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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Genrich <daniel.genrich@gmx.net>2012-08-26 17:34:17 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2012-08-26 17:34:17 +0400
commitb61abd4fe0da70ce52acf29c065df2af68e2eabe (patch)
tree67eb2668ca92240580a62f4358f7bc464c938b2e
parent43bb431548436b6b1699f795acd107de0f6b86a8 (diff)
parent25a925ceabb9987c0204df32200b664dcc1aaf44 (diff)
Merge from trunk r49908-r50219smoke2
-rw-r--r--CMakeLists.txt5
-rw-r--r--GNUmakefile6
-rw-r--r--build_files/cmake/config/blender_lite.cmake1
-rw-r--r--build_files/scons/config/win64-mingw-config.py2
-rw-r--r--build_files/scons/tools/Blender.py2
-rw-r--r--build_files/scons/tools/btools.py5
-rw-r--r--doc/python_api/rst/info_best_practice.rst46
-rw-r--r--doc/python_api/rst/info_gotcha.rst4
-rw-r--r--extern/recastnavigation/Recast/Source/RecastFilter.cpp4
-rw-r--r--intern/CMakeLists.txt5
-rw-r--r--intern/cycles/CMakeLists.txt1
-rw-r--r--intern/cycles/bvh/bvh.cpp4
-rw-r--r--intern/ghost/GHOST_C-api.h491
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h2
-rw-r--r--intern/guardedalloc/intern/mallocn.c4
-rw-r--r--intern/iksolver/CMakeLists.txt2
-rw-r--r--intern/iksolver/SConscript2
-rw-r--r--release/scripts/modules/addon_utils.py2
-rwxr-xr-xrelease/scripts/modules/blend_render_info.py2
-rw-r--r--release/scripts/modules/bpy/path.py2
-rw-r--r--release/scripts/modules/bpy/utils.py41
-rw-r--r--release/scripts/modules/bpy_extras/anim_utils.py27
-rw-r--r--release/scripts/modules/console_python.py34
-rw-r--r--release/scripts/modules/rna_xml.py6
-rw-r--r--release/scripts/startup/bl_operators/console.py19
-rw-r--r--release/scripts/startup/bl_operators/node.py10
-rw-r--r--release/scripts/startup/bl_operators/wm.py32
-rw-r--r--release/scripts/startup/bl_ui/properties_animviz.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_data_curve.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_data_lamp.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_mask_common.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_particle.py4
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_field.py2
-rw-r--r--release/scripts/startup/bl_ui/space_console.py1
-rw-r--r--release/scripts/startup/bl_ui/space_image.py2
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py102
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py7
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py4
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py2
-rw-r--r--release/scripts/templates/addon_add_object.py12
-rw-r--r--release/scripts/templates/operator_mesh_add.py6
-rw-r--r--source/blender/blenfont/intern/blf_dir.c5
-rw-r--r--source/blender/blenfont/intern/blf_font.c26
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c35
-rw-r--r--source/blender/blenkernel/BKE_colortools.h33
-rw-r--r--source/blender/blenkernel/BKE_context.h4
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h4
-rw-r--r--source/blender/blenkernel/BKE_font.h4
-rw-r--r--source/blender/blenkernel/BKE_mask.h6
-rw-r--r--source/blender/blenkernel/BKE_material.h1
-rw-r--r--source/blender/blenkernel/BKE_mball.h4
-rw-r--r--source/blender/blenkernel/BKE_node.h30
-rw-r--r--source/blender/blenkernel/BKE_object.h4
-rw-r--r--source/blender/blenkernel/BKE_packedFile.h1
-rw-r--r--source/blender/blenkernel/BKE_screen.h2
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h55
-rw-r--r--source/blender/blenkernel/CMakeLists.txt1
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.c9
-rw-r--r--source/blender/blenkernel/intern/CCGSubSurf.h2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c8
-rw-r--r--source/blender/blenkernel/intern/anim.c24
-rw-r--r--source/blender/blenkernel/intern/armature.c4
-rw-r--r--source/blender/blenkernel/intern/boids.c2
-rw-r--r--source/blender/blenkernel/intern/brush.c5
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c12
-rw-r--r--source/blender/blenkernel/intern/colortools.c179
-rw-r--r--source/blender/blenkernel/intern/constraint.c3
-rw-r--r--source/blender/blenkernel/intern/curve.c44
-rw-r--r--source/blender/blenkernel/intern/customdata.c155
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c12
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c4
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c6
-rw-r--r--source/blender/blenkernel/intern/fcurve.c23
-rw-r--r--source/blender/blenkernel/intern/font.c115
-rw-r--r--source/blender/blenkernel/intern/gpencil.c2
-rw-r--r--source/blender/blenkernel/intern/group.c22
-rw-r--r--source/blender/blenkernel/intern/idprop.c10
-rw-r--r--source/blender/blenkernel/intern/image.c51
-rw-r--r--source/blender/blenkernel/intern/ipo.c3
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/mask.c18
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c56
-rw-r--r--source/blender/blenkernel/intern/material.c35
-rw-r--r--source/blender/blenkernel/intern/mball.c374
-rw-r--r--source/blender/blenkernel/intern/mesh.c28
-rw-r--r--source/blender/blenkernel/intern/nla.c2
-rw-r--r--source/blender/blenkernel/intern/node.c162
-rw-r--r--source/blender/blenkernel/intern/object.c34
-rw-r--r--source/blender/blenkernel/intern/packedFile.c12
-rw-r--r--source/blender/blenkernel/intern/scene.c20
-rw-r--r--source/blender/blenkernel/intern/seqcache.c122
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c32
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c651
-rw-r--r--source/blender/blenkernel/intern/sequencer.c437
-rw-r--r--source/blender/blenkernel/intern/sound.c38
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c37
-rw-r--r--source/blender/blenkernel/intern/texture.c2
-rw-r--r--source/blender/blenkernel/intern/world.c3
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c129
-rw-r--r--source/blender/blenlib/BLI_listbase.h2
-rw-r--r--source/blender/blenlib/BLI_math_base.h24
-rw-r--r--source/blender/blenlib/BLI_math_rotation.h7
-rw-r--r--source/blender/blenlib/BLI_pbvh.h4
-rw-r--r--source/blender/blenlib/BLI_rect.h26
-rw-r--r--source/blender/blenlib/BLI_string.h7
-rw-r--r--source/blender/blenlib/BLI_utildefines.h24
-rw-r--r--source/blender/blenlib/BLI_vfontdata.h12
-rw-r--r--source/blender/blenlib/intern/freetypefont.c13
-rw-r--r--source/blender/blenlib/intern/listbase.c38
-rw-r--r--source/blender/blenlib/intern/math_rotation.c240
-rw-r--r--source/blender/blenlib/intern/pbvh.c4
-rw-r--r--source/blender/blenlib/intern/rct.c40
-rw-r--r--source/blender/blenlib/intern/string.c19
-rw-r--r--source/blender/blenlib/intern/voronoi.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c47
-rw-r--r--source/blender/blenloader/intern/versioning_250.c8
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c4
-rw-r--r--source/blender/blenloader/intern/writefile.c46
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c9
-rw-r--r--source/blender/bmesh/intern/bmesh_error.h6
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c52
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.h1
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c33
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c9
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c5
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c68
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c7
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c199
-rw-r--r--source/blender/bmesh/operators/bmo_create.c2
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c8
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c34
-rw-r--r--source/blender/collada/AnimationExporter.h4
-rw-r--r--source/blender/collada/AnimationImporter.cpp2
-rw-r--r--source/blender/collada/EffectExporter.cpp72
-rw-r--r--source/blender/collada/GeometryExporter.cpp19
-rw-r--r--source/blender/collada/ImageExporter.cpp30
-rw-r--r--source/blender/collada/InstanceWriter.cpp2
-rw-r--r--source/blender/collada/TransformReader.h2
-rw-r--r--source/blender/collada/collada_internal.h2
-rw-r--r--source/blender/compositor/CMakeLists.txt10
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrder.cpp2
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrder.h2
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp4
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp34
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.h4
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp16
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.h2
-rw-r--r--source/blender/compositor/intern/COM_SocketReader.h6
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp42
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.cpp6
-rw-r--r--source/blender/compositor/nodes/COM_BokehBlurNode.cpp9
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.cpp50
-rw-r--r--source/blender/compositor/nodes/COM_DespeckleNode.h36
-rw-r--r--source/blender/compositor/nodes/COM_DistanceMatteNode.cpp33
-rw-r--r--source/blender/compositor/nodes/COM_TimeNode.cpp1
-rw-r--r--source/blender/compositor/operations/COM_AntiAliasOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_BlurBaseOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_BokehImageOperation.h91
-rw-r--r--source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ColorCurveOperation.cpp42
-rw-r--r--source/blender/compositor/operations/COM_ColorCurveOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_CurveBaseOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_CurveBaseOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_DespeckleOperation.cpp139
-rw-r--r--source/blender/compositor/operations/COM_DespeckleOperation.h49
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.cpp10
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp (renamed from source/blender/compositor/operations/COM_DistanceMatteOperation.cpp)26
-rw-r--r--source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h (renamed from source/blender/compositor/operations/COM_DistanceMatteOperation.h)13
-rw-r--r--source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp35
-rw-r--r--source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h43
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp15
-rw-r--r--source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp3
-rw-r--r--source/blender/compositor/operations/COM_GlareGhostOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_MovieDistortionOperation.h13
-rw-r--r--source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ReadBufferOperation.h2
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp72
-rw-r--r--source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h4
-rw-r--r--source/blender/compositor/operations/COM_VectorBlurOperation.cpp9
-rw-r--r--source/blender/compositor/operations/COM_VectorCurveOperation.cpp1
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c6
-rw-r--r--source/blender/editors/animation/anim_deps.c97
-rw-r--r--source/blender/editors/animation/anim_filter.c2
-rw-r--r--source/blender/editors/animation/anim_markers.c5
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c4
-rw-r--r--source/blender/editors/animation/keyframes_edit.c2
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c31
-rw-r--r--source/blender/editors/include/ED_clip.h2
-rw-r--r--source/blender/editors/include/ED_image.h1
-rw-r--r--source/blender/editors/include/ED_node.h5
-rw-r--r--source/blender/editors/include/UI_interface.h98
-rw-r--r--source/blender/editors/include/UI_view2d.h4
-rw-r--r--source/blender/editors/interface/interface.c499
-rw-r--r--source/blender/editors/interface/interface_draw.c79
-rw-r--r--source/blender/editors/interface/interface_handlers.c261
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/interface/interface_intern.h40
-rw-r--r--source/blender/editors/interface/interface_layout.c39
-rw-r--r--source/blender/editors/interface/interface_ops.c77
-rw-r--r--source/blender/editors/interface/interface_panel.c70
-rw-r--r--source/blender/editors/interface/interface_regions.c347
-rw-r--r--source/blender/editors/interface/interface_style.c12
-rw-r--r--source/blender/editors/interface/interface_templates.c71
-rw-r--r--source/blender/editors/interface/interface_widgets.c160
-rw-r--r--source/blender/editors/interface/resources.c8
-rw-r--r--source/blender/editors/interface/view2d.c128
-rw-r--r--source/blender/editors/interface/view2d_ops.c108
-rw-r--r--source/blender/editors/io/io_collada.c8
-rw-r--r--source/blender/editors/mask/mask_add.c46
-rw-r--r--source/blender/editors/mask/mask_draw.c11
-rw-r--r--source/blender/editors/mask/mask_select.c4
-rw-r--r--source/blender/editors/mesh/editface.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c106
-rw-r--r--source/blender/editors/object/object_bake.c30
-rw-r--r--source/blender/editors/object/object_edit.c12
-rw-r--r--source/blender/editors/object/object_group.c3
-rw-r--r--source/blender/editors/object/object_modifier.c27
-rw-r--r--source/blender/editors/object/object_select.c8
-rw-r--r--source/blender/editors/object/object_transform.c2
-rw-r--r--source/blender/editors/object/object_vgroup.c5
-rw-r--r--source/blender/editors/physics/particle_edit.c2
-rw-r--r--source/blender/editors/physics/physics_fluid.c15
-rw-r--r--source/blender/editors/render/render_internal.c18
-rw-r--r--source/blender/editors/render/render_opengl.c2
-rw-r--r--source/blender/editors/render/render_preview.c44
-rw-r--r--source/blender/editors/screen/area.c64
-rw-r--r--source/blender/editors/screen/glutil.c21
-rw-r--r--source/blender/editors/screen/screen_edit.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c14
-rw-r--r--source/blender/editors/screen/screendump.c24
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c5
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c44
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c11
-rw-r--r--source/blender/editors/space_action/action_draw.c2
-rw-r--r--source/blender/editors/space_action/action_edit.c4
-rw-r--r--source/blender/editors/space_action/action_select.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c2
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c3
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c3
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_draw.c8
-rw-r--r--source/blender/editors/space_clip/clip_editor.c57
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c8
-rw-r--r--source/blender/editors/space_clip/clip_ops.c28
-rw-r--r--source/blender/editors/space_clip/space_clip.c4
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c37
-rw-r--r--source/blender/editors/space_clip/tracking_select.c4
-rw-r--r--source/blender/editors/space_console/space_console.c3
-rw-r--r--source/blender/editors/space_file/file_ops.c4
-rw-r--r--source/blender/editors/space_file/filelist.c15
-rw-r--r--source/blender/editors/space_file/filesel.c8
-rw-r--r--source/blender/editors/space_file/space_file.c4
-rw-r--r--source/blender/editors/space_graph/graph_draw.c4
-rw-r--r--source/blender/editors/space_graph/graph_edit.c70
-rw-r--r--source/blender/editors/space_graph/graph_select.c2
-rw-r--r--source/blender/editors/space_image/image_buttons.c24
-rw-r--r--source/blender/editors/space_image/image_draw.c3
-rw-r--r--source/blender/editors/space_image/image_edit.c11
-rw-r--r--source/blender/editors/space_image/image_ops.c54
-rw-r--r--source/blender/editors/space_image/space_image.c10
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c8
-rw-r--r--source/blender/editors/space_logic/logic_window.c36
-rw-r--r--source/blender/editors/space_logic/space_logic.c48
-rw-r--r--source/blender/editors/space_nla/nla_edit.c4
-rw-r--r--source/blender/editors/space_nla/nla_select.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c32
-rw-r--r--source/blender/editors/space_node/node_add.c4
-rw-r--r--source/blender/editors/space_node/node_draw.c26
-rw-r--r--source/blender/editors/space_node/node_edit.c100
-rw-r--r--source/blender/editors/space_node/node_group.c7
-rw-r--r--source/blender/editors/space_node/node_intern.h1
-rw-r--r--source/blender/editors/space_node/node_ops.c6
-rw-r--r--source/blender/editors/space_node/node_relationships.c9
-rw-r--r--source/blender/editors/space_node/node_select.c91
-rw-r--r--source/blender/editors/space_node/node_templates.c2
-rw-r--r--source/blender/editors/space_node/node_view.c69
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c10
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c2
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c59
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c148
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h16
-rw-r--r--source/blender/editors/space_sequencer/sequencer_modifier.c222
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c30
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c221
-rw-r--r--source/blender/editors/space_text/text_draw.c3
-rw-r--r--source/blender/editors/space_text/text_ops.c4
-rw-r--r--source/blender/editors/space_time/time_ops.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c342
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c28
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c260
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h1
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c25
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c13
-rw-r--r--source/blender/editors/transform/transform.c23
-rw-r--r--source/blender/editors/transform/transform_conversions.c13
-rw-r--r--source/blender/editors/transform/transform_generics.c11
-rw-r--r--source/blender/editors/transform/transform_manipulator.c32
-rw-r--r--source/blender/editors/transform/transform_orientations.c30
-rw-r--r--source/blender/editors/transform/transform_snap.c4
-rw-r--r--source/blender/editors/util/undo.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c14
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c10
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c6
-rw-r--r--source/blender/gpu/intern/gpu_draw.c10
-rw-r--r--source/blender/gpu/intern/gpu_material.c1
-rw-r--r--source/blender/ikplugin/CMakeLists.txt17
-rw-r--r--source/blender/ikplugin/SConscript1
-rw-r--r--source/blender/ikplugin/intern/ikplugin_api.c16
-rw-r--r--source/blender/imbuf/IMB_imbuf.h4
-rw-r--r--source/blender/imbuf/IMB_imbuf_types.h4
-rw-r--r--source/blender/imbuf/IMB_moviecache.h2
-rw-r--r--source/blender/imbuf/IMB_thumbs.h8
-rw-r--r--source/blender/imbuf/intern/anim_movie.c4
-rw-r--r--source/blender/imbuf/intern/dds/CMakeLists.txt1
-rw-r--r--source/blender/imbuf/intern/dds/SConscript3
-rw-r--r--source/blender/imbuf/intern/dds/dds_api.cpp15
-rw-r--r--source/blender/imbuf/intern/imbuf_cocoa.m27
-rw-r--r--source/blender/imbuf/intern/indexer.c6
-rw-r--r--source/blender/imbuf/intern/openexr/CMakeLists.txt1
-rw-r--r--source/blender/imbuf/intern/openexr/SConscript4
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp208
-rw-r--r--source/blender/imbuf/intern/scaling.c2
-rw-r--r--source/blender/imbuf/intern/tiff.c10
-rw-r--r--source/blender/imbuf/intern/util.c51
-rw-r--r--source/blender/makesdna/DNA_color_types.h6
-rw-r--r--source/blender/makesdna/DNA_curve_types.h32
-rw-r--r--source/blender/makesdna/DNA_mask_types.h17
-rw-r--r--source/blender/makesdna/DNA_particle_types.h4
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h83
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h3
-rw-r--r--source/blender/makesdna/DNA_vfont_types.h4
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/makesrna.c8
-rw-r--r--source/blender/makesrna/intern/rna_color.c10
-rw-r--r--source/blender/makesrna/intern/rna_mask.c3
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c41
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c25
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_object.c4
-rw-r--r--source/blender/makesrna/intern/rna_particle.c5
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c465
-rw-r--r--source/blender/makesrna/intern/rna_space.c13
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c11
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c6
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c12
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c21
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim.c4
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c6
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c10
-rw-r--r--source/blender/modifiers/intern/MOD_particlesystem.c4
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c4
-rw-r--r--source/blender/nodes/CMakeLists.txt5
-rw-r--r--source/blender/nodes/NOD_composite.h1
-rw-r--r--source/blender/nodes/SConscript3
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c131
-rw-r--r--source/blender/nodes/composite/node_composite_util.c6
-rw-r--r--source/blender/nodes/composite/node_composite_util.h7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c11
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bilateralblur.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehimage.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_boxmask.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_brightness.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorcorrection.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_common.c34
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c36
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_despeckle.c73
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_directionalblur.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_displace.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_ellipsemask.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_flip.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_gamma.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_glare.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_idMask.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c16
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_inpaint.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keying.c11
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keyingscreen.c11
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lensdist.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapUV.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapValue.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_movieclip.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normal.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normalize.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_outputFile.c11
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_premulkey.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rgb.c22
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rotate.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c15
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_setalpha.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_splitViewer.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_stabilize2d.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_tonemap.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_trackpos.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_transform.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_translate.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_valToRgb.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_value.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_vecBlur.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_viewer.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_zcombine.c7
-rw-r--r--source/blender/nodes/intern/node_common.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_attribute.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_curves.c7
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_geom.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mapping.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_material.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_checker.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_gradient.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_magic.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_noise.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_sky.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_wave.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_valToRgb.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c5
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_output.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_proc.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_valToRgb.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_api.c6
-rw-r--r--source/blender/python/bmesh/bmesh_py_ops.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c436
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.c110
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c62
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_select.c40
-rw-r--r--source/blender/python/bmesh/bmesh_py_utils.c44
-rw-r--r--source/blender/python/intern/bpy.c8
-rw-r--r--source/blender/python/intern/bpy_operator.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.h4
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c2
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m4
-rw-r--r--source/blender/quicktime/apple/qtkit_import.m8
-rw-r--r--source/blender/render/intern/include/rayobject.h19
-rw-r--r--source/blender/render/intern/source/convertblender.c15
-rw-r--r--source/blender/render/intern/source/imagetexture.c24
-rw-r--r--source/blender/render/intern/source/initrender.c4
-rw-r--r--source/blender/render/intern/source/pipeline.c21
-rw-r--r--source/blender/render/intern/source/pointdensity.c1
-rw-r--r--source/blender/render/intern/source/render_result.c9
-rw-r--r--source/blender/render/intern/source/render_texture.c4
-rw-r--r--source/blender/render/intern/source/rendercore.c8
-rw-r--r--source/blender/render/intern/source/shadbuf.c16
-rw-r--r--source/blender/render/intern/source/shadeoutput.c1
-rw-r--r--source/blender/windowmanager/WM_api.h41
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c29
-rw-r--r--source/blender/windowmanager/intern/wm_files.c6
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c4
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c18
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c351
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c20
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c53
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c12
-rw-r--r--source/blender/windowmanager/intern/wm_window.c14
-rw-r--r--source/blender/windowmanager/wm_event_types.h18
-rw-r--r--source/blenderplayer/CMakeLists.txt2
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c4
-rw-r--r--source/creator/CMakeLists.txt5
-rw-r--r--source/creator/creator.c4
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp2
-rw-r--r--source/gameengine/Converter/KX_ConvertSensors.cpp24
-rw-r--r--source/gameengine/Expressions/BoolValue.cpp2
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.cpp75
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_Application.h1
-rw-r--r--source/gameengine/GamePlayer/ghost/GPG_ghost.cpp4
-rw-r--r--source/gameengine/Ketsji/BL_Texture.cpp7
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp4
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp3
-rw-r--r--source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h2
-rw-r--r--source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h2
-rw-r--r--source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h2
-rw-r--r--source/gameengine/SceneGraph/SG_ParentRelation.h2
-rw-r--r--source/gameengine/VideoTexture/ImageBuff.cpp2
-rw-r--r--source/gameengine/VideoTexture/ImageBuff.h2
-rw-r--r--source/gameengine/VideoTexture/VideoFFmpeg.cpp6
532 files changed, 9784 insertions, 5084 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ac3920ad085..3bc215b3faa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -126,11 +126,13 @@ option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid d
option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF)
option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON)
option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
+option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effects)" ON)
option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_GAMEENGINE "Enable Game Engine" ON)
option(WITH_PLAYER "Build Player" OFF)
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
+option(WITH_COMPOSITOR_LEGACY "Enable legacy compositor" ON)
# GHOST Windowing Library Options
option(WITH_GHOST_DEBUG "Enable debugging output for the GHOST library" OFF)
@@ -1041,6 +1043,8 @@ elseif(WIN32)
set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread")
add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
+ #Turn off OpenMP since it causes crashes on render for subsurfed/multiresolution meshes
+ set(WITH_OPENMP OFF)
endif()
add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
@@ -1795,6 +1799,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_GAMEENGINE)
info_cfg_option(WITH_PLAYER)
info_cfg_option(WITH_BULLET)
+ info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_FFTW3)
diff --git a/GNUmakefile b/GNUmakefile
index 88ce32959af..f48ac5c2e41 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -19,9 +19,9 @@
#
# ##### END GPL LICENSE BLOCK #####
-# This Makefile does an out-of-source CMake build in ../build/`OS`_`CPU`
+# This Makefile does an out-of-source CMake build in ../build_`OS`_`CPU`
# eg:
-# ../build/Linux_i386
+# ../build_linux_i386
# This is for users who like to configure & build blender with a single command.
@@ -40,7 +40,7 @@ ifndef BUILD_CMAKE_ARGS
endif
ifndef BUILD_DIR
- BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build/$(OS_NCASE)
+ BUILD_DIR:=$(shell dirname $(BLENDER_DIR))/build_$(OS_NCASE)
endif
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index 06a82261795..b834cd37a8a 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -18,6 +18,7 @@ set(WITH_LIBMV OFF CACHE FORCE BOOL)
set(WITH_GAMEENGINE OFF CACHE FORCE BOOL)
set(WITH_COMPOSITOR OFF CACHE FORCE BOOL)
set(WITH_GHOST_XDND OFF CACHE FORCE BOOL)
+set(WITH_IK_SOLVER OFF CACHE FORCE BOOL)
set(WITH_IK_ITASC OFF CACHE FORCE BOOL)
set(WITH_IMAGE_CINEON OFF CACHE FORCE BOOL)
set(WITH_IMAGE_DDS OFF CACHE FORCE BOOL)
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index 27286439297..ffd37065e35 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -170,7 +170,7 @@ WITH_BF_RAYOPTIMIZATION = True
BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2']
#May produce errors with unsupported MinGW-w64 builds
-WITH_BF_OPENMP = True
+WITH_BF_OPENMP = False
##
CC = 'gcc'
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 56d13649cd1..4ab020dc26a 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -845,6 +845,8 @@ class BlenderEnvironment(SConsEnvironment):
print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
lenv = self.Clone()
lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
+ if lenv['OURPLATFORM'] in ('win32-mingw', 'win64-mingw', 'linuxcross', 'cygwin', 'linux'):
+ lenv.Replace(LINK = '$CXX')
if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'):
if lenv['BF_DEBUG']:
lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb','/NODEFAULTLIB:libcmt'])
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index 8f5bb1ffc57..2fa503f3f26 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -108,7 +108,7 @@ def validate_arguments(args, bc):
'WITH_BF_STATICFFMPEG', 'BF_FFMPEG_LIB_STATIC',
'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
'WITH_BF_FRAMESERVER',
- 'WITH_BF_COMPOSITOR',
+ 'WITH_BF_COMPOSITOR', 'WITH_BF_COMPOSITOR_LEGACY',
'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH',
@@ -583,7 +583,8 @@ def read_opts(env, cfg, args):
('BF_BOOST_LIBPATH', 'Boost library path', ''),
('BF_BOOST_LIB_STATIC', 'Boost static library', ''),
- (BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True))
+ (BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True)),
+ (BoolVariable('WITH_BF_COMPOSITOR_LEGACY', 'Enable the legacy compositor', True))
) # end of opts.AddOptions()
return localopts
diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst
index 37de8fa381d..1e12daba893 100644
--- a/doc/python_api/rst/info_best_practice.rst
+++ b/doc/python_api/rst/info_best_practice.rst
@@ -75,7 +75,7 @@ Example layouts:
* layout.row()
- Use row(), when you want more than 1 propertey in one line.
+ Use row(), when you want more than 1 property in one line.
.. code-block:: python
@@ -145,7 +145,7 @@ Even though you're not looping on the list data **python is**, so you need to be
Modifying Lists
^^^^^^^^^^^^^^^
-In python we can add and remove from a list, This is slower when the list length is modified, especially at the start of the list, since all the data after the index of modification needs to be moved up or down 1 place.
+In python we can add and remove from a list, this is slower when the list length is modified, especially at the start of the list, since all the data after the index of modification needs to be moved up or down 1 place.
The most simple way to add onto the end of the list is to use ``my_list.append(list_item)`` or ``my_list.extend(some_list)`` and the fastest way to remove an item is ``my_list.pop()`` or ``del my_list[-1]``.
@@ -154,13 +154,13 @@ To use an index you can use ``my_list.insert(index, list_item)`` or ``list.pop(i
Sometimes its faster (but more memory hungry) to just rebuild the list.
-Say you want to remove all triangle faces in a list.
+Say you want to remove all triangular faces in a list.
Rather than...
.. code-block:: python
- faces = mesh.faces[:] # make a list copy of the meshes faces
+ faces = mesh.tessfaces[:] # make a list copy of the meshes faces
f_idx = len(faces) # Loop backwards
while f_idx: # while the value is not 0
f_idx -= 1
@@ -173,13 +173,13 @@ It's faster to build a new list with list comprehension.
.. code-block:: python
- faces = [f for f in mesh.faces if len(f.vertices) != 3]
+ faces = [f for f in mesh.tessfaces if len(f.vertices) != 3]
Adding List Items
^^^^^^^^^^^^^^^^^
-If you have a list that you want to add onto another list, rather then...
+If you have a list that you want to add onto another list, rather than...
.. code-block:: python
@@ -205,6 +205,14 @@ This example shows a very sub-optimal way of making a reversed list.
reverse_list.insert(0, list_item)
+Python provides more convenient ways to reverse a list using the slice method, but you may want to time this before relying on it too much:
+
+
+.. code-block:: python
+
+ some_reversed_list = some_list[::-1]
+
+
Removing List Items
^^^^^^^^^^^^^^^^^^^
@@ -224,7 +232,7 @@ Here is an example of how to remove items in 1 loop, removing the last items fir
my_list.pop(list_index)
-This example shows a fast way of removing items, for use in cases were where you can alter the list order without breaking the scripts functionality. This works by swapping 2 list items, so the item you remove is always last.
+This example shows a fast way of removing items, for use in cases where you can alter the list order without breaking the scripts functionality. This works by swapping 2 list items, so the item you remove is always last.
.. code-block:: python
@@ -243,9 +251,9 @@ When removing many items in a large list this can provide a good speedup.
Avoid Copying Lists
^^^^^^^^^^^^^^^^^^^
-When passing a list/dictionary to a function, it is faster to have the function modify the list rather then returning a new list so python doesn't have to duplicate the list in memory.
+When passing a list/dictionary to a function, it is faster to have the function modify the list rather than returning a new list so python doesn't have to duplicate the list in memory.
-Functions that modify a list in-place are more efficient then functions that create new lists.
+Functions that modify a list in-place are more efficient than functions that create new lists.
This is generally slower so only use for functions when it makes sense not to modify the list in place.
@@ -273,22 +281,22 @@ Here are 3 ways of joining multiple strings into 1 string for writing
This really applies to any area of your code that involves a lot of string joining.
-Pythons string addition, *don't use if you can help it, especially when writing data in a loop.*
+Python’s string addition, *don't use if you can help it, especially when writing data in a loop.*
>>> file.write(str1 + " " + str2 + " " + str3 + "\n")
-String formatting. Use this when you're writing string data from floats and int's
+String formatting. Use this when you're writing string data from floats and ints
>>> file.write("%s %s %s\n" % (str1, str2, str3))
-Pythons string joining function. To join a list of strings
+Python’s string joining function. To join a list of strings
>>> file.write(" ".join([str1, str2, str3, "\n"]))
-join is fastest on many strings, string formatting is quite fast too (better for converting data types). String arithmetic is slowest.
+join is fastest on many strings, `string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`_ is quite fast too (better for converting data types). String arithmetic is slowest.
Parsing Strings (Import/Exporting)
@@ -296,12 +304,12 @@ Parsing Strings (Import/Exporting)
Since many file formats are ASCII, the way you parse/export strings can make a large difference in how fast your script runs.
-When importing strings to make into blender there are a few ways to parse the string.
+There are a few ways to parse strings when importing them into Blender.
Parsing Numbers
^^^^^^^^^^^^^^^
-Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``, float() will work for an int too but its faster to read ints with int().
+Use ``float(string)`` rather than ``eval(string)``, if you know the value will be an int then ``int(string)``, float() will work for an int too but it's faster to read ints with int().
Checking String Start/End
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -318,7 +326,7 @@ Using ``startswith()`` is slightly faster (approx 5%) and also avoids a possible
my_string.endswith("foo_bar") can be used for line endings too.
-if your unsure whether the text is upper or lower case use lower or upper string function.
+If you are unsure whether the text is upper or lower case use ``lower()`` or ``upper()`` string function.
>>> if line.lower().startswith("vert ")
@@ -328,7 +336,7 @@ Use try/except Sparingly
The **try** statement is useful to save time writing error checking code.
-However **try** is significantly slower then an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times.
+However **try** is significantly slower than an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times.
There are cases where using **try** is faster than checking whether the condition will raise an error, so it is worth experimenting.
@@ -336,7 +344,7 @@ There are cases where using **try** is faster than checking whether the conditio
Value Comparison
----------------
-Python has two ways to compare values ``a == b`` and ``a is b``, The difference is that ``==`` may run the objects comparison function ``__cmp__()`` where as ``is`` compares identity, that both variables reference the same item in memory.
+Python has two ways to compare values ``a == b`` and ``a is b``, the difference is that ``==`` may run the objects comparison function ``__cmp__()`` whereas ``is`` compares identity, that both variables reference the same item in memory.
In cases where you know you are checking for the same value which is referenced from multiple places, ``is`` is faster.
@@ -344,7 +352,7 @@ In cases where you know you are checking for the same value which is referenced
Time Your Code
--------------
-While developing a script its good to time it to be aware of any changes in performance, this can be done simply.
+While developing a script it's good to time it to be aware of any changes in performance, this can be done simply.
.. code-block:: python
diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst
index eb312799b41..1d561216b52 100644
--- a/doc/python_api/rst/info_gotcha.rst
+++ b/doc/python_api/rst/info_gotcha.rst
@@ -137,11 +137,11 @@ For the time being this limitation just has to be worked around but we're aware
NGons and Tessellation Faces
============================
-Since 2.63 NGons are supported, this adds some complexity since in some cases you need to access triangles still (some exporters for example).
+Since 2.63 NGons are supported, this adds some complexity since in some cases you need to access triangles/quads still (some exporters for example).
There are now 3 ways to access faces:
-* :class:`bpy.types.MeshPolygon` - this is the data stricture which now stores faces in object mode (access as ``mesh.polygons`` rather then ``mesh.faces``).
+* :class:`bpy.types.MeshPolygon` - this is the data structure which now stores faces in object mode (access as ``mesh.polygons`` rather then ``mesh.faces``).
* :class:`bpy.types.MeshTessFace` - the result of triangulating (tessellated) polygons, the main method of face access in 2.62 or older (access as ``mesh.tessfaces``).
* :class:`bmesh.types.BMFace` - the polygons as used in editmode.
diff --git a/extern/recastnavigation/Recast/Source/RecastFilter.cpp b/extern/recastnavigation/Recast/Source/RecastFilter.cpp
index bf985c362c9..9df71ea3fbf 100644
--- a/extern/recastnavigation/Recast/Source/RecastFilter.cpp
+++ b/extern/recastnavigation/Recast/Source/RecastFilter.cpp
@@ -128,7 +128,7 @@ void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight, const int walk
rcSpan* ns = solid.spans[dx + dy*w];
int nbot = -walkableClimb;
int ntop = ns ? (int)ns->smin : MAX_HEIGHT;
- // Skip neightbour if the gap between the spans is too small.
+ // Skip neighbor if the gap between the spans is too small.
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
minh = rcMin(minh, nbot - bot);
@@ -137,7 +137,7 @@ void rcFilterLedgeSpans(rcContext* ctx, const int walkableHeight, const int walk
{
nbot = (int)ns->smax;
ntop = ns->next ? (int)ns->next->smin : MAX_HEIGHT;
- // Skip neightbour if the gap between the spans is too small.
+ // Skip neighbor if the gap between the spans is too small.
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
{
minh = rcMin(minh, nbot - bot);
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 2b4a84d6b39..d520ffc87b4 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -28,7 +28,6 @@ add_subdirectory(ghost)
add_subdirectory(guardedalloc)
add_subdirectory(moto)
add_subdirectory(memutil)
-add_subdirectory(iksolver)
add_subdirectory(opennl)
add_subdirectory(mikktspace)
add_subdirectory(raskter)
@@ -58,6 +57,10 @@ if(WITH_MOD_BOOLEAN)
add_subdirectory(bsp)
endif()
+if(WITH_IK_SOLVER)
+ add_subdirectory(iksolver)
+endif()
+
if(WITH_IK_ITASC)
add_subdirectory(itasc)
endif()
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 2127ad23bd3..697427081c3 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -63,7 +63,6 @@ include_directories(
# Subdirectories
if(WITH_CYCLES_BLENDER)
- add_definitions(-DBLENDER_PLUGIN)
add_subdirectory(blender)
endif()
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 4d3588452eb..b58a34f9942 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -411,7 +411,7 @@ void BVH::pack_instances(size_t nodes_size)
size_t nsize_bbox = (use_qbvh)? nsize-2: nsize-1;
int4 *bvh_nodes = &bvh->pack.nodes[0];
size_t bvh_nodes_size = bvh->pack.nodes.size();
- int *bvh_is_leaf = &bvh->pack.is_leaf[0];
+ int *bvh_is_leaf = (bvh->pack.is_leaf.size() != 0) ? &bvh->pack.is_leaf[0] : NULL;
for(size_t i = 0, j = 0; i < bvh_nodes_size; i+=nsize, j++) {
memcpy(pack_nodes + pack_nodes_offset, bvh_nodes + i, nsize_bbox*sizeof(int4));
@@ -419,7 +419,7 @@ void BVH::pack_instances(size_t nodes_size)
/* modify offsets into arrays */
int4 data = bvh_nodes[i + nsize_bbox];
- if(bvh_is_leaf[j]) {
+ if(bvh_is_leaf && bvh_is_leaf[j]) {
data.x += tri_offset;
data.y += tri_offset;
}
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 4466d614ee9..ae30458a5e5 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -26,7 +26,7 @@
*/
/** \ingroup GHOST
*
- * \file GHOST_C-api.h
+ * \file GHOST_C-api.h
* \brief GHOST C-API function and type declarations.
*/
@@ -43,7 +43,7 @@ extern "C" {
* Creates a &quot;handle&quot; for a C++ GHOST object.
* A handle is just an opaque pointer to an empty struct.
* In the API the pointer is casted to the actual C++ class.
- * \param name Name of the handle to create.
+ * \param name Name of the handle to create.
*/
GHOST_DECLARE_HANDLE(GHOST_SystemHandle);
@@ -56,48 +56,47 @@ GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
/**
* Definition of a callback routine that receives events.
- * @param event The event received.
- * @param userdata The callback's user data, supplied to GHOST_CreateSystem.
+ * \param event The event received.
+ * \param userdata The callback's user data, supplied to GHOST_CreateSystem.
*/
typedef int (*GHOST_EventCallbackProcPtr)(GHOST_EventHandle event, GHOST_TUserDataPtr userdata);
/**
* Creates the one and only system.
- * @return a handle to the system.
+ * \return a handle to the system.
*/
extern GHOST_SystemHandle GHOST_CreateSystem(void);
/**
* Disposes the one and only system.
- * @param systemhandle The handle to the system
- * @return An indication of success.
+ * \param systemhandle The handle to the system
+ * \return An indication of success.
*/
extern GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle);
/**
* Creates an event consumer object
- * @param eventCallback The event callback routine.
- * @param userdata Pointer to user data returned to the callback routine.
+ * \param eventCallback The event callback routine.
+ * \param userdata Pointer to user data returned to the callback routine.
*/
extern GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
GHOST_TUserDataPtr userdata);
/**
* Disposes an event consumer object
- * @param consumerhandle Handle to the event consumer.
- * @return An indication of success.
+ * \param consumerhandle Handle to the event consumer.
+ * \return An indication of success.
*/
extern GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhandle);
-
/**
* Returns the system time.
* Returns the number of milliseconds since the start of the system process.
* Based on ANSI clock() routine.
- * @param systemhandle The handle to the system
- * @return The number of milliseconds.
+ * \param systemhandle The handle to the system
+ * \return The number of milliseconds.
*/
extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
@@ -105,12 +104,12 @@ extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
* Installs a timer.
* Note that, on most operating systems, messages need to be processed in order
* for the timer callbacks to be invoked.
- * @param systemhandle The handle to the system
- * @param delay The time to wait for the first call to the timerProc (in milliseconds)
- * @param interval The interval between calls to the timerProc (in milliseconds)
- * @param timerProc The callback invoked when the interval expires,
- * @param userData Placeholder for user data.
- * @return A timer task (0 if timer task installation failed).
+ * \param systemhandle The handle to the system
+ * \param delay The time to wait for the first call to the timerProc (in milliseconds)
+ * \param interval The interval between calls to the timerProc (in milliseconds)
+ * \param timerProc The callback invoked when the interval expires,
+ * \param userData Placeholder for user data.
+ * \return A timer task (0 if timer task installation failed).
*/
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
GHOST_TUns64 delay,
@@ -120,9 +119,9 @@ extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
/**
* Removes a timer.
- * @param systemhandle The handle to the system
- * @param timerTask Timer task to be removed.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param timerTask Timer task to be removed.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
GHOST_TimerTaskHandle timertaskhandle);
@@ -133,17 +132,17 @@ extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
/**
* Returns the number of displays on this system.
- * @param systemhandle The handle to the system
- * @return The number of displays.
+ * \param systemhandle The handle to the system
+ * \return The number of displays.
*/
extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
/**
* Returns the dimensions of the main display on this system.
- * @param systemhandle The handle to the system
- * @param width A pointer the width gets put in
- * @param height A pointer the height gets put in
- * @return void.
+ * \param systemhandle The handle to the system
+ * \param width A pointer the width gets put in
+ * \param height A pointer the height gets put in
+ * \return void.
*/
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
GHOST_TUns32 *width,
@@ -153,17 +152,17 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
* Create a new window.
* The new window is added to the list of windows managed.
* Never explicitly delete the window, use disposeWindow() instead.
- * @param systemhandle The handle to the system
- * @param title The name of the window (displayed in the title bar of the window if the OS supports it).
- * @param left The coordinate of the left edge of the window.
- * @param top The coordinate of the top edge of the window.
- * @param width The width the window.
- * @param height The height the window.
- * @param state The state of the window when opened.
- * @param type The type of drawing context installed in this window.
- * @param stereoVisual Stereo visual for quad buffered stereo.
- * @param numOfAASamples Number of samples used for AA (zero if no AA)
- * @return A handle to the new window ( == NULL if creation failed).
+ * \param systemhandle The handle to the system
+ * \param title The name of the window (displayed in the title bar of the window if the OS supports it).
+ * \param left The coordinate of the left edge of the window.
+ * \param top The coordinate of the top edge of the window.
+ * \param width The width the window.
+ * \param height The height the window.
+ * \param state The state of the window when opened.
+ * \param type The type of drawing context installed in this window.
+ * \param stereoVisual Stereo visual for quad buffered stereo.
+ * \param numOfAASamples Number of samples used for AA (zero if no AA)
+ * \return A handle to the new window ( == NULL if creation failed).
*/
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
const char *title,
@@ -178,43 +177,43 @@ extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
/**
* Returns the window user data.
- * @param windowhandle The handle to the window
- * @return The window user data.
+ * \param windowhandle The handle to the window
+ * \return The window user data.
*/
extern GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle);
-
+
/**
* Changes the window user data.
- * @param windowhandle The handle to the window
- * @param data The window user data.
+ * \param windowhandle The handle to the window
+ * \param data The window user data.
*/
extern void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle,
GHOST_TUserDataPtr userdata);
/**
* Dispose a window.
- * @param systemhandle The handle to the system
- * @param window Handle to the window to be disposed.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param windowhandle Handle to the window to be disposed.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle);
/**
* Returns whether a window is valid.
- * @param systemhandle The handle to the system
- * @param window Handle to the window to be checked.
- * @return Indication of validity.
+ * \param systemhandle The handle to the system
+ * \param windowhandle Handle to the window to be checked.
+ * \return Indication of validity.
*/
extern int GHOST_ValidWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle windowhandle);
/**
* Begins full screen mode.
- * @param systemhandle The handle to the system
- * @param setting The new setting of the display.
- * @return A handle to the window displayed in full screen.
- * This window is invalid after full screen has been ended.
+ * \param systemhandle The handle to the system
+ * \param setting The new setting of the display.
+ * \return A handle to the window displayed in full screen.
+ * This window is invalid after full screen has been ended.
*/
extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
GHOST_DisplaySetting *setting,
@@ -222,15 +221,15 @@ extern GHOST_WindowHandle GHOST_BeginFullScreen(GHOST_SystemHandle systemhandle,
/**
* Ends full screen mode.
- * @param systemhandle The handle to the system
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_EndFullScreen(GHOST_SystemHandle systemhandle);
/**
* Returns current full screen mode status.
- * @param systemhandle The handle to the system
- * @return The current status.
+ * \param systemhandle The handle to the system
+ * \return The current status.
*/
extern int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle);
@@ -240,34 +239,34 @@ extern int GHOST_GetFullScreen(GHOST_SystemHandle systemhandle);
/**
* Retrieves events from the system and stores them in the queue.
- * @param systemhandle The handle to the system
- * @param waitForEvent Boolean to indicate that ProcessEvents should
+ * \param systemhandle The handle to the system
+ * \param waitForEvent Boolean to indicate that ProcessEvents should
* wait (block) until the next event before returning.
- * @return Indication of the presence of events.
+ * \return Indication of the presence of events.
*/
extern int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent);
/**
* Retrieves events from the queue and send them to the event consumers.
- * @param systemhandle The handle to the system
- * @return Indication of the presence of events.
+ * \param systemhandle The handle to the system
+ * \return Indication of the presence of events.
*/
extern int GHOST_DispatchEvents(GHOST_SystemHandle systemhandle);
/**
* Adds the given event consumer to our list.
- * @param systemhandle The handle to the system
- * @param consumerhandle The event consumer to add.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param consumerhandle The event consumer to add.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle,
GHOST_EventConsumerHandle consumerhandle);
/**
* Remove the given event consumer to our list.
- * @param systemhandle The handle to the system
- * @param consumerhandle The event consumer to remove.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param consumerhandle The event consumer to remove.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle,
GHOST_EventConsumerHandle consumerhandle);
@@ -278,14 +277,14 @@ extern GHOST_TSuccess GHOST_RemoveEventConsumer(GHOST_SystemHandle systemhandle,
/**
* Sets the progress bar value displayed in the window/application icon
- * @param windowhandle The handle to the window
- * @param progress The progress % (0.0 to 1.0)
+ * \param windowhandle The handle to the window
+ * \param progress The progress % (0.0 to 1.0)
*/
extern GHOST_TSuccess GHOST_SetProgressBar(GHOST_WindowHandle windowhandle, float progress);
/**
* Hides the progress bar in the icon
- * @param windowhandle The handle to the window
+ * \param windowhandle The handle to the window
*/
extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle);
@@ -295,28 +294,28 @@ extern GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle);
/**
* Returns the current cursor shape.
- * @param windowhandle The handle to the window
- * @return The current cursor shape.
+ * \param windowhandle The handle to the window
+ * \return The current cursor shape.
*/
extern GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle);
/**
* Set the shape of the cursor.
- * @param windowhandle The handle to the window
- * @param cursor The new cursor shape type id.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param cursor The new cursor shape type id.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TStandardCursor cursorshape);
/**
* Set the shape of the cursor to a custom cursor.
- * @param windowhandle The handle to the window
- * @param bitmap The bitmap data for the cursor.
- * @param mask The mask data for the cursor.
- * @param hotX The X coordinate of the cursor hotspot.
- * @param hotY The Y coordinate of the cursor hotspot.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param bitmap The bitmap data for the cursor.
+ * \param mask The mask data for the cursor.
+ * \param hotX The X coordinate of the cursor hotspot.
+ * \param hotY The Y coordinate of the cursor hotspot.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
GHOST_TUns8 bitmap[16][2],
@@ -325,15 +324,15 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle
int hotY);
/**
* Set the shape of the cursor to a custom cursor of specified size.
- * @param windowhandle The handle to the window
- * @param bitmap The bitmap data for the cursor.
- * @param mask The mask data for the cursor.
- * @param sizex The width of the cursor
- * @param sizey The height of the cursor
- * @param hotX The X coordinate of the cursor hotspot.
- * @param hotY The Y coordinate of the cursor hotspot.
- * @param fg_color, bg_color Colors of the cursor
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param bitmap The bitmap data for the cursor.
+ * \param mask The mask data for the cursor.
+ * \param sizex The width of the cursor
+ * \param sizey The height of the cursor
+ * \param hotX The X coordinate of the cursor hotspot.
+ * \param hotY The Y coordinate of the cursor hotspot.
+ * \param fg_color, bg_color Colors of the cursor
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhandle,
GHOST_TUns8 *bitmap,
@@ -344,26 +343,26 @@ extern GHOST_TSuccess GHOST_SetCustomCursorShapeEx(GHOST_WindowHandle windowhand
/**
* Returns the visibility state of the cursor.
- * @param windowhandle The handle to the window
- * @return The visibility state of the cursor.
+ * \param windowhandle The handle to the window
+ * \return The visibility state of the cursor.
*/
extern int GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle);
/**
* Shows or hides the cursor.
- * @param windowhandle The handle to the window
- * @param visible The new visibility state of the cursor.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param visible The new visibility state of the cursor.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
int visible);
/**
* Returns the current location of the cursor (location in screen coordinates)
- * @param systemhandle The handle to the system
- * @param x The x-coordinate of the cursor.
- * @param y The y-coordinate of the cursor.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param x The x-coordinate of the cursor.
+ * \param y The y-coordinate of the cursor.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 *x,
@@ -372,10 +371,10 @@ extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
/**
* Updates the location of the cursor (location in screen coordinates).
* Not all operating systems allow the cursor to be moved (without the input device being moved).
- * @param systemhandle The handle to the system
- * @param x The x-coordinate of the cursor.
- * @param y The y-coordinate of the cursor.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param x The x-coordinate of the cursor.
+ * \param y The y-coordinate of the cursor.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 x,
@@ -385,10 +384,10 @@ extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
* Grabs the cursor for a modal operation, to keep receiving
* events when the mouse is outside the window. X11 only, others
* do this automatically.
- * @param windowhandle The handle to the window
- * @param mode The new grab state of the cursor.
- * @param bounds The grab ragion (optional) - left,top,right,bottom
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param mode The new grab state of the cursor.
+ * \param bounds The grab ragion (optional) - left,top,right,bottom
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
GHOST_TGrabCursorMode mode,
@@ -400,10 +399,10 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
/**
* Returns the state of a modifier key (ouside the message queue).
- * @param systemhandle The handle to the system
- * @param mask The modifier key state to retrieve.
- * @param isDown Pointer to return modifier state in.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param mask The modifier key state to retrieve.
+ * \param isDown Pointer to return modifier state in.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
GHOST_TModifierKeyMask mask,
@@ -411,10 +410,10 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
/**
* Returns the state of a mouse button (ouside the message queue).
- * @param systemhandle The handle to the system
- * @param mask The button state to retrieve.
- * @param isDown Pointer to return button state in.
- * @return Indication of success.
+ * \param systemhandle The handle to the system
+ * \param mask The button state to retrieve.
+ * \param isDown Pointer to return button state in.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
GHOST_TButtonMask mask,
@@ -429,94 +428,93 @@ extern GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept);
-
-
+
/**
* Returns the event type.
- * @param eventhandle The handle to the event
- * @return The event type.
+ * \param eventhandle The handle to the event
+ * \return The event type.
*/
extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle);
/**
* Returns the time this event was generated.
- * @param eventhandle The handle to the event
- * @return The event generation time.
+ * \param eventhandle The handle to the event
+ * \return The event generation time.
*/
extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle);
/**
* Returns the window this event was generated on,
* or NULL if it is a 'system' event.
- * @param eventhandle The handle to the event
- * @return The generating window.
+ * \param eventhandle The handle to the event
+ * \return The generating window.
*/
extern GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle);
/**
* Returns the event data.
- * @param eventhandle The handle to the event
- * @return The event data.
+ * \param eventhandle The handle to the event
+ * \return The event data.
*/
extern GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle);
/**
* Returns the timer callback.
- * @param timertaskhandle The handle to the timertask
- * @return The timer callback.
+ * \param timertaskhandle The handle to the timertask
+ * \return The timer callback.
*/
extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle);
/**
* Changes the timer callback.
- * @param timertaskhandle The handle to the timertask
- * @param timerProc The timer callback.
+ * \param timertaskhandle The handle to the timertask
+ * \param timerProc The timer callback.
*/
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
GHOST_TimerProcPtr timerProc);
/**
* Returns the timer user data.
- * @param timertaskhandle The handle to the timertask
- * @return The timer user data.
+ * \param timertaskhandle The handle to the timertask
+ * \return The timer user data.
*/
extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle);
-
+
/**
* Changes the time user data.
- * @param timertaskhandle The handle to the timertask
- * @param data The timer user data.
+ * \param timertaskhandle The handle to the timertask
+ * \param data The timer user data.
*/
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
GHOST_TUserDataPtr userData);
/**
* Returns indication as to whether the window is valid.
- * @param windowhandle The handle to the window
- * @return The validity of the window.
+ * \param windowhandle The handle to the window
+ * \return The validity of the window.
*/
extern int GHOST_GetValid(GHOST_WindowHandle windowhandle);
/**
* Returns the type of drawing context used in this window.
- * @param windowhandle The handle to the window
- * @return The current type of drawing context.
+ * \param windowhandle The handle to the window
+ * \return The current type of drawing context.
*/
extern GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle);
/**
* Tries to install a rendering context in this window.
- * @param windowhandle The handle to the window
- * @param type The type of rendering context installed.
- * @return Indication as to whether installation has succeeded.
+ * \param windowhandle The handle to the window
+ * \param type The type of rendering context installed.
+ * \return Indication as to whether installation has succeeded.
*/
extern GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
GHOST_TDrawingContextType type);
/**
* Sets the title displayed in the title bar.
- * @param windowhandle The handle to the window
- * @param title The title to display in the title bar.
+ * \param windowhandle The handle to the window
+ * \param title The title to display in the title bar.
*/
extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
const char *title);
@@ -525,57 +523,57 @@ extern void GHOST_SetTitle(GHOST_WindowHandle windowhandle,
* Returns the title displayed in the title bar. The title
* should be free'd with free().
*
- * @param windowhandle The handle to the window
- * @return The title, free with free().
+ * \param windowhandle The handle to the window
+ * \return The title, free with free().
*/
extern char *GHOST_GetTitle(GHOST_WindowHandle windowhandle);
/**
* Returns the window rectangle dimensions.
* These are screen coordinates.
- * @param windowhandle The handle to the window
- * @return A handle to the bounding rectangle of the window.
+ * \param windowhandle The handle to the window
+ * \return A handle to the bounding rectangle of the window.
*/
extern GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle);
/**
* Returns the client rectangle dimensions.
* The left and top members of the rectangle are always zero.
- * @param windowhandle The handle to the window
- * @return A handle to the bounding rectangle of the window.
+ * \param windowhandle The handle to the window
+ * \return A handle to the bounding rectangle of the window.
*/
extern GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle);
/**
* Disposes a rectangle object
- * @param rectanglehandle Handle to the rectangle.
+ * \param rectanglehandle Handle to the rectangle.
*/
void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Resizes client rectangle width.
- * @param windowhandle The handle to the window
- * @param width The new width of the client area of the window.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param width The new width of the client area of the window.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width);
/**
* Resizes client rectangle height.
- * @param windowhandle The handle to the window
- * @param height The new height of the client area of the window.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param height The new height of the client area of the window.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle,
GHOST_TUns32 height);
/**
* Resizes client rectangle.
- * @param windowhandle The handle to the window
- * @param width The new width of the client area of the window.
- * @param height The new height of the client area of the window.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param width The new width of the client area of the window.
+ * \param height The new height of the client area of the window.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
GHOST_TUns32 width,
@@ -583,11 +581,11 @@ extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
/**
* Converts a point in screen coordinates to client rectangle coordinates
- * @param windowhandle The handle to the window
- * @param inX The x-coordinate on the screen.
- * @param inY The y-coordinate on the screen.
- * @param outX The x-coordinate in the client rectangle.
- * @param outY The y-coordinate in the client rectangle.
+ * \param windowhandle The handle to the window
+ * \param inX The x-coordinate on the screen.
+ * \param inY The y-coordinate on the screen.
+ * \param outX The x-coordinate in the client rectangle.
+ * \param outY The y-coordinate in the client rectangle.
*/
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
@@ -597,11 +595,11 @@ extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
/**
* Converts a point in screen coordinates to client rectangle coordinates
- * @param windowhandle The handle to the window
- * @param inX The x-coordinate in the client rectangle.
- * @param inY The y-coordinate in the client rectangle.
- * @param outX The x-coordinate on the screen.
- * @param outY The y-coordinate on the screen.
+ * \param windowhandle The handle to the window
+ * \param inX The x-coordinate in the client rectangle.
+ * \param inY The y-coordinate in the client rectangle.
+ * \param outX The x-coordinate on the screen.
+ * \param outY The y-coordinate on the screen.
*/
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
@@ -611,88 +609,88 @@ extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
/**
* Returns the state of the window (normal, minimized, maximized).
- * @param windowhandle The handle to the window
- * @return The state of the window.
+ * \param windowhandle The handle to the window
+ * \return The state of the window.
*/
extern GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle);
/**
* Sets the state of the window (normal, minimized, maximized).
- * @param windowhandle The handle to the window
- * @param state The state of the window.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param state The state of the window.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
GHOST_TWindowState state);
-
+
/**
* Sets the window "modified" status, indicating unsaved changes
- * @param windowhandle The handle to the window
- * @param isUnsavedChanges Unsaved changes or not
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param isUnsavedChanges Unsaved changes or not
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
GHOST_TUns8 isUnsavedChanges);
-
+
/**
* Sets the order of the window (bottom, top).
- * @param windowhandle The handle to the window
- * @param order The order of the window.
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \param order The order of the window.
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle,
GHOST_TWindowOrder order);
/**
* Swaps front and back buffers of a window.
- * @param windowhandle The handle to the window
- * @return An intean success indicator.
+ * \param windowhandle The handle to the window
+ * \return An intean success indicator.
*/
extern GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle);
/**
* Activates the drawing context of this window.
- * @param windowhandle The handle to the window
- * @return An intean success indicator.
+ * \param windowhandle The handle to the window
+ * \return An intean success indicator.
*/
extern GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle);
/**
* Invalidates the contents of this window.
- * @param windowhandle The handle to the window
- * @return Indication of success.
+ * \param windowhandle The handle to the window
+ * \return Indication of success.
*/
extern GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle);
/**
* Returns the status of the tablet
- * @param windowhandle The handle to the window
- * @return Status of tablet
+ * \param windowhandle The handle to the window
+ * \return Status of tablet
*/
extern const GHOST_TabletData *GHOST_GetTabletData(GHOST_WindowHandle windowhandle);
/**
* Access to rectangle width.
- * @param rectanglehandle The handle to the rectangle
- * @return width of the rectangle
+ * \param rectanglehandle The handle to the rectangle
+ * \return width of the rectangle
*/
extern GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Access to rectangle height.
- * @param rectanglehandle The handle to the rectangle
- * @return height of the rectangle
+ * \param rectanglehandle The handle to the rectangle
+ * \return height of the rectangle
*/
extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Gets all members of the rectangle.
- * @param rectanglehandle The handle to the rectangle
- * @param l Pointer to return left coordinate in.
- * @param t Pointer to return top coordinate in.
- * @param r Pointer to return right coordinate in.
- * @param b Pointer to return bottom coordinate in.
+ * \param rectanglehandle The handle to the rectangle
+ * \param l Pointer to return left coordinate in.
+ * \param t Pointer to return top coordinate in.
+ * \param r Pointer to return right coordinate in.
+ * \param b Pointer to return bottom coordinate in.
*/
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 *l,
@@ -702,11 +700,11 @@ extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
/**
* Sets all members of the rectangle.
- * @param rectanglehandle The handle to the rectangle
- * @param l requested left coordinate of the rectangle
- * @param t requested top coordinate of the rectangle
- * @param r requested right coordinate of the rectangle
- * @param b requested bottom coordinate of the rectangle
+ * \param rectanglehandle The handle to the rectangle
+ * \param l requested left coordinate of the rectangle
+ * \param t requested top coordinate of the rectangle
+ * \param r requested right coordinate of the rectangle
+ * \param b requested bottom coordinate of the rectangle
*/
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
@@ -717,24 +715,24 @@ extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
/**
* Returns whether this rectangle is empty.
* Empty rectangles are rectangles that have width==0 and/or height==0.
- * @param rectanglehandle The handle to the rectangle
- * @return intean value (true == empty rectangle)
+ * \param rectanglehandle The handle to the rectangle
+ * \return intean value (true == empty rectangle)
*/
extern GHOST_TSuccess GHOST_IsEmptyRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Returns whether this rectangle is valid.
* Valid rectangles are rectangles that have m_l <= m_r and m_t <= m_b. Thus, emapty rectangles are valid.
- * @param rectanglehandle The handle to the rectangle
- * @return intean value (true==valid rectangle)
+ * \param rectanglehandle The handle to the rectangle
+ * \return intean value (true == valid rectangle)
*/
extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Grows (or shrinks the rectangle).
* The method avoids negative insets making the rectangle invalid
- * @param rectanglehandle The handle to the rectangle
- * @param i The amount of offset given to each extreme (negative values shrink the rectangle).
+ * \param rectanglehandle The handle to the rectangle
+ * \param i The amount of offset given to each extreme (negative values shrink the rectangle).
*/
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 i);
@@ -742,17 +740,17 @@ extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle,
/**
* Does a union of the rectangle given and this rectangle.
* The result is stored in this rectangle.
- * @param rectanglehandle The handle to the rectangle
- * @param r The rectangle that is input for the union operation.
+ * \param rectanglehandle The handle to the rectangle
+ * \param anotherrectanglehandle The rectangle that is input for the union operation.
*/
extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
/**
* Grows the rectangle to included a point.
- * @param rectanglehandle The handle to the rectangle
- * @param x The x-coordinate of the point.
- * @param y The y-coordinate of the point.
+ * \param rectanglehandle The handle to the rectangle
+ * \param x The x-coordinate of the point.
+ * \param y The y-coordinate of the point.
*/
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
@@ -761,10 +759,10 @@ extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
/**
* Returns whether the point is inside this rectangle.
* Point on the boundary is considered inside.
- * @param rectanglehandle The handle to the rectangle
- * @param x x-coordinate of point to test.
- * @param y y-coordinate of point to test.
- * @return intean value (true if point is inside).
+ * \param rectanglehandle The handle to the rectangle
+ * \param x x-coordinate of point to test.
+ * \param y y-coordinate of point to test.
+ * \return intean value (true if point is inside).
*/
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
@@ -772,9 +770,9 @@ extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehan
/**
* Returns whether the rectangle is inside this rectangle.
- * @param rectanglehandle The handle to the rectangle
- * @param r rectangle to test.
- * @return visibility (not, partially or fully visible).
+ * \param rectanglehandle The handle to the rectangle
+ * \param anotherrectanglehandle The rectangle to test.
+ * \return visibility (not, partially or fully visible).
*/
extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
@@ -782,9 +780,9 @@ extern GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rect
/**
* Sets rectangle members.
* Sets rectangle members such that it is centered at the given location.
- * @param rectanglehandle The handle to the rectangle
- * @param cx requested center x-coordinate of the rectangle
- * @param cy requested center y-coordinate of the rectangle
+ * \param rectanglehandle The handle to the rectangle
+ * \param cx Requested center x-coordinate of the rectangle
+ * \param cy Requested center y-coordinate of the rectangle
*/
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
@@ -794,11 +792,11 @@ extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
* Sets rectangle members.
* Sets rectangle members such that it is centered at the given location,
* with the width requested.
- * @param rectanglehandle The handle to the rectangle
- * @param cx requested center x-coordinate of the rectangle
- * @param cy requested center y-coordinate of the rectangle
- * @param w requested width of the rectangle
- * @param h requested height of the rectangle
+ * \param rectanglehandle The handle to the rectangle
+ * \param cx requested center x-coordinate of the rectangle
+ * \param cy requested center y-coordinate of the rectangle
+ * \param w requested width of the rectangle
+ * \param h requested height of the rectangle
*/
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
@@ -810,23 +808,23 @@ extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
* Clips a rectangle.
* Updates the rectangle given such that it will fit within this one.
* This can result in an empty rectangle.
- * @param rectanglehandle The handle to the rectangle
- * @param r the rectangle to clip
- * @return whether clipping has occurred
+ * \param rectanglehandle The handle to the rectangle
+ * \param anotherrectanglehandle The rectangle to clip
+ * \return Whether clipping has occurred
*/
extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_RectangleHandle anotherrectanglehandle);
/**
* Return the data from the clipboad
- * @param return the selection instead, X11 only feature
- * @return clipboard data
+ * \param selection Boolean to return the selection instead, X11 only feature.
+ * \return clipboard data
*/
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
/**
* Put data to the Clipboard
- * @param set the selection instead, X11 only feature
+ * \param set the selection instead, X11 only feature
*/
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
@@ -834,12 +832,13 @@ extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
/**
* Toggles console
- * @action 0 - Hides
- * 1 - Shows
- * 2 - Toggles
- * 3 - Hides if it runs not from command line
- * * - Does nothing
- * @return current status (1 -visible, 0 - hidden)
+ * \param action
+ * - 0: Hides
+ * - 1: Shows
+ * - 2: Toggles
+ * - 3: Hides if it runs not from command line
+ * - *: Does nothing
+ * \return current status (1 -visible, 0 - hidden)
*/
extern int GHOST_toggleConsole(int action);
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 149483e719f..6973c19dea9 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -92,7 +92,7 @@ extern "C" {
/**
* Duplicates a block of memory, and returns a pointer to the
* newly allocated block. */
- void *MEM_dupallocN(void *vmemh)
+ void *MEM_dupallocN(const void *vmemh)
#if MEM_GNU_ATTRIBUTES
__attribute__((warn_unused_result))
#endif
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index df6f4d59c7f..a65871f4410 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -248,12 +248,12 @@ size_t MEM_allocN_len(const void *vmemh)
}
}
-void *MEM_dupallocN(void *vmemh)
+void *MEM_dupallocN(const void *vmemh)
{
void *newp = NULL;
if (vmemh) {
- MemHead *memh = vmemh;
+ const MemHead *memh = vmemh;
memh--;
#ifndef DEBUG_MEMDUPLINAME
diff --git a/intern/iksolver/CMakeLists.txt b/intern/iksolver/CMakeLists.txt
index 119cb6eaff0..711a70ff260 100644
--- a/intern/iksolver/CMakeLists.txt
+++ b/intern/iksolver/CMakeLists.txt
@@ -73,4 +73,4 @@ set(SRC
intern/TNT/version.h
)
-blender_add_lib(bf_intern_ik "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(bf_intern_iksolver "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/iksolver/SConscript b/intern/iksolver/SConscript
index bdf7cd350ff..b88d3b1b713 100644
--- a/intern/iksolver/SConscript
+++ b/intern/iksolver/SConscript
@@ -5,5 +5,5 @@ sources = env.Glob('intern/*.cpp')
incs = 'intern ../moto/include ../memutil'
-env.BlenderLib ('bf_intern_ik', sources, Split(incs), [], libtype=['intern','player'], priority=[100,90] )
+env.BlenderLib ('bf_intern_iksolver', sources, Split(incs), [], libtype=['intern','player'], priority=[100,90] )
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index 02d9cd2d1c6..433d9024e0a 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -275,6 +275,7 @@ def enable(module_name, default_set=True, persistent=False):
try:
mod.register()
except:
+ print("Exception in module register(): %r" % getattr(mod, "__file__", module_name))
handle_error()
del sys.modules[module_name]
return None
@@ -316,6 +317,7 @@ def disable(module_name, default_set=True):
try:
mod.unregister()
except:
+ print("Exception in module unregister(): %r" % getattr(mod, "__file__", module_name))
import traceback
traceback.print_exc()
else:
diff --git a/release/scripts/modules/blend_render_info.py b/release/scripts/modules/blend_render_info.py
index 8762ea0e287..d08b9e09dda 100755
--- a/release/scripts/modules/blend_render_info.py
+++ b/release/scripts/modules/blend_render_info.py
@@ -86,6 +86,8 @@ def read_blend_rend_chunk(path):
scenes.append((start_frame, end_frame, scene_name))
+ blendfile.close()
+
return scenes
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
index f1313b583f7..41fe052c434 100644
--- a/release/scripts/modules/bpy/path.py
+++ b/release/scripts/modules/bpy/path.py
@@ -256,7 +256,7 @@ def module_names(path, recursive=False):
elif filename.endswith(".py") and filename != "__init__.py":
fullpath = join(path, filename)
modules.append((filename[0:-3], fullpath))
- elif ("." not in filename):
+ elif "." not in filename:
directory = join(path, filename)
fullpath = join(directory, "__init__.py")
if isfile(fullpath):
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index 09deb33c174..e24b61a757d 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -33,6 +33,9 @@ __all__ = (
"refresh_script_paths",
"register_class",
"register_module",
+ "register_manual_map",
+ "unregister_manual_map",
+ "manual_map",
"resource_path",
"script_path_user",
"script_path_pref",
@@ -56,7 +59,6 @@ import addon_utils as _addon_utils
_script_module_dirs = "startup", "modules"
-
def _test_import(module_name, loaded_modules):
use_time = _bpy.app.debug_python
@@ -595,3 +597,40 @@ def unregister_module(module, verbose=False):
traceback.print_exc()
if verbose:
print("done.\n")
+
+
+# -----------------------------------------------------------------------------
+# Manual lookups, each function has to return a basepath and a sequence
+# of...
+
+# we start with the built-in default mapping
+def _blender_default_map():
+ import sys
+ import rna_wiki_reference as ref_mod
+ ret = (ref_mod.url_manual_prefix, ref_mod.url_manual_mapping)
+ # avoid storing in memory
+ del sys.modules["rna_wiki_reference"]
+ return ret
+
+# hooks for doc lookups
+_manual_map = [_blender_default_map]
+
+def register_manual_map(manual_hook):
+ _manual_map.append(manual_hook)
+
+def unregister_manual_map(manual_hook):
+ _manual_map.remove(manual_hook)
+
+def manual_map():
+ # reverse so default is called last
+ for cb in reversed(_manual_map):
+ try:
+ prefix, url_manual_mapping = cb()
+ except:
+ print("Error calling %r" % cb)
+ import traceback
+ traceback.print_exc()
+ continue
+
+ yield prefix, url_manual_mapping
+
diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py
index c4ec805a72d..b8d08628de4 100644
--- a/release/scripts/modules/bpy_extras/anim_utils.py
+++ b/release/scripts/modules/bpy_extras/anim_utils.py
@@ -181,6 +181,9 @@ def bake_action(frame_start,
while pbone.constraints:
pbone.constraints.remove(pbone.constraints[0])
+ # create compatible eulers
+ euler_prev = None
+
for f in frame_range:
f_step = (f - frame_start) // frame_step
matrix = pose_info[f_step][name]["matrix_key"]
@@ -198,8 +201,19 @@ def bake_action(frame_start,
elif rotation_mode == 'AXIS_ANGLE':
pbone.keyframe_insert("rotation_axis_angle", -1, f, name)
else: # euler, XYZ, ZXY etc
+
+ if euler_prev is not None:
+ euler = pbone.rotation_euler.copy()
+ euler.make_compatible(euler_prev)
+ pbone.rotation_euler = euler
+ euler_prev = euler
+ del euler
+
pbone.keyframe_insert("rotation_euler", -1, f, name)
+ if euler_prev is None:
+ euler_prev = pbone.rotation_euler.copy()
+
pbone.keyframe_insert("scale", -1, f, name)
# object. TODO. multiple objects
@@ -208,6 +222,9 @@ def bake_action(frame_start,
while obj.constraints:
obj.constraints.remove(obj.constraints[0])
+ # create compatible eulers
+ euler_prev = None
+
for f in frame_range:
matrix = obj_info[(f - frame_start) // frame_step]["matrix_key"]
obj.matrix_local = matrix
@@ -221,8 +238,18 @@ def bake_action(frame_start,
elif rotation_mode == 'AXIS_ANGLE':
obj.keyframe_insert("rotation_axis_angle", -1, f)
else: # euler, XYZ, ZXY etc
+ if euler_prev is not None:
+ euler = obj.rotation_euler.copy()
+ euler.make_compatible(euler_prev)
+ obj.rotation_euler = euler
+ euler_prev = euler
+ del euler
+
obj.keyframe_insert("rotation_euler", -1, f)
+ if euler_prev is None:
+ euler_prev = obj.rotation_euler.copy()
+
obj.keyframe_insert("scale", -1, f)
scene.frame_set(frame_back)
diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py
index d32606eb0b0..6e8fee07c0f 100644
--- a/release/scripts/modules/console_python.py
+++ b/release/scripts/modules/console_python.py
@@ -290,6 +290,40 @@ def autocomplete(context):
return {'FINISHED'}
+def copy_as_script(context):
+ sc = context.space_data
+ lines = [
+ "import bpy",
+ "import bpy.context as C",
+ "import bpy.data as D",
+ "from mathutils import *",
+ "from math import *",
+ "",
+ ]
+
+ for line in sc.scrollback:
+ text = line.body
+ type = line.type
+
+ if type == 'INFO': # ignore autocomp.
+ continue
+ if type == 'INPUT':
+ if text.startswith(PROMPT):
+ text = text[len(PROMPT):]
+ elif text.startswith(PROMPT_MULTI):
+ text = text[len(PROMPT_MULTI):]
+ elif type == 'OUTPUT':
+ text = "#~ " + text
+ elif type == 'ERROR':
+ text = "#! " + text
+
+ lines.append(text)
+
+ context.window_manager.clipboard = "\n".join(lines)
+
+ return {'FINISHED'}
+
+
def banner(context):
sc = context.space_data
version_string = sys.version.strip().replace('\n', ' ')
diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py
index 5354fd1c776..a259a4ec396 100644
--- a/release/scripts/modules/rna_xml.py
+++ b/release/scripts/modules/rna_xml.py
@@ -99,11 +99,11 @@ def rna2xml(fw=print_ln,
subvalue = getattr(value, prop)
subvalue_type = type(subvalue)
- if subvalue_type in (int, bool, float):
+ if subvalue_type in {int, bool, float}:
node_attrs.append("%s=\"%s\"" % (prop, number_to_str(subvalue, subvalue_type)))
elif subvalue_type is str:
node_attrs.append("%s=%s" % (prop, quoteattr(subvalue)))
- elif subvalue_type == set:
+ elif subvalue_type is set:
node_attrs.append("%s=%s" % (prop, quoteattr("{" + ",".join(list(subvalue)) + "}")))
elif subvalue is None:
node_attrs.append("%s=\"NONE\"" % prop)
@@ -137,7 +137,7 @@ def rna2xml(fw=print_ln,
# default
def str_recursive(s):
subsubvalue_type = type(s)
- if subsubvalue_type in (int, float, bool):
+ if subsubvalue_type in {int, float, bool}:
return number_to_str(s, subsubvalue_type)
else:
return " ".join([str_recursive(si) for si in s])
diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py
index 82a54077bdc..fd95da02b28 100644
--- a/release/scripts/startup/bl_operators/console.py
+++ b/release/scripts/startup/bl_operators/console.py
@@ -67,6 +67,25 @@ class ConsoleAutocomplete(Operator):
return {'FINISHED'}
+class ConsoleCopyAsScript(Operator):
+ """Copy the console contents for use in a script"""
+ bl_idname = "console.copy_as_script"
+ bl_label = "Copy to Clipboard (as script)"
+
+ def execute(self, context):
+ sc = context.space_data
+
+ module = _lang_module_get(sc)
+ copy_as_script = getattr(module, "copy_as_script", None)
+
+ if copy_as_script:
+ return copy_as_script(context)
+ else:
+ print("Error: copy_as_script - not found for %r" %
+ sc.language)
+ return {'FINISHED'}
+
+
class ConsoleBanner(Operator):
"""Print a message when the terminal initializes"""
bl_idname = "console.banner"
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py
index 8a6874b43d1..ee005fcb8bb 100644
--- a/release/scripts/startup/bl_operators/node.py
+++ b/release/scripts/startup/bl_operators/node.py
@@ -57,10 +57,10 @@ def node_group_items(tree_type):
def node_type_items_cb(self, context):
snode = context.space_data
if not snode:
- return []
+ return ()
tree = snode.edit_tree
if not tree:
- return []
+ return ()
# Lists of basic node types for each
if not node_type_items_dict:
@@ -76,7 +76,7 @@ def node_type_items_cb(self, context):
if tree.type in node_type_items_dict:
return node_type_items_dict[tree.type] + node_group_items(tree.type)
else:
- return []
+ return ()
class NODE_OT_add_search(Operator):
@@ -100,10 +100,10 @@ class NODE_OT_add_search(Operator):
# Enum item identifier has an additional prefix to distinguish base node types from node groups
item = self.type
- if (item.startswith(node_type_prefix)):
+ if item.startswith(node_type_prefix):
# item means base node type
node = tree.nodes.new(type=item[len(node_type_prefix):])
- elif (item.startswith(node_group_prefix)):
+ elif item.startswith(node_group_prefix):
# item means node group type
node = tree.nodes.new(type='GROUP', group=bpy.data.node_groups[item[len(node_group_prefix):]])
else:
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index a81733fe59c..ed4d5dd55f5 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -790,7 +790,7 @@ class WM_OT_path_open(Operator):
return {'CANCELLED'}
if sys.platform[:3] == "win":
- subprocess.Popen(["start", filepath], shell=True)
+ os.startfile(filepath)
elif sys.platform == "darwin":
subprocess.Popen(["open", filepath])
else:
@@ -862,26 +862,24 @@ class WM_OT_doc_view_manual(Operator):
if rna_id is None:
return {'PASS_THROUGH'}
- import rna_wiki_reference
- rna_ref = self._find_reference(rna_id, rna_wiki_reference.url_manual_mapping)
+ url = None
- if rna_ref is None:
- self.report({'WARNING'}, "No reference available '%s', "
- "Update info in %r" %
- (self.doc_id, rna_wiki_reference.__file__))
-
- import sys
- del sys.modules["rna_wiki_reference"]
+ for prefix, url_manual_mapping in bpy.utils.manual_map():
+ rna_ref = self._find_reference(rna_id, url_manual_mapping)
+ if rna_ref is not None:
+ url = prefix + rna_ref
+ break
- if rna_ref is None:
+ if url is None:
+ self.report({'WARNING'}, "No reference available %r, "
+ "Update info in 'rna_wiki_reference.py' "
+ " or callback to bpy.utils.manual_map()" %
+ self.doc_id)
return {'CANCELLED'}
else:
- url = rna_wiki_reference.url_manual_prefix + rna_ref
-
- import webbrowser
- webbrowser.open(url)
-
- return {'FINISHED'}
+ import webbrowser
+ webbrowser.open(url)
+ return {'FINISHED'}
class WM_OT_doc_view(Operator):
diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py
index 3011f55fcb3..2d15c534e9f 100644
--- a/release/scripts/startup/bl_ui/properties_animviz.py
+++ b/release/scripts/startup/bl_ui/properties_animviz.py
@@ -44,10 +44,10 @@ class MotionPathButtonsPanel():
col = split.column()
col.label(text="Display Range:")
sub = col.column(align=True)
- if (mps.type == 'CURRENT_FRAME'):
+ if mps.type == 'CURRENT_FRAME':
sub.prop(mps, "frame_before", text="Before")
sub.prop(mps, "frame_after", text="After")
- elif (mps.type == 'RANGE'):
+ elif mps.type == 'RANGE':
sub.prop(mps, "frame_start", text="Start")
sub.prop(mps, "frame_end", text="End")
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
index 1e9fd5dd8a9..a8f4aa30e95 100644
--- a/release/scripts/startup/bl_ui/properties_data_curve.py
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -106,7 +106,7 @@ class DATA_PT_shape_curve(CurveButtonsPanel, Panel):
sub.prop(curve, "resolution_v", text="Preview V")
sub.prop(curve, "render_resolution_v", text="Render V")
- if (is_curve or is_text):
+ if is_curve or is_text:
col.label(text="Fill:")
sub = col.column()
sub.active = (curve.dimensions == '2D' or (curve.bevel_object is None and curve.dimensions == '3D'))
diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py
index 25b85591873..769715ef1b9 100644
--- a/release/scripts/startup/bl_ui/properties_data_lamp.py
+++ b/release/scripts/startup/bl_ui/properties_data_lamp.py
@@ -322,9 +322,9 @@ class DATA_PT_area(DataButtonsPanel, Panel):
col.row().prop(lamp, "shape", expand=True)
sub = col.row(align=True)
- if (lamp.shape == 'SQUARE'):
+ if lamp.shape == 'SQUARE':
sub.prop(lamp, "size")
- elif (lamp.shape == 'RECTANGLE'):
+ elif lamp.shape == 'RECTANGLE':
sub.prop(lamp, "size", text="Size X")
sub.prop(lamp, "size_y", text="Size Y")
diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py
index bb25f8fa076..67980c388b5 100644
--- a/release/scripts/startup/bl_ui/properties_mask_common.py
+++ b/release/scripts/startup/bl_ui/properties_mask_common.py
@@ -223,7 +223,7 @@ class MASK_PT_tools():
col.operator("transform.translate")
col.operator("transform.rotate")
col.operator("transform.resize", text="Scale")
- props = col.operator("transform.transform", text="Shrink/Fatten")
+ props = col.operator("transform.transform", text="Scale Feather")
props.mode = 'MASK_SHRINKFATTEN'
col = layout.column(align=True)
@@ -291,7 +291,7 @@ class MASK_MT_transform(Menu):
layout.operator("transform.translate")
layout.operator("transform.rotate")
layout.operator("transform.resize")
- props = layout.operator("transform.transform", text="Shrink/Fatten")
+ props = layout.operator("transform.transform", text="Scale Feather")
props.mode = 'MASK_SHRINKFATTEN'
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 8d220e5aae6..aa0ea1d2d9e 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -849,6 +849,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
sub = col.row()
sub.prop(part, "use_global_dupli")
sub.prop(part, "use_rotation_dupli")
+ sub.prop(part, "use_scale_dupli")
elif part.render_type == 'GROUP':
col.prop(part, "dupli_group")
split = layout.split()
@@ -865,6 +866,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
sub.active = (part.use_whole_group is False)
sub.prop(part, "use_global_dupli")
sub.prop(part, "use_rotation_dupli")
+ sub.prop(part, "use_scale_dupli")
if part.use_group_count and not part.use_whole_group:
row = layout.row()
@@ -1008,7 +1010,7 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, Panel):
sub.active = (part.draw_color in {'VELOCITY', 'ACCELERATION'})
sub.prop(part, "color_maximum", text="Max")
- if (path):
+ if path:
col.prop(part, "draw_step")
diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py
index 70499b18f41..569037cb0da 100644
--- a/release/scripts/startup/bl_ui/properties_physics_field.py
+++ b/release/scripts/startup/bl_ui/properties_physics_field.py
@@ -92,7 +92,7 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
layout.separator()
layout.prop(field, "guide_kink_type")
- if (field.guide_kink_type != 'NONE'):
+ if field.guide_kink_type != 'NONE':
layout.prop(field, "guide_kink_axis")
split = layout.split()
diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py
index 7f9699f457b..7ded4954f80 100644
--- a/release/scripts/startup/bl_ui/space_console.py
+++ b/release/scripts/startup/bl_ui/space_console.py
@@ -51,6 +51,7 @@ class CONSOLE_MT_console(Menu):
layout.separator()
+ layout.operator("console.copy_as_script")
layout.operator("console.copy")
layout.operator("console.paste")
layout.menu("CONSOLE_MT_language")
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 5302ad9b471..0b4d4cd19e4 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -774,7 +774,7 @@ class IMAGE_PT_paint_curve(BrushButtonsPanel, Panel):
toolsettings = context.tool_settings.image_paint
brush = toolsettings.brush
- layout.template_curve_mapping(brush, "curve")
+ layout.template_curve_mapping(brush, "curve", type='COLOR')
row = layout.row(align=True)
row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 45814205d9c..ebc73752aef 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -28,6 +28,29 @@ def act_strip(context):
return None
+def draw_color_balance(layout, color_balance):
+ col = layout.column()
+ col.label(text="Lift:")
+ col.template_color_wheel(color_balance, "lift", value_slider=True, cubic=True)
+ row = col.row()
+ row.prop(color_balance, "lift", text="")
+ row.prop(color_balance, "invert_lift", text="Inverse")
+
+ col = layout.column()
+ col.label(text="Gamma:")
+ col.template_color_wheel(color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
+ row = col.row()
+ row.prop(color_balance, "gamma", text="")
+ row.prop(color_balance, "invert_gamma", text="Inverse")
+
+ col = layout.column()
+ col.label(text="Gain:")
+ col.template_color_wheel(color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
+ row = col.row()
+ row.prop(color_balance, "gain", text="")
+ row.prop(color_balance, "invert_gain", text="Inverse")
+
+
class SEQUENCER_HT_header(Header):
bl_space_type = 'SEQUENCE_EDITOR'
@@ -442,7 +465,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
if strip.is_supports_mask:
col = layout.column()
- col.prop_search(strip, "input_mask", sequencer, "sequences")
+ col.prop_search(strip, "input_mask_strip", sequencer, "sequences", text="Mask")
if strip.type == 'COLOR':
layout.prop(strip, "color")
@@ -497,7 +520,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
col = layout.column(align=True)
col.prop(strip, "use_uniform_scale")
- if (strip.use_uniform_scale):
+ if strip.use_uniform_scale:
col = layout.column(align=True)
col.prop(strip, "scale_start_x", text="Scale")
else:
@@ -772,26 +795,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
layout.prop(strip, "use_color_balance")
if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow
- col = layout.column()
- col.label(text="Lift:")
- col.template_color_wheel(strip.color_balance, "lift", value_slider=True, cubic=True)
- row = col.row()
- row.prop(strip.color_balance, "lift", text="")
- row.prop(strip.color_balance, "invert_lift", text="Inverse")
-
- col = layout.column()
- col.label(text="Gamma:")
- col.template_color_wheel(strip.color_balance, "gamma", value_slider=True, lock_luminosity=True, cubic=True)
- row = col.row()
- row.prop(strip.color_balance, "gamma", text="")
- row.prop(strip.color_balance, "invert_gamma", text="Inverse")
-
- col = layout.column()
- col.label(text="Gain:")
- col.template_color_wheel(strip.color_balance, "gain", value_slider=True, lock_luminosity=True, cubic=True)
- row = col.row()
- row.prop(strip.color_balance, "gain", text="")
- row.prop(strip.color_balance, "invert_gain", text="Inverse")
+ draw_color_balance(layout, strip.color_balance)
class SEQUENCER_PT_proxy(SequencerButtonsPanel, Panel):
@@ -878,5 +882,59 @@ class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel):
col.prop(st, "show_separate_color")
col.prop(st, "proxy_render_size")
+
+class SEQUENCER_PT_modifiers(SequencerButtonsPanel, Panel):
+ bl_label = "Modifiers"
+
+ def draw(self, context):
+ layout = self.layout
+
+ strip = act_strip(context)
+ sequencer = context.scene.sequence_editor
+
+ layout.operator_menu_enum("sequencer.strip_modifier_add", "type")
+
+ for mod in strip.modifiers:
+ box = layout.box()
+
+ row = box.row()
+ row.prop(mod, "show_expanded", text="", emboss=False)
+ row.prop(mod, "name", text="")
+
+ row.prop(mod, "mute", text="")
+
+ sub = row.row(align=True)
+ props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_UP')
+ props.name = mod.name
+ props.direction = 'UP'
+ props = sub.operator("sequencer.strip_modifier_move", text="", icon='TRIA_DOWN')
+ props.name = mod.name
+ props.direction = 'DOWN'
+
+ props = row.operator("sequencer.strip_modifier_remove", text="", icon='X', emboss=False)
+ props.name = mod.name
+
+ if mod.show_expanded:
+ row = box.row()
+ row.prop(mod, "input_mask_type", expand=True)
+
+ if mod.input_mask_type == 'STRIP':
+ box.prop_search(mod, "input_mask_strip", sequencer, "sequences", text="Mask")
+ else:
+ box.prop(mod, "input_mask_id")
+
+ if mod.type == 'COLOR_BALANCE':
+ box.prop(mod, "color_multiply")
+ draw_color_balance(box, mod.color_balance)
+ elif mod.type == 'CURVES':
+ box.template_curve_mapping(mod, "curve_mapping", type='COLOR')
+ elif mod.type == 'HUE_CORRECT':
+ box.template_curve_mapping(mod, "curve_mapping", type='HUE')
+ elif mod.type == 'BRIGHT_CONTRAST':
+ col = box.column()
+ col.prop(mod, "bright")
+ col.prop(mod, "contrast")
+
+
if __name__ == "__main__": # only for live edit.
bpy.utils.register_module(__name__)
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index e7dd9fb4751..b0b587056b1 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -858,6 +858,7 @@ class USERPREF_MT_ndof_settings(Menu):
layout.separator()
layout.prop(input_prefs, "ndof_sensitivity")
+ layout.prop(input_prefs, "ndof_orbit_sensitivity")
if context.space_data.type == 'VIEW_3D':
layout.separator()
@@ -865,11 +866,10 @@ class USERPREF_MT_ndof_settings(Menu):
layout.separator()
layout.label(text="Orbit options")
- if input_prefs.view_rotate_method == 'TRACKBALL':
- layout.prop(input_prefs, "ndof_roll_invert_axis")
+ layout.prop(input_prefs, "ndof_turntable")
+ layout.prop(input_prefs, "ndof_roll_invert_axis")
layout.prop(input_prefs, "ndof_tilt_invert_axis")
layout.prop(input_prefs, "ndof_rotate_invert_axis")
- layout.prop(input_prefs, "ndof_zoom_invert")
layout.separator()
layout.label(text="Pan options")
@@ -878,6 +878,7 @@ class USERPREF_MT_ndof_settings(Menu):
layout.prop(input_prefs, "ndof_panz_invert_axis")
layout.label(text="Zoom options")
+ layout.prop(input_prefs, "ndof_zoom_invert")
layout.prop(input_prefs, "ndof_zoom_updown")
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 9368d3ab5db..5db103466a9 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -1182,7 +1182,7 @@ class VIEW3D_MT_hook(Menu):
layout = self.layout
layout.operator_context = 'EXEC_AREA'
layout.operator("object.hook_add_newob")
- layout.operator("object.hook_add_selob")
+ layout.operator("object.hook_add_selob").use_bone = False
layout.operator("object.hook_add_selob", text="Hook to Selected Object Bone").use_bone = True
if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
@@ -2557,7 +2557,7 @@ class VIEW3D_PT_background_image(Panel):
if bg.source == 'IMAGE':
row = box.row()
row.template_ID(bg, "image", open="image.open")
- if (bg.image):
+ if bg.image is not None:
box.template_image(bg, "image", bg.image_user, compact=True)
has_bg = True
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index ac962ab5097..2c1e963dcfe 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -228,7 +228,7 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel):
col = layout.column(align=True)
col.operator("transform.tilt", text="Tilt")
- col.operator("transform.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
+ col.operator("transform.transform", text="Scale Feather").mode = 'CURVE_SHRINKFATTEN'
col = layout.column(align=True)
col.label(text="Curve:")
diff --git a/release/scripts/templates/addon_add_object.py b/release/scripts/templates/addon_add_object.py
index a2d7315af4b..d7fc23f9242 100644
--- a/release/scripts/templates/addon_add_object.py
+++ b/release/scripts/templates/addon_add_object.py
@@ -68,13 +68,23 @@ def add_object_button(self, context):
icon='PLUGIN')
+# This allows you to right click on a button and link to the manual
+def add_object_manual_map():
+ url_manual_prefix = "http://wiki.blender.org/index.php/Doc:2.6/Manual/"
+ url_manual_mapping = (
+ ("bpy.ops.mesh.add_object", "Modeling/Objects"),
+ )
+ return url_manual_prefix, url_manual_mapping
+
+
def register():
bpy.utils.register_class(OBJECT_OT_add_object)
+ bpy.utils.register_manual_map(add_object_manual_map)
bpy.types.INFO_MT_mesh_add.append(add_object_button)
-
def unregister():
bpy.utils.unregister_class(OBJECT_OT_add_object)
+ bpy.utils.unregister_manual_map(add_object_manual_map)
bpy.types.INFO_MT_mesh_add.remove(add_object_button)
diff --git a/release/scripts/templates/operator_mesh_add.py b/release/scripts/templates/operator_mesh_add.py
index f2bb231cb7a..fa248cb9005 100644
--- a/release/scripts/templates/operator_mesh_add.py
+++ b/release/scripts/templates/operator_mesh_add.py
@@ -78,9 +78,9 @@ class AddBox(bpy.types.Operator):
def execute(self, context):
verts_loc, faces = add_box(self.width,
- self.height,
- self.depth,
- )
+ self.height,
+ self.depth,
+ )
mesh = bpy.data.meshes.new("Box")
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index 4fde9fe6787..da916067302 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -43,7 +43,10 @@
#include "BKE_utildefines.h"
-#include "BLI_blenlib.h"
+#include "BLI_fileops.h"
+#include "BLI_listbase.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
#include "BIF_gl.h"
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index dcefcc68d23..ab43804db8e 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -43,10 +43,12 @@
#include "DNA_vec_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_linklist.h" /* linknode */
+#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
+#include "BLI_string.h"
+#include "BLI_string_utf8.h"
+#include "BLI_linklist.h" /* linknode */
#include "BIF_gl.h"
#include "BLF_api.h"
@@ -152,7 +154,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
_kern_mode, \
&(_delta)) == 0) \
{ \
- _pen_x += delta.x >> 6; \
+ _pen_x += _delta.x >> 6; \
} \
} \
} (void)0
@@ -229,9 +231,9 @@ void blf_font_buffer(FontBLF *font, const char *str)
FontBufInfoBLF *buf_info = &font->buf_info;
float b_col_float[4];
const unsigned char b_col_char[4] = {buf_info->col[0] * 255,
- buf_info->col[1] * 255,
- buf_info->col[2] * 255,
- buf_info->col[3] * 255};
+ buf_info->col[1] * 255,
+ buf_info->col[2] * 255,
+ buf_info->col[3] * 255};
unsigned char *cbuf;
int chx, chy;
@@ -242,7 +244,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
blf_font_ensure_ascii_table(font);
- /* another buffer spesific call for color conversion */
+ /* another buffer specific call for color conversion */
if (buf_info->do_color_management) {
srgb_to_linearrgb_v4(b_col_float, buf_info->col);
}
@@ -425,8 +427,8 @@ void blf_font_width_and_height(FontBLF *font, const char *str, float *width, flo
}
blf_font_boundbox(font, str, &box);
- *width = ((box.xmax - box.xmin) * xa);
- *height = ((box.ymax - box.ymin) * ya);
+ *width = (BLI_RCT_SIZE_X(&box) * xa);
+ *height = (BLI_RCT_SIZE_Y(&box) * ya);
}
float blf_font_width(FontBLF *font, const char *str)
@@ -440,7 +442,7 @@ float blf_font_width(FontBLF *font, const char *str)
xa = 1.0f;
blf_font_boundbox(font, str, &box);
- return (box.xmax - box.xmin) * xa;
+ return BLI_RCT_SIZE_X(&box) * xa;
}
float blf_font_height(FontBLF *font, const char *str)
@@ -454,7 +456,7 @@ float blf_font_height(FontBLF *font, const char *str)
ya = 1.0f;
blf_font_boundbox(font, str, &box);
- return (box.ymax - box.ymin) * ya;
+ return BLI_RCT_SIZE_Y(&box) * ya;
}
float blf_font_fixed_width(FontBLF *font)
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 39945bf19b0..63225651e5b 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -46,7 +46,8 @@
#include "DNA_vec_types.h"
#include "DNA_userdef_types.h"
-#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
+#include "BLI_rect.h"
#include "BIF_gl.h"
#include "BLF_api.h"
@@ -314,13 +315,14 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa
static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
- float soft[25] = {1 / 60.0f, 1 / 60.0f, 2 / 60.0f, 1 / 60.0f, 1 / 60.0f,
- 1 / 60.0f, 3 / 60.0f, 5 / 60.0f, 3 / 60.0f, 1 / 60.0f,
- 2 / 60.0f, 5 / 60.0f, 8 / 60.0f, 5 / 60.0f, 2 / 60.0f,
- 1 / 60.0f, 3 / 60.0f, 5 / 60.0f, 3 / 60.0f, 1 / 60.0f,
- 1 / 60.0f, 1 / 60.0f, 2 / 60.0f, 1 / 60.0f, 1 / 60.0f};
+ const float soft[25] = {1 / 60.0f, 1 / 60.0f, 2 / 60.0f, 1 / 60.0f, 1 / 60.0f,
+ 1 / 60.0f, 3 / 60.0f, 5 / 60.0f, 3 / 60.0f, 1 / 60.0f,
+ 2 / 60.0f, 5 / 60.0f, 8 / 60.0f, 5 / 60.0f, 2 / 60.0f,
+ 1 / 60.0f, 3 / 60.0f, 5 / 60.0f, 3 / 60.0f, 1 / 60.0f,
+ 1 / 60.0f, 1 / 60.0f, 2 / 60.0f, 1 / 60.0f, 1 / 60.0f};
- float color[4], *fp = soft;
+ const float *fp = soft;
+ float color[4];
int dx, dy;
color[0] = shadow_col[0];
@@ -340,11 +342,12 @@ static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x
static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
{
- float soft[9] = {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};
+ const float soft[9] = {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};
- float color[4], *fp = soft;
+ const float *fp = soft;
+ float color[4];
int dx, dy;
color[0] = shadow_col[0];
@@ -412,7 +415,7 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
g->uv[1][1] = ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
/* update the x offset for the next glyph. */
- gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad);
+ gc->x_offs += (int)(BLI_RCT_SIZE_X(&g->box) + gc->pad);
gc->rem_glyphs--;
g->build_tex = 1;
@@ -434,13 +437,13 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
y2 = y + g->pos_y - g->height;
if (font->flags & BLF_CLIPPING) {
- if (!BLI_in_rctf(&font->clip_rec, dx + font->pos[0], y1 + font->pos[1]))
+ if (!BLI_rctf_isect_pt(&font->clip_rec, dx + font->pos[0], y1 + font->pos[1]))
return 0;
- if (!BLI_in_rctf(&font->clip_rec, dx + font->pos[0], y2 + font->pos[1]))
+ if (!BLI_rctf_isect_pt(&font->clip_rec, dx + font->pos[0], y2 + font->pos[1]))
return 0;
- if (!BLI_in_rctf(&font->clip_rec, dx1 + font->pos[0], y2 + font->pos[1]))
+ if (!BLI_rctf_isect_pt(&font->clip_rec, dx1 + font->pos[0], y2 + font->pos[1]))
return 0;
- if (!BLI_in_rctf(&font->clip_rec, dx1 + font->pos[0], y1 + font->pos[1]))
+ if (!BLI_rctf_isect_pt(&font->clip_rec, dx1 + font->pos[0], y1 + font->pos[1]))
return 0;
}
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index f58af8f39a0..9ce2de79dbf 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -47,15 +47,19 @@ struct rctf;
# define DO_INLINE static inline
#endif
+void curvemapping_set_defaults(struct CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy);
struct CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, float maxy);
+void curvemapping_free_data(struct CurveMapping *cumap);
void curvemapping_free(struct CurveMapping *cumap);
+void curvemapping_copy_data(struct CurveMapping *target, struct CurveMapping *cumap);
struct CurveMapping *curvemapping_copy(struct CurveMapping *cumap);
+void curvemapping_set_black_white_ex(const float black[3], const float white[3], float r_bwmul[3]);
void curvemapping_set_black_white(struct CurveMapping *cumap, const float black[3], const float white[3]);
#define CURVEMAP_SLOPE_NEGATIVE 0
#define CURVEMAP_SLOPE_POSITIVE 1
void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset, int slope);
-void curvemap_remove(struct CurveMap *cuma, int flag);
+void curvemap_remove(struct CurveMap *cuma, const short flag);
void curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp);
struct CurveMapPoint *curvemap_insert(struct CurveMap *cuma, float x, float y);
void curvemap_sethandle(struct CurveMap *cuma, int type);
@@ -63,22 +67,31 @@ void curvemap_sethandle(struct CurveMap *cuma, int type);
void curvemapping_changed(struct CurveMapping *cumap, int rem_doubles);
void curvemapping_changed_all(struct CurveMapping *cumap);
+/* call before _all_ evaluation functions */
+void curvemapping_initialize(struct CurveMapping *cumap);
+
+/* keep these (const CurveMap) - to help with thread safety */
/* single curve, no table check */
-float curvemap_evaluateF(struct CurveMap *cuma, float value);
+float curvemap_evaluateF(const struct CurveMap *cuma, float value);
/* single curve, with table check */
-float curvemapping_evaluateF(struct CurveMapping *cumap, int cur, float value);
-void curvemapping_evaluate3F(struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
-void curvemapping_evaluateRGBF(struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
-void curvemapping_evaluate_premulRGBF(struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
+float curvemapping_evaluateF(const struct CurveMapping *cumap, int cur, float value);
+void curvemapping_evaluate3F(const struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
+void curvemapping_evaluateRGBF(const struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
+void curvemapping_evaluate_premulRGB(const struct CurveMapping *cumap, unsigned char vecout_byte[3], const unsigned char vecin_byte[3]);
+void curvemapping_evaluate_premulRGBF_ex(const struct CurveMapping *cumap, float vecout[3], const float vecin[3],
+ const float black[3], const float bwmul[3]);
+void curvemapping_evaluate_premulRGBF(const struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
+int curvemapping_RGBA_does_something(const struct CurveMapping *cumap);
+void curvemapping_table_RGBA(const struct CurveMapping *cumap, float **array, int *size);
+
+/* non-const, these modify the curve */
void curvemapping_do_ibuf(struct CurveMapping *cumap, struct ImBuf *ibuf);
void curvemapping_premultiply(struct CurveMapping *cumap, int restore);
-int curvemapping_RGBA_does_something(struct CurveMapping *cumap);
-void curvemapping_initialize(struct CurveMapping *cumap);
-void curvemapping_table_RGBA(struct CurveMapping *cumap, float **array, int *size);
+
+
void BKE_histogram_update_sample_line(struct Histogram *hist, struct ImBuf *ibuf, const short use_color_management);
void scopes_update(struct Scopes *scopes, struct ImBuf *ibuf, int use_color_management);
void scopes_free(struct Scopes *scopes);
void scopes_new(struct Scopes *scopes);
#endif
-
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index f5e073eb27a..22b8f474cca 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -88,7 +88,7 @@ typedef struct bContextStore {
int used;
} bContextStore;
-/* for the conrtext's rna mode enum
+/* for the context's rna mode enum
* keep aligned with data_mode_strings in context.c */
enum {
CTX_MODE_EDIT_MESH = 0,
@@ -174,7 +174,7 @@ void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg);
*
* - listbases consist of CollectionPointerLink items and must be
* freed with BLI_freelistN!
- * - the dir listbase consits of LinkData items */
+ * - the dir listbase consists of LinkData items */
/* data type, needed so we can tell between a NULL pointer and an empty list */
enum {
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index ad1a63fd1e6..bf2f1262eee 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -217,8 +217,8 @@ void calc_fcurve_range(struct FCurve *fcu, float *min, float *max,
const short do_sel_only, const short do_min_length);
/* get the bounding-box extents for F-Curve */
-void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
- const short do_sel_only, const short include_handles);
+short calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
+ const short do_sel_only, const short include_handles);
/* .............. */
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index 938a13483d5..cd52dd75f26 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -76,13 +76,9 @@ void BKE_vfont_builtin_register(void *mem, int size);
void BKE_vfont_free_data(struct VFont *vfont);
void BKE_vfont_free(struct VFont *sc);
-void BKE_vfont_free_global_ttf(void);
struct VFont *BKE_vfont_builtin_get(void);
struct VFont *BKE_vfont_load(struct Main *bmain, const char *name);
-struct TmpFont *BKE_vfont_tmpfont_find(struct VFont *vfont);
-void BKE_vfont_tmpfont_remove(struct VFont *vfont);
-
struct CharTrans *BKE_vfont_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode);
int BKE_vfont_select_get(struct Object *ob, int *start, int *end);
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 1836a88555b..b46aefe4e98 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -74,10 +74,12 @@ float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline,
float (*BKE_mask_spline_differentiate_with_resolution_ex(struct MaskSpline *spline, int *tot_diff_point,
const unsigned int resol))[2];
+void BKE_mask_spline_feather_collapse_inner_loops(struct MaskSpline *spline, float (*feather_points)[2], const int tot_feather_point);
float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_diff_point))[2];
float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(struct MaskSpline *spline, int *tot_feather_point,
- const unsigned int resol))[2];
-float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height, int *tot_feather_point))[2];
+ const unsigned int resol, const int do_feather_isect))[2];
+float (*BKE_mask_spline_feather_differentiated_points_with_resolution(struct MaskSpline *spline, int width, int height,
+ int *tot_feather_point, const int do_feather_isect))[2];
float (*BKE_mask_spline_feather_points(struct MaskSpline *spline, int *tot_feather_point))[2];
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 030af85ba84..dd1b1a7752b 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -48,6 +48,7 @@ struct Scene;
void init_def_material(void);
void BKE_material_free(struct Material *sc);
+void BKE_material_free_ex(struct Material *ma, int do_id_user);
void test_object_materials(struct ID *id);
void resize_object_material(struct Object *ob, const short totcol);
void init_material(struct Material *ma);
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index 356f2c8901c..913e8653b9b 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -57,8 +57,8 @@ float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase);
void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object);
int BKE_mball_minmax(struct MetaBall *mb, float min[3], float max[3]);
-int BKE_mball_center_median(struct MetaBall *mb, float cent[3]);
-int BKE_mball_center_bounds(struct MetaBall *mb, float cent[3]);
+int BKE_mball_center_median(struct MetaBall *mb, float r_cent[3]);
+int BKE_mball_center_bounds(struct MetaBall *mb, float r_cent[3]);
void BKE_mball_translate(struct MetaBall *mb, float offset[3]);
struct MetaElem *BKE_mball_element_add(struct MetaBall *mb, const int type);
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 61845619452..c8b69898daa 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -146,7 +146,7 @@ typedef struct bNodeType {
/// Additional parameters in the side panel.
void (*uifuncbut)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
/// Additional drawing on backdrop.
- void (*uibackdropfunc)(struct SpaceNode* snode, struct ImBuf* backdrop, struct bNode* node, int x, int y);
+ void (*uibackdropfunc)(struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y);
/// Draw a node socket. Default draws the input value button.
NodeSocketButtonFunction drawinputfunc;
@@ -301,21 +301,29 @@ struct bNodeType *ntreeGetNodeType(struct bNodeTree *ntree);
struct bNodeSocketType *ntreeGetSocketType(int type);
struct bNodeTree *ntreeAddTree(const char *name, int type, int nodetype);
-void ntreeInitTypes(struct bNodeTree *ntree);
+void ntreeInitTypes(struct bNodeTree *ntree);
-void ntreeFreeTree(struct bNodeTree *ntree);
+/* copy/free funcs, need to manage ID users */
+void ntreeFreeTree_ex(struct bNodeTree *ntree, const short do_id_user);
+void ntreeFreeTree(struct bNodeTree *ntree);
+struct bNodeTree *ntreeCopyTree_ex(struct bNodeTree *ntree, const short do_id_user);
struct bNodeTree *ntreeCopyTree(struct bNodeTree *ntree);
-void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to);
-void ntreeMakeLocal(struct bNodeTree *ntree);
-int ntreeHasType(struct bNodeTree *ntree, int type);
+void ntreeSwitchID_ex(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to, const short do_id_user);
+void ntreeSwitchID(struct bNodeTree *ntree, struct ID *sce_from, struct ID *sce_to);
+/* node->id user count */
+void ntreeUserIncrefID(struct bNodeTree *ntree);
+void ntreeUserDecrefID(struct bNodeTree *ntree);
-void ntreeUpdateTree(struct bNodeTree *ntree);
+
+void ntreeMakeLocal(struct bNodeTree *ntree);
+int ntreeHasType(struct bNodeTree *ntree, int type);
+void ntreeUpdateTree(struct bNodeTree *ntree);
/* XXX Currently each tree update call does call to ntreeVerifyNodes too.
* Some day this should be replaced by a decent depsgraph automatism!
*/
-void ntreeVerifyNodes(struct Main *main, struct ID *id);
+void ntreeVerifyNodes(struct Main *main, struct ID *id);
-void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes);
+void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes);
/* XXX old trees handle output flags automatically based on special output node types and last active selection.
* new tree types have a per-output socket flag to indicate the final output to use explicitly.
@@ -388,6 +396,7 @@ void nodeSocketSetType(struct bNodeSocket *sock, int type);
/* Node Clipboard */
void BKE_node_clipboard_init(struct bNodeTree *ntree);
void BKE_node_clipboard_clear(void);
+int BKE_node_clipboard_validate(void);
void BKE_node_clipboard_add_node(struct bNode *node);
void BKE_node_clipboard_add_link(struct bNodeLink *link);
const struct ListBase *BKE_node_clipboard_get_nodes(void);
@@ -671,7 +680,8 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria
#define CMP_NODE_KEYINGSCREEN 269
#define CMP_NODE_KEYING 270
#define CMP_NODE_TRACKPOS 271
-#define CMP_NODE_INPAINT 272
+#define CMP_NODE_INPAINT 272
+#define CMP_NODE_DESPECKLE 273
#define CMP_NODE_GLARE 301
#define CMP_NODE_TONEMAP 302
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 3aa7148d821..31642dad60d 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -109,8 +109,8 @@ struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
void BKE_object_dimensions_get(struct Object *ob, float vec[3]);
void BKE_object_dimensions_set(struct Object *ob, const float *value);
void BKE_object_boundbox_flag(struct Object *ob, int flag, int set);
-void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3]);
-int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3]);
+void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const short use_hidden);
+int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], const short use_hidden);
/* sometimes min-max isn't enough, we need to loop over each point */
void BKE_object_foreach_display_point(struct Object *ob, float obmat[4][4],
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index 1891840f497..603cb1f22a6 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -43,6 +43,7 @@ struct ReportList;
struct VFont;
/* pack */
+struct PackedFile *dupPackedFile(const struct PackedFile *pf_src);
struct PackedFile *newPackedFile(struct ReportList *reports, const char *filename, const char *relabase);
struct PackedFile *newPackedFileMemory(void *mem, int memlen);
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index e99fc413ca1..8aa08beec57 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -55,7 +55,7 @@ struct wmWindowManager;
#include "RNA_types.h"
/* spacetype has everything stored to get an editor working, it gets initialized via
- * ED_spacetypes_init() in editors/area/spacetypes.c */
+ * ED_spacetypes_init() in editors/space_api/spacetypes.c */
/* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */
#define BKE_ST_MAXNAME 64
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 718daf1454e..2a90bb2c679 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -31,11 +31,14 @@
*/
struct bContext;
+struct StripColorBalance;
struct Editing;
struct ImBuf;
struct Main;
+struct Mask;
struct Scene;
struct Sequence;
+struct SequenceModifierData;
struct Strip;
struct StripElem;
struct bSound;
@@ -241,6 +244,11 @@ void BKE_sequencer_cache_put(SeqRenderData context, struct Sequence *seq, float
void BKE_sequencer_cache_cleanup_sequence(struct Sequence *seq);
+struct ImBuf *BKE_sequencer_preprocessed_cache_get(SeqRenderData context, struct Sequence *seq, float cfra, seq_stripelem_ibuf_t type);
+void BKE_sequencer_preprocessed_cache_put(SeqRenderData context, struct Sequence *seq, float cfra, seq_stripelem_ibuf_t type, struct ImBuf *ibuf);
+void BKE_sequencer_preprocessed_cache_cleanup(void);
+void BKE_sequencer_preprocessed_cache_cleanup_sequence(struct Sequence *seq);
+
/* **********************************************************************
* seqeffects.c
*
@@ -289,6 +297,7 @@ int BKE_sequence_swap(struct Sequence *seq_a, struct Sequence *seq_b, const char
int BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur);
void BKE_sequence_invalidate_cache(struct Scene *scene, struct Sequence *seq);
+void BKE_sequence_invalidate_cache_for_modifier(struct Scene *scene, struct Sequence *seq);
void BKE_sequencer_update_sound_bounds_all(struct Scene *scene);
void BKE_sequencer_update_sound_bounds(struct Scene *scene, struct Sequence *seq);
@@ -301,7 +310,7 @@ int BKE_seqence_is_valid_check(struct Sequence *seq);
void BKE_sequencer_clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce);
-struct Sequence *BKE_sequwnce_get_by_name(struct ListBase *seqbase, const char *name, int recursive);
+struct Sequence *BKE_sequence_get_by_name(struct ListBase *seqbase, const char *name, int recursive);
/* api for adding new sequence strips */
typedef struct SeqLoadInfo {
@@ -347,4 +356,48 @@ extern SequencerDrawView sequencer_view3d_cb;
extern ListBase seqbase_clipboard;
extern int seqbase_clipboard_frame;
+/* modifiers */
+typedef struct SequenceModifierTypeInfo {
+ /* default name for the modifier */
+ char name[64]; /* MAX_NAME */
+
+ /* DNA structure name used on load/save filed */
+ char struct_name[64]; /* MAX_NAME */
+
+ /* size of modifier data structure, used by allocation */
+ int struct_size;
+
+ /* data initialization */
+ void (*init_data) (struct SequenceModifierData *smd);
+
+ /* free data used by modifier,
+ * only modifier-specific data should be freed, modifier descriptor would
+ * be freed outside of this callback
+ */
+ void (*free_data) (struct SequenceModifierData *smd);
+
+ /* copy data from one modifier to another */
+ void (*copy_data) (struct SequenceModifierData *smd, struct SequenceModifierData *target);
+
+ /* apply modifier on a given image buffer */
+ struct ImBuf *(*apply) (struct SequenceModifierData *smd, struct ImBuf *ibuf, struct ImBuf *mask);
+} SequenceModifierTypeInfo;
+
+struct SequenceModifierTypeInfo *BKE_sequence_modifier_type_info_get(int type);
+
+struct SequenceModifierData *BKE_sequence_modifier_new(struct Sequence *seq, const char *name, int type);
+int BKE_sequence_modifier_remove(struct Sequence *seq, struct SequenceModifierData *smd);
+void BKE_sequence_modifier_clear(struct Sequence *seq);
+void BKE_sequence_modifier_free(struct SequenceModifierData *smd);
+void BKE_sequence_modifier_unique_name(struct Sequence *seq, struct SequenceModifierData *smd);
+struct SequenceModifierData *BKE_sequence_modifier_find_by_name(struct Sequence *seq, char *name);
+struct ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, struct Sequence *seq, struct ImBuf *ibuf, int cfra);
+void BKE_sequence_modifier_list_copy(struct Sequence *seqn, struct Sequence *seq);
+
+int BKE_sequence_supports_modifiers(struct Sequence *seq);
+
+/* internal filters */
+struct ImBuf *BKE_sequencer_render_mask_input(SeqRenderData context, int mask_input_type, struct Sequence *mask_sequence, struct Mask *mask_id, int cfra, int make_float);
+void BKE_sequencer_color_balance_apply(struct StripColorBalance *cb, struct ImBuf *ibuf, float mul, short make_float, struct ImBuf *mask_input);
+
#endif /* __BKE_SEQUENCER_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 38a39ad492d..0a0635126f5 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -128,6 +128,7 @@ set(SRC
intern/script.c
intern/seqcache.c
intern/seqeffects.c
+ intern/seqmodifier.c
intern/sequencer.c
intern/shrinkwrap.c
intern/sketch.c
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index c456840637a..387d4775ad4 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -1798,7 +1798,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
if (seamEdges < 2 || seamEdges != v->numEdges)
seam = 0;
- if (!v->numEdges) {
+ if (!v->numEdges || ss->meshIFC.simpleSubdiv) {
VertDataCopy(nCo, co, ss);
}
else if (_vert_isBoundary(v)) {
@@ -2246,7 +2246,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
if (seamEdges < 2 || seamEdges != v->numEdges)
seam = 0;
- if (!v->numEdges) {
+ if (!v->numEdges || ss->meshIFC.simpleSubdiv) {
VertDataCopy(nCo, co, ss);
}
else if (_vert_isBoundary(v)) {
@@ -2827,6 +2827,11 @@ int ccgSubSurf_getGridLevelSize(const CCGSubSurf *ss, int level)
}
}
+int ccgSubSurf_getSimpleSubdiv(const CCGSubSurf *ss)
+{
+ return ss->meshIFC.simpleSubdiv;
+}
+
/* Vert accessors */
CCGVertHDL ccgSubSurf_getVertVertHandle(CCGVert *v)
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h
index 33b37ac281c..0f96bcf172d 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf.h
@@ -17,6 +17,7 @@ typedef struct CCGMeshIFC {
int vertUserSize, edgeUserSize, faceUserSize;
int numLayers;
int vertDataSize;
+ int simpleSubdiv;
} CCGMeshIFC;
/***/
@@ -91,6 +92,7 @@ int ccgSubSurf_getEdgeSize (const CCGSubSurf *ss);
int ccgSubSurf_getEdgeLevelSize (const CCGSubSurf *ss, int level);
int ccgSubSurf_getGridSize (const CCGSubSurf *ss);
int ccgSubSurf_getGridLevelSize (const CCGSubSurf *ss, int level);
+int ccgSubSurf_getSimpleSubdiv (const CCGSubSurf *ss);
CCGVert* ccgSubSurf_getVert (CCGSubSurf *ss, CCGVertHDL v);
CCGVertHDL ccgSubSurf_getVertVertHandle (CCGVert *v);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 120a0b2ba27..a29484638c0 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -498,7 +498,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
}
}
else {
- /*if no object, set to INT_MAX so we don't mess up any shapekey layers*/
+ /* if no object, set to INT_MAX so we don't mess up any shapekey layers */
uid = INT_MAX;
}
@@ -541,7 +541,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
CustomData_free(&me->pdata, me->totpoly);
/* ok, this should now use new CD shapekey data,
- * which shouuld be fed through the modifier
+ * which should be fed through the modifier
* stack*/
if (tmp.totvert != me->totvert && !did_shapekeys && me->key) {
printf("%s: YEEK! this should be recoded! Shape key loss!: ID '%s'\n", __func__, tmp.id.name);
@@ -1188,7 +1188,7 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
wtcol_v = calc_weightpaint_vert_array(ob, dm, draw_flag, coba);
/* Now copy colors in all face verts. */
- /*first add colors to the tessellation faces*/
+ /* first add colors to the tessellation faces */
/* XXX Why update that layer? We have to update WEIGHT_MLOOPCOL anyway,
* and tessellation recreates mface layers from mloop/mpoly ones, so no
* need to fill WEIGHT_MCOL here. */
@@ -1793,7 +1793,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
{
finaldm->recalcTessellation(finaldm);
}
- /* Even if tessellation is not needed, some modifiers migh have modified CD layers
+ /* Even if tessellation is not needed, some modifiers might have modified CD layers
* (like mloopcol or mloopuv), hence we have to update those. */
else if (finaldm->dirty & DM_DIRTY_TESS_CDLAYERS) {
/* A tessellation already exists, it should always have a CD_POLYINDEX. */
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 111ac68b345..9b4f0a31e28 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -282,7 +282,7 @@ void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
/* ........ */
-/* Note on evaluation optimisations:
+/* Note on evaluation optimizations:
* Optimisations currently used here play tricks with the depsgraph in order to try and
* evaluate as few objects as strictly necessary to get nicer performance under standard
* production conditions. For those people who really need the accurate version,
@@ -323,7 +323,7 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets)
/* update scene for current frame */
static void motionpaths_calc_update_scene(Scene *scene)
{
-#if 1 // 'production' optimisations always on
+#if 1 // 'production' optimizations always on
Base *base, *last = NULL;
/* only stuff that moves or needs display still */
@@ -431,7 +431,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
if (efra <= sfra) return;
/* optimize the depsgraph for faster updates */
- /* TODO: whether this is used should depend on some setting for the level of optimisations used */
+ /* TODO: whether this is used should depend on some setting for the level of optimizations used */
motionpaths_calc_optimise_depsgraph(scene, targets);
/* calculate path over requested range */
@@ -1279,9 +1279,9 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
if (part->dup_group == NULL || part->dup_group->gobject.first == NULL)
return;
- for (go = part->dup_group->gobject.first; go; go = go->next)
- if (go->ob == par)
- return;
+ if (BLI_findptr(&part->dup_group->gobject, par, offsetof(GroupObject, ob))) {
+ return;
+ }
}
/* if we have a hair particle system, use the path cache */
@@ -1469,6 +1469,18 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
quat_to_mat4(obmat, q);
obmat[3][3] = 1.0f;
+ /* add scaling if requested */
+ if ((part->draw & PART_DRAW_NO_SCALE_OB) == 0)
+ mult_m4_m4m4(obmat, obmat, size_mat);
+ }
+ else if (part->draw & PART_DRAW_NO_SCALE_OB) {
+ /* remove scaling */
+ float size_mat[4][4], original_size[3];
+
+ mat4_to_size(original_size, obmat);
+ size_to_mat4(size_mat, original_size);
+ invert_m4(size_mat);
+
mult_m4_m4m4(obmat, obmat, size_mat);
}
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index c10b1e2d4f4..04585791135 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -210,7 +210,7 @@ bArmature *BKE_armature_copy(bArmature *arm)
newArm = BKE_libblock_copy(&arm->id);
BLI_duplicatelist(&newArm->bonebase, &arm->bonebase);
- /* Duplicate the childrens' lists*/
+ /* Duplicate the childrens' lists */
newBone = newArm->bonebase.first;
for (oldBone = arm->bonebase.first; oldBone; oldBone = oldBone->next) {
newBone->parent = NULL;
@@ -1463,7 +1463,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3])
*
* was 0.0000000000001, caused bug [#31333], smaller values give unstable
* roll when toggling editmode again...
- * No good value here, trying 0.000000001 as best compromize. :/
+ * No good value here, trying 0.000000001 as best compromise. :/
*/
if (dot_v3v3(axis, axis) > 1.0e-9f) {
/* if nor is *not* a multiple of target ... */
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index e6259cc9faf..79d5e092a10 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -425,7 +425,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
if (flbr->ob) {
float vec2[3], t;
- /* first check we're not blocking the leader*/
+ /* first check we're not blocking the leader */
sub_v3_v3v3(vec, flbr->loc, flbr->oloc);
mul_v3_fl(vec, 1.0f/bbd->timestep);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 468861242d0..fde95e0767e 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -421,7 +421,7 @@ void BKE_brush_curve_preset(Brush *b, /*CurveMappingPreset*/ int preset)
b->curve->preset = preset;
curvemap_reset(cm, &b->curve->clipr, b->curve->preset, CURVEMAP_SLOPE_NEGATIVE);
- curvemapping_changed(b->curve, 0);
+ curvemapping_changed(b->curve, FALSE);
}
int BKE_brush_texture_set_nr(Brush *brush, int nr)
@@ -1253,7 +1253,9 @@ float BKE_brush_curve_strength_clamp(Brush *br, float p, const float len)
if (p >= len) return 0;
else p = p / len;
+ curvemapping_initialize(br->curve);
p = curvemapping_evaluateF(br->curve, 0, p);
+
if (p < 0.0f) p = 0.0f;
else if (p > 1.0f) p = 1.0f;
return p;
@@ -1267,6 +1269,7 @@ float BKE_brush_curve_strength(Brush *br, float p, const float len)
else
p = p / len;
+ curvemapping_initialize(br->curve);
return curvemapping_evaluateF(br->curve, 0, p);
}
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 88748d5f0b8..881caec8a58 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1869,7 +1869,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
dm->deformedOnly = 1;
- /*don't add origindex layer if one already exists*/
+ /* don't add origindex layer if one already exists */
add_orig = !CustomData_has_layer(&bm->pdata, CD_ORIGINDEX);
mask = use_mdisps ? CD_MASK_DERIVEDMESH | CD_MASK_MDISPS : CD_MASK_DERIVEDMESH;
@@ -1886,7 +1886,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
CustomData_merge(&bm->pdata, &dm->polyData, mask,
CD_CALLOC, dm->numPolyData);
- /*add tessellation mface layers*/
+ /* add tessellation mface layers */
if (use_tessface) {
CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em->tottri);
}
@@ -2260,7 +2260,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
newe = MEM_callocN(sizeof(int) * dm->numEdgeData, "newv etable CDDM_merge_verts");
newl = MEM_callocN(sizeof(int) * totloop, "newv ltable CDDM_merge_verts");
- /*fill newl with destination vertex indices*/
+ /* fill newl with destination vertex indices */
mv = cddm->mvert;
c = 0;
for (i = 0; i < dm->numVertData; i++, mv++) {
@@ -2271,14 +2271,14 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
}
}
- /*now link target vertices to destination indices*/
+ /* now link target vertices to destination indices */
for (i = 0; i < dm->numVertData; i++) {
if (vtargetmap[i] != -1) {
newv[i] = newv[vtargetmap[i]];
}
}
- /*find-replace merged vertices with target vertices*/
+ /* find-replace merged vertices with target vertices */
ml = cddm->mloop;
for (i = 0; i < totloop; i++, ml++) {
if (vtargetmap[ml->v] != -1) {
@@ -2286,7 +2286,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
}
}
- /*now go through and fix edges and faces*/
+ /* now go through and fix edges and faces */
med = cddm->medge;
c = 0;
for (i = 0; i < dm->numEdgeData; i++, med++) {
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 20fae973756..7c03c75bd99 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -56,13 +56,11 @@
/* ***************** operations on full struct ************* */
-CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
+void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float miny, float maxx, float maxy)
{
- CurveMapping *cumap;
int a;
float clipminx, clipminy, clipmaxx, clipmaxy;
- cumap = MEM_callocN(sizeof(CurveMapping), "new curvemap");
cumap->flag = CUMA_DO_CLIP;
if (tot == 4) cumap->cur = 3; /* rhms, hack for 'col' curve? */
@@ -89,58 +87,84 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
}
cumap->changed_timestamp = 0;
+}
+
+CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
+{
+ CurveMapping *cumap;
+
+ cumap = MEM_callocN(sizeof(CurveMapping), "new curvemap");
+
+ curvemapping_set_defaults(cumap, tot, minx, miny, maxx, maxy);
return cumap;
}
-void curvemapping_free(CurveMapping *cumap)
+void curvemapping_free_data(CurveMapping *cumap)
{
int a;
-
+
+ for (a = 0; a < CM_TOT; a++) {
+ if (cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
+ if (cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
+ if (cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
+ }
+}
+
+void curvemapping_free(CurveMapping *cumap)
+{
if (cumap) {
- for (a = 0; a < CM_TOT; a++) {
- if (cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
- if (cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
- if (cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
- }
+ curvemapping_free_data(cumap);
MEM_freeN(cumap);
}
}
-CurveMapping *curvemapping_copy(CurveMapping *cumap)
+void curvemapping_copy_data(CurveMapping *target, CurveMapping *cumap)
{
int a;
-
+
+ *target = *cumap;
+
+ for (a = 0; a < CM_TOT; a++) {
+ if (cumap->cm[a].curve)
+ target->cm[a].curve = MEM_dupallocN(cumap->cm[a].curve);
+ if (cumap->cm[a].table)
+ target->cm[a].table = MEM_dupallocN(cumap->cm[a].table);
+ if (cumap->cm[a].premultable)
+ target->cm[a].premultable = MEM_dupallocN(cumap->cm[a].premultable);
+ }
+}
+
+CurveMapping *curvemapping_copy(CurveMapping *cumap)
+{
if (cumap) {
CurveMapping *cumapn = MEM_dupallocN(cumap);
- for (a = 0; a < CM_TOT; a++) {
- if (cumap->cm[a].curve)
- cumapn->cm[a].curve = MEM_dupallocN(cumap->cm[a].curve);
- if (cumap->cm[a].table)
- cumapn->cm[a].table = MEM_dupallocN(cumap->cm[a].table);
- if (cumap->cm[a].premultable)
- cumapn->cm[a].premultable = MEM_dupallocN(cumap->cm[a].premultable);
- }
+ curvemapping_copy_data(cumapn, cumap);
return cumapn;
}
return NULL;
}
-void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], const float white[3])
+void curvemapping_set_black_white_ex(const float black[3], const float white[3], float r_bwmul[3])
{
int a;
-
- if (white)
+
+ for (a = 0; a < 3; a++) {
+ const float delta = maxf(white[a] - black[a], 1e-5f);
+ r_bwmul[a] = 1.0f / delta;
+ }
+}
+
+void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], const float white[3])
+{
+ if (white) {
copy_v3_v3(cumap->white, white);
- if (black)
+ }
+ if (black) {
copy_v3_v3(cumap->black, black);
-
- for (a = 0; a < 3; a++) {
- if (cumap->white[a] == cumap->black[a])
- cumap->bwmul[a] = 0.0f;
- else
- cumap->bwmul[a] = 1.0f / (cumap->white[a] - cumap->black[a]);
- }
+ }
+
+ curvemapping_set_black_white_ex(cumap->black, cumap->white, cumap->bwmul);
}
/* ***************** operations on single curve ************* */
@@ -173,7 +197,7 @@ void curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
}
/* removes with flag set */
-void curvemap_remove(CurveMap *cuma, int flag)
+void curvemap_remove(CurveMap *cuma, const short flag)
{
CurveMapPoint *cmp = MEM_mallocN((cuma->totpoint) * sizeof(CurveMapPoint), "curve points");
int a, b, removed = 0;
@@ -416,7 +440,7 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
/* in X, out Y.
* X is presumed to be outside first or last */
-static float curvemap_calc_extend(CurveMap *cuma, float x, const float first[2], const float last[2])
+static float curvemap_calc_extend(const CurveMap *cuma, float x, const float first[2], const float last[2])
{
if (x <= first[0]) {
if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
@@ -644,7 +668,7 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
CurveMap *cuma = cumap->cm + cumap->cur;
CurveMapPoint *cmp = cuma->curve;
rctf *clipr = &cumap->clipr;
- float thresh = 0.01f * (clipr->xmax - clipr->xmin);
+ float thresh = 0.01f * BLI_RCT_SIZE_X(clipr);
float dx = 0.0f, dy = 0.0f;
int a;
@@ -682,12 +706,12 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
dy = cmp[a].y - cmp[a + 1].y;
if (sqrtf(dx * dx + dy * dy) < thresh) {
if (a == 0) {
- cmp[a + 1].flag |= 2;
+ cmp[a + 1].flag |= CUMA_VECTOR;
if (cmp[a + 1].flag & CUMA_SELECT)
cmp[a].flag |= CUMA_SELECT;
}
else {
- cmp[a].flag |= 2;
+ cmp[a].flag |= CUMA_VECTOR;
if (cmp[a].flag & CUMA_SELECT)
cmp[a + 1].flag |= CUMA_SELECT;
}
@@ -707,7 +731,7 @@ void curvemapping_changed_all(CurveMapping *cumap)
for (a = 0; a < CM_TOT; a++) {
if (cumap->cm[a].curve) {
cumap->cur = a;
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
}
}
@@ -715,7 +739,7 @@ void curvemapping_changed_all(CurveMapping *cumap)
}
/* table should be verified */
-float curvemap_evaluateF(CurveMap *cuma, float value)
+float curvemap_evaluateF(const CurveMap *cuma, float value)
{
float fi;
int i;
@@ -737,49 +761,67 @@ float curvemap_evaluateF(CurveMap *cuma, float value)
}
/* works with curve 'cur' */
-float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value)
+float curvemapping_evaluateF(const CurveMapping *cumap, int cur, float value)
{
- CurveMap *cuma = cumap->cm + cur;
-
- /* allocate or bail out */
- if (cuma->table == NULL) {
- curvemap_make_table(cuma, &cumap->clipr);
- if (cuma->table == NULL)
- return 1.0f - value;
- }
+ const CurveMap *cuma = cumap->cm + cur;
return curvemap_evaluateF(cuma, value);
}
/* vector case */
-void curvemapping_evaluate3F(CurveMapping *cumap, float vecout[3], const float vecin[3])
+void curvemapping_evaluate3F(const CurveMapping *cumap, float vecout[3], const float vecin[3])
{
- vecout[0] = curvemapping_evaluateF(cumap, 0, vecin[0]);
- vecout[1] = curvemapping_evaluateF(cumap, 1, vecin[1]);
- vecout[2] = curvemapping_evaluateF(cumap, 2, vecin[2]);
+ vecout[0] = curvemap_evaluateF(&cumap->cm[0], vecin[0]);
+ vecout[1] = curvemap_evaluateF(&cumap->cm[1], vecin[1]);
+ vecout[2] = curvemap_evaluateF(&cumap->cm[2], vecin[2]);
}
/* RGB case, no black/white points, no premult */
-void curvemapping_evaluateRGBF(CurveMapping *cumap, float vecout[3], const float vecin[3])
+void curvemapping_evaluateRGBF(const CurveMapping *cumap, float vecout[3], const float vecin[3])
{
- vecout[0] = curvemapping_evaluateF(cumap, 0, curvemapping_evaluateF(cumap, 3, vecin[0]));
- vecout[1] = curvemapping_evaluateF(cumap, 1, curvemapping_evaluateF(cumap, 3, vecin[1]));
- vecout[2] = curvemapping_evaluateF(cumap, 2, curvemapping_evaluateF(cumap, 3, vecin[2]));
+ vecout[0] = curvemap_evaluateF(&cumap->cm[0], curvemap_evaluateF(&cumap->cm[3], vecin[0]));
+ vecout[1] = curvemap_evaluateF(&cumap->cm[1], curvemap_evaluateF(&cumap->cm[3], vecin[1]));
+ vecout[2] = curvemap_evaluateF(&cumap->cm[2], curvemap_evaluateF(&cumap->cm[3], vecin[2]));
}
+/** same as #curvemapping_evaluate_premulRGBF
+ * but black/bwmul are passed as args for the compositor
+ * where they can change per pixel.
+ *
+ * Use in conjunction with #curvemapping_set_black_white_ex
+ *
+ * \param black Use instead of cumap->black
+ * \param bwmul Use instead of cumap->bwmul
+ */
+void curvemapping_evaluate_premulRGBF_ex(const CurveMapping *cumap, float vecout[3], const float vecin[3],
+ const float black[3], const float bwmul[3])
+{
+ vecout[0] = curvemap_evaluateF(&cumap->cm[0], (vecin[0] - black[0]) * bwmul[0]);
+ vecout[1] = curvemap_evaluateF(&cumap->cm[1], (vecin[1] - black[1]) * bwmul[1]);
+ vecout[2] = curvemap_evaluateF(&cumap->cm[2], (vecin[2] - black[2]) * bwmul[2]);
+}
/* RGB with black/white points and premult. tables are checked */
-void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float vecout[3], const float vecin[3])
+void curvemapping_evaluate_premulRGBF(const CurveMapping *cumap, float vecout[3], const float vecin[3])
{
- float fac;
-
- fac = (vecin[0] - cumap->black[0]) * cumap->bwmul[0];
- vecout[0] = curvemap_evaluateF(cumap->cm, fac);
-
- fac = (vecin[1] - cumap->black[1]) * cumap->bwmul[1];
- vecout[1] = curvemap_evaluateF(cumap->cm + 1, fac);
-
- fac = (vecin[2] - cumap->black[2]) * cumap->bwmul[2];
- vecout[2] = curvemap_evaluateF(cumap->cm + 2, fac);
+ vecout[0] = curvemap_evaluateF(&cumap->cm[0], (vecin[0] - cumap->black[0]) * cumap->bwmul[0]);
+ vecout[1] = curvemap_evaluateF(&cumap->cm[1], (vecin[1] - cumap->black[1]) * cumap->bwmul[1]);
+ vecout[2] = curvemap_evaluateF(&cumap->cm[2], (vecin[2] - cumap->black[2]) * cumap->bwmul[2]);
+}
+
+/* same as above, byte version */
+void curvemapping_evaluate_premulRGB(const CurveMapping *cumap, unsigned char vecout_byte[3], const unsigned char vecin_byte[3])
+{
+ float vecin[3], vecout[3];
+
+ vecin[0] = (float) vecin_byte[0] / 255.0f;
+ vecin[1] = (float) vecin_byte[1] / 255.0f;
+ vecin[2] = (float) vecin_byte[2] / 255.0f;
+
+ curvemapping_evaluate_premulRGBF(cumap, vecout, vecin);
+
+ vecout_byte[0] = FTOCHAR(vecout[0]);
+ vecout_byte[1] = FTOCHAR(vecout[1]);
+ vecout_byte[2] = FTOCHAR(vecout[2]);
}
@@ -840,7 +882,7 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
curvemapping_premultiply(cumap, 1);
}
-int curvemapping_RGBA_does_something(CurveMapping *cumap)
+int curvemapping_RGBA_does_something(const CurveMapping *cumap)
{
int a;
@@ -876,13 +918,12 @@ void curvemapping_initialize(CurveMapping *cumap)
}
}
-void curvemapping_table_RGBA(CurveMapping *cumap, float **array, int *size)
+void curvemapping_table_RGBA(const CurveMapping *cumap, float **array, int *size)
{
int a;
*size = CM_TABLE + 1;
*array = MEM_callocN(sizeof(float) * (*size) * 4, "CurveMapping");
- curvemapping_initialize(cumap);
for (a = 0; a < *size; a++) {
if (cumap->cm[0].table)
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 16edbc3f0a9..00130dd3583 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3114,7 +3114,8 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar
copy_v3_v3(ownLoc, obmat[3]);
INIT_MINMAX(curveMin, curveMax);
- BKE_object_minmax(ct->tar, curveMin, curveMax);
+ /* XXX - don't think this is good calling this here - campbell */
+ BKE_object_minmax(ct->tar, curveMin, curveMax, TRUE);
/* get targetmatrix */
if (cu->path && cu->path->data) {
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index e2bb1aaa2c7..a2f88781cbb 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1165,7 +1165,7 @@ void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float
static void forward_diff_bezier_cotangent(const float p0[3], const float p1[3], const float p2[3], const float p3[3],
float p[3], int it, int stride)
{
- /* note that these are not purpendicular to the curve
+ /* note that these are not perpendicular to the curve
* they need to be rotated for this,
*
* This could also be optimized like BKE_curve_forward_diff_bezier */
@@ -3047,29 +3047,6 @@ void BKE_nurbList_handles_set(ListBase *editnurb, short code)
}
}
-static void swapdata(void *adr1, void *adr2, int len)
-{
-
- if (len <= 0) return;
-
- if (len < 65) {
- char adr[64];
-
- memcpy(adr, adr1, len);
- memcpy(adr1, adr2, len);
- memcpy(adr2, adr, len);
- }
- else {
- char *adr;
-
- adr = (char *)MEM_mallocN(len, "curve swap");
- memcpy(adr, adr1, len);
- memcpy(adr1, adr2, len);
- memcpy(adr2, adr, len);
- MEM_freeN(adr);
- }
-}
-
void BKE_nurb_direction_switch(Nurb *nu)
{
BezTriple *bezt1, *bezt2;
@@ -3077,7 +3054,9 @@ void BKE_nurb_direction_switch(Nurb *nu)
float *fp1, *fp2, *tempf;
int a, b;
- if (nu->pntsu == 1 && nu->pntsv == 1) return;
+ if (nu->pntsu == 1 && nu->pntsv == 1) {
+ return;
+ }
if (nu->type == CU_BEZIER) {
a = nu->pntsu;
@@ -3086,19 +3065,22 @@ void BKE_nurb_direction_switch(Nurb *nu)
if (a & 1) a += 1; /* if odd, also swap middle content */
a /= 2;
while (a > 0) {
- if (bezt1 != bezt2)
+ if (bezt1 != bezt2) {
SWAP(BezTriple, *bezt1, *bezt2);
+ }
+
+ swap_v3_v3(bezt1->vec[0], bezt1->vec[2]);
- swapdata(bezt1->vec[0], bezt1->vec[2], 12);
- if (bezt1 != bezt2)
- swapdata(bezt2->vec[0], bezt2->vec[2], 12);
+ if (bezt1 != bezt2) {
+ swap_v3_v3(bezt2->vec[0], bezt2->vec[2]);
+ }
SWAP(char, bezt1->h1, bezt1->h2);
- SWAP(short, bezt1->f1, bezt1->f3);
+ SWAP(char, bezt1->f1, bezt1->f3);
if (bezt1 != bezt2) {
SWAP(char, bezt2->h1, bezt2->h2);
- SWAP(short, bezt2->f1, bezt2->f3);
+ SWAP(char, bezt2->f1, bezt2->f3);
bezt1->alfa = -bezt1->alfa;
bezt2->alfa = -bezt2->alfa;
}
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index d92c4ca8632..a00bea38e51 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -72,25 +72,29 @@ typedef struct LayerTypeInfo {
const char *structname; /* name of the struct used, for file writing */
int structnum; /* number of structs per element, for file writing */
- /* default layer name.
+ /**
+ * default layer name.
* note! when NULL this is a way to ensure there is only ever one item
* see: CustomData_layertype_is_singleton() */
const char *defaultname;
- /* a function to copy count elements of this layer's data
+ /**
+ * a function to copy count elements of this layer's data
* (deep copy if appropriate)
* if NULL, memcpy is used
*/
void (*copy)(const void *source, void *dest, int count);
- /* a function to free any dynamically allocated components of this
+ /**
+ * a function to free any dynamically allocated components of this
* layer's data (note the data pointer itself should not be freed)
* size should be the size of one element of this layer's data (e.g.
* LayerTypeInfo.size)
*/
void (*free)(void *data, int count, int size);
- /* a function to interpolate between count source elements of this
+ /**
+ * a function to interpolate between count source elements of this
* layer's data and store the result in dest
* if weights == NULL or sub_weights == NULL, they should default to 1
*
@@ -98,18 +102,24 @@ typedef struct LayerTypeInfo {
* sub_weights gives the sub-element weights for each element in sources
* (there should be (sub element count)^2 weights per element)
* count gives the number of elements in sources
+ *
+ * \note in some cases \a dest pointer is in \a sources
+ * so all functions have to take this into account and delay
+ * applying changes while reading from sources.
+ * See bug [#32395] - Campbell.
*/
- void (*interp)(void **sources, float *weights, float *sub_weights,
+ void (*interp)(void **sources, const float *weights, const float *sub_weights,
int count, void *dest);
- /* a function to swap the data in corners of the element */
+ /** a function to swap the data in corners of the element */
void (*swap)(void *data, const int *corner_indices);
- /* a function to set a layer's data to default values. if NULL, the
+ /**
+ * a function to set a layer's data to default values. if NULL, the
* default is assumed to be all zeros */
void (*set_default)(void *data, int count);
- /* functions necessary for geometry collapse*/
+ /** functions necessary for geometry collapse */
int (*equal)(void *data1, void *data2);
void (*multiply)(void *data, float fac);
void (*initminmax)(void *min, void *max);
@@ -117,13 +127,13 @@ typedef struct LayerTypeInfo {
void (*dominmax)(void *data1, void *min, void *max);
void (*copyvalue)(void *source, void *dest);
- /* a function to read data from a cdf file */
+ /** a function to read data from a cdf file */
int (*read)(CDataFile *cdf, void *data, int count);
- /* a function to write data to a cdf file */
+ /** a function to write data to a cdf file */
int (*write)(CDataFile *cdf, void *data, int count);
- /* a function to determine file size */
+ /** a function to determine file size */
size_t (*filesize)(CDataFile *cdf, void *data, int count);
} LayerTypeInfo;
@@ -203,8 +213,8 @@ static void linklist_free_simple(void *link)
MEM_freeN(link);
}
-static void layerInterp_mdeformvert(void **sources, float *weights,
- float *UNUSED(sub_weights), int count, void *dest)
+static void layerInterp_mdeformvert(void **sources, const float *weights,
+ const float *UNUSED(sub_weights), int count, void *dest)
{
MDeformVert *dvert = dest;
LinkNode *dest_dw = NULL; /* a list of lists of MDeformWeight pointers */
@@ -243,6 +253,8 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
}
}
+ /* delay writing to the destination incase dest is in sources */
+
/* now we know how many unique deform weights there are, so realloc */
if (dvert->dw) MEM_freeN(dvert->dw);
@@ -261,8 +273,8 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
}
-static void layerInterp_msticky(void **sources, float *weights,
- float *UNUSED(sub_weights), int count, void *dest)
+static void layerInterp_msticky(void **sources, const float *weights,
+ const float *UNUSED(sub_weights), int count, void *dest)
{
float co[2], w;
MSticky *mst;
@@ -276,6 +288,7 @@ static void layerInterp_msticky(void **sources, float *weights,
madd_v2_v2fl(co, mst->co, w);
}
+ /* delay writing to the destination incase dest is in sources */
mst = (MSticky *)dest;
copy_v2_v2(mst->co, co);
}
@@ -291,13 +304,13 @@ static void layerCopy_tface(const void *source, void *dest, int count)
dest_tf[i] = source_tf[i];
}
-static void layerInterp_tface(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+static void layerInterp_tface(void **sources, const float *weights,
+ const float *sub_weights, int count, void *dest)
{
MTFace *tf = dest;
int i, j, k;
float uv[4][2] = {{0.0f}};
- float *sub_weight;
+ const float *sub_weight;
if (count <= 0) return;
@@ -318,6 +331,7 @@ static void layerInterp_tface(void **sources, float *weights,
}
}
+ /* delay writing to the destination incase dest is in sources */
*tf = *(MTFace *)(*sources);
memcpy(tf->uv, uv, sizeof(tf->uv));
}
@@ -392,13 +406,13 @@ static void layerCopy_origspace_face(const void *source, void *dest, int count)
dest_tf[i] = source_tf[i];
}
-static void layerInterp_origspace_face(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+static void layerInterp_origspace_face(void **sources, const float *weights,
+ const float *sub_weights, int count, void *dest)
{
OrigSpaceFace *osf = dest;
int i, j, k;
float uv[4][2] = {{0.0f}};
- float *sub_weight;
+ const float *sub_weight;
if (count <= 0) return;
@@ -419,6 +433,8 @@ static void layerInterp_origspace_face(void **sources, float *weights,
}
}
+ /* delay writing to the destination incase dest is in sources */
+
#if 0 /* no need, this ONLY contains UV's */
*osf = *(OrigSpaceFace *)(*sources);
#endif
@@ -680,12 +696,12 @@ static void layerDefault_mloopcol(void *data, int count)
}
-static void layerInterp_mloopcol(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+static void layerInterp_mloopcol(void **sources, const float *weights,
+ const float *sub_weights, int count, void *dest)
{
MLoopCol *mc = dest;
int i;
- float *sub_weight;
+ const float *sub_weight;
struct {
float a;
float r;
@@ -719,7 +735,8 @@ static void layerInterp_mloopcol(void **sources, float *weights,
CLAMP(col.r, 0.0f, 255.0f);
CLAMP(col.g, 0.0f, 255.0f);
CLAMP(col.b, 0.0f, 255.0f);
-
+
+ /* delay writing to the destination incase dest is in sources */
mc->r = (int)col.r;
mc->g = (int)col.g;
mc->b = (int)col.b;
@@ -768,11 +785,10 @@ static void layerAdd_mloopuv(void *data1, void *data2)
add_v2_v2(l1->uv, l2->uv);
}
-static void layerInterp_mloopuv(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+static void layerInterp_mloopuv(void **sources, const float *weights,
+ const float *sub_weights, int count, void *dest)
{
- MLoopUV *mluv = dest;
- float *uv = mluv->uv;
+ float uv[2];
int i;
zero_v2(uv);
@@ -793,6 +809,9 @@ static void layerInterp_mloopuv(void **sources, float *weights,
madd_v2_v2fl(uv, src->uv, weight);
}
}
+
+ /* delay writing to the destination incase dest is in sources */
+ copy_v2_v2(((MLoopUV *)dest)->uv, uv);
}
/* origspace is almost exact copy of mloopuv's, keep in sync */
@@ -838,11 +857,10 @@ static void layerAdd_mloop_origspace(void *data1, void *data2)
add_v2_v2(l1->uv, l2->uv);
}
-static void layerInterp_mloop_origspace(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+static void layerInterp_mloop_origspace(void **sources, const float *weights,
+ const float *sub_weights, int count, void *dest)
{
- OrigSpaceLoop *mluv = dest;
- float *uv = mluv->uv;
+ float uv[2];
int i;
zero_v2(uv);
@@ -858,16 +876,19 @@ static void layerInterp_mloop_origspace(void **sources, float *weights,
}
else {
for (i = 0; i < count; i++) {
- float weight = weights ? weights[i] : 1;
+ float weight = weights ? weights[i] : 1.0f;
OrigSpaceLoop *src = sources[i];
madd_v2_v2fl(uv, src->uv, weight);
}
}
+
+ /* delay writing to the destination incase dest is in sources */
+ copy_v2_v2(((OrigSpaceLoop *)dest)->uv, uv);
}
/* --- end copy */
-static void layerInterp_mcol(void **sources, float *weights,
- float *sub_weights, int count, void *dest)
+static void layerInterp_mcol(void **sources, const float *weights,
+ const float *sub_weights, int count, void *dest)
{
MCol *mc = dest;
int i, j, k;
@@ -878,7 +899,7 @@ static void layerInterp_mcol(void **sources, float *weights,
float b;
} col[4] = {{0.0f}};
- float *sub_weight;
+ const float *sub_weight;
if (count <= 0) return;
@@ -907,6 +928,7 @@ static void layerInterp_mcol(void **sources, float *weights,
}
}
+ /* delay writing to the destination incase dest is in sources */
for (j = 0; j < 4; ++j) {
/* Subdivide smooth or fractal can cause problems without clamping
@@ -946,33 +968,36 @@ static void layerDefault_mcol(void *data, int count)
}
}
-static void layerInterp_bweight(void **sources, float *weights,
- float *UNUSED(sub_weights), int count, void *dest)
+static void layerInterp_bweight(void **sources, const float *weights,
+ const float *UNUSED(sub_weights), int count, void *dest)
{
- float *f = dest;
+ float f;
float **in = (float **)sources;
int i;
if (count <= 0) return;
- *f = 0.0f;
+ f = 0.0f;
if (weights) {
for (i = 0; i < count; ++i) {
- *f += *in[i] * weights[i];
+ f += *in[i] * weights[i];
}
}
else {
for (i = 0; i < count; ++i) {
- *f += *in[i];
+ f += *in[i];
}
}
+
+ /* delay writing to the destination incase dest is in sources */
+ *((float *)dest) = f;
}
-static void layerInterp_shapekey(void **sources, float *weights,
- float *UNUSED(sub_weights), int count, void *dest)
+static void layerInterp_shapekey(void **sources, const float *weights,
+ const float *UNUSED(sub_weights), int count, void *dest)
{
- float *co = dest;
+ float co[3];
float **in = (float **)sources;
int i;
@@ -990,6 +1015,9 @@ static void layerInterp_shapekey(void **sources, float *weights,
add_v3_v3(co, in[i]);
}
}
+
+ /* delay writing to the destination incase dest is in sources */
+ copy_v3_v3((float *)dest, co);
}
static void layerDefault_mvert_skin(void *data, int count)
@@ -1003,8 +1031,8 @@ static void layerDefault_mvert_skin(void *data, int count)
}
}
-static void layerInterp_mvert_skin(void **sources, float *weights,
- float *UNUSED(sub_weights),
+static void layerInterp_mvert_skin(void **sources, const float *weights,
+ const float *UNUSED(sub_weights),
int count, void *dest)
{
float radius[3], w;
@@ -1019,6 +1047,7 @@ static void layerInterp_mvert_skin(void **sources, float *weights,
madd_v3_v3fl(radius, vs->radius, w);
}
+ /* delay writing to the destination incase dest is in sources */
vs = dest;
copy_v3_v3(vs->radius, radius);
vs->flag &= ~MVERT_SKIN_ROOT;
@@ -1898,7 +1927,7 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
- ++dest_i;
+ dest_i++;
}
/* if there are no more dest layers, we're done */
@@ -1936,7 +1965,7 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
* we don't want to copy all source layers to the same dest, so
* increment dest_i
*/
- ++dest_i;
+ dest_i++;
}
}
}
@@ -1989,7 +2018,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
- ++dest_i;
+ dest_i++;
}
/* if there are no more dest layers, we're done */
@@ -1999,8 +2028,9 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
if (dest->layers[dest_i].type == source->layers[src_i].type) {
void *src_data = source->layers[src_i].data;
- for (j = 0; j < count; ++j)
+ for (j = 0; j < count; ++j) {
sources[j] = (char *)src_data + typeInfo->size * src_indices[j];
+ }
dest_offset = dest_index * typeInfo->size;
@@ -2011,7 +2041,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
* we don't want to copy all source layers to the same dest, so
* increment dest_i
*/
- ++dest_i;
+ dest_i++;
}
}
@@ -2139,8 +2169,8 @@ void CustomData_set(const CustomData *data, int index, int type, void *source)
memcpy(dest, source, typeInfo->size);
}
-/*Bmesh functions*/
-/*needed to convert to/from different face reps*/
+/* BMesh functions */
+/* needed to convert to/from different face reps */
void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata,
int totloop, int totpoly)
{
@@ -2401,7 +2431,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
- ++dest_i;
+ dest_i++;
}
/* if there are no more dest layers, we're done */
@@ -2425,7 +2455,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
* we don't want to copy all source layers to the same dest, so
* increment dest_i
*/
- ++dest_i;
+ dest_i++;
}
}
}
@@ -2590,8 +2620,9 @@ void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights
CustomDataLayer *layer = &data->layers[i];
const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
if (typeInfo->interp) {
- for (j = 0; j < count; ++j)
+ for (j = 0; j < count; ++j) {
sources[j] = (char *)src_blocks[j] + layer->offset;
+ }
typeInfo->interp(sources, weights, sub_weights, count,
(char *)dest_block + layer->offset);
@@ -2637,7 +2668,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
- ++dest_i;
+ dest_i++;
}
/* if there are no more dest layers, we're done */
@@ -2661,7 +2692,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
* we don't want to copy all source layers to the same dest, so
* increment dest_i
*/
- ++dest_i;
+ dest_i++;
}
}
}
@@ -2680,7 +2711,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
* (this should work because layers are ordered by type)
*/
while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
- ++dest_i;
+ dest_i++;
}
/* if there are no more dest layers, we're done */
@@ -2704,7 +2735,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
* we don't want to copy all source layers to the same dest, so
* increment dest_i
*/
- ++dest_i;
+ dest_i++;
}
}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index b22e24e15d4..1b53f8980cb 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -570,12 +570,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
/* softbody collision */
if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_LATTICE)) {
- if (modifiers_isModifierEnabled(ob, eModifierType_Softbody)
- || modifiers_isModifierEnabled(ob, eModifierType_Cloth)
- || modifiers_isModifierEnabled(ob, eModifierType_Smoke)
- || modifiers_isModifierEnabled(ob, eModifierType_DynamicPaint)
- || ob->particlesystem.first)
+ if (ob->particlesystem.first ||
+ modifiers_isModifierEnabled(ob, eModifierType_Softbody) ||
+ modifiers_isModifierEnabled(ob, eModifierType_Cloth) ||
+ modifiers_isModifierEnabled(ob, eModifierType_Smoke) ||
+ modifiers_isModifierEnabled(ob, eModifierType_DynamicPaint))
+ {
dag_add_collision_field_relation(dag, scene, ob, node); /* TODO: use effectorweight->group */
+ }
}
/* object data drivers */
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 0daf06c6305..06807dfcbad 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -3996,7 +3996,7 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa
float force_intersect;
float temp;
- /* project force vector on the plane determined by these two neightbour points
+ /* project force vector on the plane determined by these two neighbor points
* and calculate relative force angle from it*/
cross_v3_v3v3(tangent, bNeighs[closest_id[0]].dir, bNeighs[closest_id[1]].dir);
normalize_v3(tangent);
@@ -4318,7 +4318,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
dir_factor = dir_dot * MIN2(speed_scale, 1.0f) * w_factor;
if (dir_factor > 0.5f) dir_factor = 0.5f;
- /* mix new wetness*/
+ /* mix new wetness */
ePoint->wetness += dir_factor;
CLAMP(ePoint->wetness, 0.0f, MAX_WETNESS);
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 32c6caffff7..c6ba6a0d841 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -151,7 +151,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
#endif
BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
- /*don't consider two-edged faces*/
+ /* don't consider two-edged faces */
if (efa->len < 3) {
/* do nothing */
}
@@ -198,7 +198,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
/* scanfill time */
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, j) {
- /*mark order*/
+ /*mark order */
BM_elem_index_set(l, j); /* set_loop */
sf_vert = BLI_scanfill_vert_add(&sf_ctx, l->v->co);
@@ -334,7 +334,7 @@ typedef struct EditDerivedBMesh {
float (*polyNos)[3];
/* private variables, for number of verts/edges/faces
- * within the above hash/table members*/
+ * within the above hash/table members */
int tv, te, tf;
} EditDerivedBMesh;
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 97b245bd067..53c12d32bc1 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -365,7 +365,7 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short
/* initialize replace-flag first */
*replace = 0;
- /* sneaky optimisations (don't go through searching process if...):
+ /* sneaky optimizations (don't go through searching process if...):
* - keyframe to be added is to be added out of current bounds
* - keyframe to be added would replace one of the existing ones on bounds
*/
@@ -433,16 +433,18 @@ int binarysearch_bezt_index(BezTriple array[], float frame, int arraylen, short
/* ...................................... */
/* helper for calc_fcurve_* functions -> find first and last BezTriple to be used */
-static void get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple **last,
- const short do_sel_only)
+static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple **last,
+ const short do_sel_only)
{
+ short found = FALSE;
+
/* init outputs */
*first = NULL;
*last = NULL;
/* sanity checks */
if (fcu->bezt == NULL)
- return;
+ return found;
/* only include selected items? */
if (do_sel_only) {
@@ -454,6 +456,7 @@ static void get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple *
for (i = 0; i < fcu->totvert; bezt++, i++) {
if (BEZSELECTED(bezt)) {
*first = bezt;
+ found = TRUE;
break;
}
}
@@ -463,6 +466,7 @@ static void get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple *
for (i = 0; i < fcu->totvert; bezt--, i++) {
if (BEZSELECTED(bezt)) {
*last = bezt;
+ found = TRUE;
break;
}
}
@@ -471,13 +475,16 @@ static void get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple *
/* just full array */
*first = fcu->bezt;
*last = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, sizeof(BezTriple), fcu->totvert);
+ found = TRUE;
}
+
+ return found;
}
/* Calculate the extents of F-Curve's data */
-void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
- const short do_sel_only, const short include_handles)
+short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax,
+ const short do_sel_only, const short include_handles)
{
float xminv = 999999999.0f, xmaxv = -999999999.0f;
float yminv = 999999999.0f, ymaxv = -999999999.0f;
@@ -490,7 +497,7 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
if (xmin || xmax) {
/* get endpoint keyframes */
- get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only);
+ foundvert = get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only);
if (bezt_first) {
BLI_assert(bezt_last != NULL);
@@ -566,6 +573,8 @@ void calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa
if (ymin) *ymin = 0.0f;
if (ymax) *ymax = 1.0f;
}
+
+ return foundvert;
}
/* Calculate the extents of F-Curve's keyframes */
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 02e5dc02746..0ffd68c9079 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -60,10 +60,8 @@
#include "BKE_curve.h"
#include "BKE_displist.h"
-static ListBase ttfdata = {NULL, NULL};
/* The vfont code */
-
void BKE_vfont_free_data(struct VFont *vfont)
{
if (vfont->data) {
@@ -83,7 +81,10 @@ void BKE_vfont_free_data(struct VFont *vfont)
vfont->data = NULL;
}
- BKE_vfont_tmpfont_remove(vfont);
+ if (vfont->temp_pf) {
+ freePackedFile(vfont->temp_pf); /* NULL when the font file can't be found on disk */
+ vfont->temp_pf = NULL;
+ }
}
void BKE_vfont_free(struct VFont *vf)
@@ -91,7 +92,7 @@ void BKE_vfont_free(struct VFont *vf)
if (vf == NULL) return;
BKE_vfont_free_data(vf);
-
+
if (vf->packedfile) {
freePackedFile(vf->packedfile);
vf->packedfile = NULL;
@@ -128,63 +129,11 @@ static PackedFile *get_builtin_packedfile(void)
}
}
-static void vfont_tmpfont_free(struct TmpFont *tf)
-{
- if (tf->pf) {
- freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
- }
- MEM_freeN(tf);
-}
-
-void BKE_vfont_free_global_ttf(void)
-{
- struct TmpFont *tf, *tf_next;
-
- for (tf = ttfdata.first; tf; tf = tf_next) {
- tf_next = tf->next;
- vfont_tmpfont_free(tf);
- }
- ttfdata.first = ttfdata.last = NULL;
-}
-
-struct TmpFont *BKE_vfont_tmpfont_find(VFont *vfont)
-{
- struct TmpFont *tmpfnt = NULL;
-
- if (vfont == NULL) return NULL;
-
- /* Try finding the font from font list */
- for (tmpfnt = ttfdata.first; tmpfnt; tmpfnt = tmpfnt->next) {
- if (tmpfnt->vfont == vfont) {
- break;
- }
- }
-
- return tmpfnt;
-}
-
-/* assumes a VFont's tmpfont can't be in the database more then once */
-void BKE_vfont_tmpfont_remove(VFont *vfont)
-{
- struct TmpFont *tmpfnt;
-
- tmpfnt = BKE_vfont_tmpfont_find(vfont);
-
- if (tmpfnt) {
- vfont_tmpfont_free(tmpfnt);
- BLI_remlink(&ttfdata, tmpfnt);
- }
-}
-
static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
{
- struct TmpFont *tmpfnt = NULL;
- PackedFile *tpf;
-
- if (vfont == NULL) return NULL;
-
- /* Try finding the font from font list */
- tmpfnt = BKE_vfont_tmpfont_find(vfont);
+ if (vfont == NULL) {
+ return NULL;
+ }
/* And then set the data */
if (!vfont->data) {
@@ -198,30 +147,15 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
pf = vfont->packedfile;
/* We need to copy a tmp font to memory unless it is already there */
- if (!tmpfnt) {
- tpf = MEM_callocN(sizeof(*tpf), "PackedFile");
- tpf->data = MEM_mallocN(pf->size, "packFile");
- tpf->size = pf->size;
- memcpy(tpf->data, pf->data, pf->size);
-
- /* Add temporary packed file to globals */
- tmpfnt = (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
- tmpfnt->pf = tpf;
- tmpfnt->vfont = vfont;
- BLI_addtail(&ttfdata, tmpfnt);
+ if (vfont->temp_pf == NULL) {
+ vfont->temp_pf = dupPackedFile(pf);
}
}
else {
pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
- if (!tmpfnt) {
- tpf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
-
- /* Add temporary packed file to globals */
- tmpfnt = (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
- tmpfnt->pf = tpf;
- tmpfnt->vfont = vfont;
- BLI_addtail(&ttfdata, tmpfnt);
+ if (vfont->temp_pf == NULL) {
+ vfont->temp_pf = newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
}
}
if (!pf) {
@@ -252,9 +186,8 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
char filename[FILE_MAXFILE];
VFont *vfont = NULL;
PackedFile *pf;
- PackedFile *tpf = NULL;
+ PackedFile *temp_pf = NULL;
int is_builtin;
- struct TmpFont *tmpfnt;
if (strcmp(name, FO_BUILTIN_NAME) == 0) {
BLI_strncpy(filename, name, sizeof(filename));
@@ -269,7 +202,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
BLI_splitdirstring(dir, filename);
pf = newPackedFile(NULL, name, bmain->name);
- tpf = newPackedFile(NULL, name, bmain->name);
+ temp_pf = newPackedFile(NULL, name, bmain->name);
is_builtin = FALSE;
}
@@ -295,10 +228,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
/* Do not add FO_BUILTIN_NAME to temporary listbase */
if (strcmp(filename, FO_BUILTIN_NAME)) {
- tmpfnt = (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
- tmpfnt->pf = tpf;
- tmpfnt->vfont = vfont;
- BLI_addtail(&ttfdata, tmpfnt);
+ vfont->temp_pf = temp_pf;
}
}
@@ -306,8 +236,6 @@ VFont *BKE_vfont_load(Main *bmain, const char *name)
if (!vfont || vfont->packedfile != pf) {
freePackedFile(pf);
}
-
- //XXX waitcursor(0);
}
return vfont;
@@ -317,14 +245,14 @@ static VFont *which_vfont(Curve *cu, CharInfo *info)
{
switch (info->flag & (CU_CHINFO_BOLD | CU_CHINFO_ITALIC)) {
case CU_CHINFO_BOLD:
- if (cu->vfontb) return(cu->vfontb); else return(cu->vfont);
+ return cu->vfontb ? cu->vfontb : cu->vfont;
case CU_CHINFO_ITALIC:
- if (cu->vfonti) return(cu->vfonti); else return(cu->vfont);
+ return cu->vfonti ? cu->vfonti : cu->vfont;
case (CU_CHINFO_BOLD | CU_CHINFO_ITALIC):
- if (cu->vfontbi) return(cu->vfontbi); else return(cu->vfont);
+ return cu->vfontbi ? cu->vfontbi : cu->vfont;
default:
- return(cu->vfont);
- }
+ return cu->vfont;
+ }
}
VFont *BKE_vfont_builtin_get(void)
@@ -344,6 +272,7 @@ static VChar *find_vfont_char(VFontData *vfd, intptr_t character)
{
VChar *che = NULL;
+ /* TODO: use ghash */
for (che = vfd->characters.first; che; che = che->next) {
if (che->index == character)
break;
@@ -422,7 +351,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
}
#endif
- /* make a copy at distance ofsx, ofsy with shear*/
+ /* make a copy at distance ofsx, ofsy with shear */
fsize = cu->fsize;
shear = cu->shear;
si = sinf(rot);
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c317dc63ef7..2ec5801746c 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -97,7 +97,7 @@ void free_gpencil_layers(ListBase *list)
/* error checking */
if (list == NULL) return;
- /* delete layers*/
+ /* delete layers */
for (gpl = list->first; gpl; gpl = gpln) {
gpln = gpl->next;
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 89341845615..500df1b7b75 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -161,11 +161,13 @@ static int add_to_group_internal(Group *group, Object *ob)
{
GroupObject *go;
- if (group == NULL || ob == NULL) return 0;
+ if (group == NULL || ob == NULL) {
+ return FALSE;
+ }
/* check if the object has been added already */
- for (go = group->gobject.first; go; go = go->next) {
- if (go->ob == ob) return 0;
+ if (BLI_findptr(&group->gobject, ob, offsetof(GroupObject, ob))) {
+ return FALSE;
}
go = MEM_callocN(sizeof(GroupObject), "groupobject");
@@ -173,7 +175,7 @@ static int add_to_group_internal(Group *group, Object *ob)
go->ob = ob;
- return 1;
+ return TRUE;
}
int add_to_group(Group *group, Object *object, Scene *scene, Base *base)
@@ -239,15 +241,11 @@ int rem_from_group(Group *group, Object *object, Scene *scene, Base *base)
int object_in_group(Object *ob, Group *group)
{
- GroupObject *go;
-
- if (group == NULL || ob == NULL) return 0;
-
- for (go = group->gobject.first; go; go = go->next) {
- if (go->ob == ob)
- return 1;
+ if (group == NULL || ob == NULL) {
+ return FALSE;
}
- return 0;
+
+ return (BLI_findptr(&group->gobject, ob, offsetof(GroupObject, ob)) != NULL);
}
Group *find_group(Object *ob, Group *group)
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index a65d03e64cf..7456f9aab8b 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -159,12 +159,12 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
newarr = MEM_callocN(sizeof(IDProperty) * newsize, "idproperty array resized");
if (newlen >= prop->len) {
- /* newlen is bigger*/
+ /* newlen is bigger */
memcpy(newarr, prop->data.pointer, prop->len * sizeof(IDProperty));
}
else {
int i;
- /* newlen is smaller*/
+ /* newlen is smaller */
for (i = newlen; i < prop->len; i++) {
IDP_FreeProperty(GETPROP(prop, i));
}
@@ -233,12 +233,12 @@ void IDP_ResizeArray(IDProperty *prop, int newlen)
newarr = MEM_callocN(idp_size_table[(int)prop->subtype] * newsize, "idproperty array resized");
if (newlen >= prop->len) {
- /* newlen is bigger*/
+ /* newlen is bigger */
memcpy(newarr, prop->data.pointer, prop->len * idp_size_table[(int)prop->subtype]);
idp_resize_group_array(prop, newlen, newarr);
}
else {
- /* newlen is smaller*/
+ /* newlen is smaller */
idp_resize_group_array(prop, newlen, newarr);
memcpy(newarr, prop->data.pointer, newlen * idp_size_table[(int)prop->subtype]);
}
@@ -694,7 +694,7 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
break;
case IDP_ARRAY:
{
- /*for now, we only support float and int and double arrays*/
+ /* for now, we only support float and int and double arrays */
if ( (val->array.type == IDP_FLOAT) ||
(val->array.type == IDP_INT) ||
(val->array.type == IDP_DOUBLE) ||
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 5f6fedc553c..2b2128439c7 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1212,43 +1212,46 @@ void BKE_imformat_defaults(ImageFormatData *im_format)
void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *imbuf)
{
+ int ftype = imbuf->ftype & ~IB_CUSTOM_FLAGS_MASK;
+ int custom_flags = imbuf->ftype & IB_CUSTOM_FLAGS_MASK;
+
BKE_imformat_defaults(im_format);
/* file type */
- if (imbuf->ftype == IMAGIC)
+ if (ftype == IMAGIC)
im_format->imtype = R_IMF_IMTYPE_IRIS;
#ifdef WITH_HDR
- else if (imbuf->ftype == RADHDR)
+ else if (ftype == RADHDR)
im_format->imtype = R_IMF_IMTYPE_RADHDR;
#endif
- else if (imbuf->ftype == PNG)
+ else if (ftype == PNG)
im_format->imtype = R_IMF_IMTYPE_PNG;
#ifdef WITH_DDS
- else if (imbuf->ftype == DDS)
+ else if (ftype == DDS)
im_format->imtype = R_IMF_IMTYPE_DDS;
#endif
- else if (imbuf->ftype == BMP)
+ else if (ftype == BMP)
im_format->imtype = R_IMF_IMTYPE_BMP;
#ifdef WITH_TIFF
- else if (imbuf->ftype & TIF) {
+ else if (ftype == TIF) {
im_format->imtype = R_IMF_IMTYPE_TIFF;
- if (imbuf->ftype & TIF_16BIT)
+ if (custom_flags & TIF_16BIT)
im_format->depth = R_IMF_CHAN_DEPTH_16;
}
#endif
#ifdef WITH_OPENEXR
- else if (imbuf->ftype & OPENEXR) {
+ else if (ftype == OPENEXR) {
im_format->imtype = R_IMF_IMTYPE_OPENEXR;
- if (imbuf->ftype & OPENEXR_HALF)
+ if (custom_flags & OPENEXR_HALF)
im_format->depth = R_IMF_CHAN_DEPTH_16;
- if (imbuf->ftype & OPENEXR_COMPRESS)
+ if (custom_flags & OPENEXR_COMPRESS)
im_format->exr_codec = R_IMF_EXR_CODEC_ZIP; // Can't determine compression
if (imbuf->zbuf_float)
im_format->flag |= R_IMF_FLAG_ZBUF;
@@ -1256,35 +1259,35 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
#endif
#ifdef WITH_CINEON
- else if (imbuf->ftype == CINEON)
+ else if (ftype == CINEON)
im_format->imtype = R_IMF_IMTYPE_CINEON;
- else if (imbuf->ftype == DPX)
+ else if (ftype == DPX)
im_format->imtype = R_IMF_IMTYPE_DPX;
#endif
- else if (imbuf->ftype == TGA) {
+ else if (ftype == TGA) {
im_format->imtype = R_IMF_IMTYPE_TARGA;
}
- else if (imbuf->ftype == RAWTGA) {
+ else if (ftype == RAWTGA) {
im_format->imtype = R_IMF_IMTYPE_RAWTGA;
}
#ifdef WITH_OPENJPEG
- else if (imbuf->ftype & JP2) {
+ else if (ftype & JP2) {
im_format->imtype = R_IMF_IMTYPE_JP2;
- im_format->quality = imbuf->ftype & ~JPG_MSK;
+ im_format->quality = custom_flags & ~JPG_MSK;
- if (imbuf->ftype & JP2_16BIT)
+ if (ftype & JP2_16BIT)
im_format->depth = R_IMF_CHAN_DEPTH_16;
- else if (imbuf->ftype & JP2_12BIT)
+ else if (ftype & JP2_12BIT)
im_format->depth = R_IMF_CHAN_DEPTH_12;
- if (imbuf->ftype & JP2_YCC)
+ if (ftype & JP2_YCC)
im_format->jp2_flag |= R_IMF_JP2_FLAG_YCC;
- if (imbuf->ftype & JP2_CINE) {
+ if (ftype & JP2_CINE) {
im_format->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
- if (imbuf->ftype & JP2_CINE_48FPS)
+ if (ftype & JP2_CINE_48FPS)
im_format->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
}
}
@@ -1292,7 +1295,7 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
else {
im_format->imtype = R_IMF_IMTYPE_JPEG90;
- im_format->quality = imbuf->ftype & ~JPG_MSK;
+ im_format->quality = custom_flags & ~JPG_MSK;
}
/* planes */
@@ -2142,7 +2145,9 @@ RenderResult *BKE_image_acquire_renderresult(Scene *scene, Image *ima)
void BKE_image_release_renderresult(Scene *scene, Image *ima)
{
- if (ima->rr) ;
+ if (ima->rr) {
+ /* pass */
+ }
else if (ima->type == IMA_TYPE_R_RESULT) {
if (ima->render_slot == ima->last_render_slot)
RE_ReleaseResult(RE_GetRender(scene->id.name));
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 8de9640eb35..b2a9e229be9 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1764,8 +1764,7 @@ void do_versions_ipos_to_animato(Main *main)
for (act = ob->actuators.first; act; act = act->next) {
/* Any actuators set to ACT_IPO at this point are actually Action Actuators that
need this converted IPO to finish converting the actuator. */
- if (act->type == ACT_IPO)
- {
+ if (act->type == ACT_IPO) {
aa = (bActionActuator*)act->data;
aa->act = ob->adt->action;
act->type = ACT_ACTION;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 60be0a60dcb..17a3c595ea7 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1449,6 +1449,8 @@ KeyBlock *add_keyblock(Key *key, const char *name)
* \note sorting is a problematic side effect in some cases,
* better only do this explicitly by having its own function,
*
+ * \param key The key datablock to add to.
+ * \param name Optional name for the new keyblock.
* \param do_force always use ctime even for relative keys.
*/
KeyBlock *add_keyblock_ctime(Key *key, const char *name, const short do_force)
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 3c46e7bcd47..a6ceba588d2 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -158,7 +158,7 @@ MaskLayer *BKE_mask_layer_new(Mask *mask, const char *name)
mask->masklay_tot++;
- masklay->blend = MASK_BLEND_MERGE;
+ masklay->blend = MASK_BLEND_MERGE_ADD;
masklay->alpha = 1.0f;
return masklay;
@@ -559,7 +559,7 @@ static void feather_bucket_get_diagonal(FeatherEdgesBucket *buckets, int start_b
*diagonal_bucket_b_r = &buckets[diagonal_bucket_b_index];
}
-static void spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feather_points)[2], int tot_feather_point)
+void BKE_mask_spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feather_points)[2], const int tot_feather_point)
{
#define BUCKET_INDEX(co) \
feather_bucket_index_from_coord(co, min, bucket_scale, buckets_per_side)
@@ -721,7 +721,8 @@ static void spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feat
*/
float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpline *spline,
int *tot_feather_point,
- const unsigned int resol
+ const unsigned int resol,
+ const int do_feather_isect
))[2]
{
MaskSplinePoint *points_array = BKE_mask_spline_point_array(spline);
@@ -783,23 +784,24 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpl
*tot_feather_point = tot;
- if (spline->flag & MASK_SPLINE_NOINTERSECT)
- spline_feather_collapse_inner_loops(spline, feather, tot);
+ if ((spline->flag & MASK_SPLINE_NOINTERSECT) && do_feather_isect) {
+ BKE_mask_spline_feather_collapse_inner_loops(spline, feather, tot);
+ }
return feather;
}
float (*BKE_mask_spline_feather_differentiated_points_with_resolution(MaskSpline *spline, int width, int height,
- int *tot_feather_point))[2]
+ int *tot_feather_point, const int do_feather_isect))[2]
{
unsigned int resol = BKE_mask_spline_feather_resolution(spline, width, height);
- return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, tot_feather_point, resol);
+ return BKE_mask_spline_feather_differentiated_points_with_resolution_ex(spline, tot_feather_point, resol, do_feather_isect);
}
float (*BKE_mask_spline_feather_differentiated_points(MaskSpline *spline, int *tot_feather_point))[2]
{
- return BKE_mask_spline_feather_differentiated_points_with_resolution(spline, 0, 0, tot_feather_point);
+ return BKE_mask_spline_feather_differentiated_points_with_resolution(spline, 0, 0, tot_feather_point, TRUE);
}
float (*BKE_mask_spline_feather_points(MaskSpline *spline, int *tot_feather_point))[2]
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 1fde1168999..eb96d6726b9 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -370,8 +370,8 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size)
{
MemArena *arena = BLI_memarena_new(1 << 16, __func__);
- const float bucket_dim_x = layer->bounds.xmax - layer->bounds.xmin;
- const float bucket_dim_y = layer->bounds.ymax - layer->bounds.ymin;
+ const float bucket_dim_x = BLI_RCT_SIZE_X(&layer->bounds);
+ const float bucket_dim_y = BLI_RCT_SIZE_Y(&layer->bounds);
layer->buckets_x = (bucket_dim_x / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
layer->buckets_y = (bucket_dim_y / pixel_size) / (float)BUCKET_PIXELS_PER_CELL;
@@ -575,6 +575,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
int tot_diff_point;
float (*diff_feather_points)[2];
+ float (*diff_feather_points_flip)[2];
int tot_diff_feather_points;
const unsigned int resol_a = BKE_mask_spline_resolution(spline, width, height) / 4;
@@ -586,7 +587,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
if (do_feather) {
diff_feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution_ex(
- spline, &tot_diff_feather_points, resol);
+ spline, &tot_diff_feather_points, resol, FALSE);
BLI_assert(diff_feather_points);
}
else {
@@ -649,6 +650,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
}
if (is_fill) {
+ /* applt intersections depending on fill settings */
+ if (spline->flag & MASK_SPLINE_NOINTERSECT) {
+ BKE_mask_spline_feather_collapse_inner_loops(spline, diff_feather_points, tot_diff_feather_points);
+ }
+
copy_v2_v2(co, diff_points[0]);
sf_vert_prev = BLI_scanfill_vert_add(&sf_ctx, co);
sf_vert_prev->tmp.u = sf_vert_tot;
@@ -710,11 +716,27 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
/* unfilled spline */
if (diff_feather_points) {
- float co_diff[3];
+ float co_diff[2];
float co_feather[3];
co_feather[2] = 1.0f;
+ if (spline->flag & MASK_SPLINE_NOINTERSECT) {
+ diff_feather_points_flip = MEM_mallocN(sizeof(float) * 2 * tot_diff_feather_points, "diff_feather_points_flip");
+
+ for (j = 0; j < tot_diff_point; j++) {
+ sub_v2_v2v2(co_diff, diff_points[j], diff_feather_points[j]);
+ add_v2_v2v2(diff_feather_points_flip[j], diff_points[j], co_diff);
+ }
+
+ BKE_mask_spline_feather_collapse_inner_loops(spline, diff_feather_points, tot_diff_feather_points);
+ BKE_mask_spline_feather_collapse_inner_loops(spline, diff_feather_points_flip, tot_diff_feather_points);
+ }
+ else {
+ diff_feather_points_flip = NULL;
+ }
+
+
open_spline_ranges[open_spline_index].vertex_offset = sf_vert_tot;
open_spline_ranges[open_spline_index].vertex_total = tot_diff_point;
@@ -738,8 +760,14 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
/* feather vert B */
- sub_v2_v2v2(co_diff, co, co_feather);
- add_v2_v2v2(co_feather, co, co_diff);
+ if (diff_feather_points_flip) {
+ copy_v2_v2(co_feather, diff_feather_points_flip[j]);
+ }
+ else {
+ sub_v2_v2v2(co_diff, co, co_feather);
+ add_v2_v2v2(co_feather, co, co_diff);
+ }
+
sf_vert = BLI_scanfill_vert_add(&sf_ctx, co_feather);
sf_vert->tmp.u = sf_vert_tot;
sf_vert->keyindex = SF_KEYINDEX_TEMP_ID;
@@ -752,6 +780,11 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
tot_feather_quads -= 2;
}
+ if (diff_feather_points_flip) {
+ MEM_freeN(diff_feather_points_flip);
+ diff_feather_points_flip = NULL;
+ }
+
/* cap ends */
/* dummy init value */
@@ -1163,7 +1196,7 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons
BLI_INLINE unsigned int layer_bucket_index_from_xy(MaskRasterLayer *layer, const float xy[2])
{
- BLI_assert(BLI_in_rctf_v(&layer->bounds, xy));
+ BLI_assert(BLI_rctf_isect_pt_v(&layer->bounds, xy));
return ( (unsigned int)((xy[0] - layer->bounds.xmin) * layer->buckets_xy_scalar[0])) +
(((unsigned int)((xy[1] - layer->bounds.ymin) * layer->buckets_xy_scalar[1])) * layer->buckets_x);
@@ -1200,7 +1233,7 @@ static float layer_bucket_depth_from_xy(MaskRasterLayer *layer, const float xy[2
float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2])
{
/* can't do this because some layers may invert */
- /* if (BLI_in_rctf_v(&mr_handle->bounds, xy)) */
+ /* if (BLI_rctf_isect_pt_v(&mr_handle->bounds, xy)) */
const unsigned int layers_tot = mr_handle->layers_tot;
unsigned int i;
@@ -1213,7 +1246,7 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
float value_layer;
/* also used as signal for unused layer (when render is disabled) */
- if (layer->alpha != 0.0f && BLI_in_rctf_v(&layer->bounds, xy)) {
+ if (layer->alpha != 0.0f && BLI_rctf_isect_pt_v(&layer->bounds, xy)) {
value_layer = 1.0f - layer_bucket_depth_from_xy(layer, xy);
switch (layer->falloff) {
@@ -1249,9 +1282,12 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
}
switch (layer->blend) {
- case MASK_BLEND_MERGE:
+ case MASK_BLEND_MERGE_ADD:
value += value_layer * (1.0f - value);
break;
+ case MASK_BLEND_MERGE_SUBTRACT:
+ value -= value_layer * value;
+ break;
case MASK_BLEND_ADD:
value += value_layer;
break;
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 21811c19d24..7523c59a879 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -80,12 +80,18 @@ void init_def_material(void)
/* not material itself */
void BKE_material_free(Material *ma)
{
+ BKE_material_free_ex(ma, TRUE);
+}
+
+/* not material itself */
+void BKE_material_free_ex(Material *ma, int do_id_user)
+{
MTex *mtex;
int a;
for (a = 0; a < MAX_MTEX; a++) {
mtex = ma->mtex[a];
- if (mtex && mtex->tex) mtex->tex->id.us--;
+ if (do_id_user && mtex && mtex->tex) mtex->tex->id.us--;
if (mtex) MEM_freeN(mtex);
}
@@ -101,7 +107,7 @@ void BKE_material_free(Material *ma)
/* is no lib link block, but material extension */
if (ma->nodetree) {
- ntreeFreeTree(ma->nodetree);
+ ntreeFreeTree_ex(ma->nodetree, do_id_user);
MEM_freeN(ma->nodetree);
}
@@ -235,7 +241,7 @@ Material *BKE_material_copy(Material *ma)
if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview);
if (ma->nodetree) {
- man->nodetree = ntreeCopyTree(ma->nodetree); /* 0 == full new tree */
+ man->nodetree = ntreeCopyTree(ma->nodetree);
}
man->gpumaterial.first = man->gpumaterial.last = NULL;
@@ -779,7 +785,7 @@ void assign_material(Object *ob, Material *ma, short act, int assign_type)
Material *mao, **matar, ***matarar;
char *matbits;
short *totcolp;
- char bit=0;
+ char bit = 0;
if (act > MAXMAT) return;
if (act < 1) act = 1;
@@ -807,13 +813,13 @@ void assign_material(Object *ob, Material *ma, short act, int assign_type)
*totcolp = act;
}
- // Determine the object/mesh linking
+ /* Determine the object/mesh linking */
if (assign_type == BKE_MAT_ASSIGN_USERPREF && ob->totcol && ob->actcol) {
/* copy from previous material */
bit = ob->matbits[ob->actcol - 1];
}
else {
- switch(assign_type) {
+ switch (assign_type) {
case BKE_MAT_ASSIGN_OBDATA:
bit = 0;
break;
@@ -1483,7 +1489,11 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
}
}
-/* copy/paste buffer, if we had a propper py api that would be better */
+/**
+ * \brief copy/paste buffer, if we had a propper py api that would be better
+ * \note matcopybuf.nodetree does _NOT_ use ID's
+ * \todo matcopybuf.nodetree's node->id's are NOT validated, this will crash!
+ */
static Material matcopybuf;
static short matcopied = 0;
@@ -1511,7 +1521,7 @@ void free_matcopybuf(void)
matcopybuf.ramp_spec = NULL;
if (matcopybuf.nodetree) {
- ntreeFreeTree(matcopybuf.nodetree);
+ ntreeFreeTree_ex(matcopybuf.nodetree, FALSE);
MEM_freeN(matcopybuf.nodetree);
matcopybuf.nodetree = NULL;
}
@@ -1537,7 +1547,7 @@ void copy_matcopybuf(Material *ma)
matcopybuf.mtex[a] = MEM_dupallocN(mtex);
}
}
- matcopybuf.nodetree = ntreeCopyTree(ma->nodetree);
+ matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, FALSE);
matcopybuf.preview = NULL;
matcopybuf.gpumaterial.first = matcopybuf.gpumaterial.last = NULL;
matcopied = 1;
@@ -1582,7 +1592,7 @@ void paste_matcopybuf(Material *ma)
}
}
- ma->nodetree = ntreeCopyTree(matcopybuf.nodetree);
+ ma->nodetree = ntreeCopyTree_ex(matcopybuf.nodetree, FALSE);
}
@@ -1623,7 +1633,7 @@ static void decode_tfaceflag(Material *ma, int flag, int convertall)
/* flag is shifted in 1 to make 0 != no flag yet (see encode_tfaceflag) */
flag -= 1;
- alphablend = flag >> 15; //encoded in the encode_tfaceflag function
+ alphablend = flag >> 15; /* encoded in the encode_tfaceflag function */
(*game).flag = 0;
/* General Material Options */
@@ -2023,8 +2033,7 @@ int do_version_tface(Main *main, int fileload)
nowarning = 0;
}
else
- convert_tfacematerial(main, ma);
- continue;
+ convert_tfacematerial(main, ma); continue;
}
/* no conflicts in this material - 90% of cases
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index fa5304b081a..039fb2c22f3 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -67,12 +67,9 @@
/* Data types */
-typedef struct point { /* a three-dimensional point */
- float x, y, z; /* its coordinates */
-} MB_POINT;
-
typedef struct vertex { /* surface vertex */
- MB_POINT position, normal; /* position and surface normal */
+ float co[3]; /* position and surface normal */
+ float no[3];
} VERTEX;
typedef struct vertices { /* list of vertices in polygonization */
@@ -82,7 +79,7 @@ typedef struct vertices { /* list of vertices in polygonization */
typedef struct corner { /* corner of a cube */
int i, j, k; /* (i, j, k) is index within lattice */
- float x, y, z, value; /* location and function value */
+ float co[3], value; /* location and function value */
struct corner *next;
} CORNER;
@@ -159,11 +156,11 @@ struct pgn_elements {
};
/* Forward declarations */
-static int vertid(CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb);
+static int vertid(const CORNER *c1, const CORNER *c2, PROCESS *p, MetaBall *mb);
static int setcenter(CENTERLIST *table[], int i, int j, int k);
static CORNER *setcorner(PROCESS *p, int i, int j, int k);
-static void converge(MB_POINT *p1, MB_POINT *p2, float v1, float v2,
- float (*function)(float, float, float), MB_POINT *p, MetaBall *mb, int f);
+static void converge(const float p1[3], const float p2[3], float v1, float v2,
+ float (*function)(float, float, float), float p[3], MetaBall *mb, int f);
/* Global variables */
@@ -631,65 +628,59 @@ static void calc_mballco(MetaElem *ml, float vec[3])
static float densfunc(MetaElem *ball, float x, float y, float z)
{
- float dist2 = 0.0, dx, dy, dz;
- float vec[3];
+ float dist2;
+ float dvec[3] = {x, y, z};
- vec[0] = x;
- vec[1] = y;
- vec[2] = z;
- mul_m4_v3((float (*)[4])ball->imat, vec);
- dx = vec[0];
- dy = vec[1];
- dz = vec[2];
+ mul_m4_v3((float (*)[4])ball->imat, dvec);
if (ball->type == MB_BALL) {
}
else if (ball->type == MB_TUBEX) {
- if (dx > ball->len) dx -= ball->len;
- else if (dx < -ball->len) dx += ball->len;
- else dx = 0.0;
+ if (dvec[0] > ball->len) dvec[0] -= ball->len;
+ else if (dvec[0] < -ball->len) dvec[0] += ball->len;
+ else dvec[0] = 0.0;
}
else if (ball->type == MB_TUBEY) {
- if (dy > ball->len) dy -= ball->len;
- else if (dy < -ball->len) dy += ball->len;
- else dy = 0.0;
+ if (dvec[1] > ball->len) dvec[1] -= ball->len;
+ else if (dvec[1] < -ball->len) dvec[1] += ball->len;
+ else dvec[1] = 0.0;
}
else if (ball->type == MB_TUBEZ) {
- if (dz > ball->len) dz -= ball->len;
- else if (dz < -ball->len) dz += ball->len;
- else dz = 0.0;
+ if (dvec[2] > ball->len) dvec[2] -= ball->len;
+ else if (dvec[2] < -ball->len) dvec[2] += ball->len;
+ else dvec[2] = 0.0;
}
else if (ball->type == MB_TUBE) {
- if (dx > ball->expx) dx -= ball->expx;
- else if (dx < -ball->expx) dx += ball->expx;
- else dx = 0.0;
+ if (dvec[0] > ball->expx) dvec[0] -= ball->expx;
+ else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
+ else dvec[0] = 0.0;
}
else if (ball->type == MB_PLANE) {
- if (dx > ball->expx) dx -= ball->expx;
- else if (dx < -ball->expx) dx += ball->expx;
- else dx = 0.0;
- if (dy > ball->expy) dy -= ball->expy;
- else if (dy < -ball->expy) dy += ball->expy;
- else dy = 0.0;
+ if (dvec[0] > ball->expx) dvec[0] -= ball->expx;
+ else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
+ else dvec[0] = 0.0;
+ if (dvec[1] > ball->expy) dvec[1] -= ball->expy;
+ else if (dvec[1] < -ball->expy) dvec[1] += ball->expy;
+ else dvec[1] = 0.0;
}
else if (ball->type == MB_ELIPSOID) {
- dx *= 1 / ball->expx;
- dy *= 1 / ball->expy;
- dz *= 1 / ball->expz;
+ dvec[0] *= 1 / ball->expx;
+ dvec[1] *= 1 / ball->expy;
+ dvec[2] *= 1 / ball->expz;
}
else if (ball->type == MB_CUBE) {
- if (dx > ball->expx) dx -= ball->expx;
- else if (dx < -ball->expx) dx += ball->expx;
- else dx = 0.0;
- if (dy > ball->expy) dy -= ball->expy;
- else if (dy < -ball->expy) dy += ball->expy;
- else dy = 0.0;
- if (dz > ball->expz) dz -= ball->expz;
- else if (dz < -ball->expz) dz += ball->expz;
- else dz = 0.0;
+ if (dvec[0] > ball->expx) dvec[0] -= ball->expx;
+ else if (dvec[0] < -ball->expx) dvec[0] += ball->expx;
+ else dvec[0] = 0.0;
+ if (dvec[1] > ball->expy) dvec[1] -= ball->expy;
+ else if (dvec[1] < -ball->expy) dvec[1] += ball->expy;
+ else dvec[1] = 0.0;
+ if (dvec[2] > ball->expz) dvec[2] -= ball->expz;
+ else if (dvec[2] < -ball->expz) dvec[2] += ball->expz;
+ else dvec[2] = 0.0;
}
- dist2 = (dx * dx + dy * dy + dz * dz);
+ dist2 = len_v3(dvec);
if (ball->flag & MB_NEGATIVE) {
dist2 = 1.0f - (dist2 / ball->rad2);
@@ -1074,12 +1065,12 @@ static CORNER *setcorner(PROCESS *p, int i, int j, int k)
c = (CORNER *) new_pgn_element(sizeof(CORNER));
c->i = i;
- c->x = ((float)i - 0.5f) * p->size;
+ c->co[0] = ((float)i - 0.5f) * p->size;
c->j = j;
- c->y = ((float)j - 0.5f) * p->size;
+ c->co[1] = ((float)j - 0.5f) * p->size;
c->k = k;
- c->z = ((float)k - 0.5f) * p->size;
- c->value = p->function(c->x, c->y, c->z);
+ c->co[2] = ((float)k - 0.5f) * p->size;
+ c->value = p->function(c->co[0], c->co[1], c->co[2]);
c->next = p->corners[index];
p->corners[index] = c;
@@ -1204,7 +1195,7 @@ void BKE_mball_cubeTable_free(void)
/* setcenter: set (i, j, k) entry of table[]
* return 1 if already set; otherwise, set and return 0 */
-static int setcenter(CENTERLIST *table[], int i, int j, int k)
+static int setcenter(CENTERLIST *table[], const int i, const int j, const int k)
{
int index;
CENTERLIST *newc, *l, *q;
@@ -1324,72 +1315,46 @@ static void addtovertices(VERTICES *vertices, VERTEX v)
/* vnormal: compute unit length surface normal at point */
-static void vnormal(MB_POINT *point, PROCESS *p, MB_POINT *v)
+static void vnormal(const float point[3], PROCESS *p, float r_no[3])
{
float delta = 0.2f * p->delta;
- float f = p->function(point->x, point->y, point->z);
-
- v->x = p->function(point->x + delta, point->y, point->z) - f;
- v->y = p->function(point->x, point->y + delta, point->z) - f;
- v->z = p->function(point->x, point->y, point->z + delta) - f;
- f = sqrtf(v->x * v->x + v->y * v->y + v->z * v->z);
+ float f = p->function(point[0], point[1], point[2]);
- if (f != 0.0f) {
- v->x /= f;
- v->y /= f;
- v->z /= f;
- }
+ r_no[0] = p->function(point[0] + delta, point[1], point[2]) - f;
+ r_no[1] = p->function(point[0], point[1] + delta, point[2]) - f;
+ r_no[2] = p->function(point[0], point[1], point[2] + delta) - f;
+ f = normalize_v3(r_no);
- if (FALSE) {
- MB_POINT temp;
+ if (0) {
+ float tvec[3];
delta *= 2.0f;
- f = p->function(point->x, point->y, point->z);
+ f = p->function(point[0], point[1], point[2]);
- temp.x = p->function(point->x + delta, point->y, point->z) - f;
- temp.y = p->function(point->x, point->y + delta, point->z) - f;
- temp.z = p->function(point->x, point->y, point->z + delta) - f;
- f = sqrtf(temp.x * temp.x + temp.y * temp.y + temp.z * temp.z);
+ tvec[0] = p->function(point[0] + delta, point[1], point[2]) - f;
+ tvec[1] = p->function(point[0], point[1] + delta, point[2]) - f;
+ tvec[2] = p->function(point[0], point[1], point[2] + delta) - f;
- if (f != 0.0f) {
- temp.x /= f;
- temp.y /= f;
- temp.z /= f;
-
- v->x += temp.x;
- v->y += temp.y;
- v->z += temp.z;
-
- f = sqrtf(v->x * v->x + v->y * v->y + v->z * v->z);
-
- if (f != 0.0f) {
- v->x /= f;
- v->y /= f;
- v->z /= f;
- }
+ if (normalize_v3(tvec) != 0.0f) {
+ add_v3_v3(r_no, tvec);
+ normalize_v3(r_no);
}
}
-
}
-static int vertid(CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
+static int vertid(const CORNER *c1, const CORNER *c2, PROCESS *p, MetaBall *mb)
{
VERTEX v;
- MB_POINT a, b;
int vid = getedge(p->edges, c1->i, c1->j, c1->k, c2->i, c2->j, c2->k);
- if (vid != -1) return vid; /* previously computed */
- a.x = c1->x;
- a.y = c1->y;
- a.z = c1->z;
- b.x = c2->x;
- b.y = c2->y;
- b.z = c2->z;
+ if (vid != -1) {
+ return vid; /* previously computed */
+ }
- converge(&a, &b, c1->value, c2->value, p->function, &v.position, mb, 1); /* position */
- vnormal(&v.position, p, &v.normal);
+ converge(c1->co, c2->co, c1->value, c2->value, p->function, v.co, mb, 1); /* position */
+ vnormal(v.co, p, v.no);
addtovertices(&p->vertices, v); /* save vertex */
vid = p->vertices.count - 1;
@@ -1403,101 +1368,95 @@ static int vertid(CORNER *c1, CORNER *c2, PROCESS *p, MetaBall *mb)
/* converge: from two points of differing sign, converge to zero crossing */
/* watch it: p1 and p2 are used to calculate */
-static void converge(MB_POINT *p1, MB_POINT *p2, float v1, float v2,
- float (*function)(float, float, float), MB_POINT *p, MetaBall *mb, int f)
+static void converge(const float p1[3], const float p2[3], float v1, float v2,
+ float (*function)(float, float, float), float p[3], MetaBall *mb, int f)
{
int i = 0;
- MB_POINT pos, neg;
+ float pos[3], neg[3];
float positive = 0.0f, negative = 0.0f;
- float dx = 0.0f, dy = 0.0f, dz = 0.0f;
+ float dvec[3];
if (v1 < 0) {
- pos = *p2;
- neg = *p1;
+ copy_v3_v3(pos, p2);
+ copy_v3_v3(neg, p1);
positive = v2;
negative = v1;
}
else {
- pos = *p1;
- neg = *p2;
+ copy_v3_v3(pos, p1);
+ copy_v3_v3(neg, p2);
positive = v1;
negative = v2;
}
- dx = pos.x - neg.x;
- dy = pos.y - neg.y;
- dz = pos.z - neg.z;
+ sub_v3_v3v3(dvec, pos, neg);
/* Approximation by linear interpolation is faster then binary subdivision,
* but it results sometimes (mb->thresh < 0.2) into the strange results */
if ((mb->thresh > 0.2f) && (f == 1)) {
- if ((dy == 0.0f) && (dz == 0.0f)) {
- p->x = neg.x - negative * dx / (positive - negative);
- p->y = neg.y;
- p->z = neg.z;
+ if ((dvec[1] == 0.0f) && (dvec[2] == 0.0f)) {
+ p[0] = neg[0] - negative * dvec[0] / (positive - negative);
+ p[1] = neg[1];
+ p[2] = neg[2];
return;
}
- if ((dx == 0.0f) && (dz == 0.0f)) {
- p->x = neg.x;
- p->y = neg.y - negative * dy / (positive - negative);
- p->z = neg.z;
+ if ((dvec[0] == 0.0f) && (dvec[2] == 0.0f)) {
+ p[0] = neg[0];
+ p[1] = neg[1] - negative * dvec[1] / (positive - negative);
+ p[2] = neg[2];
return;
}
- if ((dx == 0.0f) && (dy == 0.0f)) {
- p->x = neg.x;
- p->y = neg.y;
- p->z = neg.z - negative * dz / (positive - negative);
+ if ((dvec[0] == 0.0f) && (dvec[1] == 0.0f)) {
+ p[0] = neg[0];
+ p[1] = neg[1];
+ p[2] = neg[2] - negative * dvec[2] / (positive - negative);
return;
}
}
- if ((dy == 0.0f) && (dz == 0.0f)) {
- p->y = neg.y;
- p->z = neg.z;
+ if ((dvec[1] == 0.0f) && (dvec[2] == 0.0f)) {
+ p[1] = neg[1];
+ p[2] = neg[2];
while (1) {
if (i++ == RES) return;
- p->x = 0.5f * (pos.x + neg.x);
- if ((function(p->x, p->y, p->z)) > 0.0f) pos.x = p->x; else neg.x = p->x;
+ p[0] = 0.5f * (pos[0] + neg[0]);
+ if ((function(p[0], p[1], p[2])) > 0.0f) pos[0] = p[0]; else neg[0] = p[0];
}
}
- if ((dx == 0.0f) && (dz == 0.0f)) {
- p->x = neg.x;
- p->z = neg.z;
+ if ((dvec[0] == 0.0f) && (dvec[2] == 0.0f)) {
+ p[0] = neg[0];
+ p[2] = neg[2];
while (1) {
if (i++ == RES) return;
- p->y = 0.5f * (pos.y + neg.y);
- if ((function(p->x, p->y, p->z)) > 0.0f) pos.y = p->y; else neg.y = p->y;
+ p[1] = 0.5f * (pos[1] + neg[1]);
+ if ((function(p[0], p[1], p[2])) > 0.0f) pos[1] = p[1]; else neg[1] = p[1];
}
}
-
- if ((dx == 0.0f) && (dy == 0.0f)) {
- p->x = neg.x;
- p->y = neg.y;
+
+ if ((dvec[0] == 0.0f) && (dvec[1] == 0.0f)) {
+ p[0] = neg[0];
+ p[1] = neg[1];
while (1) {
if (i++ == RES) return;
- p->z = 0.5f * (pos.z + neg.z);
- if ((function(p->x, p->y, p->z)) > 0.0f) pos.z = p->z; else neg.z = p->z;
+ p[2] = 0.5f * (pos[2] + neg[2]);
+ if ((function(p[0], p[1], p[2])) > 0.0f) pos[2] = p[2]; else neg[2] = p[2];
}
}
/* This is necessary to find start point */
while (1) {
- p->x = 0.5f * (pos.x + neg.x);
- p->y = 0.5f * (pos.y + neg.y);
- p->z = 0.5f * (pos.z + neg.z);
-
- if (i++ == RES) return;
-
- if ((function(p->x, p->y, p->z)) > 0.0f) {
- pos.x = p->x;
- pos.y = p->y;
- pos.z = p->z;
+ mid_v3_v3v3(&p[0], pos, neg);
+
+ if (i++ == RES) {
+ return;
+ }
+
+ if ((function(p[0], p[1], p[2])) > 0.0f) {
+ copy_v3_v3(pos, &p[0]);
}
else {
- neg.x = p->x;
- neg.y = p->y;
- neg.z = p->z;
+ copy_v3_v3(neg, &p[0]);
}
}
}
@@ -1535,105 +1494,100 @@ static void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
{
- MB_POINT IN, in, OUT, out; /*point;*/
MetaElem *ml;
- int i, j, k, c_i, c_j, c_k;
- int index[3] = {1, 0, -1};
float f = 0.0f;
- float in_v /*, out_v*/;
- MB_POINT workp;
- float tmp_v, workp_v, max_len, len, dx, dy, dz, nx, ny, nz, MAXN;
ml = mainb[a];
-
- f = 1 - (mb->thresh / ml->s);
+ f = 1.0 - (mb->thresh / ml->s);
/* Skip, when Stiffness of MetaElement is too small ... MetaElement can't be
* visible alone ... but still can influence others MetaElements :-) */
if (f > 0.0f) {
- OUT.x = IN.x = in.x = 0.0;
- OUT.y = IN.y = in.y = 0.0;
- OUT.z = IN.z = in.z = 0.0;
+ float IN[3] = {0.0f}, OUT[3] = {0.0f}, in[3] = {0.0f}, out[3];
+ int i, j, k, c_i, c_j, c_k;
+ int index[3] = {1, 0, -1};
+ float in_v /*, out_v*/;
+ float workp[3];
+ float dvec[3];
+ float tmp_v, workp_v, max_len, len, nx, ny, nz, MAXN;
- calc_mballco(ml, (float *)&in);
- in_v = mbproc->function(in.x, in.y, in.z);
+ calc_mballco(ml, in);
+ in_v = mbproc->function(in[0], in[1], in[2]);
for (i = 0; i < 3; i++) {
switch (ml->type) {
case MB_BALL:
- OUT.x = out.x = IN.x + index[i] * ml->rad;
+ OUT[0] = out[0] = IN[0] + index[i] * ml->rad;
break;
case MB_TUBE:
case MB_PLANE:
case MB_ELIPSOID:
case MB_CUBE:
- OUT.x = out.x = IN.x + index[i] * (ml->expx + ml->rad);
+ OUT[0] = out[0] = IN[0] + index[i] * (ml->expx + ml->rad);
break;
}
for (j = 0; j < 3; j++) {
switch (ml->type) {
case MB_BALL:
- OUT.y = out.y = IN.y + index[j] * ml->rad;
+ OUT[1] = out[1] = IN[1] + index[j] * ml->rad;
break;
case MB_TUBE:
case MB_PLANE:
case MB_ELIPSOID:
case MB_CUBE:
- OUT.y = out.y = IN.y + index[j] * (ml->expy + ml->rad);
+ OUT[1] = out[1] = IN[1] + index[j] * (ml->expy + ml->rad);
break;
}
for (k = 0; k < 3; k++) {
- out.x = OUT.x;
- out.y = OUT.y;
+ out[0] = OUT[0];
+ out[1] = OUT[1];
switch (ml->type) {
case MB_BALL:
case MB_TUBE:
case MB_PLANE:
- out.z = IN.z + index[k] * ml->rad;
+ out[2] = IN[2] + index[k] * ml->rad;
break;
case MB_ELIPSOID:
case MB_CUBE:
- out.z = IN.z + index[k] * (ml->expz + ml->rad);
+ out[2] = IN[2] + index[k] * (ml->expz + ml->rad);
break;
}
- calc_mballco(ml, (float *)&out);
+ calc_mballco(ml, out);
- /*out_v = mbproc->function(out.x, out.y, out.z);*/ /*UNUSED*/
+ /*out_v = mbproc->function(out[0], out[1], out[2]);*/ /*UNUSED*/
/* find "first points" on Implicit Surface of MetaElemnt ml */
- workp.x = in.x;
- workp.y = in.y;
- workp.z = in.z;
+ copy_v3_v3(workp, in);
workp_v = in_v;
- max_len = sqrtf((out.x - in.x) * (out.x - in.x) + (out.y - in.y) * (out.y - in.y) + (out.z - in.z) * (out.z - in.z));
+ max_len = len_v3v3(out, in);
- nx = abs((out.x - in.x) / mbproc->size);
- ny = abs((out.y - in.y) / mbproc->size);
- nz = abs((out.z - in.z) / mbproc->size);
+ nx = abs((out[0] - in[0]) / mbproc->size);
+ ny = abs((out[1] - in[1]) / mbproc->size);
+ nz = abs((out[2] - in[2]) / mbproc->size);
MAXN = MAX3(nx, ny, nz);
if (MAXN != 0.0f) {
- dx = (out.x - in.x) / MAXN;
- dy = (out.y - in.y) / MAXN;
- dz = (out.z - in.z) / MAXN;
+ dvec[0] = (out[0] - in[0]) / MAXN;
+ dvec[1] = (out[1] - in[1]) / MAXN;
+ dvec[2] = (out[2] - in[2]) / MAXN;
len = 0.0;
while (len <= max_len) {
- workp.x += dx;
- workp.y += dy;
- workp.z += dz;
+ workp[0] += dvec[0];
+ workp[1] += dvec[1];
+ workp[2] += dvec[2];
/* compute value of implicite function */
- tmp_v = mbproc->function(workp.x, workp.y, workp.z);
+ tmp_v = mbproc->function(workp[0], workp[1], workp[2]);
/* add cube to the stack, when value of implicite function crosses zero value */
if ((tmp_v < 0.0f && workp_v >= 0.0f) || (tmp_v > 0.0f && workp_v <= 0.0f)) {
/* indexes of CUBE, which includes "first point" */
- c_i = (int)floor(workp.x / mbproc->size);
- c_j = (int)floor(workp.y / mbproc->size);
- c_k = (int)floor(workp.z / mbproc->size);
+ c_i = (int)floor(workp[0] / mbproc->size);
+ c_j = (int)floor(workp[1] / mbproc->size);
+ c_k = (int)floor(workp[2] / mbproc->size);
/* add CUBE (with indexes c_i, c_j, c_k) to the stack,
* this cube includes found point of Implicit Surface */
@@ -1642,7 +1596,7 @@ static void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
else
add_cube(mbproc, c_i, c_j, c_k, 1);
}
- len = sqrtf((workp.x - in.x) * (workp.x - in.x) + (workp.y - in.y) * (workp.y - in.y) + (workp.z - in.z) * (workp.z - in.z));
+ len = len_v3v3(workp, in);
workp_v = tmp_v;
}
@@ -2283,7 +2237,7 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
MetaBall *mb;
DispList *dl;
int a, nr_cubes;
- float *ve, *no, totsize, width;
+ float *co, *no, totsize, width;
mb = ob->data;
@@ -2362,6 +2316,8 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
}
if (curindex) {
+ VERTEX *ptr = mbproc.vertices.ptr;
+
dl = MEM_callocN(sizeof(DispList), "mbaldisp");
BLI_addtail(dispbase, dl);
dl->type = DL_INDEX4;
@@ -2372,17 +2328,12 @@ void BKE_mball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
indices = NULL;
a = mbproc.vertices.count;
- dl->verts = ve = MEM_mallocN(sizeof(float) * 3 * a, "mballverts");
+ dl->verts = co = MEM_mallocN(sizeof(float) * 3 * a, "mballverts");
dl->nors = no = MEM_mallocN(sizeof(float) * 3 * a, "mballnors");
- for (a = 0; a < mbproc.vertices.count; a++, no += 3, ve += 3) {
- ve[0] = mbproc.vertices.ptr[a].position.x;
- ve[1] = mbproc.vertices.ptr[a].position.y;
- ve[2] = mbproc.vertices.ptr[a].position.z;
-
- no[0] = mbproc.vertices.ptr[a].normal.x;
- no[1] = mbproc.vertices.ptr[a].normal.y;
- no[2] = mbproc.vertices.ptr[a].normal.z;
+ for (a = 0; a < mbproc.vertices.count; ptr++, a++, no += 3, co += 3) {
+ copy_v3_v3(co, ptr->co);
+ copy_v3_v3(no, ptr->no);
}
}
@@ -2403,29 +2354,30 @@ int BKE_mball_minmax(MetaBall *mb, float min[3], float max[3])
return (mb->elems.first != NULL);
}
-int BKE_mball_center_median(MetaBall *mb, float cent[3])
+int BKE_mball_center_median(MetaBall *mb, float r_cent[3])
{
MetaElem *ml;
int total = 0;
- zero_v3(cent);
+ zero_v3(r_cent);
for (ml = mb->elems.first; ml; ml = ml->next) {
- add_v3_v3(cent, &ml->x);
+ add_v3_v3(r_cent, &ml->x);
}
- if (total)
- mul_v3_fl(cent, 1.0f / (float)total);
+ if (total) {
+ mul_v3_fl(r_cent, 1.0f / (float)total);
+ }
return (total != 0);
}
-int BKE_mball_center_bounds(MetaBall *mb, float cent[3])
+int BKE_mball_center_bounds(MetaBall *mb, float r_cent[3])
{
float min[3], max[3];
if (BKE_mball_minmax(mb, min, max)) {
- mid_v3_v3v3(cent, min, max);
+ mid_v3_v3v3(r_cent, min, max);
return 1;
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index 77cd127e6ea..8c3ec7e2e40 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -167,7 +167,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
for (j = 0; j < vtot; j++, v1++, v2++) {
if (len_v3v3(v1->co, v2->co) > thresh)
return MESHCMP_VERTCOMISMATCH;
- /*I don't care about normals, let's just do coodinates*/
+ /* I don't care about normals, let's just do coodinates */
}
}
@@ -990,7 +990,7 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *alll
MEM_freeN(edsort);
- /*set edge members of mloops*/
+ /* set edge members of mloops */
medge = *alledge;
for (a = 0; a < *_totedge; a++, medge++) {
BLI_edgehash_insert(hash, medge->v1, medge->v2, SET_INT_IN_POINTER(a));
@@ -1846,7 +1846,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts,
return;
}
- /* if we are not calculating verts and no verts were passes thene we have nothign to do */
+ /* if we are not calculating verts and no verts were passes then we have nothing to do */
if ((only_face_normals == TRUE) && (polyNors_r == NULL) && (faceNors_r == NULL)) {
printf("%s: called with nothing to do\n", __func__);
return;
@@ -1910,7 +1910,7 @@ void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpo
if (!pnors) pnors = MEM_callocN(sizeof(float) * 3 * numPolys, "poly_nors mesh.c");
- /*first go through and calculate normals for all the polys*/
+ /* first go through and calculate normals for all the polys */
tnorms = MEM_callocN(sizeof(float) * 3 * numVerts, "tnorms mesh.c");
mp = mpolys;
@@ -2702,13 +2702,13 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
#endif
{
/* sort loop indices to ensure winding is correct */
- if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
- if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3);
- if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
+ if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
+ if (mf->v2 > mf->v3) SWAP(unsigned int, mf->v2, mf->v3);
+ if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
- if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
- if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3);
- if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
+ if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
+ if (mf->v2 > mf->v3) SWAP(unsigned int, mf->v2, mf->v3);
+ if (mf->v1 > mf->v2) SWAP(unsigned int, mf->v1, mf->v2);
}
/* end abusing the edcode */
@@ -2820,7 +2820,7 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
mf = &mface[k];
if (mf->edcode == 3) {
- /*sort loop indices to ensure winding is correct*/
+ /* sort loop indices to ensure winding is correct */
/* NO SORT - looks like we can skip this */
lindex[0] = mf->v1;
@@ -2828,7 +2828,7 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
lindex[2] = mf->v3;
lindex[3] = 0; /* unused */
- /*transform loop indices to vert indices*/
+ /* transform loop indices to vert indices */
mf->v1 = mloop[mf->v1].v;
mf->v2 = mloop[mf->v2].v;
mf->v3 = mloop[mf->v3].v;
@@ -2839,7 +2839,7 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
test_index_face(mf, fdata, k, 3);
}
else {
- /*sort loop indices to ensure winding is correct*/
+ /* sort loop indices to ensure winding is correct */
/* NO SORT - looks like we can skip this */
lindex[0] = mf->v1;
@@ -2847,7 +2847,7 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
lindex[2] = mf->v3;
lindex[3] = mf->v4;
- /*transform loop indices to vert indices*/
+ /* transform loop indices to vert indices */
mf->v1 = mloop[mf->v1].v;
mf->v2 = mloop[mf->v2].v;
mf->v3 = mloop[mf->v3].v;
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index d62b03b5060..9590160c8f3 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -764,7 +764,7 @@ void BKE_nlastrips_clear_metas(ListBase *strips, short onlySel, short onlyTemp)
}
/* Add the given NLA-Strip to the given Meta-Strip, assuming that the
- * strip isn't attached to anyy list of strips
+ * strip isn't attached to any list of strips
*/
short BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip)
{
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 7cee9626c3f..c283db94103 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -671,7 +671,7 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype)
* copying for internal use (threads for eg), where you wont want it to modify the
* scene data.
*/
-static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_make_extern)
+static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_id_user, const short do_make_extern)
{
bNodeTree *newtree;
bNode *node /*, *nnode */ /* UNUSED */, *last;
@@ -702,6 +702,11 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_make_e
last = ntree->nodes.last;
for (node = ntree->nodes.first; node; node = node->next) {
+ /* ntreeUserDecrefID inline */
+ if (do_id_user) {
+ id_us_plus(node->id);
+ }
+
if (do_make_extern) {
id_lib_extern(node->id);
}
@@ -751,22 +756,56 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_make_e
return newtree;
}
+bNodeTree *ntreeCopyTree_ex(bNodeTree *ntree, const short do_id_user)
+{
+ return ntreeCopyTree_internal(ntree, do_id_user, TRUE);
+}
bNodeTree *ntreeCopyTree(bNodeTree *ntree)
{
- return ntreeCopyTree_internal(ntree, TRUE);
+ return ntreeCopyTree_ex(ntree, TRUE);
}
/* use when duplicating scenes */
-void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
+void ntreeSwitchID_ex(bNodeTree *ntree, ID *id_from, ID *id_to, const short do_id_user)
{
bNode *node;
+
+ if (id_from == id_to) {
+ /* should never happen but may as well skip if it does */
+ return;
+ }
+
/* for scene duplication only */
for (node = ntree->nodes.first; node; node = node->next) {
if (node->id == id_from) {
+ if (do_id_user) {
+ id_us_min(id_from);
+ id_us_plus(id_to);
+ }
+
node->id = id_to;
}
}
}
+void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
+{
+ ntreeSwitchID_ex(ntree, id_from, id_to, TRUE);
+}
+
+void ntreeUserIncrefID(bNodeTree *ntree)
+{
+ bNode *node;
+ for (node = ntree->nodes.first; node; node = node->next) {
+ id_us_plus(node->id);
+ }
+}
+void ntreeUserDecrefID(bNodeTree *ntree)
+{
+ bNode *node;
+ for (node = ntree->nodes.first; node; node = node->next) {
+ id_us_min(node->id);
+ }
+}
/* *************** preview *********** */
/* if node->preview, then we assume the rect to exist */
@@ -913,6 +952,7 @@ static void node_unlink_attached(bNodeTree *ntree, bNode *parent)
}
}
+/** \note caller needs to manage node->id user */
void nodeFreeNode(bNodeTree *ntree, bNode *node)
{
bNodeSocket *sock, *nextsock;
@@ -956,7 +996,7 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
}
/* do not free ntree itself here, BKE_libblock_free calls this function too */
-void ntreeFreeTree(bNodeTree *ntree)
+void ntreeFreeTree_ex(bNodeTree *ntree, const short do_id_user)
{
bNode *node, *next;
bNodeSocket *sock;
@@ -990,6 +1030,12 @@ void ntreeFreeTree(bNodeTree *ntree)
for (node = ntree->nodes.first; node; node = next) {
next = node->next;
+
+ /* ntreeUserIncrefID inline */
+ if (do_id_user) {
+ id_us_min(node->id);
+ }
+
nodeFreeNode(ntree, node);
}
@@ -1000,6 +1046,11 @@ void ntreeFreeTree(bNodeTree *ntree)
node_socket_free_default_value(sock->type, sock->default_value);
BLI_freelistN(&ntree->outputs);
}
+/* same as ntreeFreeTree_ex but always manage users */
+void ntreeFreeTree(bNodeTree *ntree)
+{
+ ntreeFreeTree_ex(ntree, TRUE);
+}
void ntreeFreeCache(bNodeTree *ntree)
{
@@ -1188,7 +1239,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
}
/* node copy func */
- ltree = ntreeCopyTree_internal(ntree, FALSE);
+ ltree = ntreeCopyTree_internal(ntree, FALSE, FALSE);
if (adt) {
AnimData *ladt = BKE_animdata_from_id(&ltree->id);
@@ -1248,7 +1299,7 @@ void ntreeLocalMerge(bNodeTree *localtree, bNodeTree *ntree)
if (ntreetype->local_merge)
ntreetype->local_merge(localtree, ntree);
- ntreeFreeTree(localtree);
+ ntreeFreeTree_ex(localtree, FALSE);
MEM_freeN(localtree);
}
@@ -1425,13 +1476,37 @@ void nodeSocketSetType(bNodeSocket *sock, int type)
/* ************** Node Clipboard *********** */
+#define USE_NODE_CB_VALIDATE
+
+#ifdef USE_NODE_CB_VALIDATE
+/**
+ * This data structure is to validate the node on creation,
+ * otherwise we may reference missing data.
+ *
+ * Currently its only used for ID's, but nodes may one day
+ * reference other pointers which need validation.
+ */
+typedef struct bNodeClipboardExtraInfo {
+ struct bNodeClipboardExtraInfo *next, *prev;
+ ID *id;
+ char id_name[MAX_ID_NAME];
+ char library_name[FILE_MAX];
+} bNodeClipboardExtraInfo;
+#endif /* USE_NODE_CB_VALIDATE */
+
+
typedef struct bNodeClipboard {
ListBase nodes;
+
+#ifdef USE_NODE_CB_VALIDATE
+ ListBase nodes_extra_info;
+#endif
+
ListBase links;
int type;
} bNodeClipboard;
-bNodeClipboard node_clipboard;
+bNodeClipboard node_clipboard = {{0}};
void BKE_node_clipboard_init(struct bNodeTree *ntree)
{
@@ -1454,11 +1529,83 @@ void BKE_node_clipboard_clear(void)
nodeFreeNode(NULL, node);
}
node_clipboard.nodes.first = node_clipboard.nodes.last = NULL;
+
+#ifdef USE_NODE_CB_VALIDATE
+ BLI_freelistN(&node_clipboard.nodes_extra_info);
+#endif
+}
+
+/* return FALSE when one or more ID's are lost */
+int BKE_node_clipboard_validate(void)
+{
+ int ok = TRUE;
+
+#ifdef USE_NODE_CB_VALIDATE
+ bNodeClipboardExtraInfo *node_info;
+ bNode *node;
+
+
+ /* lists must be aligned */
+ BLI_assert(BLI_countlist(&node_clipboard.nodes) ==
+ BLI_countlist(&node_clipboard.nodes_extra_info));
+
+ for (node = node_clipboard.nodes.first, node_info = node_clipboard.nodes_extra_info.first;
+ node;
+ node = node->next, node_info = node_info->next)
+ {
+ /* validate the node against the stored node info */
+
+ /* re-assign each loop since we may clear,
+ * open a new file where the ID is valid, and paste again */
+ node->id = node_info->id;
+
+ /* currently only validate the ID */
+ if (node->id) {
+ ListBase *lb = which_libbase(G.main, GS(node_info->id_name));
+ BLI_assert(lb != NULL);
+
+ if (BLI_findindex(lb, node_info->id) == -1) {
+ /* may assign NULL */
+ node->id = BLI_findstring(lb, node_info->id_name + 2, offsetof(ID, name) + 2);
+
+ if (node->id == NULL) {
+ ok = FALSE;
+ }
+ }
+ }
+ }
+#endif /* USE_NODE_CB_VALIDATE */
+
+ return ok;
}
void BKE_node_clipboard_add_node(bNode *node)
{
+#ifdef USE_NODE_CB_VALIDATE
+ /* add extra info */
+ bNodeClipboardExtraInfo *node_info = MEM_mallocN(sizeof(bNodeClipboardExtraInfo), STRINGIFY(bNodeClipboardExtraInfo));
+
+ node_info->id = node->id;
+ if (node->id) {
+ BLI_strncpy(node_info->id_name, node->id->name, sizeof(node_info->id_name));
+ if (node->id->lib) {
+ BLI_strncpy(node_info->library_name, node->id->lib->filepath, sizeof(node_info->library_name));
+ }
+ else {
+ node_info->library_name[0] = '\0';
+ }
+ }
+ else {
+ node_info->id_name[0] = '\0';
+ node_info->library_name[0] = '\0';
+ }
+ BLI_addtail(&node_clipboard.nodes_extra_info, node_info);
+ /* end extra info */
+#endif /* USE_NODE_CB_VALIDATE */
+
+ /* add node */
BLI_addtail(&node_clipboard.nodes, node);
+
}
void BKE_node_clipboard_add_link(bNodeLink *link)
@@ -1992,6 +2139,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
register_node_type_cmp_vecblur(ttype);
register_node_type_cmp_dilateerode(ttype);
register_node_type_cmp_inpaint(ttype);
+ register_node_type_cmp_despeckle(ttype);
register_node_type_cmp_defocus(ttype);
register_node_type_cmp_valtorgb(ttype);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 4f4ee3f8433..dfa3582cee8 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1514,7 +1514,7 @@ void BKE_object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
/* end drot correction */
if (use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat);
- else mat3_to_eulO(ob->rot, ob->rotmode, tmat);
+ else mat3_to_eulO(ob->rot, ob->rotmode, tmat);
}
}
}
@@ -2234,7 +2234,7 @@ void BKE_object_dimensions_set(Object *ob, const float *value)
}
}
-void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
+void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const short use_hidden)
{
BoundBox bb;
float vec[3];
@@ -2284,14 +2284,23 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
break;
case OB_ARMATURE:
if (ob->pose) {
+ bArmature *arm = ob->data;
bPoseChannel *pchan;
+
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
- mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
- minmax_v3v3_v3(min_r, max_r, vec);
- mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
- minmax_v3v3_v3(min_r, max_r, vec);
+
+ if ((use_hidden == FALSE) && (PBONE_VISIBLE(arm, pchan->bone) == FALSE)) {
+ /* pass */
+ }
+ else {
+ mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
+ minmax_v3v3_v3(min_r, max_r, vec);
+ mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
+ minmax_v3v3_v3(min_r, max_r, vec);
+
+ change = TRUE;
+ }
}
- change = TRUE;
}
break;
case OB_MESH:
@@ -2331,9 +2340,9 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3])
}
}
-int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3])
+int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3], const short use_hidden)
{
- int ok = 0;
+ int ok = FALSE;
if ((ob->transflag & OB_DUPLI) == 0) {
return ok;
}
@@ -2343,7 +2352,10 @@ int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_ma
lb = object_duplilist(scene, ob);
for (dob = lb->first; dob; dob = dob->next) {
- if (dob->no_draw == 0) {
+ if ((use_hidden == FALSE) && (dob->no_draw != 0)) {
+ /* pass */
+ }
+ else {
BoundBox *bb = BKE_object_boundbox_get(dob->ob);
if (bb) {
@@ -2354,7 +2366,7 @@ int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_ma
minmax_v3v3_v3(r_min, r_max, vec);
}
- ok = 1;
+ ok = TRUE;
}
}
}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index f115a41d419..9787a5025f7 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -158,7 +158,17 @@ void freePackedFile(PackedFile *pf)
else
printf("freePackedFile: Trying to free a NULL pointer\n");
}
-
+
+PackedFile *dupPackedFile(const PackedFile *pf_src)
+{
+ PackedFile *pf_dst;
+
+ pf_dst = MEM_dupallocN(pf_src);
+ pf_dst->data = MEM_dupallocN(pf_src->data);
+
+ return pf_dst;
+}
+
PackedFile *newPackedFileMemory(void *mem, int memlen)
{
PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile");
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 889792ad3f8..145bd6a88e5 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -153,7 +153,8 @@ Scene *BKE_scene_copy(Scene *sce, int type)
BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets));
if (sce->nodetree) {
- scen->nodetree = ntreeCopyTree(sce->nodetree); /* copies actions */
+ /* ID's are managed on both copy and switch */
+ scen->nodetree = ntreeCopyTree(sce->nodetree);
ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
}
@@ -550,14 +551,7 @@ Scene *BKE_scene_add(const char *name)
Base *BKE_scene_base_find(Scene *scene, Object *ob)
{
- Base *base;
-
- base = scene->base.first;
- while (base) {
- if (base->object == ob) return base;
- base = base->next;
- }
- return NULL;
+ return BLI_findptr(&scene->base, ob, offsetof(Base, object));
}
void BKE_scene_set_background(Main *bmain, Scene *scene)
@@ -582,10 +576,10 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
/* group flags again */
for (group = bmain->group.first; group; group = group->id.next) {
- go = group->gobject.first;
- while (go) {
- if (go->ob) go->ob->flag |= OB_FROMGROUP;
- go = go->next;
+ for (go = group->gobject.first; go; go = go->next) {
+ if (go->ob) {
+ go->ob->flag |= OB_FROMGROUP;
+ }
}
}
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index 387ec67eb1c..e3f0226c863 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -37,8 +37,11 @@
#include "BKE_sequencer.h"
#include "IMB_moviecache.h"
+#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+#include "BLI_listbase.h"
+
typedef struct SeqCacheKey {
struct Sequence *seq;
SeqRenderData context;
@@ -46,7 +49,25 @@ typedef struct SeqCacheKey {
seq_stripelem_ibuf_t type;
} SeqCacheKey;
+typedef struct SeqPreprocessCacheElem {
+ struct SeqPreprocessCacheElem *next, *prev;
+
+ struct Sequence *seq;
+ SeqRenderData context;
+ seq_stripelem_ibuf_t type;
+
+ ImBuf *ibuf;
+} SeqPreprocessCacheElem;
+
+typedef struct SeqPreprocessCache {
+ int cfra;
+ ListBase elems;
+} SeqPreprocessCache;
+
static struct MovieCache *moviecache = NULL;
+static struct SeqPreprocessCache *preprocess_cache = NULL;
+
+static void preprocessed_cache_destruct(void);
static int seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b)
{
@@ -160,6 +181,8 @@ void BKE_sequencer_cache_destruct(void)
{
if (moviecache)
IMB_moviecache_free(moviecache);
+
+ preprocessed_cache_destruct();
}
void BKE_sequencer_cache_cleanup(void)
@@ -168,6 +191,8 @@ void BKE_sequencer_cache_cleanup(void)
IMB_moviecache_free(moviecache);
moviecache = IMB_moviecache_create("seqcache", sizeof(SeqCacheKey), seqcache_hashhash, seqcache_hashcmp);
}
+
+ BKE_sequencer_preprocessed_cache_cleanup();
}
static int seqcache_key_check_seq(void *userkey, void *userdata)
@@ -219,3 +244,100 @@ void BKE_sequencer_cache_put(SeqRenderData context, Sequence *seq, float cfra, s
IMB_moviecache_put(moviecache, &key, i);
}
+
+void BKE_sequencer_preprocessed_cache_cleanup(void)
+{
+ SeqPreprocessCacheElem *elem;
+
+ if (!preprocess_cache)
+ return;
+
+ for (elem = preprocess_cache->elems.first; elem; elem = elem->next) {
+ IMB_freeImBuf(elem->ibuf);
+ }
+ BLI_freelistN(&preprocess_cache->elems);
+
+ preprocess_cache->elems.first = preprocess_cache->elems.last = NULL;
+}
+
+static void preprocessed_cache_destruct(void)
+{
+ if (!preprocess_cache)
+ return;
+
+ BKE_sequencer_preprocessed_cache_cleanup();
+
+ MEM_freeN(preprocess_cache);
+ preprocess_cache = NULL;
+}
+
+ImBuf *BKE_sequencer_preprocessed_cache_get(SeqRenderData context, Sequence *seq, float cfra, seq_stripelem_ibuf_t type)
+{
+ SeqPreprocessCacheElem *elem;
+
+ if (!preprocess_cache)
+ return NULL;
+
+ if (preprocess_cache->cfra != cfra)
+ return NULL;
+
+ for (elem = preprocess_cache->elems.first; elem; elem = elem->next) {
+ if (elem->seq != seq)
+ continue;
+
+ if (elem->type != type)
+ continue;
+
+ if (seq_cmp_render_data(&elem->context, &context) != 0)
+ continue;
+
+ IMB_refImBuf(elem->ibuf);
+ return elem->ibuf;
+ }
+
+ return NULL;
+}
+
+void BKE_sequencer_preprocessed_cache_put(SeqRenderData context, Sequence *seq, float cfra, seq_stripelem_ibuf_t type, ImBuf *ibuf)
+{
+ SeqPreprocessCacheElem *elem;
+
+ if (!preprocess_cache) {
+ preprocess_cache = MEM_callocN(sizeof(SeqPreprocessCache), "sequencer preprocessed cache");
+ }
+ else {
+ if (preprocess_cache->cfra != cfra)
+ BKE_sequencer_preprocessed_cache_cleanup();
+ }
+
+ elem = MEM_callocN(sizeof(SeqPreprocessCacheElem), "sequencer preprocessed cache element");
+
+ elem->seq = seq;
+ elem->type = type;
+ elem->context = context;
+ elem->ibuf = ibuf;
+
+ preprocess_cache->cfra = cfra;
+
+ IMB_refImBuf(ibuf);
+
+ BLI_addtail(&preprocess_cache->elems, elem);
+}
+
+void BKE_sequencer_preprocessed_cache_cleanup_sequence(Sequence *seq)
+{
+ SeqPreprocessCacheElem *elem, *elem_next;
+
+ if (!preprocess_cache)
+ return;
+
+ for (elem = preprocess_cache->elems.first; elem; elem = elem_next) {
+ elem_next = elem->next;
+
+ if (elem->seq == seq) {
+ IMB_freeImBuf(elem->ibuf);
+
+ BLI_freelinkN(&preprocess_cache->elems, elem);
+ }
+ }
+}
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 2380596c6ad..87906337ca2 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -284,14 +284,14 @@ static void do_alphaover_effect(SeqRenderData context, Sequence *UNUSED(seq), fl
int start_line, int total_lines, ImBuf *out)
{
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
do_alphaover_effect_float(facf0, facf1, context.rectx, total_lines, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -446,14 +446,14 @@ static void do_alphaunder_effect(SeqRenderData context, Sequence *UNUSED(seq), f
int start_line, int total_lines, ImBuf *out)
{
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
do_alphaunder_effect_float(facf0, facf1, context.rectx, total_lines, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -556,14 +556,14 @@ static void do_cross_effect(SeqRenderData context, Sequence *UNUSED(seq), float
int start_line, int total_lines, ImBuf *out)
{
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
do_cross_effect_float(facf0, facf1, context.rectx, total_lines, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -805,14 +805,14 @@ static void do_gammacross_effect(SeqRenderData context, Sequence *UNUSED(seq), f
int start_line, int total_lines, ImBuf *out)
{
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
do_gammacross_effect_float(facf0, facf1, context.rectx, total_lines, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -911,14 +911,14 @@ static void do_add_effect(SeqRenderData context, Sequence *UNUSED(seq), float UN
ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *UNUSED(ibuf3), int start_line, int total_lines, ImBuf *out)
{
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
do_add_effect_float(facf0, facf1, context.rectx, total_lines, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -1015,14 +1015,14 @@ static void do_sub_effect(SeqRenderData context, Sequence *UNUSED(seq), float UN
ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *UNUSED(ibuf3), int start_line, int total_lines, ImBuf *out)
{
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
do_sub_effect_float(facf0, facf1, context.rectx, total_lines, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -1212,14 +1212,14 @@ static void do_mul_effect(SeqRenderData context, Sequence *UNUSED(seq), float UN
ImBuf *ibuf1, ImBuf *ibuf2, ImBuf *UNUSED(ibuf3), int start_line, int total_lines, ImBuf *out)
{
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
do_mul_effect_float(facf0, facf1, context.rectx, total_lines, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -2746,7 +2746,7 @@ static void do_overdrop_effect(SeqRenderData context, Sequence *UNUSED(seq), flo
int y = total_lines;
if (out->rect_float) {
- float *rect1, *rect2, *rect_out;
+ float *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_float_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
@@ -2754,7 +2754,7 @@ static void do_overdrop_effect(SeqRenderData context, Sequence *UNUSED(seq), flo
do_alphaover_effect_float(facf0, facf1, x, y, rect1, rect2, rect_out);
}
else {
- unsigned char *rect1, *rect2, *rect_out;
+ unsigned char *rect1 = NULL, *rect2 = NULL, *rect_out = NULL;
slize_get_byte_buffers(&context, ibuf1, ibuf2, NULL, out, start_line, &rect1, &rect2, NULL, &rect_out);
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
new file mode 100644
index 00000000000..70f27db0f74
--- /dev/null
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -0,0 +1,651 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/seqmodifier.c
+ * \ingroup bke
+ */
+
+#include <stddef.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_listbase.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
+#include "BLI_math.h"
+
+#include "DNA_sequence_types.h"
+
+#include "BKE_colortools.h"
+#include "BKE_sequencer.h"
+#include "BKE_utildefines.h"
+
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+static SequenceModifierTypeInfo *modifiersTypes[NUM_SEQUENCE_MODIFIER_TYPES];
+static int modifierTypesInit = FALSE;
+
+/*********************** Modifiers *************************/
+
+typedef void (*modifier_apply_threaded_cb) (int width, int height, unsigned char *rect, float *rect_float,
+ unsigned char *mask_rect, float *mask_rect_float, void *data_v);
+
+typedef struct ModifierInitData {
+ ImBuf *ibuf;
+ ImBuf *mask;
+ void *user_data;
+
+ modifier_apply_threaded_cb apply_callback;
+} ModifierInitData;
+
+typedef struct ModifierThread {
+ int width, height;
+
+ unsigned char *rect, *mask_rect;
+ float *rect_float, *mask_rect_float;
+
+ void *user_data;
+
+ modifier_apply_threaded_cb apply_callback;
+} ModifierThread;
+
+
+static ImBuf *modifier_mask_get(SequenceModifierData *smd, SeqRenderData context, int cfra, int make_float)
+{
+ return BKE_sequencer_render_mask_input(context, smd->mask_input_type, smd->mask_sequence, smd->mask_id, cfra, make_float);
+}
+
+static void modifier_init_handle(void *handle_v, int start_line, int tot_line, void *init_data_v)
+{
+ ModifierThread *handle = (ModifierThread *) handle_v;
+ ModifierInitData *init_data = (ModifierInitData *) init_data_v;
+ ImBuf *ibuf = init_data->ibuf;
+ ImBuf *mask = init_data->mask;
+
+ int offset = 4 * start_line * ibuf->x;
+
+ memset(handle, 0, sizeof(ModifierThread));
+
+ handle->width = ibuf->x;
+ handle->height = tot_line;
+ handle->apply_callback = init_data->apply_callback;
+ handle->user_data = init_data->user_data;
+
+ if (ibuf->rect)
+ handle->rect = (unsigned char *) ibuf->rect + offset;
+
+ if (ibuf->rect_float)
+ handle->rect_float = ibuf->rect_float + offset;
+
+ if (mask) {
+ if (mask->rect)
+ handle->mask_rect = (unsigned char *) mask->rect + offset;
+
+ if (mask->rect_float)
+ handle->mask_rect_float = mask->rect_float + offset;
+ }
+ else {
+ handle->mask_rect = NULL;
+ handle->mask_rect_float = NULL;
+ }
+}
+
+static void *modifier_do_thread(void *thread_data_v)
+{
+ ModifierThread *td = (ModifierThread *) thread_data_v;
+
+ td->apply_callback(td->width, td->height, td->rect, td->rect_float, td->mask_rect, td->mask_rect_float, td->user_data);
+
+ return NULL;
+}
+
+static void modifier_apply_threaded(ImBuf *ibuf, ImBuf *mask, modifier_apply_threaded_cb apply_callback, void *user_data)
+{
+ ModifierInitData init_data;
+
+ init_data.ibuf = ibuf;
+ init_data.mask = mask;
+ init_data.user_data = user_data;
+
+ init_data.apply_callback = apply_callback;
+
+ IMB_processor_apply_threaded(ibuf->y, sizeof(ModifierThread), &init_data,
+ modifier_init_handle, modifier_do_thread);
+}
+
+/* **** Color Balance Modifier **** */
+
+void colorBalance_init_data(SequenceModifierData *smd)
+{
+ ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
+ int c;
+
+ cbmd->color_multiply = 1.0f;
+
+ for (c = 0; c < 3; c++) {
+ cbmd->color_balance.lift[c] = 1.0f;
+ cbmd->color_balance.gamma[c] = 1.0f;
+ cbmd->color_balance.gain[c] = 1.0f;
+ }
+}
+
+ImBuf *colorBalance_apply(SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+{
+ ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
+ ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
+
+ BKE_sequencer_color_balance_apply(&cbmd->color_balance, ibuf_new, cbmd->color_multiply, FALSE, mask);
+
+ return ibuf_new;
+}
+
+static SequenceModifierTypeInfo seqModifier_ColorBalance = {
+ "Color Balance", /* name */
+ "ColorBalanceModifierData", /* struct_name */
+ sizeof(ColorBalanceModifierData), /* struct_size */
+ colorBalance_init_data, /* init_data */
+ NULL, /* free_data */
+ NULL, /* copy_data */
+ colorBalance_apply /* apply */
+};
+
+/* **** Curves Modifier **** */
+
+void curves_init_data(SequenceModifierData *smd)
+{
+ CurvesModifierData *cmd = (CurvesModifierData *) smd;
+
+ curvemapping_set_defaults(&cmd->curve_mapping, 4, 0.0f, 0.0f, 1.0f, 1.0f);
+}
+
+void curves_free_data(SequenceModifierData *smd)
+{
+ CurvesModifierData *cmd = (CurvesModifierData *) smd;
+
+ curvemapping_free_data(&cmd->curve_mapping);
+}
+
+void curves_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
+{
+ CurvesModifierData *cmd = (CurvesModifierData *) smd;
+ CurvesModifierData *cmd_target = (CurvesModifierData *) target;
+
+ curvemapping_copy_data(&cmd_target->curve_mapping, &cmd->curve_mapping);
+}
+
+void curves_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
+ unsigned char *mask_rect, float *mask_rect_float, void *data_v)
+{
+ CurveMapping *curve_mapping = (CurveMapping *) data_v;
+ int x, y;
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ int pixel_index = (y * width + x) * 4;
+
+ if (rect_float) {
+ float *pixel = rect_float + pixel_index;
+ float result[3];
+
+ curvemapping_evaluate_premulRGBF(curve_mapping, result, pixel);
+
+ if (mask_rect_float) {
+ float *m = mask_rect_float + pixel_index;
+
+ pixel[0] = pixel[0] * (1.0f - m[0]) + result[0] * m[0];
+ pixel[1] = pixel[1] * (1.0f - m[1]) + result[1] * m[1];
+ pixel[2] = pixel[2] * (1.0f - m[2]) + result[2] * m[2];
+ }
+ else {
+ pixel[0] = result[0];
+ pixel[1] = result[1];
+ pixel[2] = result[2];
+ }
+ }
+ if (rect) {
+ unsigned char *pixel = rect + pixel_index;
+ unsigned char result[3];
+
+ curvemapping_evaluate_premulRGB(curve_mapping, result, pixel);
+
+ if (mask_rect) {
+ float t[3];
+
+ rgb_uchar_to_float(t, mask_rect + pixel_index);
+
+ pixel[0] = pixel[0] * (1.0f - t[0]) + result[0] * t[0];
+ pixel[1] = pixel[1] * (1.0f - t[1]) + result[1] * t[1];
+ pixel[2] = pixel[2] * (1.0f - t[2]) + result[2] * t[2];
+ }
+ else {
+ pixel[0] = result[0];
+ pixel[1] = result[1];
+ pixel[2] = result[2];
+ }
+ }
+ }
+ }
+}
+
+ImBuf *curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+{
+ CurvesModifierData *cmd = (CurvesModifierData *) smd;
+ ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
+
+ float black[3] = {0.0f, 0.0f, 0.0f};
+ float white[3] = {1.0f, 1.0f, 1.0f};
+
+ curvemapping_initialize(&cmd->curve_mapping);
+
+ curvemapping_premultiply(&cmd->curve_mapping, 0);
+ curvemapping_set_black_white(&cmd->curve_mapping, black, white);
+
+ modifier_apply_threaded(ibuf_new, mask, curves_apply_threaded, &cmd->curve_mapping);
+
+ curvemapping_premultiply(&cmd->curve_mapping, 1);
+
+ return ibuf_new;
+}
+
+static SequenceModifierTypeInfo seqModifier_Curves = {
+ "Curves", /* name */
+ "CurvesModifierData", /* struct_name */
+ sizeof(CurvesModifierData), /* struct_size */
+ curves_init_data, /* init_data */
+ curves_free_data, /* free_data */
+ curves_copy_data, /* copy_data */
+ curves_apply /* apply */
+};
+
+/* **** Hue Correct Modifier **** */
+
+void hue_correct_init_data(SequenceModifierData *smd)
+{
+ HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
+ int c;
+
+ curvemapping_set_defaults(&hcmd->curve_mapping, 1, 0.0f, 0.0f, 1.0f, 1.0f);
+ hcmd->curve_mapping.preset = CURVE_PRESET_MID9;
+
+ for (c = 0; c < 3; c++) {
+ CurveMap *cuma = &hcmd->curve_mapping.cm[c];
+
+ curvemap_reset(cuma, &hcmd->curve_mapping.clipr, hcmd->curve_mapping.preset, CURVEMAP_SLOPE_POSITIVE);
+ }
+
+ /* default to showing Saturation */
+ hcmd->curve_mapping.cur = 1;
+}
+
+void hue_correct_free_data(SequenceModifierData *smd)
+{
+ HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
+
+ curvemapping_free_data(&hcmd->curve_mapping);
+}
+
+void hue_correct_copy_data(SequenceModifierData *target, SequenceModifierData *smd)
+{
+ HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
+ HueCorrectModifierData *hcmd_target = (HueCorrectModifierData *) target;
+
+ curvemapping_copy_data(&hcmd_target->curve_mapping, &hcmd->curve_mapping);
+}
+
+void hue_correct_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
+ unsigned char *mask_rect, float *mask_rect_float, void *data_v)
+{
+ CurveMapping *curve_mapping = (CurveMapping *) data_v;
+ int x, y;
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ int pixel_index = (y * width + x) * 4;
+ float pixel[3], result[3], mask[3] = {1.0f, 1.0f, 1.0f};
+ float hsv[3], f;
+
+ if (rect_float)
+ copy_v3_v3(pixel, rect_float + pixel_index);
+ else
+ rgb_uchar_to_float(pixel, rect + pixel_index);
+
+ rgb_to_hsv(pixel[0], pixel[1], pixel[2], hsv, hsv + 1, hsv + 2);
+
+ /* adjust hue, scaling returned default 0.5 up to 1 */
+ f = curvemapping_evaluateF(curve_mapping, 0, hsv[0]);
+ hsv[0] += f - 0.5f;
+
+ /* adjust saturation, scaling returned default 0.5 up to 1 */
+ f = curvemapping_evaluateF(curve_mapping, 1, hsv[0]);
+ hsv[1] *= (f * 2.0f);
+
+ /* adjust value, scaling returned default 0.5 up to 1 */
+ f = curvemapping_evaluateF(curve_mapping, 2, hsv[0]);
+ hsv[2] *= (f * 2.f);
+
+ hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */
+ CLAMP(hsv[1], 0.0f, 1.0f);
+
+ /* convert back to rgb */
+ hsv_to_rgb(hsv[0], hsv[1], hsv[2], result, result + 1, result + 2);
+
+ if (mask_rect_float)
+ copy_v3_v3(mask, mask_rect_float + pixel_index);
+ else if (mask_rect)
+ rgb_uchar_to_float(mask, mask_rect + pixel_index);
+
+ result[0] = pixel[0] * (1.0f - mask[0]) + result[0] * mask[0];
+ result[1] = pixel[1] * (1.0f - mask[1]) + result[1] * mask[1];
+ result[2] = pixel[2] * (1.0f - mask[2]) + result[2] * mask[2];
+
+ if (rect_float)
+ copy_v3_v3(rect_float + pixel_index, result);
+ else
+ rgb_float_to_uchar(rect + pixel_index, result);
+ }
+ }
+}
+
+ImBuf *hue_correct_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+{
+ HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
+ ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
+
+ curvemapping_initialize(&hcmd->curve_mapping);
+
+ modifier_apply_threaded(ibuf_new, mask, hue_correct_apply_threaded, &hcmd->curve_mapping);
+
+ return ibuf_new;
+}
+
+static SequenceModifierTypeInfo seqModifier_HueCorrect = {
+ "Hue Correct", /* name */
+ "HueCorrectModifierData", /* struct_name */
+ sizeof(HueCorrectModifierData), /* struct_size */
+ hue_correct_init_data, /* init_data */
+ hue_correct_free_data, /* free_data */
+ hue_correct_copy_data, /* copy_data */
+ hue_correct_apply /* apply */
+};
+
+/* **** Bright/Contrast Modifier **** */
+
+typedef struct BrightContrastThreadData {
+ float bright;
+ float contrast;
+} BrightContrastThreadData;
+
+void brightcontrast_apply_threaded(int width, int height, unsigned char *rect, float *rect_float,
+ unsigned char *mask_rect, float *mask_rect_float, void *data_v)
+{
+ BrightContrastThreadData *data = (BrightContrastThreadData *) data_v;
+ int x, y;
+
+ float i;
+ int c;
+ float a, b, v;
+ float brightness = data->bright / 100.0f;
+ float contrast = data->contrast;
+ 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
+ */
+ if (contrast > 0) {
+ a = 1.0f / a;
+ b = a * (brightness - delta);
+ }
+ else {
+ delta *= -1;
+ b = a * (brightness + delta);
+ }
+
+ for (y = 0; y < height; y++) {
+ for (x = 0; x < width; x++) {
+ int pixel_index = (y * width + x) * 4;
+
+ if (rect) {
+ unsigned char *pixel = rect + pixel_index;
+
+ for (c = 0; c < 3; c++) {
+ i = pixel[c];
+ v = a * i + b;
+
+ if (mask_rect) {
+ unsigned char *m = mask_rect + pixel_index;
+ float t = (float) m[c] / 255.0f;
+
+ pixel[c] = pixel[c] * (1.0f - t) + v * t;
+ }
+ else
+ pixel[c] = v;
+ }
+ }
+ else if (rect_float) {
+ float *pixel = rect_float + pixel_index;
+
+ for (c = 0; c < 3; c++) {
+ i = pixel[c];
+ v = a * i + b;
+
+ if (mask_rect_float) {
+ float *m = mask_rect_float + pixel_index;
+
+ pixel[c] = pixel[c] * (1.0f - m[c]) + v * m[c];
+ }
+ else
+ pixel[c] = v;
+ }
+ }
+ }
+ }
+}
+
+ImBuf *brightcontrast_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask)
+{
+ BrightContrastModifierData *bcmd = (BrightContrastModifierData *) smd;
+ BrightContrastThreadData data;
+ ImBuf *ibuf_new = IMB_dupImBuf(ibuf);
+
+ data.bright = bcmd->bright;
+ data.contrast = bcmd->contrast;
+
+ modifier_apply_threaded(ibuf_new, mask, brightcontrast_apply_threaded, &data);
+
+ return ibuf_new;
+}
+
+static SequenceModifierTypeInfo seqModifier_BrightContrast = {
+ "Bright/Contrast", /* name */
+ "BrightContrastModifierData", /* struct_name */
+ sizeof(BrightContrastModifierData), /* struct_size */
+ NULL, /* init_data */
+ NULL, /* free_data */
+ NULL, /* copy_data */
+ brightcontrast_apply /* apply */
+};
+
+/*********************** Modifier functions *************************/
+
+static void sequence_modifier_type_info_init(void)
+{
+#define INIT_TYPE(typeName) (modifiersTypes[seqModifierType_##typeName] = &seqModifier_##typeName)
+
+ INIT_TYPE(ColorBalance);
+ INIT_TYPE(Curves);
+ INIT_TYPE(HueCorrect);
+ INIT_TYPE(BrightContrast);
+
+#undef INIT_TYPE
+}
+
+SequenceModifierTypeInfo *BKE_sequence_modifier_type_info_get(int type)
+{
+ if (!modifierTypesInit) {
+ sequence_modifier_type_info_init();
+ modifierTypesInit = TRUE;
+ }
+
+ return modifiersTypes[type];
+}
+
+SequenceModifierData *BKE_sequence_modifier_new(Sequence *seq, const char *name, int type)
+{
+ SequenceModifierData *smd;
+ SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(type);
+
+ smd = MEM_callocN(smti->struct_size, "sequence modifier");
+
+ smd->type = type;
+ smd->flag |= SEQUENCE_MODIFIER_EXPANDED;
+
+ if (!name || !name[0])
+ BLI_strncpy(smd->name, smti->name, sizeof(smd->name));
+ else
+ BLI_strncpy(smd->name, name, sizeof(smd->name));
+
+ BLI_addtail(&seq->modifiers, smd);
+
+ BKE_sequence_modifier_unique_name(seq, smd);
+
+ if (smti->init_data)
+ smti->init_data(smd);
+
+ return smd;
+}
+
+int BKE_sequence_modifier_remove(Sequence *seq, SequenceModifierData *smd)
+{
+ if (BLI_findindex(&seq->modifiers, smd) == -1)
+ return FALSE;
+
+ BLI_remlink(&seq->modifiers, smd);
+ BKE_sequence_modifier_free(smd);
+
+ return TRUE;
+}
+
+void BKE_sequence_modifier_clear(Sequence *seq)
+{
+ SequenceModifierData *smd, *smd_next;
+
+ for (smd = seq->modifiers.first; smd; smd = smd_next) {
+ smd_next = smd->next;
+ BKE_sequence_modifier_free(smd);
+ }
+
+ seq->modifiers.first = seq->modifiers.last = NULL;
+}
+
+void BKE_sequence_modifier_free(SequenceModifierData *smd)
+{
+ SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
+
+ if (smti && smti->free_data) {
+ smti->free_data(smd);
+ }
+
+ MEM_freeN(smd);
+}
+
+void BKE_sequence_modifier_unique_name(Sequence *seq, SequenceModifierData *smd)
+{
+ SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
+
+ BLI_uniquename(&seq->modifiers, smd, smti->name, '.', offsetof(SequenceModifierData, name), sizeof(smd->name));
+}
+
+SequenceModifierData *BKE_sequence_modifier_find_by_name(Sequence *seq, char *name)
+{
+ return BLI_findstring(&(seq->modifiers), name, offsetof(SequenceModifierData, name));
+}
+
+ImBuf *BKE_sequence_modifier_apply_stack(SeqRenderData context, Sequence *seq, ImBuf *ibuf, int cfra)
+{
+ SequenceModifierData *smd;
+ ImBuf *processed_ibuf = ibuf;
+
+ for (smd = seq->modifiers.first; smd; smd = smd->next) {
+ SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
+ ImBuf *ibuf_new;
+
+ /* could happen if modifier is being removed or not exists in current version of blender */
+ if (!smti)
+ continue;
+
+ /* modifier is muted, do nothing */
+ if (smd->flag & SEQUENCE_MODIFIER_MUTE)
+ continue;
+
+ if (smti->apply) {
+ ImBuf *mask = modifier_mask_get(smd, context, cfra, ibuf->rect_float != NULL);
+
+ if (processed_ibuf == ibuf)
+ processed_ibuf = IMB_dupImBuf(ibuf);
+
+ ibuf_new = smti->apply(smd, processed_ibuf, mask);
+
+ if (ibuf_new != processed_ibuf) {
+ IMB_freeImBuf(processed_ibuf);
+ processed_ibuf = ibuf_new;
+ }
+
+ if (mask)
+ IMB_freeImBuf(mask);
+ }
+ }
+
+ return processed_ibuf;
+}
+
+void BKE_sequence_modifier_list_copy(Sequence *seqn, Sequence *seq)
+{
+ SequenceModifierData *smd;
+
+ for (smd = seq->modifiers.first; smd; smd = smd->next) {
+ SequenceModifierData *smdn;
+ SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
+
+ smdn = MEM_dupallocN(smd);
+
+ if (smti && smti->copy_data)
+ smti->copy_data(smdn, smd);
+
+ smdn->next = smdn->prev = NULL;
+ BLI_addtail(&seqn->modifiers, smdn);
+ }
+}
+
+int BKE_sequence_supports_modifiers(Sequence *seq)
+{
+ return !ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD);
+}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index cec868cfc10..3bcef50a3b4 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -83,6 +83,7 @@
static ImBuf *seq_render_strip_stack(SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra);
static void seq_free_animdata(Scene *scene, Sequence *seq);
+static ImBuf *seq_render_mask(SeqRenderData context, Mask *mask, float nr, short make_float);
/* **** XXX ******** */
#define SELECT 1
@@ -203,7 +204,11 @@ void BKE_sequence_free(Scene *scene, Sequence *seq)
seq_free_animdata(scene, seq);
}
+ /* free modifiers */
+ BKE_sequence_modifier_clear(seq);
+
BKE_sequencer_cache_cleanup_sequence(seq);
+ BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
MEM_freeN(seq);
}
@@ -1432,7 +1437,7 @@ static void make_cb_table_float(float lift, float gain, float gamma,
}
}
-static void color_balance_byte_byte(Sequence *seq, unsigned char *rect, unsigned char *mask_rect, int width, int height, float mul)
+static void color_balance_byte_byte(StripColorBalance *cb_, unsigned char *rect, unsigned char *mask_rect, int width, int height, float mul)
{
unsigned char cb_tab[3][256];
int c;
@@ -1440,7 +1445,7 @@ static void color_balance_byte_byte(Sequence *seq, unsigned char *rect, unsigned
unsigned char *e = p + width * 4 * height;
unsigned char *m = mask_rect;
- StripColorBalance cb = calc_cb(seq->strip->color_balance);
+ StripColorBalance cb = calc_cb(cb_);
for (c = 0; c < 3; c++) {
make_cb_table_byte(cb.lift[c], cb.gain[c], cb.gamma[c], cb_tab[c], mul);
@@ -1466,7 +1471,7 @@ static void color_balance_byte_byte(Sequence *seq, unsigned char *rect, unsigned
}
}
-static void color_balance_byte_float(Sequence *seq, unsigned char *rect, float *rect_float, unsigned char *mask_rect, int width, int height, float mul)
+static void color_balance_byte_float(StripColorBalance *cb_, unsigned char *rect, float *rect_float, unsigned char *mask_rect, int width, int height, float mul)
{
float cb_tab[4][256];
int c, i;
@@ -1478,7 +1483,7 @@ static void color_balance_byte_float(Sequence *seq, unsigned char *rect, float *
o = rect_float;
- cb = calc_cb(seq->strip->color_balance);
+ cb = calc_cb(cb_);
for (c = 0; c < 3; c++) {
make_cb_table_float(cb.lift[c], cb.gain[c], cb.gamma[c], cb_tab[c], mul);
@@ -1510,12 +1515,12 @@ static void color_balance_byte_float(Sequence *seq, unsigned char *rect, float *
}
}
-static void color_balance_float_float(Sequence *seq, float *rect_float, float *mask_rect_float, int width, int height, float mul)
+static void color_balance_float_float(StripColorBalance *cb_, float *rect_float, float *mask_rect_float, int width, int height, float mul)
{
float *p = rect_float;
float *e = rect_float + width * 4 * height;
float *m = mask_rect_float;
- StripColorBalance cb = calc_cb(seq->strip->color_balance);
+ StripColorBalance cb = calc_cb(cb_);
while (p < e) {
int c;
@@ -1535,20 +1540,23 @@ static void color_balance_float_float(Sequence *seq, float *rect_float, float *m
}
typedef struct ColorBalanceInitData {
- Sequence *seq;
+ StripColorBalance *cb;
ImBuf *ibuf;
float mul;
ImBuf *mask;
+ short make_float;
} ColorBalanceInitData;
typedef struct ColorBalanceThread {
- Sequence *seq;
+ StripColorBalance *cb;
float mul;
int width, height;
unsigned char *rect, *mask_rect;
float *rect_float, *mask_rect_float;
+
+ short make_float;
} ColorBalanceThread;
static void color_balance_init_handle(void *handle_v, int start_line, int tot_line, void *init_data_v)
@@ -1562,10 +1570,11 @@ static void color_balance_init_handle(void *handle_v, int start_line, int tot_li
memset(handle, 0, sizeof(ColorBalanceThread));
- handle->seq = init_data->seq;
+ handle->cb = init_data->cb;
handle->mul = init_data->mul;
handle->width = ibuf->x;
handle->height = tot_line;
+ handle->make_float = init_data->make_float;
if (ibuf->rect)
handle->rect = (unsigned char *) ibuf->rect + offset;
@@ -1589,7 +1598,7 @@ static void color_balance_init_handle(void *handle_v, int start_line, int tot_li
static void *color_balance_do_thread(void *thread_data_v)
{
ColorBalanceThread *thread_data = (ColorBalanceThread *) thread_data_v;
- Sequence *seq = thread_data->seq;
+ StripColorBalance *cb = thread_data->cb;
int width = thread_data->width, height = thread_data->height;
unsigned char *rect = thread_data->rect;
unsigned char *mask_rect = thread_data->mask_rect;
@@ -1598,48 +1607,56 @@ static void *color_balance_do_thread(void *thread_data_v)
float mul = thread_data->mul;
if (rect_float) {
- color_balance_float_float(seq, rect_float, mask_rect_float, width, height, mul);
+ color_balance_float_float(cb, rect_float, mask_rect_float, width, height, mul);
}
- else if (seq->flag & SEQ_MAKE_FLOAT) {
- color_balance_byte_float(seq, rect, rect_float, mask_rect, width, height, mul);
+ else if (thread_data->make_float) {
+ color_balance_byte_float(cb, rect, rect_float, mask_rect, width, height, mul);
}
else {
- color_balance_byte_byte(seq, rect, mask_rect, width, height, mul);
+ color_balance_byte_byte(cb, rect, mask_rect, width, height, mul);
}
return NULL;
}
-static void color_balance(SeqRenderData context, Sequence *seq, ImBuf *ibuf, float mul, int cfra)
+ImBuf *BKE_sequencer_render_mask_input(SeqRenderData context, int mask_input_type, Sequence *mask_sequence, Mask *mask_id, int cfra, int make_float)
+{
+ ImBuf *mask_input = NULL;
+
+ if (mask_input_type == SEQUENCE_MASK_INPUT_STRIP) {
+ if (mask_sequence) {
+ mask_input = seq_render_strip(context, mask_sequence, cfra);
+
+ if (make_float) {
+ if (!mask_input->rect_float)
+ IMB_float_from_rect(mask_input);
+ }
+ else {
+ if (!mask_input->rect)
+ IMB_rect_from_float(mask_input);
+ }
+ }
+ }
+ else if (mask_input_type == SEQUENCE_MASK_INPUT_ID) {
+ mask_input = seq_render_mask(context, mask_id, cfra, make_float);
+ }
+
+ return mask_input;
+}
+
+void BKE_sequencer_color_balance_apply(StripColorBalance *cb, ImBuf *ibuf, float mul, short make_float, ImBuf *mask_input)
{
ColorBalanceInitData init_data;
- if (!ibuf->rect_float && seq->flag & SEQ_MAKE_FLOAT)
+ if (!ibuf->rect_float && make_float)
imb_addrectfloatImBuf(ibuf);
- init_data.seq = seq;
+ init_data.cb = cb;
init_data.ibuf = ibuf;
init_data.mul = mul;
init_data.mask = NULL;
-
- if (seq->mask_sequence) {
- if (seq->mask_sequence != seq && !BKE_sequence_check_depend(seq, seq->mask_sequence)) {
- ImBuf *mask = seq_render_strip(context, seq->mask_sequence, cfra);
-
- if (mask) {
- if (ibuf->rect_float) {
- if (!mask->rect_float)
- IMB_float_from_rect(mask);
- }
- else {
- if (!mask->rect)
- IMB_rect_from_float(mask);
- }
-
- init_data.mask = mask;
- }
- }
- }
+ init_data.make_float = make_float;
+ init_data.mask = mask_input;
IMB_processor_apply_threaded(ibuf->y, sizeof(ColorBalanceThread), &init_data,
color_balance_init_handle, color_balance_do_thread);
@@ -1650,9 +1667,26 @@ static void color_balance(SeqRenderData context, Sequence *seq, ImBuf *ibuf, flo
*/
if (ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
+}
+
+static void sequence_color_balance(SeqRenderData context, Sequence *seq, ImBuf *ibuf, float mul, int cfra)
+{
+ StripColorBalance *cb = seq->strip->color_balance;
+ ImBuf *mask_input = NULL;
+ short make_float = seq->flag & SEQ_MAKE_FLOAT;
+
+ if (seq->mask_sequence) {
+ if (seq->mask_sequence != seq && !BKE_sequence_check_depend(seq, seq->mask_sequence)) {
+ int make_float = ibuf->rect_float != NULL;
+
+ mask_input = BKE_sequencer_render_mask_input(context, SEQUENCE_MASK_INPUT_STRIP, seq->mask_sequence, NULL, cfra, make_float);
+ }
+ }
- if (init_data.mask)
- IMB_freeImBuf(init_data.mask);
+ BKE_sequencer_color_balance_apply(cb, ibuf, mul, make_float, mask_input);
+
+ if (mask_input)
+ IMB_freeImBuf(mask_input);
}
/*
@@ -1696,6 +1730,10 @@ int BKE_sequencer_input_have_to_preprocess(SeqRenderData UNUSED(context), Sequen
if (seq->sat != 1.0f) {
return TRUE;
}
+
+ if (seq->modifiers.first) {
+ return TRUE;
+ }
return FALSE;
}
@@ -1795,7 +1833,7 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
}
if (seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
- color_balance(context, seq, ibuf, mul, cfra);
+ sequence_color_balance(context, seq, ibuf, mul, cfra);
mul = 1.0;
}
@@ -1818,7 +1856,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
}
}
-
if (ibuf->x != context.rectx || ibuf->y != context.recty) {
if (context.scene->r.mode & R_OSA) {
IMB_scaleImBuf(ibuf, (short)context.rectx, (short)context.recty);
@@ -1827,6 +1864,16 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra,
IMB_scalefastImBuf(ibuf, (short)context.rectx, (short)context.recty);
}
}
+
+ if (seq->modifiers.first) {
+ ImBuf *ibuf_new = BKE_sequence_modifier_apply_stack(context, seq, ibuf, cfra);
+
+ if (ibuf_new != ibuf) {
+ IMB_freeImBuf(ibuf);
+ ibuf = ibuf_new;
+ }
+ }
+
return ibuf;
}
@@ -2098,23 +2145,23 @@ static ImBuf *seq_render_movieclip_strip(SeqRenderData context, Sequence *seq, f
}
-static ImBuf *seq_render_mask_strip(SeqRenderData context, Sequence *seq, float nr)
+static ImBuf *seq_render_mask(SeqRenderData context, Mask *mask, float nr, short make_float)
{
/* TODO - add option to rasterize to alpha imbuf? */
ImBuf *ibuf = NULL;
float *maskbuf;
int i;
- if (!seq->mask) {
+ if (!mask) {
return NULL;
}
else {
Mask *mask_temp;
MaskRasterHandle *mr_handle;
- mask_temp = BKE_mask_copy_nolib(seq->mask);
+ mask_temp = BKE_mask_copy_nolib(mask);
- BKE_mask_evaluate(mask_temp, seq->mask->sfra + nr, TRUE);
+ BKE_mask_evaluate(mask_temp, mask->sfra + nr, TRUE);
maskbuf = MEM_mallocN(sizeof(float) * context.rectx * context.recty, __func__);
@@ -2131,7 +2178,7 @@ static ImBuf *seq_render_mask_strip(SeqRenderData context, Sequence *seq, float
}
- if (seq->flag & SEQ_MAKE_FLOAT) {
+ if (make_float) {
/* pixels */
float *fp_src;
float *fp_dst;
@@ -2173,6 +2220,13 @@ static ImBuf *seq_render_mask_strip(SeqRenderData context, Sequence *seq, float
return ibuf;
}
+static ImBuf *seq_render_mask_strip(SeqRenderData context, Sequence *seq, float nr)
+{
+ short make_float = seq->flag & SEQ_MAKE_FLOAT;
+
+ return seq_render_mask(context, seq->mask, nr, make_float);
+}
+
static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float nr)
{
ImBuf *ibuf = NULL;
@@ -2328,160 +2382,146 @@ static ImBuf *seq_render_scene_strip(SeqRenderData context, Sequence *seq, float
return ibuf;
}
-static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
+static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, float cfra)
{
ImBuf *ibuf = NULL;
- char name[FILE_MAX];
- int use_preprocess = BKE_sequencer_input_have_to_preprocess(context, seq, cfra);
- int is_proxy_image = FALSE;
float nr = give_stripelem_index(seq, cfra);
- /* all effects are handled similarly with the exception of speed effect */
int type = (seq->type & SEQ_TYPE_EFFECT && seq->type != SEQ_TYPE_SPEED) ? SEQ_TYPE_EFFECT : seq->type;
- int is_preprocessed = !ELEM3(type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SCENE);
-
- ibuf = BKE_sequencer_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
-
- /* currently, we cache preprocessed images in SEQ_STRIPELEM_IBUF,
- * but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
- if (ibuf)
- use_preprocess = FALSE;
-
- if (ibuf == NULL)
- ibuf = copy_from_ibuf_still(context, seq, nr);
-
- /* MOVIECLIPs have their own proxy management */
- if (ibuf == NULL && seq->type != SEQ_TYPE_MOVIECLIP) {
- ibuf = seq_proxy_fetch(context, seq, cfra);
- is_proxy_image = (ibuf != NULL);
- }
+ int use_preprocess = BKE_sequencer_input_have_to_preprocess(context, seq, cfra);
+ char name[FILE_MAX];
- if (ibuf == NULL) switch (type) {
- case SEQ_TYPE_META:
- {
- ImBuf *meta_ibuf = NULL;
+ switch (type) {
+ case SEQ_TYPE_META:
+ {
+ ImBuf *meta_ibuf = NULL;
- if (seq->seqbase.first)
- meta_ibuf = seq_render_strip_stack(
- context, &seq->seqbase,
- seq->start + nr, 0);
+ if (seq->seqbase.first)
+ meta_ibuf = seq_render_strip_stack(context, &seq->seqbase, seq->start + nr, 0);
- if (meta_ibuf) {
- ibuf = meta_ibuf;
- if (ibuf && use_preprocess) {
- ImBuf *i = IMB_dupImBuf(ibuf);
+ if (meta_ibuf) {
+ ibuf = meta_ibuf;
+ if (ibuf && use_preprocess) {
+ ImBuf *i = IMB_dupImBuf(ibuf);
- IMB_freeImBuf(ibuf);
+ IMB_freeImBuf(ibuf);
- ibuf = i;
- }
+ ibuf = i;
}
-
- break;
}
- case SEQ_TYPE_SPEED:
- {
- ImBuf *child_ibuf = NULL;
- float f_cfra;
- SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
+ break;
+ }
- BKE_sequence_effect_speed_rebuild_map(context.scene, seq, 0);
+ case SEQ_TYPE_SPEED:
+ {
+ ImBuf *child_ibuf = NULL;
- /* weeek! */
- f_cfra = seq->start + s->frameMap[(int)nr];
+ float f_cfra;
+ SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
- child_ibuf = seq_render_strip(context, seq->seq1, f_cfra);
+ BKE_sequence_effect_speed_rebuild_map(context.scene, seq, 0);
- if (child_ibuf) {
- ibuf = child_ibuf;
- if (ibuf && use_preprocess) {
- ImBuf *i = IMB_dupImBuf(ibuf);
+ /* weeek! */
+ f_cfra = seq->start + s->frameMap[(int)nr];
- IMB_freeImBuf(ibuf);
+ child_ibuf = seq_render_strip(context, seq->seq1, f_cfra);
- ibuf = i;
- }
+ if (child_ibuf) {
+ ibuf = child_ibuf;
+ if (ibuf && use_preprocess) {
+ ImBuf *i = IMB_dupImBuf(ibuf);
+
+ IMB_freeImBuf(ibuf);
+
+ ibuf = i;
}
- break;
- }
- case SEQ_TYPE_EFFECT:
- {
- ibuf = seq_render_effect_strip_impl(context, seq, seq->start + nr);
- break;
}
- case SEQ_TYPE_IMAGE:
- {
- StripElem *s_elem = BKE_sequencer_give_stripelem(seq, cfra);
+ break;
+ }
- if (s_elem) {
- BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
- BLI_path_abs(name, G.main->name);
- }
+ case SEQ_TYPE_EFFECT:
+ {
+ ibuf = seq_render_effect_strip_impl(context, seq, seq->start + nr);
+ break;
+ }
- if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) {
- /* we don't need both (speed reasons)! */
- if (ibuf->rect_float && ibuf->rect)
- imb_freerectImBuf(ibuf);
+ case SEQ_TYPE_IMAGE:
+ {
+ StripElem *s_elem = BKE_sequencer_give_stripelem(seq, cfra);
- /* all sequencer color is done in SRGB space, linear gives odd crossfades */
- if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
- IMB_convert_profile(ibuf, IB_PROFILE_NONE);
+ if (s_elem) {
+ BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
+ BLI_path_abs(name, G.main->name);
+ }
- copy_to_ibuf_still(context, seq, nr, ibuf);
+ if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) {
+ /* we don't need both (speed reasons)! */
+ if (ibuf->rect_float && ibuf->rect)
+ imb_freerectImBuf(ibuf);
- s_elem->orig_width = ibuf->x;
- s_elem->orig_height = ibuf->y;
- }
- break;
+ /* all sequencer color is done in SRGB space, linear gives odd crossfades */
+ if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
+ IMB_convert_profile(ibuf, IB_PROFILE_NONE);
+
+ copy_to_ibuf_still(context, seq, nr, ibuf);
+
+ s_elem->orig_width = ibuf->x;
+ s_elem->orig_height = ibuf->y;
}
- case SEQ_TYPE_MOVIE:
- {
- seq_open_anim_file(seq);
+ break;
+ }
+
+ case SEQ_TYPE_MOVIE:
+ {
+ seq_open_anim_file(seq);
- if (seq->anim) {
- IMB_anim_set_preseek(seq->anim, seq->anim_preseek);
+ if (seq->anim) {
+ IMB_anim_set_preseek(seq->anim, seq->anim_preseek);
- ibuf = IMB_anim_absolute(seq->anim, nr + seq->anim_startofs,
- seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN,
- seq_rendersize_to_proxysize(context.preview_render_size));
+ ibuf = IMB_anim_absolute(seq->anim, nr + seq->anim_startofs,
+ seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN,
+ seq_rendersize_to_proxysize(context.preview_render_size));
- /* we don't need both (speed reasons)! */
- if (ibuf && ibuf->rect_float && ibuf->rect)
- imb_freerectImBuf(ibuf);
- if (ibuf) {
- seq->strip->stripdata->orig_width = ibuf->x;
- seq->strip->stripdata->orig_height = ibuf->y;
- }
+ /* we don't need both (speed reasons)! */
+ if (ibuf && ibuf->rect_float && ibuf->rect)
+ imb_freerectImBuf(ibuf);
+ if (ibuf) {
+ seq->strip->stripdata->orig_width = ibuf->x;
+ seq->strip->stripdata->orig_height = ibuf->y;
}
- copy_to_ibuf_still(context, seq, nr, ibuf);
- break;
}
- case SEQ_TYPE_SCENE:
- {
- /* scene can be NULL after deletions */
- ibuf = seq_render_scene_strip(context, seq, nr);
+ copy_to_ibuf_still(context, seq, nr, ibuf);
+ break;
+ }
- /* Scene strips update all animation, so we need to restore original state.*/
- BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra);
+ case SEQ_TYPE_SCENE:
+ {
+ /* scene can be NULL after deletions */
+ ibuf = seq_render_scene_strip(context, seq, nr);
- copy_to_ibuf_still(context, seq, nr, ibuf);
- break;
- }
- case SEQ_TYPE_MOVIECLIP:
- {
- ibuf = seq_render_movieclip_strip(context, seq, nr);
+ /* Scene strips update all animation, so we need to restore original state.*/
+ BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra);
- if (ibuf && use_preprocess) {
- ImBuf *i = IMB_dupImBuf(ibuf);
+ copy_to_ibuf_still(context, seq, nr, ibuf);
+ break;
+ }
- IMB_freeImBuf(ibuf);
+ case SEQ_TYPE_MOVIECLIP:
+ {
+ ibuf = seq_render_movieclip_strip(context, seq, nr);
- ibuf = i;
- }
+ if (ibuf && use_preprocess) {
+ ImBuf *i = IMB_dupImBuf(ibuf);
- copy_to_ibuf_still(context, seq, nr, ibuf);
- break;
+ IMB_freeImBuf(ibuf);
+
+ ibuf = i;
}
+
+ copy_to_ibuf_still(context, seq, nr, ibuf);
+ break;
+ }
+
case SEQ_TYPE_MASK:
{
/* ibuf is alwats new */
@@ -2492,6 +2532,47 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
}
}
+ return ibuf;
+}
+
+static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
+{
+ ImBuf *ibuf = NULL;
+ int use_preprocess = BKE_sequencer_input_have_to_preprocess(context, seq, cfra);
+ int is_proxy_image = FALSE;
+ float nr = give_stripelem_index(seq, cfra);
+ /* all effects are handled similarly with the exception of speed effect */
+ int type = (seq->type & SEQ_TYPE_EFFECT && seq->type != SEQ_TYPE_SPEED) ? SEQ_TYPE_EFFECT : seq->type;
+ int is_preprocessed = !ELEM3(type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SCENE);
+
+ ibuf = BKE_sequencer_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
+
+ /* currently, we cache preprocessed images in SEQ_STRIPELEM_IBUF,
+ * but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
+ if (ibuf)
+ use_preprocess = FALSE;
+
+ if (ibuf == NULL)
+ ibuf = copy_from_ibuf_still(context, seq, nr);
+
+ if (ibuf == NULL) {
+ ibuf = BKE_sequencer_preprocessed_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
+
+ if (ibuf == NULL) {
+ /* MOVIECLIPs have their own proxy management */
+ if (ibuf == NULL && seq->type != SEQ_TYPE_MOVIECLIP) {
+ ibuf = seq_proxy_fetch(context, seq, cfra);
+ is_proxy_image = (ibuf != NULL);
+ }
+
+ if (ibuf == NULL)
+ ibuf = do_render_strip_uncached(context, seq, cfra);
+
+ if (ibuf)
+ BKE_sequencer_preprocessed_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf);
+ }
+ }
+
if (ibuf == NULL)
ibuf = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
@@ -2876,7 +2957,7 @@ int BKE_sequence_check_depend(Sequence *seq, Sequence *cur)
return TRUE;
}
-void BKE_sequence_invalidate_cache(Scene *scene, Sequence *seq)
+static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidate_preprocess)
{
Editing *ed = scene->ed;
Sequence *cur;
@@ -2884,18 +2965,33 @@ void BKE_sequence_invalidate_cache(Scene *scene, Sequence *seq)
/* invalidate cache for current sequence */
BKE_sequencer_cache_cleanup_sequence(seq);
+ if (invalidate_preprocess)
+ BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
+
/* invalidate cache for all dependent sequences */
SEQ_BEGIN (ed, cur)
{
if (cur == seq)
continue;
- if (BKE_sequence_check_depend(seq, cur))
+ if (BKE_sequence_check_depend(seq, cur)) {
BKE_sequencer_cache_cleanup_sequence(cur);
+ BKE_sequencer_preprocessed_cache_cleanup_sequence(cur);
+ }
}
SEQ_END
}
+void BKE_sequence_invalidate_cache(Scene *scene, Sequence *seq)
+{
+ sequence_invalidate_cache(scene, seq, TRUE);
+}
+
+void BKE_sequence_invalidate_cache_for_modifier(Scene *scene, Sequence *seq)
+{
+ sequence_invalidate_cache(scene, seq, FALSE);
+}
+
void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, int check_mem_usage, int keep_file_handles)
{
Sequence *seq;
@@ -3531,8 +3627,8 @@ int BKE_sequence_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
SWAP(float, seq_a->blend_opacity, seq_b->blend_opacity);
- SWAP(void *, seq_a->prev, seq_b->prev);
- SWAP(void *, seq_a->next, seq_b->next);
+ SWAP(Sequence *, seq_a->prev, seq_b->prev);
+ SWAP(Sequence *, seq_a->next, seq_b->next);
SWAP(int, seq_a->start, seq_b->start);
SWAP(int, seq_a->startofs, seq_b->startofs);
SWAP(int, seq_a->endofs, seq_b->endofs);
@@ -3626,7 +3722,7 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
}
}
-Sequence *BKE_sequwnce_get_by_name(ListBase *seqbase, const char *name, int recursive)
+Sequence *BKE_sequence_get_by_name(ListBase *seqbase, const char *name, int recursive)
{
Sequence *iseq = NULL;
Sequence *rseq = NULL;
@@ -3634,7 +3730,7 @@ Sequence *BKE_sequwnce_get_by_name(ListBase *seqbase, const char *name, int recu
for (iseq = seqbase->first; iseq; iseq = iseq->next) {
if (strcmp(name, iseq->name + 2) == 0)
return iseq;
- else if (recursive && (iseq->seqbase.first) && (rseq = BKE_sequwnce_get_by_name(&iseq->seqbase, name, 1))) {
+ else if (recursive && (iseq->seqbase.first) && (rseq = BKE_sequence_get_by_name(&iseq->seqbase, name, 1))) {
return rseq;
}
}
@@ -3941,6 +4037,12 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
seqn->strip->color_balance = MEM_dupallocN(seq->strip->color_balance);
}
+ if (seqn->modifiers.first) {
+ seqn->modifiers.first = seqn->modifiers.last = NULL;
+
+ BKE_sequence_modifier_list_copy(seqn, seq);
+ }
+
if (seq->type == SEQ_TYPE_META) {
seqn->strip->stripdata = NULL;
@@ -4060,3 +4162,4 @@ int BKE_seqence_is_valid_check(Sequence *seq)
return TRUE;
}
+
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 14360297ec0..2462de07a18 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -774,37 +774,37 @@ void sound_force_device(int UNUSED(device)) {}
void sound_init_once(void) {}
void sound_init(struct Main *UNUSED(bmain)) {}
void sound_exit(void) {}
-void sound_cache(struct bSound* UNUSED(sound)) { }
-void sound_delete_cache(struct bSound* UNUSED(sound)) {}
-void sound_load(struct Main *UNUSED(bmain), struct bSound* UNUSED(sound)) {}
+void sound_cache(struct bSound *UNUSED(sound)) { }
+void sound_delete_cache(struct bSound *UNUSED(sound)) {}
+void sound_load(struct Main *UNUSED(bmain), struct bSound *UNUSED(sound)) {}
void sound_create_scene(struct Scene *UNUSED(scene)) {}
void sound_destroy_scene(struct Scene *UNUSED(scene)) {}
void sound_mute_scene(struct Scene *UNUSED(scene), int UNUSED(muted)) {}
-void* sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
-void* sound_scene_add_scene_sound_defaults(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence)) { return NULL; }
-void* sound_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
-void* sound_add_scene_sound_defaults(struct Scene *UNUSED(scene), struct Sequence* UNUSED(sequence)) { return NULL; }
-void sound_remove_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle)) {}
-void sound_mute_scene_sound(void* UNUSED(handle), char UNUSED(mute)) {}
-void sound_move_scene_sound(struct Scene *UNUSED(scene), void* UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) {}
+void *sound_scene_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence *UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
+void *sound_scene_add_scene_sound_defaults(struct Scene *UNUSED(scene), struct Sequence *UNUSED(sequence)) { return NULL; }
+void *sound_add_scene_sound(struct Scene *UNUSED(scene), struct Sequence *UNUSED(sequence), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) { return NULL; }
+void *sound_add_scene_sound_defaults(struct Scene *UNUSED(scene), struct Sequence *UNUSED(sequence)) { return NULL; }
+void sound_remove_scene_sound(struct Scene *UNUSED(scene), void *UNUSED(handle)) {}
+void sound_mute_scene_sound(void *UNUSED(handle), char UNUSED(mute)) {}
+void sound_move_scene_sound(struct Scene *UNUSED(scene), void *UNUSED(handle), int UNUSED(startframe), int UNUSED(endframe), int UNUSED(frameskip)) {}
void sound_move_scene_sound_defaults(struct Scene *UNUSED(scene), struct Sequence *UNUSED(sequence)) {}
void sound_play_scene(struct Scene *UNUSED(scene)) {}
void sound_stop_scene(struct Scene *UNUSED(scene)) {}
void sound_seek_scene(struct Main *UNUSED(bmain), struct Scene *UNUSED(scene)) {}
float sound_sync_scene(struct Scene *UNUSED(scene)) { return NAN_FLT; }
int sound_scene_playing(struct Scene *UNUSED(scene)) { return -1; }
-int sound_read_sound_buffer(struct bSound* UNUSED(sound), float* UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
-void sound_read_waveform(struct bSound* sound) { (void)sound; }
+int sound_read_sound_buffer(struct bSound *UNUSED(sound), float *UNUSED(buffer), int UNUSED(length), float UNUSED(start), float UNUSED(end)) { return 0; }
+void sound_read_waveform(struct bSound *sound) { (void)sound; }
void sound_init_main(struct Main *bmain) { (void)bmain; }
void sound_set_cfra(int cfra) { (void)cfra; }
-void sound_update_sequencer(struct Main* main, struct bSound* sound) { (void)main; (void)sound; }
-void sound_update_scene(struct Scene* scene) { (void)scene; }
-void sound_update_scene_sound(void* handle, struct bSound* sound) { (void)handle; (void)sound; }
+void sound_update_sequencer(struct Main *main, struct bSound *sound) { (void)main; (void)sound; }
+void sound_update_scene(struct Scene *scene) { (void)scene; }
+void sound_update_scene_sound(void *handle, struct bSound *sound) { (void)handle; (void)sound; }
void sound_update_scene_listener(struct Scene *scene) { (void)scene; }
void sound_update_fps(struct Scene *scene) { (void)scene; }
-void sound_set_scene_sound_volume(void* handle, float volume, char animated) { (void)handle; (void)volume; (void)animated; }
-void sound_set_scene_sound_pan(void* handle, float pan, char animated) { (void)handle; (void)pan; (void)animated; }
+void sound_set_scene_sound_volume(void *handle, float volume, char animated) { (void)handle; (void)volume; (void)animated; }
+void sound_set_scene_sound_pan(void *handle, float pan, char animated) { (void)handle; (void)pan; (void)animated; }
void sound_set_scene_volume(struct Scene *scene, float volume) { (void)scene; (void)volume; }
-void sound_set_scene_sound_pitch(void* handle, float pitch, char animated) { (void)handle; (void)pitch; (void)animated; }
-float sound_get_length(struct bSound* sound) { (void)sound; return 0; }
+void sound_set_scene_sound_pitch(void *handle, float pitch, char animated) { (void)handle; (void)pitch; (void)animated; }
+float sound_get_length(struct bSound *sound) { (void)sound; return 0; }
#endif // WITH_AUDASPACE
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 5c387e8cee0..555ed5890c8 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -113,7 +113,8 @@ typedef enum {
CCG_USE_ARENA = 2,
CCG_CALC_NORMALS = 4,
/* add an extra four bytes for a mask layer */
- CCG_ALLOC_MASK = 8
+ CCG_ALLOC_MASK = 8,
+ CCG_SIMPLE_SUBDIV = 16
} CCGFlags;
static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
@@ -133,7 +134,10 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
ccgSubSurf_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL);
- if (oldUseAging != useAging) {
+ if ((oldUseAging != useAging) ||
+ (ccgSubSurf_getSimpleSubdiv(prevSS) !=
+ !!(flags & CCG_SIMPLE_SUBDIV)))
+ {
ccgSubSurf_free(prevSS);
}
else {
@@ -156,6 +160,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels,
ifc.vertDataSize += sizeof(float) * 3;
if (flags & CCG_ALLOC_MASK)
ifc.vertDataSize += sizeof(float);
+ ifc.simpleSubdiv = !!(flags & CCG_SIMPLE_SUBDIV);
if (useArena) {
CCGAllocatorIFC allocatorIFC;
@@ -1463,9 +1468,9 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
}
static void ccgDM_foreachMappedVert(
- DerivedMesh *dm,
- void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]),
- void *userData)
+ DerivedMesh *dm,
+ void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]),
+ void *userData)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
CCGVertIterator *vi;
@@ -1485,9 +1490,9 @@ static void ccgDM_foreachMappedVert(
}
static void ccgDM_foreachMappedEdge(
- DerivedMesh *dm,
- void (*func)(void *userData, int index, const float v0co[3], const float v1co[3]),
- void *userData)
+ DerivedMesh *dm,
+ void (*func)(void *userData, int index, const float v0co[3], const float v1co[3]),
+ void *userData)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
CCGSubSurf *ss = ccgdm->ss;
@@ -2487,9 +2492,9 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm,
}
static void ccgDM_foreachMappedFaceCenter(
- DerivedMesh *dm,
- void (*func)(void *userData, int index, const float co[3], const float no[3]),
- void *userData)
+ DerivedMesh *dm,
+ void (*func)(void *userData, int index, const float co[3], const float no[3]),
+ void *userData)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
CCGSubSurf *ss = ccgdm->ss;
@@ -3474,7 +3479,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
float (*vertCos)[3],
SubsurfFlags flags)
{
- int useSimple = smd->subdivType == ME_SIMPLE_SUBSURF;
+ int useSimple = (smd->subdivType == ME_SIMPLE_SUBSURF) ? CCG_SIMPLE_SUBDIV : 0;
CCGFlags useAging = smd->flags & eSubsurfModifierFlag_DebugIncr ? CCG_USE_AGING : 0;
int useSubsurfUv = smd->flags & eSubsurfModifierFlag_SubsurfUv;
int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
@@ -3483,7 +3488,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if (flags & SUBSURF_FOR_EDIT_MODE) {
int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels) : smd->levels;
- smd->emCache = _getSubSurf(smd->emCache, levels, 3, useAging | CCG_CALC_NORMALS);
+ smd->emCache = _getSubSurf(smd->emCache, levels, 3, useSimple | useAging | CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(smd->emCache, dm, vertCos, useSimple);
result = getCCGDerivedMesh(smd->emCache,
@@ -3498,7 +3503,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
if (levels == 0)
return dm;
- ss = _getSubSurf(NULL, levels, 3, CCG_USE_ARENA | CCG_CALC_NORMALS);
+ ss = _getSubSurf(NULL, levels, 3, useSimple | CCG_USE_ARENA | CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
@@ -3529,7 +3534,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
}
if (useIncremental && (flags & SUBSURF_IS_FINAL_CALC)) {
- smd->mCache = ss = _getSubSurf(smd->mCache, levels, 3, useAging | CCG_CALC_NORMALS);
+ smd->mCache = ss = _getSubSurf(smd->mCache, levels, 3, useSimple | useAging | CCG_CALC_NORMALS);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
@@ -3538,7 +3543,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
useSubsurfUv, dm);
}
else {
- CCGFlags ccg_flags = CCG_USE_ARENA | CCG_CALC_NORMALS;
+ CCGFlags ccg_flags = useSimple | CCG_USE_ARENA | CCG_CALC_NORMALS;
if (smd->mCache && (flags & SUBSURF_IS_FINAL_CALC)) {
ccgSubSurf_free(smd->mCache);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 5bad69c2e8d..2f54fe6cebd 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -1292,7 +1292,7 @@ PointDensity *BKE_add_pointdensity(void)
pd->falloff_curve->preset = CURVE_PRESET_LINE;
pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
curvemap_reset(pd->falloff_curve->cm, &pd->falloff_curve->clipr, pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
- curvemapping_changed(pd->falloff_curve, 0);
+ curvemapping_changed(pd->falloff_curve, FALSE);
return pd;
}
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index 303098ea0bd..dd71e43182e 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -128,8 +128,9 @@ World *BKE_world_copy(World *wrld)
}
}
- if (wrld->nodetree)
+ if (wrld->nodetree) {
wrldn->nodetree = ntreeCopyTree(wrld->nodetree);
+ }
if (wrld->preview)
wrldn->preview = BKE_previewimg_copy(wrld->preview);
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index f22fd74baf4..3526058e12b 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -69,8 +69,6 @@
#include "ffmpeg_compat.h"
-extern void do_init_ffmpeg(void);
-
static int ffmpeg_type = 0;
static int ffmpeg_codec = CODEC_ID_MPEG4;
static int ffmpeg_audio_codec = CODEC_ID_NONE;
@@ -101,6 +99,8 @@ static AUD_Device *audio_mixdown_device = 0;
#define FFMPEG_AUTOSPLIT_SIZE 2000000000
+#define PRINT if (G.debug & G_DEBUG_FFMPEG) printf
+
/* Delete a picture buffer */
static void delete_picture(AVFrame *f)
@@ -125,9 +125,7 @@ static int write_audio_frame(void)
AUD_readDevice(audio_mixdown_device, audio_input_buffer, audio_input_samples);
audio_time += (double) audio_input_samples / (double) c->sample_rate;
- pkt.size = avcodec_encode_audio(c, audio_output_buffer,
- audio_outbuf_size,
- (short *)audio_input_buffer);
+ pkt.size = avcodec_encode_audio(c, audio_output_buffer, audio_outbuf_size, (short *) audio_input_buffer);
if (pkt.size < 0) {
// XXX error("Error writing audio packet");
@@ -137,9 +135,8 @@ static int write_audio_frame(void)
pkt.data = audio_output_buffer;
if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE) {
- pkt.pts = av_rescale_q(c->coded_frame->pts,
- c->time_base, audio_stream->time_base);
- fprintf(stderr, "Audio Frame PTS: %d\n", (int)pkt.pts);
+ pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, audio_stream->time_base);
+ PRINT("Audio Frame PTS: %d\n", (int) pkt.pts);
}
pkt.stream_index = audio_stream->index;
@@ -189,8 +186,7 @@ static const char **get_file_extensions(int format)
return rv;
}
case FFMPEG_MPEG2: {
- static const char *rv[] = { ".dvd", ".vob", ".mpg", ".mpeg",
- NULL };
+ static const char *rv[] = { ".dvd", ".vob", ".mpg", ".mpeg", NULL };
return rv;
}
case FFMPEG_MPEG4: {
@@ -254,21 +250,18 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame *frame, ReportLis
frame->top_field_first = ((rd->mode & R_ODDFIELD) != 0);
}
- outsize = avcodec_encode_video(c, video_buffer, video_buffersize,
- frame);
+ outsize = avcodec_encode_video(c, video_buffer, video_buffersize, frame);
if (outsize > 0) {
AVPacket packet;
av_init_packet(&packet);
if (c->coded_frame->pts != AV_NOPTS_VALUE) {
- packet.pts = av_rescale_q(c->coded_frame->pts,
- c->time_base,
- video_stream->time_base);
- fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
+ packet.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_stream->time_base);
+ PRINT("Video Frame PTS: %d\n", (int)packet.pts);
}
else {
- fprintf(stderr, "Video Frame PTS: not set\n");
+ PRINT("Video Frame PTS: not set\n");
}
if (c->coded_frame->key_frame)
packet.flags |= AV_PKT_FLAG_KEY;
@@ -364,7 +357,7 @@ static void set_ffmpeg_property_option(AVCodecContext *c, IDProperty *prop)
char *param;
const AVOption *rv = NULL;
- fprintf(stderr, "FFMPEG expert option: %s: ", prop->name);
+ PRINT("FFMPEG expert option: %s: ", prop->name);
BLI_strncpy(name, prop->name, sizeof(name));
@@ -376,15 +369,15 @@ static void set_ffmpeg_property_option(AVCodecContext *c, IDProperty *prop)
switch (prop->type) {
case IDP_STRING:
- fprintf(stderr, "%s.\n", IDP_String(prop));
+ PRINT("%s.\n", IDP_String(prop));
av_set_string3(c, prop->name, IDP_String(prop), 1, &rv);
break;
case IDP_FLOAT:
- fprintf(stderr, "%g.\n", IDP_Float(prop));
+ PRINT("%g.\n", IDP_Float(prop));
rv = av_set_double(c, prop->name, IDP_Float(prop));
break;
case IDP_INT:
- fprintf(stderr, "%d.\n", IDP_Int(prop));
+ PRINT("%d.\n", IDP_Int(prop));
if (param) {
if (IDP_Int(prop)) {
@@ -401,8 +394,7 @@ static void set_ffmpeg_property_option(AVCodecContext *c, IDProperty *prop)
}
if (!rv) {
- fprintf(stderr, "ffmpeg-option not supported: %s! Skipping.\n",
- prop->name);
+ PRINT("ffmpeg-option not supported: %s! Skipping.\n", prop->name);
}
}
@@ -446,11 +438,14 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
/* prepare a video stream for the output file */
static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContext *of,
- int rectx, int recty)
+ int rectx, int recty, char *error, int error_size)
{
AVStream *st;
AVCodecContext *c;
AVCodec *codec;
+
+ error[0] = '\0';
+
st = av_new_stream(of, 0);
if (!st) return NULL;
@@ -460,7 +455,6 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_VIDEO;
-
/* Get some values from the current render settings */
c->width = rectx;
@@ -492,7 +486,8 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
c->me_method = ME_EPZS;
codec = avcodec_find_encoder(c->codec_id);
- if (!codec) return NULL;
+ if (!codec)
+ return NULL;
/* Be sure to use the correct pixel format(e.g. RGB, YUV) */
@@ -547,27 +542,25 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
// || !strcmp(of->oformat->name, "3gp")
)
{
- fprintf(stderr, "Using global header\n");
+ PRINT("Using global header\n");
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
/* Determine whether we are encoding interlaced material or not */
if (rd->mode & R_FIELDS) {
- fprintf(stderr, "Encoding interlaced video\n");
+ PRINT("Encoding interlaced video\n");
c->flags |= CODEC_FLAG_INTERLACED_DCT;
c->flags |= CODEC_FLAG_INTERLACED_ME;
}
/* xasp & yasp got float lately... */
- st->sample_aspect_ratio = c->sample_aspect_ratio = av_d2q(
- ((double) rd->xasp / (double) rd->yasp), 255);
+ st->sample_aspect_ratio = c->sample_aspect_ratio = av_d2q(((double) rd->xasp / (double) rd->yasp), 255);
set_ffmpeg_properties(rd, c, "video");
if (avcodec_open(c, codec) < 0) {
- //
- //XXX error("Couldn't initialize codec");
+ BLI_strncpy(error, IMB_ffmpeg_last_error(), error_size);
return NULL;
}
@@ -584,16 +577,11 @@ static AVStream *alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
else
video_buffersize = avpicture_get_size(c->pix_fmt, c->width, c->height);
- video_buffer = (uint8_t *)MEM_mallocN(video_buffersize * sizeof(uint8_t),
- "FFMPEG video buffer");
+ video_buffer = (uint8_t *)MEM_mallocN(video_buffersize * sizeof(uint8_t), "FFMPEG video buffer");
current_frame = alloc_picture(c->pix_fmt, c->width, c->height);
- img_convert_ctx = sws_getContext(c->width, c->height,
- PIX_FMT_BGR32,
- c->width, c->height,
- c->pix_fmt,
- SWS_BICUBIC,
+ img_convert_ctx = sws_getContext(c->width, c->height, PIX_FMT_BGR32, c->width, c->height, c->pix_fmt, SWS_BICUBIC,
NULL, NULL, NULL);
return st;
}
@@ -645,11 +633,9 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
audio_outbuf_size = c->frame_size * c->channels * sizeof(int16_t) * 4;
}
- audio_output_buffer = (uint8_t *)av_malloc(
- audio_outbuf_size);
+ audio_output_buffer = (uint8_t *) av_malloc(audio_outbuf_size);
- audio_input_buffer = (uint8_t *)av_malloc(
- audio_input_samples * c->channels * sizeof(int16_t));
+ audio_input_buffer = (uint8_t *) av_malloc(audio_input_samples * c->channels * sizeof(int16_t));
audio_time = 0.0f;
@@ -672,7 +658,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
AVFormatContext *of;
AVOutputFormat *fmt;
AVDictionary *opts = NULL;
- char name[256];
+ char name[256], error[1024];
const char **exts;
ffmpeg_type = rd->ffcodecdata.type;
@@ -681,14 +667,11 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
ffmpeg_video_bitrate = rd->ffcodecdata.video_bitrate;
ffmpeg_audio_bitrate = rd->ffcodecdata.audio_bitrate;
ffmpeg_gop_size = rd->ffcodecdata.gop_size;
- ffmpeg_autosplit = rd->ffcodecdata.flags
- & FFMPEG_AUTOSPLIT_OUTPUT;
+ ffmpeg_autosplit = rd->ffcodecdata.flags & FFMPEG_AUTOSPLIT_OUTPUT;
- do_init_ffmpeg();
-
/* Determine the correct filename */
BKE_ffmpeg_filepath_get(name, rd);
- fprintf(stderr, "Starting output to %s(ffmpeg)...\n"
+ PRINT("Starting output to %s(ffmpeg)...\n"
" Using type=%d, codec=%d, audio_codec=%d,\n"
" video_bitrate=%d, audio_bitrate=%d,\n"
" gop_size=%d, autosplit=%d\n"
@@ -793,10 +776,14 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
}
if (fmt->video_codec != CODEC_ID_NONE) {
- video_stream = alloc_video_stream(rd, fmt->video_codec, of, rectx, recty);
- printf("alloc video stream %p\n", video_stream);
+ video_stream = alloc_video_stream(rd, fmt->video_codec, of, rectx, recty, error, sizeof(error));
+ PRINT("alloc video stream %p\n", video_stream);
if (!video_stream) {
- BKE_report(reports, RPT_ERROR, "Error initializing video stream.");
+ if (error[0])
+ BKE_report(reports, RPT_ERROR, error);
+ else
+ BKE_report(reports, RPT_ERROR, "Error initializing video stream.");
+
av_dict_free(&opts);
return 0;
}
@@ -867,13 +854,11 @@ void flush_ffmpeg(void)
break;
}
if (c->coded_frame->pts != AV_NOPTS_VALUE) {
- packet.pts = av_rescale_q(c->coded_frame->pts,
- c->time_base,
- video_stream->time_base);
- fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
+ packet.pts = av_rescale_q(c->coded_frame->pts, c->time_base, video_stream->time_base);
+ PRINT("Video Frame PTS: %d\n", (int) packet.pts);
}
else {
- fprintf(stderr, "Video Frame PTS: not set\n");
+ PRINT("Video Frame PTS: not set\n");
}
if (c->coded_frame->key_frame) {
packet.flags |= AV_PKT_FLAG_KEY;
@@ -916,8 +901,7 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd)
}
while (*fe) {
- if (BLI_strcasecmp(string + strlen(string) - strlen(*fe),
- *fe) == 0)
+ if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), *fe) == 0)
{
break;
}
@@ -983,9 +967,7 @@ int BKE_ffmpeg_append(RenderData *rd, int start_frame, int frame, int *pixels, i
AVFrame *avframe;
int success = 1;
- fprintf(stderr, "Writing frame %i, "
- "render width=%d, render height=%d\n", frame,
- rectx, recty);
+ PRINT("Writing frame %i, render width=%d, render height=%d\n", frame, rectx, recty);
// why is this done before writing the video frame and again at end_ffmpeg?
// write_audio_frames(frame / (((double)rd->frs_sec) / rd->frs_sec_base));
@@ -1013,7 +995,7 @@ void BKE_ffmpeg_end(void)
{
unsigned int i;
- fprintf(stderr, "Closing ffmpeg...\n");
+ PRINT("Closing ffmpeg...\n");
#if 0
if (audio_stream) { /* SEE UPPER */
@@ -1029,7 +1011,7 @@ void BKE_ffmpeg_end(void)
#endif
if (video_stream && video_stream->codec) {
- fprintf(stderr, "Flushing delayed frames...\n");
+ PRINT("Flushing delayed frames...\n");
flush_ffmpeg();
}
@@ -1041,7 +1023,7 @@ void BKE_ffmpeg_end(void)
if (video_stream && video_stream->codec) {
avcodec_close(video_stream->codec);
- printf("zero video stream %p\n", video_stream);
+ PRINT("zero video stream %p\n", video_stream);
video_stream = 0;
}
@@ -1142,8 +1124,7 @@ IDProperty *BKE_ffmpeg_property_add(RenderData *rd, const char *type, int opt_in
BLI_strncpy(name, o->name, sizeof(name));
}
- fprintf(stderr, "ffmpeg_property_add: %s %d %d %s\n",
- type, parent_index, opt_index, name);
+ PRINT("ffmpeg_property_add: %s %d %d %s\n", type, parent_index, opt_index, name);
prop = IDP_GetPropertyFromGroup(group, name);
if (prop) {
@@ -1181,8 +1162,7 @@ IDProperty *BKE_ffmpeg_property_add(RenderData *rd, const char *type, int opt_in
/* not all versions of ffmpeg include that, so here we go ... */
-static const AVOption *my_av_find_opt(void *v, const char *name,
- const char *unit, int mask, int flags)
+static const AVOption *my_av_find_opt(void *v, const char *name, const char *unit, int mask, int flags)
{
AVClass *c = *(AVClass **)v;
const AVOption *o = c->option;
@@ -1235,14 +1215,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);
if (p) {
- prop = BKE_ffmpeg_property_add(rd,
- (char *) type, p - c.av_class->option,
- o - c.av_class->option);
+ 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,
- (char *) type, o - c.av_class->option, 0);
+ prop = BKE_ffmpeg_property_add(rd, (char *) type, o - c.av_class->option, 0);
}
@@ -1316,12 +1293,10 @@ static void ffmpeg_set_expert_options(RenderData *rd)
if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
BKE_ffmpeg_property_add_string(rd, "video", "cqp:0");
}
-#if 0 /* disabled for after release */
else if (codec_id == CODEC_ID_DNXHD) {
if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
- ffmpeg_property_add_string(rd, "video", "mbd:rd");
+ BKE_ffmpeg_property_add_string(rd, "video", "mbd:rd");
}
-#endif
}
void BKE_ffmpeg_preset_set(RenderData *rd, int preset)
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index abe7eacb1ac..1330a74bea3 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -48,11 +48,13 @@ int BLI_findstringindex(const struct ListBase *listbase, const char *id, const i
void *BLI_findlink(const struct ListBase *listbase, int number);
void *BLI_findstring(const struct ListBase *listbase, const char *id, const int offset);
void *BLI_findstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
+void *BLI_findptr(const struct ListBase *listbase, const void *ptr, const int offset);
/* find backwards */
void *BLI_rfindlink(const struct ListBase *listbase, int number);
void *BLI_rfindstring(const struct ListBase *listbase, const char *id, const int offset);
void *BLI_rfindstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
+void *BLI_rfindptr(const struct ListBase *listbase, const void *ptr, const int offset);
void BLI_freelistN(struct ListBase *listbase);
void BLI_addtail(struct ListBase *listbase, void *vlink);
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index b0e0d3cbf19..4a89776a52e 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -137,8 +137,30 @@
# endif
#endif
+/* Causes warning:
+ * incompatible types when assigning to type 'Foo' from type 'Bar'
+ * ... the compiler optimizes away the temp var */
+#ifndef CHECK_TYPE
+#ifdef __GNUC__
+#define CHECK_TYPE(var, type) { \
+ __typeof(var) *__tmp; \
+ __tmp = (type *)NULL; \
+ (void)__tmp; \
+} (void)0
+#else
+#define CHECK_TYPE(var, type)
+#endif
+#endif
+
#ifndef SWAP
-# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0
+# define SWAP(type, a, b) { \
+ type sw_ap; \
+ CHECK_TYPE(a, type); \
+ CHECK_TYPE(b, type); \
+ sw_ap = (a); \
+ (a) = (b); \
+ (b) = sw_ap; \
+} (void)0
#endif
#ifndef CLAMP
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index a40d4ca8463..8a439c7cf7a 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -60,6 +60,7 @@ void sub_qt_qtqt(float q[4], const float a[4], const float b[4]);
void invert_qt(float q[4]);
void invert_qt_qt(float q1[4], const float q2[4]);
void conjugate_qt(float q[4]);
+void conjugate_qt_qt(float q1[4], const float q2[4]);
float dot_qtqt(const float a[4], const float b[4]);
float normalize_qt(float q[4]);
float normalize_qt_qt(float q1[4], const float q2[4]);
@@ -151,10 +152,10 @@ void mat3_to_eulO(float eul[3], const short order, float mat[3][3]);
void mat4_to_eulO(float eul[3], const short order, float mat[4][4]);
void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle);
-void mat3_to_compatible_eulO(float eul[3], float old[3], short order, float mat[3][3]);
-void mat4_to_compatible_eulO(float eul[3], float old[3], short order, float mat[4][4]);
+void mat3_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[3][3]);
+void mat4_to_compatible_eulO(float eul[3], float old[3], const short order, float mat[4][4]);
-void rotate_eulO(float eul[3], short order, char axis, float angle);
+void rotate_eulO(float eul[3], const short order, char axis, float angle);
/******************************* Dual Quaternions ****************************/
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h
index 6c0d547fe6f..20d04f7881e 100644
--- a/source/blender/blenlib/BLI_pbvh.h
+++ b/source/blender/blenlib/BLI_pbvh.h
@@ -260,8 +260,8 @@ void BLI_pbvh_node_free_proxies(PBVHNode *node);
PBVHProxyNode *BLI_pbvh_node_add_proxy(PBVH *bvh, PBVHNode *node);
void BLI_pbvh_gather_proxies(PBVH *pbvh, PBVHNode ***nodes, int *totnode);
-//void BLI_pbvh_node_BB_reset(PBVHNode* node);
-//void BLI_pbvh_node_BB_expand(PBVHNode* node, float co[3]);
+//void BLI_pbvh_node_BB_reset(PBVHNode *node);
+//void BLI_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
#endif /* __BLI_PBVH_H__ */
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 55ab961cc53..eb9915d6c9b 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -57,25 +57,35 @@ void BLI_rctf_interp(struct rctf *rect, const struct rctf *rect_a, const struct
//void BLI_rcti_interp(struct rctf *rect, struct rctf *rect_a, struct rctf *rect_b, float fac);
int BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit);
int BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b);
-int BLI_in_rcti(const struct rcti *rect, const int x, const int y);
-int BLI_in_rcti_v(const struct rcti *rect, const int xy[2]);
-int BLI_in_rctf(const struct rctf *rect, const float x, const float y);
-int BLI_in_rctf_v(const struct rctf *rect, const float xy[2]);
+int BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest);
+int BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest);
+int BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y);
+int BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2]);
+int BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y);
+int BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2]);
int BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]);
#if 0 /* NOT NEEDED YET */
int BLI_rctf_isect_segment(struct rcti *rect, int s1[2], int s2[2]);
#endif
-int BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest);
-int BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest);
void BLI_rctf_union(struct rctf *rctf1, const struct rctf *rctf2);
void BLI_rcti_union(struct rcti *rcti1, const struct rcti *rcti2);
-void BLI_rcti_rctf_copy(struct rcti *tar, const struct rctf *src);
+void BLI_rcti_rctf_copy(struct rcti *dst, const struct rctf *src);
+void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src);
void print_rctf(const char *str, const struct rctf *rect);
void print_rcti(const char *str, const struct rcti *rect);
+#define BLI_RCT_SIZE_X(rct) ((rct)->xmax - (rct)->xmin)
+#define BLI_RCT_SIZE_Y(rct) ((rct)->ymax - (rct)->ymin)
+
+#define BLI_RCT_CENTER_X(rct) (((rct)->xmin + (rct)->xmax) / 2)
+#define BLI_RCT_CENTER_Y(rct) (((rct)->ymin + (rct)->ymax) / 2)
+
+#define BLI_RCT_CENTER_X_FL(rct) ((float)((rct)->xmin + (rct)->xmax) / 2.0f)
+#define BLI_RCT_CENTER_Y_FL(rct) ((float)((rct)->ymin + (rct)->ymax) / 2.0f)
+
#ifdef __cplusplus
}
#endif
-#endif
+#endif /* __BLI_RECT_H__ */
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index a74629e589c..b3d0df04eb1 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -32,6 +32,8 @@
* \ingroup bli
*/
+#include <stdarg.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -140,6 +142,11 @@ __attribute__((nonnull))
;
/*
+ * Replacement for vsnprintf
+ */
+size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg);
+
+/*
* Print formatted string into a newly mallocN'd string
* and return it.
*/
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 78d54defafd..8a459b9b07c 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -113,8 +113,30 @@
/* some math and copy defines */
+/* Causes warning:
+ * incompatible types when assigning to type 'Foo' from type 'Bar'
+ * ... the compiler optimizes away the temp var */
+#ifndef CHECK_TYPE
+#ifdef __GNUC__
+#define CHECK_TYPE(var, type) { \
+ __typeof(var) *__tmp; \
+ __tmp = (type *)NULL; \
+ (void)__tmp; \
+} (void)0
+#else
+#define CHECK_TYPE(var, type)
+#endif
+#endif
+
#ifndef SWAP
-# define SWAP(type, a, b) { type sw_ap; sw_ap = (a); (a) = (b); (b) = sw_ap; } (void)0
+# define SWAP(type, a, b) { \
+ type sw_ap; \
+ CHECK_TYPE(a, type); \
+ CHECK_TYPE(b, type); \
+ sw_ap = (a); \
+ (a) = (b); \
+ (b) = sw_ap; \
+} (void)0
#endif
#define ABS(a) ( (a) < 0 ? (-(a)) : (a) )
diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h
index a63ec8e9f61..ed7d10ab257 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenlib/BLI_vfontdata.h
@@ -39,14 +39,8 @@
struct PackedFile;
struct VFont;
-#define MAX_VF_CHARS 256
-
typedef struct VFontData {
ListBase characters;
- // ListBase nurbsbase[MAX_VF_CHARS];
- // float resol[MAX_VF_CHARS];
- // float width[MAX_VF_CHARS];
- // float *points[MAX_VF_CHARS];
char name[128];
} VFontData;
@@ -59,12 +53,6 @@ typedef struct VChar {
float *points;
} VChar;
-struct TmpFont {
- struct TmpFont *next, *prev;
- struct PackedFile *pf;
- struct VFont *vfont;
-};
-
/**
* Construct a new VFontData structure from
* Freetype font data in a PackedFile.
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 60999e76c47..597a645eb9c 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -293,19 +293,12 @@ static int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode)
{
/* Freetype2 */
FT_Face face;
- struct TmpFont *tf;
-
- /* Find the correct FreeType font */
- tf = BKE_vfont_tmpfont_find(vfont);
-
- /* What, no font found. Something strange here */
- if (!tf) return FALSE;
/* Load the font to memory */
- if (tf->pf) {
+ if (vfont->temp_pf) {
err = FT_New_Memory_Face(library,
- tf->pf->data,
- tf->pf->size,
+ vfont->temp_pf->data,
+ vfont->temp_pf->size,
0,
&face);
if (err) return FALSE;
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 8fe9a94b466..ad718ed8e11 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -439,6 +439,44 @@ void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int of
return NULL;
}
+void *BLI_findptr(const ListBase *listbase, const void *ptr, const int offset)
+{
+ Link *link = NULL;
+ const void *ptr_iter;
+
+ if (listbase == NULL) return NULL;
+
+ for (link = listbase->first; link; link = link->next) {
+ /* exact copy of BLI_findstring(), except for this line */
+ ptr_iter = *((const char **)(((const char *)link) + offset));
+
+ if (ptr == ptr_iter) {
+ return link;
+ }
+ }
+
+ return NULL;
+}
+/* same as above but find reverse */
+void *BLI_rfindptr(const ListBase *listbase, const void *ptr, const int offset)
+{
+ Link *link = NULL;
+ const void *ptr_iter;
+
+ if (listbase == NULL) return NULL;
+
+ for (link = listbase->last; link; link = link->prev) {
+ /* exact copy of BLI_rfindstring(), except for this line */
+ ptr_iter = *((const char **)(((const char *)link) + offset));
+
+ if (ptr == ptr_iter) {
+ return link;
+ }
+ }
+
+ return NULL;
+}
+
int BLI_findstringindex(const ListBase *listbase, const char *id, const int offset)
{
Link *link = NULL;
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 1698733dda7..f0ed23aabc9 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -34,7 +34,7 @@
/******************************** Quaternions ********************************/
-/* used to test is a quat is not normalized */
+/* used to test is a quat is not normalized (only used for debug prints) */
#define QUAT_EPSILON 0.0001
/* convenience, avoids setting Y axis everywhere */
@@ -113,6 +113,14 @@ void mul_qt_v3(const float q[4], float v[3])
v[1] = t2;
}
+void conjugate_qt_qt(float q1[4], const float q2[4])
+{
+ q1[0] = q2[0];
+ q1[1] = -q2[1];
+ q1[2] = -q2[2];
+ q1[3] = -q2[3];
+}
+
void conjugate_qt(float q[4])
{
q[1] = -q[1];
@@ -370,7 +378,7 @@ float normalize_qt(float q[4])
{
float len;
- len = (float)sqrt(dot_qtqt(q, q));
+ len = sqrtf(dot_qtqt(q, q));
if (len != 0.0f) {
mul_qt_fl(q, 1.0f / len);
}
@@ -404,80 +412,75 @@ void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2
void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q2[4])
{
float tquat[4];
- double dot = 0.0f;
- int x;
- copy_qt_qt(tquat, q1);
- conjugate_qt(tquat);
- dot = 1.0f / dot_qtqt(tquat, tquat);
+ conjugate_qt_qt(tquat, q1);
- for (x = 0; x < 4; x++)
- tquat[x] *= dot;
+ mul_qt_fl(tquat, 1.0f / dot_qtqt(tquat, tquat));
mul_qt_qtqt(q, tquat, q2);
}
void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
{
- float q2[4], nor[3], *fp, mat[3][3], angle, si, co, x2, y2, z2, len1;
+ float nor[3], tvec[3];
+ float angle, si, co, len;
assert(axis >= 0 && axis <= 5);
assert(upflag >= 0 && upflag <= 2);
- /* first rotate to axis */
+ /* first set the quat to unit */
+ unit_qt(q);
+
+ len = len_v3(vec);
+
+ if (UNLIKELY(len == 0.0f)) {
+ return;
+ }
+
+ /* rotate to axis */
if (axis > 2) {
- x2 = vec[0];
- y2 = vec[1];
- z2 = vec[2];
+ copy_v3_v3(tvec, vec);
axis -= 3;
}
else {
- x2 = -vec[0];
- y2 = -vec[1];
- z2 = -vec[2];
+ negate_v3_v3(tvec, vec);
}
- q[0] = 1.0;
- q[1] = q[2] = q[3] = 0.0;
-
- len1 = (float)sqrt(x2 * x2 + y2 * y2 + z2 * z2);
- if (len1 == 0.0f) return;
-
/* nasty! I need a good routine for this...
* problem is a rotation of an Y axis to the negative Y-axis for example.
*/
if (axis == 0) { /* x-axis */
- nor[0] = 0.0;
- nor[1] = -z2;
- nor[2] = y2;
+ nor[0] = 0.0;
+ nor[1] = -tvec[2];
+ nor[2] = tvec[1];
- if (fabsf(y2) + fabsf(z2) < 0.0001f)
- nor[1] = 1.0;
+ if (fabsf(tvec[1]) + fabsf(tvec[2]) < 0.0001f)
+ nor[1] = 1.0f;
- co = x2;
+ co = tvec[0];
}
else if (axis == 1) { /* y-axis */
- nor[0] = z2;
- nor[1] = 0.0;
- nor[2] = -x2;
+ nor[0] = tvec[2];
+ nor[1] = 0.0;
+ nor[2] = -tvec[0];
- if (fabsf(x2) + fabsf(z2) < 0.0001f)
- nor[2] = 1.0;
+ if (fabsf(tvec[0]) + fabsf(tvec[2]) < 0.0001f)
+ nor[2] = 1.0f;
- co = y2;
+ co = tvec[1];
}
else { /* z-axis */
- nor[0] = -y2;
- nor[1] = x2;
- nor[2] = 0.0;
+ nor[0] = -tvec[1];
+ nor[1] = tvec[0];
+ nor[2] = 0.0;
- if (fabsf(x2) + fabsf(y2) < 0.0001f)
- nor[0] = 1.0;
+ if (fabsf(tvec[0]) + fabsf(tvec[1]) < 0.0001f)
+ nor[0] = 1.0f;
- co = z2;
+ co = tvec[2];
}
- co /= len1;
+ co /= len;
normalize_v3(nor);
@@ -489,28 +492,30 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
q[3] = nor[2] * si;
if (axis != upflag) {
+ float mat[3][3];
+ float q2[4];
+ const float *fp = mat[2];
quat_to_mat3(mat, q);
- fp = mat[2];
if (axis == 0) {
- if (upflag == 1) angle = (float)(0.5 * atan2(fp[2], fp[1]));
- else angle = (float)(-0.5 * atan2(fp[1], fp[2]));
+ if (upflag == 1) angle = 0.5f * atan2f(fp[2], fp[1]);
+ else angle = -0.5f * atan2f(fp[1], fp[2]);
}
else if (axis == 1) {
- if (upflag == 0) angle = (float)(-0.5 * atan2(fp[2], fp[0]));
- else angle = (float)(0.5 * atan2(fp[0], fp[2]));
+ if (upflag == 0) angle = -0.5f * atan2f(fp[2], fp[0]);
+ else angle = 0.5f * atan2f(fp[0], fp[2]);
}
else {
- if (upflag == 0) angle = (float)(0.5 * atan2(-fp[1], -fp[0]));
- else angle = (float)(-0.5 * atan2(-fp[0], -fp[1]));
+ if (upflag == 0) angle = 0.5f * atan2f(-fp[1], -fp[0]);
+ else angle = -0.5f * atan2f(-fp[0], -fp[1]);
}
co = cosf(angle);
- si = sinf(angle) / len1;
+ si = sinf(angle) / len;
q2[0] = co;
- q2[1] = x2 * si;
- q2[2] = y2 * si;
- q2[3] = z2 * si;
+ q2[1] = tvec[0] * si;
+ q2[2] = tvec[1] * si;
+ q2[3] = tvec[2] * si;
mul_qt_qtqt(q, q2, q);
}
@@ -1040,84 +1045,46 @@ void rotate_eul(float *beul, const char axis, const float ang)
}
-/* exported to transform.c */
-
/* order independent! */
void compatible_eul(float eul[3], const float oldrot[3])
{
- float dx, dy, dz;
+ /* we could use M_PI as pi_thresh: which is correct but 5.1 gives better results.
+ * Checked with baking actions to fcurves - campbell */
+ const float pi_thresh = (5.1f);
+ const float pi_x2 = (2.0f * (float)M_PI);
+
+ float deul[3];
+ unsigned int i;
/* correct differences of about 360 degrees first */
- dx = eul[0] - oldrot[0];
- dy = eul[1] - oldrot[1];
- dz = eul[2] - oldrot[2];
-
- while (fabsf(dx) > 5.1f) {
- if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
- else eul[0] += 2.0f * (float)M_PI;
- dx = eul[0] - oldrot[0];
- }
- while (fabsf(dy) > 5.1f) {
- if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
- else eul[1] += 2.0f * (float)M_PI;
- dy = eul[1] - oldrot[1];
- }
- while (fabsf(dz) > 5.1f) {
- if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
- else eul[2] += 2.0f * (float)M_PI;
- dz = eul[2] - oldrot[2];
+ for (i = 0; i < 3; i++) {
+ deul[i] = eul[i] - oldrot[i];
+ if (deul[i] > pi_thresh) {
+ eul[i] -= floorf(( deul[i] / pi_x2) + 0.5) * pi_x2;
+ deul[i] = eul[i] - oldrot[i];
+ }
+ else if (deul[i] < -pi_thresh) {
+ eul[i] += floorf((-deul[i] / pi_x2) + 0.5) * pi_x2;
+ deul[i] = eul[i] - oldrot[i];
+ }
}
/* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */
- if (fabsf(dx) > 3.2f && fabsf(dy) < 1.6f && fabsf(dz) < 1.6f) {
- if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
- else eul[0] += 2.0f * (float)M_PI;
+ if (fabsf(deul[0]) > 3.2f && fabsf(deul[1]) < 1.6f && fabsf(deul[2]) < 1.6f) {
+ if (deul[0] > 0.0f) eul[0] -= pi_x2;
+ else eul[0] += pi_x2;
}
- if (fabsf(dy) > 3.2f && fabsf(dz) < 1.6f && fabsf(dx) < 1.6f) {
- if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
- else eul[1] += 2.0f * (float)M_PI;
+ if (fabsf(deul[1]) > 3.2f && fabsf(deul[2]) < 1.6f && fabsf(deul[0]) < 1.6f) {
+ if (deul[1] > 0.0f) eul[1] -= pi_x2;
+ else eul[1] += pi_x2;
}
- if (fabsf(dz) > 3.2f && fabsf(dx) < 1.6f && fabsf(dy) < 1.6f) {
- if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
- else eul[2] += 2.0f * (float)M_PI;
+ if (fabsf(deul[2]) > 3.2f && fabsf(deul[0]) < 1.6f && fabsf(deul[1]) < 1.6f) {
+ if (deul[2] > 0.0f) eul[2] -= pi_x2;
+ else eul[2] += pi_x2;
}
- /* the method below was there from ancient days... but why! probably because the code sucks :)
- */
-#if 0
- /* calc again */
- dx = eul[0] - oldrot[0];
- dy = eul[1] - oldrot[1];
- dz = eul[2] - oldrot[2];
-
- /* special case, tested for x-z */
-
- if ((fabsf(dx) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dz) > 3.1f)) {
- if (dx > 0.0f) eul[0] -= M_PI;
- else eul[0] += M_PI;
- if (eul[1] > 0.0) eul[1] = M_PI - eul[1];
- else eul[1] = -M_PI - eul[1];
- if (dz > 0.0f) eul[2] -= M_PI;
- else eul[2] += M_PI;
-
- }
- else if ((fabsf(dx) > 3.1f && fabsf(dy) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dy) > 3.1f)) {
- if (dx > 0.0f) eul[0] -= M_PI;
- else eul[0] += M_PI;
- if (dy > 0.0f) eul[1] -= M_PI;
- else eul[1] += M_PI;
- if (eul[2] > 0.0f) eul[2] = M_PI - eul[2];
- else eul[2] = -M_PI - eul[2];
- }
- else if ((fabsf(dy) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dy) > 1.5f && fabsf(dz) > 3.f1)) {
- if (eul[0] > 0.0f) eul[0] = M_PI - eul[0];
- else eul[0] = -M_PI - eul[0];
- if (dy > 0.0f) eul[1] -= M_PI;
- else eul[1] += M_PI;
- if (dz > 0.0f) eul[2] -= M_PI;
- else eul[2] += M_PI;
- }
-#endif
+#undef PI_THRESH
+#undef PI_2F
}
/* uses 2 methods to retrieve eulers, and picks the closest */
@@ -1166,7 +1133,7 @@ typedef struct RotOrderInfo {
/* Array of info for Rotation Order calculations
* WARNING: must be kept in same order as eEulerRotationOrders
*/
-static RotOrderInfo rotOrders[] = {
+static const RotOrderInfo rotOrders[] = {
/* i, j, k, n */
{{0, 1, 2}, 0}, /* XYZ */
{{0, 2, 1}, 1}, /* XZY */
@@ -1185,7 +1152,7 @@ static RotOrderInfo rotOrders[] = {
/* Construct quaternion from Euler angles (in radians). */
void eulO_to_quat(float q[4], const float e[3], const short order)
{
- RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
+ const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];
double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
double a[3];
@@ -1230,7 +1197,7 @@ void quat_to_eulO(float e[3], short const order, const float q[4])
/* Construct 3x3 matrix from Euler angles (in radians). */
void eulO_to_mat3(float M[3][3], const float e[3], const short order)
{
- RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
+ const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];
double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
@@ -1269,9 +1236,9 @@ void eulO_to_mat3(float M[3][3], const float e[3], const short order)
}
/* returns two euler calculation methods, so we can pick the best */
-static void mat3_to_eulo2(float M[3][3], float *e1, float *e2, short order)
+static void mat3_to_eulo2(float M[3][3], float *e1, float *e2, const short order)
{
- RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
+ const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
short i = R->axis[0], j = R->axis[1], k = R->axis[2];
float m[3][3];
double cy;
@@ -1349,7 +1316,7 @@ void mat4_to_eulO(float e[3], const short order, float M[4][4])
}
/* uses 2 methods to retrieve eulers, and picks the closest */
-void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order, float mat[3][3])
+void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3])
{
float eul1[3], eul2[3];
float d1, d2;
@@ -1369,7 +1336,7 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order, float m
copy_v3_v3(eul, eul1);
}
-void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order, float M[4][4])
+void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float M[4][4])
{
float m[3][3];
@@ -1381,7 +1348,7 @@ void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order, float M
/* rotate the given euler by the given angle on the specified axis */
// NOTE: is this safe to do with different axis orders?
-void rotate_eulO(float beul[3], short order, char axis, float ang)
+void rotate_eulO(float beul[3], const short order, char axis, float ang)
{
float eul[3], mat1[3][3], mat2[3][3], totmat[3][3];
@@ -1406,7 +1373,7 @@ void rotate_eulO(float beul[3], short order, char axis, float ang)
/* the matrix is written to as 3 axis vectors */
void eulO_to_gimbal_axis(float gmat[][3], const float eul[3], const short order)
{
- RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
+ const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
float mat[3][3];
float teul[3];
@@ -1474,10 +1441,9 @@ void mat4_to_dquat(DualQuat *dq, float basemat[][4], float mat[][4])
mult_m4_m4m4(baseRS, mat, basemat);
mat4_to_size(scale, baseRS);
- copy_v3_v3(dscale, scale);
- dscale[0] -= 1.0f;
- dscale[1] -= 1.0f;
- dscale[2] -= 1.0f;
+ dscale[0] = scale[0] - 1.0f;
+ dscale[1] = scale[1] - 1.0f;
+ dscale[2] = scale[2] - 1.0f;
if ((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
/* extract R and S */
@@ -1513,10 +1479,10 @@ void mat4_to_dquat(DualQuat *dq, float basemat[][4], float mat[][4])
/* dual part */
t = R[3];
q = dq->quat;
- dq->trans[0] = -0.5f * (t[0] * q[1] + t[1] * q[2] + t[2] * q[3]);
- dq->trans[1] = 0.5f * (t[0] * q[0] + t[1] * q[3] - t[2] * q[2]);
- dq->trans[2] = 0.5f * (-t[0] * q[3] + t[1] * q[0] + t[2] * q[1]);
- dq->trans[3] = 0.5f * (t[0] * q[2] - t[1] * q[1] + t[2] * q[0]);
+ dq->trans[0] = -0.5f * ( t[0] * q[1] + t[1] * q[2] + t[2] * q[3]);
+ dq->trans[1] = 0.5f * ( t[0] * q[0] + t[1] * q[3] - t[2] * q[2]);
+ dq->trans[2] = 0.5f * (-t[0] * q[3] + t[1] * q[0] + t[2] * q[1]);
+ dq->trans[3] = 0.5f * ( t[0] * q[2] - t[1] * q[1] + t[2] * q[0]);
}
void dquat_to_mat4(float mat[][4], DualQuat *dq)
@@ -1527,7 +1493,7 @@ void dquat_to_mat4(float mat[][4], DualQuat *dq)
copy_qt_qt(q0, dq->quat);
/* normalize */
- len = (float)sqrt(dot_qtqt(q0, q0));
+ len = sqrtf(dot_qtqt(q0, q0));
if (len != 0.0f)
mul_qt_fl(q0, 1.0f / len);
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index b4b546d9167..22597c9f8e6 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -260,12 +260,12 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node)
node->vb = vb;
}
-//void BLI_pbvh_node_BB_reset(PBVHNode* node)
+//void BLI_pbvh_node_BB_reset(PBVHNode *node)
//{
// BB_reset(&node->vb);
//}
//
-//void BLI_pbvh_node_BB_expand(PBVHNode* node, float co[3])
+//void BLI_pbvh_node_BB_expand(PBVHNode *node, float co[3])
//{
// BB_expand(&node->vb, co);
//}
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index e22becddfd6..225ede8a8ef 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -58,7 +58,7 @@ int BLI_rctf_is_empty(const rctf *rect)
return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
}
-int BLI_in_rcti(const rcti *rect, const int x, const int y)
+int BLI_rcti_isect_pt(const rcti *rect, const int x, const int y)
{
if (x < rect->xmin) return 0;
if (x > rect->xmax) return 0;
@@ -74,7 +74,7 @@ int BLI_in_rcti(const rcti *rect, const int x, const int y)
*
* \return True if \a rect is empty.
*/
-int BLI_in_rcti_v(const rcti *rect, const int xy[2])
+int BLI_rcti_isect_pt_v(const rcti *rect, const int xy[2])
{
if (xy[0] < rect->xmin) return 0;
if (xy[0] > rect->xmax) return 0;
@@ -83,7 +83,7 @@ int BLI_in_rcti_v(const rcti *rect, const int xy[2])
return 1;
}
-int BLI_in_rctf(const rctf *rect, const float x, const float y)
+int BLI_rctf_isect_pt(const rctf *rect, const float x, const float y)
{
if (x < rect->xmin) return 0;
if (x > rect->xmax) return 0;
@@ -92,7 +92,7 @@ int BLI_in_rctf(const rctf *rect, const float x, const float y)
return 1;
}
-int BLI_in_rctf_v(const rctf *rect, const float xy[2])
+int BLI_rctf_isect_pt_v(const rctf *rect, const float xy[2])
{
if (xy[0] < rect->xmin) return 0;
if (xy[0] > rect->xmax) return 0;
@@ -124,7 +124,7 @@ int BLI_rcti_isect_segment(const rcti *rect, const int s1[2], const int s2[2])
if (s1[1] > rect->ymax && s2[1] > rect->ymax) return 0;
/* if either points intersect then we definetly intersect */
- if (BLI_in_rcti_v(rect, s1) || BLI_in_rcti_v(rect, s2)) {
+ if (BLI_rcti_isect_pt_v(rect, s1) || BLI_rcti_isect_pt_v(rect, s2)) {
return 1;
}
else {
@@ -252,8 +252,8 @@ void BLI_rctf_translate(rctf *rect, float x, float y)
/* change width & height around the central location */
void BLI_rcti_resize(rcti *rect, int x, int y)
{
- rect->xmin = rect->xmax = (rect->xmax + rect->xmin) / 2;
- rect->ymin = rect->ymax = (rect->ymax + rect->ymin) / 2;
+ rect->xmin = rect->xmax = BLI_RCT_CENTER_X(rect);
+ rect->ymin = rect->ymax = BLI_RCT_CENTER_Y(rect);
rect->xmin -= x / 2;
rect->ymin -= y / 2;
rect->xmax = rect->xmin + x;
@@ -262,8 +262,8 @@ void BLI_rcti_resize(rcti *rect, int x, int y)
void BLI_rctf_resize(rctf *rect, float x, float y)
{
- rect->xmin = rect->xmax = (rect->xmax + rect->xmin) * 0.5f;
- rect->ymin = rect->ymax = (rect->ymax + rect->ymin) * 0.5f;
+ rect->xmin = rect->xmax = BLI_RCT_CENTER_X(rect);
+ rect->ymin = rect->ymax = BLI_RCT_CENTER_Y(rect);
rect->xmin -= x * 0.5f;
rect->ymin -= y * 0.5f;
rect->xmax = rect->xmin + x;
@@ -363,22 +363,30 @@ int BLI_rcti_isect(const rcti *src1, const rcti *src2, rcti *dest)
}
}
-void BLI_rcti_rctf_copy(rcti *tar, const rctf *src)
+void BLI_rcti_rctf_copy(rcti *dst, const rctf *src)
{
- tar->xmin = floorf(src->xmin + 0.5f);
- tar->xmax = floorf((src->xmax - src->xmin) + 0.5f);
- tar->ymin = floorf(src->ymin + 0.5f);
- tar->ymax = floorf((src->ymax - src->ymin) + 0.5f);
+ dst->xmin = floorf(src->xmin + 0.5f);
+ dst->xmax = dst->xmin + floorf(BLI_RCT_SIZE_X(src) + 0.5f);
+ dst->ymin = floorf(src->ymin + 0.5f);
+ dst->ymax = dst->ymin + floorf(BLI_RCT_SIZE_Y(src) + 0.5f);
+}
+
+void BLI_rctf_rcti_copy(rctf *dst, const rcti *src)
+{
+ dst->xmin = src->xmin;
+ dst->xmax = src->xmax;
+ dst->ymin = src->ymin;
+ dst->ymax = src->ymax;
}
void print_rctf(const char *str, const rctf *rect)
{
printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
- rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+ rect->xmin, rect->xmax, rect->ymin, rect->ymax, BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
}
void print_rcti(const char *str, const rcti *rect)
{
printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
- rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+ rect->xmin, rect->xmax, rect->ymin, rect->ymax, BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 7a750a74a33..8501db7c8b8 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -78,22 +78,31 @@ char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
return dst;
}
-size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
+size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg)
{
size_t n;
- va_list arg;
- va_start(arg, format);
n = vsnprintf(buffer, count, format, arg);
-
+
if (n != -1 && n < count) {
buffer[n] = '\0';
}
else {
buffer[count - 1] = '\0';
}
-
+
+ return n;
+}
+
+size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
+{
+ size_t n;
+ va_list arg;
+
+ va_start(arg, format);
+ n = BLI_vsnprintf(buffer, count, format, arg);
va_end(arg);
+
return n;
}
diff --git a/source/blender/blenlib/intern/voronoi.c b/source/blender/blenlib/intern/voronoi.c
index f61df9c11f5..80a4da5cace 100644
--- a/source/blender/blenlib/intern/voronoi.c
+++ b/source/blender/blenlib/intern/voronoi.c
@@ -28,7 +28,7 @@
* http://blog.ivank.net/fortunes-algorithm-and-implementation.html
*/
-/** \file blender/blenkernel/intern/voronoi.c
+/** \file blender/blenlib/intern/voronoi.c
* \ingroup bli
*/
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a82b5821b7e..5dec6456043 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2617,7 +2617,7 @@ static void lib_link_armature(FileData *fd, Main *main)
}
}
-static void direct_link_bones(FileData *fd, Bone* bone)
+static void direct_link_bones(FileData *fd, Bone *bone)
{
Bone *child;
@@ -2913,6 +2913,7 @@ static void lib_link_vfont(FileData *UNUSED(fd), Main *main)
static void direct_link_vfont(FileData *fd, VFont *vf)
{
vf->data = NULL;
+ vf->temp_pf = NULL;
vf->packedfile = direct_link_packedfile(fd, vf->packedfile);
}
@@ -4786,6 +4787,16 @@ static void link_paint(FileData *fd, Scene *sce, Paint *p)
}
}
+static void lib_link_sequence_modifiers(FileData *fd, Scene *scene, ListBase *lb)
+{
+ SequenceModifierData *smd;
+
+ for (smd = lb->first; smd; smd = smd->next) {
+ if (smd->mask_id)
+ smd->mask_id = newlibadr_us(fd, scene->id.lib, smd->mask_id);
+ }
+}
+
static void lib_link_scene(FileData *fd, Main *main)
{
Scene *sce;
@@ -4870,6 +4881,8 @@ static void lib_link_scene(FileData *fd, Main *main)
}
}
seq->anim = NULL;
+
+ lib_link_sequence_modifiers(fd, sce, &seq->modifiers);
}
SEQ_END
@@ -4926,6 +4939,29 @@ static void direct_link_paint(FileData *fd, Paint **paint)
(*paint)->num_input_samples = 1;
}
+static void direct_link_sequence_modifiers(FileData *fd, ListBase *lb)
+{
+ SequenceModifierData *smd;
+
+ link_list(fd, lb);
+
+ for (smd = lb->first; smd; smd = smd->next) {
+ if (smd->mask_sequence)
+ smd->mask_sequence = newdataadr(fd, smd->mask_sequence);
+
+ if (smd->type == seqModifierType_Curves) {
+ CurvesModifierData *cmd = (CurvesModifierData *) smd;
+
+ direct_link_curvemapping(fd, &cmd->curve_mapping);
+ }
+ else if (smd->type == seqModifierType_HueCorrect) {
+ HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
+
+ direct_link_curvemapping(fd, &hcmd->curve_mapping);
+ }
+ }
+}
+
static void direct_link_scene(FileData *fd, Scene *sce)
{
Editing *ed;
@@ -5038,6 +5074,8 @@ static void direct_link_scene(FileData *fd, Scene *sce)
// seq->strip->color_balance->gui = 0; // XXX - peter, is this relevant in 2.5?
}
}
+
+ direct_link_sequence_modifiers(fd, &seq->modifiers);
}
SEQ_END
@@ -7888,10 +7926,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 14)) {
+ ParticleSettings *part;
bNodeTreeType *ntreetype = ntreeGetType(NTREE_COMPOSIT);
if (ntreetype && ntreetype->foreach_nodetree)
ntreetype->foreach_nodetree(main, NULL, do_version_ntree_keying_despill_balance);
+
+ /* keep compatibility for dupliobject particle size */
+ for (part=main->particle.first; part; part=part->id.next)
+ if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR))
+ if ((part->draw & PART_DRAW_ROTATE_OB) == 0)
+ part->draw |= PART_DRAW_NO_SCALE_OB;
}
if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 17)) {
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index d551caea425..1bad1bd80df 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -129,7 +129,7 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
ar->v2d.flag = (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
}
-static void sequencer_init_preview_region(ARegion* ar)
+static void sequencer_init_preview_region(ARegion *ar)
{
// XXX a bit ugly still, copied from space_sequencer
/* NOTE: if you change values here, also change them in space_sequencer.c, sequencer_new */
@@ -1787,7 +1787,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_VIEW3D) {
- View3D* v3d = (View3D *)sl;
+ View3D *v3d = (View3D *)sl;
v3d->flag2 &= ~V3D_RENDER_OVERRIDE;
}
}
@@ -2206,7 +2206,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
bActuator *act;
for (act = ob->actuators.first; act; act = act->next) {
if (act->type == ACT_STEERING) {
- bSteeringActuator* stact = act->data;
+ bSteeringActuator *stact = act->data;
if (stact->facingaxis == 0) {
stact->facingaxis = 1;
}
@@ -2435,7 +2435,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
- curvemapping_changed(tex->pd->falloff_curve, 0);
+ curvemapping_changed(tex->pd->falloff_curve, FALSE);
}
}
}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index c31906cbd80..8ace277b42d 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -1141,7 +1141,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
}
if (main->versionfile <= 212) {
- bSound* sound;
+ bSound *sound;
bProperty *prop;
Object *ob;
Mesh *me;
@@ -1307,7 +1307,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
}
if (main->versionfile <= 224) {
- bSound* sound;
+ bSound *sound;
Scene *sce;
Mesh *me;
bScreen *sc;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 02b4537e9c8..252e81537c4 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -646,15 +646,21 @@ static void write_animdata(WriteData *wd, AnimData *adt)
write_nladata(wd, &adt->nla_tracks);
}
-static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
+static void write_curvemapping_curves(WriteData *wd, CurveMapping *cumap)
{
int a;
-
- writestruct(wd, DATA, "CurveMapping", 1, cumap);
- for (a=0; a<CM_TOT; a++)
+
+ for (a = 0; a < CM_TOT; a++)
writestruct(wd, DATA, "CurveMapPoint", cumap->cm[a].totpoint, cumap->cm[a].curve);
}
+static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
+{
+ writestruct(wd, DATA, "CurveMapping", 1, cumap);
+
+ write_curvemapping_curves(wd, cumap);
+}
+
static void write_node_socket(WriteData *wd, bNodeSocket *sock)
{
bNodeSocketType *stype= ntreeGetSocketType(sock->type);
@@ -1815,7 +1821,7 @@ static void write_meshs(WriteData *wd, ListBase *idbase)
/* backup */
- /* now fill in polys to mfaces*/
+ /* now fill in polys to mfaces */
mesh->totface = BKE_mesh_mpoly_to_mface(&mesh->fdata, &backup_mesh.ldata, &backup_mesh.pdata,
mesh->totface, backup_mesh.totloop, backup_mesh.totpoly);
@@ -2086,6 +2092,32 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
}
}
+static void write_sequence_modifiers(WriteData *wd, ListBase *modbase)
+{
+ SequenceModifierData *smd;
+
+ for (smd = modbase->first; smd; smd = smd->next) {
+ SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);
+
+ if (smti) {
+ writestruct(wd, DATA, smti->struct_name, 1, smd);
+
+ if (smd->type == seqModifierType_Curves) {
+ CurvesModifierData *cmd = (CurvesModifierData *) smd;
+
+ write_curvemapping(wd, &cmd->curve_mapping);
+ }
+ else if (smd->type == seqModifierType_HueCorrect) {
+ HueCorrectModifierData *hcmd = (HueCorrectModifierData *) smd;
+
+ write_curvemapping(wd, &hcmd->curve_mapping);
+ }
+ }
+ else {
+ writestruct(wd, DATA, "SequenceModifierData", 1, smd);
+ }
+ }
+}
static void write_scenes(WriteData *wd, ListBase *scebase)
{
@@ -2192,6 +2224,8 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
strip->done = TRUE;
}
+
+ write_sequence_modifiers(wd, &seq->modifiers);
}
SEQ_END
@@ -2491,7 +2525,7 @@ static void write_libraries(WriteData *wd, Main *main)
}
}
-static void write_bone(WriteData *wd, Bone* bone)
+static void write_bone(WriteData *wd, Bone *bone)
{
Bone* cbone;
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 188d35c6829..94d94cbec3e 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -80,7 +80,14 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
CustomData_bmesh_set_default(&bm->vdata, &v->head.data);
if (example) {
+ int *keyi;
+
BM_elem_attrs_copy(bm, bm, example, v);
+
+ /* exception: don't copy the original shapekey index */
+ keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX);
+ if(keyi)
+ *keyi = ORIGINDEX_NONE;
}
BM_CHECK_ELEMENT(v);
@@ -1946,7 +1953,7 @@ int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
}
/**
- * High level function which wraps both #bm_vert_separate and #bm_edge_separate
+ * High level function which wraps both #bmesh_vert_separate and #bmesh_edge_separate
*/
int BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len)
diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
index 606e9eeb23b..2ef146c7b38 100644
--- a/source/blender/bmesh/intern/bmesh_error.h
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -23,7 +23,7 @@
#ifndef __BMESH_ERROR_H__
#define __BMESH_ERROR_H__
-/** \file blender/bmesh/bmesh_error.h
+/** \file blender/bmesh/intern/bmesh_error.h
* \ingroup bmesh
*/
@@ -84,8 +84,8 @@ void BMO_error_clear(BMesh *bm);
(void)((!(a)) ? ( \
( \
fprintf(stderr, \
- "BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \
- __FILE__, __func__, __LINE__, STRINGIFY(a)), \
+ "BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \
+ __FILE__, __func__, __LINE__, STRINGIFY(a)), \
_BMESH_DUMMY_ABORT(), \
NULL)) : NULL)
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 9453932b684..9033436d1b2 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -45,47 +45,67 @@
#include "bmesh.h"
#include "intern/bmesh_private.h"
-/**
- * \brief Data, Interp From Verts
- *
- * Interpolates per-vertex data from two sources to a target.
- */
-void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac)
+/* edge and vertex share, currently theres no need to have different logic */
+static void bm_data_interp_from_elem(CustomData *data_layer, BMElem *ele1, BMElem *ele2, BMElem *ele_dst, const float fac)
{
- if (v1->head.data && v2->head.data) {
+ if (ele1->head.data && ele2->head.data) {
/* first see if we can avoid interpolation */
if (fac <= 0.0f) {
- if (v1 == v) {
+ if (ele1 == ele_dst) {
/* do nothing */
}
else {
- CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
- CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, v1->head.data, &v->head.data);
+ CustomData_bmesh_free_block(data_layer, &ele_dst->head.data);
+ CustomData_bmesh_copy_data(data_layer, data_layer, ele1->head.data, &ele_dst->head.data);
}
}
else if (fac >= 1.0f) {
- if (v2 == v) {
+ if (ele2 == ele_dst) {
/* do nothing */
}
else {
- CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
- CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, v2->head.data, &v->head.data);
+ CustomData_bmesh_free_block(data_layer, &ele_dst->head.data);
+ CustomData_bmesh_copy_data(data_layer, data_layer, ele2->head.data, &ele_dst->head.data);
}
}
else {
void *src[2];
float w[2];
- src[0] = v1->head.data;
- src[1] = v2->head.data;
+ src[0] = ele1->head.data;
+ src[1] = ele2->head.data;
w[0] = 1.0f - fac;
w[1] = fac;
- CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->head.data);
+ CustomData_bmesh_interp(data_layer, src, w, NULL, 2, ele_dst->head.data);
}
}
}
/**
+ * \brief Data, Interp From Verts
+ *
+ * Interpolates per-vertex data from two sources to a target.
+ *
+ * \note This is an exact match to #BM_data_interp_from_edges
+ */
+void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac)
+{
+ bm_data_interp_from_elem(&bm->vdata, (BMElem *)v1, (BMElem *)v2, (BMElem *)v, fac);
+}
+
+/**
+ * \brief Data, Interp From Edges
+ *
+ * Interpolates per-edge data from two sources to a target.
+ *
+ * \note This is an exact match to #BM_data_interp_from_verts
+ */
+void BM_data_interp_from_edges(BMesh *bm, BMEdge *e1, BMEdge *e2, BMEdge *e, const float fac)
+{
+ bm_data_interp_from_elem(&bm->edata, (BMElem *)e1, (BMElem *)e2, (BMElem *)e, fac);
+}
+
+/**
* \brief Data Vert Average
*
* Sets all the customdata (e.g. vert, loop) associated with a vert
diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h
index 3380a3e6b1b..8be963f5798 100644
--- a/source/blender/bmesh/intern/bmesh_interp.h
+++ b/source/blender/bmesh/intern/bmesh_interp.h
@@ -31,6 +31,7 @@ void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source);
void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source);
void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac);
+void BM_data_interp_from_edges(BMesh *bm, BMEdge *e1, BMEdge *e2, BMEdge *e, const float fac);
void BM_data_interp_face_vert_edge(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, BMEdge *e1, const float fac);
void BM_data_layer_add(BMesh *em, CustomData *data, int type);
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name);
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index d16dacaf5cf..58ccfa79a02 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -31,6 +31,8 @@
* that should be addressed eventually.
*/
+#include <stddef.h>
+
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
@@ -567,9 +569,9 @@ BMFace *BM_active_face_get(BMesh *bm, int sloppy)
* These functions were written to be used by the Modifier widget
* when in Rotate about active mode, but can be used anywhere.
*
- * - #EM_editselection_center
- * - #EM_editselection_normal
- * - #EM_editselection_plane
+ * - #BM_editselection_center
+ * - #BM_editselection_normal
+ * - #BM_editselection_plane
*/
void BM_editselection_center(BMEditSelection *ese, float r_center[3])
{
@@ -708,28 +710,19 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
/* --- macro wrapped funcs --- */
int _bm_select_history_check(BMesh *bm, const BMHeader *ele)
{
- BMEditSelection *ese;
-
- for (ese = bm->selected.first; ese; ese = ese->next) {
- if (ese->ele == (BMElem *)ele) {
- return TRUE;
- }
- }
-
- return FALSE;
+ return (BLI_findptr(&bm->selected, ele, offsetof(BMEditSelection, ele)) != NULL);
}
int _bm_select_history_remove(BMesh *bm, BMHeader *ele)
{
- BMEditSelection *ese;
- for (ese = bm->selected.first; ese; ese = ese->next) {
- if (ese->ele == (BMElem *)ele) {
- BLI_freelinkN(&(bm->selected), ese);
- return TRUE;
- }
+ BMEditSelection *ese = BLI_findptr(&bm->selected, ele, offsetof(BMEditSelection, ele));
+ if (ese) {
+ BLI_freelinkN(&bm->selected, ese);
+ return TRUE;
+ }
+ else {
+ return FALSE;
}
-
- return FALSE;
}
void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele)
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 123eb6829a3..51c8b5d3bd8 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -793,6 +793,15 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
if (keyi && *keyi != ORIGINDEX_NONE) {
sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]);
}
+ else {
+ /* if there are new vertices in the mesh, we can't propagate the offset
+ * because it will only work for the existing vertices and not the new
+ * ones, creating a mess when doing e.g. subdivide + translate */
+ MEM_freeN(ofs);
+ ofs = NULL;
+ break;
+ }
+
mvert++;
}
}
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index a549c700c07..73e2d83520c 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -174,7 +174,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v)
f = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE);
/* return if couldn't join faces in manifold
* conditions */
- //!disabled for testing why bad things happen
+ /* !disabled for testing why bad things happen */
if (!f) {
return FALSE;
}
@@ -384,7 +384,7 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l
* \param bm The bmesh
* \param f the original face
* \param v1, v2 vertices which define the split edge, must be different
- * \param co Array of coordinates for intermediate points
+ * \param cos Array of coordinates for intermediate points
* \param n Length of \a cos (must be > 0)
* \param r_l pointer which will receive the BMLoop for the first split edge (from \a v1) in the new face
* \param example Edge used for attributes of splitting edge, if non-NULL
@@ -888,6 +888,7 @@ int BM_edge_rotate_check(BMEdge *e)
* 1) does the newly forms edge form a flipped face (compare with previous cross product)
* 2) does the newly formed edge cause a zero area corner (or close enough to be almost zero)
*
+ * \param e The edge to test rotation.
* \param l1,l2 are the loops of the proposed verts to rotate too and should
* be the result of calling #BM_edge_calc_rotate
*/
diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h
index 802c6cca05d..790f0cb6267 100644
--- a/source/blender/bmesh/intern/bmesh_mods.h
+++ b/source/blender/bmesh/intern/bmesh_mods.h
@@ -47,9 +47,9 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f,
float cos[][3], int n,
BMLoop **r_l, BMEdge *example);
-BMEdge* BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
+BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
const short join_faces, const short kill_degenerate_faces);
-BMEdge* BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
+BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
const short kill_degenerate_faces);
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index eacee8e12ad..362157ad71b 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -366,8 +366,8 @@ static BMOpDefine bmo_weld_verts_def = {
*/
static BMOpDefine bmo_create_vert_def = {
"create_vert",
- {{BMO_OP_SLOT_VEC, "co"}, //the coordinate of the new vert
- {BMO_OP_SLOT_ELEMENT_BUF, "newvertout"}, //the new vert
+ {{BMO_OP_SLOT_VEC, "co"}, /* the coordinate of the new vert */
+ {BMO_OP_SLOT_ELEMENT_BUF, "newvertout"}, /* the new vert */
{0, /* null-terminating sentinel */}},
bmo_create_vert_exec,
0,
@@ -381,8 +381,8 @@ static BMOpDefine bmo_create_vert_def = {
*/
static BMOpDefine bmo_join_triangles_def = {
"join_triangles",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, //input geometry.
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, //joined faces
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input geometry. */
+ {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* joined faces */
{BMO_OP_SLOT_BOOL, "cmp_sharp"},
{BMO_OP_SLOT_BOOL, "cmp_uvs"},
{BMO_OP_SLOT_BOOL, "cmp_vcols"},
@@ -406,8 +406,10 @@ static BMOpDefine bmo_join_triangles_def = {
*/
static BMOpDefine bmo_contextual_create_def = {
"contextual_create",
- {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, //input geometry.
+ {{BMO_OP_SLOT_ELEMENT_BUF, "geom"}, /* input geometry. */
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* newly-made face(s) */
+ /* note, this is for stand-alone edges only, not edges which are apart of newly created faces */
+ {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* newly-made edge(s) */
{BMO_OP_SLOT_INT, "mat_nr"}, /* material to use */
{BMO_OP_SLOT_BOOL, "use_smooth"}, /* material to use */
{0, /* null-terminating sentinel */}},
@@ -422,6 +424,8 @@ static BMOpDefine bmo_bridge_loops_def = {
"bridge_loops",
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
{BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* new face */
+ {BMO_OP_SLOT_BOOL, "use_merge"},
+ {BMO_OP_SLOT_FLT, "merge_factor"},
{0, /* null-terminating sentinel */}},
bmo_bridge_loops_exec,
0,
@@ -455,8 +459,8 @@ static BMOpDefine bmo_edgenet_fill_def = {
*/
static BMOpDefine bmo_edgenet_prepare_def = {
"edgenet_prepare",
- {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, //input edges
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, //new edges
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
+ {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* new edges */
{0, /* null-terminating sentinel */}},
bmo_edgenet_prepare,
0,
@@ -470,9 +474,9 @@ static BMOpDefine bmo_edgenet_prepare_def = {
*/
static BMOpDefine bmo_rotate_def = {
"rotate",
- {{BMO_OP_SLOT_VEC, "cent"}, //center of rotation
- {BMO_OP_SLOT_MAT, "mat"}, //matrix defining rotation
- {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
+ {{BMO_OP_SLOT_VEC, "cent"}, /* center of rotation */
+ {BMO_OP_SLOT_MAT, "mat"}, /* matrix defining rotation */
+ {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{0, /* null-terminating sentinel */}},
bmo_rotate_exec,
0,
@@ -486,8 +490,8 @@ static BMOpDefine bmo_rotate_def = {
*/
static BMOpDefine bmo_translate_def = {
"translate",
- {{BMO_OP_SLOT_VEC, "vec"}, //translation offset
- {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
+ {{BMO_OP_SLOT_VEC, "vec"}, /* translation offset */
+ {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{0, /* null-terminating sentinel */}},
bmo_translate_exec,
0,
@@ -500,8 +504,8 @@ static BMOpDefine bmo_translate_def = {
*/
static BMOpDefine bmo_scale_def = {
"scale",
- {{BMO_OP_SLOT_VEC, "vec"}, //scale factor
- {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
+ {{BMO_OP_SLOT_VEC, "vec"}, /* scale factor */
+ {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{0, /* null-terminating sentinel */}},
bmo_scale_exec,
0,
@@ -516,8 +520,8 @@ static BMOpDefine bmo_scale_def = {
*/
static BMOpDefine bmo_transform_def = {
"transform",
- {{BMO_OP_SLOT_MAT, "mat"}, //transform matrix
- {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
+ {{BMO_OP_SLOT_MAT, "mat"}, /* transform matrix */
+ {BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
{0, /* null-terminating sentinel */}},
bmo_transform_exec,
0,
@@ -546,9 +550,9 @@ static BMOpDefine bmo_object_load_bmesh_def = {
*/
static BMOpDefine bmo_bmesh_to_mesh_def = {
"bmesh_to_mesh",
- {{BMO_OP_SLOT_PTR, "mesh"}, //pointer to a mesh structure to fill in
- {BMO_OP_SLOT_PTR, "object"}, //pointer to an object structure
- {BMO_OP_SLOT_BOOL, "notessellation"}, //don't calculate mfaces
+ {{BMO_OP_SLOT_PTR, "mesh"}, /* pointer to a mesh structure to fill in */
+ {BMO_OP_SLOT_PTR, "object"}, /* pointer to an object structure */
+ {BMO_OP_SLOT_BOOL, "notessellation"}, /* don't calculate mfaces */
{0, /* null-terminating sentinel */}},
bmo_bmesh_to_mesh_exec,
0,
@@ -562,9 +566,9 @@ static BMOpDefine bmo_bmesh_to_mesh_def = {
*/
static BMOpDefine bmo_mesh_to_bmesh_def = {
"mesh_to_bmesh",
- {{BMO_OP_SLOT_PTR, "mesh"}, //pointer to a Mesh structure
- {BMO_OP_SLOT_PTR, "object"}, //pointer to an Object structure
- {BMO_OP_SLOT_BOOL, "set_shapekey"}, //load active shapekey coordinates into verts
+ {{BMO_OP_SLOT_PTR, "mesh"}, /* pointer to a Mesh structure */
+ {BMO_OP_SLOT_PTR, "object"}, /* pointer to an Object structure */
+ {BMO_OP_SLOT_BOOL, "set_shapekey"}, /* load active shapekey coordinates into verts */
{0, /* null-terminating sentinel */}},
bmo_mesh_to_bmesh_exec,
0
@@ -577,9 +581,9 @@ static BMOpDefine bmo_mesh_to_bmesh_def = {
*/
static BMOpDefine bmo_extrude_discrete_faces_def = {
"extrude_discrete_faces",
- {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, //input faces
- {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, //output faces
- {BMO_OP_SLOT_ELEMENT_BUF, "skirtout"}, //output skirt geometry, faces and edges
+ {{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+ {BMO_OP_SLOT_ELEMENT_BUF, "faceout"}, /* output faces */
+ {BMO_OP_SLOT_ELEMENT_BUF, "skirtout"}, /* output skirt geometry, faces and edges */
{0} /* null-terminating sentinel */},
bmo_extrude_discrete_faces_exec,
0
@@ -593,8 +597,8 @@ static BMOpDefine bmo_extrude_discrete_faces_def = {
*/
static BMOpDefine bmo_extrude_edge_only_def = {
"extrude_edge_only",
- {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, //input vertices
- {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, //output geometry
+ {{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input vertices */
+ {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, /* output geometry */
{0} /* null-terminating sentinel */},
bmo_extrude_edge_only_exec,
0
@@ -607,9 +611,9 @@ static BMOpDefine bmo_extrude_edge_only_def = {
*/
static BMOpDefine bmo_extrude_vert_indiv_def = {
"extrude_vert_indiv",
- {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
- {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, //output wire edges
- {BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, //output vertices
+ {{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertices */
+ {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* output wire edges */
+ {BMO_OP_SLOT_ELEMENT_BUF, "vertout"}, /* output vertices */
{0} /* null-terminating sentinel */},
bmo_extrude_vert_indiv_exec,
0
@@ -647,7 +651,7 @@ static BMOpDefine bmo_dissolve_edges_def = {
"dissolve_edges",
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
- {BMO_OP_SLOT_BOOL, "use_verts"}, // dissolve verts left between only 2 edges.
+ {BMO_OP_SLOT_BOOL, "use_verts"}, /* dissolve verts left between only 2 edges. */
{0} /* null-terminating sentinel */},
bmo_dissolve_edges_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
@@ -666,7 +670,7 @@ static BMOpDefine bmo_dissolve_faces_def = {
"dissolve_faces",
{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
{BMO_OP_SLOT_ELEMENT_BUF, "regionout"},
- {BMO_OP_SLOT_BOOL, "use_verts"}, // dissolve verts left between only 2 edges.
+ {BMO_OP_SLOT_BOOL, "use_verts"}, /* dissolve verts left between only 2 edges. */
{0} /* null-terminating sentinel */},
bmo_dissolve_faces_exec,
BMO_OP_FLAG_UNTAN_MULTIRES
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index a2f14ef8388..0674103162c 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -23,7 +23,7 @@
#ifndef __BMESH_OPERATOR_API_H__
#define __BMESH_OPERATOR_API_H__
-/** \file blender/bmesh/bmesh_operator_api.h
+/** \file blender/bmesh/intern/bmesh_operator_api.h
* \ingroup bmesh
*/
@@ -289,7 +289,7 @@ void BMO_slot_vec_get(BMOperator *op, const char *slot_name, float r_vec[3]);
/* only supports square mats */
/* size must be 3 or 4; this api is meant only for transformation matrices.
* note that internally the matrix is stored in 4x4 form, and it's safe to
- * call whichever BMO_Get_Mat* function you want. */
+ * call whichever BMO_Get_MatXXX function you want. */
void BMO_slot_mat_set(BMOperator *op, const char *slot_name, const float *mat, int size);
void BMO_slot_mat4_get(BMOperator *op, const char *slot_name, float r_mat[4][4]);
void BMO_slot_mat3_set(BMOperator *op, const char *slot_name, float r_mat[3][3]);
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 5d63172dbfa..807570f0d86 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -646,8 +646,7 @@ static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i,
continue;
}
- if (isect_point_tri_v2(pv1, v1, v2, v3) || isect_point_tri_v2(pv1, v3, v2, v1))
- {
+ if (isect_point_tri_v2(pv1, v1, v2, v3) || isect_point_tri_v2(pv1, v3, v2, v1)) {
#if 0
if (isect_point_tri_v2(pv1, v1, v2, v3))
printf("%d in (%d, %d, %d)\n", v3i, i, v1i, v2i);
@@ -664,7 +663,8 @@ static int bm_face_goodline(float const (*projectverts)[3], BMFace *f, int v1i,
* \brief Find Ear
*
* Used by tessellator to find the next triangle to 'clip off' of a polygon while tessellating.
- *
+ * \param f The face to search.
+ * \param verts an array of face vert coords.
* \param use_beauty Currently only applies to quads, can be extended later on.
* \param abscoss Must be allocated by caller, and at least f->len length
* (allow to avoid allocating a new one for each tri!).
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index ef5145d6582..a9f146e4962 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -202,6 +202,10 @@ BMLoop *BM_vert_find_first_loop(BMVert *v)
return NULL;
e = bmesh_disk_faceedge_find_first(v->e, v);
+
+ if (!e)
+ return NULL;
+
return bmesh_radial_faceloop_find_first(e->l, v);
}
@@ -797,7 +801,6 @@ float BM_loop_calc_face_angle(BMLoop *l)
*
* Calculate the normal at this loop corner or fallback to the face normal on straight lines.
*
- * \param bm The BMesh
* \param l The loop to calculate the normal at
* \param r_normal Resulting normal
*/
@@ -821,7 +824,6 @@ void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3])
* Calculate the tangent at this loop corner or fallback to the face normal on straight lines.
* This vector always points inward into the face.
*
- * \param bm The BMesh
* \param l The loop to calculate the tangent at
* \param r_tangent Resulting tangent
*/
@@ -881,6 +883,7 @@ float BM_edge_calc_face_angle(BMEdge *e)
* \param e
* \param e_loop The loop to calculate the tangent at,
* used to get the face and winding direction.
+ * \param r_tangent The loop corner tangent to set
*/
void BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3])
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index 7418be3565c..6943dcb3e5d 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -39,6 +39,7 @@
#define FACE_NEW 2
#define EDGE_MARK 4
#define EDGE_DONE 8
+#define FACE_OUT 16
void bmo_connect_verts_exec(BMesh *bm, BMOperator *op)
{
@@ -223,6 +224,10 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
BMEdge *e, *nexte;
int c = 0, cl1 = 0, cl2 = 0;
+ /* merge-bridge support */
+ const int use_merge = BMO_slot_bool_get(op, "use_merge");
+ const float merge_factor = BMO_slot_float_get(op, "merge_factor");
+
BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
@@ -370,39 +375,36 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
}
}
- /* Find the shortest distance from a vert in vv1 to vv2[0]. Use that
- * vertex in vv1 as a starting point in the first loop, while starting
- * from vv2[0] in the second loop. This is a simplistic attempt to get
- * a better edge-to-edge match between the two loops. */
+ /* Find the smallest sum of distances from verts in vv1 to verts in vv2,
+ * finding a starting point in the first loop, to start with vv2[0] in the
+ * second loop. This is a simplistic attempt to get a better edge-to-edge
+ * match between two loops. */
if (cl1) {
- int previ, nexti;
float min = 1e32;
- /* BMESH_TODO: Would be nice to do a more thorough analysis of all
- * the vertices in both loops to find a more accurate match for the
- * starting point and winding direction of the bridge generation. */
-
- for (i = 0; i < BLI_array_count(vv1); i++) {
- if (len_v3v3(vv1[i]->co, vv2[0]->co) < min) {
- min = len_v3v3(vv1[i]->co, vv2[0]->co);
+ for (i = 0; i < lenv1; i++) {
+ float len;
+
+ /* compute summed length between vertices in forward direction */
+ len = 0.0f;
+ for (j = 0; j < lenv2; j++)
+ len += len_v3v3(vv1[clamp_index(i+j, lenv1)]->co, vv2[j]->co);
+
+ if (len < min) {
+ min = len;
starti = i;
}
- }
- /* Reverse iteration order for the first loop if the distance of
- * the (starti - 1) vert from vv1 is a better match for vv2[1] than
- * the (starti + 1) vert.
- *
- * This is not always going to be right, but it will work better in
- * the average case.
- */
- previ = clamp_index(starti - 1, lenv1);
- nexti = clamp_index(starti + 1, lenv1);
-
- /* avoid sqrt for comparison */
- if (len_squared_v3v3(vv1[nexti]->co, vv2[1]->co) > len_squared_v3v3(vv1[previ]->co, vv2[1]->co)) {
- /* reverse direction for reading vv1 (1 is forward, -1 is backward) */
- dir1 = -1;
+ /* compute summed length between vertices in backward direction */
+ len = 0.0f;
+ for (j = 0; j < lenv2; j++)
+ len += len_v3v3(vv1[clamp_index(i-j, lenv1)]->co, vv2[j]->co);
+
+ if (len < min) {
+ min = len;
+ starti = i;
+ dir1 = -1;
+ }
}
}
@@ -426,63 +428,108 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
}
}
- /* Generate the bridge quads */
- for (i = 0; i < BLI_array_count(ee1) && i < BLI_array_count(ee2); i++) {
- BMFace *f;
-
- BMLoop *l_1 = NULL;
- BMLoop *l_2 = NULL;
- BMLoop *l_1_next = NULL;
- BMLoop *l_2_next = NULL;
- BMLoop *l_iter;
- BMFace *f_example;
-
- int i1, i1next, i2, i2next;
-
- i1 = clamp_index(i * dir1 + starti, lenv1);
- i1next = clamp_index((i + 1) * dir1 + starti, lenv1);
- i2 = i;
- i2next = clamp_index(i + 1, lenv2);
-
- if (vv1[i1] == vv1[i1next]) {
- continue;
- }
-
- if (wdir < 0) {
- SWAP(int, i1, i1next);
- SWAP(int, i2, i2next);
+ /* merge loops of bridge faces */
+ if (use_merge) {
+ const int vert_len = mini(BLI_array_count(vv1), BLI_array_count(vv2)) - ((cl1 || cl2) ? 1 : 0);
+ const int edge_len = mini(BLI_array_count(ee1), BLI_array_count(ee2));
+
+ if (merge_factor <= 0.0f) {
+ /* 2 --> 1 */
+ for (i = 0; i < vert_len; i++) {
+ BM_vert_splice(bm, vv2[i], vv1[i]);
+ }
+ for (i = 0; i < edge_len; i++) {
+ BM_edge_splice(bm, ee2[i], ee1[i]);
+ }
}
-
- /* get loop data - before making the face */
- bm_vert_loop_pair(bm, vv1[i1], vv2[i2], &l_1, &l_2);
- bm_vert_loop_pair(bm, vv1[i1next], vv2[i2next], &l_1_next, &l_2_next);
- /* copy if loop data if its is missing on one ring */
- if (l_1 && l_1_next == NULL) l_1_next = l_1;
- if (l_1_next && l_1 == NULL) l_1 = l_1_next;
- if (l_2 && l_2_next == NULL) l_2_next = l_2;
- if (l_2_next && l_2 == NULL) l_2 = l_2_next;
- f_example = l_1 ? l_1->f : (l_2 ? l_2->f : NULL);
-
- f = BM_face_create_quad_tri(bm,
- vv1[i1],
- vv2[i2],
- vv2[i2next],
- vv1[i1next],
- f_example, TRUE);
- if (!f || f->len != 4) {
- fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
+ else if (merge_factor >= 1.0f) {
+ /* 1 --> 2 */
+ for (i = 0; i < vert_len; i++) {
+ BM_vert_splice(bm, vv1[i], vv2[i]);
+ }
+ for (i = 0; i < edge_len; i++) {
+ BM_edge_splice(bm, ee1[i], ee2[i]);
+ }
}
else {
- l_iter = BM_FACE_FIRST_LOOP(f);
+ /* mid factor, be tricky */
+ /* 1 --> 2 */
+ for (i = 0; i < vert_len; i++) {
+ BM_data_interp_from_verts(bm, vv1[i], vv2[i], vv2[i], merge_factor);
+ interp_v3_v3v3(vv2[i]->co, vv1[i]->co, vv2[i]->co, merge_factor);
+ BM_elem_flag_merge(vv1[i], vv2[i]);
+ BM_vert_splice(bm, vv1[i], vv2[i]);
+ }
+ for (i = 0; i < edge_len; i++) {
+ BM_data_interp_from_edges(bm, ee1[i], ee2[i], ee2[i], merge_factor);
+ BM_elem_flag_merge(ee1[i], ee2[i]);
+ BM_edge_splice(bm, ee1[i], ee2[i]);
+ }
+ }
+ }
+ else {
+ /* Generate the bridge quads */
+ for (i = 0; i < BLI_array_count(ee1) && i < BLI_array_count(ee2); i++) {
+ BMFace *f;
+
+ BMLoop *l_1 = NULL;
+ BMLoop *l_2 = NULL;
+ BMLoop *l_1_next = NULL;
+ BMLoop *l_2_next = NULL;
+ BMLoop *l_iter;
+ BMFace *f_example;
+
+ int i1, i1next, i2, i2next;
+
+ i1 = clamp_index(i * dir1 + starti, lenv1);
+ i1next = clamp_index((i + 1) * dir1 + starti, lenv1);
+ i2 = i;
+ i2next = clamp_index(i + 1, lenv2);
+
+ if (vv1[i1] == vv1[i1next]) {
+ continue;
+ }
- if (l_1) BM_elem_attrs_copy(bm, bm, l_1, l_iter); l_iter = l_iter->next;
- if (l_2) BM_elem_attrs_copy(bm, bm, l_2, l_iter); l_iter = l_iter->next;
- if (l_2_next) BM_elem_attrs_copy(bm, bm, l_2_next, l_iter); l_iter = l_iter->next;
- if (l_1_next) BM_elem_attrs_copy(bm, bm, l_1_next, l_iter);
+ if (wdir < 0) {
+ SWAP(int, i1, i1next);
+ SWAP(int, i2, i2next);
+ }
+
+ /* get loop data - before making the face */
+ bm_vert_loop_pair(bm, vv1[i1], vv2[i2], &l_1, &l_2);
+ bm_vert_loop_pair(bm, vv1[i1next], vv2[i2next], &l_1_next, &l_2_next);
+ /* copy if loop data if its is missing on one ring */
+ if (l_1 && l_1_next == NULL) l_1_next = l_1;
+ if (l_1_next && l_1 == NULL) l_1 = l_1_next;
+ if (l_2 && l_2_next == NULL) l_2_next = l_2;
+ if (l_2_next && l_2 == NULL) l_2 = l_2_next;
+ f_example = l_1 ? l_1->f : (l_2 ? l_2->f : NULL);
+
+ f = BM_face_create_quad_tri(bm,
+ vv1[i1],
+ vv2[i2],
+ vv2[i2next],
+ vv1[i1next],
+ f_example, TRUE);
+ if (!f || f->len != 4) {
+ fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
+ }
+ else {
+ BMO_elem_flag_enable(bm, f, FACE_OUT);
+
+ l_iter = BM_FACE_FIRST_LOOP(f);
+
+ if (l_1) BM_elem_attrs_copy(bm, bm, l_1, l_iter); l_iter = l_iter->next;
+ if (l_2) BM_elem_attrs_copy(bm, bm, l_2, l_iter); l_iter = l_iter->next;
+ if (l_2_next) BM_elem_attrs_copy(bm, bm, l_2_next, l_iter); l_iter = l_iter->next;
+ if (l_1_next) BM_elem_attrs_copy(bm, bm, l_1_next, l_iter);
+ }
}
}
}
+ BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_OUT);
+
cleanup:
BLI_array_free(ee1);
BLI_array_free(ee2);
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index db09c5f3d27..4723b631c5f 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -1415,6 +1415,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
/* create edge */
e = BM_edge_create(bm, verts[0], verts[1], NULL, TRUE);
BMO_elem_flag_enable(bm, e, ELE_OUT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
}
else if (0) { /* nice feature but perhaps it should be a different tool? */
@@ -1460,6 +1461,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
}
}
}
+ BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_OUT);
/* done creating edges */
}
else if (amount > 2) {
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 7b59a4a9101..9ea8e631435 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -380,10 +380,18 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
/* this should always be wire, so this is mainly a speedup to avoid map lookup */
if (BM_edge_is_wire(e) && BMO_slot_map_contains(bm, op, "exclude", e)) {
+ BMVert *v1 = e->v1, *v2 = e->v2;
+
/* The original edge was excluded,
* this would result in a standalone wire edge - see [#30399] */
BM_edge_kill(bm, e);
+ /* kill standalone vertices from this edge - see [#32341] */
+ if (!v1->e)
+ BM_vert_kill(bm, v1);
+ if (!v2->e)
+ BM_vert_kill(bm, v1);
+
continue;
}
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 1d73435032d..88ed1250264 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -182,14 +182,17 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
if (!usefaces) {
BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
- if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
- break;
+ if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
+ if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
+ break;
}
if (e) {
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
- BMO_elem_flag_enable(bm, e, SEL_FLAG);
- BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG);
+ if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
+ BMO_elem_flag_enable(bm, e, SEL_FLAG);
+ BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG);
+ }
}
}
}
@@ -202,8 +205,10 @@ static void bmo_region_extend_extend(BMesh *bm, BMOperator *op, int usefaces)
BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
- if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) {
- BMO_elem_flag_enable(bm, f2, SEL_FLAG);
+ if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
+ if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) {
+ BMO_elem_flag_enable(bm, f2, SEL_FLAG);
+ }
}
}
}
@@ -221,15 +226,18 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
if (!usefaces) {
BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
- if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
- break;
+ if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN))
+ if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
+ break;
}
if (e) {
BMO_elem_flag_enable(bm, v, SEL_FLAG);
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
- BMO_elem_flag_enable(bm, e, SEL_FLAG);
+ if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
+ BMO_elem_flag_enable(bm, e, SEL_FLAG);
+ }
}
}
@@ -243,9 +251,11 @@ static void bmo_region_extend_constrict(BMesh *bm, BMOperator *op, int usefaces)
BMO_ITER (f, &siter, bm, op, "geom", BM_FACE) {
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
- if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) {
- BMO_elem_flag_enable(bm, f, SEL_FLAG);
- break;
+ if (!BM_elem_flag_test(f2, BM_ELEM_HIDDEN)) {
+ if (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) {
+ BMO_elem_flag_enable(bm, f, SEL_FLAG);
+ break;
+ }
}
}
}
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 0a7832e9d64..7fd39765cc9 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -96,7 +96,7 @@ public:
protected:
const ExportSettings *export_settings;
- void dae_animation(Object* ob, FCurve *fcu, char* transformName, bool is_param, Material *ma = NULL);
+ void dae_animation(Object *ob, FCurve *fcu, char *transformName, bool is_param, Material *ma = NULL);
void write_bone_animation_matrix(Object *ob_arm, Bone *bone);
@@ -161,7 +161,7 @@ protected:
bool hasAnimations(Scene *sce);
- char* extract_transform_name(char *rna_path);
+ char *extract_transform_name(char *rna_path);
std::string getObjectBoneName(Object *ob, const FCurve * fcu);
};
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index a237222774d..d241926c20c 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -561,7 +561,7 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
case COLLADAFW::Transformation::MATRIX:
/*{
- COLLADAFW::Matrix* mat = (COLLADAFW::Matrix*)transform;
+ COLLADAFW::Matrix *mat = (COLLADAFW::Matrix*)transform;
COLLADABU::Math::Matrix4 mat4 = mat->getMatrix();
switch (binding->animationClass) {
case COLLADAFW::AnimationList::TRANSFORM:
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 2d9ccc3e3ef..dd59fb9fb91 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -313,42 +313,48 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
std::set<Image *> uv_textures;
if (ob->type == OB_MESH && ob->totcol && this->export_settings->include_uv_textures) {
+ bool active_uv_only = this->export_settings->active_uv_only;
Mesh *me = (Mesh *) ob->data;
+ int active_uv_layer = CustomData_get_active_layer_index(&me->pdata, CD_MTEXPOLY);
+
BKE_mesh_tessface_ensure(me);
for (int i = 0; i < me->pdata.totlayer; i++) {
- if (me->pdata.layers[i].type == CD_MTEXPOLY) {
- MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
- MFace *mface = me->mface;
- for (int j = 0; j < me->totpoly; j++, mface++, txface++) {
-
- Material *mat = give_current_material(ob, mface->mat_nr + 1);
- if (mat != ma)
- continue;
-
- Image *ima = txface->tpage;
- if (ima == NULL)
- continue;
-
-
- bool not_in_list = uv_textures.find(ima)==uv_textures.end();
- if (not_in_list) {
- std::string name = id_name(ima);
- std::string key(name);
- key = translate_id(key);
-
- // create only one <sampler>/<surface> pair for each unique image
- if (im_samp_map.find(key) == im_samp_map.end()) {
- //<newparam> <sampler> <source>
- COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
- key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
- key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
- sampler.setImageId(key);
- samplers[a] = sampler;
- samp_surf[b][0] = &samplers[a];
- im_samp_map[key] = b;
- b++;
- a++;
- uv_textures.insert(ima);
+ if (!active_uv_only || active_uv_layer == i)
+ {
+ if (me->pdata.layers[i].type == CD_MTEXPOLY) {
+ MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
+ MFace *mface = me->mface;
+ for (int j = 0; j < me->totpoly; j++, mface++, txface++) {
+
+ Material *mat = give_current_material(ob, mface->mat_nr + 1);
+ if (mat != ma)
+ continue;
+
+ Image *ima = txface->tpage;
+ if (ima == NULL)
+ continue;
+
+
+ bool not_in_list = uv_textures.find(ima)==uv_textures.end();
+ if (not_in_list) {
+ std::string name = id_name(ima);
+ std::string key(name);
+ key = translate_id(key);
+
+ // create only one <sampler>/<surface> pair for each unique image
+ if (im_samp_map.find(key) == im_samp_map.end()) {
+ //<newparam> <sampler> <source>
+ COLLADASW::Sampler sampler(COLLADASW::Sampler::SAMPLER_TYPE_2D,
+ key + COLLADASW::Sampler::SAMPLER_SID_SUFFIX,
+ key + COLLADASW::Sampler::SURFACE_SID_SUFFIX);
+ sampler.setImageId(key);
+ samplers[a] = sampler;
+ samp_surf[b][0] = &samplers[a];
+ im_samp_map[key] = b;
+ b++;
+ a++;
+ uv_textures.insert(ima);
+ }
}
}
}
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 29ffcf53ee9..c7ad2ff3975 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -279,15 +279,18 @@ void GeometryExporter::createPolylist(short material_index,
// if mesh has uv coords writes <input> for TEXCOORD
int num_layers = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
-
+ int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE)-1;
for (i = 0; i < num_layers; i++) {
- // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
- COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
- makeUrl(makeTexcoordSourceId(geom_id, i)),
- 2, // offset always 2, this is only until we have optimized UV sets
- i // set number equals UV map index
- );
- til.push_back(input3);
+ if (!this->export_settings->active_uv_only || i == active_uv_index) {
+
+ // char *name = CustomData_get_layer_name(&me->fdata, CD_MTFACE, i);
+ COLLADASW::Input input3(COLLADASW::InputSemantic::TEXCOORD,
+ makeUrl(makeTexcoordSourceId(geom_id, i)),
+ 2, // offset always 2, this is only until we have optimized UV sets
+ i // set number equals UV map index
+ );
+ til.push_back(input3);
+ }
}
if (has_color) {
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index 206dc09fe8b..66dcec7d8e4 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -151,25 +151,31 @@ void ImagesExporter::export_UV_Images()
{
std::set<Image *> uv_textures;
LinkNode *node;
- bool use_copies = this->export_settings->use_texture_copies;
+ bool use_texture_copies = this->export_settings->use_texture_copies;
+ bool active_uv_only = this->export_settings->active_uv_only;
+
for (node = this->export_settings->export_set; node; node = node->next) {
Object *ob = (Object *)node->link;
if (ob->type == OB_MESH && ob->totcol) {
Mesh *me = (Mesh *) ob->data;
BKE_mesh_tessface_ensure(me);
+ int active_uv_layer = CustomData_get_active_layer_index(&me->pdata, CD_MTEXPOLY);
for (int i = 0; i < me->pdata.totlayer; i++) {
if (me->pdata.layers[i].type == CD_MTEXPOLY) {
- MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
- for (int j = 0; j < me->totpoly; j++, txface++) {
-
- Image *ima = txface->tpage;
- if (ima == NULL)
- continue;
-
- bool not_in_list = uv_textures.find(ima) == uv_textures.end();
- if (not_in_list) {
- uv_textures.insert(ima);
- export_UV_Image(ima, use_copies);
+ if (!active_uv_only || active_uv_layer == i)
+ {
+ MTexPoly *txface = (MTexPoly *)me->pdata.layers[i].data;
+ for (int j = 0; j < me->totpoly; j++, txface++) {
+
+ Image *ima = txface->tpage;
+ if (ima == NULL)
+ continue;
+
+ bool not_in_list = uv_textures.find(ima) == uv_textures.end();
+ if (not_in_list) {
+ uv_textures.insert(ima);
+ export_UV_Image(ima, use_texture_copies);
+ }
}
}
}
diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp
index be45d5295e5..71371d280df 100644
--- a/source/blender/collada/InstanceWriter.cpp
+++ b/source/blender/collada/InstanceWriter.cpp
@@ -63,7 +63,7 @@ void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_materia
int active_uv_index = CustomData_get_active_layer_index(&me->fdata, CD_MTFACE) -1;
for (int b = 0; b < totlayer; b++) {
if (!active_uv_only || b == active_uv_index) {
- char *name = bc_CustomData_get_layer_name(&me->fdata, CD_MTFACE, map_index);
+ char *name = bc_CustomData_get_layer_name(&me->fdata, CD_MTFACE, b);
im.push_back(COLLADASW::BindVertexInput(name, "TEXCOORD", map_index++));
}
}
diff --git a/source/blender/collada/TransformReader.h b/source/blender/collada/TransformReader.h
index a08f4438d73..47e59a1bf52 100644
--- a/source/blender/collada/TransformReader.h
+++ b/source/blender/collada/TransformReader.h
@@ -56,7 +56,7 @@ public:
COLLADAFW::Transformation *tm; // which transform is animated by an AnimationList->id
};
- TransformReader(UnitConverter* conv);
+ TransformReader(UnitConverter *conv);
void get_node_mat(float mat[][4], COLLADAFW::Node *node, std::map<COLLADAFW::UniqueId, Animation> *animation_map, Object *ob);
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index b64c75e7960..c1f75f996ce 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -59,7 +59,7 @@ public:
// Initialize with Z_UP, since Blender uses right-handed, z-up
UnitConverter();
- void read_asset(const COLLADAFW::FileInfo* asset);
+ void read_asset(const COLLADAFW::FileInfo *asset);
void convertVector3(COLLADABU::Math::Vector3 &vec, float *v);
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index 65d46bf515a..9932ed17378 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -284,6 +284,8 @@ set(SRC
nodes/COM_FilterNode.cpp
nodes/COM_FilterNode.h
+ nodes/COM_DespeckleNode.cpp
+ nodes/COM_DespeckleNode.h
nodes/COM_DilateErodeNode.cpp
nodes/COM_DilateErodeNode.h
nodes/COM_InpaintNode.cpp
@@ -473,8 +475,10 @@ set(SRC
operations/COM_DifferenceMatteOperation.h
operations/COM_LuminanceMatteOperation.cpp
operations/COM_LuminanceMatteOperation.h
- operations/COM_DistanceMatteOperation.cpp
- operations/COM_DistanceMatteOperation.h
+ operations/COM_DistanceRGBMatteOperation.cpp
+ operations/COM_DistanceRGBMatteOperation.h
+ operations/COM_DistanceYCCMatteOperation.cpp
+ operations/COM_DistanceYCCMatteOperation.h
operations/COM_ChromaMatteOperation.cpp
operations/COM_ChromaMatteOperation.h
operations/COM_ColorMatteOperation.cpp
@@ -590,6 +594,8 @@ set(SRC
operations/COM_ConvolutionFilterOperation.cpp
operations/COM_ConvolutionEdgeFilterOperation.h
operations/COM_ConvolutionEdgeFilterOperation.cpp
+ operations/COM_DespeckleOperation.cpp
+ operations/COM_DespeckleOperation.h
operations/COM_DilateErodeOperation.cpp
operations/COM_DilateErodeOperation.h
operations/COM_InpaintOperation.cpp
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.cpp b/source/blender/compositor/intern/COM_ChunkOrder.cpp
index 38a3350c263..1b7c435ecea 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrder.cpp
@@ -45,7 +45,7 @@ void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int nu
this->m_distance = distance;
}
-bool operator<(const ChunkOrder& a, const ChunkOrder& b)
+bool operator<(const ChunkOrder &a, const ChunkOrder &b)
{
return a.m_distance < b.m_distance;
}
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.h b/source/blender/compositor/intern/COM_ChunkOrder.h
index 190ecb9c380..108836d5299 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.h
+++ b/source/blender/compositor/intern/COM_ChunkOrder.h
@@ -33,7 +33,7 @@ private:
public:
ChunkOrder();
void determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots);
- friend bool operator<(const ChunkOrder& a, const ChunkOrder& b);
+ friend bool operator<(const ChunkOrder &a, const ChunkOrder &b);
void setChunkNumber(unsigned int chunknumber) { this->m_number = chunknumber; }
void setX(int x) { this->m_x = x; }
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 37b53c44ef7..d4fad80ed07 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -56,6 +56,7 @@
#include "COM_Converter.h"
#include "COM_CropNode.h"
#include "COM_DefocusNode.h"
+#include "COM_DespeckleNode.h"
#include "COM_DifferenceMatteNode.h"
#include "COM_DilateErodeNode.h"
#include "COM_DirectionalBlurNode.h"
@@ -307,6 +308,9 @@ Node *Converter::convert(bNode *b_node, bool fast)
case CMP_NODE_INPAINT:
node = new InpaintNode(b_node);
break;
+ case CMP_NODE_DESPECKLE:
+ node = new DespeckleNode(b_node);
+ break;
case CMP_NODE_LENSDIST:
node = new LensDistortionNode(b_node);
break;
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index 9a80c5e82ae..5c891705089 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -38,6 +38,7 @@
#include "COM_ChunkOrder.h"
#include "COM_ExecutionSystemHelper.h"
+#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "PIL_time.h"
#include "WM_api.h"
@@ -148,14 +149,14 @@ NodeOperation *ExecutionGroup::getOutputNodeOperation() const
void ExecutionGroup::initExecution()
{
if (this->m_chunkExecutionStates != NULL) {
- delete[] this->m_chunkExecutionStates;
+ MEM_freeN(this->m_chunkExecutionStates);
}
unsigned int index;
determineNumberOfChunks();
this->m_chunkExecutionStates = NULL;
if (this->m_numberOfChunks != 0) {
- this->m_chunkExecutionStates = new ChunkExecutionState[this->m_numberOfChunks];
+ this->m_chunkExecutionStates = (ChunkExecutionState *)MEM_mallocN(sizeof(ChunkExecutionState) * this->m_numberOfChunks, __func__);
for (index = 0; index < this->m_numberOfChunks; index++) {
this->m_chunkExecutionStates[index] = COM_ES_NOT_SCHEDULED;
}
@@ -180,7 +181,7 @@ void ExecutionGroup::initExecution()
void ExecutionGroup::deinitExecution()
{
if (this->m_chunkExecutionStates != NULL) {
- delete[] this->m_chunkExecutionStates;
+ MEM_freeN(this->m_chunkExecutionStates);
this->m_chunkExecutionStates = NULL;
}
this->m_numberOfChunks = 0;
@@ -217,7 +218,7 @@ void ExecutionGroup::determineNumberOfChunks()
*/
void ExecutionGroup::execute(ExecutionSystem *graph)
{
- CompositorContext& context = graph->getContext();
+ CompositorContext &context = graph->getContext();
const bNodeTree *bTree = context.getbNodeTree();
if (this->m_width == 0 || this->m_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
@@ -227,7 +228,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
this->m_chunksFinished = 0;
this->m_bTree = bTree;
unsigned int index;
- unsigned int *chunkOrder = new unsigned int[this->m_numberOfChunks];
+ unsigned int *chunkOrder = (unsigned int *)MEM_mallocN(sizeof(unsigned int) * this->m_numberOfChunks, __func__);
for (chunkNumber = 0; chunkNumber < this->m_numberOfChunks; chunkNumber++) {
chunkOrder[chunkNumber] = chunkNumber;
@@ -256,10 +257,10 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
break;
case COM_TO_CENTER_OUT:
{
- ChunkOrderHotspot **hotspots = new ChunkOrderHotspot *[1];
+ ChunkOrderHotspot *hotspots[1];
hotspots[0] = new ChunkOrderHotspot(this->m_width * centerX, this->m_height * centerY, 0.0f);
rcti rect;
- ChunkOrder *chunkOrders = new ChunkOrder[this->m_numberOfChunks];
+ ChunkOrder *chunkOrders = (ChunkOrder *)MEM_mallocN(sizeof(ChunkOrder) * this->m_numberOfChunks, __func__);
for (index = 0; index < this->m_numberOfChunks; index++) {
determineChunkRect(&rect, index);
chunkOrders[index].setChunkNumber(index);
@@ -274,13 +275,12 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
}
delete hotspots[0];
- delete[] hotspots;
- delete[] chunkOrders;
+ MEM_freeN(chunkOrders);
}
break;
case COM_TO_RULE_OF_THIRDS:
{
- ChunkOrderHotspot **hotspots = new ChunkOrderHotspot *[9];
+ ChunkOrderHotspot *hotspots[9];
unsigned int tx = this->m_width / 6;
unsigned int ty = this->m_height / 6;
unsigned int mx = this->m_width / 2;
@@ -299,7 +299,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
hotspots[7] = new ChunkOrderHotspot(mx, ty, addition * 7);
hotspots[8] = new ChunkOrderHotspot(mx, by, addition * 8);
rcti rect;
- ChunkOrder *chunkOrders = new ChunkOrder[this->m_numberOfChunks];
+ ChunkOrder *chunkOrders = (ChunkOrder *)MEM_mallocN(sizeof(ChunkOrder) * this->m_numberOfChunks, __func__);
for (index = 0; index < this->m_numberOfChunks; index++) {
determineChunkRect(&rect, index);
chunkOrders[index].setChunkNumber(index);
@@ -323,8 +323,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete hotspots[6];
delete hotspots[7];
delete hotspots[8];
- delete[] hotspots;
- delete[] chunkOrders;
+ MEM_freeN(chunkOrders);
}
break;
case COM_TO_TOP_DOWN:
@@ -372,7 +371,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
}
}
- delete[] chunkOrder;
+ MEM_freeN(chunkOrder);
}
MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
@@ -383,10 +382,7 @@ MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
determineChunkRect(&rect, chunkNumber);
this->determineDependingMemoryProxies(&memoryproxies);
- MemoryBuffer **memoryBuffers = new MemoryBuffer *[this->m_cachedMaxReadBufferOffset];
- for (index = 0; index < this->m_cachedMaxReadBufferOffset; index++) {
- memoryBuffers[index] = NULL;
- }
+ MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN(sizeof(MemoryBuffer *) * this->m_cachedMaxReadBufferOffset, __func__);
rcti output;
for (index = 0; index < this->m_cachedReadOperations.size(); index++) {
ReadBufferOperation *readOperation = (ReadBufferOperation *)this->m_cachedReadOperations[index];
@@ -422,7 +418,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo
}
}
}
- delete[] memoryBuffers;
+ MEM_freeN(memoryBuffers);
}
if (this->m_bTree) {
// status report is only performed for top level Execution Groups.
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h
index ac849bf4f6c..39e7bc80279 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.h
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.h
@@ -200,12 +200,12 @@ public:
/**
* @brief get the reference to the compositor context
*/
- CompositorContext& getContext() { return this->m_context; }
+ CompositorContext &getContext() { return this->m_context; }
/**
* @brief get the reference to the compositor nodes
*/
- vector<Node *>& getNodes() { return this->m_nodes; }
+ vector<Node *> &getNodes() { return this->m_nodes; }
/**
* @brief get the reference to the compositor connections
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 3b8fbd6d708..0994f3f8890 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -75,7 +75,7 @@ float *MemoryBuffer::convertToValueBuffer()
const unsigned int size = this->determineBufferSize();
unsigned int i;
- float *result = new float[size];
+ float *result = (float *)MEM_mallocN(sizeof(float) * size, __func__);
const float *fp_src = this->m_buffer;
float *fp_dst = result;
@@ -259,7 +259,10 @@ float clipuv(float x, float limit)
return x;
}
-void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float dy)
+/**
+ * \note \a sampler at the moment is either 'COM_PS_NEAREST' or not, other values won't matter.
+ */
+void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float dy, PixelSampler sampler)
{
const int width = this->getWidth(), height = this->getHeight();
@@ -280,7 +283,14 @@ 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;
+
+ /* note: 0.765625f is too sharp, 1.0 will not blur with an exact pixel sample
+ * useful to avoid blurring when there is no distortion */
+#if 0
+ const float rmin = ((sampler != COM_PS_NEAREST) ? 1.5625f : 0.765625f) / ff2;
+#else
+ const float rmin = ((sampler != COM_PS_NEAREST) ? 1.5625f : 1.0f ) / ff2;
+#endif
imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
if ((b2 = b * b) < rmin) {
if ((a2 = a * a) < rmin) {
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index 5d0d9c97450..d176298578f 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -202,7 +202,7 @@ public:
- void readEWA(float result[4], float fx, float fy, float dx, float dy);
+ void readEWA(float result[4], float fx, float fy, float dx, float dy, PixelSampler sampler);
/**
* @brief is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk)
diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h
index 279ca8ebdb8..01e1403b021 100644
--- a/source/blender/compositor/intern/COM_SocketReader.h
+++ b/source/blender/compositor/intern/COM_SocketReader.h
@@ -88,7 +88,7 @@ protected:
* @param dy
* @param inputBuffers chunks that can be read by their ReadBufferOperation.
*/
- virtual void executePixel(float output[4], float x, float y, float dx, float dy) {}
+ virtual void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler) {}
public:
inline void read(float *result, float x, float y, PixelSampler sampler) {
@@ -97,8 +97,8 @@ public:
inline void read(float *result, int x, int y, void *chunkData) {
executePixel(result, x, y, chunkData);
}
- inline void read(float *result, float x, float y, float dx, float dy) {
- executePixel(result, x, y, dx, dy);
+ inline void read(float *result, float x, float y, float dx, float dy, PixelSampler sampler) {
+ executePixel(result, x, y, dx, dy, sampler);
}
virtual void *initializeTileData(rcti *rect) { return 0; }
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index 61b18a6daf4..5f133fe071f 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -32,6 +32,8 @@
#include "OCL_opencl.h"
#include "COM_WriteBufferOperation.h"
+#include "MEM_guardedalloc.h"
+
#include "PIL_time.h"
#include "BLI_threads.h"
@@ -99,20 +101,20 @@ void **g_highlightedNodesRead;
void COM_startReadHighlights()
{
if (g_highlightedNodesRead) {
- delete [] g_highlightedNodesRead;
+ MEM_freeN(g_highlightedNodesRead);
}
g_highlightedNodesRead = g_highlightedNodes;
- g_highlightedNodes = new void *[MAX_HIGHLIGHT];
+ g_highlightedNodes = (void **)MEM_callocN(sizeof(void *) * MAX_HIGHLIGHT, __func__);
g_highlightIndex = 0;
- for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
- g_highlightedNodes[i] = 0;
- }
}
int COM_isHighlightedbNode(bNode *bnode)
{
- if (!g_highlightedNodesRead) return false;
+ if (!g_highlightedNodesRead) {
+ return false;
+ }
+
for (int i = 0 ; i < MAX_HIGHLIGHT; i++) {
void *p = g_highlightedNodesRead[i];
if (!p) return false;
@@ -255,8 +257,12 @@ extern void clContextError(const char *errinfo, const void *private_info, size_t
void WorkScheduler::initialize()
{
- g_highlightedNodesRead = 0;
- g_highlightedNodes = 0;
+ if (g_highlightedNodesRead) MEM_freeN(g_highlightedNodesRead);
+ if (g_highlightedNodes) MEM_freeN(g_highlightedNodes);
+
+ g_highlightedNodesRead = NULL;
+ g_highlightedNodes = NULL;
+
COM_startReadHighlights();
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
int numberOfCPUThreads = BLI_system_thread_count();
@@ -275,7 +281,7 @@ void WorkScheduler::initialize()
error = clGetPlatformIDs(0, 0, &numberOfPlatforms);
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];
+ cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN(sizeof(cl_platform_id) * numberOfPlatforms, __func__);
error = clGetPlatformIDs(numberOfPlatforms, platforms, 0);
unsigned int indexPlatform;
for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
@@ -283,7 +289,7 @@ void WorkScheduler::initialize()
cl_uint numberOfDevices = 0;
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices);
if (numberOfDevices > 0) {
- cl_device_id *cldevices = new cl_device_id[numberOfDevices];
+ cl_device_id *cldevices = (cl_device_id *)MEM_mallocN(sizeof(cl_device_id) * numberOfDevices, __func__);
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, 0);
g_context = clCreateContext(NULL, numberOfDevices, cldevices, clContextError, NULL, &error);
@@ -297,12 +303,12 @@ void WorkScheduler::initialize()
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
error2 = clGetProgramBuildInfo(g_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];
+ char *build_log = (char *)MEM_mallocN(sizeof(char) * ret_val_size + 1, __func__);
error2 = clGetProgramBuildInfo(g_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)); }
build_log[ret_val_size] = '\0';
printf("%s", build_log);
- delete build_log;
+ MEM_freeN(build_log);
}
else {
unsigned int indexDevices;
@@ -316,10 +322,10 @@ void WorkScheduler::initialize()
g_gpudevices.push_back(clDevice);
}
}
- delete[] cldevices;
+ MEM_freeN(cldevices);
}
}
- delete[] platforms;
+ MEM_freeN(platforms);
}
#endif
#endif
@@ -352,5 +358,13 @@ void WorkScheduler::deinitialize()
}
#endif
#endif
+
+ if (g_highlightedNodes) {
+ MEM_freeN(g_highlightedNodes);
+ }
+
+ if (g_highlightedNodesRead) {
+ MEM_freeN(g_highlightedNodesRead);
+ }
}
diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp
index 93ef002c8d7..e39ef2b3f23 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -74,14 +74,18 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
operationx->setbNode(editorNode);
operationx->setQuality(quality);
operationx->setSize(1.0f);
+ operationx->setFalloff(PROP_SMOOTH);
+ operationx->setSubtract(false);
addLink(graph, clamp->getOutputSocket(), operationx->getInputSocket(0));
graph->addOperation(operationx);
- GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
+ GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
operationy->setData(data);
operationy->setbNode(editorNode);
operationy->setQuality(quality);
operationy->setSize(1.0f);
+ operationy->setFalloff(PROP_SMOOTH);
+ operationy->setSubtract(false);
addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
graph->addOperation(operationy);
diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
index 9abf97aa16f..70f20e3235b 100644
--- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp
@@ -38,7 +38,11 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
{
bNode *b_node = this->getbNode();
- if (b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
+ InputSocket *inputSizeSocket = this->getInputSocket(2);
+
+ bool connectedSizeSocket = inputSizeSocket->isConnected();
+
+ if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connectedSizeSocket) {
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
@@ -55,9 +59,6 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
}
else {
BokehBlurOperation *operation = new BokehBlurOperation();
- InputSocket *inputSizeSocket = this->getInputSocket(2);
-
- bool connectedSizeSocket = inputSizeSocket->isConnected();
const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket();
const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cpp b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
new file mode 100644
index 00000000000..603ddcd1389
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.cpp
@@ -0,0 +1,50 @@
+/*
+ * 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: Campbell Barton
+ */
+
+#include "COM_DespeckleNode.h"
+#include "DNA_scene_types.h"
+#include "COM_ExecutionSystem.h"
+#include "COM_DespeckleOperation.h"
+#include "BLI_math.h"
+
+DespeckleNode::DespeckleNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
+
+void DespeckleNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+{
+ bNode *editorNode = this->getbNode();
+ InputSocket *inputSocket = this->getInputSocket(0);
+ InputSocket *inputImageSocket = this->getInputSocket(1);
+ OutputSocket *outputSocket = this->getOutputSocket(0);
+ DespeckleOperation *operation = new DespeckleOperation();
+
+ operation->setbNode(editorNode);
+ operation->setThreshold(editorNode->custom3);
+ operation->setThresholdNeighbour(editorNode->custom4);
+
+ inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
+ inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
+ outputSocket->relinkConnections(operation->getOutputSocket());
+ addPreviewOperation(graph, operation->getOutputSocket(0));
+
+ graph->addOperation(operation);
+}
diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.h b/source/blender/compositor/nodes/COM_DespeckleNode.h
new file mode 100644
index 00000000000..2b8ab9d0226
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_DespeckleNode.h
@@ -0,0 +1,36 @@
+/*
+ * 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: Campbell Barton
+ */
+
+#ifndef _COM_DespeckleNode_h_
+#define _COM_DespeckleNode_h_
+
+#include "COM_Node.h"
+
+/**
+ * @brief DespeckleNode
+ * @ingroup Node
+ */
+class DespeckleNode : public Node {
+public:
+ DespeckleNode(bNode *editorNode);
+ void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+};
+
+#endif
diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
index d6730ef6a00..87e7b9d0788 100644
--- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
+++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
@@ -21,8 +21,10 @@
#include "COM_DistanceMatteNode.h"
#include "BKE_node.h"
-#include "COM_DistanceMatteOperation.h"
+#include "COM_DistanceRGBMatteOperation.h"
+#include "COM_DistanceYCCMatteOperation.h"
#include "COM_SetAlphaOperation.h"
+#include "COM_ConvertRGBToYCCOperation.h"
DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode)
{
@@ -36,12 +38,33 @@ void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCo
OutputSocket *outputSocketImage = this->getOutputSocket(0);
OutputSocket *outputSocketMatte = this->getOutputSocket(1);
- DistanceMatteOperation *operation = new DistanceMatteOperation();
+ NodeOperation *operation;
bNode *editorsnode = getbNode();
- operation->setSettings((NodeChroma *)editorsnode->storage);
+ NodeChroma *storage = (NodeChroma *)editorsnode->storage;
- inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
- inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
+ /* work in RGB color space */
+ if (storage->channel == 1) {
+ operation = new DistanceRGBMatteOperation();
+ ((DistanceRGBMatteOperation *) operation)->setSettings(storage);
+
+ inputSocketImage->relinkConnections(operation->getInputSocket(0), 0, graph);
+ inputSocketKey->relinkConnections(operation->getInputSocket(1), 1, graph);
+ }
+ /* work in YCbCr color space */
+ else {
+ operation = new DistanceYCCMatteOperation();
+ ((DistanceYCCMatteOperation *) operation)->setSettings(storage);
+
+ ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation();
+ inputSocketImage->relinkConnections(operationYCCImage->getInputSocket(0), 0, graph);
+ addLink(graph, operationYCCImage->getOutputSocket(), operation->getInputSocket(0));
+ graph->addOperation(operationYCCImage);
+
+ ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation();
+ inputSocketKey->relinkConnections(operationYCCMatte->getInputSocket(0), 1, graph);
+ addLink(graph, operationYCCMatte->getOutputSocket(), operation->getInputSocket(1));
+ graph->addOperation(operationYCCMatte);
+ }
if (outputSocketMatte->isConnected()) {
outputSocketMatte->relinkConnections(operation->getOutputSocket());
diff --git a/source/blender/compositor/nodes/COM_TimeNode.cpp b/source/blender/compositor/nodes/COM_TimeNode.cpp
index 84ee4e77b06..00ca797bd9b 100644
--- a/source/blender/compositor/nodes/COM_TimeNode.cpp
+++ b/source/blender/compositor/nodes/COM_TimeNode.cpp
@@ -53,6 +53,7 @@ void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
fac = (context->getFramenumber() - node->custom1) / (float)(node->custom2 - node->custom1);
}
+ curvemapping_initialize((CurveMapping *)node->storage);
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/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
index 12bf651992e..c37830a9d92 100644
--- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
+++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp
@@ -23,6 +23,10 @@
#include "COM_AntiAliasOperation.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BKE_utildefines.h"
+
+#include "MEM_guardedalloc.h"
+
extern "C" {
#include "RE_render_ext.h"
}
@@ -58,7 +62,7 @@ void AntiAliasOperation::deinitExecution()
{
this->m_valueReader = NULL;
if (this->m_buffer) {
- delete this->m_buffer;
+ MEM_freeN(this->m_buffer);
}
NodeOperation::deinitMutex();
}
@@ -90,12 +94,10 @@ void *AntiAliasOperation::initializeTileData(rcti *rect)
MemoryBuffer *tile = (MemoryBuffer *)this->m_valueReader->initializeTileData(rect);
int size = tile->getHeight() * tile->getWidth();
float *input = tile->getBuffer();
- char *valuebuffer = new char[size];
+ char *valuebuffer = (char *)MEM_mallocN(sizeof(char) * size, __func__);
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; }
- valuebuffer[i] = in * 255;
+ valuebuffer[i] = FTOCHAR(in);
}
antialias_tagbuf(tile->getWidth(), tile->getHeight(), valuebuffer);
this->m_buffer = valuebuffer;
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index 98aeba41ecb..39a0014ac41 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -22,6 +22,7 @@
#include "COM_BlurBaseOperation.h"
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
extern "C" {
#include "RE_pipeline.h"
@@ -74,7 +75,7 @@ float *BlurBaseOperation::make_gausstab(int rad)
n = 2 * rad + 1;
- gausstab = new float[n];
+ gausstab = (float *)MEM_mallocN(sizeof(float) * n, __func__);
sum = 0.0f;
for (i = -rad; i <= rad; i++) {
@@ -99,7 +100,7 @@ float *BlurBaseOperation::make_dist_fac_inverse(int rad, int falloff)
n = 2 * rad + 1;
- dist_fac_invert = new float[n];
+ dist_fac_invert = (float *)MEM_mallocN(sizeof(float) * n, __func__);
for (i = -rad; i <= rad; i++) {
val = 1.0f - fabsf(((float)i / (float)rad));
@@ -120,6 +121,11 @@ float *BlurBaseOperation::make_dist_fac_inverse(int rad, int falloff)
val = val * val;
break;
case PROP_LIN:
+#ifndef NDEBUG
+ /* uninitialized! */
+ case -1:
+ BLI_assert(0);
+#endif
default:
/* nothing */
break;
diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h
index fe86e162eb2..44c4c0cfe27 100644
--- a/source/blender/compositor/operations/COM_BokehImageOperation.h
+++ b/source/blender/compositor/operations/COM_BokehImageOperation.h
@@ -24,42 +24,125 @@
#define _COM_BokehImageOperation_h
#include "COM_NodeOperation.h"
-
+/**
+ * @brief The BokehImageOperation class is an operation that creates an image useful to mimic the internals
+ *of a camera.
+ *
+ * features:
+ * - number of flaps
+ * - angle offset of the flaps
+ * - rounding of the flaps (also used to make a circular lens)
+ * - simulate catadioptric
+ * - simulate lensshift
+ *
+ * Per pixel the algorithm determines the edge of the bokeh on the same line as the center of the image and the pixel
+ * is evaluating.
+ *
+ * The edge is detected by finding the closest point on the direct line between the two nearest flap-corners.
+ * this edge is interpolated with a full circle.
+ * Result of this edge detection is stored as the distance between the center of the image and the edge.
+ *
+ * catadioptric lenses are simulated to interpolate between the center of the image and the distance of the edge.
+ * We now have three distances:
+ * - distance between the center of the image and the pixel to be evaluated
+ * - distance between the center of the image and the outer-edge
+ * - distance between the center of the image and the inner-edge
+ *
+ * With a simple compare it can be detected if the evaluated pixel is between the outer and inner edge.
+ */
class BokehImageOperation : public NodeOperation {
private:
+ /**
+ * @brief Settings of the bokeh image
+ */
NodeBokehImage *m_data;
+ /**
+ * @brief precalced center of the image
+ */
float m_center[2];
+
+ /**
+ * @brief 1.0-rounding
+ */
float m_inverseRounding;
+
+ /**
+ * @brief distance of a full circle lens
+ */
float m_circularDistance;
+
+ /**
+ * @brief radius when the first flap starts
+ */
float m_flapRad;
+
+ /**
+ * @brief radians of a single flap
+ */
float m_flapRadAdd;
+ /**
+ * @brief should the m_data field by deleted when this operation is finished
+ */
bool m_deleteData;
+ /**
+ * @brief detemine the coordinate of a flap cornder
+ *
+ * @param r result in bokehimage space are stored [x,y]
+ * @param flapNumber the flap number to calculate
+ * @param distance the lens distance is used to simulate lens shifts
+ */
void detemineStartPointOfFlap(float r[2], int flapNumber, float distance);
+
+ /**
+ * @brief Determine if a coordinate is inside the bokeh image
+ *
+ * @param distance the distance that will be used. This parameter is modified a bit to mimic lens shifts
+ * @param x the x coordinate of the pixel to evaluate
+ * @param y the y coordinate of the pixel to evaluate
+ * @return float range 0..1 0 is completely outside
+ */
float isInsideBokeh(float distance, float x, float y);
public:
BokehImageOperation();
/**
- * the inner loop of this program
+ * @brief the inner loop of this program
*/
void executePixel(float output[4], float x, float y, PixelSampler sampler);
/**
- * Initialize the execution
+ * @brief Initialize the execution
*/
void initExecution();
/**
- * Deinitialize the execution
+ * @brief Deinitialize the execution
*/
void deinitExecution();
+ /**
+ * @brief determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, COM_BLUR_BOKEH_PIXELS]
+ * @param resolution
+ * @param preferredResolution
+ */
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+ /**
+ * @brief set the node data
+ * @param data
+ */
void setData(NodeBokehImage *data) { this->m_data = data; }
+
+ /**
+ * @brief deleteDataOnFinish
+ *
+ * There are cases that the compositor uses this operation on its own (see defocus node)
+ * the deleteDataOnFinish must only be called when the data has been created by the compositor.
+ *It should not be called when the data has been created by the node-editor/user.
+ */
void deleteDataOnFinish() { this->m_deleteData = true; }
};
#endif
diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
index dfbbef8c56e..aa4d0932c92 100644
--- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp
@@ -61,9 +61,9 @@ void ColorBalanceASCCDLOperation::executePixel(float output[4], float x, float y
fac = min(1.0f, fac);
const float mfac = 1.0f - fac;
- output[0] = mfac * inputColor[0] + fac *colorbalance_cdl(inputColor[0], this->m_lift[0], this->m_gamma[0], this->m_gain[0]);
- output[1] = mfac * inputColor[1] + fac *colorbalance_cdl(inputColor[1], this->m_lift[1], this->m_gamma[1], this->m_gain[1]);
- output[2] = mfac * inputColor[2] + fac *colorbalance_cdl(inputColor[2], this->m_lift[2], this->m_gamma[2], this->m_gain[2]);
+ output[0] = mfac * inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->m_lift[0], this->m_gamma[0], this->m_gain[0]);
+ output[1] = mfac * inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->m_lift[1], this->m_gamma[1], this->m_gain[1]);
+ output[2] = mfac * inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->m_lift[2], this->m_gamma[2], this->m_gain[2]);
output[3] = inputColor[3];
}
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
index 44784837301..2f13a90c072 100644
--- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp
@@ -61,44 +61,48 @@ void ColorCurveOperation::initExecution()
void ColorCurveOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
CurveMapping *cumap = this->m_curveMapping;
- CurveMapping *workingCopy = (CurveMapping *)MEM_dupallocN(cumap);
- float black[4];
- float white[4];
float fac[4];
float image[4];
+ /* local versions of cumap->black, cumap->white, cumap->bwmul */
+ float black[4];
+ float white[4];
+ float bwmul[3];
+
this->m_inputBlackProgram->read(black, x, y, sampler);
this->m_inputWhiteProgram->read(white, x, y, sampler);
- curvemapping_set_black_white(workingCopy, black, white);
+ /* get our own local bwmul value,
+ * since we can't be threadsafe and use cumap->bwmul & friends */
+ curvemapping_set_black_white_ex(black, white, bwmul);
this->m_inputFacProgram->read(fac, x, y, sampler);
this->m_inputImageProgram->read(image, x, y, sampler);
- if (*fac >= 1.0f)
- curvemapping_evaluate_premulRGBF(workingCopy, output, image);
+ if (*fac >= 1.0f) {
+ curvemapping_evaluate_premulRGBF_ex(cumap, output, image,
+ black, bwmul);
+ }
else if (*fac <= 0.0f) {
copy_v3_v3(output, image);
}
else {
- float col[4], mfac = 1.0f - *fac;
- curvemapping_evaluate_premulRGBF(workingCopy, col, image);
- output[0] = mfac * image[0] + *fac * col[0];
- output[1] = mfac * image[1] + *fac * col[1];
- output[2] = mfac * image[2] + *fac * col[2];
+ float col[4];
+ curvemapping_evaluate_premulRGBF_ex(cumap, col, image,
+ black, bwmul);
+ interp_v3_v3v3(output, image, col, *fac);
}
output[3] = image[3];
- MEM_freeN(workingCopy);
}
void ColorCurveOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputFacProgram = NULL;
this->m_inputImageProgram = NULL;
this->m_inputBlackProgram = NULL;
this->m_inputWhiteProgram = NULL;
- curvemapping_premultiply(this->m_curveMapping, 1);
}
@@ -131,28 +135,26 @@ void ConstantLevelColorCurveOperation::executePixel(float output[4], float x, fl
float fac[4];
float image[4];
-
this->m_inputFacProgram->read(fac, x, y, sampler);
this->m_inputImageProgram->read(image, x, y, sampler);
- if (*fac >= 1.0f)
+ if (*fac >= 1.0f) {
curvemapping_evaluate_premulRGBF(this->m_curveMapping, output, image);
+ }
else if (*fac <= 0.0f) {
copy_v3_v3(output, image);
}
else {
- float col[4], mfac = 1.0f - *fac;
+ float col[4];
curvemapping_evaluate_premulRGBF(this->m_curveMapping, col, image);
- output[0] = mfac * image[0] + *fac * col[0];
- output[1] = mfac * image[1] + *fac * col[1];
- output[2] = mfac * image[2] + *fac * col[2];
+ interp_v3_v3v3(output, image, col, *fac);
}
output[3] = image[3];
}
void ConstantLevelColorCurveOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputFacProgram = NULL;
this->m_inputImageProgram = NULL;
- curvemapping_premultiply(this->m_curveMapping, 1);
}
diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h
index 063873c6443..7dc1913b85a 100644
--- a/source/blender/compositor/operations/COM_ColorCurveOperation.h
+++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h
@@ -82,8 +82,8 @@ public:
*/
void deinitExecution();
- void setBlackLevel(float black[3]) { this->m_black[0] = black[0]; this->m_black[1] = black[1]; this->m_black[2] = black[2]; }
- void setWhiteLevel(float white[3]) { this->m_white[0] = white[0]; this->m_white[1] = white[1]; this->m_white[2] = white[2]; }
+ void setBlackLevel(float black[3]) { copy_v3_v3(this->m_black, black); }
+ void setWhiteLevel(float white[3]) { copy_v3_v3(this->m_white, white); }
};
#endif
diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
index fd593b39dcd..553a9827ffa 100644
--- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp
@@ -24,6 +24,8 @@
#include "BLI_utildefines.h"
+#include "MEM_guardedalloc.h"
+
ConvolutionFilterOperation::ConvolutionFilterOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
@@ -42,7 +44,7 @@ void ConvolutionFilterOperation::initExecution()
void ConvolutionFilterOperation::set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9)
{
- this->m_filter = new float[9];
+ this->m_filter = (float *)MEM_mallocN(sizeof(float) * 9, __func__);
this->m_filter[0] = f1;
this->m_filter[1] = f2;
this->m_filter[2] = f3;
@@ -61,7 +63,7 @@ void ConvolutionFilterOperation::deinitExecution()
this->m_inputOperation = NULL;
this->m_inputValueOperation = NULL;
if (this->m_filter) {
- delete[] this->m_filter;
+ MEM_freeN(this->m_filter);
this->m_filter = NULL;
}
}
diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
index 48d2bcd0ef9..36c49859880 100644
--- a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp
@@ -38,3 +38,17 @@ void CurveBaseOperation::initExecution()
{
curvemapping_initialize(this->m_curveMapping);
}
+void CurveBaseOperation::deinitExecution()
+{
+ curvemapping_free(this->m_curveMapping);
+ this->m_curveMapping = NULL;
+}
+
+void CurveBaseOperation::setCurveMapping(CurveMapping *mapping)
+{
+ /* duplicate the curve to avoid glitches while drawing, see bug [#32374] */
+ if (this->m_curveMapping) {
+ curvemapping_free(this->m_curveMapping);
+ }
+ this->m_curveMapping = curvemapping_copy(mapping);
+}
diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h
index 1636c13a571..6bfce26f532 100644
--- a/source/blender/compositor/operations/COM_CurveBaseOperation.h
+++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h
@@ -38,7 +38,8 @@ public:
* Initialize the execution
*/
void initExecution();
+ void deinitExecution();
- void setCurveMapping(CurveMapping *mapping) { this->m_curveMapping = mapping; }
+ void setCurveMapping(CurveMapping *mapping);
};
#endif
diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cpp b/source/blender/compositor/operations/COM_DespeckleOperation.cpp
new file mode 100644
index 00000000000..599f54720f2
--- /dev/null
+++ b/source/blender/compositor/operations/COM_DespeckleOperation.cpp
@@ -0,0 +1,139 @@
+/*
+ * 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: Campbell Barton
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "COM_DespeckleOperation.h"
+
+#include "BLI_utildefines.h"
+
+DespeckleOperation::DespeckleOperation() : NodeOperation()
+{
+ this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addOutputSocket(COM_DT_COLOR);
+ this->setResolutionInputSocketIndex(0);
+ this->m_inputOperation = NULL;
+ this->setComplex(true);
+}
+void DespeckleOperation::initExecution()
+{
+ this->m_inputOperation = this->getInputSocketReader(0);
+ this->m_inputValueOperation = this->getInputSocketReader(1);
+}
+
+void DespeckleOperation::deinitExecution()
+{
+ this->m_inputOperation = NULL;
+ this->m_inputValueOperation = NULL;
+}
+
+BLI_INLINE int color_diff(const float a[3], const float b[3], const float threshold)
+{
+ return ((fabsf(a[0] - b[0]) > threshold) ||
+ (fabsf(a[1] - b[1]) > threshold) ||
+ (fabsf(a[2] - b[2]) > threshold));
+}
+
+void DespeckleOperation::executePixel(float output[4], int x, int y, void *data)
+{
+ float w = 0.0f;
+ float color_org[4];
+ float color_mid[4];
+ float color_mid_ok[4];
+ float in1[4];
+ int x1 = x - 1;
+ int x2 = x;
+ int x3 = x + 1;
+ 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);
+ float value[4];
+ this->m_inputValueOperation->read(value, x2, y2, NULL);
+ //const float mval = 1.0f - value[0];
+
+
+ this->m_inputOperation->read(color_org, x2, y2, NULL);
+
+#define TOT_DIV_ONE 1.0f
+#define TOT_DIV_CNR (float)M_SQRT1_2
+
+#define WTOT (TOT_DIV_ONE * 4 + TOT_DIV_CNR * 4)
+
+#define COLOR_ADD(fac) \
+{ \
+ madd_v4_v4fl(color_mid, in1, fac); \
+ if (color_diff(in1, color_org, this->m_threshold)) { \
+ w += fac; \
+ madd_v4_v4fl(color_mid_ok, in1, fac); \
+ } \
+}
+
+ zero_v4(color_mid);
+ zero_v4(color_mid_ok);
+
+ this->m_inputOperation->read(in1, x1, y1, NULL); COLOR_ADD(TOT_DIV_CNR)
+ this->m_inputOperation->read(in1, x2, y1, NULL); COLOR_ADD(TOT_DIV_ONE)
+ this->m_inputOperation->read(in1, x3, y1, NULL); COLOR_ADD(TOT_DIV_CNR)
+ this->m_inputOperation->read(in1, x1, y2, NULL); COLOR_ADD(TOT_DIV_ONE)
+
+#if 0
+ this->m_inputOperation->read(in2, x2, y2, NULL);
+ madd_v4_v4fl(color_mid, in2, this->m_filter[4]);
+#endif
+
+ this->m_inputOperation->read(in1, x3, y2, NULL); COLOR_ADD(TOT_DIV_ONE)
+ this->m_inputOperation->read(in1, x1, y3, NULL); COLOR_ADD(TOT_DIV_CNR)
+ this->m_inputOperation->read(in1, x2, y3, NULL); COLOR_ADD(TOT_DIV_ONE)
+ this->m_inputOperation->read(in1, x3, y3, NULL); COLOR_ADD(TOT_DIV_CNR)
+
+ mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * (float)M_SQRT1_2)));
+ //mul_v4_fl(color_mid, 1.0f / w);
+
+ if ((w != 0.0f) &&
+ ((w / WTOT) > (this->m_threshold_neighbour)) &&
+ color_diff(color_mid, color_org, this->m_threshold))
+ {
+ mul_v4_fl(color_mid_ok, 1.0f / w);
+ interp_v4_v4v4(output, color_org, color_mid_ok, value[0]);
+ }
+ else {
+ copy_v4_v4(output, color_org);
+ }
+}
+
+bool DespeckleOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+{
+ rcti newInput;
+ int addx = 2; //(this->m_filterWidth - 1) / 2 + 1;
+ int addy = 2; //(this->m_filterHeight - 1) / 2 + 1;
+ newInput.xmax = input->xmax + addx;
+ newInput.xmin = input->xmin - addx;
+ newInput.ymax = input->ymax + addy;
+ newInput.ymin = input->ymin - addy;
+
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+}
diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.h b/source/blender/compositor/operations/COM_DespeckleOperation.h
new file mode 100644
index 00000000000..5b79d7cb7e0
--- /dev/null
+++ b/source/blender/compositor/operations/COM_DespeckleOperation.h
@@ -0,0 +1,49 @@
+/*
+ * 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: Campbell Barton
+ */
+
+#ifndef _COM_DespeckleOperation_h
+#define _COM_DespeckleOperation_h
+#include "COM_NodeOperation.h"
+
+class DespeckleOperation : public NodeOperation {
+private:
+ float m_threshold;
+ float m_threshold_neighbour;
+
+ int m_filterWidth;
+ int m_filterHeight;
+
+protected:
+ SocketReader *m_inputOperation;
+ SocketReader *m_inputValueOperation;
+
+public:
+ DespeckleOperation();
+ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
+ void executePixel(float output[4], int x, int y, void *data);
+
+ void setThreshold(float threshold) { this->m_threshold = threshold; }
+ void setThresholdNeighbour(float threshold) { this->m_threshold_neighbour = threshold; }
+
+ void initExecution();
+ void deinitExecution();
+};
+
+#endif
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index 5e70187557b..c4b4452fbb0 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -24,6 +24,8 @@
#include "BLI_math.h"
#include "COM_OpenCLDevice.h"
+#include "MEM_guardedalloc.h"
+
// DilateErode Distance Threshold
DilateErodeThresholdOperation::DilateErodeThresholdOperation() : NodeOperation()
{
@@ -77,7 +79,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y,
const int miny = max(y - this->m_scope, rect->ymin);
const int maxx = min(x + this->m_scope, rect->xmax);
const int maxy = min(y + this->m_scope, rect->ymax);
- const int bufferWidth = rect->xmax - rect->xmin;
+ const int bufferWidth = BLI_RCT_SIZE_X(rect);
int offset;
this->m_inputProgram->read(inputValue, x, y, NULL);
@@ -197,7 +199,7 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void *
const int miny = max(y - this->m_scope, rect->ymin);
const int maxx = min(x + this->m_scope, rect->xmax);
const int maxy = min(y + this->m_scope, rect->ymax);
- const int bufferWidth = rect->xmax - rect->xmin;
+ const int bufferWidth = BLI_RCT_SIZE_X(rect);
int offset;
float value = 0.0f;
@@ -271,7 +273,7 @@ void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *d
const int miny = max(y - this->m_scope, rect->ymin);
const int maxx = min(x + this->m_scope, rect->xmax);
const int maxy = min(y + this->m_scope, rect->ymax);
- const int bufferWidth = rect->xmax - rect->xmin;
+ const int bufferWidth = BLI_RCT_SIZE_X(rect);
int offset;
float value = 1.0f;
@@ -384,7 +386,7 @@ void DilateStepOperation::deinitExecution()
this->m_inputProgram = NULL;
this->deinitMutex();
if (this->m_cached_buffer) {
- delete [] this->m_cached_buffer;
+ MEM_freeN(this->m_cached_buffer);
this->m_cached_buffer = NULL;
}
}
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
index 39f0ac7874b..31608c88274 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
@@ -95,8 +95,8 @@ void DisplaceOperation::executePixel(float output[4], int x, int y, void *data)
dxt = signf(dxt) * maxf(fabsf(dxt), DISPLACE_EPSILON) / this->getWidth();
dyt = signf(dyt) * maxf(fabsf(dyt), DISPLACE_EPSILON) / this->getHeight();
- /* EWA filtering */
- this->m_inputColorProgram->read(output, u, v, dxt, dyt);
+ /* EWA filtering (without nearest it gets blurry with NO distortion) */
+ this->m_inputColorProgram->read(output, u, v, dxt, dyt, COM_PS_NEAREST);
}
void DisplaceOperation::deinitExecution()
diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
index b65b5e0f224..d3309e0c978 100644
--- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
@@ -19,32 +19,37 @@
* Dalai Felinto
*/
-#include "COM_DistanceMatteOperation.h"
+#include "COM_DistanceRGBMatteOperation.h"
#include "BLI_math.h"
-DistanceMatteOperation::DistanceMatteOperation() : NodeOperation()
+DistanceRGBMatteOperation::DistanceRGBMatteOperation() : NodeOperation()
{
- addInputSocket(COM_DT_COLOR);
- addInputSocket(COM_DT_COLOR);
- addOutputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_COLOR);
+ this->addOutputSocket(COM_DT_VALUE);
this->m_inputImageProgram = NULL;
this->m_inputKeyProgram = NULL;
}
-void DistanceMatteOperation::initExecution()
+void DistanceRGBMatteOperation::initExecution()
{
this->m_inputImageProgram = this->getInputSocketReader(0);
this->m_inputKeyProgram = this->getInputSocketReader(1);
}
-void DistanceMatteOperation::deinitExecution()
+void DistanceRGBMatteOperation::deinitExecution()
{
this->m_inputImageProgram = NULL;
this->m_inputKeyProgram = NULL;
}
-void DistanceMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
+float DistanceRGBMatteOperation::calculateDistance(float key[4], float image[4])
+{
+ return len_v3v3(key, image);
+}
+
+void DistanceRGBMatteOperation::executePixel(float output[4], float x, float y, PixelSampler sampler)
{
float inKey[4];
float inImage[4];
@@ -58,9 +63,7 @@ void DistanceMatteOperation::executePixel(float output[4], float x, float y, Pix
this->m_inputKeyProgram->read(inKey, x, y, sampler);
this->m_inputImageProgram->read(inImage, x, y, sampler);
- distance = sqrt(pow((inKey[0] - inImage[0]), 2) +
- pow((inKey[1] - inImage[1]), 2) +
- pow((inKey[2] - inImage[2]), 2));
+ distance = this->calculateDistance(inKey, inImage);
/* store matte(alpha) value in [0] to go with
* COM_SetAlphaOperation and the Value output
@@ -87,4 +90,3 @@ void DistanceMatteOperation::executePixel(float output[4], float x, float y, Pix
output[0] = inImage[3];
}
}
-
diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h
index a176e5da888..5a34135b1a4 100644
--- a/source/blender/compositor/operations/COM_DistanceMatteOperation.h
+++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h
@@ -19,8 +19,8 @@
* Dalai Felinto
*/
-#ifndef _COM_DistanceMatteOperation_h
-#define _COM_DistanceMatteOperation_h
+#ifndef _COM_DistanceRGBMatteOperation_h
+#define _COM_DistanceRGBMatteOperation_h
#include "COM_MixBaseOperation.h"
@@ -28,16 +28,19 @@
* this program converts an input color to an output value.
* it assumes we are in sRGB color space.
*/
-class DistanceMatteOperation : public NodeOperation {
-private:
+class DistanceRGBMatteOperation : public NodeOperation {
+protected:
NodeChroma *m_settings;
SocketReader *m_inputImageProgram;
SocketReader *m_inputKeyProgram;
+
+ virtual float calculateDistance(float key[4], float image[4]);
+
public:
/**
* Default constructor
*/
- DistanceMatteOperation();
+ DistanceRGBMatteOperation();
/**
* the inner loop of this program
diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
new file mode 100644
index 00000000000..0a6f1fdfd31
--- /dev/null
+++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
@@ -0,0 +1,35 @@
+/*
+ * 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:
+ * Dalai Felinto
+ */
+
+#include "COM_DistanceYCCMatteOperation.h"
+#include "BLI_math.h"
+
+DistanceYCCMatteOperation::DistanceYCCMatteOperation() : DistanceRGBMatteOperation()
+{
+ /* pass */
+}
+
+float DistanceYCCMatteOperation::calculateDistance(float key[4], float image[4])
+{
+ /* only measure the second 2 values */
+ return len_v2v2(key + 1, image + 1);
+}
+
diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h
new file mode 100644
index 00000000000..f4866a327f1
--- /dev/null
+++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h
@@ -0,0 +1,43 @@
+/*
+ * 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:
+ * Dalai Felinto
+ */
+
+#ifndef _COM_DistanceYCCMatteOperation_h
+#define _COM_DistanceYCCMatteOperation_h
+#include "COM_MixBaseOperation.h"
+#include "COM_DistanceRGBMatteOperation.h"
+
+
+/**
+ * this program converts an input color to an output value.
+ * it assumes we are in sRGB color space.
+ */
+class DistanceYCCMatteOperation : public DistanceRGBMatteOperation {
+protected:
+ virtual float calculateDistance(float key[4], float image[4]);
+
+public:
+ /**
+ * Default constructor
+ */
+ DistanceYCCMatteOperation();
+
+};
+#endif
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
index d5daace059d..39665b10f48 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
@@ -1269,12 +1269,12 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect)
if (this->m_cachedInstance == NULL) {
MemoryBuffer *innerMask = (MemoryBuffer *)this->m_inputInnerMask->initializeTileData(rect);
MemoryBuffer *outerMask = (MemoryBuffer *)this->m_inputOuterMask->initializeTileData(rect);
- float *data = new float[this->getWidth() * this->getHeight()];
+ float *data = (float *)MEM_mallocN(sizeof(float) * this->getWidth() * this->getHeight(), __func__);
float *imask = innerMask->convertToValueBuffer();
float *omask = outerMask->convertToValueBuffer();
doDoubleEdgeMask(imask, omask, data);
- delete [] imask;
- delete [] omask;
+ MEM_freeN(imask);
+ MEM_freeN(omask);
this->m_cachedInstance = data;
}
unlockMutex();
@@ -1293,7 +1293,7 @@ void DoubleEdgeMaskOperation::deinitExecution()
this->m_inputOuterMask = NULL;
deinitMutex();
if (this->m_cachedInstance) {
- delete this->m_cachedInstance;
+ MEM_freeN(this->m_cachedInstance);
this->m_cachedInstance = NULL;
}
}
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
index 935bfcac6c7..8c5e5faf12a 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
@@ -23,6 +23,7 @@
#include "COM_GaussianAlphaXBlurOperation.h"
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
extern "C" {
#include "RE_pipeline.h"
@@ -32,6 +33,7 @@ GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() : BlurBaseOperation(C
{
this->m_gausstab = NULL;
this->m_rad = 0;
+ this->m_falloff = -1; /* intentionally invalid, so we can detect uninitialized values */
}
void *GaussianAlphaXBlurOperation::initializeTileData(rcti *rect)
@@ -154,9 +156,9 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo
void GaussianAlphaXBlurOperation::deinitExecution()
{
BlurBaseOperation::deinitExecution();
- delete [] this->m_gausstab;
+ MEM_freeN(this->m_gausstab);
this->m_gausstab = NULL;
- delete [] this->m_distbuf_inv;
+ MEM_freeN(this->m_distbuf_inv);
this->m_distbuf_inv = NULL;
deinitMutex();
diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
index 375f1bcf07c..197715595ed 100644
--- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
@@ -23,6 +23,7 @@
#include "COM_GaussianAlphaYBlurOperation.h"
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
extern "C" {
#include "RE_pipeline.h"
@@ -32,6 +33,7 @@ GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() : BlurBaseOperation(C
{
this->m_gausstab = NULL;
this->m_rad = 0;
+ this->m_falloff = -1; /* intentionally invalid, so we can detect uninitialized values */
}
void *GaussianAlphaYBlurOperation::initializeTileData(rcti *rect)
@@ -154,9 +156,9 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo
void GaussianAlphaYBlurOperation::deinitExecution()
{
BlurBaseOperation::deinitExecution();
- delete [] this->m_gausstab;
+ MEM_freeN(this->m_gausstab);
this->m_gausstab = NULL;
- delete [] this->m_distbuf_inv;
+ MEM_freeN(this->m_distbuf_inv);
this->m_distbuf_inv = NULL;
deinitMutex();
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index d97d2f15ded..a9bcb2dd752 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -88,7 +88,7 @@ void GaussianBokehBlurOperation::updateGauss()
n = (2 * this->m_radx + 1) * (2 * this->m_rady + 1);
/* create a full filter image */
- ddgauss = new float[n];
+ ddgauss = (float *)MEM_mallocN(sizeof(float) * n, __func__);
dgauss = ddgauss;
val = 0.0f;
for (j = -this->m_rady; j <= this->m_rady; j++) {
@@ -103,8 +103,9 @@ void GaussianBokehBlurOperation::updateGauss()
}
if (val != 0.0f) {
val = 1.0f / val;
- for (j = n - 1; j >= 0; j--)
+ for (j = n - 1; j >= 0; j--) {
ddgauss[j] *= val;
+ }
}
else ddgauss[4] = 1.0f;
@@ -158,7 +159,7 @@ void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, voi
void GaussianBokehBlurOperation::deinitExecution()
{
BlurBaseOperation::deinitExecution();
- delete [] this->m_gausstab;
+ MEM_freeN(this->m_gausstab);
this->m_gausstab = NULL;
deinitMutex();
@@ -258,8 +259,9 @@ void GaussianBlurReferenceOperation::updateGauss()
int i;
int x = MAX2(m_radx, m_rady);
this->m_maintabs = (float **)MEM_mallocN(x * sizeof(float *), "gauss array");
- for (i = 0; i < x; i++)
+ for (i = 0; i < x; i++) {
m_maintabs[i] = make_gausstab(i + 1);
+ }
}
void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, void *data)
@@ -326,8 +328,9 @@ void GaussianBlurReferenceOperation::deinitExecution()
{
int x, i;
x = MAX2(m_radx, m_rady);
- for (i = 0; i < x; i++)
- delete []m_maintabs[i];
+ for (i = 0; i < x; i++) {
+ MEM_freeN(m_maintabs[i]);
+ }
MEM_freeN(m_maintabs);
BlurBaseOperation::deinitExecution();
}
diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
index 01c85738822..984119b926a 100644
--- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
@@ -22,6 +22,7 @@
#include "COM_GaussianXBlurOperation.h"
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
extern "C" {
#include "RE_pipeline.h"
@@ -107,7 +108,7 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d
void GaussianXBlurOperation::deinitExecution()
{
BlurBaseOperation::deinitExecution();
- delete [] this->m_gausstab;
+ MEM_freeN(this->m_gausstab);
this->m_gausstab = NULL;
deinitMutex();
diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
index 298b4660c6a..192bc29e1ae 100644
--- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
@@ -22,6 +22,7 @@
#include "COM_GaussianYBlurOperation.h"
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
extern "C" {
#include "RE_pipeline.h"
@@ -108,7 +109,7 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d
void GaussianYBlurOperation::deinitExecution()
{
BlurBaseOperation::deinitExecution();
- delete [] this->m_gausstab;
+ MEM_freeN(this->m_gausstab);
this->m_gausstab = NULL;
deinitMutex();
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
index 39fffd6ac64..ace04237b29 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
@@ -83,11 +83,11 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
for (x = 0; x < gbuf->getWidth(); x++) {
u = (float)(x + 0.5f) / (float)gbuf->getWidth();
s = (u - 0.5f) * sc + 0.5f, t = (v - 0.5f) * sc + 0.5f;
- tbuf1->read(c, s * gbuf->getWidth(), t * gbuf->getHeight());
+ tbuf1->readCubic(c, s * gbuf->getWidth(), t * gbuf->getHeight());
sm = smoothMask(s, t);
mul_v3_fl(c, sm);
s = (u - 0.5f) * isc + 0.5f, t = (v - 0.5f) * isc + 0.5f;
- tbuf2->read(tc, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f);
+ tbuf2->readCubic(tc, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f);
sm = smoothMask(s, t);
madd_v3_v3fl(c, tc, sm);
@@ -108,7 +108,7 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
np = (n << 2) + p;
s = (u - 0.5f) * scalef[np] + 0.5f;
t = (v - 0.5f) * scalef[np] + 0.5f;
- gbuf->read(c, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f);
+ gbuf->readCubic(c, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f);
mul_v3_v3(c, cm[np]);
sm = smoothMask(s, t) * 0.25f;
madd_v3_v3fl(tc, c, sm);
diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
index 57d43f67c9b..8f58942fbe2 100644
--- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
+++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp
@@ -74,5 +74,6 @@ void HueSaturationValueCorrectOperation::executePixel(float output[4], float x,
void HueSaturationValueCorrectOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputProgram = NULL;
}
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp
index 77bef54c485..70d4d987c81 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cpp
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp
@@ -121,7 +121,7 @@ void InpaintSimpleOperation::calc_manhatten_distance()
{
int width = this->getWidth();
int height = this->getHeight();
- short *m = this->m_manhatten_distance = new short[width * height];
+ short *m = this->m_manhatten_distance = (short *)MEM_mallocN(sizeof(short) * width * height, __func__);
int *offsets;
offsets = (int *)MEM_callocN(sizeof(int) * (width + height + 1), "InpaintSimpleOperation offsets");
@@ -140,9 +140,9 @@ void InpaintSimpleOperation::calc_manhatten_distance()
m[j * width + i] = r;
}
}
-
+
for (int j = height - 1; j >= 0; j--) {
- for (int i = width; i >= 0; i--) {
+ for (int i = width - 1; i >= 0; i--) {
int r = m[j * width + i];
if (i + 1 < width)
@@ -163,7 +163,7 @@ void InpaintSimpleOperation::calc_manhatten_distance()
}
this->m_area_size = offsets[width + height];
- this->m_pixelorder = new int[this->m_area_size];
+ this->m_pixelorder = (int *)MEM_mallocN(sizeof(int) * this->m_area_size, __func__);
for (int i = 0; i < width * height; i++) {
if (m[i] > 0) {
@@ -182,8 +182,8 @@ void InpaintSimpleOperation::pix_step(int x, int y)
for (int dx = -1; dx <= 1; dx++) {
for (int dy = -1; dy <= 1; dy++) {
- if (dx != 0 && dy != 0) {
-
+ /* changing to both != 0 gives dithering artifacts */
+ if (dx != 0 || dy != 0) {
int x_ofs = x + dx;
int y_ofs = y + dy;
@@ -224,9 +224,7 @@ void *InpaintSimpleOperation::initializeTileData(rcti *rect)
lockMutex();
if (!this->m_cached_buffer_ready) {
MemoryBuffer *buf = (MemoryBuffer *)this->m_inputImageProgram->initializeTileData(rect);
-
- this->m_cached_buffer = new float[this->getWidth() * this->getHeight() * COM_NUMBER_OF_CHANNELS];
- memcpy(this->m_cached_buffer, buf->getBuffer(), this->getWidth() * this->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float));
+ this->m_cached_buffer = (float *)MEM_dupallocN(buf->getBuffer());
this->calc_manhatten_distance();
@@ -255,17 +253,17 @@ void InpaintSimpleOperation::deinitExecution()
this->m_inputImageProgram = NULL;
this->deinitMutex();
if (this->m_cached_buffer) {
- delete [] this->m_cached_buffer;
+ MEM_freeN(this->m_cached_buffer);
this->m_cached_buffer = NULL;
}
if (this->m_pixelorder) {
- delete [] this->m_pixelorder;
+ MEM_freeN(this->m_pixelorder);
this->m_pixelorder = NULL;
}
if (this->m_manhatten_distance) {
- delete [] this->m_manhatten_distance;
+ MEM_freeN(this->m_manhatten_distance);
this->m_manhatten_distance = NULL;
}
this->m_cached_buffer_ready = false;
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp
index 1a441b0ac9a..fe6ebcebf97 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp
@@ -107,7 +107,7 @@ void MapUVOperation::executePixel(float output[4], float x, float y, PixelSample
u = inputUV[0] * this->m_inputColorProgram->getWidth();
v = inputUV[1] * this->m_inputColorProgram->getHeight();
- this->m_inputColorProgram->read(output, u, v, dx, dy);
+ this->m_inputColorProgram->read(output, u, v, dx, dy, COM_PS_NEAREST);
/* "premul" */
if (alpha < 1.0f) {
diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
index 00723d92a84..7e62de7b9f1 100644
--- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h
@@ -25,6 +25,8 @@
#include "COM_NodeOperation.h"
#include "DNA_movieclip_types.h"
+#include "MEM_guardedalloc.h"
+
extern "C" {
#include "BKE_tracking.h"
#include "PIL_time.h"
@@ -62,22 +64,19 @@ public:
this->m_calibration_width = calibration_width;
this->m_calibration_height = calibration_height;
this->m_inverted = inverted;
- this->m_bufferCalculated = new int[this->m_width * this->m_height];
- this->m_buffer = new float[this->m_width * this->m_height * 2];
- for (int i = 0; i < this->m_width * this->m_height; i++) {
- this->m_bufferCalculated[i] = 0;
- }
+ this->m_bufferCalculated = (int *)MEM_callocN(sizeof(int) * this->m_width * this->m_height, __func__);
+ this->m_buffer = (float *)MEM_mallocN(sizeof(float) * this->m_width * this->m_height * 2, __func__);
this->updateLastUsage();
}
~DistortionCache() {
if (this->m_buffer) {
- delete[] this->m_buffer;
+ MEM_freeN(this->m_buffer);
this->m_buffer = NULL;
}
if (this->m_bufferCalculated) {
- delete[] this->m_bufferCalculated;
+ MEM_freeN(this->m_bufferCalculated);
this->m_bufferCalculated = NULL;
}
}
diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
index 7e854f01213..d92fe04eb15 100644
--- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
@@ -80,12 +80,20 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in
newInput.xmax = input->xmax + this->m_kr2 + 2;
}
else {
+ rcti dispInput;
+ BLI_rcti_init(&dispInput, 0,5,0,5);
+ if (this->getInputOperation(1)->determineDependingAreaOfInterest(&dispInput, readOperation, output)) {
+ return true;
+ }
newInput.xmin = input->xmin - 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */
newInput.ymin = input->ymin;
newInput.ymax = input->ymax;
newInput.xmax = input->xmax + 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */
}
- return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+ if (this->getInputOperation(0)->determineDependingAreaOfInterest(&newInput, readOperation, output)) {
+ return true;
+ }
+ return false;
}
void ProjectorLensDistortionOperation::updateDispersion()
@@ -94,7 +102,7 @@ void ProjectorLensDistortionOperation::updateDispersion()
this->lockMutex();
if (!this->m_dispersionAvailable) {
float result[4];
- this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST);
+ this->getInputSocketReader(1)->read(result, 1, 1, COM_PS_NEAREST);
this->m_dispersion = result[0];
this->m_kr = 0.25f * maxf(minf(this->m_dispersion, 1.0f), 0.0f);
this->m_kr2 = this->m_kr * 20;
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
index a2385f79c04..03d41edda64 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp
@@ -59,9 +59,9 @@ void ReadBufferOperation::executePixel(float output[4], float x, float y, PixelS
}
}
-void ReadBufferOperation::executePixel(float output[4], float x, float y, float dx, float dy)
+void ReadBufferOperation::executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler)
{
- m_buffer->readEWA(output, x, y, dx, dy);
+ m_buffer->readEWA(output, x, y, dx, dy, sampler);
}
bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h
index 7958a4aee6b..7e3ac147ee3 100644
--- a/source/blender/compositor/operations/COM_ReadBufferOperation.h
+++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h
@@ -40,7 +40,7 @@ public:
void *initializeTileData(rcti *rect);
void executePixel(float output[4], float x, float y, PixelSampler sampler);
- void executePixel(float output[4], float x, float y, float dx, float dy);
+ void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler);
const bool isReadBufferOperation() const { return true; }
void setOffset(unsigned int offset) { this->m_offset = offset; }
unsigned int getOffset() { return this->m_offset; }
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index 218e8234084..193ab669f40 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -145,7 +145,7 @@ void ScreenLensDistortionOperation::deinitExecution()
this->m_inputProgram = NULL;
}
-void ScreenLensDistortionOperation::determineUV(float result[4], float x, float y, float distortion, float dispersion)
+void ScreenLensDistortionOperation::determineUV(float result[6], float x, float y, float distortion, float dispersion)
{
if (!this->m_valuesAvailable) {
updateVariables(distortion, dispersion);
@@ -153,63 +153,36 @@ void ScreenLensDistortionOperation::determineUV(float result[4], float x, float
determineUV(result, x, y);
}
-void ScreenLensDistortionOperation::determineUV(float result[4], float x, float y) const
+void ScreenLensDistortionOperation::determineUV(float result[6], float x, float y) const
{
const float height = this->getHeight();
const float width = this->getWidth();
- float d, t, ln[6] = {0, 0, 0, 0, 0, 0};
+ result[0] = x;
+ result[1] = y;
+ result[2] = x;
+ result[3] = y;
+ result[4] = x;
+ result[5] = y;
+
+ float d, t;
const float v = this->m_sc * ((y + 0.5f) - this->m_cy) / this->m_cy;
const float u = this->m_sc * ((x + 0.5f) - this->m_cx) / this->m_cx;
const float uv_dot = u * u + v * v;
if ((t = 1.0f - this->m_kr4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
- ln[0] = (u * d + 0.5f) * width - 0.5f, ln[1] = (v * d + 0.5f) * height - 0.5f;
+ result[0] = (u * d + 0.5f) * width - 0.5f, result[1] = (v * d + 0.5f) * height - 0.5f;
}
if ((t = 1.0f - this->m_kg4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
- ln[2] = (u * d + 0.5f) * width - 0.5f, ln[3] = (v * d + 0.5f) * height - 0.5f;
+ result[2] = (u * d + 0.5f) * width - 0.5f, result[3] = (v * d + 0.5f) * height - 0.5f;
}
if ((t = 1.0f - this->m_kb4 * uv_dot) >= 0.0f) {
d = 1.0f / (1.0f + sqrtf(t));
- ln[4] = (u * d + 0.5f) * width - 0.5f, ln[5] = (v * d + 0.5f) * height - 0.5f;
- }
-
- float jit = this->m_data->jit;
- float z;
- {
- // RG
- const int dx = ln[2] - ln[0], dy = ln[3] - ln[1];
- const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.0f;
- const int ds = (int)(jit ? ((dsf < 4.0f) ? 2.0f : sqrtf(dsf)) : dsf);
- const float sd = 1.0f / (float)ds;
-
- z = ds;
- const float tz = ((float)z + (1.0f)) * sd;
- t = 1.0f - (this->m_kr4 + tz * this->m_drg) * uv_dot;
- d = 1.0f / (1.0f + sqrtf(t));
- const float nx = (u * d + 0.5f) * width - 0.5f;
- const float ny = (v * d + 0.5f) * height - 0.5f;
- result[0] = nx;
- result[1] = ny;
- }
- {
- // GB
- const int dx = ln[4] - ln[2], dy = ln[5] - ln[3];
- const float dsf = sqrtf((float)dx * dx + dy * dy) + 1.0f;
- const int ds = (int)(jit ? ((dsf < 4.0f) ? 2.0f : sqrtf(dsf)) : dsf);
- const float sd = 1.0f / (float)ds;
-
- z = ds;
- const float tz = ((float)z + (1.0f)) * sd;
- t = 1.0f - (this->m_kg4 + tz * this->m_dgb) * uv_dot;
- d = 1.0f / (1.0f + sqrtf(t));
- const float nx = (u * d + 0.5f) * width - 0.5f;
- const float ny = (v * d + 0.5f) * height - 0.5f;
- result[2] = nx;
- result[3] = ny;
+ result[4] = (u * d + 0.5f) * width - 0.5f, result[5] = (v * d + 0.5f) * height - 0.5f;
}
+
}
bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
@@ -230,18 +203,16 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
return true;
}
-#define MARGIN 96
-
#define UPDATE_INPUT { \
- newInput.xmin = MIN3(newInput.xmin, coords[0], coords[2]); \
- newInput.ymin = MIN3(newInput.ymin, coords[1], coords[3]); \
- newInput.xmax = MAX3(newInput.xmax, coords[0], coords[2]); \
- newInput.ymax = MAX3(newInput.ymax, coords[1], coords[3]); \
+ newInput.xmin = MIN4(newInput.xmin, coords[0], coords[2], coords[4]); \
+ newInput.ymin = MIN4(newInput.ymin, coords[1], coords[3], coords[5]); \
+ newInput.xmax = MAX4(newInput.xmax, coords[0], coords[2], coords[4]); \
+ newInput.ymax = MAX4(newInput.ymax, coords[1], coords[3], coords[5]); \
} (void)0
rcti newInput;
- float margin;
- float coords[4];
+ const float margin = 2;
+ float coords[6];
if (m_valuesAvailable) {
determineUV(coords, input->xmin, input->ymin);
newInput.xmin = coords[0];
@@ -255,7 +226,6 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
UPDATE_INPUT;
determineUV(coords, input->xmax, input->ymin);
UPDATE_INPUT;
- margin = (fabsf(this->m_distortion) + this->m_dispersion) * MARGIN + 2.0f;
}
else {
determineUV(coords, input->xmin, input->ymin, 1.0f, 1.0f);
@@ -281,8 +251,6 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti *input
UPDATE_INPUT;
determineUV(coords, input->xmax, input->ymin, 1.0f, 1.0f);
UPDATE_INPUT;
- margin = MARGIN;
- printf("margin b: %f\n", margin);
}
#undef UPDATE_INPUT
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
index cfbdaacb41e..2e2105c764d 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h
@@ -79,8 +79,8 @@ public:
}
private:
- void determineUV(float result[4], float x, float y) const;
- void determineUV(float result[4], float x, float y, float distortion, float dispersion);
+ void determineUV(float result[6], float x, float y) const;
+ void determineUV(float result[6], float x, float y, float distortion, float dispersion);
void updateDispersionAndDistortion();
void updateVariables(float distortion, float dispersion);
diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
index ebf3b772b3b..08ef1249a6a 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
@@ -23,6 +23,8 @@
#include "COM_VectorBlurOperation.h"
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
+
// use the implementation of blender internal renderer to calculate the vector blur.
extern "C" {
#include "RE_pipeline.h"
@@ -66,7 +68,7 @@ void VectorBlurOperation::deinitExecution()
this->m_inputSpeedProgram = NULL;
this->m_inputZProgram = NULL;
if (this->m_cachedInstance) {
- delete [] this->m_cachedInstance;
+ MEM_freeN(this->m_cachedInstance);
this->m_cachedInstance = NULL;
}
}
@@ -81,8 +83,7 @@ void *VectorBlurOperation::initializeTileData(rcti *rect)
MemoryBuffer *tile = (MemoryBuffer *)this->m_inputImageProgram->initializeTileData(rect);
MemoryBuffer *speed = (MemoryBuffer *)this->m_inputSpeedProgram->initializeTileData(rect);
MemoryBuffer *z = (MemoryBuffer *)this->m_inputZProgram->initializeTileData(rect);
- float *data = new float[this->getWidth() * this->getHeight() * COM_NUMBER_OF_CHANNELS];
- memcpy(data, tile->getBuffer(), this->getWidth() * this->getHeight() * COM_NUMBER_OF_CHANNELS * sizeof(float));
+ float *data = (float *)MEM_dupallocN(tile->getBuffer());
this->generateVectorBlur(data, tile, speed, z);
this->m_cachedInstance = data;
}
@@ -115,6 +116,6 @@ void VectorBlurOperation::generateVectorBlur(float *data, MemoryBuffer *inputIma
blurdata.curved = this->m_settings->curved;
blurdata.fac = this->m_settings->fac;
RE_zbuf_accumulate_vecblur(&blurdata, this->getWidth(), this->getHeight(), data, inputImage->getBuffer(), inputSpeed->getBuffer(), zbuf);
- delete [] zbuf;
+ MEM_freeN((void *)zbuf);
return;
}
diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
index d0a077fed61..6450b0716a3 100644
--- a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp
@@ -56,5 +56,6 @@ void VectorCurveOperation::executePixel(float output[4], float x, float y, Pixel
void VectorCurveOperation::deinitExecution()
{
+ CurveBaseOperation::deinitExecution();
this->m_inputProgram = NULL;
}
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 837230d9719..16168888573 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3067,9 +3067,9 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
break;
}
}
-
+
/* check if there's enough space for the toggles if the sliders are drawn too */
- if (!(draw_sliders) || ((v2d->mask.xmax - v2d->mask.xmin) > ACHANNEL_BUTTON_WIDTH / 2) ) {
+ if (!(draw_sliders) || (BLI_RCT_SIZE_X(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) {
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT))
offset += ICON_WIDTH;
@@ -3461,7 +3461,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
}
/* check if there's enough space for the toggles if the sliders are drawn too */
- if (!(draw_sliders) || ((v2d->mask.xmax - v2d->mask.xmin) > ACHANNEL_BUTTON_WIDTH / 2) ) {
+ if (!(draw_sliders) || (BLI_RCT_SIZE_X(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) {
/* protect... */
if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
offset += ICON_WIDTH;
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 3cc39238713..3255bc47148 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -125,7 +125,7 @@ void ANIM_id_update(Scene *UNUSED(scene), ID *id)
*/
/* perform syncing updates for Action Groups */
-static void animchan_sync_group(bAnimContext *UNUSED(ac), bAnimListElem *ale)
+static void animchan_sync_group(bAnimContext *ac, bAnimListElem *ale, bActionGroup **active_agrp)
{
bActionGroup *agrp = (bActionGroup *)ale->data;
ID *owner_id = ale->id;
@@ -143,22 +143,50 @@ static void animchan_sync_group(bAnimContext *UNUSED(ac), bAnimListElem *ale)
/* check if there are bones, and whether the name matches any
* NOTE: this feature will only really work if groups by default contain the F-Curves for a single bone
*/
+ // TODO: if bone gets renamed, it would be best to be able to rename the group
if (ob->pose) {
bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, agrp->name);
+ bArmature *arm = ob->data;
- /* if one matches, sync the selection status */
if (pchan) {
- if (pchan->bone && pchan->bone->flag & BONE_SELECTED)
+ bActionGroup *bgrp;
+
+ /* if one matches, sync the selection status */
+ if ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))
agrp->flag |= AGRP_SELECTED;
else
agrp->flag &= ~AGRP_SELECTED;
+
+ /* also sync active group status */
+ if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
+ /* if no previous F-Curve has active flag, then we're the first and only one to get it */
+ if (*active_agrp == NULL) {
+ agrp->flag |= AGRP_ACTIVE;
+ *active_agrp = agrp;
+ }
+ else {
+ /* someone else has already taken it - set as not active */
+ agrp->flag &= ~AGRP_ACTIVE;
+ }
+ }
+ else {
+ /* this can't possibly be active now */
+ agrp->flag &= ~AGRP_ACTIVE;
+ }
+
+ /* sync group colors */
+ bgrp = (bActionGroup *)BLI_findlink(&ob->pose->agroups, (pchan->agrp_index - 1));
+ if (bgrp) {
+ agrp->customCol = bgrp->customCol;
+ action_group_colors_sync(agrp, bgrp);
+ }
}
}
}
}
/* perform syncing updates for F-Curves */
-static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
+static void animchan_sync_fcurve(bAnimContext *ac, bAnimListElem *ale, FCurve **active_fcurve)
{
FCurve *fcu = (FCurve *)ale->data;
ID *owner_id = ale->id;
@@ -168,12 +196,13 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
*/
if (ELEM3(NULL, fcu, fcu->rna_path, owner_id))
return;
-
+
if (GS(owner_id->name) == ID_OB) {
Object *ob = (Object *)owner_id;
/* only affect if F-Curve involves pose.bones */
if ((fcu->rna_path) && strstr(fcu->rna_path, "pose.bones")) {
+ bArmature *arm = (bArmature *)ob->data;
bPoseChannel *pchan;
char *bone_name;
@@ -184,10 +213,30 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
/* F-Curve selection depends on whether the bone is selected */
if ((pchan) && (pchan->bone)) {
+ /* F-Curve selection */
if (pchan->bone->flag & BONE_SELECTED)
fcu->flag |= FCURVE_SELECTED;
else
fcu->flag &= ~FCURVE_SELECTED;
+
+ /* Active F-Curve - it should be the first one for this bone on the
+ * active object to be considered as active
+ */
+ if ((ob == ac->obact) && (pchan->bone == arm->act_bone)) {
+ /* if no previous F-Curve has active flag, then we're the first and only one to get it */
+ if (*active_fcurve == NULL) {
+ fcu->flag |= FCURVE_ACTIVE;
+ *active_fcurve = fcu;
+ }
+ else {
+ /* someone else has already taken it - set as not active */
+ fcu->flag &= ~FCURVE_ACTIVE;
+ }
+ }
+ else {
+ /* this can't possibly be active now */
+ fcu->flag &= ~FCURVE_ACTIVE;
+ }
}
}
}
@@ -202,10 +251,10 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
/* get strip name, and check if this strip is selected */
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
- seq = BKE_sequwnce_get_by_name(ed->seqbasep, seq_name, FALSE);
+ seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, FALSE);
if (seq_name) MEM_freeN(seq_name);
- /* can only add this F-Curve if it is selected */
+ /* update selection status */
if (seq) {
if (seq->flag & SELECT)
fcu->flag |= FCURVE_SELECTED;
@@ -227,12 +276,31 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale)
node = nodeFindNodebyName(ntree, node_name);
if (node_name) MEM_freeN(node_name);
- /* can only add this F-Curve if it is selected */
+ /* update selection/active status */
if (node) {
+ /* update selection status */
if (node->flag & NODE_SELECT)
fcu->flag |= FCURVE_SELECTED;
else
fcu->flag &= ~FCURVE_SELECTED;
+
+ /* update active status */
+ /* XXX: this may interfere with setting bones as active if both exist at once;
+ * then again, if that's the case, production setups aren't likely to be animating
+ * nodes while working with bones?
+ */
+ if (node->flag & NODE_ACTIVE) {
+ if (*active_fcurve == NULL) {
+ fcu->flag |= FCURVE_ACTIVE;
+ *active_fcurve = fcu;
+ }
+ else {
+ fcu->flag &= ~FCURVE_ACTIVE;
+ }
+ }
+ else {
+ fcu->flag &= ~FCURVE_ACTIVE;
+ }
}
}
}
@@ -248,25 +316,30 @@ void ANIM_sync_animchannels_to_data(const bContext *C)
bAnimListElem *ale;
int filter;
+ bActionGroup *active_agrp = NULL;
+ FCurve *active_fcurve = NULL;
+
/* get animation context info for filtering the channels */
// TODO: check on whether we need to set the area specially instead, since active area might not be ok?
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
/* filter data */
- /* NOTE: we want all channels, since we want to be able to set selection status on some of them even when collapsed */
- filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
+ /* NOTE: we want all channels, since we want to be able to set selection status on some of them even when collapsed
+ * However, don't include duplicates so that selection statuses don't override each other
+ */
+ filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS | ANIMFILTER_NODUPLIS;
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* flush settings as appropriate depending on the types of the channels */
for (ale = anim_data.first; ale; ale = ale->next) {
switch (ale->type) {
case ANIMTYPE_GROUP:
- animchan_sync_group(&ac, ale);
+ animchan_sync_group(&ac, ale, &active_agrp);
break;
case ANIMTYPE_FCURVE:
- animchan_sync_fcurve(&ac, ale);
+ animchan_sync_fcurve(&ac, ale, &active_fcurve);
break;
}
}
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index b1497712aed..a0acdd710e0 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -917,7 +917,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i
/* get strip name, and check if this strip is selected */
seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
- seq = BKE_sequwnce_get_by_name(ed->seqbasep, seq_name, FALSE);
+ seq = BKE_sequence_get_by_name(ed->seqbasep, seq_name, FALSE);
if (seq_name) MEM_freeN(seq_name);
/* can only add this F-Curve if it is selected */
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index a8daf852dda..95adaa01b94 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -354,7 +354,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
xpos = marker->frame;
/* no time correction for framelen! space is drawn with old values */
- ypixels = v2d->mask.ymax - v2d->mask.ymin;
+ ypixels = BLI_RCT_SIZE_Y(&v2d->mask);
UI_view2d_getscale(v2d, &xscale, &yscale);
glScalef(1.0f / xscale, 1.0f, 1.0f);
@@ -773,8 +773,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
if (hasNumInput(&mm->num))
break;
- dx = v2d->mask.xmax - v2d->mask.xmin;
- dx = (v2d->cur.xmax - v2d->cur.xmin) / dx;
+ dx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
if (evt->x != mm->evtx) { /* XXX maybe init for first time */
int a, offs, totmark = 0;
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 91cc602c838..e254fb7a3c4 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -229,7 +229,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
if ( (i != (data->poly_order - 1)) || ((i == 0) && data->poly_order == 2) ) {
uiDefBut(block, LABEL, 1, ") +", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
- /* set up new row for the next pair of coefficients*/
+ /* set up new row for the next pair of coefficients */
row = uiLayoutRow(layout, TRUE);
block = uiLayoutGetBlock(row);
}
@@ -336,7 +336,7 @@ static int binarysearch_fcm_envelopedata_index(FCM_EnvelopeData array[], float f
/* initialize exists-flag first */
*exists = 0;
- /* sneaky optimisations (don't go through searching process if...):
+ /* sneaky optimizations (don't go through searching process if...):
* - keyframe to be added is to be added out of current bounds
* - keyframe to be added would replace one of the existing ones on bounds
*/
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 78ac729f16e..b277d0eccb5 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -505,7 +505,7 @@ static short ok_bezier_region(KeyframeEditData *ked, BezTriple *bezt)
if (ked->data) {
short ok = 0;
- #define KEY_CHECK_OK(_index) BLI_in_rctf_v(ked->data, bezt->vec[_index])
+ #define KEY_CHECK_OK(_index) BLI_rctf_isect_pt_v(ked->data, bezt->vec[_index])
KEYFRAME_OK_CHECKS(KEY_CHECK_OK);
#undef KEY_CHECK_OK
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index dd2400ca302..738fdc229fb 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -1585,7 +1585,7 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- /* properties s*/
+ /* properties */
RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index bc154de9691..e2d15897233 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1938,7 +1938,7 @@ static void adduplicateflagNurb(Object *obedit, short flag)
}
else {
- if (newu == 1) SWAP(short, newu, newv);
+ if (newu == 1) SWAP(int, newu, newv);
newnu = (Nurb *)MEM_mallocN(sizeof(Nurb), "adduplicateN5");
memcpy(newnu, nu, sizeof(Nurb));
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 949f92c68e9..5d67b63af18 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -422,8 +422,8 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin
}
else {
if (subrect) {
- mvalf[0] = (((float)pt->x / 100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin;
- mvalf[1] = (((float)pt->y / 100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin;
+ mvalf[0] = (((float)pt->x / 100.0f) * BLI_RCT_SIZE_X(subrect)) + subrect->xmin;
+ mvalf[1] = (((float)pt->y / 100.0f) * BLI_RCT_SIZE_Y(subrect)) + subrect->ymin;
}
else {
mvalf[0] = (float)pt->x / 100.0f * ar->winx;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index fd98dd83a7d..e4bfbea75b0 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -300,8 +300,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
}
else { /* camera view, use subrect */
- out[0] = ((mval[0] - p->subrect->xmin) / ((p->subrect->xmax - p->subrect->xmin))) * 100;
- out[1] = ((mval[1] - p->subrect->ymin) / ((p->subrect->ymax - p->subrect->ymin))) * 100;
+ out[0] = ((mval[0] - p->subrect->xmin) / BLI_RCT_SIZE_X(p->subrect)) * 100;
+ out[1] = ((mval[1] - p->subrect->ymin) / BLI_RCT_SIZE_Y(p->subrect)) * 100;
}
}
}
@@ -819,13 +819,13 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, int mval[], int mvalo[], shor
y0 = (int)(gps->points->y / 100 * p->ar->winy);
}
else { /* camera view, use subrect */
- x0 = (int)((gps->points->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
- y0 = (int)((gps->points->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ x0 = (int)((gps->points->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin;
+ y0 = (int)((gps->points->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin;
}
}
/* do boundbox check first */
- if (BLI_in_rcti(rect, x0, y0)) {
+ if (BLI_rcti_isect_pt(rect, x0, y0)) {
/* only check if point is inside */
if ( ((x0 - mval[0]) * (x0 - mval[0]) + (y0 - mval[1]) * (y0 - mval[1])) <= rad * rad) {
/* free stroke */
@@ -866,15 +866,15 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, int mval[], int mvalo[], shor
y1 = (int)(pt2->y / 100 * p->ar->winy);
}
else { /* camera view, use subrect */
- x0 = (int)((pt1->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
- y0 = (int)((pt1->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
- x1 = (int)((pt2->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
- y1 = (int)((pt2->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ x0 = (int)((pt1->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin;
+ y0 = (int)((pt1->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin;
+ x1 = (int)((pt2->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin;
+ y1 = (int)((pt2->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin;
}
}
/* check that point segment of the boundbox of the eraser stroke */
- if (BLI_in_rcti(rect, x0, y0) || BLI_in_rcti(rect, x1, y1)) {
+ if (BLI_rcti_isect_pt(rect, x0, y0) || BLI_rcti_isect_pt(rect, x1, y1)) {
/* check if point segment of stroke had anything to do with
* eraser region (either within stroke painted, or on its lines)
* - this assumes that linewidth is irrelevant
@@ -1480,7 +1480,7 @@ static void gpencil_draw_apply_event(wmOperator *op, wmEvent *event)
float mousef[2];
int tablet = 0;
- /* convert from window-space to area-space mouse coordintes
+ /* convert from window-space to area-space mouse coordinates
* NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding...
*/
p->mval[0] = event->mval[0] + 1;
@@ -1667,14 +1667,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int gpencil_area_exists(bContext *C, ScrArea *sa_test)
{
bScreen *sc = CTX_wm_screen(C);
- ScrArea *sa;
-
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- if (sa == sa_test)
- return 1;
- }
-
- return 0;
+ return (BLI_findindex(&sc->areabase, sa_test) != -1);
}
static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 3a1d63574a6..13c3b180230 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -62,6 +62,8 @@ int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc);
struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc);
struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2], float *scale, float *angle);
+int ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *ar, int mval[2], float r_col[3]);
+
void ED_clip_update_frame(const struct Main *mainp, int cfra);
int ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, int fit);
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index d291c500547..6f41bef81f4 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -46,6 +46,7 @@ void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, s
struct Mask *ED_space_image_get_mask(struct SpaceImage *sima);
void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask);
+int ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *ar, int mval[2], float r_col[3]);
struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **lock_r);
void ED_space_image_release_buffer(struct SpaceImage *sima, void *lock);
int ED_space_image_has_buffer(struct SpaceImage *sima);
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index b6a1fd0f979..32baa8883e1 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -76,8 +76,11 @@ void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNod
void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, struct Scene *scene_owner);
-/* node ops.c */
+/* node_ops.c */
void ED_operatormacros_node(void);
+/* node_view.c */
+int ED_space_node_color_sample(struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]);
+
#endif /* __ED_NODE_H__ */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 0b0ad83ab21..f055c89235d 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -456,19 +456,19 @@ uiBut *uiDefBut(uiBlock *block,
void *poin,
float min, float max,
float a1, float a2, const char *tip);
-uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, const char *str, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip);
uiBut *uiDefIconBut(uiBlock *block,
int type, int retval, int icon,
@@ -477,18 +477,18 @@ uiBut *uiDefIconBut(uiBlock *block,
void *poin,
float min, float max,
float a1, float a2, const char *tip);
-uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, struct PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefIconButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, int x1, int y1, short x2, short y2, const char *tip);
+uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, struct PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefIconButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, int x, int y, short width, short height, const char *tip);
uiBut *uiDefIconTextBut(uiBlock *block,
int type, int retval, int icon, const char *str,
@@ -497,18 +497,18 @@ uiBut *uiDefIconTextBut(uiBlock *block,
void *poin,
float min, float max,
float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
-uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip);
+uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
+uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip);
/* for passing inputs to ButO buttons */
struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
@@ -573,25 +573,25 @@ typedef void (*uiIDPoinFuncFP)(struct bContext *C, const char *str, struct ID **
typedef void (*uiIDPoinFunc)(struct bContext *C, struct ID *id, int event);
uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str,
- int x1, int y1, short x2, short y2, void *idpp, const char *tip);
+ int x, int y, short width, short height, void *idpp, const char *tip);
int uiIconFromID(struct ID *id);
-uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x1, int y1, short x2, short y2, const char *tip);
+uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip);
-uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *func_arg1, const char *str, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x1, int y1, short x2, short y2, const char *tip);
+uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *func_arg1, const char *str, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x, int y, short width, short height, const char *tip);
-uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x1, int y1, short x2, short y2, const char *tip);
-uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip);
+uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, const char *tip);
+uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip);
-uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x1, int y1, short x2, short y2, short *spoin, const char *tip);
-uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, int y1, short x2, short y2, short *keypoin, short *modkeypoin, const char *tip);
+uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *spoin, const char *tip);
+uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *keypoin, short *modkeypoin, const char *tip);
-uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x1, int y1, short x2, short y2, float a1, float a2, const char *tip);
+uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip);
uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align);
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 9ab024a8b76..3a8f05a76f0 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -120,8 +120,8 @@ enum {
/* Macros: */
/* test if mouse in a scrollbar (assume that scroller availability has been tested) */
-#define IN_2D_VERT_SCROLL(v2d, co) (BLI_in_rcti_v(&v2d->vert, co))
-#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_in_rcti_v(&v2d->hor, co))
+#define IN_2D_VERT_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->vert, co))
+#define IN_2D_HORIZ_SCROLL(v2d, co) (BLI_rcti_isect_pt_v(&v2d->hor, co))
/* ------------------------------------------ */
/* Type definitions: */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 7b1150669e8..afbabaaa8d7 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -99,8 +99,8 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y
float gx, gy;
int sx, sy, getsizex, getsizey;
- getsizex = ar->winrct.xmax - ar->winrct.xmin + 1;
- getsizey = ar->winrct.ymax - ar->winrct.ymin + 1;
+ getsizex = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ getsizey = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
sx = ar->winrct.xmin;
sy = ar->winrct.ymin;
@@ -137,10 +137,7 @@ void ui_block_to_window_rct(const ARegion *ar, uiBlock *block, rctf *graph, rcti
ui_block_to_window_fl(ar, block, &tmpr.xmin, &tmpr.ymin);
ui_block_to_window_fl(ar, block, &tmpr.xmax, &tmpr.ymax);
- winr->xmin = tmpr.xmin;
- winr->ymin = tmpr.ymin;
- winr->xmax = tmpr.xmax;
- winr->ymax = tmpr.ymax;
+ BLI_rcti_rctf_copy(winr, &tmpr);
}
void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y) /* for mouse cursor */
@@ -148,8 +145,8 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y
float a, b, c, d, e, f, px, py;
int sx, sy, getsizex, getsizey;
- getsizex = ar->winrct.xmax - ar->winrct.xmin + 1;
- getsizey = ar->winrct.ymax - ar->winrct.ymin + 1;
+ getsizex = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ getsizey = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
sx = ar->winrct.xmin;
sy = ar->winrct.ymin;
@@ -196,19 +193,13 @@ void ui_window_to_region(const ARegion *ar, int *x, int *y)
void ui_block_translate(uiBlock *block, int x, int y)
{
- uiBut *bt;
+ uiBut *but;
- for (bt = block->buttons.first; bt; bt = bt->next) {
- bt->x1 += x;
- bt->y1 += y;
- bt->x2 += x;
- bt->y2 += y;
+ for (but = block->buttons.first; but; but = but->next) {
+ BLI_rctf_translate(&but->rect, x, y);
}
- block->minx += x;
- block->miny += y;
- block->maxx += x;
- block->maxy += y;
+ BLI_rctf_translate(&block->rect, x, y);
}
static void ui_text_bounds_block(uiBlock *block, float offset)
@@ -227,26 +218,27 @@ static void ui_text_bounds_block(uiBlock *block, float offset)
if (j > i) i = j;
}
- if (bt->next && bt->x1 < bt->next->x1)
+ if (bt->next && bt->rect.xmin < bt->next->rect.xmin)
lastcol++;
}
/* cope with multi collumns */
bt = block->buttons.first;
while (bt) {
- if (bt->next && bt->x1 < bt->next->x1) {
+ if (bt->next && bt->rect.xmin < bt->next->rect.xmin) {
nextcol = 1;
col++;
}
else nextcol = 0;
- bt->x1 = x1addval;
- bt->x2 = bt->x1 + i + block->bounds;
+ bt->rect.xmin = x1addval;
+ bt->rect.xmax = bt->rect.xmin + i + block->bounds;
- if (col == lastcol)
- bt->x2 = MAX2(bt->x2, offset + block->minbounds);
+ if (col == lastcol) {
+ bt->rect.xmax = maxf(bt->rect.xmax, offset + block->minbounds);
+ }
- ui_check_but(bt); // clips text again
+ ui_check_but(bt); /* clips text again */
if (nextcol)
x1addval += i + block->bounds;
@@ -262,43 +254,35 @@ void ui_bounds_block(uiBlock *block)
if (block->buttons.first == NULL) {
if (block->panel) {
- block->minx = 0.0; block->maxx = block->panel->sizex;
- block->miny = 0.0; block->maxy = block->panel->sizey;
+ block->rect.xmin = 0.0; block->rect.xmax = block->panel->sizex;
+ block->rect.ymin = 0.0; block->rect.ymax = block->panel->sizey;
}
}
else {
- block->minx = block->miny = 10000;
- block->maxx = block->maxy = -10000;
-
- bt = block->buttons.first;
- while (bt) {
- if (bt->x1 < block->minx) block->minx = bt->x1;
- if (bt->y1 < block->miny) block->miny = bt->y1;
-
- if (bt->x2 > block->maxx) block->maxx = bt->x2;
- if (bt->y2 > block->maxy) block->maxy = bt->y2;
+ BLI_rctf_init_minmax(&block->rect);
- bt = bt->next;
+ for (bt = block->buttons.first; bt; bt = bt->next) {
+ BLI_rctf_union(&block->rect, &bt->rect);
}
- block->minx -= block->bounds;
- block->miny -= block->bounds;
- block->maxx += block->bounds;
- block->maxy += block->bounds;
+ block->rect.xmin -= block->bounds;
+ block->rect.ymin -= block->bounds;
+ block->rect.xmax += block->bounds;
+ block->rect.ymax += block->bounds;
}
- block->maxx = block->minx + MAX2(block->maxx - block->minx, block->minbounds);
+ block->rect.xmax = block->rect.xmin + maxf(BLI_RCT_SIZE_X(&block->rect), block->minbounds);
/* hardcoded exception... but that one is annoying with larger safety */
bt = block->buttons.first;
if (bt && strncmp(bt->str, "ERROR", 5) == 0) xof = 10;
else xof = 40;
- block->safety.xmin = block->minx - xof;
- block->safety.ymin = block->miny - xof;
- block->safety.xmax = block->maxx + xof;
- block->safety.ymax = block->maxy + xof;
+ block->safety.xmin = block->rect.xmin - xof;
+ block->safety.ymin = block->rect.ymin - xof;
+ block->safety.xmax = block->rect.xmax + xof;
+ block->safety.ymax = block->rect.ymax + xof;
}
static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
@@ -316,13 +300,13 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
ui_bounds_block(block);
- width = block->maxx - block->minx;
- height = block->maxy - block->miny;
+ width = BLI_RCT_SIZE_X(&block->rect);
+ height = BLI_RCT_SIZE_Y(&block->rect);
startx = (xmax * 0.5f) - (width * 0.5f);
starty = (ymax * 0.5f) - (height * 0.5f);
- ui_block_translate(block, startx - block->minx, starty - block->miny);
+ ui_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin);
/* now recompute bounds and safety */
ui_bounds_block(block);
@@ -341,14 +325,14 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
wm_window_get_size(window, &xmax, &ymax);
- oldwidth = block->maxx - block->minx;
- oldheight = block->maxy - block->miny;
+ oldwidth = BLI_RCT_SIZE_X(&block->rect);
+ oldheight = BLI_RCT_SIZE_Y(&block->rect);
/* first we ensure wide enough text bounds */
if (bounds_calc == UI_BLOCK_BOUNDS_POPUP_MENU) {
if (block->flag & UI_BLOCK_LOOP) {
block->bounds = 50;
- ui_text_bounds_block(block, block->minx);
+ ui_text_bounds_block(block, block->rect.xmin);
}
}
@@ -357,8 +341,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
ui_bounds_block(block);
/* and we adjust the position to fit within window */
- width = block->maxx - block->minx;
- height = block->maxy - block->miny;
+ width = BLI_RCT_SIZE_X(&block->rect);
+ height = BLI_RCT_SIZE_Y(&block->rect);
/* avoid divide by zero below, caused by calling with no UI, but better not crash */
oldwidth = oldwidth > 0 ? oldwidth : MAX2(1, width);
@@ -366,8 +350,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
/* offset block based on mouse position, user offset is scaled
* along in case we resized the block in ui_text_bounds_block */
- startx = window->eventstate->x + block->minx + (block->mx * width) / oldwidth;
- starty = window->eventstate->y + block->miny + (block->my * height) / oldheight;
+ startx = window->eventstate->x + block->rect.xmin + (block->mx * width) / oldwidth;
+ starty = window->eventstate->y + block->rect.ymin + (block->my * height) / oldheight;
if (startx < 10)
startx = 10;
@@ -386,7 +370,7 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
starty = endy - height;
}
- ui_block_translate(block, startx - block->minx, starty - block->miny);
+ ui_block_translate(block, startx - block->rect.xmin, starty - block->rect.ymin);
/* now recompute bounds and safety */
ui_bounds_block(block);
@@ -436,10 +420,10 @@ void uiCenteredBoundsBlock(uiBlock *block, int addval)
void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy)
{
- block->minx = minx;
- block->miny = miny;
- block->maxx = maxx;
- block->maxy = maxy;
+ block->rect.xmin = minx;
+ block->rect.ymin = miny;
+ block->rect.xmax = maxx;
+ block->rect.ymax = maxy;
block->dobounds = 0;
}
@@ -504,10 +488,10 @@ static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines)
if (line->from == NULL || line->to == NULL) return;
- rect.xmin = (line->from->x1 + line->from->x2) / 2.0f;
- rect.ymin = (line->from->y1 + line->from->y2) / 2.0f;
- rect.xmax = (line->to->x1 + line->to->x2) / 2.0f;
- rect.ymax = (line->to->y1 + line->to->y2) / 2.0f;
+ rect.xmin = BLI_RCT_CENTER_X(&line->from->rect);
+ rect.ymin = BLI_RCT_CENTER_Y(&line->from->rect);
+ rect.xmax = BLI_RCT_CENTER_X(&line->to->rect);
+ rect.ymax = BLI_RCT_CENTER_Y(&line->to->rect);
if (line->flag & UI_SELECT)
glColor3ub(100, 100, 100);
@@ -526,18 +510,18 @@ static void ui_draw_links(uiBlock *block)
/* Draw the inactive lines (lines with neither button being hovered over).
* As we go, remember if we see any active or selected lines. */
- int foundselectline = 0;
- int foundactiveline = 0;
+ int foundselectline = FALSE;
+ int foundactiveline = FALSE;
for (but = block->buttons.first; but; but = but->next) {
if (but->type == LINK && but->link) {
for (line = but->link->lines.first; line; line = line->next) {
if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE))
ui_draw_linkline(line, 0);
else
- foundactiveline = 1;
+ foundactiveline = TRUE;
if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT))
- foundselectline = 1;
+ foundselectline = TRUE;
}
}
}
@@ -653,8 +637,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
*butpp = oldbut;
/* still stuff needs to be copied */
- oldbut->x1 = but->x1; oldbut->y1 = but->y1;
- oldbut->x2 = but->x2; oldbut->y2 = but->y2;
+ oldbut->rect = but->rect;
oldbut->context = but->context; /* set by Layout */
/* typically the same pointers, but not on undo/redo */
@@ -697,28 +680,27 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
{
uiBlock *oldblock;
uiBut *oldbut;
- int activate = 0, found = 0, isactive = 0;
+ int activate = FALSE, found = FALSE, isactive = FALSE;
oldblock = block->oldblock;
if (!oldblock)
- activate = 1;
+ activate = TRUE;
else {
for (oldbut = oldblock->buttons.first; oldbut; oldbut = oldbut->next) {
if (ui_but_equals_old(oldbut, but)) {
- found = 1;
+ found = TRUE;
if (oldbut->active)
- isactive = 1;
+ isactive = TRUE;
break;
}
}
}
- if (activate || found == 0) {
+ if ((activate == TRUE) || (found == FALSE)) {
ui_button_activate_do((bContext *)C, CTX_wm_region(C), but);
}
- else if (found && isactive == 0) {
-
+ else if ((found == TRUE) && (isactive == FALSE)) {
BLI_remlink(&block->buttons, but);
ui_free_but(C, but);
return 0;
@@ -764,7 +746,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
int tot_missing = 0;
/* only do it before bounding */
- if (block->minx != block->maxx)
+ if (block->rect.xmin != block->rect.xmax)
return;
for (pass = 0; pass < 2; pass++) {
@@ -865,7 +847,7 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
IDProperty *prop_menu_name = NULL;
/* only do it before bounding */
- if (block->minx != block->maxx)
+ if (block->rect.xmin != block->rect.xmax)
return;
for (but = block->buttons.first; but; but = but->next) {
@@ -928,7 +910,7 @@ void uiEndBlock(const bContext *C, uiBlock *block)
if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) {
but->flag |= UI_BUT_DISABLED;
- but->lock = 1;
+ but->lock = TRUE;
}
if (but->context)
@@ -960,7 +942,7 @@ void uiEndBlock(const bContext *C, uiBlock *block)
else if (block->dobounds == UI_BLOCK_BOUNDS_POPUP_CENTER) ui_centered_bounds_block(C, block);
else if (block->dobounds) ui_popup_bounds_block(C, block, block->dobounds);
- if (block->minx == 0.0f && block->maxx == 0.0f) uiBoundsBlock(block, 0);
+ if (block->rect.xmin == 0.0f && block->rect.xmax == 0.0f) uiBoundsBlock(block, 0);
if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
block->endblock = 1;
@@ -993,14 +975,14 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
getsizex = ar->winx;
getsizey = ar->winy;
- gx = (but ? but->x1 : block->minx) + (block->panel ? block->panel->ofsx : 0.0f);
- gy = (but ? but->y1 : block->miny) + (block->panel ? block->panel->ofsy : 0.0f);
+ gx = (but ? but->rect.xmin : block->rect.xmin) + (block->panel ? block->panel->ofsx : 0.0f);
+ gy = (but ? but->rect.ymin : block->rect.ymin) + (block->panel ? block->panel->ofsy : 0.0f);
rect->xmin = floorf(getsizex * (0.5f + 0.5f * (gx * block->winmat[0][0] + gy * block->winmat[1][0] + block->winmat[3][0])));
rect->ymin = floorf(getsizey * (0.5f + 0.5f * (gx * block->winmat[0][1] + gy * block->winmat[1][1] + block->winmat[3][1])));
- gx = (but ? but->x2 : block->maxx) + (block->panel ? block->panel->ofsx : 0.0f);
- gy = (but ? but->y2 : block->maxy) + (block->panel ? block->panel->ofsy : 0.0f);
+ gx = (but ? but->rect.xmax : block->rect.xmax) + (block->panel ? block->panel->ofsx : 0.0f);
+ gy = (but ? but->rect.ymax : block->rect.ymax) + (block->panel ? block->panel->ofsy : 0.0f);
rect->xmax = floorf(getsizex * (0.5f + 0.5f * (gx * block->winmat[0][0] + gy * block->winmat[1][0] + block->winmat[3][0])));
rect->ymax = floorf(getsizey * (0.5f + 0.5f * (gx * block->winmat[0][1] + gy * block->winmat[1][1] + block->winmat[3][1])));
@@ -1010,7 +992,7 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
/* uses local copy of style, to scale things down, and allow widgets to change stuff */
void uiDrawBlock(const bContext *C, uiBlock *block)
{
- uiStyle style = *UI_GetStyle(); // XXX pass on as arg
+ uiStyle style = *UI_GetStyle(); /* XXX pass on as arg */
ARegion *ar;
uiBut *but;
rcti rect;
@@ -1084,9 +1066,12 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
static void ui_is_but_sel(uiBut *but, double *value)
{
- short is_push = 0, is_true = 1;
+ short is_push = 0; /* (0 == UNSELECT), (1 == SELECT), (2 == DO-NOHING) */
+ short is_true = TRUE;
- if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true = 0;
+ if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) {
+ is_true = FALSE;
+ }
if (but->bit) {
int lvalue;
@@ -1215,14 +1200,14 @@ void uiComposeLinks(uiBlock *block)
void uiBlockSetButLock(uiBlock *block, int val, const char *lockstr)
{
if (val) {
- block->lock = val ? 1 : 0;
+ block->lock = val ? TRUE : FALSE;
block->lockstr = lockstr;
}
}
void uiBlockClearButLock(uiBlock *block)
{
- block->lock = 0;
+ block->lock = FALSE;
block->lockstr = NULL;
}
@@ -1369,7 +1354,7 @@ int ui_is_but_unit(uiBut *but)
if (unit_type == PROP_UNIT_NONE)
return 0;
-#if 1 // removed so angle buttons get correct snapping
+#if 1 /* removed so angle buttons get correct snapping */
if (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION)
return 0;
#endif
@@ -1532,10 +1517,15 @@ void ui_set_but_val(uiBut *but, double value)
if (but->pointype == CHA)
value = (char)floor(value + 0.5);
else if (but->pointype == SHO) {
- /* gcc 3.2.1 seems to have problems
+ /* gcc 3.2.1 seems to have problems
* casting a double like 32772.0 to
- * a short so we cast to an int, then
- * to a short */
+ * a short so we cast to an int, then
+ * to a short.
+ *
+ * Update: even in gcc.4.6 using intermediate int cast gives -32764,
+ * where as a direct cast from double to short gives -32768,
+ * if this difference isn't important we could remove this hack,
+ * since we dont support gcc3 anymore - Campbell */
int gcckludge;
gcckludge = (int) floor(value + 0.5);
value = (short)gcckludge;
@@ -2112,7 +2102,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
block = MEM_callocN(sizeof(uiBlock), "uiBlock");
block->active = 1;
block->dt = dt;
- block->evil_C = (void *)C; // XXX
+ block->evil_C = (void *)C; /* XXX */
if (scn) {
block->color_profile = (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
@@ -2221,7 +2211,7 @@ void ui_check_but(uiBut *but)
/* safety is 4 to enable small number buttons (like 'users') */
- // okwidth= -4 + (but->x2 - but->x1); // UNUSED
+ // okwidth= -4 + (BLI_RCT_SIZE_X(&but->rect)); // UNUSED
/* name: */
switch (but->type) {
@@ -2229,7 +2219,7 @@ void ui_check_but(uiBut *but)
case MENU:
case ICONTEXTROW:
- if (but->x2 - but->x1 > 24) {
+ if (BLI_RCT_SIZE_X(&but->rect) > 24.0f) {
UI_GET_BUT_VALUE_INIT(but, value);
ui_set_name_menu(but, (int)value);
}
@@ -2373,8 +2363,8 @@ static int buts_are_horiz(uiBut *but1, uiBut *but2)
{
float dx, dy;
- dx = fabs(but1->x2 - but2->x1);
- dy = fabs(but1->y1 - but2->y2);
+ dx = fabs(but1->rect.xmax - but2->rect.xmin);
+ dy = fabs(but1->rect.ymin - but2->rect.ymax);
if (dx > dy) return 0;
return 1;
@@ -2382,7 +2372,7 @@ static int buts_are_horiz(uiBut *but1, uiBut *but2)
void uiBlockEndAlign(uiBlock *block)
{
- block->flag &= ~UI_BUT_ALIGN; // all 4 flags
+ block->flag &= ~UI_BUT_ALIGN; /* all 4 flags */
}
int ui_but_can_align(uiBut *but)
@@ -2492,32 +2482,32 @@ static void ui_block_do_align_but(uiBut *first, short nr)
if (prev) {
/* simple cases */
if (rows == 0) {
- but->x1 = (prev->x2 + but->x1) / 2.0f;
- prev->x2 = but->x1;
+ but->rect.xmin = (prev->rect.xmax + but->rect.xmin) / 2.0f;
+ prev->rect.xmax = but->rect.xmin;
}
else if (cols == 0) {
- but->y2 = (prev->y1 + but->y2) / 2.0f;
- prev->y1 = but->y2;
+ but->rect.ymax = (prev->rect.ymin + but->rect.ymax) / 2.0f;
+ prev->rect.ymin = but->rect.ymax;
}
else {
if (buts_are_horiz(prev, but)) {
- but->x1 = (prev->x2 + but->x1) / 2.0f;
- prev->x2 = but->x1;
+ but->rect.xmin = (prev->rect.xmax + but->rect.xmin) / 2.0f;
+ prev->rect.xmax = but->rect.xmin;
/* copy height too */
- but->y2 = prev->y2;
+ but->rect.ymax = prev->rect.ymax;
}
else if (prev->prev && buts_are_horiz(prev->prev, prev) == 0) {
/* the previous button is a single one in its row */
- but->y2 = (prev->y1 + but->y2) / 2.0f;
- prev->y1 = but->y2;
+ but->rect.ymax = (prev->rect.ymin + but->rect.ymax) / 2.0f;
+ prev->rect.ymin = but->rect.ymax;
- but->x1 = prev->x1;
+ but->rect.xmin = prev->rect.xmin;
if (next && buts_are_horiz(but, next) == 0)
- but->x2 = prev->x2;
+ but->rect.xmax = prev->rect.xmax;
}
else {
/* the previous button is not a single one in its row */
- but->y2 = prev->y1;
+ but->rect.ymax = prev->rect.ymin;
}
}
}
@@ -2549,13 +2539,16 @@ void ui_block_do_align(uiBlock *block)
/**
* \brief ui_def_but is the function that draws many button types
*
+ * \param x,y The lower left hand corner of the button (X axis)
+ * \param width,height The size of the button.
+ *
* for float buttons:
* - \a a1 Click Step (how much to change the value each click)
* - \a a2 Number of decimal point values to display. 0 defaults to 3 (0.000)
* 1,2,3, and a maximum of 4, all greater values will be clamped to 4.
*/
static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
- int x1, int y1, short x2, short y2,
+ int x, int y, short width, short height,
void *poin, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
@@ -2586,10 +2579,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
}
memcpy(but->str, str, slen + 1);
- but->x1 = x1;
- but->y1 = y1;
- but->x2 = (x1 + x2);
- but->y2 = (y1 + y2);
+ but->rect.xmin = x;
+ but->rect.ymin = y;
+ but->rect.xmax = but->rect.xmin + width;
+ but->rect.ymax = but->rect.ymin + height;
but->poin = poin;
but->hardmin = but->softmin = min;
@@ -2602,8 +2595,8 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->lockstr = block->lockstr;
but->dt = block->dt;
- but->aspect = 1.0f; //XXX block->aspect;
- but->block = block; // pointer back, used for frontbuffer status, and picker
+ but->aspect = 1.0f; /* XXX block->aspect; */
+ but->block = block; /* pointer back, used for frontbuffer status, and picker */
if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
but->alignnr = block->alignnr;
@@ -2639,7 +2632,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
but->flag |= (block->flag & UI_BUT_ALIGN);
- if (but->lock) {
+ if (but->lock == TRUE) {
if (but->lockstr) {
but->flag |= UI_BUT_DISABLED;
}
@@ -2682,7 +2675,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
- int x1, int y1, short x2, short y2,
+ int x, int y, short width, short height,
PointerRNA *ptr, PropertyRNA *prop, int index,
float min, float max, float a1, float a2, const char *tip)
{
@@ -2794,7 +2787,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
/* now create button */
- but = ui_def_but(block, type, retval, str, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
+ but = ui_def_but(block, type, retval, str, x, y, width, height, NULL, min, max, a1, a2, tip);
but->rnapoin = *ptr;
but->rnaprop = prop;
@@ -2830,16 +2823,16 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
return but;
}
-static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
+static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
uiBut *but;
if (prop) {
- but = ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
+ but = ui_def_but_rna(block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
}
else {
- but = ui_def_but(block, type, retval, propname, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
+ but = ui_def_but(block, type, retval, propname, x, y, width, height, NULL, min, max, a1, a2, tip);
UI_DEF_BUT_RNA_DISABLE(but);
}
@@ -2847,7 +2840,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons
return but;
}
-static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but;
@@ -2862,14 +2855,14 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
tip = RNA_struct_ui_description(ot->srna);
}
- but = ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
+ but = ui_def_but(block, type, -1, str, x, y, width, height, NULL, 0, 0, 0, 0, tip);
but->optype = ot;
but->opcontext = opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
if (!ot) {
but->flag |= UI_BUT_DISABLED;
- but->lock = 1;
+ but->lock = TRUE;
but->lockstr = "";
}
@@ -2877,15 +2870,15 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
}
#if 0 /* UNUSED */
-static uiBut *UNUSED_FUNCTION(ui_def_but_operator) (uiBlock * block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+static uiBut *UNUSED_FUNCTION(ui_def_but_operator) (uiBlock * block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
if (str == NULL && ot == NULL) str = opname;
- return ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
+ return ui_def_but_operator_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
}
#endif
-static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
wmOperatorType *ot;
@@ -2901,23 +2894,23 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
tip = ot->description;
}
- but = ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ but = ui_def_but(block, type, -1, str, x, y, width, height, poin, min, max, a1, a2, tip);
but->optype = ot;
but->opcontext = opcontext;
but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
if (!ot) {
but->flag |= UI_BUT_DISABLED;
- but->lock = 1;
+ but->lock = TRUE;
but->lockstr = "";
}
return but;
}
-uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
- uiBut *but = ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
ui_check_but(but);
@@ -3036,241 +3029,241 @@ static void ui_check_but_and_iconize(uiBut *but, int icon)
ui_check_but(but);
}
-static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
int bitIdx = findBitIndex(bit);
if (bitIdx == -1) {
return NULL;
}
else {
- return uiDefBut(block, type | BIT | bitIdx, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ return uiDefBut(block, type | BIT | bitIdx, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
}
}
-uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefBut(block, type | FLO, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefBut(block, type | FLO, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefButBit(block, type | FLO, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefButBit(block, type | FLO, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefBut(block, type | INT, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefBut(block, type | INT, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefButBit(block, type | INT, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefButBit(block, type | INT, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefBut(block, type | SHO, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefBut(block, type | SHO, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefButBit(block, type | SHO, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefButBit(block, type | SHO, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefBut(block, type | CHA, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefBut(block, type | CHA, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefButBit(block, type | CHA, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefButBit(block, type | CHA, bit, retval, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
- but = ui_def_but_rna_propname(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+ but = ui_def_but_rna_propname(block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, a1, a2, tip);
ui_check_but(but);
return but;
}
-uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
- but = ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
+ but = ui_def_but_rna(block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
ui_check_but(but);
return but;
}
-uiBut *uiDefButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but;
- but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
+ but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
ui_check_but(but);
return but;
}
-uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
if (str == NULL && ot == NULL) str = opname;
- return uiDefButO_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
+ return uiDefButO_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
}
-uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
- uiBut *but = ui_def_but_operator_text(block, type, opname, opcontext, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ uiBut *but = ui_def_but_operator_text(block, type, opname, opcontext, str, x, y, width, height, poin, min, max, a1, a2, tip);
ui_check_but(but);
return but;
}
/* if a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0) */
-uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
- uiBut *but = ui_def_but(block, type, retval, "", x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ uiBut *but = ui_def_but(block, type, retval, "", x, y, width, height, poin, min, max, a1, a2, tip);
ui_check_but_and_iconize(but, icon);
return but;
}
-static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
int bitIdx = findBitIndex(bit);
if (bitIdx == -1) {
return NULL;
}
else {
- return uiDefIconBut(block, type | BIT | bitIdx, retval, icon, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ return uiDefIconBut(block, type | BIT | bitIdx, retval, icon, x, y, width, height, poin, min, max, a1, a2, tip);
}
}
-uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconBut(block, type | FLO, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconBut(block, type | FLO, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconButBit(block, type | FLO, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconButBit(block, type | FLO, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconBut(block, type | INT, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconBut(block, type | INT, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconButBit(block, type | INT, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconButBit(block, type | INT, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconBut(block, type | SHO, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconBut(block, type | SHO, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconButBit(block, type | SHO, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconButBit(block, type | SHO, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconBut(block, type | CHA, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconBut(block, type | CHA, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconButBit(block, type | CHA, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconButBit(block, type | CHA, bit, retval, icon, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
- but = ui_def_but_rna_propname(block, type, retval, "", x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+ but = ui_def_but_rna_propname(block, type, retval, "", x, y, width, height, ptr, propname, index, min, max, a1, a2, tip);
ui_check_but_and_iconize(but, icon);
return but;
}
-uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
- but = ui_def_but_rna(block, type, retval, "", x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
+ but = ui_def_but_rna(block, type, retval, "", x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
ui_check_but_and_iconize(but, icon);
return but;
}
-uiBut *uiDefIconButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, int icon, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, int icon, int x, int y, short width, short height, const char *tip)
{
uiBut *but;
- but = ui_def_but_operator_ptr(block, type, ot, opcontext, "", x1, y1, x2, y2, tip);
+ but = ui_def_but_operator_ptr(block, type, ot, opcontext, "", x, y, width, height, tip);
ui_check_but_and_iconize(but, icon);
return but;
}
-uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x, int y, short width, short height, const char *tip)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
- return uiDefIconButO_ptr(block, type, ot, opcontext, icon, x1, y1, x2, y2, tip);
+ return uiDefIconButO_ptr(block, type, ot, opcontext, icon, x, y, width, height, tip);
}
/* Button containing both string label and icon */
-uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
- uiBut *but = ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ uiBut *but = ui_def_but(block, type, retval, str, x, y, width, height, poin, min, max, a1, a2, tip);
ui_check_but_and_iconize(but, icon);
but->flag |= UI_ICON_LEFT;
return but;
}
-static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
+static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
{
int bitIdx = findBitIndex(bit);
if (bitIdx == -1) {
return NULL;
}
else {
- return uiDefIconTextBut(block, type | BIT | bitIdx, retval, icon, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+ return uiDefIconTextBut(block, type | BIT | bitIdx, retval, icon, str, x, y, width, height, poin, min, max, a1, a2, tip);
}
}
-uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextBut(block, type | FLO, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextBut(block, type | FLO, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextButBit(block, type | FLO, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextButBit(block, type | FLO, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextBut(block, type | INT, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextBut(block, type | INT, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextButBit(block, type | INT, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextButBit(block, type | INT, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextBut(block, type | SHO, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextBut(block, type | SHO, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextButBit(block, type | SHO, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextButBit(block, type | SHO, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextBut(block, type | CHA, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextBut(block, type | CHA, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
{
- return uiDefIconTextButBit(block, type | CHA, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
+ return uiDefIconTextButBit(block, type | CHA, bit, retval, icon, str, x, y, width, height, (void *) poin, min, max, a1, a2, tip);
}
-uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
- but = ui_def_but_rna_propname(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+ but = ui_def_but_rna_propname(block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, a1, a2, tip);
ui_check_but_and_iconize(but, icon);
but->flag |= UI_ICON_LEFT;
return but;
}
-uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
+uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
{
uiBut *but;
- but = ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
+ but = ui_def_but_rna(block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
ui_check_but_and_iconize(but, icon);
but->flag |= UI_ICON_LEFT;
return but;
}
-uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip)
{
uiBut *but;
- but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
+ but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x, y, width, height, tip);
ui_check_but_and_iconize(but, icon);
but->flag |= UI_ICON_LEFT;
return but;
}
-uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0);
- return uiDefIconTextButO_ptr(block, type, ot, opcontext, icon, str, x1, y1, x2, y2, tip);
+ return uiDefIconTextButO_ptr(block, type, ot, opcontext, icon, str, x, y, width, height, tip);
}
/* END Button containing both string label and icon */
@@ -3296,8 +3289,8 @@ int uiBlocksGetYMin(ListBase *lb)
int min = 0;
for (block = lb->first; block; block = block->next)
- if (block == lb->first || block->miny < min)
- min = block->miny;
+ if (block == lb->first || block->rect.ymin < min)
+ min = block->rect.ymin;
return min;
}
@@ -3321,15 +3314,15 @@ void uiBlockFlipOrder(uiBlock *block)
for (but = block->buttons.first; but; but = but->next) {
if (but->flag & UI_BUT_ALIGN) return;
- if (but->y1 < miny) miny = but->y1;
- if (but->y2 > maxy) maxy = but->y2;
+ if (but->rect.ymin < miny) miny = but->rect.ymin;
+ if (but->rect.ymax > maxy) maxy = but->rect.ymax;
}
/* mirror trick */
centy = (miny + maxy) / 2.0f;
for (but = block->buttons.first; but; but = but->next) {
- but->y1 = centy - (but->y1 - centy);
- but->y2 = centy - (but->y2 - centy);
- SWAP(float, but->y1, but->y2);
+ but->rect.ymin = centy - (but->rect.ymin - centy);
+ but->rect.ymax = centy - (but->rect.ymax - centy);
+ SWAP(float, but->rect.ymin, but->rect.ymax);
}
/* also flip order in block itself, for example for arrowkey */
@@ -3522,9 +3515,9 @@ void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg)
but->autofunc_arg = arg;
}
-uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str, int x1, int y1, short x2, short y2, void *idpp, const char *tip)
+uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str, int x, int y, short width, short height, void *idpp, const char *tip)
{
- uiBut *but = ui_def_but(block, IDPOIN, retval, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, IDPOIN, retval, str, x, y, width, height, NULL, 0.0, 0.0, 0.0, 0.0, tip);
but->idpoin_func = func;
but->idpoin_idpp = (ID **) idpp;
ui_check_but(but);
@@ -3535,17 +3528,17 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int
return but;
}
-uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
but->block_create_func = func;
ui_check_but(but);
return but;
}
-uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, NULL, 0.0, 0.0, 0.0, 0.0, tip);
but->block_create_func = func;
if (but->func_argN) {
MEM_freeN(but->func_argN);
@@ -3556,25 +3549,25 @@ uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const
}
-uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
but->block_create_func = func;
ui_check_but(but);
return but;
}
-uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
but->menu_create_func = func;
ui_check_but(but);
return but;
}
-uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
but->icon = (BIFIconID) icon;
but->flag |= UI_HAS_ICON;
@@ -3588,9 +3581,9 @@ uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, in
return but;
}
-uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, PULLDOWN, 0, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, PULLDOWN, 0, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
but->icon = (BIFIconID) icon;
but->flag |= UI_HAS_ICON;
@@ -3603,9 +3596,9 @@ uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int ic
}
/* Block button containing both string label and icon */
-uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, BLOCK, 0, str, x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
/* XXX temp, old menu calls pass on icon arrow, which is now UI_ICON_SUBMENU flag */
if (icon != ICON_RIGHTARROW_THIN) {
@@ -3622,9 +3615,9 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
}
/* Block button containing icon */
-uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x1, int y1, short x2, short y2, const char *tip)
+uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, const char *tip)
{
- uiBut *but = ui_def_but(block, BLOCK, retval, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, BLOCK, retval, "", x, y, width, height, arg, 0.0, 0.0, 0.0, 0.0, tip);
but->icon = (BIFIconID) icon;
but->flag |= UI_HAS_ICON;
@@ -3637,18 +3630,18 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int
return but;
}
-uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x1, int y1, short x2, short y2, short *spoin, const char *tip)
+uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *spoin, const char *tip)
{
- uiBut *but = ui_def_but(block, KEYEVT | SHO, retval, str, x1, y1, x2, y2, spoin, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, KEYEVT | SHO, retval, str, x, y, width, height, spoin, 0.0, 0.0, 0.0, 0.0, tip);
ui_check_but(but);
return but;
}
/* short pointers hardcoded */
/* modkeypoin will be set to KM_SHIFT, KM_ALT, KM_CTRL, KM_OSKEY bits */
-uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, int y1, short x2, short y2, short *keypoin, short *modkeypoin, const char *tip)
+uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *keypoin, short *modkeypoin, const char *tip)
{
- uiBut *but = ui_def_but(block, HOTKEYEVT | SHO, retval, str, x1, y1, x2, y2, keypoin, 0.0, 0.0, 0.0, 0.0, tip);
+ uiBut *but = ui_def_but(block, HOTKEYEVT | SHO, retval, str, x, y, width, height, keypoin, 0.0, 0.0, 0.0, 0.0, tip);
but->modifier_key = *modkeypoin;
ui_check_but(but);
return but;
@@ -3657,9 +3650,9 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, i
/* arg is pointer to string/name, use uiButSetSearchFunc() below to make this work */
/* here a1 and a2, if set, control thumbnail preview rows/cols */
-uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x1, int y1, short x2, short y2, float a1, float a2, const char *tip)
+uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip)
{
- uiBut *but = ui_def_but(block, SEARCH_MENU, retval, "", x1, y1, x2, y2, arg, 0.0, maxlen, a1, a2, tip);
+ uiBut *but = ui_def_but(block, SEARCH_MENU, retval, "", x, y, width, height, arg, 0.0, maxlen, a1, a2, tip);
but->icon = (BIFIconID) icon;
but->flag |= UI_HAS_ICON;
@@ -3828,7 +3821,9 @@ void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
buf, sizeof(buf)))
+ {
tmp = BLI_strdup(buf);
+ }
}
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index f7eff2cb22b..77dbbc878a7 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -439,8 +439,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
//glColor4f(1.0, 0.f, 0.f, 1.f);
//fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax)
- w = (rect->xmax - rect->xmin);
- h = (rect->ymax - rect->ymin);
+ w = BLI_RCT_SIZE_X(rect);
+ h = BLI_RCT_SIZE_Y(rect);
/* prevent drawing outside widget area */
glGetIntegerv(GL_SCISSOR_BOX, scissor);
glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h);
@@ -493,8 +493,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
charmax = G.charmax = 0xffff;
/* Calculate the size of the button */
- width = abs(rect->xmax - rect->xmin);
- height = abs(rect->ymax - rect->ymin);
+ width = abs(BLI_RCT_SIZE_X(rect));
+ height = abs(BLI_RCT_SIZE_Y(rect));
butw = floor(width / 12);
buth = floor(height / 6);
@@ -629,7 +629,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
}
}
-#endif // WITH_INTERNATIONAL
+#endif /* WITH_INTERNATIONAL */
#endif
static void draw_scope_end(rctf *rect, GLint *scissor)
@@ -642,8 +642,8 @@ static void draw_scope_end(rctf *rect, GLint *scissor)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* scale widget */
- scaler_x1 = rect->xmin + (rect->xmax - rect->xmin) / 2 - SCOPE_RESIZE_PAD;
- scaler_x2 = rect->xmin + (rect->xmax - rect->xmin) / 2 + SCOPE_RESIZE_PAD;
+ scaler_x1 = rect->xmin + BLI_RCT_SIZE_X(rect) / 2 - SCOPE_RESIZE_PAD;
+ scaler_x2 = rect->xmin + BLI_RCT_SIZE_X(rect) / 2 + SCOPE_RESIZE_PAD;
glColor4f(0.f, 0.f, 0.f, 0.25f);
fdrawline(scaler_x1, rect->ymin - 4, scaler_x2, rect->ymin - 4);
@@ -732,8 +732,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
rect.ymax = (float)recti->ymax - 1;
- w = rect.xmax - rect.xmin;
- h = (rect.ymax - rect.ymin) * hist->ymax;
+ w = BLI_RCT_SIZE_X(&rect);
+ h = BLI_RCT_SIZE_Y(&rect) * hist->ymax;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -805,9 +805,9 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
if (scopes->wavefrm_yfac < 0.5f)
scopes->wavefrm_yfac = 0.98f;
- w = rect.xmax - rect.xmin - 7;
- h = (rect.ymax - rect.ymin) * scopes->wavefrm_yfac;
- yofs = rect.ymin + (rect.ymax - rect.ymin - h) / 2.0f;
+ w = BLI_RCT_SIZE_X(&rect) - 7;
+ h = BLI_RCT_SIZE_Y(&rect) * scopes->wavefrm_yfac;
+ yofs = rect.ymin + (BLI_RCT_SIZE_Y(&rect) - h) / 2.0f;
w3 = w / 3.0f;
/* log scale for alpha */
@@ -1033,8 +1033,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
rect.ymax = (float)recti->ymax - 1;
- w = rect.xmax - rect.xmin;
- h = rect.ymax - rect.ymin;
+ w = BLI_RCT_SIZE_X(&rect);
+ h = BLI_RCT_SIZE_Y(&rect);
centerx = rect.xmin + w / 2;
centery = rect.ymin + h / 2;
diam = (w < h) ? w : h;
@@ -1262,12 +1262,12 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* transform to button */
glPushMatrix();
- glTranslatef(rect->xmin + 0.5f * (rect->xmax - rect->xmin), rect->ymin + 0.5f * (rect->ymax - rect->ymin), 0.0f);
+ glTranslatef(rect->xmin + 0.5f * BLI_RCT_SIZE_X(rect), rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect), 0.0f);
- if (rect->xmax - rect->xmin < rect->ymax - rect->ymin)
- size = (rect->xmax - rect->xmin) / 200.f;
+ if (BLI_RCT_SIZE_X(rect) < BLI_RCT_SIZE_Y(rect))
+ size = BLI_RCT_SIZE_X(rect) / 200.f;
else
- size = (rect->ymax - rect->ymin) / 200.f;
+ size = BLI_RCT_SIZE_Y(rect) / 200.f;
glScalef(size, size, size);
@@ -1355,8 +1355,14 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
rcti scissor_new;
int a;
- cumap = (CurveMapping *)(but->editcumap ? but->editcumap : but->poin);
- cuma = cumap->cm + cumap->cur;
+ if (but->editcumap) {
+ cumap = but->editcumap;
+ }
+ else {
+ cumap = (CurveMapping *)but->poin;
+ }
+
+ cuma = &cumap->cm[cumap->cur];
/* need scissor test, curve can draw outside of boundary */
glGetIntegerv(GL_VIEWPORT, scissor);
@@ -1365,11 +1371,14 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
scissor_new.xmax = ar->winrct.xmin + rect->xmax;
scissor_new.ymax = ar->winrct.ymin + rect->ymax;
BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new);
- glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin);
-
+ glScissor(scissor_new.xmin,
+ scissor_new.ymin,
+ BLI_RCT_SIZE_X(&scissor_new),
+ BLI_RCT_SIZE_Y(&scissor_new));
+
/* calculate offset and zoom */
- zoomx = (rect->xmax - rect->xmin - 2.0f * but->aspect) / (cumap->curr.xmax - cumap->curr.xmin);
- zoomy = (rect->ymax - rect->ymin - 2.0f * but->aspect) / (cumap->curr.ymax - cumap->curr.ymin);
+ zoomx = (BLI_RCT_SIZE_X(rect) - 2.0f * but->aspect) / BLI_RCT_SIZE_X(&cumap->curr);
+ zoomy = (BLI_RCT_SIZE_Y(rect) - 2.0f * but->aspect) / BLI_RCT_SIZE_Y(&cumap->curr);
offsx = cumap->curr.xmin - but->aspect / zoomx;
offsy = cumap->curr.ymin - but->aspect / zoomy;
@@ -1481,12 +1490,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glBegin(GL_LINE_STRIP);
if (cuma->table == NULL)
- curvemapping_changed(cumap, 0); /* 0 = no remove doubles */
+ curvemapping_changed(cumap, FALSE);
cmp = cuma->table;
/* first point */
- if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
glVertex2f(rect->xmin, rect->ymin + zoomy * (cmp[0].y - offsy));
+ }
else {
fx = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]);
fy = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]);
@@ -1498,8 +1508,9 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glVertex2f(fx, fy);
}
/* last point */
- if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
+ if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0) {
glVertex2f(rect->xmax, rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy));
+ }
else {
fx = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]);
fy = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]);
@@ -1514,7 +1525,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glPointSize(3.0f);
bglBegin(GL_POINTS);
for (a = 0; a < cuma->totpoint; a++) {
- if (cmp[a].flag & SELECT)
+ if (cmp[a].flag & CUMA_SELECT)
UI_ThemeColor(TH_TEXT_HI);
else
UI_ThemeColor(TH_TEXT);
@@ -1545,8 +1556,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
rect.ymax = (float)recti->ymax - 1;
- width = rect.xmax - rect.xmin + 1;
- height = rect.ymax - rect.ymin;
+ width = BLI_RCT_SIZE_X(&rect) + 1;
+ height = BLI_RCT_SIZE_Y(&rect);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -1621,8 +1632,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
glTranslatef(rect.xmin + track_pos[0], rect.ymin + track_pos[1], 0.f);
glScissor(ar->winrct.xmin + rect.xmin,
ar->winrct.ymin + rect.ymin,
- rect.xmax - rect.xmin,
- rect.ymax - rect.ymin);
+ BLI_RCT_SIZE_X(&rect),
+ BLI_RCT_SIZE_Y(&rect));
for (a = 0; a < 2; a++) {
if (a == 1) {
@@ -1722,8 +1733,8 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int UNUSE
glEnable(GL_BLEND);
- if (radius > (rct->ymax - rct->ymin - 10.0f) / 2.0f)
- rad = (rct->ymax - rct->ymin - 10.0f) / 2.0f;
+ if (radius > (BLI_RCT_SIZE_Y(rct) - 10.0f) / 2.0f)
+ rad = (BLI_RCT_SIZE_Y(rct) - 10.0f) / 2.0f;
else
rad = radius;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 90f8bb52826..ca52daa8cd2 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -686,20 +686,19 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
ui_window_to_block(ar, but->block, &x, &y);
- rect.xmin = but->x1; rect.xmax = but->x2;
- rect.ymin = but->y1; rect.ymax = but->y2;
+ BLI_rcti_rctf_copy(&rect, &but->rect);
if (but->imb) ; /* use button size itself */
else if (but->flag & UI_ICON_LEFT) {
- rect.xmax = rect.xmin + (rect.ymax - rect.ymin);
+ rect.xmax = rect.xmin + (BLI_RCT_SIZE_Y(&rect));
}
else {
- int delta = (rect.xmax - rect.xmin) - (rect.ymax - rect.ymin);
+ int delta = BLI_RCT_SIZE_X(&rect) - BLI_RCT_SIZE_Y(&rect);
rect.xmin += delta / 2;
rect.xmax -= delta / 2;
}
- return BLI_in_rcti(&rect, x, y);
+ return BLI_rcti_isect_pt(&rect, x, y);
}
static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
@@ -715,7 +714,7 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
if (but->imb)
- WM_event_drag_image(drag, but->imb, but->imb_scale, but->x2 - but->x1, but->y2 - but->y1);
+ WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_RCT_SIZE_X(&but->rect), BLI_RCT_SIZE_Y(&but->rect));
return 1;
}
@@ -839,6 +838,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
/* (3) add a new controller */
if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) {
cont = (bController *)ob->controllers.last;
+ cont->type = CONT_LOGIC_AND; /* Quick fix to make sure we always have an AND controller. It might be nicer to make sure the operator gives us the right one though... */
/* (4) link the sensor->controller->actuator */
tmp_but = MEM_callocN(sizeof(uiBut), "uiBut");
@@ -1140,8 +1140,9 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
static ColorBand but_copypaste_coba = {0};
char buf[UI_MAX_DRAW_STR + 1] = {0};
- if (mode == 'v' && but->lock)
+ if (mode == 'v' && but->lock == TRUE) {
return;
+ }
if (mode == 'v') {
/* extract first line from clipboard in case of multi-line copies */
@@ -1282,7 +1283,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
{
uiStyle *style = UI_GetStyle(); // XXX pass on as arg
uiFontStyle *fstyle = &style->widget;
- int startx = but->x1;
+ int startx = but->rect.xmin;
char *origstr;
uiStyleFontSet(fstyle);
@@ -1296,7 +1297,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
/* XXX solve generic */
if (but->type == NUM || but->type == NUMSLI)
- startx += (int)(0.5f * (but->y2 - but->y1));
+ startx += (int)(0.5f * (BLI_RCT_SIZE_Y(&but->rect)));
else if (ELEM(but->type, TEX, SEARCH_MENU)) {
startx += 5;
if (but->flag & UI_HAS_ICON)
@@ -2537,11 +2538,11 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* XXX hardcoded keymap check.... */
if (event->type == WHEELDOWNMOUSE && event->alt) {
- mx = but->x1;
+ mx = but->rect.xmin;
click = 1;
}
else if (event->type == WHEELUPMOUSE && event->alt) {
- mx = but->x2;
+ mx = but->rect.xmax;
click = 1;
}
else if (event->val == KM_PRESS) {
@@ -2611,7 +2612,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
softmax = but->softmax;
if (!ui_is_but_float(but)) {
- if (mx < (but->x1 + (but->x2 - but->x1) / 3 - 3)) {
+ if (mx < (but->rect.xmin + BLI_RCT_SIZE_X(&but->rect) / 3 - 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
temp = (int)data->value - 1;
@@ -2622,7 +2623,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if (mx > (but->x1 + (2 * (but->x2 - but->x1) / 3) + 3)) {
+ else if (mx > (but->rect.xmin + (2 * BLI_RCT_SIZE_X(&but->rect) / 3) + 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
temp = (int)data->value + 1;
@@ -2637,7 +2638,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
}
else {
- if (mx < (but->x1 + (but->x2 - but->x1) / 3 - 3)) {
+ if (mx < (but->rect.xmin + BLI_RCT_SIZE_X(&but->rect) / 3 - 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
tempf = (float)data->value - 0.01f * but->a1;
@@ -2646,7 +2647,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
- else if (mx > but->x1 + (2 * ((but->x2 - but->x1) / 3) + 3)) {
+ else if (mx > but->rect.xmin + (2 * (BLI_RCT_SIZE_X(&but->rect) / 3) + 3)) {
button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
tempf = (float)data->value + 0.01f * but->a1;
@@ -2674,14 +2675,14 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, const short
softmax = but->softmax;
softrange = softmax - softmin;
- if (but->type == NUMSLI) deler = ((but->x2 - but->x1) - 5.0f * but->aspect);
- else if (but->type == HSVSLI) deler = ((but->x2 - but->x1) / 2.0f - 5.0f * but->aspect);
+ if (but->type == NUMSLI) deler = (BLI_RCT_SIZE_X(&but->rect) - 5.0f * but->aspect);
+ else if (but->type == HSVSLI) deler = (BLI_RCT_SIZE_X(&but->rect) / 2.0f - 5.0f * but->aspect);
else if (but->type == SCROLL) {
- int horizontal = (but->x2 - but->x1 > but->y2 - but->y1);
- float size = (horizontal) ? (but->x2 - but->x1) : -(but->y2 - but->y1);
+ int horizontal = (BLI_RCT_SIZE_X(&but->rect) > BLI_RCT_SIZE_Y(&but->rect));
+ float size = (horizontal) ? BLI_RCT_SIZE_X(&but->rect) : -BLI_RCT_SIZE_Y(&but->rect);
deler = size * (but->softmax - but->softmin) / (but->softmax - but->softmin + but->a1);
}
- else deler = (but->x2 - but->x1 - 5.0f * but->aspect);
+ else deler = (BLI_RCT_SIZE_X(&but->rect) - 5.0f * but->aspect);
f = (float)(mx - data->dragstartx) / deler + data->dragfstart;
@@ -2750,11 +2751,11 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
if (data->state == BUTTON_STATE_HIGHLIGHT) {
/* XXX hardcoded keymap check.... */
if (event->type == WHEELDOWNMOUSE && event->alt) {
- mx = but->x1;
+ mx = but->rect.xmin;
click = 2;
}
else if (event->type == WHEELUPMOUSE && event->alt) {
- mx = but->x2;
+ mx = but->rect.xmax;
click = 2;
}
else if (event->val == KM_PRESS) {
@@ -2764,12 +2765,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
/* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */
else if (event->type == LEFTMOUSE && event->alt) {
- int halfpos = (but->x1 + but->x2) / 2;
+ int halfpos = BLI_RCT_CENTER_X(&but->rect);
click = 2;
if (mx < halfpos)
- mx = but->x1;
+ mx = but->rect.xmin;
else
- mx = but->x2;
+ mx = but->rect.xmax;
}
else if (event->type == LEFTMOUSE) {
data->dragstartx = mx;
@@ -2831,12 +2832,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
#if 0
if (but->type == SLI) {
- f = (float)(mx - but->x1) / (but->x2 - but->x1); /* same as below */
+ f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect)); /* same as below */
}
else
#endif
{
- f = (float)(mx - but->x1) / (but->x2 - but->x1);
+ f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect));
}
f = softmin + f * softrange;
@@ -2877,7 +2878,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
{
int mx, my /*, click= 0 */;
int retval = WM_UI_HANDLER_CONTINUE;
- int horizontal = (but->x2 - but->x1 > but->y2 - but->y1);
+ int horizontal = (BLI_RCT_SIZE_X(&but->rect) > BLI_RCT_SIZE_Y(&but->rect));
mx = event->x;
my = event->y;
@@ -2946,9 +2947,11 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
return WM_UI_HANDLER_BREAK;
}
else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
-
- if (event->type == WHEELDOWNMOUSE && event->alt) {
- data->value = ui_step_name_menu(but, -1);
+ if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
+ const int direction = (event->type == WHEELDOWNMOUSE) ? -1 : 1;
+
+ data->value = ui_step_name_menu(but, direction);
+
button_activate_state(C, but, BUTTON_STATE_EXIT);
ui_apply_button(C, but->block, but, data, 1);
@@ -2962,16 +2965,15 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
data->postbut = but;
data->posttype = BUTTON_ACTIVATE_OVER;
- return WM_UI_HANDLER_BREAK;
- }
- else if (event->type == WHEELUPMOUSE && event->alt) {
- data->value = ui_step_name_menu(but, 1);
- button_activate_state(C, but, BUTTON_STATE_EXIT);
- ui_apply_button(C, but->block, but, data, 1);
-
- /* why this is needed described above */
- data->postbut = but;
- data->posttype = BUTTON_ACTIVATE_OVER;
+ /* without this, a new interface that draws as result of the menu change
+ * won't register that the mouse is over it, eg:
+ * Alt+MouseWheel over the render slots, without this,
+ * the slot menu fails to switch a second time.
+ *
+ * The active state of the button could be maintained some other way
+ * and remove this mousemove event.
+ */
+ WM_event_add_mousemove(C);
return WM_UI_HANDLER_BREAK;
}
@@ -3034,7 +3036,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i
* else we'll get a harmless but annoying jump when first clicking */
fp = data->origvec;
- rad = (but->x2 - but->x1);
+ rad = BLI_RCT_SIZE_X(&but->rect);
radsq = rad * rad;
if (fp[2] > 0.0f) {
@@ -3142,8 +3144,8 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
/* relative position within box */
- x = ((float)mx_fl - but->x1) / (but->x2 - but->x1);
- y = ((float)my_fl - but->y1) / (but->y2 - but->y1);
+ x = ((float)mx_fl - but->rect.xmin) / BLI_RCT_SIZE_X(&but->rect);
+ y = ((float)my_fl - but->rect.ymin) / BLI_RCT_SIZE_Y(&but->rect);
CLAMP(x, 0.0f, 1.0f);
CLAMP(y, 0.0f, 1.0f);
@@ -3348,9 +3350,8 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, float
ui_mouse_scale_warp(data, mx, my, &mx_fl, &my_fl, shift);
- rect.xmin = but->x1; rect.xmax = but->x2;
- rect.ymin = but->y1; rect.ymax = but->y2;
-
+ BLI_rcti_rctf_copy(&rect, &but->rect);
+
ui_get_but_vectorf(but, rgb);
copy_v3_v3(hsv, ui_block_hsv_get(but->block));
rgb_to_hsv_compat_v(rgb, hsv);
@@ -3541,7 +3542,7 @@ static int ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int mx
if (data->draglastx == mx)
return changed;
- dx = ((float)(mx - data->draglastx)) / (but->x2 - but->x1);
+ dx = ((float)(mx - data->draglastx)) / BLI_RCT_SIZE_X(&but->rect);
data->dragcbd->pos += dx;
CLAMP(data->dragcbd->pos, 0.0f, 1.0f);
@@ -3570,7 +3571,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
if (event->ctrl) {
/* insert new key on mouse location */
- float pos = ((float)(mx - but->x1)) / (but->x2 - but->x1);
+ float pos = ((float)(mx - but->rect.xmin)) / BLI_RCT_SIZE_X(&but->rect);
colorband_element_add(coba, pos);
button_activate_state(C, but, BUTTON_STATE_EXIT);
}
@@ -3582,7 +3583,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
/* activate new key when mouse is close */
for (a = 0, cbd = coba->data; a < coba->tot; a++, cbd++) {
- xco = but->x1 + (cbd->pos * (but->x2 - but->x1));
+ xco = but->rect.xmin + (cbd->pos * BLI_RCT_SIZE_X(&but->rect));
xco = ABS(xco - mx);
if (a == coba->cur) xco += 5; // selected one disadvantage
if (xco < mindist) {
@@ -3623,8 +3624,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
float fx, fy, zoomx, zoomy /*, offsx, offsy */ /* UNUSED */;
int a, changed = 0;
- zoomx = (but->x2 - but->x1) / (cumap->curr.xmax - cumap->curr.xmin);
- zoomy = (but->y2 - but->y1) / (cumap->curr.ymax - cumap->curr.ymin);
+ zoomx = BLI_RCT_SIZE_X(&but->rect) / BLI_RCT_SIZE_X(&cumap->curr);
+ zoomy = BLI_RCT_SIZE_Y(&but->rect) / BLI_RCT_SIZE_Y(&cumap->curr);
/* offsx= cumap->curr.xmin; */
/* offsy= cumap->curr.ymin; */
@@ -3649,7 +3650,7 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
fy *= mval_factor;
for (a = 0; a < cuma->totpoint; a++) {
- if (cmp[a].flag & SELECT) {
+ if (cmp[a].flag & CUMA_SELECT) {
float origx = cmp[a].x, origy = cmp[a].y;
cmp[a].x += fx;
cmp[a].y += fy;
@@ -3662,7 +3663,7 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
}
}
- curvemapping_changed(cumap, 0); /* no remove doubles */
+ curvemapping_changed(cumap, FALSE);
if (moved_point) {
data->draglastx = mx;
@@ -3719,25 +3720,25 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
float dist, mindist = 200.0f; // 14 pixels radius
int sel = -1;
- zoomx = (but->x2 - but->x1) / (cumap->curr.xmax - cumap->curr.xmin);
- zoomy = (but->y2 - but->y1) / (cumap->curr.ymax - cumap->curr.ymin);
+ zoomx = BLI_RCT_SIZE_X(&but->rect) / BLI_RCT_SIZE_X(&cumap->curr);
+ zoomy = BLI_RCT_SIZE_Y(&but->rect) / BLI_RCT_SIZE_Y(&cumap->curr);
offsx = cumap->curr.xmin;
offsy = cumap->curr.ymin;
if (event->ctrl) {
- fx = ((float)mx - but->x1) / zoomx + offsx;
- fy = ((float)my - but->y1) / zoomy + offsy;
+ fx = ((float)mx - but->rect.xmin) / zoomx + offsx;
+ fy = ((float)my - but->rect.ymin) / zoomy + offsy;
curvemap_insert(cuma, fx, fy);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
changed = 1;
}
/* check for selecting of a point */
cmp = cuma->curve; /* ctrl adds point, new malloc */
for (a = 0; a < cuma->totpoint; a++) {
- fx = but->x1 + zoomx * (cmp[a].x - offsx);
- fy = but->y1 + zoomy * (cmp[a].y - offsy);
+ fx = but->rect.xmin + zoomx * (cmp[a].x - offsx);
+ fy = but->rect.ymin + zoomy * (cmp[a].y - offsy);
dist = (fx - mx) * (fx - mx) + (fy - my) * (fy - my);
if (dist < mindist) {
sel = a;
@@ -3750,20 +3751,20 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* if the click didn't select anything, check if it's clicked on the
* curve itself, and if so, add a point */
- fx = ((float)mx - but->x1) / zoomx + offsx;
- fy = ((float)my - but->y1) / zoomy + offsy;
+ fx = ((float)mx - but->rect.xmin) / zoomx + offsx;
+ fy = ((float)my - but->rect.ymin) / zoomy + offsy;
cmp = cuma->table;
/* loop through the curve segment table and find what's near the mouse.
* 0.05 is kinda arbitrary, but seems to be what works nicely. */
for (i = 0; i <= CM_TABLE; i++) {
- if ( (fabsf(fx - cmp[i].x) < 0.05f) &&
- (fabsf(fy - cmp[i].y) < 0.05f))
+ if ((fabsf(fx - cmp[i].x) < 0.05f) &&
+ (fabsf(fy - cmp[i].y) < 0.05f))
{
curvemap_insert(cuma, fx, fy);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
changed = 1;
@@ -3785,11 +3786,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* deselect all if this one is deselect. except if we hold shift */
if (event->shift == FALSE) {
for (a = 0; a < cuma->totpoint; a++)
- cmp[a].flag &= ~SELECT;
- cmp[sel].flag |= SELECT;
+ cmp[a].flag &= ~CUMA_SELECT;
+ cmp[sel].flag |= CUMA_SELECT;
}
else
- cmp[sel].flag ^= SELECT;
+ cmp[sel].flag ^= CUMA_SELECT;
}
else {
/* move the view */
@@ -3824,12 +3825,13 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* deselect all, select one */
if (event->shift == FALSE) {
for (a = 0; a < cuma->totpoint; a++)
- cmp[a].flag &= ~SELECT;
- cmp[data->dragsel].flag |= SELECT;
+ cmp[a].flag &= ~CUMA_SELECT;
+ cmp[data->dragsel].flag |= CUMA_SELECT;
}
}
- else
- curvemapping_changed(cumap, 1); /* remove doubles */
+ else {
+ curvemapping_changed(cumap, TRUE); /* remove doubles */
+ }
}
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -3846,8 +3848,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
static int in_scope_resize_zone(uiBut *but, int UNUSED(x), int y)
{
- /* bottom corner return (x > but->x2 - SCOPE_RESIZE_PAD) && (y < but->y1 + SCOPE_RESIZE_PAD); */
- return (y < but->y1 + SCOPE_RESIZE_PAD);
+ /* bottom corner return (x > but->rect.xmax - SCOPE_RESIZE_PAD) && (y < but->rect.ymin + SCOPE_RESIZE_PAD); */
+ return (y < but->rect.ymin + SCOPE_RESIZE_PAD);
}
static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx, int my)
@@ -3857,15 +3859,14 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
int changed = 1;
float /* dx, */ dy; /* UNUSED */
- /* rect.xmin = but->x1; rect.xmax = but->x2; */
- /* rect.ymin = but->y1; rect.ymax = but->y2; */
+ /* BLI_rcti_rctf_copy(&rect, &but->rect); */
/* dx = mx - data->draglastx; */ /* UNUSED */
dy = my - data->draglasty;
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize histogram widget itself */
- hist->height = (but->y2 - but->y1) + (data->dragstarty - my);
+ hist->height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
else {
/* scale histogram values (dy / 10 for better control) */
@@ -3941,8 +3942,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
int changed = 1;
float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */
- /* rect.xmin = but->x1; rect.xmax = but->x2; */
- /* rect.ymin = but->y1; rect.ymax = but->y2; */
+ /* BLI_rcti_rctf_copy(&rect, &but->rect); */
/* dx = mx - data->draglastx; */ /* UNUSED */
dy = my - data->draglasty;
@@ -3950,7 +3950,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize waveform widget itself */
- scopes->wavefrm_height = (but->y2 - but->y1) + (data->dragstarty - my);
+ scopes->wavefrm_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
else {
/* scale waveform values */
@@ -4025,15 +4025,14 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
int changed = 1;
/* float dx, dy; */
- /* rect.xmin = but->x1; rect.xmax = but->x2; */
- /* rect.ymin = but->y1; rect.ymax = but->y2; */
+ /* BLI_rcti_rctf_copy(&rect, &but->rect); */
/* dx = mx - data->draglastx; */
/* dy = my - data->draglasty; */
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize vectorscope widget itself */
- scopes->vecscope_height = (but->y2 - but->y1) + (data->dragstarty - my);
+ scopes->vecscope_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
data->draglastx = mx;
@@ -4103,17 +4102,17 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
if (data->state == BUTTON_STATE_HIGHLIGHT) {
if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
/* Calculate the size of the button */
- width = abs(but->x2 - but->x1);
- height = abs(but->y2 - but->y1);
+ width = abs(BLI_RCT_SIZE_X(&but->rect));
+ height = abs(BLI_RCT_SIZE_Y(&but->rect));
butw = floor(width / 12);
buth = floor(height / 6);
/* Initialize variables */
- sx = but->x1;
- ex = but->x1 + butw;
- sy = but->y1 + height - buth;
- ey = but->y1 + height;
+ sx = but->rect.xmin;
+ ex = but->rect.xmin + butw;
+ sy = but->rect.ymin + height - buth;
+ ey = but->rect.ymin + height;
cs = G.charstart;
@@ -4236,7 +4235,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize preview widget itself */
- scopes->track_preview_height = (but->y2 - but->y1) + (data->dragstarty - my);
+ scopes->track_preview_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
else {
if (!scopes->track_locked) {
@@ -4244,8 +4243,8 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa
scopes->marker = BKE_tracking_marker_ensure(scopes->track, scopes->framenr);
scopes->marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
- scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / (but->block->maxx - but->block->minx);
- scopes->marker->pos[1] += -dy * scopes->slide_scale[1] / (but->block->maxy - but->block->miny);
+ scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / BLI_RCT_SIZE_X(&but->block->rect);
+ scopes->marker->pos[1] += -dy * scopes->slide_scale[1] / BLI_RCT_SIZE_Y(&but->block->rect);
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
}
@@ -4712,7 +4711,6 @@ static int ui_but_menu(bContext *C, uiBut *but)
static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
{
-// Scene *scene= CTX_data_scene(C);
uiHandleButtonData *data;
int retval;
@@ -4796,7 +4794,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
/* verify if we can edit this button */
if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
/* this should become disabled button .. */
- if (but->lock) {
+ if (but->lock == TRUE) {
if (but->lockstr) {
BKE_report(NULL, RPT_WARNING, but->lockstr);
button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4879,7 +4877,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
retval = ui_do_but_BUT(C, but, data, event);
break;
case COL:
- if (but->a1 == UI_GRAD_V_ALT) // signal to prevent calling up color picker
+ if (but->a1 == UI_GRAD_V_ALT) /* signal to prevent calling up color picker */
retval = ui_do_but_EXIT(C, but, data, event);
else
retval = ui_do_but_BLOCK(C, but, data, event);
@@ -4921,7 +4919,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
static int ui_but_contains_pt(uiBut *but, int mx, int my)
{
- return ((but->x1 < mx && but->x2 >= mx) && (but->y1 < my && but->y2 >= my));
+ return BLI_rctf_isect_pt(&but->rect, mx, my);
}
static uiBut *ui_but_find_activated(ARegion *ar)
@@ -4997,7 +4995,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
uiBlock *block;
/* check if the mouse is in the region */
- if (!BLI_in_rcti(&ar->winrct, x, y)) {
+ if (!BLI_rcti_isect_pt(&ar->winrct, x, y)) {
for (block = ar->uiblocks.first; block; block = block->next)
block->auto_open = FALSE;
@@ -5020,10 +5018,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
ui_window_to_region(ar, &mx, &my);
/* make a copy of the mask rect, and tweak accordingly for hidden scrollbars */
- mask_rct.xmin = v2d->mask.xmin;
- mask_rct.xmax = v2d->mask.xmax;
- mask_rct.ymin = v2d->mask.ymin;
- mask_rct.ymax = v2d->mask.ymax;
+ mask_rct = v2d->mask;
if (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE | V2D_SCROLL_VERTICAL_FULLR)) {
if (v2d->scroll & V2D_SCROLL_LEFT)
@@ -5039,7 +5034,7 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
}
/* check if in the rect */
- if (!BLI_in_rcti(&mask_rct, mx, my))
+ if (!BLI_rcti_isect_pt(&mask_rct, mx, my))
return 0;
}
@@ -5092,9 +5087,7 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
/* CLIP_EVENTS prevents the event from reaching other blocks */
if (block->flag & UI_BLOCK_CLIP_EVENTS) {
/* check if mouse is inside block */
- if (block->minx <= mx && block->maxx >= mx &&
- block->miny <= my && block->maxy >= my)
- {
+ if (BLI_rctf_isect_pt(&block->rect, mx, my)) {
break;
}
}
@@ -5290,8 +5283,13 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
data->wm = CTX_wm_manager(C);
data->window = CTX_wm_window(C);
data->region = ar;
- if (ELEM(but->type, BUT_CURVE, SEARCH_MENU) ) ; // XXX curve is temp
- else data->interactive = 1;
+
+ if (ELEM(but->type, BUT_CURVE, SEARCH_MENU)) {
+ /* XXX curve is temp */
+ }
+ else {
+ data->interactive = 1;
+ }
data->state = BUTTON_STATE_INIT;
@@ -5979,17 +5977,17 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
/* verify that we are moving towards one of the edges of the
* menu block, in other words, in the triangle formed by the
* initial mouse location and two edge points. */
- p1[0] = block->minx - 20;
- p1[1] = block->miny - 20;
+ p1[0] = block->rect.xmin - 20;
+ p1[1] = block->rect.ymin - 20;
- p2[0] = block->maxx + 20;
- p2[1] = block->miny - 20;
+ p2[0] = block->rect.xmax + 20;
+ p2[1] = block->rect.ymin - 20;
- p3[0] = block->maxx + 20;
- p3[1] = block->maxy + 20;
+ p3[0] = block->rect.xmax + 20;
+ p3[1] = block->rect.ymax + 20;
- p4[0] = block->minx - 20;
- p4[1] = block->maxy + 20;
+ p4[0] = block->rect.xmin - 20;
+ p4[1] = block->rect.ymax + 20;
oldp[0] = menu->towardsx;
oldp[1] = menu->towardsy;
@@ -6019,10 +6017,10 @@ static char ui_menu_scroll_test(uiBlock *block, int my)
{
if (block->flag & (UI_BLOCK_CLIPTOP | UI_BLOCK_CLIPBOTTOM)) {
if (block->flag & UI_BLOCK_CLIPTOP)
- if (my > block->maxy - 14)
+ if (my > block->rect.ymax - 14)
return 't';
if (block->flag & UI_BLOCK_CLIPBOTTOM)
- if (my < block->miny + 14)
+ if (my < block->rect.ymin + 14)
return 'b';
}
return 0;
@@ -6053,25 +6051,25 @@ static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
if (test == 't') {
/* bottom button is first button */
- if (b1->y1 < b2->y1)
- dy = bnext->y1 - b1->y1;
+ if (b1->rect.ymin < b2->rect.ymin)
+ dy = bnext->rect.ymin - b1->rect.ymin;
/* bottom button is last button */
else
- dy = bprev->y1 - b2->y1;
+ dy = bprev->rect.ymin - b2->rect.ymin;
}
else if (test == 'b') {
/* bottom button is first button */
- if (b1->y1 < b2->y1)
- dy = b1->y1 - bnext->y1;
+ if (b1->rect.ymin < b2->rect.ymin)
+ dy = b1->rect.ymin - bnext->rect.ymin;
/* bottom button is last button */
else
- dy = b2->y1 - bprev->y1;
+ dy = b2->rect.ymin - bprev->rect.ymin;
}
if (dy) {
for (b1 = block->buttons.first; b1; b1 = b1->next) {
- b1->y1 -= dy;
- b1->y2 -= dy;
+ b1->rect.ymin -= dy;
+ b1->rect.ymax -= dy;
}
/* set flags again */
ui_popup_block_scrolltest(block);
@@ -6103,10 +6101,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
ui_window_to_block(ar, block, &mx, &my);
/* check if mouse is inside block */
- inside = 0;
- if (block->minx <= mx && block->maxx >= mx)
- if (block->miny <= my && block->maxy >= my)
- inside = 1;
+ inside = BLI_rctf_isect_pt(&block->rect, mx, my);
/* if there's an active modal button, don't check events or outside, except for search menu */
but = ui_but_find_activated(ar);
@@ -6355,7 +6350,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
uiSafetyRct *saferct = block->saferct.first;
if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val == KM_PRESS) {
- if (saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y)) {
+ if (saferct && !BLI_rctf_isect_pt(&saferct->parent, event->x, event->y)) {
if (block->flag & (UI_BLOCK_OUT_1))
menu->menuretval = UI_RETURN_OK;
else
@@ -6388,9 +6383,9 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
* events we check all preceding block rects too to make
* arrow keys navigation work */
if (event->type != MOUSEMOVE || saferct == block->saferct.first) {
- if (BLI_in_rctf(&saferct->parent, (float)event->x, (float)event->y))
+ if (BLI_rctf_isect_pt(&saferct->parent, (float)event->x, (float)event->y))
break;
- if (BLI_in_rctf(&saferct->safety, (float)event->x, (float)event->y))
+ if (BLI_rctf_isect_pt(&saferct->safety, (float)event->x, (float)event->y))
break;
}
}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 2bfead708be..dd3c2e491a7 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -596,7 +596,7 @@ static void init_internal_icons(void)
IMB_freeImBuf(bbuf);
}
-#endif // WITH_HEADLESS
+#endif /* WITH_HEADLESS */
static void init_iconfile_list(struct ListBase *list)
{
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index c6787b4c554..567109e26d0 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -158,7 +158,7 @@ struct uiBut {
char strdata[UI_MAX_NAME_STR];
char drawstr[UI_MAX_DRAW_STR];
- float x1, y1, x2, y2;
+ rctf rect;
char *poin;
float hardmin, hardmax, softmin, softmax;
@@ -176,7 +176,7 @@ struct uiBut {
struct bContextStore *context;
- /* not ysed yet, was used in 2.4x for ui_draw_pulldown_round & friends */
+ /* not used yet, was used in 2.4x for ui_draw_pulldown_round & friends */
#if 0
void (*embossfunc)(int, int, float, float, float, float, float, int);
void (*sliderfunc)(int, float, float, float, float, float, float, int);
@@ -264,8 +264,8 @@ struct uiBlock {
char name[UI_MAX_NAME_STR];
float winmat[4][4];
-
- float minx, miny, maxx, maxy;
+
+ rctf rect;
float aspect;
int puphash; /* popup menu hash for memory */
@@ -303,27 +303,27 @@ struct uiBlock {
const char *lockstr;
char lock;
- char active; // to keep blocks while drawing and free them afterwards
- char tooltipdisabled; // to avoid tooltip after click
- char endblock; // uiEndBlock done?
-
- float xofs, yofs; // offset to parent button
- int dobounds, mx, my; // for doing delayed
- int bounds, minbounds; // for doing delayed
+ char active; /* to keep blocks while drawing and free them afterwards */
+ char tooltipdisabled; /* to avoid tooltip after click */
+ char endblock; /* uiEndBlock done? */
+
+ float xofs, yofs; /* offset to parent button */
+ int dobounds, mx, my; /* for doing delayed */
+ int bounds, minbounds; /* for doing delayed */
- rctf safety; // pulldowns, to detect outside, can differ per case how it is created
- ListBase saferct; // uiSafetyRct list
+ rctf safety; /* pulldowns, to detect outside, can differ per case how it is created */
+ ListBase saferct; /* uiSafetyRct list */
- uiPopupBlockHandle *handle; // handle
+ uiPopupBlockHandle *handle; /* handle */
- struct wmOperator *ui_operator; // use so presets can find the operator,
- // across menus and from nested popups which fail for operator context.
+ struct wmOperator *ui_operator; /* use so presets can find the operator, */
+ /* across menus and from nested popups which fail for operator context. */
- void *evil_C; // XXX hack for dynamic operator enums
+ void *evil_C; /* XXX hack for dynamic operator enums */
- struct UnitSettings *unit; // unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time.
- float _hsv[3]; // XXX, only access via ui_block_hsv_get()
- char color_profile; // color profile for correcting linear colors for display
+ struct UnitSettings *unit; /* unit system, used a lot for numeric buttons so include here rather then fetching through the scene every time. */
+ float _hsv[3]; /* XXX, only access via ui_block_hsv_get() */
+ char color_profile; /* color profile for correcting linear colors for display */
};
typedef struct uiSafetyRct {
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 10fde402acc..b68e14898d0 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -39,6 +39,7 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
+#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BLF_translation.h"
@@ -238,8 +239,10 @@ static void ui_item_size(uiItem *item, int *r_w, int *r_h)
if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem = (uiButtonItem *)item;
- if (r_w) *r_w = bitem->but->x2 - bitem->but->x1;
- if (r_h) *r_h = bitem->but->y2 - bitem->but->y1;
+
+
+ if (r_w) *r_w = BLI_RCT_SIZE_X(&bitem->but->rect);
+ if (r_h) *r_h = BLI_RCT_SIZE_Y(&bitem->but->rect);
}
else {
uiLayout *litem = (uiLayout *)item;
@@ -254,8 +257,8 @@ static void ui_item_offset(uiItem *item, int *r_x, int *r_y)
if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem = (uiButtonItem *)item;
- if (r_x) *r_x = bitem->but->x1;
- if (r_y) *r_y = bitem->but->y1;
+ if (r_x) *r_x = bitem->but->rect.xmin;
+ if (r_y) *r_y = bitem->but->rect.ymin;
}
else {
if (r_x) *r_x = 0;
@@ -268,10 +271,10 @@ static void ui_item_position(uiItem *item, int x, int y, int w, int h)
if (item->type == ITEM_BUTTON) {
uiButtonItem *bitem = (uiButtonItem *)item;
- bitem->but->x1 = x;
- bitem->but->y1 = y;
- bitem->but->x2 = x + w;
- bitem->but->y2 = y + h;
+ bitem->but->rect.xmin = x;
+ bitem->but->rect.ymin = y;
+ bitem->but->rect.xmax = x + w;
+ bitem->but->rect.ymax = y + h;
ui_check_but(bitem->but); /* for strlen */
}
@@ -627,7 +630,7 @@ static void ui_item_disabled(uiLayout *layout, const char *name)
but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
but->flag |= UI_BUT_DISABLED;
- but->lock = 1;
+ but->lock = TRUE;
but->lockstr = "";
}
@@ -1898,10 +1901,10 @@ static void ui_litem_layout_box(uiLayout *litem)
/* roundbox around the sublayout */
but = box->roundbox;
- but->x1 = litem->x;
- but->y1 = litem->y;
- but->x2 = litem->x + litem->w;
- but->y2 = litem->y + litem->h;
+ but->rect.xmin = litem->x;
+ but->rect.ymin = litem->y;
+ but->rect.xmax = litem->x + litem->w;
+ but->rect.ymax = litem->y + litem->h;
}
/* multi-column layout, automatically flowing to the next */
@@ -2749,7 +2752,7 @@ static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
uiBut *but = bitem->but;
BLI_dynstr_appendf(ds, "'type':%d, ", but->type); /* see ~ UI_interface.h:200 */
BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr);
- BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); // not exactly needed, rna has this
+ BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); /* not exactly needed, rna has this */
if (but->optype) {
char *opstr = WM_operator_pystring(but->block->evil_C, but->optype, but->opptr, 0);
@@ -2811,7 +2814,7 @@ static void ui_intro_uiLayout(DynStr *ds, uiLayout *layout)
ui_intro_items(ds, &layout->items);
}
-static char *str = NULL; // XXX, constant re-freeing, far from ideal.
+static char *str = NULL; /* XXX, constant re-freeing, far from ideal. */
const char *uiLayoutIntrospect(uiLayout *layout)
{
DynStr *ds = BLI_dynstr_new();
@@ -2848,8 +2851,10 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, i
/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
* just fails silently */
if (!WM_operator_repeat_check(C, op)) {
- uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator cannot redo");
- uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
+ uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator can't' redo");
+
+ /* XXX, could give some nicer feedback or not show redo panel at all? */
+ uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE);
}
/* menu */
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index b76907bc3ba..67c0d04a79f 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -27,7 +27,6 @@
* \ingroup edinterface
*/
-
#include <stdio.h>
#include <math.h>
#include <string.h>
@@ -69,6 +68,9 @@
#include "BKE_main.h"
#include "BLI_ghash.h"
+#include "ED_image.h" /* for HDR color sampling */
+#include "ED_node.h" /* for HDR color sampling */
+#include "ED_clip.h" /* for HDR color sampling */
/* ********************************************************** */
@@ -126,9 +128,59 @@ static int eyedropper_cancel(bContext *C, wmOperator *op)
/* *** eyedropper_color_ helper functions *** */
-/* simply get the color from the screen */
-static void eyedropper_color_sample_fl(Eyedropper *UNUSED(eye), int mx, int my, float r_col[3])
+/**
+ * \brief get the color from the screen.
+ *
+ * Special check for image or nodes where we MAY have HDR pixels which don't display.
+ */
+static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int mx, int my, float r_col[3])
{
+
+ /* we could use some clever */
+ wmWindow *win = CTX_wm_window(C);
+ ScrArea *sa;
+ for (sa = win->screen->areabase.first; sa; sa = sa->next) {
+ if (BLI_rcti_isect_pt(&sa->totrct, mx, my)) {
+ if (sa->spacetype == SPACE_IMAGE) {
+ ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
+ SpaceImage *sima = sa->spacedata.first;
+ int mval[2] = {mx - ar->winrct.xmin,
+ my - ar->winrct.ymin};
+
+ if (ED_space_image_color_sample(sima, ar, mval, r_col)) {
+ return;
+ }
+ }
+ }
+ else if (sa->spacetype == SPACE_NODE) {
+ ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
+ SpaceNode *snode = sa->spacedata.first;
+ int mval[2] = {mx - ar->winrct.xmin,
+ my - ar->winrct.ymin};
+
+ if (ED_space_node_color_sample(snode, ar, mval, r_col)) {
+ return;
+ }
+ }
+ }
+ else if (sa->spacetype == SPACE_CLIP) {
+ ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) {
+ SpaceClip *sc = sa->spacedata.first;
+ int mval[2] = {mx - ar->winrct.xmin,
+ my - ar->winrct.ymin};
+
+ if (ED_space_clip_color_sample(sc, ar, mval, r_col)) {
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /* fallback to simple opengl picker */
glReadBuffer(GL_FRONT);
glReadPixels(mx, my, 1, 1, GL_RGB, GL_FLOAT, r_col);
glReadBuffer(GL_BACK);
@@ -167,14 +219,14 @@ static void eyedropper_color_set_accum(bContext *C, Eyedropper *eye)
static void eyedropper_color_sample(bContext *C, Eyedropper *eye, int mx, int my)
{
float col[3];
- eyedropper_color_sample_fl(eye, mx, my, col);
+ eyedropper_color_sample_fl(C, eye, mx, my, col);
eyedropper_color_set(C, eye, col);
}
-static void eyedropper_color_sample_accum(Eyedropper *eye, int mx, int my)
+static void eyedropper_color_sample_accum(bContext *C, Eyedropper *eye, int mx, int my)
{
float col[3];
- eyedropper_color_sample_fl(eye, mx, my, col);
+ eyedropper_color_sample_fl(C, eye, mx, my, col);
/* delay linear conversion */
add_v3_v3(eye->accum_col, col);
eye->accum_tot++;
@@ -203,13 +255,13 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
else if (event->val == KM_PRESS) {
/* enable accum and make first sample */
eye->accum_start = TRUE;
- eyedropper_color_sample_accum(eye, event->x, event->y);
+ eyedropper_color_sample_accum(C, eye, event->x, event->y);
}
break;
case MOUSEMOVE:
if (eye->accum_start) {
/* button is pressed so keep sampling */
- eyedropper_color_sample_accum(eye, event->x, event->y);
+ eyedropper_color_sample_accum(C, eye, event->x, event->y);
eyedropper_color_set_accum(C, eye);
}
break;
@@ -217,7 +269,7 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_RELEASE) {
eye->accum_tot = 0;
zero_v3(eye->accum_col);
- eyedropper_color_sample_accum(eye, event->x, event->y);
+ eyedropper_color_sample_accum(C, eye, event->x, event->y);
eyedropper_color_set_accum(C, eye);
}
break;
@@ -689,10 +741,7 @@ static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
/* this just needs to be a 'good-enough' comparison so we can know beyond
* reasonable doubt that these buttons are the same between redraws.
* if this fails it only means edit-source fails - campbell */
- if ((but_a->x1 == but_b->x1) &&
- (but_a->x2 == but_b->x2) &&
- (but_a->y1 == but_b->y1) &&
- (but_a->y2 == but_b->y2) &&
+ if (BLI_rctf_compare(&but_a->rect, &but_b->rect, FLT_EPSILON) &&
(but_a->type == but_b->type) &&
(but_a->rnaprop == but_b->rnaprop) &&
(but_a->optype == but_b->optype) &&
@@ -1018,7 +1067,7 @@ void UI_buttons_operatortypes(void)
WM_operatortype_append(UI_OT_copy_data_path_button);
WM_operatortype_append(UI_OT_reset_default_button);
WM_operatortype_append(UI_OT_copy_to_selected_button);
- WM_operatortype_append(UI_OT_reports_to_textblock); // XXX: temp?
+ WM_operatortype_append(UI_OT_reports_to_textblock); /* XXX: temp? */
#ifdef WITH_PYTHON
WM_operatortype_append(UI_OT_editsource);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index d04c1af2769..fa3e04d1351 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -315,13 +315,13 @@ static void ui_offset_panel_block(uiBlock *block)
ofsy = block->panel->sizey - style->panelspace;
for (but = block->buttons.first; but; but = but->next) {
- but->y1 += ofsy;
- but->y2 += ofsy;
+ but->rect.ymin += ofsy;
+ but->rect.ymax += ofsy;
}
- block->maxx = block->panel->sizex;
- block->maxy = block->panel->sizey;
- block->minx = block->miny = 0.0;
+ block->rect.xmax = block->panel->sizex;
+ block->rect.ymax = block->panel->sizey;
+ block->rect.xmin = block->rect.ymin = 0.0;
}
/**************************** drawing *******************************/
@@ -360,11 +360,11 @@ void UI_DrawTriIcon(float x, float y, char dir)
static void ui_draw_tria_rect(rctf *rect, char dir)
{
if (dir == 'h') {
- float half = 0.5f * (rect->ymax - rect->ymin);
+ float half = 0.5f * BLI_RCT_SIZE_Y(rect);
ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin + half);
}
else {
- float half = 0.5f * (rect->xmax - rect->xmin);
+ float half = 0.5f * BLI_RCT_SIZE_X(rect);
ui_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin + half, rect->ymin);
}
}
@@ -422,7 +422,7 @@ static void ui_draw_panel_scalewidget(rcti *rect)
glDisable(GL_BLEND);
}
-static void ui_draw_panel_dragwidget(rctf *rect)
+static void ui_draw_panel_dragwidget(const rctf *rect)
{
float xmin, xmax, dx;
float ymin, ymax, dy;
@@ -483,8 +483,8 @@ static void rectf_scale(rctf *rect, float scale)
{
float centx = 0.5f * (rect->xmin + rect->xmax);
float centy = 0.5f * (rect->ymin + rect->ymax);
- float sizex = 0.5f * scale * (rect->xmax - rect->xmin);
- float sizey = 0.5f * scale * (rect->ymax - rect->ymin);
+ float sizex = 0.5f * scale * BLI_RCT_SIZE_X(rect);
+ float sizey = 0.5f * scale * BLI_RCT_SIZE_Y(rect);
rect->xmin = centx - sizex;
rect->xmax = centx + sizex;
@@ -547,7 +547,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
/* itemrect smaller */
itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
- itemrect.xmin = itemrect.xmax - (headrect.ymax - headrect.ymin);
+ itemrect.xmin = itemrect.xmax - BLI_RCT_SIZE_Y(&headrect);
itemrect.ymin = headrect.ymin;
itemrect.ymax = headrect.ymax;
@@ -596,7 +596,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
/* itemrect smaller */
itemrect.xmin = headrect.xmin + 5.0f / block->aspect;
- itemrect.xmax = itemrect.xmin + (headrect.ymax - headrect.ymin);
+ itemrect.xmax = itemrect.xmin + BLI_RCT_SIZE_Y(&headrect);
itemrect.ymin = headrect.ymin;
itemrect.ymax = headrect.ymax;
@@ -875,11 +875,11 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
/* consistency; are panels not made, whilst they have tabs */
for (panot = ar->panels.first; panot; panot = panot->next) {
- if ((panot->runtime_flag & PNL_ACTIVE) == 0) { // not made
+ if ((panot->runtime_flag & PNL_ACTIVE) == 0) { /* not made */
for (panew = ar->panels.first; panew; panew = panew->next) {
if ((panew->runtime_flag & PNL_ACTIVE)) {
- if (panew->paneltab == panot) { // panew is tab in notmade pa
+ if (panew->paneltab == panot) { /* panew is tab in notmade pa */
break;
}
}
@@ -893,7 +893,7 @@ void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
}
panot->paneltab = panew;
panew->paneltab = NULL;
- ED_region_tag_redraw(ar); // the buttons panew were not made
+ ED_region_tag_redraw(ar); /* the buttons panew were not made */
}
}
}
@@ -979,14 +979,14 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
short align = panel_aligned(sa, ar), dx = 0, dy = 0;
/* first clip for window, no dragging outside */
- if (!BLI_in_rcti_v(&ar->winrct, &event->x))
+ if (!BLI_rcti_isect_pt_v(&ar->winrct, &event->x))
return;
dx = (event->x - data->startx) & ~(PNL_GRID - 1);
dy = (event->y - data->starty) & ~(PNL_GRID - 1);
- dx *= (float)(ar->v2d.cur.xmax - ar->v2d.cur.xmin) / (float)(ar->winrct.xmax - ar->winrct.xmin);
- dy *= (float)(ar->v2d.cur.ymax - ar->v2d.cur.ymin) / (float)(ar->winrct.ymax - ar->winrct.ymin);
+ dx *= (float)BLI_RCT_SIZE_X(&ar->v2d.cur) / (float)BLI_RCT_SIZE_X(&ar->winrct);
+ dy *= (float)BLI_RCT_SIZE_Y(&ar->v2d.cur) / (float)BLI_RCT_SIZE_Y(&ar->winrct);
if (data->state == PANEL_STATE_DRAG_SCALE) {
panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX);
@@ -1033,22 +1033,22 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
else if (event == AKEY)
button = 1;
else if (block->panel->flag & PNL_CLOSEDX) {
- if (my >= block->maxy) button = 1;
+ if (my >= block->rect.ymax) button = 1;
}
else if (block->panel->control & UI_PNL_CLOSE) {
/* whole of header can be used to collapse panel (except top-right corner) */
- if (mx <= block->maxx - 8 - PNL_ICON) button = 2;
- //else if (mx <= block->minx + 10 + 2 * PNL_ICON + 2) button = 1;
+ if (mx <= block->rect.xmax - 8 - PNL_ICON) button = 2;
+ //else if (mx <= block->rect.xmin + 10 + 2 * PNL_ICON + 2) button = 1;
}
- else if (mx <= block->maxx - PNL_ICON - 12) {
+ else if (mx <= block->rect.xmax - PNL_ICON - 12) {
button = 1;
}
if (button) {
- if (button == 2) { // close
+ if (button == 2) { /* close */
ED_region_tag_redraw(ar);
}
- else { // collapse
+ else { /* collapse */
if (block->panel->flag & PNL_CLOSED) {
block->panel->flag &= ~PNL_CLOSED;
/* snap back up so full panel aligns with screen edge */
@@ -1078,7 +1078,7 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
else
ED_region_tag_redraw(ar);
}
- else if (mx <= (block->maxx - PNL_ICON - 12) + PNL_ICON + 2) {
+ else if (mx <= (block->rect.xmax - PNL_ICON - 12) + PNL_ICON + 2) {
panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
}
}
@@ -1106,18 +1106,18 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
if (!pa || pa->paneltab != NULL)
continue;
- if (pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
+ if (pa->type && pa->type->flag & PNL_NO_HEADER) /* XXX - accessed freed panels when scripts reload, need to fix. */
continue;
- if (block->minx <= mx && block->maxx >= mx)
- if (block->miny <= my && block->maxy + PNL_HEADER >= my)
+ if (block->rect.xmin <= mx && block->rect.xmax >= mx)
+ if (block->rect.ymin <= my && block->rect.ymax + PNL_HEADER >= my)
inside = 1;
if (inside && event->val == KM_PRESS) {
if (event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
if (pa->flag & PNL_CLOSEDY) {
- if ((block->maxy <= my) && (block->maxy + PNL_HEADER >= my))
+ if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my))
ui_handle_panel_header(C, block, mx, my, event->type);
}
else
@@ -1134,15 +1134,15 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
if (inside) {
/* clicked at panel header? */
if (pa->flag & PNL_CLOSEDX) {
- if (block->minx <= mx && block->minx + PNL_HEADER >= mx)
+ if (block->rect.xmin <= mx && block->rect.xmin + PNL_HEADER >= mx)
inside_header = 1;
}
- else if ((block->maxy <= my) && (block->maxy + PNL_HEADER >= my)) {
+ else if ((block->rect.ymax <= my) && (block->rect.ymax + PNL_HEADER >= my)) {
inside_header = 1;
}
else if (pa->control & UI_PNL_SCALE) {
- if (block->maxx - PNL_HEADER <= mx)
- if (block->miny + PNL_HEADER >= my)
+ if (block->rect.xmax - PNL_HEADER <= mx)
+ if (block->rect.ymin + PNL_HEADER >= my)
inside_scale = 1;
}
@@ -1177,7 +1177,7 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
#endif
}
else if (event->type == PADPLUSKEY || event->type == PADMINUS) {
-#if 0 // XXX make float panel exception?
+#if 0 /* XXX make float panel exception? */
int zoom = 0;
/* if panel is closed, only zoom if mouse is over the header */
@@ -1275,7 +1275,7 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
* Aligorith, 2009Sep
*/
//test_add_new_tabs(ar); // also copies locations of tabs in dragged panel
- check_panel_overlap(ar, NULL); // clears
+ check_panel_overlap(ar, NULL); /* clears */
}
pa->flag &= ~PNL_SELECT;
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 70f2bf7b028..96c1b00d46d 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -391,7 +391,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
/* draw text */
uiStyleFontSet(&data->fstyle);
- bbox.ymax = bbox.ymax - 0.5f * ((bbox.ymax - bbox.ymin) - data->toth);
+ bbox.ymax = bbox.ymax - 0.5f * (BLI_RCT_SIZE_Y(&bbox) - data->toth);
bbox.ymin = bbox.ymax - data->lineh;
for (i = 0; i < data->totline; i++) {
@@ -420,8 +420,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* IDProperty *prop;*/
char buf[512];
float fonth, fontw, aspect = but->block->aspect;
- float x1f, x2f, y1f, y2f;
- int x1, x2, y1, y2, winx, winy, ofsx, ofsy, w, h, a;
+ int winx, winy, ofsx, ofsy, w, h, a;
+ rctf rect_fl;
+ rcti rect_i;
const int nbr_info = 6;
uiStringInfo but_tip = {BUT_GET_TIP, NULL};
@@ -573,6 +574,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
char *str;
opptr = uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
+ /* so the context is passed to itemf functions (some py itemf functions use it) */
+ WM_operator_properties_sanitize(opptr, FALSE);
+
str = WM_operator_pystring(C, but->optype, opptr, 0);
/* operator info */
@@ -682,62 +686,59 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
ofsx = (but->block->panel) ? but->block->panel->ofsx : 0;
ofsy = (but->block->panel) ? but->block->panel->ofsy : 0;
- x1f = (but->x1 + but->x2) * 0.5f + ofsx - (TIP_BORDER_X * aspect);
- x2f = x1f + fontw + (TIP_BORDER_X * aspect);
- y2f = but->y1 + ofsy - (TIP_BORDER_Y * aspect);
- y1f = y2f - fonth * aspect - (TIP_BORDER_Y * aspect);
+ rect_fl.xmin = (but->rect.xmin + but->rect.xmax) * 0.5f + ofsx - (TIP_BORDER_X * aspect);
+ rect_fl.xmax = rect_fl.xmin + fontw + (TIP_BORDER_X * aspect);
+ rect_fl.ymax = but->rect.ymin + ofsy - (TIP_BORDER_Y * aspect);
+ rect_fl.ymin = rect_fl.ymax - fonth * aspect - (TIP_BORDER_Y * aspect);
#undef TIP_MARGIN_Y
#undef TIP_BORDER_X
#undef TIP_BORDER_Y
/* copy to int, gets projected if possible too */
- x1 = x1f; y1 = y1f; x2 = x2f; y2 = y2f;
+ BLI_rcti_rctf_copy(&rect_i, &rect_fl);
if (butregion) {
/* XXX temp, region v2ds can be empty still */
if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
- UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
- UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
+ UI_view2d_to_region_no_clip(&butregion->v2d, rect_fl.xmin, rect_fl.ymin, &rect_i.xmin, &rect_i.ymin);
+ UI_view2d_to_region_no_clip(&butregion->v2d, rect_fl.xmax, rect_fl.ymax, &rect_i.xmax, &rect_i.ymax);
}
- x1 += butregion->winrct.xmin;
- x2 += butregion->winrct.xmin;
- y1 += butregion->winrct.ymin;
- y2 += butregion->winrct.ymin;
+ BLI_rcti_translate(&rect_i, butregion->winrct.xmin, butregion->winrct.ymin);
}
wm_window_get_size(CTX_wm_window(C), &winx, &winy);
- if (x2 > winx) {
+ if (rect_i.xmax > winx) {
/* super size */
- if (x2 > winx + x1) {
- x2 = winx;
- x1 = 0;
+ if (rect_i.xmax > winx + rect_i.xmin) {
+ rect_i.xmax = winx;
+ rect_i.xmin = 0;
}
else {
- x1 -= x2 - winx;
- x2 = winx;
+ rect_i.xmin -= rect_i.xmax - winx;
+ rect_i.xmax = winx;
}
}
/* ensure at least 5 px above screen bounds
* 25 is just a guess to be above the menu item */
- if (y1 < 5) {
- y2 += (-y1) + 30;
- y1 = 30;
+ if (rect_i.ymin < 5) {
+ rect_i.ymax += (-rect_i.ymin) + 30;
+ rect_i.ymin = 30;
}
/* widget rect, in region coords */
data->bbox.xmin = MENU_SHADOW_SIDE;
- data->bbox.xmax = x2 - x1 + MENU_SHADOW_SIDE;
+ data->bbox.xmax = BLI_RCT_SIZE_X(&rect_i) + MENU_SHADOW_SIDE;
data->bbox.ymin = MENU_SHADOW_BOTTOM;
- data->bbox.ymax = y2 - y1 + MENU_SHADOW_BOTTOM;
+ data->bbox.ymax = BLI_RCT_SIZE_Y(&rect_i) + MENU_SHADOW_BOTTOM;
/* region bigger for shadow */
- ar->winrct.xmin = x1 - MENU_SHADOW_SIDE;
- ar->winrct.xmax = x2 + MENU_SHADOW_SIDE;
- ar->winrct.ymin = y1 - MENU_SHADOW_BOTTOM;
- ar->winrct.ymax = y2 + MENU_TOP;
+ ar->winrct.xmin = rect_i.xmin - MENU_SHADOW_SIDE;
+ ar->winrct.xmax = rect_i.xmax + MENU_SHADOW_SIDE;
+ ar->winrct.ymin = rect_i.ymin - MENU_SHADOW_BOTTOM;
+ ar->winrct.ymax = rect_i.ymax + MENU_TOP;
/* adds subwindow */
ED_region_init(C, ar);
@@ -864,8 +865,8 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
{
/* thumbnail preview */
if (data->preview) {
- int buth = (data->bbox.ymax - data->bbox.ymin - 2 * MENU_TOP) / data->prv_rows;
- int butw = (data->bbox.xmax - data->bbox.xmin) / data->prv_cols;
+ int butw = BLI_RCT_SIZE_X(&data->bbox) / data->prv_cols;
+ int buth = (BLI_RCT_SIZE_Y(&data->bbox) - 2 * MENU_TOP) / data->prv_rows;
int row, col;
*rect = data->bbox;
@@ -881,7 +882,7 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
}
/* list view */
else {
- int buth = (data->bbox.ymax - data->bbox.ymin - 2 * MENU_TOP) / SEARCH_ITEMS;
+ int buth = (BLI_RCT_SIZE_Y(&data->bbox) - 2 * MENU_TOP) / SEARCH_ITEMS;
*rect = data->bbox;
rect->xmin = data->bbox.xmin + 3.0f;
@@ -898,7 +899,7 @@ int ui_searchbox_inside(ARegion *ar, int x, int y)
{
uiSearchboxData *data = ar->regiondata;
- return(BLI_in_rcti(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin));
+ return(BLI_rcti_isect_pt(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin));
}
/* string validated to be of correct length (but->hardmax) */
@@ -934,13 +935,13 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
ui_searchbox_select(C, ar, but, 1);
break;
case MOUSEMOVE:
- if (BLI_in_rcti(&ar->winrct, event->x, event->y)) {
+ if (BLI_rcti_isect_pt(&ar->winrct, event->x, event->y)) {
rcti rect;
int a;
for (a = 0; a < data->items.totitem; a++) {
ui_searchbox_butrect(&rect, data, a);
- if (BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
+ if (BLI_rcti_isect_pt(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
if (data->active != a + 1) {
data->active = a + 1;
ui_searchbox_select(C, ar, but, 0);
@@ -1094,13 +1095,13 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem - 1);
glEnable(GL_BLEND);
- UI_icon_draw((rect.xmax - rect.xmin) / 2, rect.ymin - 9, ICON_TRIA_DOWN);
+ UI_icon_draw((BLI_RCT_SIZE_X(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN);
glDisable(GL_BLEND);
}
if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
glEnable(GL_BLEND);
- UI_icon_draw((rect.xmax - rect.xmin) / 2, rect.ymax - 7, ICON_TRIA_UP);
+ UI_icon_draw((BLI_RCT_SIZE_X(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP);
glDisable(GL_BLEND);
}
}
@@ -1131,8 +1132,10 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
ARegion *ar;
uiSearchboxData *data;
float aspect = but->block->aspect;
- float x1f, x2f, y1f, y2f;
- int x1, x2, y1, y2, winx, winy, ofsx, ofsy;
+ rctf rect_fl;
+ rcti rect_i;
+ int winx, winy, ofsx, ofsy;
+ int i;
/* create area region */
ar = ui_add_temporary_region(CTX_wm_screen(C));
@@ -1173,82 +1176,78 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
/* widget rect, in region coords */
data->bbox.xmin = MENU_SHADOW_SIDE;
- data->bbox.xmax = (ar->winrct.xmax - ar->winrct.xmin) - MENU_SHADOW_SIDE;
+ data->bbox.xmax = BLI_RCT_SIZE_X(&ar->winrct) - MENU_SHADOW_SIDE;
data->bbox.ymin = MENU_SHADOW_BOTTOM;
- data->bbox.ymax = (ar->winrct.ymax - ar->winrct.ymin) - MENU_SHADOW_BOTTOM;
+ data->bbox.ymax = BLI_RCT_SIZE_Y(&ar->winrct) - MENU_SHADOW_BOTTOM;
/* check if button is lower half */
- if (but->y2 < (but->block->miny + but->block->maxy) / 2) {
- data->bbox.ymin += (but->y2 - but->y1);
+ if (but->rect.ymax < BLI_RCT_CENTER_Y(&but->block->rect)) {
+ data->bbox.ymin += BLI_RCT_SIZE_Y(&but->rect);
}
else {
- data->bbox.ymax -= (but->y2 - but->y1);
+ data->bbox.ymax -= BLI_RCT_SIZE_Y(&but->rect);
}
}
else {
- x1f = but->x1 - 5; /* align text with button */
- x2f = but->x2 + 5; /* symmetrical */
- y2f = but->y1;
- y1f = y2f - uiSearchBoxhHeight();
+ rect_fl.xmin = but->rect.xmin - 5; /* align text with button */
+ rect_fl.xmax = but->rect.xmax + 5; /* symmetrical */
+ rect_fl.ymax = but->rect.ymin;
+ rect_fl.ymin = rect_fl.ymax - uiSearchBoxhHeight();
ofsx = (but->block->panel) ? but->block->panel->ofsx : 0;
ofsy = (but->block->panel) ? but->block->panel->ofsy : 0;
- x1f += ofsx;
- x2f += ofsx;
- y1f += ofsy;
- y2f += ofsy;
+ BLI_rctf_translate(&rect_fl, ofsx, ofsy);
/* minimal width */
- if (x2f - x1f < 150) x2f = x1f + 150; // XXX arbitrary
+ if (BLI_RCT_SIZE_X(&rect_fl) < 150) {
+ rect_fl.xmax = rect_fl.xmin + 150; /* XXX arbitrary */
+ }
/* copy to int, gets projected if possible too */
- x1 = x1f; y1 = y1f; x2 = x2f; y2 = y2f;
+ BLI_rcti_rctf_copy(&rect_i, &rect_fl);
if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
- UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
- UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
+ UI_view2d_to_region_no_clip(&butregion->v2d, rect_fl.xmin, rect_fl.ymin, &rect_i.xmin, &rect_i.ymin);
+ UI_view2d_to_region_no_clip(&butregion->v2d, rect_fl.xmax, rect_fl.ymax, &rect_i.xmax, &rect_i.ymax);
}
- x1 += butregion->winrct.xmin;
- x2 += butregion->winrct.xmin;
- y1 += butregion->winrct.ymin;
- y2 += butregion->winrct.ymin;
+ BLI_rcti_translate(&rect_i, butregion->winrct.xmin, butregion->winrct.ymin);
wm_window_get_size(CTX_wm_window(C), &winx, &winy);
- if (x2 > winx) {
+ if (rect_i.xmax > winx) {
/* super size */
- if (x2 > winx + x1) {
- x2 = winx;
- x1 = 0;
+ if (rect_i.xmax > winx + rect_i.xmin) {
+ rect_i.xmax = winx;
+ rect_i.xmin = 0;
}
else {
- x1 -= x2 - winx;
- x2 = winx;
+ rect_i.xmin -= rect_i.xmax - winx;
+ rect_i.xmax = winx;
}
}
- if (y1 < 0) {
+ if (rect_i.ymin < 0) {
int newy1;
- UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, NULL, &newy1);
+ UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->rect.ymax + ofsy, NULL, &newy1);
newy1 += butregion->winrct.ymin;
- y2 = y2 - y1 + newy1;
- y1 = newy1;
+ rect_i.ymax = BLI_RCT_SIZE_Y(&rect_i) + newy1;
+ rect_i.ymin = newy1;
}
/* widget rect, in region coords */
data->bbox.xmin = MENU_SHADOW_SIDE;
- data->bbox.xmax = x2 - x1 + MENU_SHADOW_SIDE;
+ data->bbox.xmax = BLI_RCT_SIZE_X(&rect_i) + MENU_SHADOW_SIDE;
data->bbox.ymin = MENU_SHADOW_BOTTOM;
- data->bbox.ymax = y2 - y1 + MENU_SHADOW_BOTTOM;
+ data->bbox.ymax = BLI_RCT_SIZE_Y(&rect_i) + MENU_SHADOW_BOTTOM;
/* region bigger for shadow */
- ar->winrct.xmin = x1 - MENU_SHADOW_SIDE;
- ar->winrct.xmax = x2 + MENU_SHADOW_SIDE;
- ar->winrct.ymin = y1 - MENU_SHADOW_BOTTOM;
- ar->winrct.ymax = y2;
+ ar->winrct.xmin = rect_i.xmin - MENU_SHADOW_SIDE;
+ ar->winrct.xmax = rect_i.xmax + MENU_SHADOW_SIDE;
+ ar->winrct.ymin = rect_i.ymin - MENU_SHADOW_BOTTOM;
+ ar->winrct.ymax = rect_i.ymax;
}
/* adds subwindow */
@@ -1269,8 +1268,8 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
data->items.names = MEM_callocN(data->items.maxitem * sizeof(void *), "search names");
data->items.pointers = MEM_callocN(data->items.maxitem * sizeof(void *), "search pointers");
data->items.icons = MEM_callocN(data->items.maxitem * sizeof(int), "search icons");
- for (x1 = 0; x1 < data->items.maxitem; x1++)
- data->items.names[x1] = MEM_callocN(but->hardmax + 1, "search pointers");
+ for (i = 0; i < data->items.maxitem; i++)
+ data->items.names[i] = MEM_callocN(but->hardmax + 1, "search pointers");
return ar;
}
@@ -1336,45 +1335,36 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
short dir1 = 0, dir2 = 0;
/* transform to window coordinates, using the source button region/block */
- butrct.xmin = but->x1; butrct.xmax = but->x2;
- butrct.ymin = but->y1; butrct.ymax = but->y2;
+ butrct = but->rect;
ui_block_to_window_fl(butregion, but->block, &butrct.xmin, &butrct.ymin);
ui_block_to_window_fl(butregion, but->block, &butrct.xmax, &butrct.ymax);
/* calc block rect */
- if (block->minx == 0.0f && block->maxx == 0.0f) {
+ if (block->rect.xmin == 0.0f && block->rect.xmax == 0.0f) {
if (block->buttons.first) {
- block->minx = block->miny = 10000;
- block->maxx = block->maxy = -10000;
-
- bt = block->buttons.first;
- while (bt) {
- if (bt->x1 < block->minx) block->minx = bt->x1;
- if (bt->y1 < block->miny) block->miny = bt->y1;
+ BLI_rctf_init_minmax(&block->rect);
- if (bt->x2 > block->maxx) block->maxx = bt->x2;
- if (bt->y2 > block->maxy) block->maxy = bt->y2;
-
- bt = bt->next;
+ for (bt = block->buttons.first; bt; bt = bt->next) {
+ BLI_rctf_union(&block->rect, &bt->rect);
}
}
else {
/* we're nice and allow empty blocks too */
- block->minx = block->miny = 0;
- block->maxx = block->maxy = 20;
+ block->rect.xmin = block->rect.ymin = 0;
+ block->rect.xmax = block->rect.ymax = 20;
}
}
- /* aspect = (float)(block->maxx - block->minx + 4);*/ /*UNUSED*/
- ui_block_to_window_fl(butregion, but->block, &block->minx, &block->miny);
- ui_block_to_window_fl(butregion, but->block, &block->maxx, &block->maxy);
+ /* aspect = (float)(BLI_RCT_SIZE_X(&block->rect) + 4);*/ /*UNUSED*/
+ ui_block_to_window_fl(butregion, but->block, &block->rect.xmin, &block->rect.ymin);
+ ui_block_to_window_fl(butregion, but->block, &block->rect.xmax, &block->rect.ymax);
- //block->minx -= 2.0; block->miny -= 2.0;
- //block->maxx += 2.0; block->maxy += 2.0;
+ //block->rect.xmin -= 2.0; block->rect.ymin -= 2.0;
+ //block->rect.xmax += 2.0; block->rect.ymax += 2.0;
- xsize = block->maxx - block->minx + 4; // 4 for shadow
- ysize = block->maxy - block->miny + 4;
+ xsize = BLI_RCT_SIZE_X(&block->rect) + 4; /* 4 for shadow */
+ ysize = BLI_RCT_SIZE_Y(&block->rect) + 4;
/* aspect /= (float)xsize;*/ /*UNUSED*/
{
@@ -1428,20 +1418,20 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
}
if (dir1 == UI_LEFT) {
- xof = butrct.xmin - block->maxx;
- if (dir2 == UI_TOP) yof = butrct.ymin - block->miny - center;
- else yof = butrct.ymax - block->maxy + center;
+ xof = butrct.xmin - block->rect.xmax;
+ if (dir2 == UI_TOP) yof = butrct.ymin - block->rect.ymin - center;
+ else yof = butrct.ymax - block->rect.ymax + center;
}
else if (dir1 == UI_RIGHT) {
- xof = butrct.xmax - block->minx;
- if (dir2 == UI_TOP) yof = butrct.ymin - block->miny - center;
- else yof = butrct.ymax - block->maxy + center;
+ xof = butrct.xmax - block->rect.xmin;
+ if (dir2 == UI_TOP) yof = butrct.ymin - block->rect.ymin - center;
+ else yof = butrct.ymax - block->rect.ymax + center;
}
else if (dir1 == UI_TOP) {
- yof = butrct.ymax - block->miny;
- if (dir2 == UI_RIGHT) xof = butrct.xmax - block->maxx;
- else xof = butrct.xmin - block->minx;
- // changed direction?
+ yof = butrct.ymax - block->rect.ymin;
+ if (dir2 == UI_RIGHT) xof = butrct.xmax - block->rect.xmax;
+ else xof = butrct.xmin - block->rect.xmin;
+ /* changed direction? */
if ((dir1 & block->direction) == 0) {
if (block->direction & UI_SHIFT_FLIPPED)
xof += dir2 == UI_LEFT ? 25 : -25;
@@ -1449,10 +1439,10 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
}
}
else if (dir1 == UI_DOWN) {
- yof = butrct.ymin - block->maxy;
- if (dir2 == UI_RIGHT) xof = butrct.xmax - block->maxx;
- else xof = butrct.xmin - block->minx;
- // changed direction?
+ yof = butrct.ymin - block->rect.ymax;
+ if (dir2 == UI_RIGHT) xof = butrct.xmax - block->rect.xmax;
+ else xof = butrct.xmin - block->rect.xmin;
+ /* changed direction? */
if ((dir1 & block->direction) == 0) {
if (block->direction & UI_SHIFT_FLIPPED)
xof += dir2 == UI_LEFT ? 25 : -25;
@@ -1463,7 +1453,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
/* and now we handle the exception; no space below or to top */
if (top == 0 && down == 0) {
if (dir1 == UI_LEFT || dir1 == UI_RIGHT) {
- // align with bottom of screen
+ /* align with bottom of screen */
// yof= ysize; (not with menu scrolls)
}
}
@@ -1471,77 +1461,71 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
/* or no space left or right */
if (left == 0 && right == 0) {
if (dir1 == UI_TOP || dir1 == UI_DOWN) {
- // align with left size of screen
- xof = -block->minx + 5;
+ /* align with left size of screen */
+ xof = -block->rect.xmin + 5;
}
}
- // apply requested offset in the block
+ /* apply requested offset in the block */
xof += block->xofs / block->aspect;
yof += block->yofs / block->aspect;
#if 0
/* clamp to window bounds, could be made into an option if its ever annoying */
- if ( (offscreen = (block->miny + yof)) < 0) yof -= offscreen; /* bottom */
- else if ((offscreen = (block->maxy + yof) - winy) > 0) yof -= offscreen; /* top */
- if ( (offscreen = (block->minx + xof)) < 0) xof -= offscreen; /* left */
- else if ((offscreen = (block->maxx + xof) - winx) > 0) xof -= offscreen; /* right */
+ if ( (offscreen = (block->rect.ymin + yof)) < 0) yof -= offscreen; /* bottom */
+ else if ((offscreen = (block->rect.ymax + yof) - winy) > 0) yof -= offscreen; /* top */
+ if ( (offscreen = (block->rect.xmin + xof)) < 0) xof -= offscreen; /* left */
+ else if ((offscreen = (block->rect.xmax + xof) - winx) > 0) xof -= offscreen; /* right */
#endif
}
/* apply offset, buttons in window coords */
for (bt = block->buttons.first; bt; bt = bt->next) {
- ui_block_to_window_fl(butregion, but->block, &bt->x1, &bt->y1);
- ui_block_to_window_fl(butregion, but->block, &bt->x2, &bt->y2);
+ ui_block_to_window_fl(butregion, but->block, &bt->rect.xmin, &bt->rect.ymin);
+ ui_block_to_window_fl(butregion, but->block, &bt->rect.xmax, &bt->rect.ymax);
- bt->x1 += xof;
- bt->x2 += xof;
- bt->y1 += yof;
- bt->y2 += yof;
+ BLI_rctf_translate(&bt->rect, xof, yof);
- bt->aspect = 1.0;
- // ui_check_but recalculates drawstring size in pixels
+ bt->aspect = 1.0f;
+ /* ui_check_but recalculates drawstring size in pixels */
ui_check_but(bt);
}
- block->minx += xof;
- block->miny += yof;
- block->maxx += xof;
- block->maxy += yof;
+ BLI_rctf_translate(&block->rect, xof, yof);
/* safety calculus */
if (but) {
- float midx = (butrct.xmin + butrct.xmax) / 2.0f;
- float midy = (butrct.ymin + butrct.ymax) / 2.0f;
+ const float midx = BLI_RCT_CENTER_X(&butrct);
+ const float midy = BLI_RCT_CENTER_Y(&butrct);
/* when you are outside parent button, safety there should be smaller */
/* parent button to left */
- if (midx < block->minx) block->safety.xmin = block->minx - 3;
- else block->safety.xmin = block->minx - 40;
+ if (midx < block->rect.xmin) block->safety.xmin = block->rect.xmin - 3;
+ else block->safety.xmin = block->rect.xmin - 40;
/* parent button to right */
- if (midx > block->maxx) block->safety.xmax = block->maxx + 3;
- else block->safety.xmax = block->maxx + 40;
+ if (midx > block->rect.xmax) block->safety.xmax = block->rect.xmax + 3;
+ else block->safety.xmax = block->rect.xmax + 40;
/* parent button on bottom */
- if (midy < block->miny) block->safety.ymin = block->miny - 3;
- else block->safety.ymin = block->miny - 40;
+ if (midy < block->rect.ymin) block->safety.ymin = block->rect.ymin - 3;
+ else block->safety.ymin = block->rect.ymin - 40;
/* parent button on top */
- if (midy > block->maxy) block->safety.ymax = block->maxy + 3;
- else block->safety.ymax = block->maxy + 40;
+ if (midy > block->rect.ymax) block->safety.ymax = block->rect.ymax + 3;
+ else block->safety.ymax = block->rect.ymax + 40;
/* exception for switched pulldowns... */
if (dir1 && (dir1 & block->direction) == 0) {
- if (dir2 == UI_RIGHT) block->safety.xmax = block->maxx + 3;
- if (dir2 == UI_LEFT) block->safety.xmin = block->minx - 3;
+ if (dir2 == UI_RIGHT) block->safety.xmax = block->rect.xmax + 3;
+ if (dir2 == UI_LEFT) block->safety.xmin = block->rect.xmin - 3;
}
block->direction = dir1;
}
else {
- block->safety.xmin = block->minx - 40;
- block->safety.ymin = block->miny - 40;
- block->safety.xmax = block->maxx + 40;
- block->safety.ymax = block->maxy + 40;
+ block->safety.xmin = block->rect.xmin - 40;
+ block->safety.ymin = block->rect.ymin - 40;
+ block->safety.xmax = block->rect.xmax + 40;
+ block->safety.ymax = block->rect.ymax + 40;
}
/* keep a list of these, needed for pulldown menus */
@@ -1568,15 +1552,15 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
wm_window_get_size(window, &winx, &winy);
- if (block->minx < MENU_SHADOW_SIDE)
- block->minx = MENU_SHADOW_SIDE;
- if (block->maxx > winx - MENU_SHADOW_SIDE)
- block->maxx = winx - MENU_SHADOW_SIDE;
+ if (block->rect.xmin < MENU_SHADOW_SIDE)
+ block->rect.xmin = MENU_SHADOW_SIDE;
+ if (block->rect.xmax > winx - MENU_SHADOW_SIDE)
+ block->rect.xmax = winx - MENU_SHADOW_SIDE;
- if (block->miny < MENU_SHADOW_BOTTOM)
- block->miny = MENU_SHADOW_BOTTOM;
- if (block->maxy > winy - MENU_TOP)
- block->maxy = winy - MENU_TOP;
+ if (block->rect.ymin < MENU_SHADOW_BOTTOM)
+ block->rect.ymin = MENU_SHADOW_BOTTOM;
+ if (block->rect.ymax > winy - MENU_TOP)
+ block->rect.ymax = winy - MENU_TOP;
}
void ui_popup_block_scrolltest(uiBlock *block)
@@ -1595,25 +1579,25 @@ void ui_popup_block_scrolltest(uiBlock *block)
/* mark buttons that are outside boundary and the ones next to it for arrow(s) */
for (bt = block->buttons.first; bt; bt = bt->next) {
- if (bt->y1 < block->miny) {
+ if (bt->rect.ymin < block->rect.ymin) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPBOTTOM;
/* make space for arrow */
- if (bt->y2 < block->miny + 10) {
- if (is_flip && bt->next && bt->next->y1 > bt->y1)
+ if (bt->rect.ymax < block->rect.ymin + 10) {
+ if (is_flip && bt->next && bt->next->rect.ymin > bt->rect.ymin)
bt->next->flag |= UI_SCROLLED;
- else if (!is_flip && bt->prev && bt->prev->y1 > bt->y1)
+ else if (!is_flip && bt->prev && bt->prev->rect.ymin > bt->rect.ymin)
bt->prev->flag |= UI_SCROLLED;
}
}
- if (bt->y2 > block->maxy) {
+ if (bt->rect.ymax > block->rect.ymax) {
bt->flag |= UI_SCROLLED;
block->flag |= UI_BLOCK_CLIPTOP;
/* make space for arrow */
- if (bt->y1 > block->maxy - 10) {
- if (!is_flip && bt->next && bt->next->y2 < bt->y2)
+ if (bt->rect.ymin > block->rect.ymax - 10) {
+ if (!is_flip && bt->next && bt->next->rect.ymax < bt->rect.ymax)
bt->next->flag |= UI_SCROLLED;
- else if (is_flip && bt->prev && bt->prev->y2 < bt->y2)
+ else if (is_flip && bt->prev && bt->prev->rect.ymax < bt->rect.ymax)
bt->prev->flag |= UI_SCROLLED;
}
}
@@ -1628,7 +1612,6 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
static ARegionType type;
ARegion *ar;
uiBlock *block;
- uiBut *bt;
uiPopupBlockHandle *handle;
uiSafetyRct *saferct;
@@ -1691,22 +1674,12 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
/* the block and buttons were positioned in window space as in 2.4x, now
* these menu blocks are regions so we bring it back to region space.
* additionally we add some padding for the menu shadow or rounded menus */
- ar->winrct.xmin = block->minx - MENU_SHADOW_SIDE;
- ar->winrct.xmax = block->maxx + MENU_SHADOW_SIDE;
- ar->winrct.ymin = block->miny - MENU_SHADOW_BOTTOM;
- ar->winrct.ymax = block->maxy + MENU_TOP;
+ ar->winrct.xmin = block->rect.xmin - MENU_SHADOW_SIDE;
+ ar->winrct.xmax = block->rect.xmax + MENU_SHADOW_SIDE;
+ ar->winrct.ymin = block->rect.ymin - MENU_SHADOW_BOTTOM;
+ ar->winrct.ymax = block->rect.ymax + MENU_TOP;
- block->minx -= ar->winrct.xmin;
- block->maxx -= ar->winrct.xmin;
- block->miny -= ar->winrct.ymin;
- block->maxy -= ar->winrct.ymin;
-
- for (bt = block->buttons.first; bt; bt = bt->next) {
- bt->x1 -= ar->winrct.xmin;
- bt->x2 -= ar->winrct.xmin;
- bt->y1 -= ar->winrct.ymin;
- bt->y2 -= ar->winrct.ymin;
- }
+ ui_block_translate(block, -ar->winrct.xmin, -ar->winrct.ymin);
block->flag |= UI_BLOCK_LOOP;
@@ -2368,7 +2341,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
if (pup->but) {
/* minimum width to enforece */
- minwidth = pup->but->x2 - pup->but->x1;
+ minwidth = BLI_RCT_SIZE_X(&pup->but->rect);
if (pup->but->type == PULLDOWN || pup->but->menu_create_func) {
direction = UI_DOWN;
@@ -2410,15 +2383,15 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
* button, so it doesn't overlap the text too much, also note
* the offset is negative because we are inverse moving the
* block to be under the mouse */
- offset[0] = -(bt->x1 + 0.8f * (bt->x2 - bt->x1));
- offset[1] = -(bt->y1 + 0.5f * UI_UNIT_Y);
+ offset[0] = -(bt->rect.xmin + 0.8f * BLI_RCT_SIZE_X(&bt->rect));
+ offset[1] = -(bt->rect.ymin + 0.5f * UI_UNIT_Y);
}
else {
/* position mouse at 0.8*width of the button and below the tile
* on the first item */
offset[0] = 0;
for (bt = block->buttons.first; bt; bt = bt->next)
- offset[0] = mini(offset[0], -(bt->x1 + 0.8f * (bt->x2 - bt->x1)));
+ offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_RCT_SIZE_X(&bt->rect)));
offset[1] = 1.5 * UI_UNIT_Y;
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 779341160c5..ee0613ea0d0 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -152,17 +152,17 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
uiStyleFontSet(fs);
height = BLF_ascender(fs->uifont_id);
- yofs = ceil(0.5f * (rect->ymax - rect->ymin - height));
+ yofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height));
if (fs->align == UI_STYLE_TEXT_CENTER) {
- xofs = floor(0.5f * (rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str)));
+ xofs = floor(0.5f * (BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str)));
/* don't center text if it chops off the start of the text, 2 gives some margin */
if (xofs < 2) {
xofs = 2;
}
}
else if (fs->align == UI_STYLE_TEXT_RIGHT) {
- xofs = rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str) - 1;
+ xofs = BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str) - 1;
}
/* clip is very strict, so we give it some space */
@@ -209,7 +209,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
height = BLF_ascender(fs->uifont_id);
/* becomes x-offset when rotated */
- xofs = ceil(0.5f * (rect->ymax - rect->ymin - height));
+ xofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height));
/* ignore UI_STYLE, always aligned to top */
@@ -219,8 +219,8 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
angle = 90.0f;
/* translate rect to vertical */
- txtrect.xmin = rect->xmin - (rect->ymax - rect->ymin);
- txtrect.ymin = rect->ymin - (rect->xmax - rect->xmin);
+ txtrect.xmin = rect->xmin - BLI_RCT_SIZE_Y(rect);
+ txtrect.ymin = rect->ymin - BLI_RCT_SIZE_X(rect);
txtrect.xmax = rect->xmin;
txtrect.ymax = rect->ymin;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 9207a6ff3b8..71c019ae29e 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -40,6 +40,7 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
#include "BLI_ghash.h"
+#include "BLI_rect.h"
#include "BLF_translation.h"
@@ -1378,7 +1379,7 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, RNAUpdateCb *cb)
{
uiBut *bt;
- float unit = (butr->xmax - butr->xmin) / 14.0f;
+ float unit = BLI_RCT_SIZE_X(butr) / 14.0f;
float xs = butr->xmin;
uiBlockBeginAlign(block);
@@ -1404,7 +1405,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
TIP_("Set interpolation between color stops"));
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
- bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, butr->ymin, butr->xmax - butr->xmin, UI_UNIT_Y, coba, 0, 0, 0, 0, "");
+ bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, butr->ymin, BLI_RCT_SIZE_X(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
uiBlockEndAlign(block);
@@ -1479,7 +1480,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height;
- bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, hist->height, hist, 0, 0, 0, 0, "");
+ bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), hist->height, hist, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
MEM_freeN(cb);
@@ -1516,8 +1517,8 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
- bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
- (void)bt; // UNUSED
+ bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
+ (void)bt; /* UNUSED */
MEM_freeN(cb);
}
@@ -1553,7 +1554,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height;
- bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
+ bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
MEM_freeN(cb);
@@ -1568,11 +1569,11 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(ar
float d;
/* we allow 20 times zoom */
- if ( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f * (cumap->clipr.xmax - cumap->clipr.xmin) ) {
- d = 0.1154f * (cumap->curr.xmax - cumap->curr.xmin);
+ if (BLI_RCT_SIZE_X(&cumap->curr) > 0.04f * BLI_RCT_SIZE_X(&cumap->clipr)) {
+ d = 0.1154f * BLI_RCT_SIZE_X(&cumap->curr);
cumap->curr.xmin += d;
cumap->curr.xmax -= d;
- d = 0.1154f * (cumap->curr.ymax - cumap->curr.ymin);
+ d = 0.1154f * BLI_RCT_SIZE_Y(&cumap->curr);
cumap->curr.ymin += d;
cumap->curr.ymax -= d;
}
@@ -1586,8 +1587,8 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
float d, d1;
/* we allow 20 times zoom, but don't view outside clip */
- if ( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f * (cumap->clipr.xmax - cumap->clipr.xmin) ) {
- d = d1 = 0.15f * (cumap->curr.xmax - cumap->curr.xmin);
+ if (BLI_RCT_SIZE_X(&cumap->curr) < 20.0f * BLI_RCT_SIZE_X(&cumap->clipr)) {
+ d = d1 = 0.15f * BLI_RCT_SIZE_X(&cumap->curr);
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->curr.xmin - d < cumap->clipr.xmin)
@@ -1600,7 +1601,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
d1 = -cumap->curr.xmax + cumap->clipr.xmax;
cumap->curr.xmax += d1;
- d = d1 = 0.15f * (cumap->curr.ymax - cumap->curr.ymin);
+ d = d1 = 0.15f * BLI_RCT_SIZE_Y(&cumap->curr);
if (cumap->flag & CUMA_DO_CLIP)
if (cumap->curr.ymin - d < cumap->clipr.ymin)
@@ -1621,7 +1622,7 @@ static void curvemap_buttons_setclip(bContext *UNUSED(C), void *cumap_v, void *U
{
CurveMapping *cumap = cumap_v;
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
}
static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v)
@@ -1629,7 +1630,7 @@ static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v)
CurveMapping *cumap = cumap_v;
curvemap_remove(cumap->cm + cumap->cur, SELECT);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
rna_update_cb(C, cb_v, NULL);
}
@@ -1671,26 +1672,26 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
switch (event) {
case 0: /* reset */
curvemap_reset(cuma, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
break;
case 1:
cumap->curr = cumap->clipr;
break;
case 2: /* set vector */
curvemap_sethandle(cuma, 1);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
break;
case 3: /* set auto */
curvemap_sethandle(cuma, 0);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
break;
case 4: /* extend horiz */
cuma->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
break;
case 5: /* extend extrapolate */
cuma->flag |= CUMA_EXTEND_EXTRAPOLATE;
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
break;
}
ED_region_tag_redraw(CTX_wm_region(C));
@@ -1756,7 +1757,7 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f;
curvemapping_set_black_white(cumap, NULL, NULL);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
rna_update_cb(C, cb_v, NULL);
}
@@ -2315,7 +2316,6 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *activeptr, const char *activepropname, const char *prop_list, int rows, int maxrows, int listtype)
{
- //Scene *scene = CTX_data_scene(C);
PropertyRNA *prop = NULL, *activeprop;
PropertyType type, activetype;
StructRNA *ptype;
@@ -2571,7 +2571,7 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, NULL);
break;
case B_STOPCOMPO:
- WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+ WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
break;
case B_STOPSEQ:
WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
@@ -2596,36 +2596,37 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiBlockSetHandleFunc(block, do_running_jobs, NULL);
- if (sa->spacetype == SPACE_NODE) {
- if (WM_jobs_test(wm, sa))
- owner = sa;
- handle_event = B_STOPCOMPO;
- }
- else if (sa->spacetype == SPACE_SEQ) {
- if (WM_jobs_test(wm, sa))
+ if (sa->spacetype == SPACE_SEQ) {
+ if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
owner = sa;
handle_event = B_STOPSEQ;
}
else if (sa->spacetype == SPACE_CLIP) {
- if (WM_jobs_test(wm, sa))
+ if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
owner = sa;
handle_event = B_STOPCLIP;
}
else {
Scene *scene;
/* another scene can be rendering too, for example via compositor */
- for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next)
- if (WM_jobs_test(wm, scene))
+ for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next) {
+ if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
+ handle_event = B_STOPRENDER;
break;
+ }
+ else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
+ handle_event = B_STOPCOMPO;
+ break;
+ }
+ }
owner = scene;
- handle_event = B_STOPRENDER;
}
if (owner) {
uiLayout *ui_abs;
ui_abs = uiLayoutAbsolute(layout, FALSE);
- (void)ui_abs; // UNUSED
+ (void)ui_abs; /* UNUSED */
uiDefIconBut(block, BUT, handle_event, ICON_PANEL_CLOSE,
0, UI_UNIT_Y * 0.1, UI_UNIT_X * 0.8, UI_UNIT_Y * 0.8, NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job"));
@@ -2634,7 +2635,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
uiLayoutRow(layout, FALSE);
}
- if (WM_jobs_test(wm, screen))
+ if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
TIP_("Stop screencast"));
if (screen->animtimer)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index b439271b23d..ef8d8302fa7 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -260,8 +260,8 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
rad += step;
- if (2.0f * rad > rect->ymax - rect->ymin)
- rad = 0.5f * (rect->ymax - rect->ymin);
+ if (2.0f * rad > BLI_RCT_SIZE_Y(rect))
+ rad = 0.5f * BLI_RCT_SIZE_Y(rect);
minx = rect->xmin - step;
miny = rect->ymin - step;
@@ -346,8 +346,8 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl
const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) ||
(roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2;
- minsize = mini((rect->xmax - rect->xmin) * hnum,
- (rect->ymax - rect->ymin) * vnum);
+ minsize = mini(BLI_RCT_SIZE_X(rect) * hnum,
+ BLI_RCT_SIZE_Y(rect) * vnum);
if (2.0f * rad > minsize)
rad = 0.5f * minsize;
@@ -492,7 +492,7 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha
float centx, centy, sizex, sizey, minsize;
int a, i1 = 0, i2 = 1;
- minsize = MIN2(rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+ minsize = mini(BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
/* center position and size */
centx = (float)rect->xmin + 0.5f * minsize;
@@ -527,7 +527,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize
float centx, centy, sizex, sizey, minsize;
int a, i1 = 0, i2 = 1;
- minsize = MIN2(rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+ minsize = mini(BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect));
/* center position and size */
centx = (float)rect->xmin + 0.5f * minsize;
@@ -571,14 +571,14 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
int a;
/* center position and size */
- centx = rect->xmax - 0.5f * (rect->ymax - rect->ymin);
- centy = rect->ymin + 0.5f * (rect->ymax - rect->ymin);
- size = 0.4f * (rect->ymax - rect->ymin);
+ centx = rect->xmax - 0.5f * BLI_RCT_SIZE_Y(rect);
+ centy = rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect);
+ size = 0.4f * BLI_RCT_SIZE_Y(rect);
/* XXX exception */
- asp = ((float)rect->xmax - rect->xmin) / ((float)rect->ymax - rect->ymin);
+ asp = ((float)BLI_RCT_SIZE_X(rect)) / ((float)BLI_RCT_SIZE_Y(rect));
if (asp > 1.2f && asp < 2.6f)
- centx = rect->xmax - 0.3f * (rect->ymax - rect->ymin);
+ centx = rect->xmax - 0.3f * BLI_RCT_SIZE_Y(rect);
for (a = 0; a < 6; a++) {
tria->vec[a][0] = size * menu_tria_vert[a][0] + centx;
@@ -595,9 +595,9 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
int a;
/* center position and size */
- centx = rect->xmin + 0.5f * (rect->ymax - rect->ymin);
- centy = rect->ymin + 0.5f * (rect->ymax - rect->ymin);
- size = 0.5f * (rect->ymax - rect->ymin);
+ centx = rect->xmin + 0.5f * BLI_RCT_SIZE_Y(rect);
+ centy = rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect);
+ size = 0.5f * BLI_RCT_SIZE_Y(rect);
for (a = 0; a < 6; a++) {
tria->vec[a][0] = size * check_tria_vert[a][0] + centx;
@@ -841,8 +841,8 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
if (icon == ICON_NONE)
return;
- w = rect->xmax - rect->xmin;
- h = rect->ymax - rect->ymin;
+ w = BLI_RCT_SIZE_X(rect);
+ h = BLI_RCT_SIZE_Y(rect);
size = MIN2(w, h);
size -= PREVIEW_PAD * 2; /* padding */
@@ -970,7 +970,7 @@ static void ui_text_clip_give_next_off(uiBut *but)
static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
{
int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
- int okwidth = rect->xmax - rect->xmin - border;
+ int okwidth = BLI_RCT_SIZE_X(rect) - border;
if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
@@ -1033,7 +1033,7 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
{
int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
- int okwidth = rect->xmax - rect->xmin - border;
+ int okwidth = BLI_RCT_SIZE_X(rect) - border;
char *cpoin = NULL;
char *cpend = but->drawstr + strlen(but->drawstr);
@@ -1095,7 +1095,7 @@ static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
{
-// int transopts;
+ //int transopts; // UNUSED
char *cpoin = NULL;
/* for underline drawing */
@@ -1170,7 +1170,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
#if 0
ui_rasterpos_safe(x, y, but->aspect);
- if (but->type == IDPOIN) transopts = 0; // no translation, of course!
+ if (but->type == IDPOIN) transopts = 0; /* no translation, of course! */
else transopts = ui_translate_buttons();
#endif
@@ -1265,7 +1265,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
}
else if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) {
int tmp = rect->xmin;
- rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
+ rect->xmin = rect->xmax - BLI_RCT_SIZE_Y(rect) - 1;
widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
rect->xmin = tmp;
}
@@ -1654,13 +1654,13 @@ static void widget_state(uiWidgetType *wt, int state)
static void widget_state_numslider(uiWidgetType *wt, int state)
{
uiWidgetStateColors *wcol_state = wt->wcol_state;
- float blend = wcol_state->blend - 0.2f; // XXX special tweak to make sure that bar will still be visible
+ float blend = wcol_state->blend - 0.2f; /* XXX special tweak to make sure that bar will still be visible */
/* call this for option button */
widget_state(wt, state);
/* now, set the inner-part so that it reflects state settings too */
- // TODO: maybe we should have separate settings for the blending colors used for this case?
+ /* TODO: maybe we should have separate settings for the blending colors used for this case? */
if (state & UI_SELECT) {
if (state & UI_BUT_ANIMATED_KEY)
@@ -1760,8 +1760,8 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
float quad_strip[WIDGET_SIZE_MAX * 2][2];
/* prevent tooltips to not show round shadow */
- if (2.0f * radout > 0.2f * (rect1.ymax - rect1.ymin) )
- rect1.ymax -= 0.2f * (rect1.ymax - rect1.ymin);
+ if (2.0f * radout > 0.2f * BLI_RCT_SIZE_Y(&rect1))
+ rect1.ymax -= 0.2f * BLI_RCT_SIZE_Y(&rect1);
else
rect1.ymax -= 2.0f * radout;
@@ -1843,14 +1843,14 @@ static void ui_hsv_cursor(float x, float y)
void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my)
{
/* duplication of code... well, simple is better now */
- float centx = (float)(rect->xmin + rect->xmax) / 2;
- float centy = (float)(rect->ymin + rect->ymax) / 2;
+ float centx = BLI_RCT_CENTER_X_FL(rect);
+ float centy = BLI_RCT_CENTER_Y_FL(rect);
float radius, dist;
- if (rect->xmax - rect->xmin > rect->ymax - rect->ymin)
- radius = (float)(rect->ymax - rect->ymin) / 2;
+ if (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect))
+ radius = (float)BLI_RCT_SIZE_Y(rect) / 2;
else
- radius = (float)(rect->xmax - rect->xmin) / 2;
+ radius = (float)BLI_RCT_SIZE_X(rect) / 2;
mx -= centx;
my -= centy;
@@ -1876,13 +1876,13 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
color_profile = BLI_PR_NONE;
radstep = 2.0f * (float)M_PI / (float)tot;
- centx = (float)(rect->xmin + rect->xmax) / 2;
- centy = (float)(rect->ymin + rect->ymax) / 2;
+ centx = BLI_RCT_CENTER_X_FL(rect);
+ centy = BLI_RCT_CENTER_Y_FL(rect);
- if (rect->xmax - rect->xmin > rect->ymax - rect->ymin)
- radius = (float)(rect->ymax - rect->ymin) / 2;
+ if (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect))
+ radius = (float)BLI_RCT_SIZE_Y(rect) / 2;
else
- radius = (float)(rect->xmax - rect->xmin) / 2;
+ radius = (float)BLI_RCT_SIZE_X(rect) / 2;
/* color */
ui_get_but_vectorf(but, rgb);
@@ -2007,13 +2007,13 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
/* old below */
for (dx = 0.0f; dx < 1.0f; dx += color_step) {
- // previous color
+ /* previous color */
copy_v3_v3(col0[0], col1[0]);
copy_v3_v3(col0[1], col1[1]);
copy_v3_v3(col0[2], col1[2]);
copy_v3_v3(col0[3], col1[3]);
- // new color
+ /* new color */
switch (type) {
case UI_GRAD_SV:
hsv_to_rgb(h, 0.0, dx, &col1[0][0], &col1[0][1], &col1[0][2]);
@@ -2057,11 +2057,11 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
break;
}
- // rect
- sx1 = rect->xmin + dx * (rect->xmax - rect->xmin);
- sx2 = rect->xmin + (dx + color_step) * (rect->xmax - rect->xmin);
+ /* rect */
+ sx1 = rect->xmin + dx * BLI_RCT_SIZE_X(rect);
+ sx2 = rect->xmin + (dx + color_step) * BLI_RCT_SIZE_X(rect);
sy = rect->ymin;
- dy = (rect->ymax - rect->ymin) / 3.0;
+ dy = BLI_RCT_SIZE_Y(rect) / 3.0;
glBegin(GL_QUADS);
for (a = 0; a < 3; a++, sy += dy) {
@@ -2116,8 +2116,8 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
}
/* cursor */
- x = rect->xmin + x * (rect->xmax - rect->xmin);
- y = rect->ymin + y * (rect->ymax - rect->ymin);
+ x = rect->xmin + x * BLI_RCT_SIZE_X(rect);
+ y = rect->ymin + y * BLI_RCT_SIZE_Y(rect);
CLAMP(x, rect->xmin + 3.0f, rect->xmax - 3.0f);
CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f);
@@ -2132,7 +2132,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
{
uiWidgetBase wtb;
- float rad = 0.5f * (rect->xmax - rect->xmin);
+ float rad = 0.5f * BLI_RCT_SIZE_X(rect);
float x, y;
float rgb[3], hsv[3], v, range;
int color_profile = but->block->color_profile;
@@ -2166,8 +2166,8 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
widgetbase_draw(&wtb, &wcol_tmp);
/* cursor */
- x = rect->xmin + 0.5f * (rect->xmax - rect->xmin);
- y = rect->ymin + v * (rect->ymax - rect->ymin);
+ x = rect->xmin + 0.5f * BLI_RCT_SIZE_X(rect);
+ y = rect->ymin + v * BLI_RCT_SIZE_Y(rect);
CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f);
ui_hsv_cursor(x, y);
@@ -2178,7 +2178,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
/* ************ separator, for menus etc ***************** */
static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol)
{
- int y = rect->ymin + (rect->ymax - rect->ymin) / 2 - 1;
+ int y = rect->ymin + BLI_RCT_SIZE_Y(rect) / 2 - 1;
unsigned char col[4];
col[0] = wcol->text[0];
@@ -2197,7 +2197,7 @@ static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol)
static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
uiWidgetBase wtb;
- float rad = 0.5f * (rect->ymax - rect->ymin);
+ float rad = 0.5f * BLI_RCT_SIZE_Y(rect);
float textofs = rad * 0.75f;
if (state & UI_SELECT)
@@ -2221,7 +2221,6 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
rect->xmax -= textofs;
}
-//static int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
{
float dist, vec[4][2];
@@ -2252,7 +2251,7 @@ void ui_draw_link_bezier(rcti *rect)
if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
/* we can reuse the dist variable here to increment the GL curve eval amount*/
- // const float dist = 1.0f/(float)LINK_RESOL; // UNUSED
+ // const float dist = 1.0f / (float)LINK_RESOL; // UNUSED
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
@@ -2279,12 +2278,12 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
widget_init(&wtb);
/* determine horizontal/vertical */
- horizontal = (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
+ horizontal = (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect));
if (horizontal)
- rad = 0.5f * (rect->ymax - rect->ymin);
+ rad = 0.5f * BLI_RCT_SIZE_Y(rect);
else
- rad = 0.5f * (rect->xmax - rect->xmin);
+ rad = 0.5f * BLI_RCT_SIZE_X(rect);
wtb.shadedir = (horizontal) ? 1 : 0;
@@ -2296,9 +2295,10 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
widgetbase_draw(&wtb, wcol);
/* slider */
- if (slider->xmax - slider->xmin < 2 || slider->ymax - slider->ymin < 2) ;
+ if ((BLI_RCT_SIZE_X(slider) < 2) || (BLI_RCT_SIZE_Y(slider) < 2)) {
+ /* pass */
+ }
else {
-
SWAP(short, wcol->shadetop, wcol->shadedown);
copy_v4_v4_char(wcol->inner, wcol->item);
@@ -2361,34 +2361,34 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
rect1 = *rect;
/* determine horizontal/vertical */
- horizontal = (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
+ horizontal = (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect));
if (horizontal) {
- fac = (rect->xmax - rect->xmin) / (size);
+ fac = BLI_RCT_SIZE_X(rect) / size;
rect1.xmin = rect1.xmin + ceilf(fac * ((float)value - but->softmin));
rect1.xmax = rect1.xmin + ceilf(fac * (but->a1 - but->softmin));
/* ensure minimium size */
- min = rect->ymax - rect->ymin;
+ min = BLI_RCT_SIZE_Y(rect);
- if (rect1.xmax - rect1.xmin < min) {
+ if (BLI_RCT_SIZE_X(&rect1) < min) {
rect1.xmax = rect1.xmin + min;
if (rect1.xmax > rect->xmax) {
rect1.xmax = rect->xmax;
- rect1.xmin = MAX2(rect1.xmax - min, rect->xmin);
+ rect1.xmin = maxi(rect1.xmax - min, rect->xmin);
}
}
}
else {
- fac = (rect->ymax - rect->ymin) / (size);
+ fac = BLI_RCT_SIZE_Y(rect) / size;
rect1.ymax = rect1.ymax - ceilf(fac * ((float)value - but->softmin));
rect1.ymin = rect1.ymax - ceilf(fac * (but->a1 - but->softmin));
/* ensure minimium size */
- min = rect->xmax - rect->xmin;
+ min = BLI_RCT_SIZE_X(rect);
- if (rect1.ymax - rect1.ymin < min) {
+ if (BLI_RCT_SIZE_Y(&rect1) < min) {
rect1.ymax = rect1.ymin + min;
if (rect1.ymax > rect->ymax) {
@@ -2416,10 +2416,10 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
rect_prog.ymax = rect_prog.ymin + 4;
rect_bar.ymax = rect_bar.ymin + 4;
- w = value * (rect_prog.xmax - rect_prog.xmin);
+ w = value * BLI_RCT_SIZE_X(&rect_prog);
/* ensure minimium size */
- min = rect_prog.ymax - rect_prog.ymin;
+ min = BLI_RCT_SIZE_Y(&rect_prog);
w = MAX2(w, min);
rect_bar.xmax = rect_bar.xmin + w;
@@ -2439,8 +2439,8 @@ static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, in
UI_ThemeColor(TH_TEXT_HI);
- rectlink.xmin = (rect->xmin + rect->xmax) / 2;
- rectlink.ymin = (rect->ymin + rect->ymax) / 2;
+ rectlink.xmin = BLI_RCT_CENTER_X(rect);
+ rectlink.ymin = BLI_RCT_CENTER_Y(rect);
rectlink.xmax = but->linkto[0];
rectlink.ymax = but->linkto[1];
@@ -2462,7 +2462,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
/* backdrop first */
/* fully rounded */
- offs = 0.5f * (rect->ymax - rect->ymin);
+ offs = 0.5f * BLI_RCT_SIZE_Y(rect);
toffs = offs * 0.75f;
round_box_edges(&wtb, roundboxalign, rect, offs);
@@ -2483,7 +2483,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
rect1 = *rect;
value = ui_get_but_val(but);
- fac = ((float)value - but->softmin) * (rect1.xmax - rect1.xmin - offs) / (but->softmax - but->softmin);
+ fac = ((float)value - but->softmin) * (BLI_RCT_SIZE_X(&rect1) - offs) / (but->softmax - but->softmin);
/* left part of slider, always rounded */
rect1.xmax = rect1.xmin + ceil(offs + 1.0f);
@@ -2616,7 +2616,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
widgetbase_draw(&wtb, wcol);
/* text space */
- rect->xmax -= (rect->ymax - rect->ymin);
+ rect->xmax -= BLI_RCT_SIZE_Y(rect);
}
static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
@@ -2659,7 +2659,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int
{
if (state & UI_ACTIVE) {
uiWidgetBase wtb;
- float rad = 0.5f * (rect->ymax - rect->ymin); // 4.0f
+ float rad = 0.5f * BLI_RCT_SIZE_Y(rect); /* 4.0f */
widget_init(&wtb);
@@ -2705,10 +2705,10 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
widget_init(&wtb);
/* square */
- recttemp.xmax = recttemp.xmin + (recttemp.ymax - recttemp.ymin);
+ recttemp.xmax = recttemp.xmin + BLI_RCT_SIZE_Y(&recttemp);
/* smaller */
- delta = 1 + (recttemp.ymax - recttemp.ymin) / 8;
+ delta = 1 + BLI_RCT_SIZE_Y(&recttemp) / 8;
recttemp.xmin += delta;
recttemp.ymin += delta;
recttemp.xmax -= delta;
@@ -2725,7 +2725,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN
widgetbase_draw(&wtb, wcol);
/* text space */
- rect->xmin += (rect->ymax - rect->ymin) * 0.7 + delta;
+ rect->xmin += BLI_RCT_SIZE_Y(rect) * 0.7 + delta;
}
@@ -2787,7 +2787,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int
static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
{
uiWidgetBase wtb;
- float rad = 5.0f; //0.5f*(rect->ymax - rect->ymin);
+ float rad = 5.0f; /* 0.5f * BLI_RCT_SIZE_Y(rect); */
widget_init(&wtb);
@@ -3176,10 +3176,12 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
break;
case HSVCUBE:
- if (but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
+ if (but->a1 == UI_GRAD_V_ALT) { /* vertical V slider, uses new widget draw now */
ui_draw_but_HSV_v(but, rect);
- else // other HSV pickers...
+ }
+ else { /* other HSV pickers... */
ui_draw_but_HSVCUBE(but, rect);
+ }
break;
case HSVCIRCLE:
@@ -3268,12 +3270,12 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
if (block->flag & UI_BLOCK_CLIPTOP) {
/* XXX no scaling for UI here yet */
glColor3ubv((unsigned char *)wt->wcol.text);
- UI_DrawTriIcon((rect->xmax + rect->xmin) / 2, rect->ymax - 8, 't');
+ UI_DrawTriIcon(BLI_RCT_CENTER_X(rect), rect->ymax - 8, 't');
}
if (block->flag & UI_BLOCK_CLIPBOTTOM) {
/* XXX no scaling for UI here yet */
glColor3ubv((unsigned char *)wt->wcol.text);
- UI_DrawTriIcon((rect->xmax + rect->xmin) / 2, rect->ymin + 10, 'v');
+ UI_DrawTriIcon(BLI_RCT_CENTER_X(rect), rect->ymin + 10, 'v');
}
}
}
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 0ff81f27f6b..ed6b2e00119 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -643,9 +643,7 @@ void ui_theme_init_default(void)
bTheme *btheme;
/* we search for the theme with name Default */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (strcmp("Default", btheme->name) == 0) break;
- }
+ btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
if (btheme == NULL) {
btheme = MEM_callocN(sizeof(bTheme), "theme");
@@ -1969,6 +1967,10 @@ void init_userdef_do_versions(void)
U.ndof_flag = NDOF_LOCK_HORIZON |
NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE;
}
+
+ if (U.ndof_orbit_sensitivity == 0.0f) {
+ U.ndof_orbit_sensitivity = 1.0f;
+ }
if (U.tweak_threshold == 0)
U.tweak_threshold = 10;
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 8ae08c08693..c3059b8d575 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -96,11 +96,11 @@ static void view2d_masks(View2D *v2d)
/* check size if: */
if (v2d->scroll & V2D_SCROLL_HORIZONTAL)
if (!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
- if (v2d->tot.xmax - v2d->tot.xmin <= v2d->cur.xmax - v2d->cur.xmin)
+ if (BLI_RCT_SIZE_X(&v2d->tot) <= BLI_RCT_SIZE_X(&v2d->cur))
v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
if (v2d->scroll & V2D_SCROLL_VERTICAL)
if (!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
- if (v2d->tot.ymax - v2d->tot.ymin <= v2d->cur.ymax - v2d->cur.ymin)
+ if (BLI_RCT_SIZE_Y(&v2d->tot) <= BLI_RCT_SIZE_Y(&v2d->cur))
v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
#endif
scroll = view2d_scroll_mapped(v2d->scroll);
@@ -328,8 +328,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
rctf *cur, *tot;
/* use mask as size of region that View2D resides in, as it takes into account scrollbars already */
- winx = (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
- winy = (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
+ winx = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1);
+ winy = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1);
/* get pointers to rcts for less typing */
cur = &v2d->cur;
@@ -347,10 +347,10 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
* - firstly, we calculate the sizes of the rects
* - curwidth and curheight are saved as reference... modify width and height values here
*/
- totwidth = tot->xmax - tot->xmin;
- totheight = tot->ymax - tot->ymin;
- curwidth = width = cur->xmax - cur->xmin;
- curheight = height = cur->ymax - cur->ymin;
+ totwidth = BLI_RCT_SIZE_X(tot);
+ totheight = BLI_RCT_SIZE_Y(tot);
+ curwidth = width = BLI_RCT_SIZE_X(cur);
+ curheight = height = BLI_RCT_SIZE_Y(cur);
/* if zoom is locked, size on the appropriate axis is reset to mask size */
if (v2d->keepzoom & V2D_LOCKZOOM_X)
@@ -499,16 +499,16 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
/* resize from centerpoint, unless otherwise specified */
if (width != curwidth) {
if (v2d->keepofs & V2D_LOCKOFS_X) {
- cur->xmax += width - (cur->xmax - cur->xmin);
+ cur->xmax += width - BLI_RCT_SIZE_X(cur);
}
else if (v2d->keepofs & V2D_KEEPOFS_X) {
if (v2d->align & V2D_ALIGN_NO_POS_X)
- cur->xmin -= width - (cur->xmax - cur->xmin);
+ cur->xmin -= width - BLI_RCT_SIZE_X(cur);
else
- cur->xmax += width - (cur->xmax - cur->xmin);
+ cur->xmax += width - BLI_RCT_SIZE_X(cur);
}
else {
- temp = (cur->xmax + cur->xmin) * 0.5f;
+ temp = BLI_RCT_CENTER_X(cur);
dh = width * 0.5f;
cur->xmin = temp - dh;
@@ -517,16 +517,16 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
}
if (height != curheight) {
if (v2d->keepofs & V2D_LOCKOFS_Y) {
- cur->ymax += height - (cur->ymax - cur->ymin);
+ cur->ymax += height - BLI_RCT_SIZE_Y(cur);
}
else if (v2d->keepofs & V2D_KEEPOFS_Y) {
if (v2d->align & V2D_ALIGN_NO_POS_Y)
- cur->ymin -= height - (cur->ymax - cur->ymin);
+ cur->ymin -= height - BLI_RCT_SIZE_Y(cur);
else
- cur->ymax += height - (cur->ymax - cur->ymin);
+ cur->ymax += height - BLI_RCT_SIZE_Y(cur);
}
else {
- temp = (cur->ymax + cur->ymin) * 0.5f;
+ temp = BLI_RCT_CENTER_Y(cur);
dh = height * 0.5f;
cur->ymin = temp - dh;
@@ -540,8 +540,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
float temp, diff;
/* recalculate extents of cur */
- curwidth = cur->xmax - cur->xmin;
- curheight = cur->ymax - cur->ymin;
+ curwidth = BLI_RCT_SIZE_X(cur);
+ curheight = BLI_RCT_SIZE_Y(cur);
/* width */
if ( (curwidth > totwidth) && !(v2d->keepzoom & (V2D_KEEPZOOM | V2D_LOCKZOOM_X | V2D_LIMITZOOM)) ) {
@@ -592,7 +592,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
*/
if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) {
/* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
- temp = (tot->xmax + tot->xmin) * 0.5f;
+ temp = BLI_RCT_CENTER_X(tot);
diff = curheight * 0.5f;
cur->xmin = temp - diff;
@@ -642,7 +642,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
*/
if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) {
/* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
- temp = (tot->ymax + tot->ymin) * 0.5f;
+ temp = BLI_RCT_CENTER_Y(tot);
diff = curheight * 0.5f;
cur->ymin = temp - diff;
@@ -791,8 +791,8 @@ void UI_view2d_curRect_reset(View2D *v2d)
float width, height;
/* assume width and height of 'cur' rect by default, should be same size as mask */
- width = (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
- height = (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
+ width = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1);
+ height = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1);
/* handle width - posx and negx flags are mutually exclusive, so watch out */
if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
@@ -958,8 +958,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
*curmasked = v2d->cur;
if (view2d_scroll_mapped(v2d->scroll)) {
- float dx = (v2d->cur.xmax - v2d->cur.xmin) / ((float)(v2d->mask.xmax - v2d->mask.xmin + 1));
- float dy = (v2d->cur.ymax - v2d->cur.ymin) / ((float)(v2d->mask.ymax - v2d->mask.ymin + 1));
+ float dx = BLI_RCT_SIZE_X(&v2d->cur) / ((float)(BLI_RCT_SIZE_X(&v2d->mask) + 1));
+ float dy = BLI_RCT_SIZE_Y(&v2d->cur) / ((float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1));
if (v2d->mask.xmin != 0)
curmasked->xmin -= dx * (float)v2d->mask.xmin;
@@ -985,8 +985,8 @@ void UI_view2d_view_ortho(View2D *v2d)
*/
/* XXX brecht: instead of zero at least use a tiny offset, otherwise
* pixel rounding is effectively random due to float inaccuracy */
- xofs = 0.001f * (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
- yofs = 0.001f * (v2d->cur.ymax - v2d->cur.ymin) / (v2d->mask.ymax - v2d->mask.ymin);
+ xofs = 0.001f * BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
+ yofs = 0.001f * BLI_RCT_SIZE_Y(&v2d->cur) / BLI_RCT_SIZE_Y(&v2d->mask);
/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
view2d_map_cur_using_mask(v2d, &curmasked);
@@ -1044,8 +1044,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis)
void UI_view2d_view_restore(const bContext *C)
{
ARegion *ar = CTX_wm_region(C);
- int width = ar->winrct.xmax - ar->winrct.xmin + 1;
- int height = ar->winrct.ymax - ar->winrct.ymin + 1;
+ int width = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ int height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
wmOrtho2(0.0f, (float)width, 0.0f, (float)height);
glLoadIdentity();
@@ -1140,8 +1140,8 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
/* calculate x-axis grid scale (only if both args are valid) */
if (ELEM(V2D_ARG_DUMMY, xunits, xclamp) == 0) {
- space = v2d->cur.xmax - v2d->cur.xmin;
- pixels = (float)(v2d->mask.xmax - v2d->mask.xmin);
+ space = BLI_RCT_SIZE_X(&v2d->cur);
+ pixels = (float)BLI_RCT_SIZE_X(&v2d->mask);
if (pixels != 0.0f) {
grid->dx = (U.v2d_min_gridsize * space) / (seconddiv * pixels);
@@ -1158,7 +1158,7 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
/* calculate y-axis grid scale (only if both args are valid) */
if (ELEM(V2D_ARG_DUMMY, yunits, yclamp) == 0) {
- space = v2d->cur.ymax - v2d->cur.ymin;
+ space = BLI_RCT_SIZE_Y(&v2d->cur);
pixels = (float)winy;
grid->dy = U.v2d_min_gridsize * space / pixels;
@@ -1206,7 +1206,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
vec2[1] = v2d->cur.ymax;
/* minor gridlines */
- step = (v2d->mask.xmax - v2d->mask.xmin + 1) / U.v2d_min_gridsize;
+ step = (BLI_RCT_SIZE_X(&v2d->mask) + 1) / U.v2d_min_gridsize;
UI_ThemeColor(TH_GRID);
for (a = 0; a < step; a++) {
@@ -1240,7 +1240,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
vec1[0] = grid->startx;
vec2[0] = v2d->cur.xmax;
- step = (v2d->mask.ymax - v2d->mask.ymin + 1) / U.v2d_min_gridsize;
+ step = (BLI_RCT_SIZE_Y(&v2d->mask) + 1) / U.v2d_min_gridsize;
UI_ThemeColor(TH_GRID);
for (a = 0; a <= step; a++) {
@@ -1457,8 +1457,8 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
/* horizontal scrollers */
if (scroll & V2D_SCROLL_HORIZONTAL) {
/* scroller 'button' extents */
- totsize = v2d->tot.xmax - v2d->tot.xmin;
- scrollsize = (float)(hor.xmax - hor.xmin);
+ totsize = BLI_RCT_SIZE_X(&v2d->tot);
+ scrollsize = (float)BLI_RCT_SIZE_X(&hor);
if (totsize == 0.0f) totsize = 1.0f; /* avoid divide by zero */
fac1 = (v2d->cur.xmin - v2d->tot.xmin) / totsize;
@@ -1498,8 +1498,8 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
/* vertical scrollers */
if (scroll & V2D_SCROLL_VERTICAL) {
/* scroller 'button' extents */
- totsize = v2d->tot.ymax - v2d->tot.ymin;
- scrollsize = (float)(vert.ymax - vert.ymin);
+ totsize = BLI_RCT_SIZE_Y(&v2d->tot);
+ scrollsize = (float)BLI_RCT_SIZE_Y(&vert);
if (totsize == 0.0f) totsize = 1.0f; /* avoid divide by zero */
fac1 = (v2d->cur.ymin - v2d->tot.ymin) / totsize;
@@ -1545,7 +1545,9 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
scrollers->yclamp = yclamp;
scrollers->yunits = yunits;
- scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
+ scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d,
+ xunits, xclamp, yunits, yclamp,
+ BLI_RCT_SIZE_X(&hor), BLI_RCT_SIZE_Y(&vert));
}
/* return scrollers */
@@ -1629,7 +1631,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
*/
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 &&
(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) &&
- (slider.xmax - slider.xmin > V2D_SCROLLER_HANDLE_SIZE))
+ (BLI_RCT_SIZE_X(&slider) > V2D_SCROLLER_HANDLE_SIZE))
{
state |= UI_SCROLL_ARROWS;
}
@@ -1649,11 +1651,11 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
* - fac is x-coordinate to draw to
* - dfac is gap between scale markings
*/
- fac = (grid->startx - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
- fac = (float)hor.xmin + fac * (hor.xmax - hor.xmin);
+ fac = (grid->startx - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
+ fac = (float)hor.xmin + fac * BLI_RCT_SIZE_X(&hor);
- dfac = (grid->dx) / (v2d->cur.xmax - v2d->cur.xmin);
- dfac = dfac * (hor.xmax - hor.xmin);
+ dfac = grid->dx / BLI_RCT_SIZE_X(&v2d->cur);
+ dfac = dfac * BLI_RCT_SIZE_X(&hor);
/* set starting value, and text color */
UI_ThemeColor(TH_TEXT);
@@ -1740,7 +1742,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
*/
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 &&
(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) &&
- (slider.ymax - slider.ymin > V2D_SCROLLER_HANDLE_SIZE))
+ (BLI_RCT_SIZE_Y(&slider) > V2D_SCROLLER_HANDLE_SIZE))
{
state |= UI_SCROLL_ARROWS;
}
@@ -1763,11 +1765,11 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
* - these involve a correction for horizontal scrollbar
* NOTE: it's assumed that that scrollbar is there if this is involved!
*/
- fac = (grid->starty - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
- fac = vert.ymin + fac * (vert.ymax - vert.ymin);
+ fac = (grid->starty - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
+ fac = vert.ymin + fac * BLI_RCT_SIZE_Y(&vert);
- dfac = (grid->dy) / (v2d->cur.ymax - v2d->cur.ymin);
- dfac = dfac * (vert.ymax - vert.ymin);
+ dfac = grid->dy / BLI_RCT_SIZE_Y(&v2d->cur);
+ dfac = dfac * BLI_RCT_SIZE_Y(&vert);
/* set starting value, and text color */
UI_ThemeColor(TH_TEXT);
@@ -1925,17 +1927,17 @@ void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *r_viewx, float *
float div, ofs;
if (r_viewx) {
- div = (float)(v2d->mask.xmax - v2d->mask.xmin);
+ div = (float)BLI_RCT_SIZE_X(&v2d->mask);
ofs = (float)v2d->mask.xmin;
- *r_viewx = v2d->cur.xmin + (v2d->cur.xmax - v2d->cur.xmin) * ((float)x - ofs) / div;
+ *r_viewx = v2d->cur.xmin + BLI_RCT_SIZE_X(&v2d->cur) * ((float)x - ofs) / div;
}
if (r_viewy) {
- div = (float)(v2d->mask.ymax - v2d->mask.ymin);
+ div = (float)BLI_RCT_SIZE_Y(&v2d->mask);
ofs = (float)v2d->mask.ymin;
- *r_viewy = v2d->cur.ymin + (v2d->cur.ymax - v2d->cur.ymin) * ((float)y - ofs) / div;
+ *r_viewy = v2d->cur.ymin + BLI_RCT_SIZE_Y(&v2d->cur) * ((float)y - ofs) / div;
}
}
@@ -1954,15 +1956,15 @@ void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *regionx, int *
*regiony = V2D_IS_CLIPPED;
/* express given coordinates as proportional values */
- x = (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
- y = (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+ x = (x - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
+ y = (y - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
/* check if values are within bounds */
if ((x >= 0.0f) && (x <= 1.0f) && (y >= 0.0f) && (y <= 1.0f)) {
if (regionx)
- *regionx = (int)(v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin));
+ *regionx = (int)(v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask));
if (regiony)
- *regiony = (int)(v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin));
+ *regiony = (int)(v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask));
}
}
@@ -1975,12 +1977,12 @@ void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *regionx, int *
void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, int *regiony)
{
/* step 1: express given coordinates as proportional values */
- x = (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
- y = (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+ x = (x - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
+ y = (y - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
/* step 2: convert proportional distances to screen coordinates */
- x = v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin);
- y = v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin);
+ x = v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask);
+ y = v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask);
/* although we don't clamp to lie within region bounds, we must avoid exceeding size of ints */
if (regionx) {
@@ -2033,8 +2035,8 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C)
*/
void UI_view2d_getscale(View2D *v2d, float *x, float *y)
{
- if (x) *x = (v2d->mask.xmax - v2d->mask.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
- if (y) *y = (v2d->mask.ymax - v2d->mask.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+ if (x) *x = BLI_RCT_SIZE_X(&v2d->mask) / BLI_RCT_SIZE_X(&v2d->cur);
+ if (y) *y = BLI_RCT_SIZE_Y(&v2d->mask) / BLI_RCT_SIZE_Y(&v2d->cur);
}
/* Check if mouse is within scrollers
@@ -2140,7 +2142,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
const char *str = (const char *)(v2s + 1);
int xofs = 0, yofs;
- yofs = ceil(0.5f * (v2s->rect.ymax - v2s->rect.ymin - default_height));
+ yofs = ceil(0.5f * (BLI_RCT_SIZE_Y(&v2s->rect) - default_height));
if (yofs < 1) yofs = 1;
if (col_pack_prev != v2s->col.pack) {
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 33b72b34784..cc2ca5c5475 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -119,10 +119,10 @@ static int view_pan_init(bContext *C, wmOperator *op)
vpd->ar = ar;
/* calculate translation factor - based on size of view */
- winx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1);
- winy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1);
- vpd->facx = (v2d->cur.xmax - v2d->cur.xmin) / winx;
- vpd->facy = (v2d->cur.ymax - v2d->cur.ymin) / winy;
+ winx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1);
+ winy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1);
+ vpd->facx = (BLI_RCT_SIZE_X(&v2d->cur)) / winx;
+ vpd->facy = (BLI_RCT_SIZE_Y(&v2d->cur)) / winy;
return 1;
}
@@ -471,7 +471,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
if (RNA_boolean_get(op->ptr, "page")) {
ARegion *ar = CTX_wm_region(C);
- RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymax - ar->v2d.mask.ymin);
+ RNA_int_set(op->ptr, "deltay", BLI_RCT_SIZE_Y(&ar->v2d.mask));
}
/* apply movement, then we're done */
@@ -590,12 +590,12 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
facy = RNA_float_get(op->ptr, "zoomfacy");
if (facx >= 0.0f) {
- dx = (v2d->cur.xmax - v2d->cur.xmin) * facx;
- dy = (v2d->cur.ymax - v2d->cur.ymin) * facy;
+ dx = BLI_RCT_SIZE_X(&v2d->cur) * facx;
+ dy = BLI_RCT_SIZE_Y(&v2d->cur) * facy;
}
else {
- dx = ((v2d->cur.xmax - v2d->cur.xmin) / (1.0f + 2.0f * facx)) * facx;
- dy = ((v2d->cur.ymax - v2d->cur.ymin) / (1.0f + 2.0f * facy)) * facy;
+ dx = (BLI_RCT_SIZE_X(&v2d->cur) / (1.0f + 2.0f * facx)) * facx;
+ dy = (BLI_RCT_SIZE_Y(&v2d->cur) / (1.0f + 2.0f * facy)) * facy;
}
/* only resize view on an axis if change is allowed */
@@ -611,7 +611,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
}
else {
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
+ float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
float mval_faci = 1.0f - mval_fac;
float ofs = (mval_fac * dx) - (mval_faci * dx);
@@ -636,7 +636,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
}
else {
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- float mval_fac = (vzd->my_2d - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+ float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
float mval_faci = 1.0f - mval_fac;
float ofs = (mval_fac * dy) - (mval_faci * dy);
@@ -672,13 +672,22 @@ static void view_zoomstep_exit(wmOperator *op)
/* this operator only needs this single callback, where it calls the view_zoom_*() methods */
static int view_zoomin_exec(bContext *C, wmOperator *op)
{
+ ScrArea *sa = CTX_wm_area(C);
+ short do_zoom_x = TRUE;
+ short do_zoom_y = TRUE;
+
/* check that there's an active region, as View2D data resides there */
if (!view_zoom_poll(C))
return OPERATOR_PASS_THROUGH;
+ /* default not to zoom the sequencer vertically */
+ if (sa && sa->spacetype == SPACE_SEQ) {
+ do_zoom_y = FALSE;
+ }
+
/* set RNA-Props - zooming in by uniform factor */
- RNA_float_set(op->ptr, "zoomfacx", 0.0375f);
- RNA_float_set(op->ptr, "zoomfacy", 0.0375f);
+ RNA_float_set(op->ptr, "zoomfacx", do_zoom_x ? 0.0375f : 0.0f);
+ RNA_float_set(op->ptr, "zoomfacy", do_zoom_y ? 0.0375f : 0.0f);
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
@@ -729,13 +738,22 @@ static void VIEW2D_OT_zoom_in(wmOperatorType *ot)
/* this operator only needs this single callback, where it callsthe view_zoom_*() methods */
static int view_zoomout_exec(bContext *C, wmOperator *op)
{
+ ScrArea *sa = CTX_wm_area(C);
+ short do_zoom_x = TRUE;
+ short do_zoom_y = TRUE;
+
/* check that there's an active region, as View2D data resides there */
if (!view_zoom_poll(C))
return OPERATOR_PASS_THROUGH;
+ /* default not to zoom the sequencer vertically */
+ if (sa && sa->spacetype == SPACE_SEQ) {
+ do_zoom_y = FALSE;
+ }
+
/* set RNA-Props - zooming in by uniform factor */
- RNA_float_set(op->ptr, "zoomfacx", -0.0375f);
- RNA_float_set(op->ptr, "zoomfacy", -0.0375f);
+ RNA_float_set(op->ptr, "zoomfacx", do_zoom_x ? -0.0375f : 0.0f);
+ RNA_float_set(op->ptr, "zoomfacy", do_zoom_y ? -0.0375f : 0.0f);
/* apply movement, then we're done */
view_zoomstep_apply(C, op);
@@ -821,7 +839,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
}
else {
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
+ float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
float mval_faci = 1.0f - mval_fac;
float ofs = (mval_fac * dx) - (mval_faci * dx);
@@ -840,7 +858,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
}
else {
if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
- float mval_fac = (vzd->my_2d - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+ float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
float mval_faci = 1.0f - mval_fac;
float ofs = (mval_fac * dy) - (mval_faci * dy);
@@ -918,8 +936,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
* with magnify information that is stored in x axis
*/
fac = 0.01f * (event->x - event->prevx);
- dx = fac * (v2d->cur.xmax - v2d->cur.xmin) / 10.0f;
- dy = fac * (v2d->cur.ymax - v2d->cur.ymin) / 10.0f;
+ dx = fac * BLI_RCT_SIZE_X(&v2d->cur) / 10.0f;
+ dy = fac * BLI_RCT_SIZE_Y(&v2d->cur) / 10.0f;
RNA_float_set(op->ptr, "deltax", dx);
RNA_float_set(op->ptr, "deltay", dy);
@@ -985,14 +1003,14 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
float dist;
/* x-axis transform */
- dist = (v2d->mask.xmax - v2d->mask.xmin) / 2.0f;
+ dist = BLI_RCT_SIZE_X(&v2d->mask) / 2.0f;
dx = 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f);
- dx *= 0.5f * (v2d->cur.xmax - v2d->cur.xmin);
+ dx *= 0.5f * BLI_RCT_SIZE_X(&v2d->cur);
/* y-axis transform */
- dist = (v2d->mask.ymax - v2d->mask.ymin) / 2.0f;
+ dist = BLI_RCT_SIZE_Y(&v2d->mask) / 2.0f;
dy = 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f);
- dy *= 0.5f * (v2d->cur.ymax - v2d->cur.ymin);
+ dy *= 0.5f * BLI_RCT_SIZE_Y(&v2d->cur);
}
else {
/* 'continuous' or 'dolly' */
@@ -1000,11 +1018,11 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
/* x-axis transform */
fac = 0.01f * (event->x - vzd->lastx);
- dx = fac * (v2d->cur.xmax - v2d->cur.xmin);
+ dx = fac * BLI_RCT_SIZE_X(&v2d->cur);
/* y-axis transform */
fac = 0.01f * (event->y - vzd->lasty);
- dy = fac * (v2d->cur.ymax - v2d->cur.ymin);
+ dy = fac * BLI_RCT_SIZE_Y(&v2d->cur);
#if 0
/* continuous zoom shouldn't move that fast... */
if (U.viewzoom == USER_ZOOM_CONT) { // XXX store this setting as RNA prop?
@@ -1137,17 +1155,17 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
/* TODO: is this zoom factor calculation valid? It seems to produce same results everytime... */
if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
- size = (cur_new.xmax - cur_new.xmin);
- zoom = size / (rect.xmax - rect.xmin);
- center = (cur_new.xmax + cur_new.xmin) * 0.5f;
+ size = BLI_RCT_SIZE_X(&cur_new);
+ zoom = size / BLI_RCT_SIZE_X(&rect);
+ center = BLI_RCT_CENTER_X(&cur_new);
cur_new.xmin = center - (size * zoom);
cur_new.xmax = center + (size * zoom);
}
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
- size = (cur_new.ymax - cur_new.ymin);
- zoom = size / (rect.ymax - rect.ymin);
- center = (cur_new.ymax + cur_new.ymin) * 0.5f;
+ size = BLI_RCT_SIZE_Y(&cur_new);
+ zoom = size / BLI_RCT_SIZE_Y(&rect);
+ center = BLI_RCT_CENTER_Y(&cur_new);
cur_new.ymin = center - (size * zoom);
cur_new.ymax = center + (size * zoom);
@@ -1197,14 +1215,14 @@ struct SmoothView2DStore {
*/
static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
{
- float size_a[2] = {rect_a->xmax - rect_a->xmin,
- rect_a->ymax - rect_a->ymin};
- float size_b[2] = {rect_b->xmax - rect_b->xmin,
- rect_b->ymax - rect_b->ymin};
- float cent_a[2] = {(rect_a->xmax + rect_a->xmin) * 0.5f,
- (rect_a->ymax + rect_a->ymin) * 0.5f};
- float cent_b[2] = {(rect_b->xmax + rect_b->xmin) * 0.5f,
- (rect_b->ymax + rect_b->ymin) * 0.5f};
+ float size_a[2] = {BLI_RCT_SIZE_X(rect_a),
+ BLI_RCT_SIZE_Y(rect_a)};
+ float size_b[2] = {BLI_RCT_SIZE_X(rect_b),
+ BLI_RCT_SIZE_Y(rect_b)};
+ float cent_a[2] = {BLI_RCT_CENTER_X(rect_a),
+ BLI_RCT_CENTER_Y(rect_a)};
+ float cent_b[2] = {BLI_RCT_CENTER_X(rect_b),
+ BLI_RCT_CENTER_Y(rect_b)};
float fac_max = 0.0f;
float tfac;
@@ -1477,8 +1495,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
if (in_scroller == 'h') {
/* horizontal scroller - calculate adjustment factor first */
- mask_size = (float)(v2d->hor.xmax - v2d->hor.xmin);
- vsm->fac = (v2d->tot.xmax - v2d->tot.xmin) / mask_size;
+ mask_size = (float)BLI_RCT_SIZE_X(&v2d->hor);
+ vsm->fac = BLI_RCT_SIZE_X(&v2d->tot) / mask_size;
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
@@ -1493,8 +1511,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
}
else {
/* vertical scroller - calculate adjustment factor first */
- mask_size = (float)(v2d->vert.ymax - v2d->vert.ymin);
- vsm->fac = (v2d->tot.ymax - v2d->tot.ymin) / mask_size;
+ mask_size = (float)BLI_RCT_SIZE_Y(&v2d->vert);
+ vsm->fac = BLI_RCT_SIZE_Y(&v2d->tot) / mask_size;
/* get 'zone' (i.e. which part of scroller is activated) */
vsm->zone = mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
@@ -1774,8 +1792,8 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
int winx, winy;
/* zoom 1.0 */
- winx = (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
- winy = (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
+ winx = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1);
+ winy = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1);
v2d->cur.xmax = v2d->cur.xmin + winx;
v2d->cur.ymax = v2d->cur.ymin + winy;
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index ebfc0522f17..d0ce3f0cace 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -269,15 +269,15 @@ void WM_OT_collada_export(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "active_uv_only", 0, "Only Active UV layer",
- "Export textures assigned to the object UV maps");
+ "Export textures assigned to the object UV maps");
RNA_def_boolean(ot->srna, "include_uv_textures", 0, "Include UV Textures",
- "Export textures assigned to the object UV maps");
+ "Export textures assigned to the object UV maps");
RNA_def_boolean(ot->srna, "include_material_textures", 0, "Include Material Textures",
- "Export textures assigned to the object Materials");
+ "Export textures assigned to the object Materials");
- RNA_def_boolean(ot->srna, "use_texture_copies", 1, "Copy",
+ RNA_def_boolean(ot->srna, "use_texture_copies", 1, "Copy",
"Copy textures to same folder where the .dae file is exported");
diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c
index e9b31b8df1a..b37f758596b 100644
--- a/source/blender/editors/mask/mask_add.c
+++ b/source/blender/editors/mask/mask_add.c
@@ -180,24 +180,20 @@ static int find_nearest_diff_point(const bContext *C, Mask *mask, const float no
/******************** add vertex *********************/
-static void setup_vertex_point(const bContext *C, Mask *mask, MaskSpline *spline, MaskSplinePoint *new_point,
+static void setup_vertex_point(Mask *mask, MaskSpline *spline, MaskSplinePoint *new_point,
const float point_co[2], const float tangent[2], const float u,
- MaskSplinePoint *reference_point, const short reference_adjacent)
+ MaskSplinePoint *reference_point, const short reference_adjacent,
+ const float view_zoom)
{
- ScrArea *sa = CTX_wm_area(C);
-
MaskSplinePoint *prev_point = NULL;
MaskSplinePoint *next_point = NULL;
BezTriple *bezt;
- int width, height;
float co[3];
- const float len = 20.0; /* default length of handle in pixel space */
+ const float len = 10.0; /* default length of handle in pixel space */
copy_v2_v2(co, point_co);
co[2] = 0.0f;
- ED_mask_get_size(sa, &width, &height);
-
/* point coordinate */
bezt = &new_point->bezt;
@@ -225,21 +221,15 @@ static void setup_vertex_point(const bContext *C, Mask *mask, MaskSpline *spline
/* initial offset for handles */
if (spline->tot_point == 1) {
/* first point of splien is aligned horizontally */
- bezt->vec[0][0] -= len / width;
- bezt->vec[2][0] += len / width;
+ bezt->vec[0][0] -= len * view_zoom;
+ bezt->vec[2][0] += len * view_zoom;
}
else if (tangent) {
float vec[2];
copy_v2_v2(vec, tangent);
- vec[0] *= width;
- vec[1] *= height;
-
- mul_v2_fl(vec, len / len_v2(vec));
-
- vec[0] /= width;
- vec[1] /= height;
+ mul_v2_fl(vec, len);
sub_v2_v2(bezt->vec[0], vec);
add_v2_v2(bezt->vec[2], vec);
@@ -391,7 +381,7 @@ static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2]
new_point = &spline->points[point_index + 1];
- setup_vertex_point(C, mask, spline, new_point, co, tangent, u, NULL, TRUE);
+ setup_vertex_point(mask, spline, new_point, co, tangent, u, NULL, TRUE, 1.0f);
/* TODO - we could pass the spline! */
BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index + 1, TRUE, TRUE);
@@ -490,7 +480,7 @@ static int add_vertex_extrude(const bContext *C, Mask *mask, MaskLayer *masklay,
masklay->act_point = new_point;
- setup_vertex_point(C, mask, spline, new_point, co, NULL, 0.5f, ref_point, FALSE);
+ setup_vertex_point(mask, spline, new_point, co, NULL, 0.5f, ref_point, FALSE, 1.0f);
if (masklay->splines_shapes.first) {
point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
@@ -512,6 +502,7 @@ static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, con
MaskSpline *spline;
MaskSplinePoint *point;
MaskSplinePoint *new_point = NULL, *ref_point = NULL;
+ float view_zoom;
if (!masklay) {
/* if there's no masklay currently operationg on, create new one */
@@ -536,7 +527,22 @@ static int add_vertex_new(const bContext *C, Mask *mask, MaskLayer *masklay, con
masklay->act_point = new_point;
- setup_vertex_point(C, mask, spline, new_point, co, NULL, 0.5f, ref_point, FALSE);
+ {
+ ScrArea *sa = CTX_wm_area(C);
+ ARegion *ar = CTX_wm_region(C);
+
+ float zoom_x, zoom_y;
+ /* calc view zoom in a simplistic way */
+ ED_mask_zoom(sa, ar, &zoom_x, &zoom_y);
+
+ view_zoom = zoom_x + zoom_y / 2.0f;
+ view_zoom = 1.0f / view_zoom;
+
+ /* arbitrary but gives good results */
+ view_zoom /= 500.0f;
+ }
+
+ setup_vertex_point(mask, spline, new_point, co, NULL, 0.5f, ref_point, FALSE, view_zoom);
{
int point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 703ae70eb0f..c6b19e51de9 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -33,6 +33,7 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_mask.h"
@@ -387,7 +388,7 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
- feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height, &tot_feather_point);
+ feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height, &tot_feather_point, (is_fill != FALSE));
/* draw feather */
mask_spline_feather_color_get(masklay, spline, is_spline_sel, rgb_tmp);
@@ -512,12 +513,12 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
- /* w = v2d->tot.xmax - v2d->tot.xmin; */
- /* h = v2d->tot.ymax - v2d->tot.ymin;/*/
+ /* w = BLI_RCT_SIZE_X(&v2d->tot); */
+ /* h = BLI_RCT_SIZE_Y(&v2d->tot);/*/
- zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin));
- zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin));
+ zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur));
+ zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur));
if (do_scale_applied) {
zoomx /= width;
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index 285306ce12f..ace427f65ab 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -440,7 +440,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
/* TODO: handles? */
/* TODO: uw? */
- if (BLI_in_rctf_v(&rectf, point_deform->bezt.vec[1])) {
+ if (BLI_rctf_isect_pt_v(&rectf, point_deform->bezt.vec[1])) {
BKE_mask_point_select_set(point, mode == GESTURE_MODAL_SELECT);
BKE_mask_point_select_set_handle(point, mode == GESTURE_MODAL_SELECT);
}
@@ -525,7 +525,7 @@ static int do_lasso_select_mask(bContext *C, int mcords[][2], short moves, short
point_deform->bezt.vec[1][0], point_deform->bezt.vec[1][1],
&screen_co[0], &screen_co[1]);
- if (BLI_in_rcti(&rect, screen_co[0], screen_co[1]) &&
+ if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], INT_MAX))
{
BKE_mask_point_select_set(point, select);
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 62600c7fe6b..3431bea18ea 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -570,8 +570,8 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
unsigned int *rt;
char *selar;
int a, index;
- int sx = rect->xmax - rect->xmin + 1;
- int sy = rect->ymax - rect->ymin + 1;
+ int sx = BLI_RCT_SIZE_X(rect) + 1;
+ int sy = BLI_RCT_SIZE_Y(rect) + 1;
me = BKE_mesh_from_object(ob);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 13c48c7f51d..92cc3366b3e 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -1056,6 +1056,7 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
BMO_op_exec(em->bm, &bmop);
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "edgeout", BM_EDGE, BM_ELEM_SELECT, TRUE);
if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
@@ -2042,22 +2043,38 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMOperator bmop;
+ const float mergedist = RNA_float_get(op->ptr, "mergedist");
+ int use_unselected = RNA_boolean_get(op->ptr, "use_unselected");
+ int totvert_orig = em->bm->totvert;
int count;
- EDBM_op_init(em, &bmop, op, "find_doubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist"));
- BMO_op_exec(em->bm, &bmop);
-
- count = BMO_slot_map_count(em->bm, &bmop, "targetmapout");
+ if (use_unselected) {
+ EDBM_op_init(em, &bmop, op,
+ "automerge verts=%hv dist=%f",
+ BM_ELEM_SELECT, mergedist);
+ BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_callf(em, op, "weld_verts targetmap=%s", &bmop, "targetmapout")) {
- BMO_op_finish(em->bm, &bmop);
- return OPERATOR_CANCELLED;
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ return OPERATOR_CANCELLED;
+ }
}
+ else {
+ EDBM_op_init(em, &bmop, op,
+ "find_doubles verts=%hv dist=%f",
+ BM_ELEM_SELECT, mergedist);
+ BMO_op_exec(em->bm, &bmop);
- if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
- return OPERATOR_CANCELLED;
+ if (!EDBM_op_callf(em, op, "weld_verts targetmap=%s", &bmop, "targetmapout")) {
+ BMO_op_finish(em->bm, &bmop);
+ return OPERATOR_CANCELLED;
+ }
+
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+ return OPERATOR_CANCELLED;
+ }
}
+ count = totvert_orig - em->bm->totvert;
BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s", count, (count == 1) ? "ex" : "ices");
EDBM_update_generic(C, em, TRUE);
@@ -2082,6 +2099,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot)
RNA_def_float(ot->srna, "mergedist", 0.0001f, 0.000001f, 50.0f,
"Merge Distance",
"Minimum distance between elements to merge", 0.00001, 10.0);
+ RNA_def_boolean(ot->srna, "use_unselected", 0, "Unselected", "Merge selected to other unselected vertices");
}
/************************ Vertex Path Operator *************************/
@@ -2105,23 +2123,49 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
Object *ob = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(ob);
BMOperator bmop;
+ BMIter iter;
+ BMVert *eve = NULL, *svert = NULL, *evert = NULL;
BMEditSelection *sv, *ev;
/* get the type from RNA */
int type = RNA_enum_get(op->ptr, "type");
+ /* first try to find vertices in edit selection */
sv = em->bm->selected.last;
- if (sv != NULL)
+ if (sv != NULL) {
ev = sv->prev;
- else return OPERATOR_CANCELLED;
- if (ev == NULL)
- return OPERATOR_CANCELLED;
- if ((sv->htype != BM_VERT) || (ev->htype != BM_VERT))
+ if (ev && (sv->htype == BM_VERT) && (ev->htype == BM_VERT)) {
+ svert = (BMVert *)sv->ele;
+ evert = (BMVert *)ev->ele;
+ }
+ }
+
+ /* if those are not found, because vertices where selected by e.g.
+ border or circle select, find two selected vertices */
+ if (svert == NULL) {
+ BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+ if (!BM_elem_flag_test(eve, BM_ELEM_SELECT) || BM_elem_flag_test(eve, BM_ELEM_HIDDEN))
+ continue;
+
+ if (svert == NULL) svert = eve;
+ else if (evert == NULL) evert = eve;
+ else {
+ /* more than two vertices are selected,
+ show warning message and cancel operator */
+ svert = evert = NULL;
+ break;
+ }
+ }
+ }
+
+ if (svert == NULL || evert == NULL) {
+ BKE_report(op->reports, RPT_WARNING, "Path Selection requires that two vertices be selected");
return OPERATOR_CANCELLED;
+ }
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "shortest_path startv=%e endv=%e type=%i", sv->ele, ev->ele, type);
+ EDBM_op_init(em, &bmop, op, "shortest_path startv=%e endv=%e type=%i", svert, evert, type);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -2915,12 +2959,12 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *base_old, BMe
BMIter iter;
int result = FALSE;
- BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
-
while ((f_cmp = BM_iter_at_index(bm_old, BM_FACES_OF_MESH, NULL, 0))) {
const short mat_nr = f_cmp->mat_nr;
int tot = 0;
+ BM_mesh_elem_hflag_disable_all(bm_old, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, FALSE);
+
BM_ITER_MESH (f, &iter, bm_old, BM_FACES_OF_MESH) {
if (f->mat_nr == mat_nr) {
BMLoop *l_iter;
@@ -4758,15 +4802,32 @@ void MESH_OT_bevel(wmOperatorType *ot)
static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
{
+ BMOperator bmop;
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
+ const int use_merge = RNA_boolean_get(op->ptr, "use_merge");
+ const float merge_factor = RNA_float_get(op->ptr, "merge_factor");
- if (!EDBM_op_callf(em, op, "bridge_loops edges=%he", BM_ELEM_SELECT))
+ EDBM_op_init(em, &bmop, op,
+ "bridge_loops edges=%he use_merge=%b merge_factor=%f",
+ BM_ELEM_SELECT, use_merge, merge_factor);
+
+ BMO_op_exec(em->bm, &bmop);
+
+ /* when merge is used the edges are joined and remain selected */
+ if (use_merge == FALSE) {
+ EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+ BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+ }
+
+ if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
return OPERATOR_CANCELLED;
-
- EDBM_update_generic(C, em, TRUE);
- return OPERATOR_FINISHED;
+ }
+ else {
+ EDBM_update_generic(C, em, TRUE);
+ return OPERATOR_FINISHED;
+ }
}
void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
@@ -4784,6 +4845,9 @@ void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna, "inside", 0, "Inside", "");
+
+ RNA_def_boolean(ot->srna, "use_merge", FALSE, "Merge", "Merge rather than creating faces");
+ RNA_def_float(ot->srna, "merge_factor", 0.5f, 0.0f, 1.0f, "Merge Factor", "", 0.0f, 1.0f);
}
typedef struct {
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index c3093259fd8..59cc782f3eb 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -1241,7 +1241,7 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
MultiresBakeJob *bkr;
- wmJob *steve;
+ wmJob *wm_job;
if (!multiresbake_check(C, op))
return OPERATOR_CANCELLED;
@@ -1255,14 +1255,15 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
}
/* setup job */
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
- WM_jobs_customdata_set(steve, bkr, multiresbake_freejob);
- WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
- WM_jobs_callbacks(steve, multiresbake_startjob, NULL, NULL, NULL);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake",
+ WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
+ WM_jobs_customdata_set(wm_job, bkr, multiresbake_freejob);
+ WM_jobs_timer(wm_job, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
+ WM_jobs_callbacks(wm_job, multiresbake_startjob, NULL, NULL, NULL);
G.is_break = FALSE;
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
WM_cursor_wait(0);
/* add modal handler for ESC */
@@ -1438,7 +1439,7 @@ static void bake_freejob(void *bkv)
static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running blender, remove handler and pass through */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_OBJECT_BAKE_TEXTURE))
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
/* running render */
@@ -1468,7 +1469,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
}
else {
/* only one render job at a time */
- if (WM_jobs_test(CTX_wm_manager(C), scene))
+ if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE))
return OPERATOR_CANCELLED;
if (test_bake_internal(C, op->reports) == 0) {
@@ -1476,21 +1477,22 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
}
else {
BakeRender *bkr = MEM_callocN(sizeof(BakeRender), "render bake");
- wmJob *steve;
+ wmJob *wm_job;
init_bake_internal(bkr, C);
bkr->reports = op->reports;
/* setup job */
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
- WM_jobs_customdata_set(steve, bkr, bake_freejob);
- WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
- WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake",
+ WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
+ WM_jobs_customdata_set(wm_job, bkr, bake_freejob);
+ WM_jobs_timer(wm_job, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
+ WM_jobs_callbacks(wm_job, bake_startjob, NULL, bake_update, NULL);
G.is_break = FALSE;
G.is_rendering = TRUE;
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
WM_cursor_wait(0);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index b5e85c3712b..aa885320b37 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1720,13 +1720,15 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
{
if (ob != ob_iter) {
- if (type == COPY_PROPERTIES_REPLACE)
+ if (type == COPY_PROPERTIES_REPLACE) {
copy_properties(&ob_iter->prop, &ob->prop);
-
- /* merge - the default when calling with no argument */
- else
- for (prop = ob->prop.first; prop; prop = prop->next)
+ }
+ else {
+ /* merge - the default when calling with no argument */
+ for (prop = ob->prop.first; prop; prop = prop->next) {
set_ob_property(ob_iter, prop);
+ }
+ }
}
}
CTX_DATA_END;
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 53bfddee740..cca37cf3a44 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -370,6 +370,7 @@ void OBJECT_OT_group_add(wmOperatorType *ot)
/* api callbacks */
ot->exec = group_add_exec;
+ ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -403,6 +404,7 @@ void OBJECT_OT_group_link(wmOperatorType *ot)
/* api callbacks */
ot->exec = group_link_exec;
ot->invoke = WM_enum_search_invoke;
+ ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -438,6 +440,7 @@ void OBJECT_OT_group_remove(wmOperatorType *ot)
/* api callbacks */
ot->exec = group_remove_exec;
+ ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 2bace9c30d4..2b1492aa732 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -268,17 +268,12 @@ static int object_modifier_safe_to_delete(Main *bmain, Object *ob,
static int object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
int *sort_depsgraph)
{
- ModifierData *obmd;
-
/* It seems on rapid delete it is possible to
* get called twice on same modifier, so make
* sure it is in list. */
- for (obmd = ob->modifiers.first; obmd; obmd = obmd->next)
- if (obmd == md)
- break;
-
- if (!obmd)
+ if (BLI_findindex(&ob->modifiers, md) == -1) {
return 0;
+ }
/* special cases */
if (md->type == eModifierType_ParticleSystem) {
@@ -341,7 +336,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
ok = object_modifier_remove(bmain, ob, md, &sort_depsgraph);
if (!ok) {
- BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name);
+ BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", md->name, ob->id.name);
return 0;
}
@@ -1467,7 +1462,8 @@ static void modifier_skin_customdata_ensure(Object *ob)
me->totvert);
/* Mark an arbitrary vertex as root */
- vs->flag |= MVERT_SKIN_ROOT;
+ if (vs)
+ vs->flag |= MVERT_SKIN_ROOT;
}
}
@@ -2114,7 +2110,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
int f, cfra, i = 0;
int free = RNA_boolean_get(op->ptr, "free");
- wmJob *steve;
+ wmJob *wm_job;
OceanBakeJob *oj;
if (!omd)
@@ -2181,17 +2177,18 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
scene->r.cfra = cfra;
/* setup job */
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation",
+ WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_SIM_OCEAN);
oj = MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
oj->ocean = ocean;
oj->och = och;
oj->omd = omd;
- WM_jobs_customdata_set(steve, oj, oceanbake_free);
- WM_jobs_timer(steve, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
- WM_jobs_callbacks(steve, oceanbake_startjob, NULL, NULL, oceanbake_endjob);
+ WM_jobs_customdata_set(wm_job, oj, oceanbake_free);
+ WM_jobs_timer(wm_job, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
+ WM_jobs_callbacks(wm_job, oceanbake_startjob, NULL, NULL, oceanbake_endjob);
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index ff7728d4f68..7eb8cc01db9 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -988,13 +988,11 @@ static int object_select_same_group_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "group", group_name);
- for (group = CTX_data_main(C)->group.first; group; group = group->id.next) {
- if (!strcmp(group->id.name, group_name))
- break;
- }
+ group = (Group *)BKE_libblock_find_name(ID_GR, group_name);
- if (!group)
+ if (!group) {
return OPERATOR_PASS_THROUGH;
+ }
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index f943c83f4ed..9129d651d4d 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -759,7 +759,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
float min[3], max[3];
/* only bounds support */
INIT_MINMAX(min, max);
- BKE_object_minmax_dupli(scene, ob, min, max);
+ BKE_object_minmax_dupli(scene, ob, min, max, TRUE);
mid_v3_v3v3(cent, min, max);
invert_m4_m4(ob->imat, ob->obmat);
mul_m4_v3(ob->imat, cent);
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 11e98c970a0..c4616fc39c6 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -686,8 +686,9 @@ static void vgroup_duplicate(Object *ob)
dw_org = defvert_find_index(dv, idg);
if (dw_org) {
/* defvert_verify_index re-allocs org so need to store the weight first */
+ const float weight = dw_org->weight;
dw_cpy = defvert_verify_index(dv, icdg);
- dw_cpy->weight = dw_org->weight;
+ dw_cpy->weight = weight;
}
}
@@ -2826,7 +2827,7 @@ void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot)
}
/* creates the name_array parameter for vgroup_do_remap, call this before fiddling
- * with the order of vgroups then call vgroup_do_remap after*/
+ * with the order of vgroups then call vgroup_do_remap after */
static char *vgroup_init_remap(Object *ob)
{
bDeformGroup *def;
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index d6cf46363d3..72d2d67e081 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -4111,7 +4111,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
}
if (!ok) {
- BKE_object_minmax(ob, min, max);
+ BKE_object_minmax(ob, min, max, TRUE);
ok= 1;
}
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 621d06a7bd8..f95b07bd71e 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1068,14 +1068,15 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
fb->settings = fsset;
if (do_job) {
- wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS);
+ wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation",
+ WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_SIM_FLUID);
/* setup job */
- WM_jobs_customdata_set(steve, fb, fluidbake_free);
- WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME);
- WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, fluidbake_endjob);
+ WM_jobs_customdata_set(wm_job, fb, fluidbake_free);
+ WM_jobs_timer(wm_job, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME);
+ WM_jobs_callbacks(wm_job, fluidbake_startjob, NULL, NULL, fluidbake_endjob);
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
}
else {
short dummy_stop, dummy_do_update;
@@ -1112,7 +1113,7 @@ void fluidsimSettingsFree(FluidsimSettings *UNUSED(fss))
{
}
-FluidsimSettings* fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss))
+FluidsimSettings *fluidsimSettingsCopy(FluidsimSettings *UNUSED(fss))
{
return NULL;
}
@@ -1130,7 +1131,7 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object
static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
/* only one bake job at a time */
- if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_OBJECT_SIM_FLUID))
return OPERATOR_CANCELLED;
if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE))
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index ae1b82c6690..b236b555850 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -457,7 +457,7 @@ static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event)
Scene *scene = (Scene *) op->customdata;
/* no running blender, remove handler and pass through */
- if (0 == WM_jobs_test(CTX_wm_manager(C), scene)) {
+ if (0 == WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) {
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
}
@@ -479,7 +479,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
SceneRenderLayer *srl = NULL;
View3D *v3d = CTX_wm_view3d(C);
Render *re;
- wmJob *steve;
+ wmJob *wm_job;
RenderJob *rj;
Image *ima;
int jobflag;
@@ -489,7 +489,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
const char *name;
/* only one render job at a time */
- if (WM_jobs_test(CTX_wm_manager(C), scene))
+ if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
return OPERATOR_CANCELLED;
if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
@@ -564,10 +564,10 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
else name = "Render";
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
- WM_jobs_customdata_set(steve, rj, render_freejob);
- WM_jobs_timer(steve, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
- WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag, WM_JOB_TYPE_RENDER);
+ WM_jobs_customdata_set(wm_job, rj, render_freejob);
+ WM_jobs_timer(wm_job, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
+ WM_jobs_callbacks(wm_job, render_startjob, NULL, NULL, render_endjob);
/* get a render result image, and make sure it is empty */
ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
@@ -588,11 +588,11 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* store actual owner of job, so modal operator could check for it,
* the reason of this is that active scene could change when rendering
- * several layers from composistor [#31800]
+ * several layers from compositor [#31800]
*/
op->customdata = scene;
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
WM_cursor_wait(0);
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index d705799b1d8..55df1caf3eb 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -309,7 +309,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
}
/* only one render job at a time */
- if (WM_jobs_test(CTX_wm_manager(C), scene))
+ if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
return 0;
if (!is_view_context && scene->camera == NULL) {
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 03906c99c74..add2cbd566b 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -474,7 +474,9 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
RenderResult rres;
char name[32];
int do_gamma_correct = FALSE, do_predivide = FALSE;
- int offx = 0, newx = rect->xmax - rect->xmin, newy = rect->ymax - rect->ymin;
+ int offx = 0;
+ int newx = BLI_RCT_SIZE_X(rect);
+ int newy = BLI_RCT_SIZE_Y(rect);
if (id && GS(id->name) != ID_TE) {
/* exception: don't color manage texture previews - show the raw values */
@@ -547,7 +549,8 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
SpaceButs *sbuts = sa->spacedata.first;
rcti newrect;
int ok;
- int newx = rect->xmax - rect->xmin, newy = rect->ymax - rect->ymin;
+ int newx = BLI_RCT_SIZE_X(rect);
+ int newy = BLI_RCT_SIZE_Y(rect);
newrect.xmin = rect->xmin;
newrect.xmax = rect->xmin;
@@ -746,7 +749,6 @@ static void shader_preview_free(void *customdata)
if (sp->matcopy) {
struct IDProperty *properties;
- int a;
/* node previews */
shader_preview_updatejob(sp);
@@ -754,13 +756,7 @@ static void shader_preview_free(void *customdata)
/* get rid of copied material */
BLI_remlink(&pr_main->mat, sp->matcopy);
- /* BKE_material_free decrements texture, prevent this. hack alert! */
- for (a = 0; a < MAX_MTEX; a++) {
- MTex *mtex = sp->matcopy->mtex[a];
- if (mtex && mtex->tex) mtex->tex = NULL;
- }
-
- BKE_material_free(sp->matcopy);
+ BKE_material_free_ex(sp->matcopy, FALSE);
properties = IDP_GetProperties((ID *)sp->matcopy, FALSE);
if (properties) {
@@ -1022,16 +1018,17 @@ static void icon_preview_free(void *customdata)
void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *rect, int sizex, int sizey)
{
- wmJob *steve;
+ wmJob *wm_job;
IconPreview *ip, *old_ip;
/* suspended start means it starts after 1 timer step, see WM_jobs_timer below */
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview", WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview",
+ WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND, WM_JOB_TYPE_RENDER_PREVIEW);
ip = MEM_callocN(sizeof(IconPreview), "icon preview");
/* render all resolutions from suspended job too */
- old_ip = WM_jobs_customdata_get(steve);
+ old_ip = WM_jobs_customdata_get(wm_job);
if (old_ip)
BLI_movelisttolist(&ip->sizes, &old_ip->sizes);
@@ -1043,20 +1040,21 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
icon_preview_add_size(ip, rect, sizex, sizey);
/* setup job */
- WM_jobs_customdata_set(steve, ip, icon_preview_free);
- WM_jobs_timer(steve, 0.25, NC_MATERIAL, NC_MATERIAL);
- WM_jobs_callbacks(steve, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
+ WM_jobs_customdata_set(wm_job, ip, icon_preview_free);
+ WM_jobs_timer(wm_job, 0.25, NC_MATERIAL, NC_MATERIAL);
+ WM_jobs_callbacks(wm_job, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
}
void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, int method)
{
Object *ob = CTX_data_active_object(C);
- wmJob *steve;
+ wmJob *wm_job;
ShaderPreview *sp;
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview",
+ WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
/* customdata for preview thread */
@@ -1072,11 +1070,11 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
/* setup job */
- WM_jobs_customdata_set(steve, sp, shader_preview_free);
- WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
- WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
+ WM_jobs_customdata_set(wm_job, sp, shader_preview_free);
+ WM_jobs_timer(wm_job, 0.1, NC_MATERIAL, NC_MATERIAL);
+ WM_jobs_callbacks(wm_job, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
}
void ED_preview_kill_jobs(const struct bContext *C)
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 293af4357d4..0bfe5d04e5e 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -104,8 +104,8 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
void ED_region_pixelspace(ARegion *ar)
{
- int width = ar->winrct.xmax - ar->winrct.xmin + 1;
- int height = ar->winrct.ymax - ar->winrct.ymin + 1;
+ int width = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ int height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
wmOrtho2(-GLA_PIXEL_OFS, (float)width - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, (float)height - GLA_PIXEL_OFS);
glLoadIdentity();
@@ -161,7 +161,7 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
ys = (az->y1 + az->y2) / 2;
/* test if inside */
- if (BLI_in_rcti(&ar->winrct, xs, ys)) {
+ if (BLI_rcti_isect_pt(&ar->winrct, xs, ys)) {
az->do_draw = TRUE;
}
}
@@ -901,10 +901,10 @@ static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
static int rct_fits(rcti *rect, char dir, int size)
{
if (dir == 'h') {
- return rect->xmax - rect->xmin - size;
+ return BLI_RCT_SIZE_X(rect) - size;
}
- else { // 'v'
- return rect->ymax - rect->ymin - size;
+ else { /* 'v' */
+ return BLI_RCT_SIZE_Y(rect) - size;
}
}
@@ -1010,7 +1010,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
if (alignment == RGN_ALIGN_HSPLIT) {
if (rct_fits(remainder, 'h', prefsizex) > 4) {
- ar->winrct.xmax = (remainder->xmin + remainder->xmax) / 2;
+ ar->winrct.xmax = BLI_RCT_CENTER_X(remainder);
remainder->xmin = ar->winrct.xmax + 1;
}
else {
@@ -1019,7 +1019,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
}
else {
if (rct_fits(remainder, 'v', prefsizey) > 4) {
- ar->winrct.ymax = (remainder->ymin + remainder->ymax) / 2;
+ ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder);
remainder->ymin = ar->winrct.ymax + 1;
}
else {
@@ -1051,20 +1051,20 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
}
if (quad) {
if (quad == 1) { /* left bottom */
- ar->winrct.xmax = (remainder->xmin + remainder->xmax) / 2;
- ar->winrct.ymax = (remainder->ymin + remainder->ymax) / 2;
+ ar->winrct.xmax = BLI_RCT_CENTER_X(remainder);
+ ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder);
}
else if (quad == 2) { /* left top */
- ar->winrct.xmax = (remainder->xmin + remainder->xmax) / 2;
- ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax) / 2;
+ ar->winrct.xmax = BLI_RCT_CENTER_X(remainder);
+ ar->winrct.ymin = BLI_RCT_CENTER_Y(remainder) + 1;
}
else if (quad == 3) { /* right bottom */
- ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax) / 2;
- ar->winrct.ymax = (remainder->ymin + remainder->ymax) / 2;
+ ar->winrct.xmin = BLI_RCT_CENTER_X(remainder) + 1;
+ ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder);
}
else { /* right top */
- ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax) / 2;
- ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax) / 2;
+ ar->winrct.xmin = BLI_RCT_CENTER_X(remainder) + 1;
+ ar->winrct.ymin = BLI_RCT_CENTER_Y(remainder) + 1;
BLI_rcti_init(remainder, 0, 0, 0, 0);
}
@@ -1073,8 +1073,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
}
/* for speedup */
- ar->winx = ar->winrct.xmax - ar->winrct.xmin + 1;
- ar->winy = ar->winrct.ymax - ar->winrct.ymin + 1;
+ ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ ar->winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
/* set winrect for azones */
if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) {
@@ -1096,8 +1096,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
if (ar->alignment & RGN_SPLIT_PREV) {
if (ar->prev) {
remainder = remainder_prev;
- ar->prev->winx = ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
- ar->prev->winy = ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
+ ar->prev->winx = BLI_RCT_SIZE_X(&ar->prev->winrct) + 1;
+ ar->prev->winy = BLI_RCT_SIZE_Y(&ar->prev->winrct) + 1;
}
}
@@ -1133,8 +1133,8 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
else sa->totrct.ymax = sa->v2->vec.y;
/* for speedup */
- sa->winx = sa->totrct.xmax - sa->totrct.xmin + 1;
- sa->winy = sa->totrct.ymax - sa->totrct.ymin + 1;
+ sa->winx = BLI_RCT_SIZE_X(&sa->totrct) + 1;
+ sa->winy = BLI_RCT_SIZE_Y(&sa->totrct) + 1;
}
@@ -1268,8 +1268,8 @@ void ED_region_init(bContext *C, ARegion *ar)
/* refresh can be called before window opened */
region_subwindow(CTX_wm_window(C), ar);
- ar->winx = ar->winrct.xmax - ar->winrct.xmin + 1;
- ar->winy = ar->winrct.ymax - ar->winrct.ymin + 1;
+ ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ ar->winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
/* UI convention */
wmOrtho2(-0.01f, ar->winx - 0.01f, -0.01f, ar->winy - 0.01f);
@@ -1425,7 +1425,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
/* tell WM to refresh, cursor types etc */
WM_event_add_mousemove(C);
- /*send space change notifier*/
+ /* send space change notifier */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa);
ED_area_tag_refresh(sa);
@@ -1452,7 +1452,7 @@ void ED_area_prevspace(bContext *C, ScrArea *sa)
}
ED_area_tag_redraw(sa);
- /*send space change notifier*/
+ /* send space change notifier */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa);
}
@@ -1503,7 +1503,7 @@ static void spacefunc(struct bContext *C, void *UNUSED(arg1), void *UNUSED(arg2)
ED_area_newspace(C, CTX_wm_area(C), CTX_wm_area(C)->butspacetype);
ED_area_tag_redraw(CTX_wm_area(C));
- /*send space change notifier*/
+ /* send space change notifier */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, CTX_wm_area(C));
}
@@ -1574,7 +1574,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
newcontext = UI_view2d_tab_set(v2d, contextnr);
if (vertical) {
- w = v2d->cur.xmax - v2d->cur.xmin;
+ w = BLI_RCT_SIZE_X(&v2d->cur);
em = (ar->type->prefsizex) ? UI_UNIT_Y / 2 : UI_UNIT_Y;
}
else {
@@ -1769,7 +1769,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
}
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, ar->v2d.tot.ymax - ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_RCT_SIZE_Y(&ar->v2d.tot));
/* restore view matrix? */
UI_view2d_view_restore(C);
@@ -1798,16 +1798,16 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
/* background box */
rect = ar->winrct;
rect.xmin = 0;
- rect.ymin = ar->winrct.ymax - ar->winrct.ymin - header_height;
+ rect.ymin = BLI_RCT_SIZE_Y(&ar->winrct) - header_height;
if (block) {
- rect.xmax = ar->winrct.xmax - ar->winrct.xmin;
+ rect.xmax = BLI_RCT_SIZE_X(&ar->winrct);
}
else {
rect.xmax = rect.xmin + BLF_width(fontid, text) + 24;
}
- rect.ymax = ar->winrct.ymax - ar->winrct.ymin;
+ rect.ymax = BLI_RCT_SIZE_Y(&ar->winrct);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index a534124d2c0..967c6e85590 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -35,6 +35,7 @@
#include "DNA_vec_types.h"
+#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BKE_colortools.h"
@@ -668,8 +669,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
void glaDefine2DArea(rcti *screen_rect)
{
- int sc_w = screen_rect->xmax - screen_rect->xmin + 1;
- int sc_h = screen_rect->ymax - screen_rect->ymin + 1;
+ const int sc_w = BLI_RCT_SIZE_X(screen_rect) + 1;
+ const int sc_h = BLI_RCT_SIZE_Y(screen_rect) + 1;
glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
@@ -713,10 +714,10 @@ void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
di->world_rect = *rect;
- sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
- sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
- wo_w = (di->world_rect.xmax - di->world_rect.xmin);
- wo_h = (di->world_rect.ymax - di->world_rect.ymin);
+ sc_w = BLI_RCT_SIZE_X(&di->screen_rect);
+ sc_h = BLI_RCT_SIZE_Y(&di->screen_rect);
+ wo_w = BLI_RCT_SIZE_X(&di->world_rect);
+ wo_h = BLI_RCT_SIZE_Y(&di->world_rect);
di->wo_to_sc[0] = sc_w / wo_w;
di->wo_to_sc[1] = sc_h / wo_h;
@@ -744,10 +745,10 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
di->world_rect.ymax = di->screen_rect.ymax;
}
- sc_w = (di->screen_rect.xmax - di->screen_rect.xmin);
- sc_h = (di->screen_rect.ymax - di->screen_rect.ymin);
- wo_w = (di->world_rect.xmax - di->world_rect.xmin);
- wo_h = (di->world_rect.ymax - di->world_rect.ymin);
+ sc_w = BLI_RCT_SIZE_X(&di->screen_rect);
+ sc_h = BLI_RCT_SIZE_Y(&di->screen_rect);
+ wo_w = BLI_RCT_SIZE_X(&di->world_rect);
+ wo_h = BLI_RCT_SIZE_Y(&di->world_rect);
di->wo_to_sc[0] = sc_w / wo_w;
di->wo_to_sc[1] = sc_h / wo_h;
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index d1458fec94b..adffb97c16f 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1267,7 +1267,7 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
}
if (sa) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (BLI_in_rcti_v(&ar->winrct, &event->x))
+ if (BLI_rcti_isect_pt_v(&ar->winrct, &event->x))
scr->subwinactive = ar->swinid;
}
}
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e92f7b7a3c2..823037a7903 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -521,7 +521,7 @@ static ScrArea *screen_areahascursor(bScreen *scr, int x, int y)
ScrArea *sa = NULL;
sa = scr->areabase.first;
while (sa) {
- if (BLI_in_rcti(&sa->totrct, x, y)) break;
+ if (BLI_rcti_isect_pt(&sa->totrct, x, y)) break;
sa = sa->next;
}
@@ -540,7 +540,7 @@ static int actionzone_area_poll(bContext *C)
int y = win->eventstate->y;
for (az = sa->actionzones.first; az; az = az->next)
- if (BLI_in_rcti(&az->rect, x, y))
+ if (BLI_rcti_isect_pt(&az->rect, x, y))
return 1;
}
return 0;
@@ -551,7 +551,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2])
AZone *az = NULL;
for (az = sa->actionzones.first; az; az = az->next) {
- if (BLI_in_rcti_v(&az->rect, xy)) {
+ if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
if (az->type == AZONE_AREA) {
/* no triangle intersect but a hotspot circle based on corner */
int radius = (xy[0] - az->x1) * (xy[0] - az->x1) + (xy[1] - az->y1) * (xy[1] - az->y1);
@@ -1612,10 +1612,10 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
int dist;
if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) {
- dist = sa->totrct.xmax - sa->totrct.xmin;
+ dist = BLI_RCT_SIZE_X(&sa->totrct);
}
else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
- dist = sa->totrct.ymax - sa->totrct.ymin;
+ dist = BLI_RCT_SIZE_Y(&sa->totrct);
}
/* subtractwidth of regions on opposite side
@@ -2030,8 +2030,8 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
ot->poll = ED_operator_screenactive_norender;
ot->flag = OPTYPE_UNDO;
- /* rna */
- RNA_def_boolean(ot->srna, "next", 1, "Next Keyframe", "");
+ /* properties */
+ RNA_def_boolean(ot->srna, "next", TRUE, "Next Keyframe", "");
}
/* ************** switch screen operator ***************************** */
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 166a4943db0..4e71c49465f 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -149,14 +149,16 @@ static void screenshot_crop(ImBuf *ibuf, rcti crop)
{
unsigned int *to = ibuf->rect;
unsigned int *from = ibuf->rect + crop.ymin * ibuf->x + crop.xmin;
- int y, cropw = crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
+ int crop_x = BLI_RCT_SIZE_X(&crop);
+ int crop_y = BLI_RCT_SIZE_Y(&crop);
+ int y;
- if (cropw > 0 && croph > 0) {
- for (y = 0; y < croph; y++, to += cropw, from += ibuf->x)
- memmove(to, from, sizeof(unsigned int) * cropw);
+ if (crop_x > 0 && crop_y > 0) {
+ for (y = 0; y < crop_y; y++, to += crop_x, from += ibuf->x)
+ memmove(to, from, sizeof(unsigned int) * crop_x);
- ibuf->x = cropw;
- ibuf->y = croph;
+ ibuf->x = crop_x;
+ ibuf->y = crop_y;
}
}
@@ -396,7 +398,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
static int screencast_exec(bContext *C, wmOperator *op)
{
bScreen *screen = CTX_wm_screen(C);
- wmJob *steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0);
+ wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0, WM_JOB_TYPE_SCREENCAST);
ScreenshotJob *sj = MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
/* setup sj */
@@ -420,11 +422,11 @@ static int screencast_exec(bContext *C, wmOperator *op)
BKE_reports_init(&sj->reports, RPT_PRINT);
/* setup job */
- WM_jobs_customdata_set(steve, sj, screenshot_freejob);
- WM_jobs_timer(steve, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
- WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob, NULL);
+ WM_jobs_customdata_set(wm_job, sj, screenshot_freejob);
+ WM_jobs_timer(wm_job, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
+ WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, NULL);
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 7f51f54ee4b..8616d4e66eb 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -31,6 +31,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "DNA_brush_types.h"
@@ -440,8 +441,8 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
else {
quad.xmin = 0;
quad.ymin = 0;
- quad.xmax = vc->ar->winrct.xmax - vc->ar->winrct.xmin;
- quad.ymax = vc->ar->winrct.ymax - vc->ar->winrct.ymin;
+ quad.xmax = BLI_RCT_SIZE_X(&vc->ar->winrct);
+ quad.ymax = BLI_RCT_SIZE_Y(&vc->ar->winrct);
}
/* set quad color */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 76e4a75ea8b..953215b83aa 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -388,7 +388,11 @@ typedef struct UndoImageTile {
char idname[MAX_ID_NAME]; /* name instead of pointer*/
char ibufname[IB_FILENAME_SIZE];
- void *rect;
+ union {
+ float *fp;
+ unsigned int *uint;
+ void *pt;
+ } rect;
int x, y;
short source, use_float;
@@ -406,10 +410,10 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, int
tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (ibuf->rect_float) {
- SWAP(void *, tmpibuf->rect_float, tile->rect);
+ SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
}
else {
- SWAP(void *, tmpibuf->rect, tile->rect);
+ SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
if (restore)
@@ -428,7 +432,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
if (tile->use_float == use_float)
if (strcmp(tile->idname, ima->id.name) == 0 && strcmp(tile->ibufname, ibuf->name) == 0)
- return tile->rect;
+ return tile->rect.pt;
if (*tmpibuf == NULL)
*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat | IB_rect);
@@ -440,7 +444,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
- tile->rect = MEM_mapallocN(allocsize, "UndeImageTile.rect");
+ tile->rect.pt = MEM_mapallocN(allocsize, "UndeImageTile.rect");
BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
@@ -453,7 +457,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
BLI_addtail(lb, tile);
- return tile->rect;
+ return tile->rect.pt;
}
static void image_undo_restore(bContext *C, ListBase *lb)
@@ -517,7 +521,7 @@ static void image_undo_free(ListBase *lb)
UndoImageTile *tile;
for (tile = lb->first; tile; tile = tile->next)
- MEM_freeN(tile->rect);
+ MEM_freeN(tile->rect.pt);
}
/* get active image for face depending on old/new shading system */
@@ -1615,7 +1619,7 @@ static int line_clip_rect2f(
if (fabsf(l1[0] - l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
- if (BLI_in_rctf_v(rect, l1)) {
+ if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
return 1;
@@ -1643,7 +1647,7 @@ static int line_clip_rect2f(
}
if (fabsf(l1[1] - l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
- if (BLI_in_rctf_v(rect, l1)) {
+ if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
copy_v2_v2(l2_clip, l2);
return 1;
@@ -1667,12 +1671,12 @@ static int line_clip_rect2f(
/* Done with vertical lines */
/* are either of the points inside the rectangle ? */
- if (BLI_in_rctf_v(rect, l1)) {
+ if (BLI_rctf_isect_pt_v(rect, l1)) {
copy_v2_v2(l1_clip, l1);
ok1 = 1;
}
- if (BLI_in_rctf_v(rect, l2)) {
+ if (BLI_rctf_isect_pt_v(rect, l2)) {
copy_v2_v2(l2_clip, l2);
ok2 = 1;
}
@@ -1820,7 +1824,7 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
* this is even less work then an intersection test
*/
#if 0
- if (BLI_in_rctf_v(bucket_bounds, cent))
+ if (BLI_rctf_isect_pt_v(bucket_bounds, cent))
return 1;
#endif
@@ -1987,9 +1991,9 @@ static void project_bucket_clip_face(
float bucket_bounds_ss[4][2];
/* get the UV space bounding box */
- inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v1coSS);
- inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v2coSS) << 1;
- inside_bucket_flag |= BLI_in_rctf_v(bucket_bounds, v3coSS) << 2;
+ inside_bucket_flag |= BLI_rctf_isect_pt_v(bucket_bounds, v1coSS);
+ inside_bucket_flag |= BLI_rctf_isect_pt_v(bucket_bounds, v2coSS) << 1;
+ inside_bucket_flag |= BLI_rctf_isect_pt_v(bucket_bounds, v3coSS) << 2;
if (inside_bucket_flag == ISECT_ALL3) {
/* all screenspace points are inside the bucket bounding box, this means we don't need to clip and can simply return the UVs */
@@ -2057,7 +2061,7 @@ static void project_bucket_clip_face(
float v1_clipSS[2], v2_clipSS[2];
float w[3];
- /* calc center*/
+ /* calc center */
float cent[2] = {0.0f, 0.0f};
/*float up[2] = {0.0f, 1.0f};*/
int i;
@@ -2816,7 +2820,7 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
fidx = mf->v4 ? 3 : 2;
do {
v = ps->screenCoords[(*(&mf->v1 + fidx))];
- if (BLI_in_rctf_v(&bucket_bounds, v)) {
+ if (BLI_rctf_isect_pt_v(&bucket_bounds, v)) {
return 1;
}
} while (fidx--);
@@ -4545,15 +4549,15 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
/* temporarily add float rect for cloning */
if (s->canvas->rect_float && !s->clonecanvas->rect_float) {
- int profile = IB_PROFILE_NONE;
+ short profile = IB_PROFILE_NONE;
/* Don't want to color manage, but don't disturb existing profiles */
- SWAP(int, s->clonecanvas->profile, profile);
+ SWAP(short, s->clonecanvas->profile, profile);
IMB_float_from_rect(s->clonecanvas);
s->clonefreefloat = 1;
- SWAP(int, s->clonecanvas->profile, profile);
+ SWAP(short, s->clonecanvas->profile, profile);
}
else if (!s->canvas->rect_float && !s->clonecanvas->rect)
IMB_rect_from_float(s->clonecanvas);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 560174e73ae..104f727c603 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -624,7 +624,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
/* Sculpt mode */
keymap = WM_keymap_find(keyconf, "Sculpt", 0, 0);
- keymap->poll = sculpt_poll;
+ keymap->poll = sculpt_mode_poll;
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "mode", BRUSH_STROKE_NORMAL);
RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "mode", BRUSH_STROKE_INVERT);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index f327f67be33..c62dc687c73 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -32,6 +32,7 @@
* \ingroup edsculpt
*/
+#include <stddef.h>
#include "MEM_guardedalloc.h"
@@ -379,16 +380,12 @@ static void sculpt_undo_free(ListBase *lb)
SculptUndoNode *sculpt_undo_get_node(PBVHNode *node)
{
ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_MESH);
- SculptUndoNode *unode;
- if (!lb)
+ if (!lb) {
return NULL;
+ }
- for (unode = lb->first; unode; unode = unode->next)
- if (unode->node == node)
- return unode;
-
- return NULL;
+ return BLI_findptr(lb, node, offsetof(SculptUndoNode, node));
}
static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh,
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index edec57d9e93..878fd20b27e 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -89,7 +89,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
* start of list offset, and the second is as a correction for the scrollers.
*/
height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2));
- if (height > (v2d->mask.ymax - v2d->mask.ymin)) {
+ if (height > BLI_RCT_SIZE_Y(&v2d->mask)) {
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index dbde950188d..c95f1dba31d 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -365,13 +365,13 @@ static int actkeys_viewall(bContext *C, const short onlySel)
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel);
- extra = 0.1f * (v2d->cur.xmax - v2d->cur.xmin);
+ extra = 0.1f * BLI_RCT_SIZE_X(&v2d->cur);
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
/* set vertical range */
v2d->cur.ymax = 0.0f;
- v2d->cur.ymin = (float)-(v2d->mask.ymax - v2d->mask.ymin);
+ v2d->cur.ymin = (float)-BLI_RCT_SIZE_Y(&v2d->mask);
/* do View2D syncing */
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 6b61990d485..c9f765ac3db 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -309,7 +309,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
* - the frame-range select option is favored over the channel one (x over y), as frame-range one is often
* used for tweaking timing when "blocking", while channels is not that useful...
*/
- if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
+ if (BLI_RCT_SIZE_X(&rect) >= BLI_RCT_SIZE_Y(&rect))
mode = ACTKEYS_BORDERSEL_FRAMERANGE;
else
mode = ACTKEYS_BORDERSEL_CHANNELS;
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 199875fdc7b..4bcd4a933ed 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -148,7 +148,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
uiBlockEndAlign(block);
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), ar->v2d.tot.ymax - ar->v2d.tot.ymin);
+ UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), BLI_RCT_SIZE_Y(&ar->v2d.tot));
uiEndBlock(C, block);
uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index e561b2a9e79..e66faa88b93 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -41,6 +41,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
+#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
@@ -168,7 +169,7 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
scopes->track_preview_height =
(scopes->track_preview_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->track_preview_height;
- uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin,
+ uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect),
scopes->track_preview_height, scopes, 0, 0, 0, 0, "");
}
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index 83d895067cc..5d890155e25 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -44,6 +44,7 @@
#include "BLI_string.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "ED_screen.h"
#include "ED_clip.h"
@@ -273,7 +274,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
dopesheet = &tracking->dopesheet;
height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2);
- if (height > (v2d->mask.ymax - v2d->mask.ymin)) {
+ if (height > BLI_RCT_SIZE_Y(&v2d->mask)) {
/* don't use totrect set, as the width stays the same
* (NOTE: this is ok here, the configuration is pretty straightforward)
*/
diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c
index 6d1610f3f91..09f6271b6ef 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_ops.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c
@@ -157,7 +157,7 @@ void CLIP_OT_dopesheet_select_channel(wmOperatorType *ot)
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
- "Location", "Mouse location to select channel", -100.0f, 100.0f);
+ "Location", "Mouse location to select channel", -100.0f, 100.0f);
RNA_def_boolean(ot->srna, "extend", 0,
- "Extend", "Extend selection rather than clearing the existing selection");
+ "Extend", "Extend selection rather than clearing the existing selection");
}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index c24cdab29e5..2353f8f8c12 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -958,12 +958,12 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
static void view2d_to_region_float(View2D *v2d, float x, float y, float *regionx, float *regiony)
{
/* express given coordinates as proportional values */
- x = -v2d->cur.xmin / (v2d->cur.xmax - v2d->cur.xmin);
- y = -v2d->cur.ymin / (v2d->cur.ymax - v2d->cur.ymin);
+ x = -v2d->cur.xmin / BLI_RCT_SIZE_X(&v2d->cur);
+ y = -v2d->cur.ymin / BLI_RCT_SIZE_Y(&v2d->cur);
/* convert proportional distances to screen coordinates */
- *regionx = v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin);
- *regiony = v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin);
+ *regionx = v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask);
+ *regiony = v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask);
}
static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 5e4ef1aa24a..7a54a39ee48 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -44,6 +44,7 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "GPU_extensions.h"
@@ -148,8 +149,8 @@ void ED_space_clip_get_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoo
ED_space_clip_get_size(sc, &width, &height);
- *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
- *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
+ *zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur) * width);
+ *zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur) * height);
}
void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
@@ -247,6 +248,54 @@ ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale
return NULL;
}
+/* returns color in SRGB */
+/* matching ED_space_image_color_sample() */
+int ED_space_clip_color_sample(SpaceClip *sc, ARegion *ar, int mval[2], float r_col[3])
+{
+ ImBuf *ibuf;
+ float fx, fy, co[2];
+ int ret = FALSE;
+
+ ibuf = ED_space_clip_get_buffer(sc);
+ if (!ibuf) {
+ return FALSE;
+ }
+
+ /* map the mouse coords to the backdrop image space */
+ ED_clip_mouse_pos(sc, ar, mval, co);
+
+ fx = co[0];
+ fy = co[1];
+
+ if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
+ float *fp;
+ unsigned char *cp;
+ int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
+
+ CLAMP(x, 0, ibuf->x - 1);
+ CLAMP(y, 0, ibuf->y - 1);
+
+ if (ibuf->rect_float) {
+ fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
+ /* IB_PROFILE_NONE is default but infact its linear */
+ if (ELEM(ibuf->profile, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE)) {
+ linearrgb_to_srgb_v3_v3(r_col, fp);
+ }
+ else {
+ copy_v3_v3(r_col, fp);
+ }
+ ret = TRUE;
+ }
+ else if (ibuf->rect) {
+ cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+ rgb_uchar_to_float(r_col, cp);
+ ret = TRUE;
+ }
+ }
+
+ return ret;
+}
+
void ED_clip_update_frame(const Main *mainp, int cfra)
{
wmWindowManager *wm;
@@ -345,8 +394,8 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit)
ED_space_clip_get_aspect(sc, &aspx, &aspy);
- width = ar->winrct.xmax - ar->winrct.xmin + 1;
- height = ar->winrct.ymax - ar->winrct.ymin + 1;
+ width = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
zoomx = (float)width / w / aspx;
zoomy = (float)height / h / aspy;
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index a2cb812d51c..71dcd326887 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -321,7 +321,7 @@ static void border_select_cb(void *userdata, MovieTrackingTrack *UNUSED(track),
{
BorderSelectuserData *data = (BorderSelectuserData *) userdata;
- if (BLI_in_rctf(&data->rect, scene_framenr, val)) {
+ if (BLI_rctf_isect_pt(&data->rect, scene_framenr, val)) {
int flag = 0;
if (coord == 0)
@@ -580,11 +580,11 @@ static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
}
/* we need an extra "buffer" factor on either side so that the endpoints are visible */
- extra = 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
+ extra = 0.01f * BLI_RCT_SIZE_X(&v2d->cur);
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
- extra = 0.01f * (v2d->cur.ymax - v2d->cur.ymin);
+ extra = 0.01f * BLI_RCT_SIZE_Y(&v2d->cur);
v2d->cur.ymin -= extra;
v2d->cur.ymax += extra;
@@ -610,7 +610,7 @@ void CLIP_OT_graph_view_all(wmOperatorType *ot)
void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar)
{
View2D *v2d = &ar->v2d;
- float extra = (v2d->cur.xmax - v2d->cur.xmin) / 2.0f;
+ float extra = BLI_RCT_SIZE_X(&v2d->cur) / 2.0f;
/* set extents of view to start/end frames */
v2d->cur.xmin = (float)CFRA - extra;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 9b4f3fcdd68..aa2cadbd2d3 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -39,6 +39,7 @@
#include "BLI_path_util.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -89,9 +90,9 @@ static void sclip_zoom_set(const bContext *C, float zoom, float location[2])
if ((width < 4) && (height < 4))
sc->zoom = oldzoom;
- else if ((ar->winrct.xmax - ar->winrct.xmin) <= sc->zoom)
+ else if (BLI_RCT_SIZE_X(&ar->winrct) <= sc->zoom)
sc->zoom = oldzoom;
- else if ((ar->winrct.ymax - ar->winrct.ymin) <= sc->zoom)
+ else if (BLI_RCT_SIZE_Y(&ar->winrct) <= sc->zoom)
sc->zoom = oldzoom;
}
@@ -455,7 +456,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot)
/* properties */
RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
- "Offset", "Offset in floating point units, 1.0 is the width and height of the image", -FLT_MAX, FLT_MAX);
+ "Offset", "Offset in floating point units, 1.0 is the width and height of the image", -FLT_MAX, FLT_MAX);
}
/********************** view zoom operator *********************/
@@ -579,7 +580,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
/* properties */
RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
- "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
+ "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
}
/********************** view zoom in/out operator *********************/
@@ -700,7 +701,7 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
/* properties */
RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
- "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
+ "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
}
/********************** view all operator *********************/
@@ -725,8 +726,8 @@ static int view_all_exec(bContext *C, wmOperator *op)
h = h * aspy;
/* check if the image will fit in the image with zoom == 1 */
- width = ar->winrct.xmax - ar->winrct.xmin + 1;
- height = ar->winrct.ymax - ar->winrct.ymin + 1;
+ width = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
if (fit_view) {
const int margin = 5; /* margin from border */
@@ -1031,7 +1032,7 @@ static void proxy_endjob(void *pjv)
static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
{
- wmJob * steve;
+ wmJob *wm_job;
ProxyJob *pj;
Scene *scene = CTX_data_scene(C);
ScrArea *sa = CTX_wm_area(C);
@@ -1041,7 +1042,8 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
if ((clip->flag & MCLIP_USE_PROXY) == 0)
return OPERATOR_CANCELLED;
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies",
+ WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_BUILD_PROXY);
pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
pj->scene = scene;
@@ -1054,12 +1056,12 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
clip->proxy.build_size_flag, clip->proxy.quality);
}
- WM_jobs_customdata_set(steve, pj, proxy_freejob);
- WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
- WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
+ WM_jobs_customdata_set(wm_job, pj, proxy_freejob);
+ WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
+ WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob);
G.is_break = FALSE;
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
ED_area_tag_redraw(CTX_wm_area(C));
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index bf65429b9f4..bb06104d442 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1036,8 +1036,8 @@ static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
if (clip)
h *= clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
- winx = ar->winrct.xmax - ar->winrct.xmin + 1;
- winy = ar->winrct.ymax - ar->winrct.ymin + 1;
+ winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
ar->v2d.tot.xmin = 0;
ar->v2d.tot.ymin = 0;
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index bf0a6617e2b..97f7d7bf132 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -42,7 +42,6 @@
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rect.h"
-#include "BLI_lasso.h"
#include "BLI_blenlib.h"
#include "BKE_main.h"
@@ -1235,11 +1234,11 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
ScrArea *sa = CTX_wm_area(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- wmJob *steve;
+ wmJob *wm_job;
int backwards = RNA_boolean_get(op->ptr, "backwards");
int sequence = RNA_boolean_get(op->ptr, "sequence");
- if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
/* only one tracking is allowed at a time */
return OPERATOR_CANCELLED;
}
@@ -1261,23 +1260,24 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
}
/* setup job */
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers", WM_JOB_PROGRESS);
- WM_jobs_customdata_set(steve, tmj, track_markers_freejob);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers",
+ WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_TRACK_MARKERS);
+ WM_jobs_customdata_set(wm_job, tmj, track_markers_freejob);
/* if there's delay set in tracking job, tracking should happen
* with fixed FPS. To deal with editor refresh we have to synchronize
* tracks from job and tracks in clip. Do this in timer callback
* to prevent threading conflicts. */
if (tmj->delay > 0)
- WM_jobs_timer(steve, tmj->delay / 1000.0f, NC_MOVIECLIP | NA_EVALUATED, 0);
+ WM_jobs_timer(wm_job, tmj->delay / 1000.0f, NC_MOVIECLIP | NA_EVALUATED, 0);
else
- WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | NA_EVALUATED, 0);
+ WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | NA_EVALUATED, 0);
- WM_jobs_callbacks(steve, track_markers_startjob, NULL, track_markers_updatejob, NULL);
+ WM_jobs_callbacks(wm_job, track_markers_startjob, NULL, track_markers_updatejob, NULL);
G.is_break = FALSE;
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
WM_cursor_wait(0);
/* add modal handler for ESC */
@@ -1289,7 +1289,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running tracking, remove handler and pass through */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY))
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
/* running tracking */
@@ -1467,10 +1467,10 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(tracking);
- wmJob *steve;
+ wmJob *wm_job;
char error_msg[256] = "\0";
- if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
/* only one solve is allowed at a time */
return OPERATOR_CANCELLED;
}
@@ -1492,14 +1492,15 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
/* setup job */
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
- WM_jobs_customdata_set(steve, scj, solve_camera_freejob);
- WM_jobs_timer(steve, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0);
- WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera",
+ WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_SOLVE_CAMERA);
+ WM_jobs_customdata_set(wm_job, scj, solve_camera_freejob);
+ WM_jobs_timer(wm_job, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0);
+ WM_jobs_callbacks(wm_job, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
G.is_break = FALSE;
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
WM_cursor_wait(0);
/* add modal handler for ESC */
@@ -1511,7 +1512,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running solver, remove handler and pass through */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+ if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY))
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
/* running tracking */
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index 5a79e832ebe..507e492497d 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -363,7 +363,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
if (MARKER_VISIBLE(sc, track, marker)) {
- if (BLI_in_rctf_v(&rectf, marker->pos)) {
+ if (BLI_rctf_isect_pt_v(&rectf, marker->pos)) {
if (mode == GESTURE_MODAL_SELECT)
BKE_tracking_track_flag_set(track, TRACK_AREA_ALL, SELECT);
else
@@ -441,7 +441,7 @@ static int do_lasso_select_marker(bContext *C, int mcords[][2], short moves, sho
/* marker in screen coords */
ED_clip_point_stable_pos__reverse(sc, ar, marker->pos, screen_co);
- if (BLI_in_rcti(&rect, screen_co[0], screen_co[1]) &&
+ if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], V2D_IS_CLIPPED))
{
if (select)
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 460b31d69bd..a4f7e30ed7b 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -142,7 +142,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
/* always keep the bottom part of the view aligned, less annoying */
if (prev_y_min != ar->v2d.cur.ymin) {
- const float cur_y_range = ar->v2d.cur.ymax - ar->v2d.cur.ymin;
+ const float cur_y_range = BLI_RCT_SIZE_Y(&ar->v2d.cur);
ar->v2d.cur.ymin = prev_y_min;
ar->v2d.cur.ymax = prev_y_min + cur_y_range;
}
@@ -326,6 +326,7 @@ static void console_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CONSOLE_OT_autocomplete", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* python operator - space_text.py */
#endif
+ WM_keymap_add_item(keymap, "CONSOLE_OT_copy_as_script", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CONSOLE_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CONSOLE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 01962853556..ff7a71af8c2 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -327,7 +327,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
rect.xmin = rect.xmax = event->mval[0];
rect.ymin = rect.ymax = event->mval[1];
- if (!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
+ if (!BLI_rcti_isect_pt(&ar->v2d.mask, rect.xmin, rect.ymin))
return OPERATOR_CANCELLED;
/* single select, deselect all selected first */
@@ -525,7 +525,7 @@ int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
mx -= ar->winrct.xmin;
my -= ar->winrct.ymin;
- if (BLI_in_rcti(&ar->v2d.mask, mx, my)) {
+ if (BLI_rcti_isect_pt(&ar->v2d.mask, mx, my)) {
float fx, fy;
int active_file;
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 27db7907e30..337e13f7785 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1346,7 +1346,7 @@ static void thumbnails_free(void *tjv)
void thumbnails_start(struct FileList *filelist, const struct bContext *C)
{
- wmJob *steve;
+ wmJob *wm_job;
ThumbnailJob *tj;
int idx;
@@ -1368,13 +1368,14 @@ 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);
- WM_jobs_customdata_set(steve, tj, thumbnails_free);
- WM_jobs_timer(steve, 0.5, NC_WINDOW, NC_WINDOW);
- WM_jobs_callbacks(steve, thumbnails_startjob, NULL, thumbnails_update, NULL);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails",
+ 0, WM_JOB_TYPE_FILESEL_THUMBNAIL);
+ WM_jobs_customdata_set(wm_job, tj, thumbnails_free);
+ WM_jobs_timer(wm_job, 0.5, NC_WINDOW, NC_WINDOW);
+ WM_jobs_callbacks(wm_job, thumbnails_startjob, NULL, thumbnails_update, NULL);
/* start the job */
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
}
void thumbnails_stop(struct FileList *filelist, const struct bContext *C)
@@ -1384,5 +1385,5 @@ void thumbnails_stop(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);
+ return WM_jobs_test(CTX_wm_manager(C), filelist, WM_JOB_TYPE_FILESEL_THUMBNAIL);
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 34f16c11537..09231efd367 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -270,12 +270,12 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, 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)(BLI_RCT_SIZE_X(&ar->v2d.cur) - 2 * layout->tile_border_x);
numfiles = (int)((float)width / (float)layout->tile_w + 0.5f);
return numfiles * layout->rows;
}
else {
- int height = (int)(ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2 * layout->tile_border_y);
+ int height = (int)(BLI_RCT_SIZE_Y(&ar->v2d.cur) - 2 * layout->tile_border_y);
numfiles = (int)((float)height / (float)layout->tile_h + 0.5f);
return numfiles * layout->columns;
}
@@ -503,7 +503,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
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->width = (int)(BLI_RCT_SIZE_X(&v2d->cur) - 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
@@ -522,7 +522,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar)
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->height = (int)(BLI_RCT_SIZE_Y(&v2d->cur) - 2 * layout->tile_border_y);
layout->rows = layout->height / (layout->tile_h + 2 * layout->tile_border_y);
column_widths(sfile->files, layout);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 17669dfa8f9..fcf6f28b406 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -252,7 +252,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
static void file_listener(ScrArea *sa, wmNotifier *wmn)
{
- /* SpaceFile* sfile = (SpaceFile*)sa->spacedata.first; */
+ /* SpaceFile *sfile = (SpaceFile*)sa->spacedata.first; */
/* context changes */
switch (wmn->category) {
@@ -525,7 +525,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* scrolling here is just annoying, disable it */
- ar->v2d.cur.ymax = ar->v2d.cur.ymax - ar->v2d.cur.ymin;
+ ar->v2d.cur.ymax = BLI_RCT_SIZE_Y(&ar->v2d.cur);
ar->v2d.cur.ymin = 0;
/* set view2d view matrix for scrolling (without scrollers) */
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 870e9bb8168..ad97b7853c4 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -88,7 +88,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
{
FMod_Envelope *env = (FMod_Envelope *)fcm->data;
FCM_EnvelopeData *fed;
- const float fac = 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
+ const float fac = 0.05f * BLI_RCT_SIZE_X(&v2d->cur);
int i;
/* draw two black lines showing the standard reference levels */
@@ -137,7 +137,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel)
{
BezTriple *bezt = fcu->bezt;
- const float fac = 0.05f * (v2d->cur.xmax - v2d->cur.xmin);
+ const float fac = 0.05f * BLI_RCT_SIZE_X(&v2d->cur);
int i;
/* we use bgl points not standard gl points, to workaround vertex
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 8a0538eddb0..f01d64b46b8 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -86,6 +86,8 @@
void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax,
const short do_sel_only, const short include_handles)
{
+ Scene *scene = ac->scene;
+
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
@@ -94,7 +96,7 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_NODUPLIS);
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
- /* set large values to try to override */
+ /* set large values initial values that will be easy to override */
if (xmin) *xmin = 999999999.0f;
if (xmax) *xmax = -999999999.0f;
if (ymin) *ymin = 999999999.0f;
@@ -102,6 +104,8 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
/* check if any channels to set range with */
if (anim_data.first) {
+ short foundBounds = FALSE;
+
/* go through channels, finding max extents */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
@@ -110,29 +114,39 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
float unitFac;
/* get range */
- calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles);
-
- /* apply NLA scaling */
- if (adt) {
- txmin = BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP);
- txmax = BKE_nla_tweakedit_remap(adt, txmax, NLATIME_CONVERT_MAP);
+ if (calc_fcurve_bounds(fcu, &txmin, &txmax, &tymin, &tymax, do_sel_only, include_handles)) {
+ /* apply NLA scaling */
+ if (adt) {
+ txmin = BKE_nla_tweakedit_remap(adt, txmin, NLATIME_CONVERT_MAP);
+ txmax = BKE_nla_tweakedit_remap(adt, txmax, NLATIME_CONVERT_MAP);
+ }
+
+ /* apply unit corrections */
+ unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
+ tymin *= unitFac;
+ tymax *= unitFac;
+
+ /* try to set cur using these values, if they're more extreme than previously set values */
+ if ((xmin) && (txmin < *xmin)) *xmin = txmin;
+ if ((xmax) && (txmax > *xmax)) *xmax = txmax;
+ if ((ymin) && (tymin < *ymin)) *ymin = tymin;
+ if ((ymax) && (tymax > *ymax)) *ymax = tymax;
+
+ foundBounds = TRUE;
}
-
- /* apply unit corrections */
- unitFac = ANIM_unit_mapping_get_factor(ac->scene, ale->id, fcu, 0);
- tymin *= unitFac;
- tymax *= unitFac;
-
- /* try to set cur using these values, if they're more extreme than previously set values */
- if ((xmin) && (txmin < *xmin)) *xmin = txmin;
- if ((xmax) && (txmax > *xmax)) *xmax = txmax;
- if ((ymin) && (tymin < *ymin)) *ymin = tymin;
- if ((ymax) && (tymax > *ymax)) *ymax = tymax;
}
/* ensure that the extents are not too extreme that view implodes...*/
- if ((xmin && xmax) && (fabsf(*xmax - *xmin) < 0.1f)) *xmax += 0.1f;
- if ((ymin && ymax) && (fabsf(*ymax - *ymin) < 0.1f)) *ymax += 0.1f;
+ if (foundBounds) {
+ if ((xmin && xmax) && (fabsf(*xmax - *xmin) < 0.1f)) *xmax += 0.1f;
+ if ((ymin && ymax) && (fabsf(*ymax - *ymin) < 0.1f)) *ymax += 0.1f;
+ }
+ else {
+ if (xmin) *xmin = (float)PSFRA;
+ if (xmax) *xmax = (float)PEFRA;
+ if (ymin) *ymin = -5;
+ if (ymax) *ymax = 5;
+ }
/* free memory */
BLI_freelistN(&anim_data);
@@ -140,8 +154,8 @@ void get_graph_keyframe_extents(bAnimContext *ac, float *xmin, float *xmax, floa
else {
/* set default range */
if (ac->scene) {
- if (xmin) *xmin = (float)ac->scene->r.sfra;
- if (xmax) *xmax = (float)ac->scene->r.efra;
+ if (xmin) *xmin = (float)PSFRA;
+ if (xmax) *xmax = (float)PEFRA;
}
else {
if (xmin) *xmin = -5;
@@ -210,16 +224,16 @@ static int graphkeys_viewall(bContext *C, const short do_sel_only, const short i
return OPERATOR_CANCELLED;
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
- get_graph_keyframe_extents(&ac,
- &cur_new.xmin, &cur_new.xmax,
- &cur_new.ymin, &cur_new.ymax,
- do_sel_only, include_handles);
+ get_graph_keyframe_extents(&ac,
+ &cur_new.xmin, &cur_new.xmax,
+ &cur_new.ymin, &cur_new.ymax,
+ do_sel_only, include_handles);
- extra = 0.1f * (cur_new.xmax - cur_new.xmin);
+ extra = 0.1f * BLI_RCT_SIZE_X(&cur_new);
cur_new.xmin -= extra;
cur_new.xmax += extra;
- extra = 0.1f * (cur_new.ymax - cur_new.ymin);
+ extra = 0.1f * BLI_RCT_SIZE_Y(&cur_new);
cur_new.ymin -= extra;
cur_new.ymax += extra;
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 781099f6a68..32abad86828 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -325,7 +325,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
* - the frame-range select option is favored over the channel one (x over y), as frame-range one is often
* used for tweaking timing when "blocking", while channels is not that useful...
*/
- if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
+ if ((BLI_RCT_SIZE_X(&rect)) >= (BLI_RCT_SIZE_Y(&rect)))
mode = BEZT_OK_FRAMERANGE;
else
mode = BEZT_OK_VALUERANGE;
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 51bd4e16d06..40f0683a852 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -268,13 +268,13 @@ static void preview_cb(ScrArea *sa, struct uiBlock *block)
int mval[2];
if (G.scene->r.mode & R_BORDER) {
- winx *= (G.scene->r.border.xmax - G.scene->r.border.xmin);
- winy *= (G.scene->r.border.ymax - G.scene->r.border.ymin);
+ winx *= BLI_RCT_SIZE_X(&G.scene->r.border);
+ winy *= BLI_RCT_SIZE_Y(&G.scene->r.border);
}
/* while dragging we need to update the rects, otherwise it doesn't end with correct one */
- BLI_rctf_init(&dispf, 15.0f, (block->maxx - block->minx) - 15.0f, 15.0f, (block->maxy - block->miny) - 15.0f);
+ BLI_rctf_init(&dispf, 15.0f, BLI_RCT_SIZE_X(&block->rect) - 15.0f, 15.0f, (BLI_RCT_SIZE_Y(&block->rect)) - 15.0f);
ui_graphics_to_window_rct(sa->win, &dispf, disprect);
/* correction for gla draw */
@@ -681,10 +681,12 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
}
else if (ima->type == IMA_TYPE_R_RESULT) {
/* browse layer/passes */
- Render *re = RE_GetRender(scene->id.name);
- RenderResult *rr = RE_AcquireResultRead(re);
+ RenderResult *rr;
+
+ /* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
+ rr = BKE_image_acquire_renderresult(scene, ima);
uiblock_layer_pass_arrow_buttons(layout, rr, iuser, &ima->render_slot);
- RE_ReleaseResult(re);
+ BKE_image_release_renderresult(scene, ima);
}
}
else {
@@ -867,16 +869,16 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
{
Scene *scene = CTX_data_scene(C);
- Render *re;
- RenderResult *rr;
/* render layers and passes */
if (ima && iuser) {
const float dpi_fac = UI_DPI_FAC;
- re = RE_GetRender(scene->id.name);
- rr = RE_AcquireResultRead(re);
+ RenderResult *rr;
+
+ /* use BKE_image_acquire_renderresult so we get the correct slot in the menu */
+ rr = BKE_image_acquire_renderresult(scene, ima);
uiblock_layer_pass_buttons(layout, rr, iuser, 160 * dpi_fac, (ima->type == IMA_TYPE_R_RESULT) ? &ima->render_slot : NULL);
- RE_ReleaseResult(re);
+ BKE_image_release_renderresult(scene, ima);
}
}
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 52ed7fd1d0b..e293264c021 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -44,6 +44,7 @@
#include "PIL_time.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "BLI_threads.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
@@ -135,7 +136,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
/* noisy, high contrast make impossible to read if lower alpha is used. */
glColor4ub(0, 0, 0, 190);
- glRecti(0.0, 0.0, ar->winrct.xmax - ar->winrct.xmin + 1, 20);
+ glRecti(0.0, 0.0, BLI_RCT_SIZE_X(&ar->winrct) + 1, 20);
glDisable(GL_BLEND);
BLF_size(blf_mono_font, 11, 72);
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index 58e6a1aa94a..ac9883b411d 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -24,7 +24,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_image/image_editor.c
+/** \file blender/editors/space_image/image_edit.c
* \ingroup spimage
*/
@@ -33,6 +33,7 @@
#include "DNA_scene_types.h"
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -181,8 +182,8 @@ void ED_space_image_get_size(SpaceImage *sima, int *width, int *height)
*height = (scene->r.ysch * scene->r.size) / 100;
if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
- *width *= (scene->r.border.xmax - scene->r.border.xmin);
- *height *= (scene->r.border.ymax - scene->r.border.ymin);
+ *width *= BLI_RCT_SIZE_X(&scene->r.border);
+ *height *= BLI_RCT_SIZE_Y(&scene->r.border);
}
}
@@ -229,8 +230,8 @@ void ED_space_image_get_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float
ED_space_image_get_size(sima, &width, &height);
- *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
- *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
+ *zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur) * width);
+ *zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur) * height);
}
void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index b2a9584b243..3d6b316b743 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -98,9 +98,9 @@ static void sima_zoom_set(SpaceImage *sima, ARegion *ar, float zoom, float locat
if ((width < 4) && (height < 4))
sima->zoom = oldzoom;
- else if ((ar->winrct.xmax - ar->winrct.xmin) <= sima->zoom)
+ else if (BLI_RCT_SIZE_X(&ar->winrct) <= sima->zoom)
sima->zoom = oldzoom;
- else if ((ar->winrct.ymax - ar->winrct.ymin) <= sima->zoom)
+ else if (BLI_RCT_SIZE_Y(&ar->winrct) <= sima->zoom)
sima->zoom = oldzoom;
}
@@ -581,8 +581,8 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
h = height * aspy;
/* check if the image will fit in the image with (zoom == 1) */
- width = ar->winrct.xmax - ar->winrct.xmin + 1;
- height = ar->winrct.ymax - ar->winrct.ymin + 1;
+ width = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ height = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
if ((w >= width || h >= height) && (width > 0 && height > 0)) {
/* find the zoom value that will fit the image in the image space */
@@ -1948,6 +1948,52 @@ static void image_sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_
}
}
+/* returns color in SRGB */
+/* matching ED_space_node_color_sample() */
+int ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], float r_col[3])
+{
+ void *lock;
+ ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+ float fx, fy;
+ int ret = FALSE;
+
+ if (ibuf == NULL) {
+ ED_space_image_release_buffer(sima, lock);
+ return FALSE;
+ }
+
+ UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &fx, &fy);
+
+ if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
+ float *fp;
+ unsigned char *cp;
+ int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
+
+ CLAMP(x, 0, ibuf->x - 1);
+ CLAMP(y, 0, ibuf->y - 1);
+
+ if (ibuf->rect_float) {
+ fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
+
+ if (ELEM(ibuf->profile, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE)) {
+ linearrgb_to_srgb_v3_v3(r_col, fp);
+ }
+ else {
+ copy_v3_v3(r_col, fp);
+ }
+ ret = TRUE;
+ }
+ else if (ibuf->rect) {
+ cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+ rgb_uchar_to_float(r_col, cp);
+ ret = TRUE;
+ }
+ }
+
+ ED_space_image_release_buffer(sima, lock);
+ return ret;
+}
+
static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceImage *sima = CTX_wm_space_image(C);
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index cc8940201e2..d2639edb276 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -42,6 +42,7 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_image.h"
+#include "BKE_global.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_tessmesh.h"
@@ -373,7 +374,10 @@ static void image_refresh(const bContext *C, ScrArea *sa)
/* check if we have to set the image from the editmesh */
if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) {
- if (sima->lock) {
+ if (sima->lock == FALSE && G.moving) {
+ /* pass */
+ }
+ else {
if (scene->nodetree) {
Mask *mask = ED_space_image_get_mask(sima);
if (mask) {
@@ -556,8 +560,8 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
if (ima)
h *= ima->aspy / ima->aspx;
- winx = ar->winrct.xmax - ar->winrct.xmin + 1;
- winy = ar->winrct.ymax - ar->winrct.ymin + 1;
+ winx = BLI_RCT_SIZE_X(&ar->winrct) + 1;
+ winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1;
ar->v2d.tot.xmin = 0;
ar->v2d.tot.ymin = 0;
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index 1595889f596..abffb955405 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -84,10 +84,10 @@ static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot)
int i, b;
rcti rectlink;
- rectlink.xmin = (int) (line->from->x1 + line->from->x2) / 2;
- rectlink.ymin = (int) (line->from->y1 + line->from->y2) / 2;
- rectlink.xmax = (int) (line->to->x1 + line->to->x2) / 2;
- rectlink.ymax = (int) (line->to->y1 + line->to->y2) / 2;
+ rectlink.xmin = (int)BLI_RCT_CENTER_X(&line->from->rect);
+ rectlink.ymin = (int)BLI_RCT_CENTER_Y(&line->from->rect);
+ rectlink.xmax = (int)BLI_RCT_CENTER_X(&line->to->rect);
+ rectlink.ymax = (int)BLI_RCT_CENTER_Y(&line->to->rect);
if (ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)) {
for (i=0; i<tot-1; i++)
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 915e5c20e99..08e0934e8ae 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -109,7 +109,7 @@ static int vergname(const void *v1, const void *v2)
x1= (char **)v1;
x2= (char **)v2;
- return strcmp(*x1, *x2);
+ return BLI_natstrcmp(*x1, *x2);
}
void make_unique_prop_names(bContext *C, char *str)
@@ -724,25 +724,25 @@ static const char *actuator_name(int type)
static const char *actuator_pup(Object *owner)
{
switch (owner->type) {
- case OB_ARMATURE:
- return "Actuators %t|Action %x15|Armature %x23|Motion %x0|Constraint %x9|Ipo %x1"
- "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
- "|Scene %x11|Random %x13|Message %x14|Game %x17"
- "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
- break;
+ case OB_ARMATURE:
+ return ("Actuators %t|Action %x15|Armature %x23|Motion %x0|Constraint %x9|Ipo %x1"
+ "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
+ "|Scene %x11|Random %x13|Message %x14|Game %x17"
+ "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22");
+ break;
- case OB_MESH:
- return "Actuators %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1"
- "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
- "|Scene %x11|Random %x13|Message %x14|Game %x17"
- "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
- break;
+ case OB_MESH:
+ return ("Actuators %t|Shape Action %x21|Motion %x0|Constraint %x9|Ipo %x1"
+ "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
+ "|Scene %x11|Random %x13|Message %x14|Game %x17"
+ "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22");
+ break;
- default:
- return "Actuators %t|Motion %x0|Constraint %x9|Ipo %x1"
- "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
- "|Scene %x11|Random %x13|Message %x14|Game %x17"
- "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22";
+ default:
+ return ("Actuators %t|Motion %x0|Constraint %x9|Ipo %x1"
+ "|Camera %x3|Sound %x5|Property %x6|Edit Object %x10"
+ "|Scene %x11|Random %x13|Message %x14|Game %x17"
+ "|Visibility %x18|2D Filter %x19|Parent %x20|State %x22");
}
}
diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c
index 1caf1075ae6..1a50f72153a 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -302,48 +302,48 @@ static void logic_header_area_draw(const bContext *C, ARegion *ar)
/* only called once, from space/spacetypes.c */
void ED_spacetype_logic(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype logic");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype logic");
ARegionType *art;
- st->spaceid= SPACE_LOGIC;
+ st->spaceid = SPACE_LOGIC;
strncpy(st->name, "Logic", BKE_ST_MAXNAME);
- st->new= logic_new;
- st->free= logic_free;
- st->init= logic_init;
- st->duplicate= logic_duplicate;
- st->operatortypes= logic_operatortypes;
- st->keymap= logic_keymap;
- st->refresh= logic_refresh;
- st->context= logic_context;
+ st->new = logic_new;
+ st->free = logic_free;
+ st->init = logic_init;
+ st->duplicate = logic_duplicate;
+ st->operatortypes = logic_operatortypes;
+ st->keymap = logic_keymap;
+ st->refresh = logic_refresh;
+ st->context = logic_context;
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype logic region");
art->regionid = RGN_TYPE_WINDOW;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES|ED_KEYMAP_VIEW2D;
- art->init= logic_main_area_init;
- art->draw= logic_main_area_draw;
- art->listener= logic_listener;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES | ED_KEYMAP_VIEW2D;
+ art->init = logic_main_area_init;
+ art->draw = logic_main_area_draw;
+ art->listener = logic_listener;
BLI_addhead(&st->regiontypes, art);
/* regions: listview/buttons */
- art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype logic region");
art->regionid = RGN_TYPE_UI;
art->prefsizex= 220; // XXX
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
- art->listener= logic_listener;
- art->init= logic_buttons_area_init;
- art->draw= logic_buttons_area_draw;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+ art->listener = logic_listener;
+ art->init = logic_buttons_area_init;
+ art->draw = logic_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
- art->init= logic_header_area_init;
- art->draw= logic_header_area_draw;
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
+ art->init = logic_header_area_init;
+ art->draw = logic_header_area_draw;
BLI_addhead(&st->regiontypes, art);
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index a3e9ca1c4a2..775dd5445c3 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -304,13 +304,13 @@ static int nlaedit_viewall(bContext *C, const short onlySel)
/* set the horizontal range, with an extra offset so that the extreme keys will be in view */
get_nlastrip_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel);
- extra = 0.1f * (v2d->cur.xmax - v2d->cur.xmin);
+ extra = 0.1f * BLI_RCT_SIZE_X(&v2d->cur);
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
/* set vertical range */
v2d->cur.ymax = 0.0f;
- v2d->cur.ymin = (float)-(v2d->mask.ymax - v2d->mask.ymin);
+ v2d->cur.ymin = (float)-BLI_RCT_SIZE_Y(&v2d->mask);
/* do View2D syncing */
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index b6bef651af3..e7610210881 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -309,7 +309,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
* - the frame-range select option is favored over the channel one (x over y), as frame-range one is often
* used for tweaking timing when "blocking", while channels is not that useful...
*/
- if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
+ if (BLI_RCT_SIZE_X(&rect) >= BLI_RCT_SIZE_Y(&rect))
mode = NLA_BORDERSEL_FRAMERANGE;
else
mode = NLA_BORDERSEL_CHANNELS;
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 615c4fb4b46..8a1f0e5b611 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -386,7 +386,7 @@ static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *
bt = uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "",
(int)butr->xmin, (int)butr->xmin,
- (short)(butr->xmax - butr->xmin), (short)(butr->xmax - butr->xmin),
+ (short)BLI_RCT_SIZE_X(butr), (short)BLI_RCT_SIZE_X(butr),
nor, 0.0f, 1.0f, 0, 0, "");
uiButSetFunc(bt, node_normal_cb, ntree, node);
}
@@ -454,7 +454,7 @@ static int node_resize_area_default(bNode *node, int x, int y)
rctf totr = node->totr;
/* right part of node */
totr.xmin = node->totr.xmax - 20.0f;
- if (BLI_in_rctf(&totr, x, y))
+ if (BLI_rctf_isect_pt(&totr, x, y))
return NODE_RESIZE_RIGHT;
else
return 0;
@@ -522,7 +522,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
rect->ymax += NODE_DY;
/* input sockets */
- dy = 0.5f * (rect->ymin + rect->ymax) + NODE_DY * (BLI_countlist(&gnode->inputs) - 1);
+ dy = BLI_RCT_CENTER_Y(rect) + (NODE_DY * (BLI_countlist(&gnode->inputs) - 1));
gsock = ngroup->inputs.first;
sock = gnode->inputs.first;
while (gsock || sock) {
@@ -570,7 +570,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
}
/* output sockets */
- dy = 0.5f * (rect->ymin + rect->ymax) + NODE_DY * (BLI_countlist(&gnode->outputs) - 1);
+ dy = BLI_RCT_CENTER_Y(rect) + (NODE_DY * (BLI_countlist(&gnode->outputs) - 1));
gsock = ngroup->outputs.first;
sock = gnode->outputs.first;
while (gsock || sock) {
@@ -837,7 +837,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL,
(int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + (group_header - (2.5f * dpi_fac))),
- mini((int)(rect.xmax - rect.xmin - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
+ mini((int)(BLI_RCT_SIZE_X(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle());
RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr);
uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL);
uiBlockLayoutResolve(gnode->block, NULL, NULL);
@@ -857,13 +857,13 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
while (gsock && (!sock || sock->groupsock != gsock)) {
draw_group_socket(C, snode, ntree, gnode, NULL, gsock, index, SOCK_IN);
gsock = gsock->next;
- ++index;
+ index++;
}
while (sock && gsock && sock->groupsock == gsock) {
draw_group_socket(C, snode, ntree, gnode, sock, gsock, index, SOCK_IN);
sock = sock->next;
gsock = gsock->next;
- ++index;
+ index++;
}
}
gsock = ngroup->outputs.first;
@@ -877,13 +877,13 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN
while (gsock && (!sock || sock->groupsock != gsock)) {
draw_group_socket(C, snode, ntree, gnode, NULL, gsock, index, SOCK_OUT);
gsock = gsock->next;
- ++index;
+ index++;
}
while (sock && gsock && sock->groupsock == gsock) {
draw_group_socket(C, snode, ntree, gnode, sock, gsock, index, SOCK_OUT);
sock = sock->next;
gsock = gsock->next;
- ++index;
+ index++;
}
}
@@ -979,7 +979,7 @@ static void node_draw_frame_label(bNode *node, const float aspect)
ascender = BLF_ascender(fontid);
/* 'x' doesn't need aspect correction */
- x = 0.5f * (rct->xmin + rct->xmax) - 0.5f * width;
+ x = BLI_RCT_CENTER_X(rct) - (0.5f * width);
y = rct->ymax - (((NODE_DY / 4) / aspect) + (ascender * aspect));
BLF_position(fontid, x, y, 0);
@@ -1812,6 +1812,15 @@ static void node_composit_buts_inpaint(uiLayout *layout, bContext *UNUSED(C), Po
uiItemR(layout, ptr, "distance", 0, NULL, ICON_NONE);
}
+static void node_composit_buts_despeckle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+ uiLayout *col;
+
+ col = uiLayoutColumn(layout, FALSE);
+ uiItemR(col, ptr, "threshold", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "threshold_neighbour", 0, NULL, ICON_NONE);
+}
+
static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
{
uiLayout *col;
@@ -2674,6 +2683,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
case CMP_NODE_INPAINT:
ntype->uifunc = node_composit_buts_inpaint;
break;
+ case CMP_NODE_DESPECKLE:
+ ntype->uifunc = node_composit_buts_despeckle;
+ break;
case CMP_NODE_OUTPUT_FILE:
ntype->uifunc = node_composit_buts_file_output;
ntype->uifuncbut = node_composit_buts_file_output_details;
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 7d007d024ab..99d49fa1e8f 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/space_node/node_relationships.c
+/** \file blender/editors/space_node/node_add.c
* \ingroup spnode
*/
@@ -360,7 +360,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
/* RNA_property_pointer_set increases the user count,
* fixed here as the editor is the initial user.
*/
- --ntree->id.us;
+ ntree->id.us++;
RNA_property_update(C, &ptr, prop);
}
else if (snode) {
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 1a4c302124f..f1a91df6f53 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -226,12 +226,12 @@ void ED_node_sort(bNodeTree *ntree)
while (a < k && b < k && node_b) {
if (compare_nodes(node_a, node_b) == 0) {
node_a = node_a->next;
- ++a;
+ a++;
}
else {
tmp = node_b;
node_b = node_b->next;
- ++b;
+ b++;
BLI_remlink(&ntree->nodes, tmp);
BLI_insertlinkbefore(&ntree->nodes, node_a, tmp);
}
@@ -343,7 +343,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
if (node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
}
else {
- float oldh = node->prvr.ymax - node->prvr.ymin;
+ float oldh = BLI_RCT_SIZE_Y(&node->prvr);
if (oldh == 0.0f)
oldh = 0.6f * node->width - NODE_DY;
dy -= NODE_DYS / 2;
@@ -476,12 +476,12 @@ void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)
int node_select_area_default(bNode *node, int x, int y)
{
- return BLI_in_rctf(&node->totr, x, y);
+ return BLI_rctf_isect_pt(&node->totr, x, y);
}
int node_tweak_area_default(bNode *node, int x, int y)
{
- return BLI_in_rctf(&node->totr, x, y);
+ return BLI_rctf_isect_pt(&node->totr, x, y);
}
int node_get_colorid(bNode *node)
@@ -584,9 +584,9 @@ void node_socket_circle_draw(bNodeTree *UNUSED(ntree), bNodeSocket *sock, float
/* not a callback */
static void node_draw_preview(bNodePreview *preview, rctf *prv)
{
- float xscale = (prv->xmax - prv->xmin) / ((float)preview->xsize);
- float yscale = (prv->ymax - prv->ymin) / ((float)preview->ysize);
- float tile = (prv->xmax - prv->xmin) / 10.0f;
+ float xscale = BLI_RCT_SIZE_X(prv) / ((float)preview->xsize);
+ float yscale = BLI_RCT_SIZE_Y(prv) / ((float)preview->ysize);
+ float tile = BLI_RCT_SIZE_X(prv) / 10.0f;
float x, y;
/* draw checkerboard backdrop to show alpha */
@@ -852,8 +852,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
{
bNodeSocket *sock;
rctf *rct = &node->totr;
- float dx, centy = 0.5f * (rct->ymax + rct->ymin);
- float hiddenrad = 0.5f * (rct->ymax - rct->ymin);
+ float dx, centy = BLI_RCT_CENTER_Y(rct);
+ float hiddenrad = BLI_RCT_SIZE_Y(rct) / 2.0f;
float socket_size = NODE_SOCKSIZE * U.dpi / 72;
int color_id = node_get_colorid(node);
char showname[128]; /* 128 is used below */
@@ -932,7 +932,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
uiDefBut(node->block, LABEL, 0, showname,
(int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10),
- (short)(rct->xmax - rct->xmin - 18.0f - 12.0f), (short)NODE_DY,
+ (short)(BLI_RCT_SIZE_X(rct) - 18.0f - 12.0f), (short)NODE_DY,
NULL, 0, 0, 0, 0, "");
}
@@ -989,7 +989,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode)
else {
/* check nodes front to back */
for (node = ntree->nodes.last; node; node = node->prev) {
- if (BLI_in_rctf(&node->totr, snode->cursor[0], snode->cursor[1]))
+ if (BLI_rctf_isect_pt(&node->totr, snode->cursor[0], snode->cursor[1]))
break; /* first hit on node stops */
}
if (node) {
@@ -1110,7 +1110,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
glEnable(GL_MAP1_VERTEX_3);
/* aspect+font, set each time */
- snode->aspect = (v2d->cur.xmax - v2d->cur.xmin) / ((float)ar->winx);
+ snode->aspect = BLI_RCT_SIZE_X(&v2d->cur) / (float)ar->winx;
snode->aspect_sqrt = sqrtf(snode->aspect);
// XXX snode->curfont= uiSetCurFont_ext(snode->aspect);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 60375e9ab02..fbae8b17ebf 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -40,6 +40,7 @@
#include "BLI_math.h"
#include "BLI_blenlib.h"
+#include "BKE_blender.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
#include "BKE_global.h"
@@ -72,6 +73,8 @@
#include "node_intern.h" /* own include */
+#define USE_ESC_COMPO
+
/* ***************** composite job manager ********************** */
typedef struct CompoJob {
@@ -88,7 +91,13 @@ static int compo_breakjob(void *cjv)
{
CompoJob *cj = cjv;
- return *(cj->stop);
+ /* without G.is_break 'ESC' wont quit - which annoys users */
+ return (*(cj->stop)
+#ifdef USE_ESC_COMPO
+ ||
+ G.is_break
+#endif
+ );
}
/* called by compo, wmJob sends notifier */
@@ -173,7 +182,7 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog
*/
void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene *scene_owner)
{
- wmJob *steve;
+ wmJob *wm_job;
CompoJob *cj;
/* to fix bug: [#32272] */
@@ -181,7 +190,12 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
return;
}
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS);
+#ifdef USE_ESC_COMPO
+ G.is_break = FALSE;
+#endif
+
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing",
+ WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS, WM_JOB_TYPE_COMPOSITE);
cj = MEM_callocN(sizeof(CompoJob), "compo job");
/* customdata for preview thread */
@@ -189,11 +203,11 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
cj->ntree = nodetree;
/* setup job */
- WM_jobs_customdata_set(steve, cj, compo_freejob);
- WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT);
- WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob, NULL);
+ WM_jobs_customdata_set(wm_job, cj, compo_freejob);
+ WM_jobs_timer(wm_job, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT);
+ WM_jobs_callbacks(wm_job, compo_startjob, compo_initjob, compo_updatejob, NULL);
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
}
/* ***************************************** */
@@ -1023,11 +1037,11 @@ static int UNUSED_FUNCTION(node_mouse_groupheader) (SpaceNode * snode)
// XXX areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
/* click in header or outside? */
- if (BLI_in_rctf(&gnode->totr, mx, my) == 0) {
+ if (BLI_rctf_isect_pt(&gnode->totr, mx, my) == 0) {
rctf rect = gnode->totr;
rect.ymax += NODE_DY;
- if (BLI_in_rctf(&rect, mx, my) == 0)
+ if (BLI_rctf_isect_pt(&rect, mx, my) == 0)
snode_make_group_editable(snode, NULL); /* toggles, so exits editmode */
// else
// XXX transform_nodes(snode->nodetree, 'g', "Move group");
@@ -1071,7 +1085,7 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
if (in_out & SOCK_IN) {
for (sock = node->inputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
- if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
if (node == visible_node(snode, &rect)) {
*nodep = node;
*sockp = sock;
@@ -1084,7 +1098,7 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
if (in_out & SOCK_OUT) {
for (sock = node->outputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
- if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
if (node == visible_node(snode, &rect)) {
*nodep = node;
*sockp = sock;
@@ -1102,7 +1116,7 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
if (in_out & SOCK_IN) {
for (sock = snode->edittree->outputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
- if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
*nodep = NULL; /* NULL node pointer indicates group socket */
*sockp = sock;
return 1;
@@ -1113,7 +1127,7 @@ int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **so
if (in_out & SOCK_OUT) {
for (sock = snode->edittree->inputs.first; sock; sock = sock->next) {
if (!nodeSocketIsHidden(sock)) {
- if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+ if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
*nodep = NULL; /* NULL node pointer indicates group socket */
*sockp = sock;
return 1;
@@ -1824,7 +1838,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
BLI_remlink(&node->inputs, sock);
BLI_insertlinkbefore(&node->inputs, before, sock);
- --nimf->active_input;
+ nimf->active_input--;
}
else {
bNodeSocket *after = sock->next;
@@ -1832,7 +1846,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
BLI_remlink(&node->inputs, sock);
BLI_insertlinkafter(&node->inputs, after, sock);
- ++nimf->active_input;
+ nimf->active_input++;
}
snode_notify(C, snode);
@@ -2004,47 +2018,69 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
SpaceNode *snode = CTX_wm_space_node(C);
bNodeTree *ntree = snode->edittree;
bNode *gnode = node_tree_get_editgroup(snode->nodetree);
- float gnode_x = 0.0f, gnode_y = 0.0f;
+ float gnode_center[2];
+ const ListBase *clipboard_nodes_lb;
+ const ListBase *clipboard_links_lb;
bNode *node;
bNodeLink *link;
int num_nodes;
- float centerx, centery;
+ float center[2];
+ int is_clipboard_valid;
+
+ /* validate pointers in the clipboard */
+ is_clipboard_valid = BKE_node_clipboard_validate();
+ clipboard_nodes_lb = BKE_node_clipboard_get_nodes();
+ clipboard_links_lb = BKE_node_clipboard_get_links();
+
+ if (clipboard_nodes_lb->first == NULL) {
+ BKE_report(op->reports, RPT_ERROR, "Clipboard is empty");
+ return OPERATOR_CANCELLED;
+ }
if (BKE_node_clipboard_get_type() != ntree->type) {
BKE_report(op->reports, RPT_ERROR, "Clipboard nodes are an incompatible type");
return OPERATOR_CANCELLED;
}
+ /* only warn */
+ if (is_clipboard_valid == FALSE) {
+ BKE_report(op->reports, RPT_WARNING, "Some nodes references could not be restored, will be left empty");
+ }
+
ED_preview_kill_jobs(C);
/* deselect old nodes */
node_deselect_all(snode);
/* get group node offset */
- if (gnode)
- nodeToView(gnode, 0.0f, 0.0f, &gnode_x, &gnode_y);
+ if (gnode) {
+ nodeToView(gnode, 0.0f, 0.0f, &gnode_center[0], &gnode_center[1]);
+ }
+ else {
+ zero_v2(gnode_center);
+ }
/* calculate "barycenter" for placing on mouse cursor */
- num_nodes = 0;
- centerx = centery = 0.0f;
- for (node = BKE_node_clipboard_get_nodes()->first; node; node = node->next) {
- ++num_nodes;
- centerx += 0.5f * (node->totr.xmin + node->totr.xmax);
- centery += 0.5f * (node->totr.ymin + node->totr.ymax);
+ zero_v2(center);
+ for (node = clipboard_nodes_lb->first, num_nodes = 0; node; node = node->next, num_nodes++) {
+ center[0] += BLI_RCT_CENTER_X(&node->totr);
+ center[1] += BLI_RCT_CENTER_Y(&node->totr);
}
- centerx /= num_nodes;
- centery /= num_nodes;
+ mul_v2_fl(center, 1.0 / num_nodes);
/* copy nodes from clipboard */
- for (node = BKE_node_clipboard_get_nodes()->first; node; node = node->next) {
+ for (node = clipboard_nodes_lb->first; node; node = node->next) {
bNode *new_node = nodeCopyNode(ntree, node);
+ /* needed since nodeCopyNode() doesn't increase ID's */
+ id_us_plus(node->id);
+
/* pasted nodes are selected */
node_select(new_node);
}
/* reparent copied nodes */
- for (node = BKE_node_clipboard_get_nodes()->first; node; node = node->next) {
+ for (node = clipboard_nodes_lb->first; node; node = node->next) {
bNode *new_node = node->new_node;
if (new_node->parent)
new_node->parent = new_node->parent->new_node;
@@ -2052,12 +2088,12 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
/* place nodes around the mouse cursor. child nodes locations are relative to parent */
if (!new_node->parent) {
- new_node->locx += snode->cursor[0] - centerx - gnode_x;
- new_node->locy += snode->cursor[1] - centery - gnode_y;
+ new_node->locx += snode->cursor[0] - center[0] - gnode_center[0];
+ new_node->locy += snode->cursor[1] - center[1] - gnode_center[1];
}
}
- for (link = BKE_node_clipboard_get_links()->first; link; link = link->next) {
+ for (link = clipboard_links_lb->first; link; link = link->next) {
nodeAddLink(ntree, link->fromnode->new_node, link->fromsock->new_sock,
link->tonode->new_node, link->tosock->new_sock);
}
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index efd2378bf31..77583ae1325 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -421,10 +421,11 @@ static int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
node->new_node = NULL;
/* wgroup is a temporary copy of the NodeTree we're merging in
- * - all of wgroup's nodes are transferred across to their new home
- * - ngroup (i.e. the source NodeTree) is left unscathed
+ * - all of wgroup's nodes are transferred across to their new home
+ * - ngroup (i.e. the source NodeTree) is left unscathed
+ * - temp copy. don't change ID usercount
*/
- wgroup = ntreeCopyTree(ngroup);
+ wgroup = ntreeCopyTree_ex(ngroup, FALSE);
/* add the nodes into the ntree */
for (node = wgroup->nodes.first; node; node = nextn) {
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 048e09efab5..2bb550d1a63 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -107,6 +107,7 @@ void NODE_OT_select_all(wmOperatorType *ot);
void NODE_OT_select_linked_to(wmOperatorType *ot);
void NODE_OT_select_linked_from(wmOperatorType *ot);
void NODE_OT_select_border(struct wmOperatorType *ot);
+void NODE_OT_select_lasso(struct wmOperatorType *ot);
void NODE_OT_select_same_type(struct wmOperatorType *ot);
void NODE_OT_select_same_type_next(wmOperatorType *ot);
void NODE_OT_select_same_type_prev(wmOperatorType *ot);
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 195dd60b72a..a5032fb6465 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -55,6 +55,7 @@ void node_operatortypes(void)
WM_operatortype_append(NODE_OT_select_linked_to);
WM_operatortype_append(NODE_OT_select_linked_from);
WM_operatortype_append(NODE_OT_select_border);
+ WM_operatortype_append(NODE_OT_select_lasso);
WM_operatortype_append(NODE_OT_select_same_type);
WM_operatortype_append(NODE_OT_select_same_type_next);
WM_operatortype_append(NODE_OT_select_same_type_prev);
@@ -217,6 +218,11 @@ void node_keymap(struct wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "NODE_OT_select_border", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_boolean_set(kmi->ptr, "tweak", TRUE);
+ kmi = WM_keymap_add_item(keymap, "NODE_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "deselect", FALSE);
+ kmi = WM_keymap_add_item(keymap, "NODE_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT | KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "deselect", TRUE);
+
/* each of these falls through if not handled... */
WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "NODE_OT_link", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index 6295a568113..12c221b9273 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -224,8 +224,9 @@ static void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
if (!sock_fr)
continue;
- if (snode_autoconnect_input(snode, node_fr, sock_fr, node_to, sock_to, replace))
- ++numlinks;
+ if (snode_autoconnect_input(snode, node_fr, sock_fr, node_to, sock_to, replace)) {
+ numlinks++;
+ }
}
}
@@ -246,7 +247,7 @@ static void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
continue;
if (snode_autoconnect_input(snode, node_fr, sock_fr, node_to, sock_to, replace)) {
- ++numlinks;
+ numlinks++;
break;
}
}
@@ -1139,7 +1140,7 @@ static int node_attach_exec(bContext *C, wmOperator *UNUSED(op))
/* skip selected, those are the nodes we want to attach */
if ((frame->type != NODE_FRAME) || (frame->flag & NODE_SELECT))
continue;
- if (BLI_in_rctf(&frame->totr, snode->cursor[0], snode->cursor[1]))
+ if (BLI_rctf_isect_pt(&frame->totr, snode->cursor[0], snode->cursor[1]))
break;
}
if (frame) {
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 2f4e7648a5f..a56d76a3ef7 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -35,6 +35,7 @@
#include "BKE_node.h"
#include "BLI_rect.h"
+#include "BLI_lasso.h"
#include "BLI_utildefines.h"
#include "ED_node.h" /* own include */
@@ -48,7 +49,9 @@
#include "WM_types.h"
#include "UI_view2d.h"
-
+
+#include "MEM_guardedalloc.h"
+
#include "node_intern.h" /* own include */
/* ****** helpers ****** */
@@ -534,6 +537,92 @@ void NODE_OT_select_border(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "tweak", 0, "Tweak", "Only activate when mouse is not over a node - useful for tweak gesture");
}
+/* ****** Lasso Select ****** */
+
+static int do_lasso_select_node(bContext *C, int mcords[][2], short moves, short select)
+{
+ SpaceNode *snode = CTX_wm_space_node(C);
+ bNode *node;
+
+ ARegion *ar = CTX_wm_region(C);
+
+ rcti rect;
+ int change = FALSE;
+
+ /* get rectangle from operator */
+ BLI_lasso_boundbox(&rect, mcords, moves);
+
+ /* do actual selection */
+ for (node = snode->edittree->nodes.first; node; node = node->next) {
+ int screen_co[2];
+ const float cent[2] = {BLI_RCT_CENTER_X(&node->totr),
+ BLI_RCT_CENTER_Y(&node->totr)};
+
+ /* marker in screen coords */
+ UI_view2d_view_to_region(&ar->v2d,
+ cent[0], cent[1],
+ &screen_co[0], &screen_co[1]);
+
+ if (BLI_rcti_isect_pt(&rect, screen_co[0], screen_co[1]) &&
+ BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], INT_MAX))
+ {
+ if (select)
+ node_select(node);
+ else
+ node_deselect(node);
+
+ change = TRUE;
+ }
+ }
+
+ if (change) {
+ WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL);
+ }
+
+ return change;
+}
+
+static int node_lasso_select_exec(bContext *C, wmOperator *op)
+{
+ int mcords_tot;
+ int (*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot);
+
+ if (mcords) {
+ short select;
+
+ select = !RNA_boolean_get(op->ptr, "deselect");
+ do_lasso_select_node(C, mcords, mcords_tot, select);
+
+ MEM_freeN(mcords);
+
+ return OPERATOR_FINISHED;
+ }
+ return OPERATOR_PASS_THROUGH;
+}
+
+void NODE_OT_select_lasso(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Lasso Select";
+ ot->description = "Select nodes using lasso selection";
+ ot->idname = "NODE_OT_select_lasso";
+
+ /* api callbacks */
+ ot->invoke = WM_gesture_lasso_invoke;
+ ot->modal = WM_gesture_lasso_modal;
+ ot->exec = node_lasso_select_exec;
+ ot->poll = ED_operator_node_active;
+ ot->cancel = WM_gesture_lasso_cancel;
+
+ /* flags */
+ ot->flag = OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
+ RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
+ RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
+}
+
/* ****** Select/Deselect All ****** */
static int node_select_all_exec(bContext *C, wmOperator *op)
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index a8fe8318f22..989b3999018 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -596,7 +596,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
uiItemL(row, "", ICON_BLANK1);
bt = block->buttons.last;
- bt->x2 = UI_UNIT_X / 2;
+ bt->rect.xmax = UI_UNIT_X / 2;
uiBlockSetEmboss(block, UI_EMBOSS);
}
diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c
index 4be51a02137..e89e798a6fa 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -32,6 +32,7 @@
#include "BLI_rect.h"
#include "BLI_utildefines.h"
+#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_image.h"
@@ -71,8 +72,8 @@ static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, cons
int tot = 0;
int has_frame = FALSE;
- oldwidth = ar->v2d.cur.xmax - ar->v2d.cur.xmin;
- oldheight = ar->v2d.cur.ymax - ar->v2d.cur.ymin;
+ oldwidth = BLI_RCT_SIZE_X(&ar->v2d.cur);
+ oldheight = BLI_RCT_SIZE_Y(&ar->v2d.cur);
BLI_rctf_init_minmax(&cur_new);
@@ -90,8 +91,8 @@ static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, cons
}
if (tot) {
- width = cur_new.xmax - cur_new.xmin;
- height = cur_new.ymax - cur_new.ymin;
+ width = BLI_RCT_SIZE_X(&cur_new);
+ height = BLI_RCT_SIZE_Y(&cur_new);
/* for single non-frame nodes, don't zoom in, just pan view,
* but do allow zooming out, this allows for big nodes to be zoomed out */
@@ -103,9 +104,6 @@ static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, cons
BLI_rctf_resize(&cur_new, oldwidth, oldheight);
}
else {
- width = cur_new.xmax - cur_new.xmin;
- height = cur_new.ymax - cur_new.ymin;
-
if (width > height) {
float newheight;
newheight = oldheight * width / oldwidth;
@@ -350,6 +348,59 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
}
}
+/* returns color in SRGB */
+/* matching ED_space_image_color_sample() */
+int ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3])
+{
+ void *lock;
+ Image *ima;
+ ImBuf *ibuf;
+ float fx, fy, bufx, bufy;
+ int ret = FALSE;
+
+ ima = BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ if (!ibuf) {
+ return FALSE;
+ }
+
+ /* map the mouse coords to the backdrop image space */
+ bufx = ibuf->x * snode->zoom;
+ bufy = ibuf->y * snode->zoom;
+ fx = (bufx > 0.0f ? ((float)mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
+ fy = (bufy > 0.0f ? ((float)mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
+
+ if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
+ float *fp;
+ unsigned char *cp;
+ int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
+
+ CLAMP(x, 0, ibuf->x - 1);
+ CLAMP(y, 0, ibuf->y - 1);
+
+ if (ibuf->rect_float) {
+ fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
+ /* IB_PROFILE_NONE is default but infact its linear */
+ if (ELEM(ibuf->profile, IB_PROFILE_LINEAR_RGB, IB_PROFILE_NONE)) {
+ linearrgb_to_srgb_v3_v3(r_col, fp);
+ }
+ else {
+ copy_v3_v3(r_col, fp);
+ }
+ ret = TRUE;
+ }
+ else if (ibuf->rect) {
+ cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+ rgb_uchar_to_float(r_col, cp);
+ ret = TRUE;
+ }
+ }
+
+ BKE_image_release_ibuf(ima, lock);
+
+ return ret;
+}
+
static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -383,7 +434,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
float *fp;
- char *cp;
+ unsigned char *cp;
int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
CLAMP(x, 0, ibuf->x - 1);
@@ -395,7 +446,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
info->channels = ibuf->channels;
if (ibuf->rect) {
- cp = (char *)(ibuf->rect + y * ibuf->x + x);
+ cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
info->col[0] = cp[0];
info->col[1] = cp[1];
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 4fa8686bce3..0874ddcb279 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -579,11 +579,11 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
te = outliner_find_id(so, &so->tree, (ID *)OBACT);
if (te) {
/* make te->ys center of view */
- ytop = (int)(te->ys + (v2d->mask.ymax - v2d->mask.ymin) / 2);
+ ytop = (int)(te->ys + BLI_RCT_SIZE_Y(&v2d->mask) / 2);
if (ytop > 0) ytop = 0;
v2d->cur.ymax = (float)ytop;
- v2d->cur.ymin = (float)(ytop - (v2d->mask.ymax - v2d->mask.ymin));
+ v2d->cur.ymin = (float)(ytop - BLI_RCT_SIZE_Y(&v2d->mask));
/* make te->xs ==> te->xend center of view */
xdelta = (int)(te->xs - v2d->cur.xmin);
@@ -615,7 +615,7 @@ void OUTLINER_OT_show_active(wmOperatorType *ot)
static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
- int dy = ar->v2d.mask.ymax - ar->v2d.mask.ymin;
+ int dy = BLI_RCT_SIZE_Y(&ar->v2d.mask);
int up = 0;
if (RNA_boolean_get(op->ptr, "up"))
@@ -760,10 +760,10 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
tselem->flag |= TSE_SELECTED;
/* make te->ys center of view */
- ytop = (int)(te->ys + (ar->v2d.mask.ymax - ar->v2d.mask.ymin) / 2);
+ ytop = (int)(te->ys + BLI_RCT_SIZE_Y(&ar->v2d.mask) / 2);
if (ytop > 0) ytop = 0;
ar->v2d.cur.ymax = (float)ytop;
- ar->v2d.cur.ymin = (float)(ytop - (ar->v2d.mask.ymax - ar->v2d.mask.ymin));
+ ar->v2d.cur.ymin = (float)(ytop - BLI_RCT_SIZE_Y(&ar->v2d.mask));
/* make te->xs ==> te->xend center of view */
xdelta = (int)(te->xs - ar->v2d.cur.xmin);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 489a4efe891..6cfc3f97b31 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -483,7 +483,7 @@ void ED_spacetype_outliner(void)
BLI_addhead(&st->regiontypes, art);
/* regions: header */
- art = MEM_callocN(sizeof(ARegionType), "spacetype time region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype time header region");
art->regionid = RGN_TYPE_HEADER;
art->prefsizey = HEADERY;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 7bee8c2bebf..c1f7fc942e4 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -40,9 +40,11 @@ set(SRC
sequencer_buttons.c
sequencer_draw.c
sequencer_edit.c
+ sequencer_modifier.c
sequencer_ops.c
sequencer_scopes.c
sequencer_select.c
+ sequencer_view.c
space_sequencer.c
sequencer_intern.h
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 7dd98c39e4c..d6a2b0a001e 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -428,7 +428,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
y2 = seq->machine + SEQ_STRIP_OFSTOP;
- pixely = (v2d->cur.ymax - v2d->cur.ymin) / (v2d->mask.ymax - v2d->mask.ymin);
+ pixely = BLI_RCT_SIZE_Y(&v2d->cur) / BLI_RCT_SIZE_Y(&v2d->mask);
if (pixely <= 0) return; /* can happen when the view is split/resized */
@@ -721,7 +721,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
/* draw sound wave */
if (seq->type == SEQ_TYPE_SOUND_RAM) {
- drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin) / ar->winx);
+ drawseqwave(scene, seq, x1, y1, x2, y2, BLI_RCT_SIZE_X(&ar->v2d.cur) / ar->winx);
}
/* draw lock */
@@ -811,6 +811,41 @@ static void UNUSED_FUNCTION(set_special_seq_update) (int val)
else special_seq_update = NULL;
}
+ImBuf *sequencer_ibuf_get(struct Main *bmain, Scene *scene, SpaceSeq *sseq, int cfra, int frame_ofs)
+{
+ SeqRenderData context;
+ ImBuf *ibuf;
+ int rectx, recty;
+ float render_size = 0.0;
+ float proxy_size = 100.0;
+
+ render_size = sseq->render_size;
+ if (render_size == 0) {
+ render_size = scene->r.size;
+ }
+ else {
+ proxy_size = render_size;
+ }
+
+ if (render_size < 0) {
+ return NULL;
+ }
+
+ rectx = (render_size * (float)scene->r.xsch) / 100.0f + 0.5f;
+ recty = (render_size * (float)scene->r.ysch) / 100.0f + 0.5f;
+
+ context = BKE_sequencer_new_render_data(bmain, scene, rectx, recty, proxy_size);
+
+ if (special_seq_update)
+ ibuf = BKE_sequencer_give_ibuf_direct(context, cfra + frame_ofs, special_seq_update);
+ else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
+ ibuf = BKE_sequencer_give_ibuf(context, cfra + frame_ofs, sseq->chanshown);
+ else
+ ibuf = BKE_sequencer_give_ibuf_threaded(context, cfra + frame_ofs, sseq->chanshown);
+
+ return ibuf;
+}
+
void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs, int draw_overlay)
{
struct Main *bmain = CTX_data_main(C);
@@ -824,7 +859,6 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
float col[3];
GLuint texid;
GLuint last_texid;
- SeqRenderData context;
render_size = sseq->render_size;
if (render_size == 0) {
@@ -865,14 +899,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
if (G.is_rendering)
return;
- context = BKE_sequencer_new_render_data(bmain, scene, rectx, recty, proxy_size);
-
- if (special_seq_update)
- ibuf = BKE_sequencer_give_ibuf_direct(context, cfra + frame_ofs, special_seq_update);
- else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
- ibuf = BKE_sequencer_give_ibuf(context, cfra + frame_ofs, sseq->chanshown);
- else
- ibuf = BKE_sequencer_give_ibuf_threaded(context, cfra + frame_ofs, sseq->chanshown);
+ ibuf = sequencer_ibuf_get(bmain, scene, sseq, cfra, frame_ofs);
if (ibuf == NULL)
return;
@@ -929,10 +956,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
if (draw_overlay) {
if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) {
rctf tot_clip;
- tot_clip.xmin = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
- tot_clip.ymin = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
- tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
- tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
+ tot_clip.xmin = v2d->tot.xmin + (ABS(BLI_RCT_SIZE_X(&v2d->tot)) * scene->ed->over_border.xmin);
+ tot_clip.ymin = v2d->tot.ymin + (ABS(BLI_RCT_SIZE_Y(&v2d->tot)) * scene->ed->over_border.ymin);
+ tot_clip.xmax = v2d->tot.xmin + (ABS(BLI_RCT_SIZE_X(&v2d->tot)) * scene->ed->over_border.xmax);
+ tot_clip.ymax = v2d->tot.ymin + (ABS(BLI_RCT_SIZE_Y(&v2d->tot)) * scene->ed->over_border.ymax);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
@@ -1114,7 +1141,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
View2D *v2d = &ar->v2d;
Sequence *last_seq = BKE_sequencer_active_get(scene);
int sel = 0, j;
- float pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
+ float pixelx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
/* loop through twice, first unselected, then selected */
for (j = 0; j < 2; j++) {
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 9e730fff940..81699d36f5f 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -177,7 +177,7 @@ static void proxy_endjob(void *pjv)
static void seq_proxy_build_job(const bContext *C)
{
- wmJob *steve;
+ wmJob *wm_job;
ProxyJob *pj;
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
@@ -186,9 +186,10 @@ static void seq_proxy_build_job(const bContext *C)
LinkData *link;
Sequence *seq;
- steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+ wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies",
+ WM_JOB_PROGRESS, WM_JOB_TYPE_SEQ_BUILD_PROXY);
- pj = WM_jobs_customdata_get(steve);
+ pj = WM_jobs_customdata_get(wm_job);
if (!pj) {
pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
@@ -196,9 +197,9 @@ static void seq_proxy_build_job(const bContext *C)
pj->scene = scene;
pj->main = CTX_data_main(C);
- WM_jobs_customdata_set(steve, pj, proxy_freejob);
- WM_jobs_timer(steve, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
- WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
+ WM_jobs_customdata_set(wm_job, pj, proxy_freejob);
+ WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
+ WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob);
}
SEQP_BEGIN (ed, seq)
@@ -211,9 +212,9 @@ static void seq_proxy_build_job(const bContext *C)
}
SEQ_END
- if (!WM_jobs_is_running(steve)) {
+ if (!WM_jobs_is_running(wm_job)) {
G.is_break = FALSE;
- WM_jobs_start(CTX_wm_manager(C), steve);
+ WM_jobs_start(CTX_wm_manager(C), wm_job);
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -371,7 +372,7 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[
if (ed == NULL) return NULL;
- pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
+ pixelx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask);
UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
@@ -2141,8 +2142,8 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
float winx = (int)(rd->size * rd->xsch) / 100;
float winy = (int)(rd->size * rd->ysch) / 100;
- float facx = (v2d->mask.xmax - v2d->mask.xmin) / winx;
- float facy = (v2d->mask.ymax - v2d->mask.ymin) / winy;
+ float facx = BLI_RCT_SIZE_X(&v2d->mask) / winx;
+ float facy = BLI_RCT_SIZE_Y(&v2d->mask) / winy;
BLI_rctf_resize(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1);
@@ -2245,7 +2246,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
ymax += ymargin;
ymin -= ymargin;
- orig_height = cur_new.ymax - cur_new.ymin;
+ orig_height = BLI_RCT_SIZE_Y(&cur_new);
cur_new.xmin = xmin;
cur_new.xmax = xmax;
@@ -2254,8 +2255,8 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
cur_new.ymax = ymax;
/* only zoom out vertically */
- if (orig_height > cur_new.ymax - cur_new.ymin) {
- ymid = (cur_new.ymax + cur_new.ymin) / 2;
+ if (orig_height > BLI_RCT_SIZE_Y(&cur_new)) {
+ ymid = BLI_RCT_CENTER_Y(&cur_new);
cur_new.ymin = ymid - (orig_height / 2);
cur_new.ymax = ymid + (orig_height / 2);
@@ -2287,7 +2288,9 @@ void SEQUENCER_OT_view_selected(wmOperatorType *ot)
}
-static int find_next_prev_edit(Scene *scene, int cfra, int side)
+static int find_next_prev_edit(Scene *scene, int cfra,
+ const short side,
+ const short do_skip_mute, const short do_center)
{
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq, *best_seq = NULL, *frame_seq = NULL;
@@ -2298,19 +2301,32 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
if (ed == NULL) return cfra;
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+ int seq_frame;
+
+ if (do_skip_mute && (seq->flag & SEQ_MUTE)) {
+ continue;
+ }
+
+ if (do_center) {
+ seq_frame = (seq->startdisp + seq->enddisp) / 2;
+ }
+ else {
+ seq_frame = seq->startdisp;
+ }
+
dist = MAXFRAME * 2;
switch (side) {
case SEQ_SIDE_LEFT:
- if (seq->startdisp < cfra) {
- dist = cfra - seq->startdisp;
+ if (seq_frame < cfra) {
+ dist = cfra - seq_frame;
}
break;
case SEQ_SIDE_RIGHT:
- if (seq->startdisp > cfra) {
- dist = seq->startdisp - cfra;
+ if (seq_frame > cfra) {
+ dist = seq_frame - cfra;
}
- else if (seq->startdisp == cfra) {
+ else if (seq_frame == cfra) {
frame_seq = seq;
}
break;
@@ -2325,83 +2341,77 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
/* if no sequence to the right is found and the
* frame is on the start of the last sequence,
* move to the end of the last sequence */
- if (frame_seq) cfra = frame_seq->enddisp;
+ if (frame_seq) {
+ if (do_center) {
+ cfra = (frame_seq->startdisp + frame_seq->enddisp) / 2;
+ }
+ else {
+ cfra = frame_seq->enddisp;
+ }
+ }
- return best_seq ? best_seq->startdisp : cfra;
+ if (best_seq) {
+ if (do_center) {
+ cfra = (best_seq->startdisp + best_seq->enddisp) / 2;
+ }
+ else {
+ cfra = best_seq->startdisp;
+ }
+ }
+
+ return cfra;
}
-static int next_prev_edit_internal(Scene *scene, int side)
+static int strip_jump_internal(Scene *scene,
+ const short side,
+ const short do_skip_mute, const short do_center)
{
- int change = 0;
+ int change = FALSE;
int cfra = CFRA;
- int nfra = find_next_prev_edit(scene, cfra, side);
+ int nfra = find_next_prev_edit(scene, cfra, side, do_skip_mute, do_center);
if (nfra != cfra) {
CFRA = nfra;
- change = 1;
+ change = TRUE;
}
return change;
}
-/* move frame to next edit point operator */
-static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op))
+/* jump frame to edit point operator */
+static int sequencer_strip_jump_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
-
- if (!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT))
- return OPERATOR_CANCELLED;
-
- WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
+ short next = RNA_boolean_get(op->ptr, "next");
+ short center = RNA_boolean_get(op->ptr, "center");
- return OPERATOR_FINISHED;
-}
-
-void SEQUENCER_OT_next_edit(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Next Edit";
- ot->idname = "SEQUENCER_OT_next_edit";
- ot->description = "Move frame to next edit point";
-
- /* api callbacks */
- ot->exec = sequencer_next_edit_exec;
- ot->poll = sequencer_edit_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
- /* properties */
-}
-
-/* move frame to previous edit point operator */
-static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Scene *scene = CTX_data_scene(C);
-
- if (!next_prev_edit_internal(scene, SEQ_SIDE_LEFT))
+ /* currently do_skip_mute is always TRUE */
+ if (!strip_jump_internal(scene, next ? SEQ_SIDE_RIGHT : SEQ_SIDE_LEFT, TRUE, center)) {
return OPERATOR_CANCELLED;
+ }
WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
return OPERATOR_FINISHED;
}
-void SEQUENCER_OT_previous_edit(wmOperatorType *ot)
+void SEQUENCER_OT_strip_jump(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Previous Edit";
- ot->idname = "SEQUENCER_OT_previous_edit";
+ ot->name = "Jump to Strip";
+ ot->idname = "SEQUENCER_OT_strip_jump";
ot->description = "Move frame to previous edit point";
-
+
/* api callbacks */
- ot->exec = sequencer_previous_edit_exec;
+ ot->exec = sequencer_strip_jump_exec;
ot->poll = sequencer_edit_poll;
-
+
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
+ RNA_def_boolean(ot->srna, "next", TRUE, "Next Strip", "");
+ RNA_def_boolean(ot->srna, "center", TRUE, "Use strip center", "");
}
static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
@@ -2768,11 +2778,11 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
if (ed == NULL)
return OPERATOR_CANCELLED;
- rect.xmin /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin));
- rect.ymin /= (float)(ABS(v2d->tot.ymax - v2d->tot.ymin));
+ rect.xmin /= (float)(ABS(BLI_RCT_SIZE_X(&v2d->tot)));
+ rect.ymin /= (float)(ABS(BLI_RCT_SIZE_Y(&v2d->tot)));
- rect.xmax /= (float)(ABS(v2d->tot.xmax - v2d->tot.xmin));
- rect.ymax /= (float)(ABS(v2d->tot.ymax - v2d->tot.ymin));
+ rect.xmax /= (float)(ABS(BLI_RCT_SIZE_X(&v2d->tot)));
+ rect.ymax /= (float)(ABS(BLI_RCT_SIZE_Y(&v2d->tot)));
rect.xmin += 0.5f;
rect.xmax += 0.5f;
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 16cf929a832..f5c3a4c4d89 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -44,6 +44,7 @@ struct ScrArea;
struct ARegion;
struct ARegionType;
struct Scene;
+struct Main;
/* space_sequencer.c */
struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
@@ -51,10 +52,12 @@ struct ARegion *sequencer_has_buttons_region(struct ScrArea *sa);
/* sequencer_draw.c */
void draw_timeline_seq(const struct bContext *C, struct ARegion *ar);
-void draw_image_seq(const struct bContext* C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, int draw_overlay);
+void draw_image_seq(const struct bContext *C, struct Scene *scene, struct ARegion *ar, struct SpaceSeq *sseq, int cfra, int offset, int draw_overlay);
void seq_reset_imageofs(struct SpaceSeq *sseq);
+struct ImBuf *sequencer_ibuf_get(struct Main *bmain, struct Scene *scene, struct SpaceSeq *sseq, int cfra, int frame_ofs);
+
/* sequencer_edit.c */
struct View2D;
void seq_rectf(struct Sequence *seq, struct rctf *rectf);
@@ -95,8 +98,7 @@ void SEQUENCER_OT_meta_toggle(struct wmOperatorType *ot);
void SEQUENCER_OT_meta_make(struct wmOperatorType *ot);
void SEQUENCER_OT_meta_separate(struct wmOperatorType *ot);
void SEQUENCER_OT_snap(struct wmOperatorType *ot);
-void SEQUENCER_OT_previous_edit(struct wmOperatorType *ot);
-void SEQUENCER_OT_next_edit(struct wmOperatorType *ot);
+void SEQUENCER_OT_strip_jump(struct wmOperatorType *ot);
void SEQUENCER_OT_swap(struct wmOperatorType *ot);
void SEQUENCER_OT_swap_data(struct wmOperatorType *ot);
void SEQUENCER_OT_rendersize(struct wmOperatorType *ot);
@@ -177,5 +179,13 @@ struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf);
void sequencer_buttons_register(struct ARegionType *art);
void SEQUENCER_OT_properties(struct wmOperatorType *ot);
+/* sequencer_modifiers.c */
+void SEQUENCER_OT_strip_modifier_add(struct wmOperatorType *ot);
+void SEQUENCER_OT_strip_modifier_remove(struct wmOperatorType *ot);
+void SEQUENCER_OT_strip_modifier_move(struct wmOperatorType *ot);
+
+/* sequencer_view.c */
+void SEQUENCER_OT_sample(struct wmOperatorType *ot);
+
#endif /* __SEQUENCER_INTERN_H__ */
diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c
new file mode 100644
index 00000000000..a4a485b34c6
--- /dev/null
+++ b/source/blender/editors/space_sequencer/sequencer_modifier.c
@@ -0,0 +1,222 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+
+/** \file blender/editors/space_sequencer/sequencer_modifier.c
+ * \ingroup spseq
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_mask_types.h"
+#include "DNA_userdef_types.h"
+
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_sequencer.h"
+#include "BKE_movieclip.h"
+#include "BKE_sequencer.h"
+#include "BKE_mask.h"
+#include "BKE_report.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+/* own include */
+#include "sequencer_intern.h"
+
+/*********************** Add modifier operator *************************/
+
+static int strip_modifier_active_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
+
+ if (ed) {
+ Sequence *seq = BKE_sequencer_active_get(scene);
+
+ if (seq)
+ return BKE_sequence_supports_modifiers(seq);
+ }
+
+ return FALSE;
+}
+
+static int strip_modifier_add_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ Sequence *seq = BKE_sequencer_active_get(scene);
+ int type = RNA_enum_get(op->ptr, "type");
+
+ BKE_sequence_modifier_new(seq, NULL, type);
+
+ BKE_sequence_invalidate_cache(scene, seq);
+ WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_strip_modifier_add(wmOperatorType *ot)
+{
+ PropertyRNA *prop;
+
+ /* identifiers */
+ ot->name = "Add Strip Modifier";
+ ot->idname = "SEQUENCER_OT_strip_modifier_add";
+ ot->description = "Add a modifier to strip";
+
+ /* api callbacks */
+ ot->exec = strip_modifier_add_exec;
+ ot->poll = strip_modifier_active_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ prop = RNA_def_enum(ot->srna, "type", sequence_modifier_type_items, seqModifierType_ColorBalance, "Type", "");
+ ot->prop = prop;
+}
+
+/*********************** Remove modifier operator *************************/
+
+static int strip_modifier_remove_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ Sequence *seq = BKE_sequencer_active_get(scene);
+ char name[MAX_NAME];
+ SequenceModifierData *smd;
+
+ RNA_string_get(op->ptr, "name", name);
+
+ smd = BKE_sequence_modifier_find_by_name(seq, name);
+ if (!smd)
+ return OPERATOR_CANCELLED;
+
+ BLI_remlink(&seq->modifiers, smd);
+ BKE_sequence_modifier_free(smd);
+
+ BKE_sequence_invalidate_cache(scene, seq);
+ WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_strip_modifier_remove(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Remove Strip Modifier";
+ ot->idname = "SEQUENCER_OT_strip_modifier_remove";
+ ot->description = "Add a modifier to strip";
+
+ /* api callbacks */
+ ot->exec = strip_modifier_remove_exec;
+ ot->poll = strip_modifier_active_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
+}
+
+/*********************** Move operator *************************/
+
+enum {
+ SEQ_MODIFIER_MOVE_UP = 0,
+ SEQ_MODIFIER_MOVE_DOWN
+};
+
+static int strip_modifier_move_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene = CTX_data_scene(C);
+ Sequence *seq = BKE_sequencer_active_get(scene);
+ char name[MAX_NAME];
+ int direction;
+ SequenceModifierData *smd;
+
+ RNA_string_get(op->ptr, "name", name);
+ direction = RNA_enum_get(op->ptr, "direction");
+
+ smd = BKE_sequence_modifier_find_by_name(seq, name);
+ if (!smd)
+ return OPERATOR_CANCELLED;
+
+ if (direction == SEQ_MODIFIER_MOVE_UP) {
+ if (smd->prev) {
+ BLI_remlink(&seq->modifiers, smd);
+ BLI_insertlink(&seq->modifiers, smd->prev->prev, smd);
+ }
+ }
+ else if (direction == SEQ_MODIFIER_MOVE_DOWN) {
+ if (smd->next) {
+ BLI_remlink(&seq->modifiers, smd);
+ BLI_insertlink(&seq->modifiers, smd->next, smd);
+ }
+ }
+
+ BKE_sequence_invalidate_cache(scene, seq);
+ WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+
+ return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_strip_modifier_move(wmOperatorType *ot)
+{
+ static EnumPropertyItem direction_items[] = {
+ {SEQ_MODIFIER_MOVE_UP, "UP", 0, "Up", "Move modifier up in the stack"},
+ {SEQ_MODIFIER_MOVE_DOWN, "DOWN", 0, "Down", "Move modifier down in the stack"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ /* identifiers */
+ ot->name = "Move Strip Modifier";
+ ot->idname = "SEQUENCER_OT_strip_modifier_move";
+ ot->description = "Move modifier up and down in the stack";
+
+ /* api callbacks */
+ ot->exec = strip_modifier_move_exec;
+ ot->poll = strip_modifier_active_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+ /* properties */
+ RNA_def_string(ot->srna, "name", "Name", MAX_NAME, "Name", "Name of modifier to remove");
+ RNA_def_enum(ot->srna, "direction", direction_items, SEQ_MODIFIER_MOVE_UP, "Type", "");
+}
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 4a1c8f0c006..aa6bacf8836 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -72,8 +72,7 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_meta_make);
WM_operatortype_append(SEQUENCER_OT_meta_separate);
WM_operatortype_append(SEQUENCER_OT_snap);
- WM_operatortype_append(SEQUENCER_OT_next_edit);
- WM_operatortype_append(SEQUENCER_OT_previous_edit);
+ WM_operatortype_append(SEQUENCER_OT_strip_jump);
WM_operatortype_append(SEQUENCER_OT_swap);
WM_operatortype_append(SEQUENCER_OT_swap_data);
WM_operatortype_append(SEQUENCER_OT_rendersize);
@@ -114,6 +113,14 @@ void sequencer_operatortypes(void)
WM_operatortype_append(SEQUENCER_OT_copy);
WM_operatortype_append(SEQUENCER_OT_paste);
+
+ /* sequencer_modifiers.c */
+ WM_operatortype_append(SEQUENCER_OT_strip_modifier_add);
+ WM_operatortype_append(SEQUENCER_OT_strip_modifier_remove);
+ WM_operatortype_append(SEQUENCER_OT_strip_modifier_move);
+
+ /* sequencer_view.h */
+ WM_operatortype_append(SEQUENCER_OT_sample);
}
@@ -185,8 +192,20 @@ void sequencer_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SEQUENCER_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "SEQUENCER_OT_next_edit", PAGEUPKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "SEQUENCER_OT_previous_edit", PAGEDOWNKEY, KM_PRESS, 0, 0);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_strip_jump", PAGEUPKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(kmi->ptr, "next", TRUE);
+ RNA_boolean_set(kmi->ptr, "center", FALSE);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_strip_jump", PAGEDOWNKEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(kmi->ptr, "next", FALSE);
+ RNA_boolean_set(kmi->ptr, "center", FALSE);
+
+ /* alt for center */
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_strip_jump", PAGEUPKEY, KM_PRESS, KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "next", TRUE);
+ RNA_boolean_set(kmi->ptr, "center", TRUE);
+ kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_strip_jump", PAGEDOWNKEY, KM_PRESS, KM_ALT, 0);
+ RNA_boolean_set(kmi->ptr, "next", FALSE);
+ RNA_boolean_set(kmi->ptr, "center", TRUE);
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", LEFTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_LEFT);
RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_RIGHT);
@@ -319,6 +338,9 @@ void sequencer_keymap(wmKeyConfig *keyconf)
RNA_float_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom_ratio", PAD4, KM_PRESS, 0, 0)->ptr, "ratio", 0.25f);
RNA_float_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom_ratio", PAD8, KM_PRESS, 0, 0)->ptr, "ratio", 0.125f);
#endif
+
+ /* sample */
+ WM_keymap_add_item(keymap, "SEQUENCER_OT_sample", ACTIONMOUSE, KM_PRESS, 0, 0);
}
void ED_operatormacros_sequencer(void)
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
new file mode 100644
index 00000000000..fa39003bd55
--- /dev/null
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -0,0 +1,221 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation,
+ * Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+
+/** \file blender/editors/space_sequencer/sequencer_modifier.c
+ * \ingroup spseq
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+
+#include "DNA_scene_types.h"
+
+#include "BKE_context.h"
+#include "BKE_main.h"
+#include "BKE_sequencer.h"
+#include "BKE_screen.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_image.h"
+#include "ED_screen.h"
+#include "ED_space_api.h"
+
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+#include "UI_view2d.h"
+
+/* own include */
+#include "sequencer_intern.h"
+
+/******************** sample backdrop operator ********************/
+
+typedef struct ImageSampleInfo {
+ ARegionType *art;
+ void *draw_handle;
+ int x, y;
+ int channels;
+
+ unsigned char col[4];
+ float colf[4];
+
+ unsigned char *colp;
+ float *colfp;
+
+ int draw;
+} ImageSampleInfo;
+
+static void sample_draw(const bContext *C, ARegion *ar, void *arg_info)
+{
+ Scene *scene = CTX_data_scene(C);
+ ImageSampleInfo *info = arg_info;
+
+ if (info->draw) {
+ ED_image_draw_info(ar, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT), info->channels,
+ info->x, info->y, info->col, info->colf, NULL, NULL);
+ }
+}
+
+static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
+{
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ SpaceSeq *sseq = (SpaceSeq *) CTX_wm_space_data(C);
+ ARegion *ar = CTX_wm_region(C);
+ ImBuf *ibuf = sequencer_ibuf_get(bmain, scene, sseq, CFRA, 0);
+ ImageSampleInfo *info = op->customdata;
+ float fx, fy;
+
+ if (ibuf == NULL) {
+ IMB_freeImBuf(ibuf);
+ info->draw = 0;
+ return;
+ }
+
+ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
+
+ fx += (float) ibuf->x / 2.0f;
+ fy += (float) ibuf->y / 2.0f;
+
+ if (fx >= 0.0f && fy >= 0.0f && fx < ibuf->x && fy < ibuf->y) {
+ float *fp;
+ unsigned char *cp;
+ int x = (int) fx, y = (int) fy;
+
+ info->x = x;
+ info->y = y;
+ info->draw = 1;
+ info->channels = ibuf->channels;
+
+ info->colp = NULL;
+ info->colfp = NULL;
+
+ if (ibuf->rect) {
+ cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+
+ info->col[0] = cp[0];
+ info->col[1] = cp[1];
+ info->col[2] = cp[2];
+ info->col[3] = cp[3];
+ info->colp = info->col;
+
+ info->colf[0] = (float)cp[0] / 255.0f;
+ info->colf[1] = (float)cp[1] / 255.0f;
+ info->colf[2] = (float)cp[2] / 255.0f;
+ info->colf[3] = (float)cp[3] / 255.0f;
+ info->colfp = info->colf;
+ }
+ if (ibuf->rect_float) {
+ fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
+
+ info->colf[0] = fp[0];
+ info->colf[1] = fp[1];
+ info->colf[2] = fp[2];
+ info->colf[3] = fp[3];
+ info->colfp = info->colf;
+ }
+ }
+ else {
+ info->draw = 0;
+ }
+
+ IMB_freeImBuf(ibuf);
+ ED_area_tag_redraw(CTX_wm_area(C));
+}
+
+static void sample_exit(bContext *C, wmOperator *op)
+{
+ ImageSampleInfo *info = op->customdata;
+
+ ED_region_draw_cb_exit(info->art, info->draw_handle);
+ ED_area_tag_redraw(CTX_wm_area(C));
+ MEM_freeN(info);
+}
+
+static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ ARegion *ar = CTX_wm_region(C);
+ ImageSampleInfo *info;
+
+ info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
+ info->art = ar->type;
+ info->draw_handle = ED_region_draw_cb_activate(ar->type, sample_draw, info, REGION_DRAW_POST_PIXEL);
+ op->customdata = info;
+
+ sample_apply(C, op, event);
+
+ WM_event_add_modal_handler(C, op);
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+static int sample_modal(bContext *C, wmOperator *op, wmEvent *event)
+{
+ switch (event->type) {
+ case LEFTMOUSE:
+ case RIGHTMOUSE: /* XXX hardcoded */
+ sample_exit(C, op);
+ return OPERATOR_CANCELLED;
+ case MOUSEMOVE:
+ sample_apply(C, op, event);
+ break;
+ }
+
+ return OPERATOR_RUNNING_MODAL;
+}
+
+static int sample_cancel(bContext *C, wmOperator *op)
+{
+ sample_exit(C, op);
+
+ return OPERATOR_CANCELLED;
+}
+
+int sample_poll(bContext *C)
+{
+ return BKE_sequencer_editing_get(CTX_data_scene(C), FALSE) != NULL;
+}
+
+void SEQUENCER_OT_sample(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Sample Color";
+ ot->idname = "SEQUENCER_OT_sample";
+ ot->description = "Use mouse to sample color in current frame";
+
+ /* api callbacks */
+ ot->invoke = sample_invoke;
+ ot->modal = sample_modal;
+ ot->cancel = sample_cancel;
+ ot->poll = sample_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_BLOCKING;
+}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 6240d174575..97eb5b41db7 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -39,6 +39,7 @@
#include "BLF_api.h"
#include "BLI_blenlib.h"
+#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "DNA_text_types.h"
@@ -1231,7 +1232,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0);
uiSetRoundBox(UI_CNR_ALL);
- rad = 0.4f * MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin);
+ rad = 0.4f * mini(BLI_RCT_SIZE_X(&st->txtscroll), BLI_RCT_SIZE_Y(&st->txtscroll));
UI_GetThemeColor3ubv(TH_HILITE, col);
col[3] = 48;
glColor4ubv(col);
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index df90ce24dda..5af44f93d06 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -2409,8 +2409,8 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* jump scroll, works in v2d but needs to be added here too :S */
if (event->type == MIDDLEMOUSE) {
- tsc->old[0] = ar->winrct.xmin + (st->txtbar.xmax + st->txtbar.xmin) / 2;
- tsc->old[1] = ar->winrct.ymin + (st->txtbar.ymax + st->txtbar.ymin) / 2;
+ tsc->old[0] = ar->winrct.xmin + BLI_RCT_CENTER_X(&st->txtbar);
+ tsc->old[1] = ar->winrct.ymin + BLI_RCT_CENTER_Y(&st->txtbar);
tsc->delta[0] = 0;
tsc->delta[1] = 0;
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index 189c8bfc7d0..733fd27135b 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -151,7 +151,7 @@ static int time_view_all_exec(bContext *C, wmOperator *UNUSED(op))
v2d->cur.xmax = (float)PEFRA;
/* we need an extra "buffer" factor on either side so that the endpoints are visible */
- extra = 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
+ extra = 0.01f * BLI_RCT_SIZE_X(&v2d->cur);
v2d->cur.xmin -= extra;
v2d->cur.xmax += extra;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index b31550af289..6a9be8d979c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -193,6 +193,17 @@ static void drawcircle_size(float size);
static void draw_empty_sphere(float size);
static void draw_empty_cone(float size);
+static void ob_wire_color_blend_theme_id(const unsigned char ob_wire_col[4], const int theme_id, float fac)
+{
+ float col_wire[3], col_bg[3], col[3];
+
+ rgb_uchar_to_float(col_wire, ob_wire_col);
+
+ UI_GetThemeColor3fv(theme_id, col_bg);
+ interp_v3_v3v3(col, col_bg, col_wire, fac);
+ glColor3fv(col);
+}
+
/* this condition has been made more complex since editmode can draw textures */
static int check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype)
{
@@ -653,7 +664,7 @@ void drawaxes(float size, char drawtype)
/* Function to draw an Image on a empty Object */
-static void draw_empty_image(Object *ob)
+static void draw_empty_image(Object *ob, const short dflag, const unsigned char ob_wire_col[4])
{
Image *ima = (Image *)ob->data;
ImBuf *ibuf = ima ? BKE_image_get_ibuf(ima, NULL) : NULL;
@@ -726,15 +737,17 @@ static void draw_empty_image(Object *ob)
glDisable(GL_BLEND);
}
- UI_ThemeColor((ob->flag & SELECT) ? TH_SELECT : TH_WIRE);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ glColor3ubv(ob_wire_col);
- /* Calculate the outline vertex positions */
- glBegin(GL_LINE_LOOP);
- glVertex2f(ofs_x, ofs_y);
- glVertex2f(ofs_x + ima_x, ofs_y);
- glVertex2f(ofs_x + ima_x, ofs_y + ima_y);
- glVertex2f(ofs_x, ofs_y + ima_y);
- glEnd();
+ /* Calculate the outline vertex positions */
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(ofs_x, ofs_y);
+ glVertex2f(ofs_x + ima_x, ofs_y);
+ glVertex2f(ofs_x + ima_x, ofs_y + ima_y);
+ glVertex2f(ofs_x, ofs_y + ima_y);
+ glEnd();
+ }
/* Reset GL settings */
glMatrixMode(GL_MODELVIEW);
@@ -1559,17 +1572,18 @@ static void draw_bundle_sphere(void)
static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D *v3d,
MovieClip *clip, MovieTrackingObject *tracking_object,
- const short dflag, int *global_track_index, int draw_selected)
+ const short dflag, const unsigned char ob_wire_col[4],
+ int *global_track_index, int draw_selected)
{
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
float mat[4][4], imat[4][4];
- unsigned char col[4], scol[4];
+ unsigned char col_unsel[4], col_sel[4];
int tracknr = *global_track_index;
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
- UI_GetThemeColor4ubv(TH_TEXT, col);
- UI_GetThemeColor4ubv(TH_SELECT, scol);
+ UI_GetThemeColor4ubv(TH_TEXT, col_unsel);
+ UI_GetThemeColor4ubv(TH_SELECT, col_sel);
BKE_tracking_get_camera_object_matrix(scene, base->object, mat);
@@ -1612,13 +1626,13 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
if (v3d->drawtype == OB_WIRE) {
glDisable(GL_LIGHTING);
- if (selected) {
- if (base == BASACT) UI_ThemeColor(TH_ACTIVE);
- else UI_ThemeColor(TH_SELECT);
- }
- else {
- if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
- else UI_ThemeColor(TH_WIRE);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ if (selected && (track->flag & TRACK_CUSTOMCOLOR) == 0) {
+ glColor3ubv(ob_wire_col);
+ }
+ else {
+ glColor3fv(track->color);
+ }
}
drawaxes(0.05f, v3d->bundle_drawtype);
@@ -1629,8 +1643,9 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
if (v3d->bundle_drawtype == OB_EMPTY_SPHERE) {
/* selection outline */
if (selected) {
- if (base == BASACT) UI_ThemeColor(TH_ACTIVE);
- else UI_ThemeColor(TH_SELECT);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ glColor3ubv(ob_wire_col);
+ }
glLineWidth(2.f);
glDisable(GL_LIGHTING);
@@ -1643,21 +1658,24 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
glLineWidth(1.f);
}
- if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
- else UI_ThemeColor(TH_BUNDLE_SOLID);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ else UI_ThemeColor(TH_BUNDLE_SOLID);
+ }
draw_bundle_sphere();
}
else {
glDisable(GL_LIGHTING);
- if (selected) {
- if (base == BASACT) UI_ThemeColor(TH_ACTIVE);
- else UI_ThemeColor(TH_SELECT);
- }
- else {
- if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
- else UI_ThemeColor(TH_WIRE);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ if (selected) {
+ glColor3ubv(ob_wire_col);
+ }
+ else {
+ if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+ else UI_ThemeColor(TH_WIRE);
+ }
}
drawaxes(0.05f, v3d->bundle_drawtype);
@@ -1670,13 +1688,9 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
if ((dflag & DRAW_PICKING) == 0 && (v3d->flag2 & V3D_SHOW_BUNDLENAME)) {
float pos[3];
- unsigned char tcol[4];
-
- if (selected) memcpy(tcol, scol, sizeof(tcol));
- else memcpy(tcol, col, sizeof(tcol));
mul_v3_m4v3(pos, mat, track->bundle_pos);
- view3d_cached_text_draw_add(pos, track->name, 10, V3D_CACHE_TEXT_GLOBALSPACE, tcol);
+ view3d_cached_text_draw_add(pos, track->name, 10, V3D_CACHE_TEXT_GLOBALSPACE, selected ? col_sel : col_unsel);
}
tracknr++;
@@ -1734,7 +1748,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
tracking_object = tracking->objects.first;
while (tracking_object) {
draw_viewport_object_reconstruction(scene, base, v3d, clip, tracking_object,
- dflag, &global_track_index, draw_selected);
+ dflag, ob_wire_col, &global_track_index, draw_selected);
tracking_object = tracking_object->next;
}
@@ -2242,9 +2256,9 @@ void mesh_foreachScreenFace(
}
void nurbs_foreachScreenVert(
- ViewContext *vc,
- void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y),
- void *userData)
+ ViewContext *vc,
+ void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y),
+ void *userData)
{
Curve *cu = vc->obedit->data;
short s[2] = {IS_CLIPPED, 0};
@@ -3354,7 +3368,7 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
}
static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
- const short dt, const short dflag)
+ const short dt, const unsigned char ob_wire_col[4], const short dflag)
{
Object *ob = base->object;
Mesh *me = ob->data;
@@ -3428,13 +3442,12 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
if (!(draw_flags & DRAW_FACE_SELECT)) {
- if (base->flag & SELECT)
- UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
- else
- UI_ThemeColor(TH_WIRE);
-
- if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
+ if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ glColor3ubv(ob_wire_col);
+ }
dm->drawLooseEdges(dm);
+ }
}
}
else if (dt == OB_SOLID) {
@@ -3518,14 +3531,12 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
- if (base->flag & SELECT) {
- UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
- }
- else {
- UI_ThemeColor(TH_WIRE);
- }
- if (!ob->sculpt && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
+ if (!ob->sculpt && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ glColor3ubv(ob_wire_col);
+ }
dm->drawLooseEdges(dm);
+ }
}
}
else if (dt == OB_PAINT) {
@@ -3534,42 +3545,22 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* since we already draw wire as wp guide, don't draw over the top */
draw_wire = OBDRAW_WIRE_OFF;
}
-
- /* set default draw color back for wire or for draw-extra later on */
- if (dt != OB_WIRE) {
- if (base->flag & SELECT) {
- if (is_obact && ob->flag & OB_FROMGROUP)
- UI_ThemeColor(TH_GROUP_ACTIVE);
- else if (ob->flag & OB_FROMGROUP)
- UI_ThemeColorShade(TH_GROUP_ACTIVE, -16);
- else if (dflag != DRAW_CONSTCOLOR)
- UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
- else
- glColor3ub(80, 80, 80);
- }
- else {
- if (ob->flag & OB_FROMGROUP)
- UI_ThemeColor(TH_GROUP);
- else {
- if (ob->dtx & OB_DRAWWIRE && dflag == DRAW_CONSTCOLOR)
- glColor3ub(80, 80, 80);
- else
- UI_ThemeColor(TH_WIRE);
- }
- }
- }
- if (draw_wire != OBDRAW_WIRE_OFF) {
+ if ((draw_wire != OBDRAW_WIRE_OFF) && /* draw extra wire */
+ /* when overriding with render only, don't bother */
+ (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID) == 0))
+ {
/* When using wireframe object draw in particle edit mode
* the mesh gets in the way of seeing the particles, fade the wire color
* with the background. */
- if (is_obact && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
- float col_wire[4], col_bg[4], col[3];
- UI_GetThemeColor3fv(TH_BACK, col_bg);
- glGetFloatv(GL_CURRENT_COLOR, col_wire);
- interp_v3_v3v3(col, col_bg, col_wire, 0.15);
- glColor3fv(col);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ if (is_obact && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
+ ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.15f);
+ }
+ else {
+ glColor3ubv(ob_wire_col);
+ }
}
/* If drawing wire and drawtype is not OB_WIRE then we are
@@ -3586,8 +3577,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */
}
- if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID) == 0)
- dm->drawEdges(dm, (dt == OB_WIRE || totface == 0), me->drawflag & ME_ALLEDGES);
+ dm->drawEdges(dm, (dt == OB_WIRE || totface == 0), me->drawflag & ME_ALLEDGES);
if (dt != OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
glDepthMask(1);
@@ -3609,7 +3599,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
/* returns 1 if nothing was drawn, for detecting to draw an object center */
static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base,
- const short dt, const short dflag)
+ const short dt, const unsigned char ob_wire_col[4], const short dflag)
{
Object *ob = base->object;
Object *obedit = scene->obedit;
@@ -3673,7 +3663,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
(check_alpha) ? &do_alpha_after : NULL);
}
- draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, dflag);
+ draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
GPU_end_object_materials();
@@ -5913,9 +5903,9 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[
glVertex3f(cur[0], cur[1] - radius, cur[2]);
glEnd();
}
-/* return 1 if nothing was drawn */
+/* return TRUE if nothing was drawn */
static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
- const short dt, const unsigned char ob_wire_col[4])
+ const short dt, const short dflag, const unsigned char ob_wire_col[4])
{
Object *ob = base->object;
MetaBall *mb;
@@ -5942,27 +5932,32 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
ml = mb->elems.first;
}
- if (ml == NULL) return 1;
+ if (ml == NULL) {
+ return TRUE;
+ }
- if (v3d->flag2 & V3D_RENDER_OVERRIDE) return 0;
-
- /* in case solid draw, reset wire colors */
- if (ob->flag & SELECT) {
- if (ob == OBACT) UI_ThemeColor(TH_ACTIVE);
- else UI_ThemeColor(TH_SELECT);
+ if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+ return FALSE;
}
- else UI_ThemeColor(TH_WIRE);
invert_m4_m4(imat, rv3d->viewmatob);
normalize_v3(imat[0]);
normalize_v3(imat[1]);
+
+ if (mb->editelems == NULL) {
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ glColor3ubv(ob_wire_col);
+ }
+ }
while (ml) {
/* draw radius */
if (mb->editelems) {
- if ((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
- else cpack(0x3030A0);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ if ((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
+ else cpack(0x3030A0);
+ }
if (G.f & G_PICKSEL) {
ml->selcol1 = code;
@@ -5973,8 +5968,10 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
/* draw stiffness */
if (mb->editelems) {
- if ((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
- else cpack(0x30A030);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ if ((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
+ else cpack(0x30A030);
+ }
if (G.f & G_PICKSEL) {
ml->selcol2 = code;
@@ -5985,23 +5982,16 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
ml = ml->next;
}
- return 0;
+ return FALSE;
}
-static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
+static void draw_forcefield(Object *ob, RegionView3D *rv3d,
+ const short dflag, const unsigned char ob_wire_col[4])
{
PartDeflect *pd = ob->pd;
float imat[4][4], tmat[4][4];
float vec[3] = {0.0, 0.0, 0.0};
- int curcol;
float size;
-
- /* XXX why? */
- if (ob != scene->obedit && (ob->flag & SELECT)) {
- if (ob == OBACT) curcol = TH_ACTIVE;
- else curcol = TH_SELECT;
- }
- else curcol = TH_EMPTY;
/* scale size of circle etc with the empty drawsize */
if (ob->type == OB_EMPTY) size = ob->empty_drawsize;
@@ -6014,16 +6004,19 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
if (pd->forcefield == PFIELD_WIND) {
float force_val;
-
- unit_m4(tmat);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
-
+
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.5f);
+ }
+
//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
// force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
//else
{
force_val = pd->f_strength;
}
+
+ unit_m4(tmat);
force_val *= 0.1f;
drawcircball(GL_LINE_LOOP, vec, size, tmat);
vec[2] = 0.5f * force_val;
@@ -6045,11 +6038,11 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
ffall_val = pd->f_power;
}
- UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.5f);
drawcircball(GL_LINE_LOOP, vec, size, imat);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(1.5f, ffall_val));
+ if ((dflag & DRAW_CONSTCOLOR) == 0) ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.9f - 0.4f / powf(1.5f, ffall_val));
drawcircball(GL_LINE_LOOP, vec, size * 1.5f, imat);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(2.0f, ffall_val));
+ if ((dflag & DRAW_CONSTCOLOR) == 0) ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.9f - 0.4f / powf(2.0f, ffall_val));
drawcircball(GL_LINE_LOOP, vec, size * 2.0f, imat);
}
else if (pd->forcefield == PFIELD_VORTEX) {
@@ -6068,7 +6061,10 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
force_val = pd->f_strength;
}
- UI_ThemeColorBlend(curcol, TH_BACK, 0.7f);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.7f);
+ }
+
if (force_val < 0) {
drawspiral(vec, size, tmat, 1);
drawspiral(vec, size, tmat, 16);
@@ -6090,16 +6086,18 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
mindist = pd->f_strength;
}
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.5f);
+ }
+
/*path end*/
setlinestyle(3);
where_on_path(ob, 1.0f, guidevec1, guidevec2, NULL, NULL, NULL);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
/*path beginning*/
setlinestyle(0);
where_on_path(ob, 0.0f, guidevec1, guidevec2, NULL, NULL, NULL);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
copy_v3_v3(vec, guidevec1); /* max center */
@@ -6107,7 +6105,10 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
}
setlinestyle(3);
- UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
+
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ ob_wire_color_blend_theme_id(ob_wire_col, TH_BACK, 0.5f);
+ }
if (pd->falloff == PFIELD_FALL_SPHERE) {
/* as last, guide curve alters it */
@@ -6357,59 +6358,46 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
glDepthMask(1);
}
-static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob)
+static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, unsigned char ob_wire_col[4])
{
- if (ob != scene->obedit && (ob->flag & SELECT)) {
- if (ob == OBACT) {
- if (ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP_ACTIVE);
- else UI_ThemeColor(TH_ACTIVE);
+ if (ELEM4(ob->type, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL)) {
+
+ if (scene->obedit == ob) {
+ UI_ThemeColor(TH_WIRE);
}
- else if (ob->flag & OB_FROMGROUP)
- UI_ThemeColorShade(TH_GROUP_ACTIVE, -16);
- else
- UI_ThemeColor(TH_SELECT);
- }
- else {
- if (ob->flag & OB_FROMGROUP)
- UI_ThemeColor(TH_GROUP);
else {
- if (ob->dtx & OB_DRAWWIRE) {
- glColor3ub(80, 80, 80);
- }
- else {
- UI_ThemeColor(TH_WIRE);
- }
+ glColor3ubv(ob_wire_col);
}
- }
-
- bglPolygonOffset(rv3d->dist, 1.0);
- glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */
- if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
- Curve *cu = ob->data;
- if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
- if (ob->type == OB_CURVE)
- draw_index_wire = 0;
+ bglPolygonOffset(rv3d->dist, 1.0);
+ glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */
+
+ if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
+ Curve *cu = ob->data;
+ if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+ if (ob->type == OB_CURVE)
+ draw_index_wire = 0;
+
+ if (ob->derivedFinal) {
+ drawCurveDMWired(ob);
+ }
+ else {
+ drawDispListwire(&ob->disp);
+ }
- if (ob->derivedFinal) {
- drawCurveDMWired(ob);
+ if (ob->type == OB_CURVE)
+ draw_index_wire = 1;
}
- else {
+ }
+ else if (ob->type == OB_MBALL) {
+ if (BKE_mball_is_basis(ob)) {
drawDispListwire(&ob->disp);
}
-
- if (ob->type == OB_CURVE)
- draw_index_wire = 1;
- }
- }
- else if (ob->type == OB_MBALL) {
- if (BKE_mball_is_basis(ob)) {
- drawDispListwire(&ob->disp);
}
- }
- glDepthMask(1);
- bglPolygonOffset(rv3d->dist, 0.0);
+ glDepthMask(1);
+ bglPolygonOffset(rv3d->dist, 0.0);
+ }
}
/* should be called in view space */
@@ -6550,7 +6538,10 @@ static void draw_object_wire_color(Scene *scene, Base *base, unsigned char r_ob_
r_ob_wire_col[3] = 255;
}
-/* flag can be DRAW_PICKING and/or DRAW_CONSTCOLOR, DRAW_SCENESET */
+/**
+ * main object drawing function, draws in selection
+ * \param dflag (draw flag) can be DRAW_PICKING and/or DRAW_CONSTCOLOR, DRAW_SCENESET
+ */
void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short dflag)
{
static int warning_recursive = 0;
@@ -6692,7 +6683,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
switch (ob->type) {
case OB_MESH:
- empty_object = draw_mesh_object(scene, ar, v3d, rv3d, base, dt, dflag);
+ empty_object = draw_mesh_object(scene, ar, v3d, rv3d, base, dt, ob_wire_col, dflag);
if (dflag != DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
break;
@@ -6812,20 +6803,20 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
MetaBall *mb = ob->data;
if (mb->editelems)
- drawmball(scene, v3d, rv3d, base, dt, ob_wire_col);
+ drawmball(scene, v3d, rv3d, base, dt, dflag, ob_wire_col);
else if (dt == OB_BOUNDBOX) {
if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) {
draw_bounding_volume(scene, ob, ob->boundtype);
}
}
else
- empty_object = drawmball(scene, v3d, rv3d, base, dt, ob_wire_col);
+ empty_object = drawmball(scene, v3d, rv3d, base, dt, dflag, ob_wire_col);
break;
}
case OB_EMPTY:
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
- draw_empty_image(ob);
+ draw_empty_image(ob, dflag, ob_wire_col);
}
else {
drawaxes(ob->empty_drawsize, ob->empty_drawtype);
@@ -6897,7 +6888,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
if (ob->pd && ob->pd->forcefield) {
- draw_forcefield(scene, ob, rv3d);
+ draw_forcefield(ob, rv3d, dflag, ob_wire_col);
}
}
@@ -7106,7 +7097,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
/*if (dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
if ((dtx & OB_DRAWWIRE) && dt >= OB_SOLID) {
- drawWireExtra(scene, rv3d, ob);
+ if ((dflag & DRAW_CONSTCOLOR) == 0) {
+ draw_wire_extra(scene, rv3d, ob, ob_wire_col);
+ }
}
}
}
@@ -7578,7 +7571,8 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
break;
case OB_EMPTY:
if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
- draw_empty_image(ob);
+ /* CONSTCOLOR == no wire outline */
+ draw_empty_image(ob, DRAW_CONSTCOLOR, NULL);
}
else {
drawaxes(ob->empty_drawsize, ob->empty_drawtype);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 199a1751f9d..24395865a5e 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -971,10 +971,10 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV
rect_camera = params.viewplane;
/* get camera border within viewport */
- viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin) / (rect_view.xmax - rect_view.xmin)) * ar->winx;
- viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin) / (rect_view.xmax - rect_view.xmin)) * ar->winx;
- viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin) / (rect_view.ymax - rect_view.ymin)) * ar->winy;
- viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin) / (rect_view.ymax - rect_view.ymin)) * ar->winy;
+ viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin) / BLI_RCT_SIZE_X(&rect_view)) * ar->winx;
+ viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin) / BLI_RCT_SIZE_X(&rect_view)) * ar->winx;
+ viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin) / BLI_RCT_SIZE_Y(&rect_view)) * ar->winy;
+ viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin) / BLI_RCT_SIZE_Y(&rect_view)) * ar->winy;
}
void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2])
@@ -982,8 +982,8 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R
rctf viewborder;
view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE);
- size_r[0] = viewborder.xmax - viewborder.xmin;
- size_r[1] = viewborder.ymax - viewborder.ymin;
+ size_r[0] = BLI_RCT_SIZE_X(&viewborder);
+ size_r[1] = BLI_RCT_SIZE_Y(&viewborder);
}
void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d,
@@ -1339,7 +1339,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
glDisable(GL_MULTISAMPLE_ARB);
region_scissor_winrct(ar, &winrct);
- glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin);
+ glScissor(winrct.xmin, winrct.ymin, BLI_RCT_SIZE_X(&winrct), BLI_RCT_SIZE_Y(&winrct));
glClearColor(0.0, 0.0, 0.0, 0.0);
if (v3d->zbuf) {
@@ -2038,8 +2038,8 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
x = rect->xmin;
y = rect->ymin;
- w = rect->xmax - rect->xmin;
- h = rect->ymax - rect->ymin;
+ w = BLI_RCT_SIZE_X(rect);
+ h = BLI_RCT_SIZE_Y(rect);
if (w <= 0 || h <= 0) {
if (d->depths)
@@ -2846,10 +2846,10 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
- cliprct.xmin = viewborder.xmin + scene->r.border.xmin * (viewborder.xmax - viewborder.xmin);
- cliprct.ymin = viewborder.ymin + scene->r.border.ymin * (viewborder.ymax - viewborder.ymin);
- cliprct.xmax = viewborder.xmin + scene->r.border.xmax * (viewborder.xmax - viewborder.xmin);
- cliprct.ymax = viewborder.ymin + scene->r.border.ymax * (viewborder.ymax - viewborder.ymin);
+ cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_RCT_SIZE_X(&viewborder);
+ cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_RCT_SIZE_Y(&viewborder);
+ cliprct.xmax = viewborder.xmin + scene->r.border.xmax * BLI_RCT_SIZE_X(&viewborder);
+ cliprct.ymax = viewborder.ymin + scene->r.border.ymax * BLI_RCT_SIZE_Y(&viewborder);
cliprct.xmin += ar->winrct.xmin;
cliprct.xmax += ar->winrct.xmin;
@@ -2863,7 +2863,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
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);
+ glScissor(cliprct.xmin, cliprct.ymin, BLI_RCT_SIZE_X(&cliprct), BLI_RCT_SIZE_Y(&cliprct));
}
else
return 0;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 8b8adb193bf..e74bda87a43 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -382,10 +382,10 @@ static void calctrackballvec(rcti *rect, int mx, int my, float vec[3])
radius = TRACKBALLSIZE;
/* normalize x and y */
- x = (rect->xmax + rect->xmin) / 2 - mx;
- x /= (float)((rect->xmax - rect->xmin) / 4);
- y = (rect->ymax + rect->ymin) / 2 - my;
- y /= (float)((rect->ymax - rect->ymin) / 2);
+ x = BLI_RCT_CENTER_X(rect) - mx;
+ x /= (float)(BLI_RCT_SIZE_X(rect) / 4);
+ y = BLI_RCT_CENTER_Y(rect) - my;
+ y /= (float)(BLI_RCT_SIZE_Y(rect) / 2);
d = sqrt(x * x + y * y);
if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */
@@ -662,8 +662,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
if (vod->use_dyn_ofs) {
/* compute the post multiplication quat, to rotate the offset correctly */
- copy_qt_qt(q1, vod->oldquat);
- conjugate_qt(q1);
+ conjugate_qt_qt(q1, vod->oldquat);
mul_qt_qtqt(q1, q1, vod->viewquat);
conjugate_qt(q1); /* conj == inv for unit quat */
@@ -1022,9 +1021,10 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
/* tune these until everything feels right */
const float rot_sensitivity = 1.f;
+#if 0
const float zoom_sensitivity = 1.f;
+#endif
const float pan_sensitivity = 1.f;
-
const int has_rotation = rv3d->viewlock != RV3D_LOCKED && !is_zero_v3(ndof->rvec);
float view_inv[4];
@@ -1036,20 +1036,6 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
#endif
- if (ndof->tz) {
- /* Zoom!
- * velocity should be proportional to the linear velocity attained by rotational motion of same strength
- * [got that?]
- * proportional to arclength = radius * angle
- */
- float zoom_distance = zoom_sensitivity * rv3d->dist * dt * ndof->tz;
-
- if (U.ndof_flag & NDOF_ZOOM_INVERT)
- zoom_distance = -zoom_distance;
-
- rv3d->dist += zoom_distance;
- }
-
if (rv3d->viewlock == RV3D_LOCKED) {
/* rotation not allowed -- explore panning options instead */
float pan_vec[3] = {ndof->tx, ndof->ty, 0.0f};
@@ -1067,34 +1053,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
rv3d->view = RV3D_VIEW_USER;
- if (U.flag & USER_TRACKBALL) {
- float rot[4];
- float axis[3];
- float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
-
- if (U.ndof_flag & NDOF_ROLL_INVERT_AXIS)
- axis[2] = -axis[2];
-
- if (U.ndof_flag & NDOF_TILT_INVERT_AXIS)
- axis[0] = -axis[0];
-
- if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
- axis[1] = -axis[1];
-
- /* transform rotation axis from view to world coordinates */
- mul_qt_v3(view_inv, axis);
-
- /* update the onscreen doo-dad */
- rv3d->rot_angle = angle;
- copy_v3_v3(rv3d->rot_axis, axis);
-
- axis_angle_to_quat(rot, axis, angle);
-
- /* apply rotation */
- mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
-
- }
- else {
+ if (U.ndof_flag & NDOF_TURNTABLE) {
/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
float angle, rot[4];
@@ -1127,6 +1086,33 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
rot[3] = sin(angle);
mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
}
+ else {
+ float rot[4];
+ float axis[3];
+ float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
+
+ if (U.ndof_flag & NDOF_ROLL_INVERT_AXIS)
+ axis[2] = -axis[2];
+
+ if (U.ndof_flag & NDOF_TILT_INVERT_AXIS)
+ axis[0] = -axis[0];
+
+ if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
+ axis[1] = -axis[1];
+
+ /* transform rotation axis from view to world coordinates */
+ mul_qt_v3(view_inv, axis);
+
+ /* update the onscreen doo-dad */
+ rv3d->rot_angle = angle;
+ copy_v3_v3(rv3d->rot_axis, axis);
+
+ axis_angle_to_quat(rot, axis, angle);
+
+ /* apply rotation */
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+
+ }
}
}
@@ -1247,6 +1233,160 @@ void VIEW3D_OT_ndof_pan(struct wmOperatorType *ot)
ot->flag = 0;
}
+
+/*
+* this is basically just the pan only code + the rotate only code crammed into one function that does both
+*/
+static int ndof_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ if (event->type != NDOF_MOTION)
+ return OPERATOR_CANCELLED;
+ else {
+
+ ViewOpsData *vod;
+ RegionView3D *rv3d;
+
+ View3D *v3d = CTX_wm_view3d(C);
+ wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
+
+ viewops_data_create(C, op, event);
+ vod = op->customdata;
+ rv3d = vod->rv3d;
+
+ ED_view3d_camera_lock_init(v3d, rv3d);
+
+ if (ndof->progress != P_FINISHING) {
+
+ const float dt = ndof->dt;
+ float view_inv[4];
+
+ float speed = 10.f; /* blender units per second */
+ /* ^^ this is ok for default cube scene, but should scale with.. something */
+
+ /* tune these until everything feels right */
+ const float forward_sensitivity = 1.f;
+ const float vertical_sensitivity = 0.4f;
+ const float lateral_sensitivity = 0.6f;
+
+ float pan_vec[3];
+ const float rot_sensitivity = 1.f;
+#if 0
+ const float zoom_sensitivity = 1.f;
+ const float pan_sensitivity = 1.f;
+ float rot[4];
+ float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
+ float axis[3];
+#endif
+
+ if (U.ndof_flag & NDOF_PANX_INVERT_AXIS)
+ pan_vec[0] = -lateral_sensitivity * ndof->tvec[0];
+ else
+ pan_vec[0] = lateral_sensitivity * ndof->tvec[0];
+
+ if (U.ndof_flag & NDOF_PANZ_INVERT_AXIS)
+ pan_vec[1] = -vertical_sensitivity * ndof->tvec[1];
+ else
+ pan_vec[1] = vertical_sensitivity * ndof->tvec[1];
+
+ if (U.ndof_flag & NDOF_PANY_INVERT_AXIS)
+ pan_vec[2] = -forward_sensitivity * ndof->tvec[2];
+ else
+ pan_vec[2] = forward_sensitivity * ndof->tvec[2];
+
+ mul_v3_fl(pan_vec, speed * dt);
+
+ /* transform motion from view to world coordinates */
+ invert_qt_qt(view_inv, rv3d->viewquat);
+ mul_qt_v3(view_inv, pan_vec);
+
+ /* move center of view opposite of hand motion (this is camera mode, not object mode) */
+ sub_v3_v3(rv3d->ofs, pan_vec);
+
+ if (U.ndof_flag & NDOF_TURNTABLE) {
+ /* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
+ float angle, rot[4];
+ float xvec[3] = {1, 0, 0};
+
+ /* Determine the direction of the x vector (for rotating up and down) */
+ mul_qt_v3(view_inv, xvec);
+
+ /* Perform the up/down rotation */
+ angle = rot_sensitivity * dt * ndof->rx;
+ if (U.ndof_flag & NDOF_TILT_INVERT_AXIS)
+ angle = -angle;
+ rot[0] = cos(angle);
+ mul_v3_v3fl(rot + 1, xvec, sin(angle));
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+
+ /* Perform the orbital rotation */
+ angle = rot_sensitivity * dt * ndof->ry;
+ if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
+ angle = -angle;
+
+ /* update the onscreen doo-dad */
+ rv3d->rot_angle = angle;
+ rv3d->rot_axis[0] = 0;
+ rv3d->rot_axis[1] = 0;
+ rv3d->rot_axis[2] = 1;
+
+ rot[0] = cos(angle);
+ rot[1] = rot[2] = 0.0;
+ rot[3] = sin(angle);
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+
+ }
+ else {
+
+ float rot[4];
+ float axis[3];
+ float angle = rot_sensitivity * ndof_to_axis_angle(ndof, axis);
+
+ if (U.ndof_flag & NDOF_ROLL_INVERT_AXIS)
+ axis[2] = -axis[2];
+
+ if (U.ndof_flag & NDOF_TILT_INVERT_AXIS)
+ axis[0] = -axis[0];
+
+ if (U.ndof_flag & NDOF_ROTATE_INVERT_AXIS)
+ axis[1] = -axis[1];
+
+ /* transform rotation axis from view to world coordinates */
+ mul_qt_v3(view_inv, axis);
+
+ /* update the onscreen doo-dad */
+ rv3d->rot_angle = angle;
+ copy_v3_v3(rv3d->rot_axis, axis);
+
+ axis_angle_to_quat(rot, axis, angle);
+
+ /* apply rotation */
+ mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
+
+ }
+ }
+ ED_view3d_camera_lock_sync(v3d, rv3d);
+
+ ED_region_tag_redraw(CTX_wm_region(C));
+ viewops_data_free(C, op);
+ return OPERATOR_FINISHED;
+ }
+}
+
+void VIEW3D_OT_ndof_all(struct wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "NDOF move View";
+ ot->description = "Position your viewpoint with the 3D mouse";
+ ot->idname = "VIEW3D_OT_ndof_all";
+
+ /* api callbacks */
+ ot->invoke = ndof_all_invoke;
+ ot->poll = ED_operator_view3d_active;
+
+ /* flags */
+ ot->flag = 0;
+}
+
/* ************************ viewmove ******************************** */
@@ -1525,8 +1665,8 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
int ctr[2], len1, len2;
/* method which zooms based on how far you move the mouse */
- ctr[0] = (vod->ar->winrct.xmax + vod->ar->winrct.xmin) / 2;
- ctr[1] = (vod->ar->winrct.ymax + vod->ar->winrct.ymin) / 2;
+ ctr[0] = BLI_RCT_CENTER_X(&vod->ar->winrct);
+ ctr[1] = BLI_RCT_CENTER_Y(&vod->ar->winrct);
len1 = (int)sqrt((ctr[0] - x) * (ctr[0] - x) + (ctr[1] - y) * (ctr[1] - y)) + 5;
len2 = (int)sqrt((ctr[0] - vod->origx) * (ctr[0] - vod->origx) + (ctr[1] - vod->origy) * (ctr[1] - vod->origy)) + 5;
@@ -2072,7 +2212,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
continue;
}
- BKE_object_minmax(base->object, min, max);
+ BKE_object_minmax(base->object, min, max, FALSE);
}
}
if (!onedone) {
@@ -2218,8 +2358,8 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
}
/* account for duplis */
- if (BKE_object_minmax_dupli(scene, base->object, min, max) == 0)
- BKE_object_minmax(base->object, min, max); /* use if duplis not found */
+ if (BKE_object_minmax_dupli(scene, base->object, min, max, FALSE) == 0)
+ BKE_object_minmax(base->object, min, max, FALSE); /* use if duplis not found */
ok = 1;
}
@@ -2476,10 +2616,10 @@ static int render_border_exec(bContext *C, wmOperator *op)
/* calculate range */
ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
- scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / (vb.xmax - vb.xmin);
- scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / (vb.ymax - vb.ymin);
- scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / (vb.xmax - vb.xmin);
- scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / (vb.ymax - vb.ymin);
+ scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / BLI_RCT_SIZE_X(&vb);
+ scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / BLI_RCT_SIZE_Y(&vb);
+ scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / BLI_RCT_SIZE_X(&vb);
+ scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / BLI_RCT_SIZE_Y(&vb);
/* actually set border */
CLAMP(scene->r.border.xmin, 0.0f, 1.0f);
@@ -2643,8 +2783,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
}
/* work out the ratios, so that everything selected fits when we zoom */
- xscale = ((rect.xmax - rect.xmin) / vb[0]);
- yscale = ((rect.ymax - rect.ymin) / vb[1]);
+ xscale = (BLI_RCT_SIZE_X(&rect) / vb[0]);
+ yscale = (BLI_RCT_SIZE_Y(&rect) / vb[1]);
new_dist *= maxf(xscale, yscale);
/* zoom in as required, or as far as we can go */
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 561e97a8393..855771b17a2 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -489,7 +489,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
else if (event->type == NDOF_MOTION) {
/* do these automagically get delivered? yes. */
// puts("ndof motion detected in fly mode!");
- // static const char* tag_name = "3D mouse position";
+ // static const char *tag_name = "3D mouse position";
wmNDOFMotionData *incoming_ndof = (wmNDOFMotionData *)event->customdata;
switch (incoming_ndof->progress) {
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index a6a22d85cd9..996525d2be4 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -79,6 +79,7 @@ void VIEW3D_OT_move(struct wmOperatorType *ot);
void VIEW3D_OT_rotate(struct wmOperatorType *ot);
void VIEW3D_OT_ndof_orbit(struct wmOperatorType *ot);
void VIEW3D_OT_ndof_pan(struct wmOperatorType *ot);
+void VIEW3D_OT_ndof_all(struct wmOperatorType *ot);
void VIEW3D_OT_view_all(struct wmOperatorType *ot);
void VIEW3D_OT_viewnumpad(struct wmOperatorType *ot);
void VIEW3D_OT_view_selected(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 7b3e7358978..14c02c2357e 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -64,6 +64,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_dolly);
WM_operatortype_append(VIEW3D_OT_ndof_orbit);
WM_operatortype_append(VIEW3D_OT_ndof_pan);
+ WM_operatortype_append(VIEW3D_OT_ndof_all);
WM_operatortype_append(VIEW3D_OT_view_all);
WM_operatortype_append(VIEW3D_OT_viewnumpad);
WM_operatortype_append(VIEW3D_OT_view_orbit);
@@ -221,8 +222,9 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "align_active", TRUE);
/* 3D mouse */
- WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_orbit", NDOF_MOTION, 0, 0, 0);
+ WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_orbit", NDOF_MOTION, 0, KM_CTRL, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_pan", NDOF_MOTION, 0, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_all", NDOF_MOTION, 0, 0, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_view_selected", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BACK, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BACK);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 69fa42b0abb..6f3cc744537 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -291,7 +291,7 @@ static int view3d_selectable_data(bContext *C)
/* helper also for borderselect */
static int edge_fully_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
{
- return BLI_in_rcti(rect, x1, y1) && BLI_in_rcti(rect, x2, y2);
+ return BLI_rcti_isect_pt(rect, x1, y1) && BLI_rcti_isect_pt(rect, x2, y2);
}
static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
@@ -394,7 +394,7 @@ static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, int
{
LassoSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y) &&
+ if (BLI_rcti_isect_pt(data->rect, x, y) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
{
BM_vert_select_set(data->vc->em->bm, eve, data->select);
@@ -425,7 +425,7 @@ static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, int
{
LassoSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y) &&
+ if (BLI_rcti_isect_pt(data->rect, x, y) &&
BLI_lasso_is_point_inside(data->mcords, data->moves, x, y, IS_CLIPPED))
{
BM_face_select_set(data->vc->em->bm, efa, data->select);
@@ -654,8 +654,8 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
unsigned int *rt;
int a, index;
char *selar;
- int sx = rect->xmax - rect->xmin + 1;
- int sy = rect->ymax - rect->ymin + 1;
+ int sx = BLI_RCT_SIZE_X(rect) + 1;
+ int sy = BLI_RCT_SIZE_Y(rect) + 1;
me = vc->obact->data;
@@ -765,12 +765,11 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
/* store selection in temp test flag */
for (node = snode->edittree->nodes.first; node; node = node->next) {
-
- node_centf[0] = (node->totr.xmin + node->totr.xmax) / 2;
- node_centf[1] = (node->totr.ymin + node->totr.ymax) / 2;
+ node_centf[0] = BLI_RCT_CENTER_X(&node->totr);
+ node_centf[1] = BLI_RCT_CENTER_Y(&node->totr);
ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent);
- if (BLI_in_rcti_v(&rect, node_cent) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
+ if (BLI_rcti_isect_pt_v(&rect, node_cent) && BLI_lasso_is_point_inside(mcords, moves, node_cent[0], node_cent[1])) {
if (select) {
node->flag |= SELECT;
}
@@ -1553,7 +1552,7 @@ static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoi
Object *obedit = data->vc->obedit;
Curve *cu = (Curve *)obedit->data;
- if (BLI_in_rcti(data->rect, x, y)) {
+ if (BLI_rcti_isect_pt(data->rect, x, y)) {
if (bp) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
@@ -1600,7 +1599,7 @@ static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, int x, i
{
BoxSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y)) {
+ if (BLI_rcti_isect_pt(data->rect, x, y)) {
bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
}
}
@@ -1625,7 +1624,7 @@ static void do_mesh_box_select__doSelectVert(void *userData, BMVert *eve, int x,
{
BoxSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y)) {
+ if (BLI_rcti_isect_pt(data->rect, x, y)) {
BM_vert_select_set(data->vc->em->bm, eve, data->select);
}
}
@@ -1651,7 +1650,7 @@ static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, int x,
{
BoxSelectUserData *data = userData;
- if (BLI_in_rcti(data->rect, x, y)) {
+ if (BLI_rcti_isect_pt(data->rect, x, y)) {
BM_face_select_set(data->vc->em->bm, efa, data->select);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 604d101abd5..fbbf23beca4 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -308,11 +308,11 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
step_inv = 1.0f - step;
- interp_v3_v3v3(rv3d->ofs, sms->new_ofs, sms->orig_ofs, step);
+ interp_v3_v3v3(rv3d->ofs, sms->orig_ofs, sms->new_ofs, step);
interp_qt_qtqt(rv3d->viewquat, sms->orig_quat, sms->new_quat, step);
rv3d->dist = sms->new_dist * step + sms->orig_dist * step_inv;
- v3d->lens = sms->new_lens * step + sms->orig_lens * step_inv;
+ v3d->lens = sms->new_lens * step + sms->orig_lens * step_inv;
ED_view3d_camera_lock_sync(v3d, rv3d);
}
@@ -1212,10 +1212,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
rect.ymax = input->ymin + 12;
}
else {
- rect.xmin = input->xmin;
- rect.xmax = input->xmax;
- rect.ymin = input->ymin;
- rect.ymax = input->ymax;
+ BLI_rctf_rcti_copy(&rect, input);
}
setwinmatrixview3d(ar, v3d, &rect);
@@ -1409,7 +1406,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
}
else {
if (scene->obedit) {
- BKE_object_minmax(scene->obedit, min, max);
+ BKE_object_minmax(scene->obedit, min, max, FALSE);
ok = TRUE;
@@ -1419,7 +1416,7 @@ static int view3d_localview_init(Main *bmain, Scene *scene, ScrArea *sa, ReportL
else {
for (base = FIRSTBASE; base; base = base->next) {
if (TESTBASE(v3d, base)) {
- BKE_object_minmax(base->object, min, max);
+ BKE_object_minmax(base->object, min, max, FALSE);
base->lay |= locallay;
base->object->lay = base->lay;
ok = TRUE;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index f88d4becc74..8259ca64bad 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -125,11 +125,11 @@ static void convertViewVec2D(View2D *v2d, float r_vec[3], int dx, int dy)
{
float divx, divy;
- divx = v2d->mask.xmax - v2d->mask.xmin;
- divy = v2d->mask.ymax - v2d->mask.ymin;
+ divx = BLI_RCT_SIZE_X(&v2d->mask);
+ divy = BLI_RCT_SIZE_Y(&v2d->mask);
- r_vec[0] = (v2d->cur.xmax - v2d->cur.xmin) * dx / divx;
- r_vec[1] = (v2d->cur.ymax - v2d->cur.ymin) * dy / divy;
+ r_vec[0] = BLI_RCT_SIZE_X(&v2d->cur) * dx / divx;
+ r_vec[1] = BLI_RCT_SIZE_Y(&v2d->cur) * dy / divy;
r_vec[2] = 0.0f;
}
@@ -138,11 +138,11 @@ static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy)
float divx, divy;
float mulx, muly;
- divx = v2d->mask.xmax - v2d->mask.xmin;
- divy = v2d->mask.ymax - v2d->mask.ymin;
+ divx = BLI_RCT_SIZE_X(&v2d->mask);
+ divy = BLI_RCT_SIZE_Y(&v2d->mask);
- mulx = (v2d->cur.xmax - v2d->cur.xmin);
- muly = (v2d->cur.ymax - v2d->cur.ymin);
+ mulx = BLI_RCT_SIZE_X(&v2d->cur);
+ muly = BLI_RCT_SIZE_Y(&v2d->cur);
/* difference with convertViewVec2D */
/* clamp w/h, mask only */
@@ -208,6 +208,11 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
/* TODO - NOT WORKING, this isnt so bad since its only display aspect */
ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
}
+ else {
+ /* should never happen, quiet warnings */
+ BLI_assert(0);
+ aspx = aspy = 1.0f;
+ }
r_vec[0] *= aspx;
r_vec[1] *= aspy;
@@ -4978,7 +4983,9 @@ static int createSlideVerts(TransInfo *t)
/* This test is only relevant if object is not wire-drawn! See [#32068]. */
if (v3d && t->obedit->dt > OB_WIRE && v3d->drawtype > OB_WIRE &&
!BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
+ {
continue;
+ }
j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index c22a645eb53..8eba8ebea41 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -4209,7 +4209,7 @@ static void freeSeqData(TransInfo *t)
for (a = 0; a < t->total; a++, td++) {
if ((seq != seq_prev) && (seq->depth == 0) && (seq->flag & SEQ_OVERLAP)) {
seq = ((TransDataSeq *)td->extra)->seq;
- shuffle_seq(seqbasep, seq);
+ BKE_sequence_base_shuffle(seqbasep, seq, t->scene);
}
seq_prev = seq;
@@ -4244,7 +4244,7 @@ static void freeSeqData(TransInfo *t)
has_effect = TRUE;
}
else {
- /* Tag seq with a non zero value, used by shuffle_seq_time to identify the ones to shuffle */
+ /* Tag seq with a non zero value, used by BKE_sequence_base_shuffle_time to identify the ones to shuffle */
seq->tmp = (void *)1;
}
}
@@ -4289,7 +4289,7 @@ static void freeSeqData(TransInfo *t)
BKE_sequence_base_shuffle_time(seqbasep, t->scene);
}
#else
- shuffle_seq_time(seqbasep, t->scene);
+ BKE_sequence_base_shuffle_time(seqbasep, t->scene);
#endif
if (has_effect) {
@@ -4340,6 +4340,9 @@ static void freeSeqData(TransInfo *t)
for (a = 0; a < t->total; a++, td++) {
seq = ((TransDataSeq *)td->extra)->seq;
if ((seq != seq_prev) && (seq->depth == 0)) {
+ if (seq->flag & SEQ_OVERLAP)
+ BKE_sequence_base_shuffle(seqbasep, seq, t->scene);
+
BKE_sequence_calc_disp(t->scene, seq);
}
seq_prev = seq;
@@ -5548,8 +5551,8 @@ static void createTransObject(bContext *C, TransInfo *t)
static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
{
/* hold original location */
- float locxy[2] = {(node->totr.xmax + node->totr.xmin) / 2.0f,
- (node->totr.ymax + node->totr.ymin) / 2.0f};
+ float locxy[2] = {BLI_RCT_CENTER_X(&node->totr),
+ BLI_RCT_CENTER_Y(&node->totr)};
copy_v2_v2(td2d->loc, locxy);
td2d->loc[2] = 0.0f;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 8e73fb8b8cb..bcebca52ce8 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -71,6 +71,7 @@
#include "BKE_mesh.h"
#include "BKE_nla.h"
#include "BKE_context.h"
+#include "BKE_sequencer.h"
#include "BKE_tessmesh.h"
#include "BKE_tracking.h"
#include "BKE_mask.h"
@@ -890,6 +891,14 @@ static void recalcData_view3d(TransInfo *t)
}
}
+/* helper for recalcData() - for sequencer transforms */
+static void recalcData_sequencer(TransInfo *t)
+{
+ BKE_sequencer_preprocessed_cache_cleanup();
+
+ flushTransSeq(t);
+}
+
/* called for updating while transform acts, once per redraw */
void recalcData(TransInfo *t)
{
@@ -897,7 +906,7 @@ void recalcData(TransInfo *t)
flushTransNodes(t);
}
else if (t->spacetype == SPACE_SEQ) {
- flushTransSeq(t);
+ recalcData_sequencer(t);
}
else if (t->spacetype == SPACE_ACTION) {
recalcData_actedit(t);
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index a89ba06c1af..74a2292d74c 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -84,22 +84,22 @@
/* return codes for select, and drawing flags */
-#define MAN_TRANS_X 1
-#define MAN_TRANS_Y 2
-#define MAN_TRANS_Z 4
-#define MAN_TRANS_C 7
-
-#define MAN_ROT_X 8
-#define MAN_ROT_Y 16
-#define MAN_ROT_Z 32
-#define MAN_ROT_V 64
-#define MAN_ROT_T 128
-#define MAN_ROT_C 248
-
-#define MAN_SCALE_X 256
-#define MAN_SCALE_Y 512
-#define MAN_SCALE_Z 1024
-#define MAN_SCALE_C 1792
+#define MAN_TRANS_X (1 << 0)
+#define MAN_TRANS_Y (1 << 1)
+#define MAN_TRANS_Z (1 << 2)
+#define MAN_TRANS_C (MAN_TRANS_X | MAN_TRANS_Y | MAN_TRANS_Z)
+
+#define MAN_ROT_X (1 << 3)
+#define MAN_ROT_Y (1 << 4)
+#define MAN_ROT_Z (1 << 5)
+#define MAN_ROT_V (1 << 6)
+#define MAN_ROT_T (1 << 7)
+#define MAN_ROT_C (MAN_ROT_X | MAN_ROT_Y | MAN_ROT_Z | MAN_ROT_V | MAN_ROT_T)
+
+#define MAN_SCALE_X (1 << 8)
+#define MAN_SCALE_Y (1 << 9)
+#define MAN_SCALE_Z (1 << 10)
+#define MAN_SCALE_C (MAN_SCALE_X | MAN_SCALE_Y | MAN_SCALE_Z)
/* color codes */
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index b9583fc21e1..237f6b35eb0 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -33,6 +33,7 @@
#include "DNA_armature_types.h"
#include "DNA_curve_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meta_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@@ -549,8 +550,8 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
Object *ob = OBACT;
int result = ORIENTATION_NONE;
- normal[0] = normal[1] = normal[2] = 0;
- plane[0] = plane[1] = plane[2] = 0;
+ zero_v3(normal);
+ zero_v3(plane);
if (obedit) {
float imat[3][3], mat[3][3];
@@ -743,37 +744,20 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
}
}
else if (obedit->type == OB_MBALL) {
-#if 0 // XXX
- /* editmball.c */
- MetaElem *ml, *ml_sel = NULL;
-
- /* loop and check that only one element is selected */
- for (ml = editelems.first; ml; ml = ml->next) {
- if (ml->flag & SELECT) {
- if (ml_sel == NULL) {
- ml_sel = ml;
- }
- else {
- ml_sel = NULL;
- break;
- }
- }
- }
+ MetaBall *mb = obedit->data;
- if (ml_sel) {
+ if (mb->lastelem) {
float mat[4][4];
/* Rotation of MetaElem is stored in quat */
- quat_to_mat4(mat, ml_sel->quat);
+ quat_to_mat4(mat, mb->lastelem->quat);
copy_v3_v3(normal, mat[2]);
negate_v3_v3(plane, mat[1]);
- result = ORIENTATION_NORMAL;
+ result = ORIENTATION_FACE;
}
-#endif
-
}
else if (obedit->type == OB_ARMATURE) {
bArmature *arm = obedit->data;
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index fcb857be4e0..89cb83e3661 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -961,8 +961,8 @@ static void TargetSnapOffset(TransInfo *t, TransData *td)
if (t->spacetype == SPACE_NODE && td != NULL) {
bNode *node = td->extra;
char border = t->tsnap.snapNodeBorder;
- float width = node->totr.xmax - node->totr.xmin;
- float height = node->totr.ymax - node->totr.ymin;
+ float width = BLI_RCT_SIZE_X(&node->totr);
+ float height = BLI_RCT_SIZE_Y(&node->totr);
if (border & NODE_LEFT)
t->tsnap.snapTarget[0] -= 0.5f * width;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 65b92168842..4213ff68cf2 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -129,7 +129,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
/* undo during jobs are running can easily lead to freeing data using by jobs,
* or they can just lead to freezing job in some other cases */
- if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
+ if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY)) {
return OPERATOR_CANCELLED;
}
@@ -359,7 +359,7 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
* (which copy their data), wont stop redo, see [#29579]],
*
* note, - WM_operator_check_ui_enabled() jobs test _must_ stay in sync with this */
- (WM_jobs_test(wm, scene) == 0))
+ (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY) == 0))
{
int retval;
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 54c5cbfce93..6f3e6bee850 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -205,8 +205,8 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im
ED_image_get_uv_aspect(previma, prev_aspect, prev_aspect + 1);
ED_image_get_uv_aspect(ima, aspect, aspect + 1);
- fprev_aspect = prev_aspect[0]/prev_aspect[1];
- faspect = aspect[0]/aspect[1];
+ fprev_aspect = prev_aspect[0] / prev_aspect[1];
+ faspect = aspect[0] / aspect[1];
#endif
/* ensure we have a uv map */
@@ -2567,7 +2567,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
if (uvedit_face_visible_test(scene, ima, efa, tf)) {
uv_poly_center(em, efa, cent);
- if (BLI_in_rctf_v(&rectf, cent)) {
+ if (BLI_rctf_isect_pt_v(&rectf, cent)) {
BM_elem_flag_enable(efa, BM_ELEM_TAG);
change = 1;
}
@@ -2592,13 +2592,13 @@ static int border_select_exec(bContext *C, wmOperator *op)
if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
/* UV_SYNC_SELECTION - can't do pinned selection */
- if (BLI_in_rctf_v(&rectf, luv->uv)) {
+ if (BLI_rctf_isect_pt_v(&rectf, luv->uv)) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
else uvedit_uv_select_disable(em, scene, l);
}
}
else if (pinned) {
- if ((luv->flag & MLOOPUV_PINNED) && BLI_in_rctf_v(&rectf, luv->uv)) {
+ if ((luv->flag & MLOOPUV_PINNED) && BLI_rctf_isect_pt_v(&rectf, luv->uv)) {
if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
else uvedit_uv_select_disable(em, scene, l);
}
@@ -2771,7 +2771,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh
float cent[2];
uv_poly_center(em, efa, cent);
UI_view2d_view_to_region(&ar->v2d, cent[0], cent[1], &screen_uv[0], &screen_uv[1]);
- if (BLI_in_rcti_v(&rect, screen_uv) &&
+ if (BLI_rcti_isect_pt_v(&rect, screen_uv) &&
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
{
uvedit_face_select_enable(scene, em, efa, FALSE);
@@ -2788,7 +2788,7 @@ static int do_lasso_select_mesh_uv(bContext *C, int mcords[][2], short moves, sh
if ((select) != (uvedit_uv_select_test(em, scene, l))) {
MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
UI_view2d_view_to_region(&ar->v2d, luv->uv[0], luv->uv[1], &screen_uv[0], &screen_uv[1]);
- if (BLI_in_rcti_v(&rect, screen_uv) &&
+ if (BLI_rcti_isect_pt_v(&rect, screen_uv) &&
BLI_lasso_is_point_inside(mcords, moves, screen_uv[0], screen_uv[1], V2D_IS_CLIPPED))
{
if (select) {
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 2161d4989db..f017394356e 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -45,7 +45,7 @@
#include <stdio.h>
#include <string.h>
-#include "BLO_sys_types.h" // for intptr_t support
+#include "BLO_sys_types.h" /* for intptr_t support */
/* Utils */
@@ -1040,7 +1040,7 @@ static PFace *p_face_add(PHandle *handle)
/* allocate */
f = (PFace *)BLI_memarena_alloc(handle->arena, sizeof *f);
- f->flag = 0; // init !
+ f->flag = 0; /* init ! */
e1 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e1);
e2 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e2);
@@ -1135,7 +1135,11 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3)
static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys)
{
- float fac = len_v3v3(co[0], co[2]) - len_v3v3(co[1], co[3]);
+ /* slight bias to prefer one edge over the other in case they are equal, so
+ * that in symmetric models we choose the same split direction instead of
+ * depending on floating point errors to decide */
+ float bias = 1.0f + 1e-6f;
+ float fac = len_v3v3(co[0], co[2]) * bias - len_v3v3(co[1], co[3]);
PBool dir = (fac <= 0.0f);
/* the face exists check is there because of a special case: when
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 682b35072f6..b4903390408 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -882,14 +882,14 @@ static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result,
mid_v3_v3v3(result, min, max);
break;
- case V3D_CURSOR: /*cursor center*/
+ case V3D_CURSOR: /* cursor center */
cursx = give_cursor(scene, v3d);
/* shift to objects world */
sub_v3_v3v3(result, cursx, ob->obmat[3]);
break;
- case V3D_LOCAL: /*object center*/
- case V3D_CENTROID: /* multiple objects centers, only one object here*/
+ case V3D_LOCAL: /* object center */
+ case V3D_CENTROID: /* multiple objects centers, only one object here*/
default:
result[0] = result[1] = result[2] = 0.0;
break;
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 3c2d3e11197..d03913af417 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -730,6 +730,11 @@ int GPU_upload_dxt_texture(ImBuf *ibuf)
return FALSE;
}
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
+
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
blocksize = (format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) ? 8 : 16;
for (i=0; i<ibuf->dds_data.nummipmaps && (width||height); ++i) {
if (width == 0)
@@ -766,11 +771,6 @@ void GPU_create_gl_tex_compressed(unsigned int *bind, unsigned int *pix, int x,
glGenTextures(1, (GLuint *)bind);
glBindTexture(GL_TEXTURE_2D, *bind);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
if (GPU_upload_dxt_texture(ibuf) == 0) {
glDeleteTextures(1, (GLuint*)bind);
GPU_create_gl_tex(bind, pix, NULL, x, y, mipmap, 0, ima);
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index bd25a042ee4..efb24375729 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -427,6 +427,7 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
float *array;
int size;
+ curvemapping_initialize(lamp->curfalloff);
curvemapping_table_RGBA(lamp->curfalloff, &array, &size);
GPU_link(mat, "lamp_falloff_curve", GPU_dynamic_uniform(&lamp->dist, GPU_DYNAMIC_LAMP_DISTANCE, lamp->ob), GPU_texture(size, array), *dist, &visifac);
}
diff --git a/source/blender/ikplugin/CMakeLists.txt b/source/blender/ikplugin/CMakeLists.txt
index f37b254d719..903267c5618 100644
--- a/source/blender/ikplugin/CMakeLists.txt
+++ b/source/blender/ikplugin/CMakeLists.txt
@@ -29,7 +29,6 @@ set(INC
../blenlib
../makesdna
../../../intern/guardedalloc
- ../../../intern/iksolver/extern
)
set(INC_SYS
@@ -38,14 +37,22 @@ set(INC_SYS
set(SRC
intern/ikplugin_api.c
- intern/iksolver_plugin.c
BIK_api.h
intern/ikplugin_api.h
- intern/iksolver_plugin.h
- intern/itasc_plugin.h
)
+if(WITH_IK_SOLVER)
+ add_definitions(-DWITH_IK_SOLVER)
+ list(APPEND INC
+ ../../../intern/iksolver/extern
+ )
+ list(APPEND SRC
+ intern/iksolver_plugin.c
+ intern/iksolver_plugin.h
+ )
+endif()
+
if(WITH_IK_ITASC)
add_definitions(-DWITH_IK_ITASC)
list(APPEND INC
@@ -54,8 +61,8 @@ if(WITH_IK_ITASC)
)
list(APPEND SRC
intern/itasc_plugin.cpp
+ intern/itasc_plugin.h
)
endif()
-
blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/ikplugin/SConscript b/source/blender/ikplugin/SConscript
index 38c53894df8..97b1cf18e0d 100644
--- a/source/blender/ikplugin/SConscript
+++ b/source/blender/ikplugin/SConscript
@@ -7,5 +7,6 @@ incs = '#/intern/guardedalloc #/intern/iksolver/extern ../makesdna ../blenlib'
incs += ' ../blenkernel ../include ../ikplugin #/intern/itasc #/extern/Eigen3'
defs.append('WITH_IK_ITASC')
+defs.append('WITH_IK_SOLVER')
env.BlenderLib ( 'bf_ikplugin', sources, Split(incs), defs, libtype=['core','player'], priority=[180, 190] )
diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c
index 147c2b50e31..08d2789451c 100644
--- a/source/blender/ikplugin/intern/ikplugin_api.c
+++ b/source/blender/ikplugin/intern/ikplugin_api.c
@@ -45,13 +45,17 @@
#include "DNA_armature_types.h"
#include "ikplugin_api.h"
-#include "iksolver_plugin.h"
+
+#ifdef WITH_IK_SOLVER
+# include "iksolver_plugin.h"
+#endif
#ifdef WITH_IK_ITASC
-#include "itasc_plugin.h"
+# include "itasc_plugin.h"
#endif
static IKPlugin ikplugin_tab[] = {
+#ifdef WITH_IK_SOLVER
/* Legacy IK solver */
{
iksolver_initialize_tree,
@@ -61,8 +65,10 @@ static IKPlugin ikplugin_tab[] = {
NULL,
NULL,
NULL,
-#ifdef WITH_IK_ITASC
},
+#endif
+
+#ifdef WITH_IK_ITASC
/* iTaSC IK solver */
{
itasc_initialize_tree,
@@ -72,8 +78,8 @@ static IKPlugin ikplugin_tab[] = {
itasc_clear_cache,
itasc_update_param,
itasc_test_constraint,
-#endif
- }
+ },
+ #endif
};
static IKPlugin *get_plugin(bPose *pose)
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 738e61dbe6e..a04affd4891 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -506,5 +506,9 @@ void IMB_processor_apply_threaded(int buffer_lines, int handle_size, void *init_
void *customdata),
void *(do_thread) (void *));
+/* ffmpeg */
+void IMB_ffmpeg_init(void);
+const char *IMB_ffmpeg_last_error(void);
+
#endif
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index dcb5cdd7d32..be93d51d7d7 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -165,8 +165,10 @@ typedef struct ImBuf {
/*
* The bit flag is stored in the ImBuf.ftype variable.
- * Note that the lower 10 bits is used for storing custom flags
+ * Note that the lower 10 bits is used for storing custom flags
*/
+#define IB_CUSTOM_FLAGS_MASK 0x3ff
+
#define PNG (1 << 30)
#define TGA (1 << 28)
#define JPG (1 << 27)
diff --git a/source/blender/imbuf/IMB_moviecache.h b/source/blender/imbuf/IMB_moviecache.h
index 00d3368ae5f..4588c2bcee5 100644
--- a/source/blender/imbuf/IMB_moviecache.h
+++ b/source/blender/imbuf/IMB_moviecache.h
@@ -58,7 +58,7 @@ void IMB_moviecache_set_priority_callback(struct MovieCache *cache, MovieCacheGe
MovieCachePriorityDeleterFP prioritydeleterfp);
void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
-struct ImBuf* IMB_moviecache_get(struct MovieCache *cache, void *userkey);
+struct ImBuf *IMB_moviecache_get(struct MovieCache *cache, void *userkey);
void IMB_moviecache_free(struct MovieCache *cache);
void IMB_moviecache_cleanup(struct MovieCache *cache, int (cleanup_check_cb) (void *userkey, void *userdata), void *userdata);
diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h
index 76c09ec1486..a6f38516a14 100644
--- a/source/blender/imbuf/IMB_thumbs.h
+++ b/source/blender/imbuf/IMB_thumbs.h
@@ -63,16 +63,16 @@ typedef enum ThumbSource {
// IB_metadata
/* create thumbnail for file and returns new imbuf for thumbnail */
-ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, ImBuf *ibuf);
+ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, ImBuf *ibuf);
/* read thumbnail for file and returns new imbuf for thumbnail */
-ImBuf* IMB_thumb_read(const char* path, ThumbSize size);
+ImBuf *IMB_thumb_read(const char *path, ThumbSize size);
/* delete all thumbs for the file */
-void IMB_thumb_delete(const char* path, ThumbSize size);
+void IMB_thumb_delete(const char *path, ThumbSize size);
/* return the state of the thumb, needed to determine how to manage the thumb */
-ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source);
+ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source);
/* create the necessary dirs to store the thumbnails */
void IMB_thumb_makedirs(void);
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index f07a18cb89c..9092d59c351 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -439,8 +439,6 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position)
#ifdef WITH_FFMPEG
-extern void do_init_ffmpeg(void);
-
static int startffmpeg(struct anim *anim)
{
int i, videoStream;
@@ -463,8 +461,6 @@ static int startffmpeg(struct anim *anim)
streamcount = anim->streamindex;
- do_init_ffmpeg();
-
if (avformat_open_input(&pFormatCtx, anim->name, NULL, NULL) != 0) {
return -1;
}
diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt
index ae5f1ca9d09..e514b7ab6f9 100644
--- a/source/blender/imbuf/intern/dds/CMakeLists.txt
+++ b/source/blender/imbuf/intern/dds/CMakeLists.txt
@@ -31,6 +31,7 @@ set(INC
../../../blenlib
../../../makesdna
../../../../../intern/guardedalloc
+ ../../../../../intern/utfconv
)
set(INC_SYS
diff --git a/source/blender/imbuf/intern/dds/SConscript b/source/blender/imbuf/intern/dds/SConscript
index 918ae7b530b..4245f5001b9 100644
--- a/source/blender/imbuf/intern/dds/SConscript
+++ b/source/blender/imbuf/intern/dds/SConscript
@@ -11,7 +11,8 @@ incs = ['.',
'../../../blenkernel',
'../../../blenlib',
'intern/include',
- '#/intern/guardedalloc']
+ '#/intern/guardedalloc',
+ '#/intern/utfconv']
defs = ['WITH_DDS']
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index fba326f7865..71313d4438f 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -32,6 +32,10 @@
#include <stdio.h> // printf
#include <fstream>
+#if defined (WIN32) && !defined(FREE_WINDOWS)
+#include "utfconv.h"
+#endif
+
extern "C" {
#include "imbuf.h"
@@ -39,7 +43,6 @@ extern "C" {
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
-
int imb_save_dds(struct ImBuf * ibuf, const char *name, int flags)
{
return(0); /* todo: finish this function */
@@ -49,7 +52,15 @@ int imb_save_dds(struct ImBuf * ibuf, const char *name, int flags)
if (ibuf->rect == 0) return (0);
/* open file for writing */
- std::ofstream fildes(name);
+ std::ofstream fildes;
+
+#if defined (WIN32) && !defined(FREE_WINDOWS)
+ wchar_t *wname = alloc_utf16_from_8(name, 0);
+ fildes.open(wname);
+ free(wname);
+#else
+ fildes.open(name);
+#endif
/* write header */
fildes << "DDS ";
diff --git a/source/blender/imbuf/intern/imbuf_cocoa.m b/source/blender/imbuf/intern/imbuf_cocoa.m
index ebfee7a1a30..10381e9d1c3 100644
--- a/source/blender/imbuf/intern/imbuf_cocoa.m
+++ b/source/blender/imbuf/intern/imbuf_cocoa.m
@@ -92,9 +92,8 @@ struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags)
/* allocate the image buffer */
ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0);
if (!ibuf) {
- fprintf(stderr,
- "imb_cocoaLoadImage: could not allocate memory for the " \
- "image.\n");
+ fprintf(stderr,
+ "imb_cocoaLoadImage: could not allocate memory for the image.\n");
[bitmapImage release];
[pool drain];
return NULL;
@@ -243,8 +242,8 @@ short imb_cocoaSaveImage(struct ImBuf *ibuf, char *name, int flags)
break;
default:
fprintf(stderr,
- "imb_cocoaSaveImage: unsupported number of bytes per "
- "pixel: %d\n", samplesperpixel);
+ "imb_cocoaSaveImage: unsupported number of bytes per "
+ "pixel: %d\n", samplesperpixel);
return (0);
}
@@ -257,16 +256,16 @@ short imb_cocoaSaveImage(struct ImBuf *ibuf, char *name, int flags)
/* Create bitmap image rep in blender format */
blBitmapFormatImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
- pixelsWide:ibuf->x
- pixelsHigh:ibuf->y
- bitsPerSample:bitspersample samplesPerPixel:samplesperpixel hasAlpha:hasAlpha isPlanar:NO
- colorSpaceName:colorSpace
- bitmapFormat:NSAlphaNonpremultipliedBitmapFormat
- bytesPerRow:(ibuf->x*bitspersample*samplesperpixel/8)
- bitsPerPixel:(bitspersample*samplesperpixel)];
+ pixelsWide:ibuf->x
+ pixelsHigh:ibuf->y
+ bitsPerSample:bitspersample samplesPerPixel:samplesperpixel hasAlpha:hasAlpha isPlanar:NO
+ colorSpaceName:colorSpace
+ bitmapFormat:NSAlphaNonpremultipliedBitmapFormat
+ bytesPerRow:(ibuf->x*bitspersample*samplesperpixel/8)
+ bitsPerPixel:(bitspersample*samplesperpixel)];
if (!blBitmapFormatImage) {
- [pool drain];
- return FALSE;
+ [pool drain];
+ return FALSE;
}
/* setup pointers */
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index d5ca7da7d93..4108f0d89d7 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -221,7 +221,7 @@ struct anim_index *IMB_indexer_open(const char *name)
}
unsigned long long IMB_indexer_get_seek_pos(
- struct anim_index *idx, int frame_index)
+ struct anim_index *idx, int frame_index)
{
if (frame_index < 0) {
frame_index = 0;
@@ -233,7 +233,7 @@ unsigned long long IMB_indexer_get_seek_pos(
}
unsigned long long IMB_indexer_get_seek_pos_dts(
- struct anim_index *idx, int frame_index)
+ struct anim_index *idx, int frame_index)
{
if (frame_index < 0) {
frame_index = 0;
@@ -581,7 +581,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg(
}
static int add_to_proxy_output_ffmpeg(
- struct proxy_output_ctx *ctx, AVFrame *frame)
+ struct proxy_output_ctx *ctx, AVFrame *frame)
{
int outsize = 0;
diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt
index 4ee2ff4cc47..a5afc1abdc6 100644
--- a/source/blender/imbuf/intern/openexr/CMakeLists.txt
+++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt
@@ -31,6 +31,7 @@ set(INC
../../../blenlib
../../../makesdna
../../../../../intern/guardedalloc
+ ../../../../../intern/utfconv
)
set(INC_SYS
diff --git a/source/blender/imbuf/intern/openexr/SConscript b/source/blender/imbuf/intern/openexr/SConscript
index e590077db2b..a6c5ad984e2 100644
--- a/source/blender/imbuf/intern/openexr/SConscript
+++ b/source/blender/imbuf/intern/openexr/SConscript
@@ -10,7 +10,9 @@ incs = ['.',
'../../../blenlib',
'intern/include',
'#/intern/guardedalloc',
- '../../../makesdna']
+ '../../../makesdna',
+ '#/intern/utfconv']
+
incs += Split(env['BF_OPENEXR_INC'])
defs = ['WITH_OPENEXR']
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index b66a7449781..26aab29b8dd 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -32,12 +32,17 @@
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
+#include <fstream>
#include <string>
#include <set>
-
+#include <errno.h>
#include <openexr_api.h>
+#if defined (WIN32) && !defined(FREE_WINDOWS)
+#include "utfconv.h"
+#endif
+
extern "C"
{
@@ -66,6 +71,7 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
#if defined(_WIN32) && !defined(FREE_WINDOWS)
#include <half.h>
+#include <Iex/Iex.h>
#include <IlmImf/ImfVersion.h>
#include <IlmImf/ImfArray.h>
#include <IlmImf/ImfIO.h>
@@ -79,6 +85,7 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
#include <Imath/ImathBox.h>
#else
#include <half.h>
+#include <Iex.h>
#include <ImfVersion.h>
#include <ImathBox.h>
#include <ImfArray.h>
@@ -95,6 +102,8 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
using namespace Imf;
using namespace Imath;
+/* Memory Input Stream */
+
class Mem_IStream : public Imf::IStream
{
public:
@@ -142,6 +151,122 @@ void Mem_IStream::clear()
{
}
+/* File Input Stream */
+
+class IFileStream : public Imf::IStream
+{
+public:
+ IFileStream(const char *filename)
+ : IStream(filename)
+ {
+ /* utf-8 file path support on windows */
+#if defined (WIN32) && !defined(FREE_WINDOWS)
+ wchar_t *wfilename = alloc_utf16_from_8(filename, 0);
+ ifs.open(wfilename, std::ios_base::binary);
+ free(wfilename);
+#else
+ ifs.open(filename, std::ios_base::binary);
+#endif
+
+ if (!ifs)
+ Iex::throwErrnoExc();
+ }
+
+ virtual bool read(char c[], int n)
+ {
+ if (!ifs)
+ throw Iex::InputExc("Unexpected end of file.");
+
+ errno = 0;
+ ifs.read(c, n);
+ return check_error();
+ }
+
+ virtual Int64 tellg()
+ {
+ return std::streamoff(ifs.tellg());
+ }
+
+ virtual void seekg(Int64 pos)
+ {
+ ifs.seekg(pos);
+ check_error();
+ }
+
+ virtual void clear()
+ {
+ ifs.clear();
+ }
+
+private:
+ bool check_error()
+ {
+ if (!ifs) {
+ if (errno)
+ Iex::throwErrnoExc();
+
+ return false;
+ }
+
+ return true;
+ }
+
+ std::ifstream ifs;
+};
+
+/* File Output Stream */
+
+class OFileStream : public OStream
+{
+public:
+ OFileStream(const char *filename)
+ : OStream(filename)
+ {
+ /* utf-8 file path support on windows */
+#if defined (WIN32) && !defined(FREE_WINDOWS)
+ wchar_t *wfilename = alloc_utf16_from_8(filename, 0);
+ ofs.open(wfilename, std::ios_base::binary);
+ free(wfilename);
+#else
+ ofs.open(filename, std::ios_base::binary);
+#endif
+
+ if (!ofs)
+ Iex::throwErrnoExc();
+ }
+
+ virtual void write(const char c[], int n)
+ {
+ errno = 0;
+ ofs.write(c, n);
+ check_error();
+ }
+
+ virtual Int64 tellp()
+ {
+ return std::streamoff(ofs.tellp());
+ }
+
+ virtual void seekp(Int64 pos)
+ {
+ ofs.seekp(pos);
+ check_error();
+ }
+
+private:
+ void check_error()
+ {
+ if (!ofs) {
+ if (errno)
+ Iex::throwErrnoExc();
+
+ throw Iex::ErrnoExc("File output failed.");
+ }
+ }
+
+ std::ofstream ofs;
+};
+
struct _RGBAZ {
half r;
half g;
@@ -216,7 +341,10 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
header.channels().insert("Z", Channel(Imf::FLOAT));
FrameBuffer frameBuffer;
- OutputFile *file = new OutputFile(name, header);
+
+ /* manually create ofstream, so we can handle utf-8 filepaths on windows */
+ OFileStream file_stream(name);
+ OutputFile file(file_stream, header);
/* we store first everything in half array */
RGBAZ *pixels = new RGBAZ[height * width];
@@ -281,9 +409,9 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
// printf("OpenEXR-save: Writing OpenEXR file of height %d.\n", height);
- file->setFrameBuffer(frameBuffer);
- file->writePixels(height);
- delete file;
+ file.setFrameBuffer(frameBuffer);
+ file.writePixels(height);
+
delete[] pixels;
}
catch (const std::exception &exc)
@@ -321,7 +449,11 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
header.channels().insert("Z", Channel(Imf::FLOAT));
FrameBuffer frameBuffer;
- OutputFile *file = new OutputFile(name, header);
+
+ /* manually create ofstream, so we can handle utf-8 filepaths on windows */
+ OFileStream file_stream(name);
+ OutputFile file(file_stream, header);
+
int xstride = sizeof(float) * channels;
int ystride = -xstride * width;
float *rect[4] = {NULL, NULL, NULL, NULL};
@@ -340,9 +472,8 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
if (is_zbuf)
frameBuffer.insert("Z", Slice(Imf::FLOAT, (char *) (ibuf->zbuf_float + (height - 1) * width),
sizeof(float), sizeof(float) * -width));
- file->setFrameBuffer(frameBuffer);
- file->writePixels(height);
- delete file;
+ file.setFrameBuffer(frameBuffer);
+ file.writePixels(height);
}
catch (const std::exception &exc)
{
@@ -391,9 +522,13 @@ static ListBase exrhandles = {NULL, NULL};
typedef struct ExrHandle {
struct ExrHandle *next, *prev;
+ IFileStream *ifile_stream;
InputFile *ifile;
+
+ OFileStream *ofile_stream;
TiledOutputFile *tofile;
OutputFile *ofile;
+
int tilex, tiley;
int width, height;
int mipmap;
@@ -486,12 +621,19 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh
header.insert("BlenderMultiChannel", StringAttribute("Blender V2.55.1 and newer"));
/* avoid crash/abort when we don't have permission to write here */
+ /* manually create ofstream, so we can handle utf-8 filepaths on windows */
try {
- data->ofile = new OutputFile(filename, header);
+ data->ofile_stream = new OFileStream(filename);
+ data->ofile = new OutputFile(*(data->ofile_stream), header);
}
catch (const std::exception &exc) {
std::cerr << "IMB_exr_begin_write: ERROR: " << exc.what() << std::endl;
+
+ delete data->ofile;
+ delete data->ofile_stream;
+
data->ofile = NULL;
+ data->ofile_stream = NULL;
}
return (data->ofile != NULL);
@@ -518,7 +660,19 @@ void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int
header.insert("BlenderMultiChannel", StringAttribute("Blender V2.43"));
- data->tofile = new TiledOutputFile(filename, header);
+ /* avoid crash/abort when we don't have permission to write here */
+ /* manually create ofstream, so we can handle utf-8 filepaths on windows */
+ try {
+ data->ofile_stream = new OFileStream(filename);
+ data->tofile = new TiledOutputFile(*(data->ofile_stream), header);
+ }
+ catch (const std::exception &exc) {
+ delete data->tofile;
+ delete data->ofile_stream;
+
+ data->tofile = NULL;
+ data->ofile_stream = NULL;
+ }
}
/* read from file */
@@ -527,7 +681,19 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig
ExrHandle *data = (ExrHandle *)handle;
if (BLI_exists(filename) && BLI_file_size(filename) > 32) { /* 32 is arbitrary, but zero length files crashes exr */
- data->ifile = new InputFile(filename);
+ /* avoid crash/abort when we don't have permission to write here */
+ try {
+ data->ifile_stream = new IFileStream(filename);
+ data->ifile = new InputFile(*(data->ifile_stream));
+ }
+ catch (const std::exception &exc) {
+ delete data->ifile;
+ delete data->ifile_stream;
+
+ data->ifile = NULL;
+ data->ifile_stream = NULL;
+ }
+
if (data->ifile) {
Box2i dw = data->ifile->header().dataWindow();
data->width = *width = dw.max.x - dw.min.x + 1;
@@ -696,16 +862,17 @@ void IMB_exr_close(void *handle)
ExrLayer *lay;
ExrPass *pass;
- if (data->ifile)
- delete data->ifile;
- else if (data->ofile)
- delete data->ofile;
- else if (data->tofile)
- delete data->tofile;
+ delete data->ifile;
+ delete data->ifile_stream;
+ delete data->ofile;
+ delete data->tofile;
+ delete data->ofile_stream;
data->ifile = NULL;
+ data->ifile_stream = NULL;
data->ofile = NULL;
data->tofile = NULL;
+ data->ofile_stream = NULL;
BLI_freelistN(&data->channels);
@@ -728,8 +895,9 @@ static int imb_exr_split_token(const char *str, const char *end, const char **to
{
int maxlen = end - str;
int len = 0;
- while (len < maxlen && *(end - len - 1) != '.')
- ++len;
+ while (len < maxlen && *(end - len - 1) != '.') {
+ len++;
+ }
*token = end - len;
return len;
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index e90269a0986..389c3c42b6d 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -294,7 +294,7 @@ struct ImBuf *IMB_double_y(struct ImBuf *ibuf1)
/* result in ibuf2, scaling should be done correctly */
void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
{
- int x, y;
+ int x, y;
const short do_rect = (ibuf1->rect != NULL);
const short do_float = (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL);
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 985c575daaa..ac5f5da8a67 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -59,7 +59,9 @@
#include "tiffio.h"
-
+#ifdef WIN32
+#include "utfconv.h"
+#endif
/***********************
* Local declarations. *
@@ -712,7 +714,13 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
}
else {
/* create image as a file */
+#ifdef WIN32
+ wchar_t *wname = alloc_utf16_from_8(name, 0);
+ image = TIFFOpenW(wname, "w");
+ free(wname);
+#else
image = TIFFOpen(name, "w");
+#endif
}
if (image == NULL) {
fprintf(stderr,
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 2b0597d64a5..9ec22f0798e 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -43,6 +43,8 @@
#include "BLI_path_util.h"
#include "BLI_fileops.h"
+#include "BLI_utildefines.h"
+#include "BLI_string.h"
#include "DNA_userdef_types.h"
#include "BKE_global.h"
@@ -220,6 +222,8 @@ static int isqtime(const char *name)
#ifdef WITH_FFMPEG
+static char ffmpeg_last_error[1024];
+
void silence_log_ffmpeg(int quiet)
{
if (quiet) {
@@ -230,21 +234,40 @@ void silence_log_ffmpeg(int quiet)
}
}
-extern void do_init_ffmpeg(void);
-void do_init_ffmpeg(void)
+void ffmpeg_log_callback(void *ptr, int level, const char *format, va_list arg)
{
- static int ffmpeg_init = 0;
- if (!ffmpeg_init) {
- ffmpeg_init = 1;
- av_register_all();
- avdevice_register_all();
- if ((G.debug & G_DEBUG_FFMPEG) == 0) {
- silence_log_ffmpeg(1);
- }
- else {
- silence_log_ffmpeg(0);
- }
+ if (ELEM(level, AV_LOG_FATAL, AV_LOG_ERROR)) {
+ size_t n = BLI_vsnprintf(ffmpeg_last_error, sizeof(ffmpeg_last_error), format, arg);
+
+ /* strip trailing \n */
+ ffmpeg_last_error[n - 1] = '\0';
}
+
+ /* call default logger to print all message to console */
+ av_log_default_callback(ptr, level, format, arg);
+}
+
+void IMB_ffmpeg_init(void)
+{
+ av_register_all();
+ avdevice_register_all();
+
+ if ((G.debug & G_DEBUG_FFMPEG) == 0) {
+ silence_log_ffmpeg(1);
+ }
+ else {
+ silence_log_ffmpeg(0);
+ }
+
+ ffmpeg_last_error[0] = '\0';
+
+ /* set own callback which could store last error to report to UI */
+ av_log_set_callback(ffmpeg_log_callback);
+}
+
+const char *IMB_ffmpeg_last_error(void)
+{
+ return ffmpeg_last_error;
}
static int isffmpeg(const char *filename)
@@ -255,8 +278,6 @@ static int isffmpeg(const char *filename)
AVCodec *pCodec;
AVCodecContext *pCodecCtx;
- do_init_ffmpeg();
-
if (BLI_testextensie(filename, ".swf") ||
BLI_testextensie(filename, ".jpg") ||
BLI_testextensie(filename, ".png") ||
diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h
index 1f8fdd20dda..4ead26c04f3 100644
--- a/source/blender/makesdna/DNA_color_types.h
+++ b/source/blender/makesdna/DNA_color_types.h
@@ -47,8 +47,10 @@ typedef struct CurveMapPoint {
} CurveMapPoint;
/* curvepoint->flag */
-#define CUMA_SELECT 1
-#define CUMA_VECTOR 2
+enum {
+ CUMA_SELECT = 1,
+ CUMA_VECTOR = 2
+};
typedef struct CurveMap {
short totpoint, flag;
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 56cf90d3d9d..284694f2b48 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -87,20 +87,22 @@ typedef struct BevPoint {
short split_tag, dupe_tag;
} BevPoint;
-/* Keyframes on F-Curves (allows code reuse of Bezier eval code) and
+/**
+ * Keyframes on F-Curves (allows code reuse of Bezier eval code) and
* Points on Bezier Curves/Paths are generally BezTriples
- */
-/* note: alfa location in struct is abused by Key system */
-/* vec in BezTriple looks like this:
- * - vec[0][0]=x location of handle 1
- * - vec[0][1]=y location of handle 1
- * - vec[0][2]=z location of handle 1 (not used for FCurve Points(2d))
- * - vec[1][0]=x location of control point
- * - vec[1][1]=y location of control point
- * - vec[1][2]=z location of control point
- * - vec[2][0]=x location of handle 2
- * - vec[2][1]=y location of handle 2
- * - vec[2][2]=z location of handle 2 (not used for FCurve Points(2d))
+ *
+ * \note alfa location in struct is abused by Key system
+ *
+ * \note vec in BezTriple looks like this:
+ * - vec[0][0] = x location of handle 1
+ * - vec[0][1] = y location of handle 1
+ * - vec[0][2] = z location of handle 1 (not used for FCurve Points(2d))
+ * - vec[1][0] = x location of control point
+ * - vec[1][1] = y location of control point
+ * - vec[1][2] = z location of control point
+ * - vec[2][0] = x location of handle 2
+ * - vec[2][1] = y location of handle 2
+ * - vec[2][2] = z location of handle 2 (not used for FCurve Points(2d))
*/
typedef struct BezTriple {
float vec[3][3];
@@ -119,6 +121,10 @@ typedef struct BPoint {
float radius, pad; /* user-set radius per point for beveling etc */
} BPoint;
+/**
+ * \note Nurb name is misleading, since it can be used for polygons too,
+ * also, it should be NURBS (Nurb isn't the singular of Nurbs).
+ */
typedef struct Nurb {
struct Nurb *next, *prev; /* multiple nurbs per curve object are allowed */
short type;
diff --git a/source/blender/makesdna/DNA_mask_types.h b/source/blender/makesdna/DNA_mask_types.h
index b34a6c9b12f..6c7f7aa2471 100644
--- a/source/blender/makesdna/DNA_mask_types.h
+++ b/source/blender/makesdna/DNA_mask_types.h
@@ -168,14 +168,15 @@ enum {
/* masklay->blend */
enum {
- MASK_BLEND_ADD = 0,
- MASK_BLEND_SUBTRACT = 1,
- MASK_BLEND_LIGHTEN = 2,
- MASK_BLEND_DARKEN = 3,
- MASK_BLEND_MUL = 4,
- MASK_BLEND_REPLACE = 5,
- MASK_BLEND_DIFFERENCE = 6,
- MASK_BLEND_MERGE = 7
+ MASK_BLEND_ADD = 0,
+ MASK_BLEND_SUBTRACT = 1,
+ MASK_BLEND_LIGHTEN = 2,
+ MASK_BLEND_DARKEN = 3,
+ MASK_BLEND_MUL = 4,
+ MASK_BLEND_REPLACE = 5,
+ MASK_BLEND_DIFFERENCE = 6,
+ MASK_BLEND_MERGE_ADD = 7,
+ MASK_BLEND_MERGE_SUBTRACT = 8
};
/* masklay->blend_flag */
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 0853df87a35..5952aa8afb0 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -154,7 +154,8 @@ typedef struct ParticleSettings {
short type, from, distr, texact;
/* physics modes */
short phystype, rotmode, avemode, reactevent;
- short draw, draw_as, draw_size, childtype;
+ int draw, pad1;
+ short draw_as, draw_size, childtype, pad2;
short ren_as, subframes, draw_col;
/* number of path segments, power of 2 except */
short draw_step, ren_step;
@@ -398,6 +399,7 @@ typedef struct ParticleSystem {
#define PART_DRAW_MAT_COL (1<<13) /* deprecated, but used in do_versions */
#define PART_DRAW_WHOLE_GR (1<<14)
#define PART_DRAW_REN_STRAND (1<<15)
+#define PART_DRAW_NO_SCALE_OB (1<<16) /* used with dupliobjects/groups */
/* part->draw_col */
#define PART_DRAW_COL_NONE 0
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 16e8b8904fa..c83bddbfc64 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -34,6 +34,7 @@
#define __DNA_SEQUENCE_TYPES_H__
#include "DNA_defs.h"
+#include "DNA_color_types.h"
#include "DNA_listBase.h"
#include "DNA_vec_types.h"
@@ -101,11 +102,16 @@ typedef struct Strip {
StripColorBalance *color_balance;
} Strip;
-/* The sequence structure is the basic struct used by any strip. each of the strips uses a different sequence structure.*/
-/* WATCH IT: first part identical to ID (for use in ipo's)
- * the commend above is historic, probably we can drop the ID compatibility, but take care making this change */
-
-/* WATCH ITv2, this is really a 'Strip' in the UI!, name is highly confusing */
+/**
+ * The sequence structure is the basic struct used by any strip.
+ * each of the strips uses a different sequence structure.
+ *
+ * \warning The first part identical to ID (for use in ipo's)
+ * the commend above is historic, probably we can drop the ID compatibility,
+ * but take care making this change.
+ *
+ * \warning This is really a 'Strip' in the UI!, name is highly confusing.
+ */
typedef struct Sequence {
struct Sequence *next, *prev;
void *tmp; /* tmp var for copying, and tagging for linked selection */
@@ -167,6 +173,9 @@ typedef struct Sequence {
/* is sfra needed anymore? - it looks like its only used in one place */
int sfra, pad; /* starting frame according to the timeline of the scene. */
+
+ /* modifiers */
+ ListBase modifiers;
} Sequence;
typedef struct MetaStack {
@@ -229,6 +238,46 @@ typedef struct SpeedControlVars {
int lastValidFrame;
} SpeedControlVars;
+/* ***************** Sequence modifiers ****************** */
+
+typedef struct SequenceModifierData {
+ struct SequenceModifierData *next, *prev;
+ int type, flag;
+ char name[64]; /* MAX_NAME */
+
+ /* mask input, either sequence or maks ID */
+ int mask_input_type, pad;
+
+ struct Sequence *mask_sequence;
+ struct Mask *mask_id;
+} SequenceModifierData;
+
+typedef struct ColorBalanceModifierData {
+ SequenceModifierData modifier;
+
+ StripColorBalance color_balance;
+ float color_multiply;
+} ColorBalanceModifierData;
+
+typedef struct CurvesModifierData {
+ SequenceModifierData modifier;
+
+ struct CurveMapping curve_mapping;
+} CurvesModifierData;
+
+typedef struct HueCorrectModifierData {
+ SequenceModifierData modifier;
+
+ struct CurveMapping curve_mapping;
+} HueCorrectModifierData;
+
+typedef struct BrightContrastModifierData {
+ SequenceModifierData modifier;
+
+ float bright;
+ float contrast;
+} BrightContrastModifierData;
+
#define MAXSEQ 32
#define SELECT 1
@@ -352,5 +401,27 @@ enum {
#define SEQ_HAS_PATH(_seq) (ELEM4((_seq)->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD))
-#endif
+/* modifiers */
+
+/* SequenceModifierData->type */
+enum {
+ seqModifierType_ColorBalance = 1,
+ seqModifierType_Curves = 2,
+ seqModifierType_HueCorrect = 3,
+ seqModifierType_BrightContrast = 4,
+
+ NUM_SEQUENCE_MODIFIER_TYPES
+};
+/* SequenceModifierData->flag */
+enum {
+ SEQUENCE_MODIFIER_MUTE = (1 << 0),
+ SEQUENCE_MODIFIER_EXPANDED = (1 << 1),
+};
+
+enum {
+ SEQUENCE_MASK_INPUT_STRIP = 0,
+ SEQUENCE_MASK_INPUT_ID = 1
+};
+
+#endif
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 8b62f58212b..3f9f4d3980e 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -414,6 +414,8 @@ typedef struct UserDef {
short use_16bit_textures, use_gpu_mipmap;
float ndof_sensitivity; /* overall sensitivity of 3D mouse */
+ float ndof_orbit_sensitivity;
+ float pad4;
int ndof_flag; /* flags for 3D mouse */
float glalphaclip;
@@ -649,6 +651,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define NDOF_PANX_INVERT_AXIS (1 << 12)
#define NDOF_PANY_INVERT_AXIS (1 << 13)
#define NDOF_PANZ_INVERT_AXIS (1 << 14)
+#define NDOF_TURNTABLE (1 << 15)
/* compute_device_type */
#define USER_COMPUTE_DEVICE_NONE 0
diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h
index 3cccfe6a19f..7aaeaf23db2 100644
--- a/source/blender/makesdna/DNA_vfont_types.h
+++ b/source/blender/makesdna/DNA_vfont_types.h
@@ -46,6 +46,10 @@ typedef struct VFont {
struct VFontData *data;
struct PackedFile *packedfile;
+
+ /* runtime only, holds memory for freetype to read from
+ * TODO, replace this with blf_font_new() style loading */
+ struct PackedFile *temp_pf;
} VFont;
/* *************** FONT ****************** */
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 2fbee1e9e1a..dd230b7b9f8 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -52,6 +52,7 @@ extern EnumPropertyItem region_type_items[];
extern EnumPropertyItem modifier_type_items[];
extern EnumPropertyItem constraint_type_items[];
extern EnumPropertyItem boidrule_type_items[];
+extern EnumPropertyItem sequence_modifier_type_items[];
extern EnumPropertyItem image_type_items[];
extern EnumPropertyItem image_color_mode_items[];
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 32ca1bca107..62a09e65191 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -2865,7 +2865,7 @@ static const char *cpp_classes = ""
"\n"
"class Pointer {\n"
"public:\n"
-" Pointer(const PointerRNA& p) : ptr(p) { }\n"
+" Pointer(const PointerRNA &p) : ptr(p) { }\n"
" operator const PointerRNA&() { return ptr; }\n"
" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type)? true: false; }\n"
" operator void*() { return ptr.data; }\n"
@@ -2909,7 +2909,7 @@ static const char *cpp_classes = ""
" bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
"{ return iter.valid != other.iter.valid; }\n"
"\n"
-" void begin(const Pointer& ptr)\n"
+" void begin(const Pointer &ptr)\n"
" { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
"\n"
"private:\n"
@@ -2924,7 +2924,7 @@ static const char *cpp_classes = ""
"template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n"
"class Collection {\n"
"public:\n"
-" Collection(const PointerRNA& p) : ptr(p) {}\n"
+" Collection(const PointerRNA &p) : ptr(p) {}\n"
"\n"
" void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
" { iter.begin(ptr); }\n"
@@ -2968,7 +2968,7 @@ static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer");
fprintf(f, "public:\n");
- fprintf(f, "\t%s(const PointerRNA& ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier,
+ fprintf(f, "\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier,
(srna->base) ? srna->base->identifier : "Pointer");
for (dp = ds->cont.properties.first; dp; dp = dp->next)
if (!(dp->prop->flag & (PROP_IDPROPERTY | PROP_BUILTIN)))
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 15fdce09d83..0bd42c2f5a0 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -79,7 +79,7 @@ static void rna_CurveMapping_clip_set(PointerRNA *ptr, int value)
if (value) cumap->flag |= CUMA_DO_CLIP;
else cumap->flag &= ~CUMA_DO_CLIP;
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
}
static void rna_CurveMapping_black_level_set(PointerRNA *ptr, const float *values)
@@ -337,6 +337,12 @@ static void rna_Scopes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointer
s->ok = 0;
}
+/* this function only exists because #curvemap_evaluateF uses a 'const' qualifier */
+float rna_CurveMap_evaluateF(struct CurveMap *cuma, float value)
+{
+ return curvemap_evaluateF(cuma, value);
+}
+
#else
static void rna_def_curvemappoint(BlenderRNA *brna)
@@ -419,7 +425,7 @@ static void rna_def_curvemap(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Points", "");
rna_def_curvemap_points_api(brna, prop);
- func = RNA_def_function(srna, "evaluate", "curvemap_evaluateF");
+ func = RNA_def_function(srna, "evaluate", "rna_CurveMap_evaluateF");
RNA_def_function_ui_description(func, "Evaluate curve at given location");
parm = RNA_def_float(func, "position", 0.0f, -FLT_MAX, FLT_MAX, "Position", "Position to evaluate curve at", -FLT_MAX, FLT_MAX);
RNA_def_property_flag(parm, PROP_REQUIRED);
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index f197bf8391d..a6571a2db4f 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -580,7 +580,8 @@ static void rna_def_maskSpline(BlenderRNA *brna)
static void rna_def_mask_layer(BlenderRNA *brna)
{
static EnumPropertyItem masklay_blend_mode_items[] = {
- {MASK_BLEND_MERGE, "MERGE", 0, "Merge", ""},
+ {MASK_BLEND_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""},
+ {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""},
{MASK_BLEND_ADD, "ADD", 0, "Add", ""},
{MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
{MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 4f3e6081fcc..fe5f8e574a0 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -1393,6 +1393,46 @@ static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bCont
return ptr;
}
+/* only to quiet warnings */
+static void UNUSED_FUNCTION(rna_mesh_unused)(void)
+{
+ /* unused functions made by macros */
+ (void)rna_Mesh_skin_vertice_index_range;
+ (void)rna_Mesh_tessface_uv_texture_active_set;
+ (void)rna_Mesh_tessface_uv_texture_clone_get;
+ (void)rna_Mesh_tessface_uv_texture_clone_index_get;
+ (void)rna_Mesh_tessface_uv_texture_clone_index_set;
+ (void)rna_Mesh_tessface_uv_texture_clone_set;
+ (void)rna_Mesh_tessface_uv_texture_index_range;
+ (void)rna_Mesh_tessface_uv_texture_render_get;
+ (void)rna_Mesh_tessface_uv_texture_render_index_get;
+ (void)rna_Mesh_tessface_uv_texture_render_index_set;
+ (void)rna_Mesh_tessface_uv_texture_render_set;
+ (void)rna_Mesh_tessface_uv_texture_stencil_get;
+ (void)rna_Mesh_tessface_uv_texture_stencil_index_get;
+ (void)rna_Mesh_tessface_uv_texture_stencil_index_set;
+ (void)rna_Mesh_tessface_uv_texture_stencil_set;
+ (void)rna_Mesh_tessface_vertex_color_active_set;
+ (void)rna_Mesh_tessface_vertex_color_index_range;
+ (void)rna_Mesh_tessface_vertex_color_render_get;
+ (void)rna_Mesh_tessface_vertex_color_render_index_get;
+ (void)rna_Mesh_tessface_vertex_color_render_index_set;
+ (void)rna_Mesh_tessface_vertex_color_render_set;
+ (void)rna_Mesh_uv_layer_render_get;
+ (void)rna_Mesh_uv_layer_render_index_get;
+ (void)rna_Mesh_uv_layer_render_index_set;
+ (void)rna_Mesh_uv_layer_render_set;
+ (void)rna_Mesh_uv_texture_render_get;
+ (void)rna_Mesh_uv_texture_render_index_get;
+ (void)rna_Mesh_uv_texture_render_index_set;
+ (void)rna_Mesh_uv_texture_render_set;
+ (void)rna_Mesh_vertex_color_render_get;
+ (void)rna_Mesh_vertex_color_render_index_get;
+ (void)rna_Mesh_vertex_color_render_index_set;
+ (void)rna_Mesh_vertex_color_render_set;
+ /* end unused function block */
+}
+
#else
static void rna_def_mvert_group(BlenderRNA *brna)
@@ -3003,4 +3043,3 @@ void RNA_def_mesh(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 27201ea6389..2013fd7318e 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2148,6 +2148,23 @@ static void def_cmp_inpaint(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
+static void def_cmp_despeckle(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Threshold for detecting pixels to despeckle");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "threshold_neighbour", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom4");
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Neighbour", "Threshold for the number of neighbour pixels that must match");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+}
+
static void def_cmp_scale(StructRNA *srna)
{
PropertyRNA *prop;
@@ -3711,7 +3728,7 @@ static void def_cmp_keying(StructRNA *srna)
RNA_def_property_float_sdna(prop, NULL, "clip_white");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Clip White", "Value of non-scaled matte pixel which considers as fully foreground pixel");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "blur_pre", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "blur_pre");
@@ -3790,12 +3807,12 @@ static void def_cmp_trackpos(StructRNA *srna)
prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "tracking_object");
RNA_def_property_ui_text(prop, "Tracking Object", "");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "track_name");
RNA_def_property_ui_text(prop, "Track", "");
- RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
/* -- Texture Nodes --------------------------------------------------------- */
@@ -4124,7 +4141,7 @@ static void rna_def_node_socket(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDDEN);
RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set");
RNA_def_property_ui_text(prop, "Hide", "Hide the socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_IN_USE);
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index c70dd01cd57..15ad1c557a5 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -122,6 +122,7 @@ DefNode( CompositorNode, CMP_NODE_ZCOMBINE, def_cmp_zcombine, "ZCOMB
DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" )
DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" )
DefNode( CompositorNode, CMP_NODE_INPAINT, def_cmp_inpaint, "INPAINT", Inpaint, "Inpaint", "" )
+DefNode( CompositorNode, CMP_NODE_DESPECKLE, def_cmp_despeckle, "DESPECKLE", Despeckle, "Despeckle", "" )
DefNode( CompositorNode, CMP_NODE_ROTATE, def_cmp_rotate, "ROTATE", Rotate, "Rotate", "" )
DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" )
DefNode( CompositorNode, CMP_NODE_SEPYCCA, def_cmp_ycc, "SEPYCCA", SepYCCA, "Separate YCCA", "" )
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index e1f45e4de17..e69d313b23b 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -313,7 +313,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
if (!base)
return;
- SWAP(int, base->lay, ob->lay);
+ SWAP(unsigned int, base->lay, ob->lay);
rna_Object_layer_update__internal(bmain, scene, base, ob);
ob->lay = base->lay;
@@ -1768,7 +1768,7 @@ static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Add a new modifier");
- parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the bone");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* modifier to add */
parm = RNA_def_enum(func, "type", modifier_type_items, 1, "", "Modifier type to add");
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 8cf3b718c30..fc3dfafe133 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -1846,6 +1846,11 @@ static void rna_def_particle_settings(BlenderRNA *brna)
"particle rotation axis)");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
+ prop = RNA_def_property(srna, "use_scale_dupli", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "draw", PART_DRAW_NO_SCALE_OB);
+ RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 09099ca5d93..597c2294ade 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -209,7 +209,7 @@ EnumPropertyItem snap_node_element_items[] = {
#define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
R_IMF_ENUM_BMP \
- R_IMF_ENUM_DDS \
+ /* DDS save not supported yet R_IMF_ENUM_DDS */ \
R_IMF_ENUM_IRIS \
R_IMF_ENUM_PNG \
R_IMF_ENUM_JPEG \
@@ -2995,7 +2995,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
{CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
{CODEC_ID_QTRLE, "QTRLE", 0, "QTRLE", ""},
- /* {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""}, */ /* disabled for after release */
+ {CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 6fc304e6bbb..a3884b62ec1 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -30,6 +30,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
@@ -58,11 +59,25 @@ typedef struct EffectInfo {
int supports_mask;
} EffectInfo;
+EnumPropertyItem sequence_modifier_type_items[] = {
+ {seqModifierType_ColorBalance, "COLOR_BALANCE", ICON_NONE, "Color Balance", ""},
+ {seqModifierType_Curves, "CURVES", ICON_NONE, "Curves", ""},
+ {seqModifierType_HueCorrect, "HUE_CORRECT", ICON_NONE, "Hue Correct", ""},
+ {seqModifierType_BrightContrast, "BRIGHT_CONTRAST", ICON_NONE, "Bright/Contrast", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifdef RNA_RUNTIME
+#include "BKE_report.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
typedef struct SequenceSearchData {
Sequence *seq;
void *data;
+ SequenceModifierData *smd;
} SequenceSearchData;
/* build a temp reference to the parent */
@@ -332,8 +347,9 @@ static char *rna_SequenceTransform_path(PointerRNA *ptr)
return BLI_strdup("");
}
-static void rna_SequenceTransform_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_SequenceTransform_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq = sequence_get_by_transform(ed, ptr->data);
@@ -376,8 +392,9 @@ static char *rna_SequenceCrop_path(PointerRNA *ptr)
return BLI_strdup("");
}
-static void rna_SequenceCrop_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_SequenceCrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq = sequence_get_by_crop(ed, ptr->data);
@@ -613,8 +630,9 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
}
#endif
-static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
if (ed) {
@@ -638,8 +656,9 @@ static int rna_Sequence_otherSequence_poll(PointerRNA *ptr, PointerRNA value)
return TRUE;
}
-static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
BKE_sequencer_free_imbuf(scene, &ed->seqbase, FALSE, FALSE);
@@ -648,16 +667,18 @@ static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *scene,
BKE_sequencer_update_sound_bounds(scene, ptr->data);
}
-static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_mute_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
BKE_sequencer_update_muting(ed);
rna_Sequence_update(bmain, scene, ptr);
}
-static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Sequence *seq = (Sequence *)(ptr->data);
BKE_sequence_reload_new_file(scene, seq, TRUE);
BKE_sequence_calc(scene, seq);
@@ -686,8 +707,9 @@ static Sequence *sequence_get_by_proxy(Editing *ed, StripProxy *proxy)
return data.seq;
}
-static void rna_Sequence_tcindex_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Sequence_tcindex_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
@@ -695,8 +717,9 @@ static void rna_Sequence_tcindex_update(Main *bmain, Scene *scene, PointerRNA *p
rna_Sequence_frame_change_update(scene, seq);
}
-static void rna_SequenceProxy_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_SequenceProxy_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
@@ -722,42 +745,77 @@ static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt)
if (seq->strip && seq->strip->color_balance == data->data) {
data->seq = seq;
+ data->smd = NULL;
return -1; /* done so bail out */
}
+
+ if (seq->modifiers.first) {
+ SequenceModifierData *smd = seq->modifiers.first;
+
+ for (smd = seq->modifiers.first; smd; smd = smd->next) {
+ if (smd->type == seqModifierType_ColorBalance) {
+ ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
+
+ if (&cbmd->color_balance == data->data) {
+ data->seq = seq;
+ data->smd = smd;
+ return -1; /* done so bail out */
+ }
+ }
+ }
+ }
+
return 1;
}
-static Sequence *sequence_get_by_colorbalance(Editing *ed, StripColorBalance *cb)
+static Sequence *sequence_get_by_colorbalance(Editing *ed, StripColorBalance *cb, SequenceModifierData **smd_r)
{
SequenceSearchData data;
data.seq = NULL;
+ data.smd = NULL;
data.data = cb;
/* irritating we need to search for our sequence! */
BKE_sequencer_base_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data);
+ *smd_r = data.smd;
+
return data.seq;
}
static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
{
Scene *scene = ptr->id.data;
+ SequenceModifierData *smd;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
- Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data);
+ Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
- if (seq && seq->name + 2)
- return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", seq->name + 2);
+ if (seq && seq->name + 2) {
+ if (!smd) {
+ /* path to old filter color balance */
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", seq->name + 2);
+ }
+ else {
+ /* path to modifier */
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"].color_balance", seq->name + 2, smd->name);
+ }
+ }
else
return BLI_strdup("");
}
-static void rna_SequenceColorBalance_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_SequenceColorBalance_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
+ Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
- Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data);
+ SequenceModifierData *smd;
+ Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
- BKE_sequence_invalidate_cache(scene, seq);
+ if (smd == NULL)
+ BKE_sequence_invalidate_cache(scene, seq);
+ else
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
}
static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, int value)
@@ -825,6 +883,161 @@ static float rna_WipeSequence_angle_get(PointerRNA *ptr)
return DEG2RADF(((WipeVars *)seq->effectdata)->angle);
}
+static int modifier_seq_cmp_cb(Sequence *seq, void *arg_pt)
+{
+ SequenceSearchData *data = arg_pt;
+
+ if (BLI_findindex(&seq->modifiers, data->data) != -1) {
+ data->seq = seq;
+ return -1; /* done so bail out */
+ }
+
+ return 1;
+}
+
+static Sequence *sequence_get_by_modifier(Editing *ed, SequenceModifierData *smd)
+{
+ SequenceSearchData data;
+
+ data.seq = NULL;
+ data.data = smd;
+
+ /* irritating we need to search for our sequence! */
+ BKE_sequencer_base_recursive_apply(&ed->seqbase, modifier_seq_cmp_cb, &data);
+
+ return data.seq;
+}
+
+static StructRNA *rna_SequenceModifier_refine(struct PointerRNA *ptr)
+{
+ SequenceModifierData *smd = (SequenceModifierData *) ptr->data;
+
+ switch (smd->type) {
+ case seqModifierType_ColorBalance:
+ return &RNA_ColorBalanceModifier;
+ case seqModifierType_Curves:
+ return &RNA_CurvesModifier;
+ case seqModifierType_HueCorrect:
+ return &RNA_HueCorrectModifier;
+ case seqModifierType_BrightContrast:
+ return &RNA_BrightContrastModifier;
+ default:
+ return &RNA_SequenceModifier;
+ }
+}
+
+static char *rna_SequenceModifier_path(PointerRNA *ptr)
+{
+ Scene *scene = ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
+ SequenceModifierData *smd = ptr->data;
+ Sequence *seq = sequence_get_by_modifier(ed, smd);
+
+ if (seq && seq->name + 2)
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"]", seq->name + 2, smd->name);
+ else
+ return BLI_strdup("");
+}
+
+static void rna_SequenceModifier_name_set(PointerRNA *ptr, const char *value)
+{
+ SequenceModifierData *smd = ptr->data;
+ Scene *scene = (Scene *) ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
+ Sequence *seq = sequence_get_by_modifier(ed, smd);
+ AnimData *adt;
+ char oldname[sizeof(smd->name)];
+
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, smd->name, sizeof(smd->name));
+
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(smd->name, value, sizeof(smd->name));
+
+ /* make sure the name is truly unique */
+ BKE_sequence_modifier_unique_name(seq, smd);
+
+ /* fix all the animation data which may link to this */
+ adt = BKE_animdata_from_id(&scene->id);
+ if (adt) {
+ char path[1024];
+
+ BLI_snprintf(path, sizeof(path), "sequence_editor.sequences_all[\"%s\"].modifiers", seq->name + 2);
+ BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, path, oldname, smd->name, 0, 0, 1);
+ }
+}
+
+static void rna_SequenceModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ /* strip from other scenes could be modified, so using active scene is not reliable */
+ Scene *scene = (Scene *) ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
+ Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
+
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+}
+
+static int rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value)
+{
+ Scene *scene = (Scene *) ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
+ Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
+ Sequence *cur = (Sequence *) value.data;
+
+ if (seq == cur)
+ return FALSE;
+
+ if (BKE_sequence_check_depend(seq, cur))
+ return FALSE;
+
+ return TRUE;
+}
+
+static SequenceModifierData *rna_Sequence_modifier_new(Sequence *seq, bContext *C, ReportList *reports, const char *name, int type)
+{
+ if (!BKE_sequence_supports_modifiers(seq)) {
+ BKE_report(reports, RPT_ERROR, "Sequence type does not support modifiers");
+
+ return NULL;
+ }
+ else {
+ Scene *scene = CTX_data_scene(C);
+ SequenceModifierData *smd;
+
+ smd = BKE_sequence_modifier_new(seq, name, type);
+
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+
+ return smd;
+ }
+}
+
+static void rna_Sequence_modifier_remove(Sequence *seq, bContext *C, ReportList *reports, SequenceModifierData *smd)
+{
+ Scene *scene = CTX_data_scene(C);
+
+ if (BKE_sequence_modifier_remove(seq, smd)) {
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Modifier was not found in the stack");
+ }
+}
+
+static void rna_Sequence_modifier_clear(Sequence *seq, bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+
+ BKE_sequence_modifier_clear(seq);
+
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+}
#else
@@ -991,13 +1204,13 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
}
-static void rna_def_strip_color_balance(BlenderRNA *brna)
+static void rna_def_color_balance(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SequenceColorBalance", NULL);
- RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance parameters for a sequence strip");
+ srna = RNA_def_struct(brna, "SequenceColorBalanceData", NULL);
+ RNA_def_struct_ui_text(srna, "Sequence Color Balance Data", "Color balance parameters for a sequence strip and it's modifiers");
RNA_def_struct_sdna(srna, "StripColorBalance");
prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR);
@@ -1005,19 +1218,19 @@ static void rna_def_strip_color_balance(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
+
prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR);
RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)");
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
+
prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR);
RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)");
RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
RNA_def_property_float_default(prop, 1.0f);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
+
prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
RNA_def_property_ui_text(prop, "Inverse Gain", "");
@@ -1033,20 +1246,29 @@ static void rna_def_strip_color_balance(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Inverse Lift", "");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
- RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
-
/* not yet used */
#if 0
prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Exposure", "");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
-
+
prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Saturation", "");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
#endif
+
+ RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
+}
+
+static void rna_def_strip_color_balance(BlenderRNA *brna)
+{
+ StructRNA *srna;
+
+ srna = RNA_def_struct(brna, "SequenceColorBalance", "SequenceColorBalanceData");
+ RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance parameters for a sequence strip");
+ RNA_def_struct_sdna(srna, "StripColorBalance");
}
EnumPropertyItem blend_mode_items[] = {
@@ -1062,6 +1284,45 @@ EnumPropertyItem blend_mode_items[] = {
{0, NULL, 0, NULL, NULL}
};
+static void rna_def_sequence_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "SequenceModifiers");
+ srna = RNA_def_struct(brna, "SequenceModifiers", NULL);
+ RNA_def_struct_sdna(srna, "Sequence");
+ RNA_def_struct_ui_text(srna, "Strip Modifiers", "Collection of strip modifiers");
+
+ /* add modifier */
+ func = RNA_def_function(srna, "new", "rna_Sequence_modifier_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new modifier");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* modifier to add */
+ parm = RNA_def_enum(func, "type", sequence_modifier_type_items, seqModifierType_ColorBalance, "", "Modifier type to add");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Newly created modifier");
+ RNA_def_function_return(func, parm);
+
+ /* remove modifier */
+ func = RNA_def_function(srna, "remove", "rna_Sequence_modifier_remove");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an existing modifier from the sequence");
+ /* modifier to remove */
+ parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Modifier to remove");
+ RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+
+ /* clear all modifiers */
+ func = RNA_def_function(srna, "clear", "rna_Sequence_modifier_clear");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Remove all modifiers from the sequence");
+}
+
static void rna_def_sequence(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1253,6 +1514,12 @@ static void rna_def_sequence(BlenderRNA *brna)
"to this frame");
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ /* modifiers */
+ prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SequenceModifier");
+ RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting this strip");
+ rna_def_sequence_modifiers(brna, prop);
+
RNA_api_sequence_strip(srna);
}
@@ -1475,7 +1742,7 @@ static void rna_def_effect_inputs(StructRNA *srna, int count, int supports_mask)
*/
if (supports_mask) {
- prop = RNA_def_property(srna, "input_mask", PROP_POINTER, PROP_NONE);
+ prop = RNA_def_property(srna, "input_mask_strip", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence");
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Sequence_otherSequence_poll");
RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -1963,8 +2230,155 @@ static void rna_def_effects(BlenderRNA *brna)
}
}
+static void rna_def_modifier(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem mask_input_type_items[] = {
+ {SEQUENCE_MASK_INPUT_STRIP, "STRIP", 0, "Strip", "Use sequencer strip as mask input"},
+ {SEQUENCE_MASK_INPUT_ID, "ID", 0, "Mask", "Use mask ID as mask input"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "SequenceModifier", NULL);
+ RNA_def_struct_sdna(srna, "SequenceModifierData");
+ RNA_def_struct_ui_text(srna, "SequenceModifier", "Modifier for sequence strip");
+ RNA_def_struct_refine_func(srna, "rna_SequenceModifier_refine");
+ RNA_def_struct_path_func(srna, "rna_SequenceModifier_path");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceModifier_name_set");
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, sequence_modifier_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_MUTE);
+ RNA_def_property_ui_text(prop, "Mute", "Mute this modifier");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_EXPANDED);
+ RNA_def_property_ui_text(prop, "Expanded", "Mute expanded settings for the modifier");
+ RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "input_mask_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mask_input_type");
+ RNA_def_property_enum_items(prop, mask_input_type_items);
+ RNA_def_property_ui_text(prop, "Mask Input Type", "Type of input data used for mask");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "input_mask_strip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_SequenceModifier_otherSequence_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask Strip", "Strip used as mask input for the modifier");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "input_mask_id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_id");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask", "Mask ID used as mask input for the modifier");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+}
+
+static void rna_def_colorbalance_modifier(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ColorBalanceModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "ColorBalanceModifierData");
+ RNA_def_struct_ui_text(srna, "ColorBalanceModifier", "Color balance modifier for sequence strip");
+
+ prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SequenceColorBalanceData");
+
+ prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "color_multiply");
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Multiply Colors", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+}
+
+static void rna_def_curves_modifier(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "CurvesModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "CurvesModifierData");
+ RNA_def_struct_ui_text(srna, "CurvesModifier", "RGB curves modifier for sequence strip");
+
+ prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve Mapping", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+}
+
+static void rna_def_hue_modifier(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "HueCorrectModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "HueCorrectModifierData");
+ RNA_def_struct_ui_text(srna, "HueCorrectModifier", "Hue correction modifier for sequence strip");
+
+ prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve Mapping", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+}
+
+static void rna_def_brightcontrast_modifier(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BrightContrastModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "BrightContrastModifierData");
+ RNA_def_struct_ui_text(srna, "BrightContrastModifier", "Bright/contrast modifier data for sequence strip");
+
+ prop = RNA_def_property(srna, "bright", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "bright");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Bright", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "contrast");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Contrast", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+}
+
+static void rna_def_modifiers(BlenderRNA *brna)
+{
+ rna_def_modifier(brna);
+
+ rna_def_colorbalance_modifier(brna);
+ rna_def_curves_modifier(brna);
+ rna_def_hue_modifier(brna);
+ rna_def_brightcontrast_modifier(brna);
+}
+
void RNA_def_sequencer(BlenderRNA *brna)
{
+ rna_def_color_balance(brna);
+
rna_def_strip_element(brna);
rna_def_strip_proxy(brna);
rna_def_strip_color_balance(brna);
@@ -1983,6 +2397,7 @@ void RNA_def_sequencer(BlenderRNA *brna)
rna_def_sound(brna);
rna_def_effect(brna);
rna_def_effects(brna);
+ rna_def_modifiers(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 456df187fff..ad14c60e532 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2656,6 +2656,14 @@ static void rna_def_space_time(BlenderRNA *brna)
static void rna_def_console_line(BlenderRNA *brna)
{
+ static EnumPropertyItem console_line_type_items[] = {
+ {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""},
+ {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
+ {CONSOLE_LINE_INFO, "INFO", 0, "Info", ""},
+ {CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
StructRNA *srna;
PropertyRNA *prop;
@@ -2673,6 +2681,11 @@ static void rna_def_console_line(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "cursor");
RNA_def_property_int_funcs(prop, NULL, NULL, "rna_ConsoleLine_cursor_index_range");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, console_line_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Console line type when used in scrollback");
}
static void rna_def_space_console(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 0898ba5608f..172a79970b5 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -910,7 +910,7 @@ static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
"Frame number to find marker for", MINFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_boolean(func, "exact", TRUE, "Exact",
- "Get marker at exact frame number rather than get estimated marker");
+ "Get marker at exact frame number rather than get estimated marker");
parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 96ddcce6004..cf43bd74d72 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -125,6 +125,7 @@ void RNA_api_ui_layout(StructRNA *srna)
{0, "NONE", 0, "None", ""},
{'v', "VECTOR", 0, "Vector", ""},
{'c', "COLOR", 0, "Color", ""},
+ {'h', "HUE", 0, "Hue", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e3cd236a8e3..7cebbe5a895 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3358,7 +3358,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
/* global options */
prop = RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.25f, 4.0f);
- RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse");
+ RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse for panning");
+
+ prop = RNA_def_property(srna, "ndof_orbit_sensitivity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.25f, 4.0f);
+ RNA_def_property_ui_text(prop, "Orbit Sensitivity", "Overall sensitivity of the 3D Mouse for orbiting");
prop = RNA_def_property(srna, "ndof_zoom_updown", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_UPDOWN);
@@ -3375,6 +3379,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation");
/* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/
+ /* 3D view */
+ prop = RNA_def_property(srna, "ndof_turntable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_TURNTABLE);
+ RNA_def_property_ui_text(prop, "Turntable", "Turntable for ndof rotation");
+
/* 3D view: roll */
prop = RNA_def_property(srna, "ndof_roll_invert_axis", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROLL_INVERT_AXIS);
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index fb9788fb278..5c78a8efe23 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -67,9 +67,9 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
}
static void foreachObjectLink(
- ModifierData *md, Object *ob,
- void (*walk)(void *userData, Object *ob, Object **obpoin),
- void *userData)
+ ModifierData *md, Object *ob,
+ void (*walk)(void *userData, Object *ob, Object **obpoin),
+ void *userData)
{
BooleanModifierData *bmd = (BooleanModifierData *) md;
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index c80b4dfa4de..2530a230e0a 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -127,8 +127,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
}
static void sphere_do(
- CastModifierData *cmd, Object *ob, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+ CastModifierData *cmd, Object *ob, DerivedMesh *dm,
+ float (*vertexCos)[3], int numVerts)
{
MDeformVert *dvert = NULL;
@@ -299,8 +299,8 @@ static void sphere_do(
}
static void cuboid_do(
- CastModifierData *cmd, Object *ob, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+ CastModifierData *cmd, Object *ob, DerivedMesh *dm,
+ float (*vertexCos)[3], int numVerts)
{
MDeformVert *dvert = NULL;
Object *ctrl_ob = NULL;
@@ -600,8 +600,8 @@ static void deformVerts(ModifierData *md, Object *ob,
}
static void deformVertsEM(
- ModifierData *md, Object *ob, struct BMEditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+ ModifierData *md, Object *ob, struct BMEditMesh *editData,
+ DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
CastModifierData *cmd = (CastModifierData *)md;
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 21cbc2b766c..988d15e8df4 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -166,8 +166,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
/* dm must be a CDDerivedMesh */
static void displaceModifier_do(
- DisplaceModifierData *dmd, Object *ob,
- DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
+ DisplaceModifierData *dmd, Object *ob,
+ DerivedMesh *dm, float (*vertexCos)[3], int numVerts)
{
int i;
MVert *mvert;
@@ -183,11 +183,16 @@ static void displaceModifier_do(
mvert = CDDM_get_verts(dm);
modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
- tex_co = MEM_callocN(sizeof(*tex_co) * numVerts,
- "displaceModifier_do tex_co");
- get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts);
+ if (dmd->texture) {
+ tex_co = MEM_callocN(sizeof(*tex_co) * numVerts,
+ "displaceModifier_do tex_co");
+ get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts);
- modifier_init_texture(dmd->modifier.scene, dmd->texture);
+ modifier_init_texture(dmd->modifier.scene, dmd->texture);
+ }
+ else {
+ tex_co = NULL;
+ }
for (i = 0; i < numVerts; i++) {
TexResult texres;
@@ -236,7 +241,9 @@ static void displaceModifier_do(
}
}
- MEM_freeN(tex_co);
+ if (tex_co) {
+ MEM_freeN(tex_co);
+ }
}
static void deformVerts(ModifierData *md, Object *ob,
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index 694f4f174e8..c9121010d5d 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -98,8 +98,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
}
static void updateDepgraph(
- ModifierData *md, DagForest *forest, Scene *scene,
- Object *ob, DagNode *obNode)
+ ModifierData *md, DagForest *forest, Scene *scene,
+ Object *ob, DagNode *obNode)
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
Base *base;
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 2c05b164d86..d64ccf750b2 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -82,9 +82,9 @@ static int isDisabled(ModifierData *md, int UNUSED(userRenderParams))
}
static void foreachObjectLink(
- ModifierData *md, Object *ob,
- void (*walk)(void *userData, Object *ob, Object **obpoin),
- void *userData)
+ ModifierData *md, Object *ob,
+ void (*walk)(void *userData, Object *ob, Object **obpoin),
+ void *userData)
{
LatticeModifierData *lmd = (LatticeModifierData *) md;
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index aafb21b3c34..f0bdf1bb737 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -104,9 +104,9 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
}
static void foreachObjectLink(
- ModifierData *md, Object *ob,
- void (*walk)(void *userData, Object *ob, Object **obpoin),
- void *userData)
+ ModifierData *md, Object *ob,
+ void (*walk)(void *userData, Object *ob, Object **obpoin),
+ void *userData)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData *) md;
@@ -182,8 +182,8 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3
}
static void meshdeformModifier_do(
- ModifierData *md, Object *ob, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts)
+ ModifierData *md, Object *ob, DerivedMesh *dm,
+ float (*vertexCos)[3], int numVerts)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData *) md;
struct Mesh *me = (mmd->object) ? mmd->object->data : NULL;
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index ecdc5b53460..890e45f7e80 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -199,8 +199,8 @@ static void deformVerts(ModifierData *md, Object *ob,
* updates is coded */
#if 0
static void deformVertsEM(
- ModifierData *md, Object *ob, EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+ ModifierData *md, Object *ob, EditMesh *editData,
+ DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
DerivedMesh *dm = derivedData;
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 9eb360f6819..95f6ef60665 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -195,6 +195,10 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
if (wmd->curfalloff == NULL) /* should never happen, but bad lib linking could cause it */
wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+ if (wmd->curfalloff) {
+ curvemapping_initialize(wmd->curfalloff);
+ }
+
invert_m4_m4(obinv, ob->obmat);
mult_m4_m4m4(mat_from, obinv, wmd->object_from->obmat);
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 81cdad0d5e5..7181b5bbb44 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -73,6 +73,10 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
return;
}
+ if (cmap && falloff_type == MOD_WVG_MAPPING_CURVE) {
+ curvemapping_initialize(cmap);
+ }
+
/* Map each weight (vertex) to its new value, accordingly to the chosen mode. */
for (i = 0; i < num; ++i) {
float fac = new_w[i];
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index d95751af82f..e1adb419a8a 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -59,6 +59,7 @@ set(SRC
composite/nodes/node_composite_composite.c
composite/nodes/node_composite_crop.c
composite/nodes/node_composite_curves.c
+ composite/nodes/node_composite_despeckle.c
composite/nodes/node_composite_doubleEdgeMask.c
composite/nodes/node_composite_defocus.c
composite/nodes/node_composite_diffMatte.c
@@ -251,4 +252,8 @@ if(WITH_COMPOSITOR)
add_definitions(-DWITH_COMPOSITOR)
endif()
+if(WITH_COMPOSITOR_LEGACY)
+ add_definitions(-DWITH_COMPOSITOR_LEGACY)
+endif()
+
blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h
index 92e547288c9..bcef230e1d0 100644
--- a/source/blender/nodes/NOD_composite.h
+++ b/source/blender/nodes/NOD_composite.h
@@ -81,6 +81,7 @@ void register_node_type_cmp_bilateralblur(struct bNodeTreeType *ttype);
void register_node_type_cmp_vecblur(struct bNodeTreeType *ttype);
void register_node_type_cmp_dilateerode(struct bNodeTreeType *ttype);
void register_node_type_cmp_inpaint(struct bNodeTreeType *ttype);
+void register_node_type_cmp_despeckle(struct bNodeTreeType *ttype);
void register_node_type_cmp_defocus(struct bNodeTreeType *ttype);
void register_node_type_cmp_valtorgb(struct bNodeTreeType *ttype);
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index bf70b5a6ed5..ec4f00a199a 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -40,6 +40,9 @@ if env['WITH_BF_COMPOSITOR']:
incs += ' ../compositor '
defs.append("WITH_COMPOSITOR")
+if env['WITH_BF_COMPOSITOR_LEGACY']:
+ defs.append("WITH_COMPOSITOR_LEGACY")
+
env.BlenderLib ( libname = 'bf_nodes', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [190,105] )
env.BlenderLib ( libname = 'bf_cmpnodes', sources = cmpsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] )
env.BlenderLib ( libname = 'bf_shdnodes', sources = shdsources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [175,101] )
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index c6ad97c31da..37444b6da92 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -95,7 +95,9 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
for (sock= node->outputs.first; sock; sock= sock->next) {
if (sock->cache) {
+#ifdef WITH_COMPOSITOR_LEGACY
free_compbuf(sock->cache);
+#endif
sock->cache= NULL;
}
}
@@ -159,8 +161,9 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree)
for (sock= node->outputs.first; sock; sock= sock->next) {
sock->new_sock->cache= sock->cache;
+#ifdef WITH_COMPOSITOR_LEGACY
compbuf_set_node(sock->new_sock->cache, node->new_node);
-
+#endif
sock->cache= NULL;
sock->new_sock->new_sock= sock;
}
@@ -236,7 +239,9 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
for (lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
lsock->new_sock->cache= lsock->cache;
+#ifdef WITH_COMPOSITOR_LEGACY
compbuf_set_node(lsock->new_sock->cache, lnode->new_node);
+#endif
lsock->cache= NULL;
lsock->new_sock= NULL;
}
@@ -359,6 +364,7 @@ void ntreeCompositEndExecTree(bNodeTreeExec *exec, int use_tree_data)
}
#ifdef WITH_COMPOSITOR
+#ifdef WITH_COMPOSITOR_LEGACY
/* ***************************** threaded version for execute composite nodes ************* */
/* these are nodes without input, only giving values */
@@ -685,20 +691,29 @@ static void ntreeCompositExecTreeOld(bNodeTree *ntree, RenderData *rd, int do_pr
/* XXX top-level tree uses the ntree->execdata pointer */
ntreeCompositEndExecTree(exec, 1);
}
-#endif
+#endif /* WITH_COMPOSITOR_LEGACY */
+#endif /* WITH_COMPOSITOR */
void *COM_linker_hack = NULL;
void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int rendering, int do_preview)
{
#ifdef WITH_COMPOSITOR
+#ifdef WITH_COMPOSITOR_LEGACY
if (G.debug_value == 200)
+ {
ntreeCompositExecTreeOld(ntree, rd, do_preview);
+ }
else
+#endif
+ {
COM_execute(rd, ntree, rendering);
+ }
#else
(void)ntree, (void)rd, (void)rendering, (void)do_preview;
#endif
+
+ (void)do_preview;
}
/* *********************************************** */
@@ -780,13 +795,13 @@ static void force_hidden_passes(bNode *node, int passflag)
void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene)
{
bNode *node;
-
- if (ntree==NULL) return;
-
- for (node= ntree->nodes.first; node; node= node->next) {
- if ( node->type==CMP_NODE_R_LAYERS) {
- Scene *sce= node->id?(Scene *)node->id:curscene;
- SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
+
+ if (ntree == NULL) return;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_R_LAYERS) {
+ Scene *sce = node->id ? (Scene *)node->id : curscene;
+ SceneRenderLayer *srl = BLI_findlink(&sce->r.layers, node->custom1);
if (srl)
force_hidden_passes(node, srl->passflag);
}
@@ -794,7 +809,7 @@ void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene)
* Updates should only happen when actually necessary.
*/
#if 0
- else if ( node->type==CMP_NODE_IMAGE) {
+ else if (node->type == CMP_NODE_IMAGE) {
nodeUpdate(ntree, node);
}
#endif
@@ -807,15 +822,15 @@ void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene)
void ntreeCompositTagRender(Scene *curscene)
{
Scene *sce;
-
- for (sce= G.main->scene.first; sce; sce= sce->id.next) {
+
+ for (sce = G.main->scene.first; sce; sce = sce->id.next) {
if (sce->nodetree) {
bNode *node;
-
- for (node= sce->nodetree->nodes.first; node; node= node->next) {
- if (node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE)
+
+ for (node = sce->nodetree->nodes.first; node; node = node->next) {
+ if (node->id == (ID *)curscene || node->type == CMP_NODE_COMPOSITE)
nodeUpdate(sce->nodetree, node);
- else if (node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */
+ else if (node->type == CMP_NODE_TEXTURE) /* uses scene sizex/sizey */
nodeUpdate(sce->nodetree, node);
}
}
@@ -829,37 +844,37 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
Link *link;
PointerRNA ptr;
PropertyRNA *prop;
-
+
/* check to see if any of the node's properties have fcurves */
RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr);
lb = RNA_struct_type_properties(ptr.type);
-
- for (link=lb->first; link; link=link->next) {
- int driven, len=1, index;
+
+ for (link = lb->first; link; link = link->next) {
+ int driven, len = 1, index;
prop = (PropertyRNA *)link;
-
+
if (RNA_property_array_check(prop))
len = RNA_property_array_length(&ptr, prop);
-
- for (index=0; index<len; index++) {
+
+ for (index = 0; index < len; index++) {
if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) {
nodeUpdate(ntree, node);
return 1;
}
}
}
-
+
/* now check node sockets */
- for (sock = node->inputs.first; sock; sock=sock->next) {
- int driven, len=1, index;
-
+ for (sock = node->inputs.first; sock; sock = sock->next) {
+ int driven, len = 1, index;
+
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
prop = RNA_struct_find_property(&ptr, "default_value");
if (prop) {
if (RNA_property_array_check(prop))
len = RNA_property_array_length(&ptr, prop);
-
- for (index=0; index<len; index++) {
+
+ for (index = 0; index < len; index++) {
if (rna_get_fcurve(&ptr, prop, index, NULL, &driven)) {
nodeUpdate(ntree, node);
return 1;
@@ -875,42 +890,42 @@ static int node_animation_properties(bNodeTree *ntree, bNode *node)
int ntreeCompositTagAnimated(bNodeTree *ntree)
{
bNode *node;
- int tagged= 0;
-
- if (ntree==NULL) return 0;
-
- for (node= ntree->nodes.first; node; node= node->next) {
-
+ int tagged = 0;
+
+ if (ntree == NULL) return 0;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+
tagged = node_animation_properties(ntree, node);
-
+
/* otherwise always tag these node types */
- if (node->type==CMP_NODE_IMAGE) {
- Image *ima= (Image *)node->id;
+ if (node->type == CMP_NODE_IMAGE) {
+ Image *ima = (Image *)node->id;
if (ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
nodeUpdate(ntree, node);
- tagged= 1;
+ tagged = 1;
}
}
- else if (node->type==CMP_NODE_TIME) {
+ else if (node->type == CMP_NODE_TIME) {
nodeUpdate(ntree, node);
- tagged= 1;
+ tagged = 1;
}
/* here was tag render layer, but this is called after a render, so re-composites fail */
- else if (node->type==NODE_GROUP) {
- if ( ntreeCompositTagAnimated((bNodeTree *)node->id) ) {
+ else if (node->type == NODE_GROUP) {
+ if (ntreeCompositTagAnimated((bNodeTree *)node->id) ) {
nodeUpdate(ntree, node);
}
}
else if (ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) {
nodeUpdate(ntree, node);
- tagged= 1;
+ tagged = 1;
}
- else if (node->type==CMP_NODE_MASK) {
+ else if (node->type == CMP_NODE_MASK) {
nodeUpdate(ntree, node);
- tagged= 1;
+ tagged = 1;
}
}
-
+
return tagged;
}
@@ -919,11 +934,11 @@ int ntreeCompositTagAnimated(bNodeTree *ntree)
void ntreeCompositTagGenerators(bNodeTree *ntree)
{
bNode *node;
-
- if (ntree==NULL) return;
-
- for (node= ntree->nodes.first; node; node= node->next) {
- if ( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
+
+ if (ntree == NULL) return;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
nodeUpdate(ntree, node);
}
}
@@ -932,12 +947,12 @@ void ntreeCompositTagGenerators(bNodeTree *ntree)
void ntreeCompositClearTags(bNodeTree *ntree)
{
bNode *node;
-
- if (ntree==NULL) return;
-
- for (node= ntree->nodes.first; node; node= node->next) {
- node->need_exec= 0;
- if (node->type==NODE_GROUP)
+
+ if (ntree == NULL) return;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ node->need_exec = 0;
+ if (node->type == NODE_GROUP)
ntreeCompositClearTags((bNodeTree *)node->id);
}
}
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 1b9ff610e4c..2277c5a2836 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -29,9 +29,10 @@
* \ingroup nodes
*/
-
#include "node_composite_util.h"
+#ifdef WITH_COMPOSITOR_LEGACY
+
#include <limits.h>
CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
@@ -145,7 +146,7 @@ CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, in
if (disprect.xmin>= disprect.xmax) return NULL;
if (disprect.ymin>= disprect.ymax) return NULL;
- cbuf= alloc_compbuf(disprect.xmax-disprect.xmin, disprect.ymax-disprect.ymin, type, 1);
+ cbuf= alloc_compbuf(BLI_RCT_SIZE_X(&disprect), BLI_RCT_SIZE_Y(&disprect), type, 1);
outfp= cbuf->rect;
rectf += type*(disprect.ymin*rectx + disprect.xmin);
dx= type*cbuf->x;
@@ -1405,3 +1406,4 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy)
#undef YVV
}
+#endif /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h
index 8f772b19d5e..f2719ee0779 100644
--- a/source/blender/nodes/composite/node_composite_util.h
+++ b/source/blender/nodes/composite/node_composite_util.h
@@ -86,6 +86,9 @@
/* only for forward declarations */
#include "NOD_composite.h"
+#define CMP_SCALE_MAX 12000
+
+#ifdef WITH_COMPOSITOR_LEGACY
/* *************************** operations support *************************** */
@@ -198,9 +201,9 @@ void IIR_gauss(CompBuf* src, float sigma, int chan, int xy);
/* transformations */
-#define CMP_SCALE_MAX 12000
-
CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, float scale, int filter_type);
float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc);
#endif
+
+#endif /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 588574e324c..86eb0aa2c83 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -29,7 +29,6 @@
* \ingroup cmpnodes
*/
-
#include "node_composite_util.h"
/* **************** ALPHAOVER ******************** */
@@ -44,6 +43,8 @@ static bNodeSocketTemplate cmp_node_alphaover_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
@@ -109,8 +110,6 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over,
}
-
-
static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order in: col col */
@@ -139,7 +138,9 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
}
}
-static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
}
@@ -153,7 +154,9 @@ void register_node_type_cmp_alphaover(bNodeTreeType *ttype)
node_type_size(&ntype, 80, 40, 120);
node_type_init(&ntype, node_alphaover_init);
node_type_storage(&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_alphaover);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index 0137093658c..e05ef1ea5a5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
#define INIT_C3 \
mean0 = 1; \
mean1[0] = src[0]; \
@@ -254,6 +256,8 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
free_compbuf(new);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeBilateralBlurData *nbbd = MEM_callocN(sizeof(NodeBilateralBlurData), "node bilateral blur data");
@@ -271,7 +275,9 @@ void register_node_type_cmp_bilateralblur(bNodeTreeType *ttype)
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_bilateralblur);
node_type_storage(&ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_bilateralblur);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index fb163222781..b9b2406631b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_blur_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static float *make_gausstab(int filtertype, int rad)
{
float *gausstab, sum, val;
@@ -720,6 +722,8 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
generate_preview(data, node, out[0]->data);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage = MEM_callocN(sizeof(NodeBlurData), "node blur data");
@@ -734,7 +738,9 @@ void register_node_type_cmp_blur(bNodeTreeType *ttype)
node_type_size(&ntype, 120, 80, 200);
node_type_init(&ntype, node_composit_init_blur);
node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_blur);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
index 24378c4d5b7..c5697679f90 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate cmp_node_bokehimage_out[]= {
{ SOCK_RGBA, 0, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
-static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeBokehImage * data = MEM_callocN(sizeof(NodeBokehImage), "NodeBokehImage");
data->angle = 0.0f;
diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.c b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
index 81c13980f22..1ba522c0e5f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_boxmask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.c
@@ -46,7 +46,7 @@ static bNodeSocketTemplate cmp_node_boxmask_out[]= {
{ -1, 0, "" }
};
-static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeBoxMask *data = MEM_callocN(sizeof(NodeBoxMask), "NodeBoxMask");
data->x = 0.5;
diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c
index 8761d35f18f..2b8a394d6f2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_brightness.c
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c
@@ -47,6 +47,8 @@ static bNodeSocketTemplate cmp_node_brightcontrast_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, float *in_brightness, float *in_contrast)
{
float i;
@@ -92,6 +94,8 @@ static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, b
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_brightcontrast(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -99,7 +103,9 @@ void register_node_type_cmp_brightcontrast(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_brightcontrast_in, cmp_node_brightcontrast_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_brightcontrast);
-
+#endif
+
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index 6163d8f01b1..cda6fa85d74 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_channel_matte_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_normalized_rgba_to_ycca2(bNode *UNUSED(node), float *out, float *in)
{
/*normalize to the range 0.0 to 1.0) */
@@ -179,13 +181,15 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
out[0]->data=outbuf;
if (out[1]->hasoutput)
out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
-
+
if (cbuf!=in[0]->data)
free_compbuf(cbuf);
}
-static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage=c;
@@ -209,7 +213,9 @@ void register_node_type_cmp_channel_matte(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_channel_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_channel_matte);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index 0c6ce79c51f..55ee1b090bb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_chroma_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_rgba_to_ycca_normalized(bNode *UNUSED(node), float *out, float *in)
{
rgb_to_ycc(in[0], in[1], in[2], &out[0], &out[1], &out[2], BLI_YCC_ITU_BT601);
@@ -171,8 +173,9 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
free_compbuf(cbuf);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
-static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage= c;
@@ -192,7 +195,9 @@ void register_node_type_cmp_chroma_matte(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 80, 300);
node_type_init(&ntype, node_composit_init_chroma_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_chroma_matte);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 8aad5bdf179..37fb29811ba 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_color_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_color_key(bNode *node, float *out, float *in)
{
float h_wrap;
@@ -112,7 +114,9 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
free_compbuf(cbuf);
}
-static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node color");
node->storage= c;
@@ -132,7 +136,9 @@ void register_node_type_cmp_color_matte(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 80, 300);
node_type_init(&ntype, node_composit_init_color_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_color_matte);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index 678091790ea..c4120ab22c6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -47,6 +47,8 @@ static bNodeSocketTemplate cmp_node_color_spill_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_simple_spillmap_red(bNode *node, float* out, float *in)
{
NodeColorspill *ncs;
@@ -315,7 +317,9 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
free_compbuf(spillmap);
}
-static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeColorspill *ncs= MEM_callocN(sizeof(NodeColorspill), "node colorspill");
node->storage=ncs;
@@ -335,7 +339,9 @@ void register_node_type_cmp_color_spill(bNodeTreeType *ttype)
node_type_size(&ntype, 140, 80, 200);
node_type_init(&ntype, node_composit_init_color_spill);
node_type_storage(&ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_color_spill);
-
+#endif
+
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index fa32db9b31d..0868c9467e5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -46,6 +46,8 @@ static bNodeSocketTemplate cmp_node_colorbalance_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* this function implements ASC-CDL according to the spec at http://www.asctech.org/
Slope
S = in * slope
@@ -174,7 +176,9 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo
}
}
-static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeColorBalance *n= node->storage= MEM_callocN(sizeof(NodeColorBalance), "node colorbalance");
@@ -192,7 +196,9 @@ void register_node_type_cmp_colorbalance(bNodeTreeType *ttype)
node_type_size(&ntype, 400, 200, 400);
node_type_init(&ntype, node_composit_init_colorbalance);
node_type_storage(&ntype, "NodeColorBalance", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_colorbalance);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
index 6b02202151c..ce43b2f0f2b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.c
@@ -47,7 +47,7 @@ static bNodeSocketTemplate cmp_node_colorcorrection_out[]={
{ -1,0,""}
};
-static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeColorCorrection *n= node->storage= MEM_callocN(sizeof(NodeColorCorrection), "node colorcorrection");
n->startmidtones = 0.2f;
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c
index 3a3f94f05cc..2596248d696 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.c
+++ b/source/blender/nodes/composite/nodes/node_composite_common.c
@@ -30,7 +30,6 @@
* \ingroup cmpnodes
*/
-
#include "DNA_node_types.h"
#include "BKE_node.h"
@@ -89,7 +88,7 @@ static void copy_stack(bNodeStack *to, bNodeStack *from)
copy_v4_v4(to->vec, from->vec);
to->data = from->data;
to->datatype = from->datatype;
-
+
/* tag as copy to prevent freeing */
to->is_copy = 1;
}
@@ -102,7 +101,7 @@ static void move_stack(bNodeStack *to, bNodeStack *from)
to->data = from->data;
to->datatype = from->datatype;
to->is_copy = from->is_copy;
-
+
zero_v4(from->vec);
from->data = NULL;
from->datatype = 0;
@@ -114,19 +113,19 @@ static void move_stack(bNodeStack *to, bNodeStack *from)
static void *group_initexec(bNode *node)
{
- bNodeTree *ngroup= (bNodeTree *)node->id;
+ bNodeTree *ngroup = (bNodeTree *)node->id;
bNodeTreeExec *exec;
bNodeSocket *sock;
bNodeStack *ns;
-
+
if (!ngroup)
return NULL;
-
+
/* initialize the internal node tree execution */
exec = ntreeCompositBeginExecTree(ngroup, 0);
-
+
/* tag group outputs as external to prevent freeing */
- for (sock=ngroup->outputs.first; sock; sock=sock->next) {
+ for (sock = ngroup->outputs.first; sock; sock = sock->next) {
if (!(sock->flag & SOCK_INTERNAL)) {
ns = node_get_socket_stack(exec->stack, sock);
ns->external = 1;
@@ -138,8 +137,8 @@ static void *group_initexec(bNode *node)
static void group_freeexec(bNode *UNUSED(node), void *nodedata)
{
- bNodeTreeExec *gexec= (bNodeTreeExec *)nodedata;
-
+ bNodeTreeExec *gexec = (bNodeTreeExec *)nodedata;
+
if (gexec)
ntreeCompositEndExecTree(gexec, 0);
}
@@ -167,7 +166,7 @@ static void group_move_outputs(bNode *node, bNodeStack **out, bNodeStack *gstack
bNodeSocket *sock;
bNodeStack *ns;
int a;
- for (sock=node->outputs.first, a=0; sock; sock=sock->next, ++a) {
+ for (sock = node->outputs.first, a = 0; sock; sock = sock->next, ++a) {
if (sock->groupsock) {
ns = node_get_socket_stack(gstack, sock->groupsock);
move_stack(out[a], ns);
@@ -180,11 +179,13 @@ static void group_free_internal(bNodeTreeExec *gexec)
{
bNodeStack *ns;
int i;
-
- for (i=0, ns=gexec->stack; i < gexec->stacksize; ++i, ++ns) {
+
+ for (i = 0, ns = gexec->stack; i < gexec->stacksize; ++i, ++ns) {
if (!ns->external && !ns->is_copy) {
if (ns->data) {
+#ifdef WITH_COMPOSITOR_LEGACY
free_compbuf(ns->data);
+#endif
ns->data = NULL;
}
}
@@ -217,7 +218,7 @@ void register_node_type_cmp_group(bNodeTreeType *ttype)
{
static bNodeType ntype;
- node_type_base(ttype, &ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS|NODE_CONST_OUTPUT);
+ node_type_base(ttype, &ntype, NODE_GROUP, "Group", NODE_CLASS_GROUP, NODE_OPTIONS | NODE_CONST_OUTPUT);
node_type_socket_templates(&ntype, NULL, NULL);
node_type_size(&ntype, 120, 60, 200);
node_type_label(&ntype, node_group_label);
@@ -227,10 +228,11 @@ void register_node_type_cmp_group(bNodeTreeType *ttype)
node_type_update(&ntype, NULL, node_group_verify);
node_type_group_edit(&ntype, node_group_edit_get, node_group_edit_set, node_group_edit_clear);
node_type_exec_new(&ntype, group_initexec, group_freeexec, group_execute);
-
+
nodeRegisterType(ttype, &ntype);
}
+#ifdef WITH_COMPOSITOR_LEGACY
/**** FOR LOOP ****/
@@ -377,3 +379,5 @@ void register_node_type_cmp_whileloop(bNodeTreeType *ttype)
nodeRegisterType(ttype, &ntype);
}
#endif
+
+#endif /* WITH_COMPOSITOR_LEGACY */
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index 7b189ef40e5..dadc863873d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -29,11 +29,8 @@
* \ingroup cmpnodes
*/
-
#include "node_composite_util.h"
-
-
/* **************** COMPOSITE ******************** */
static bNodeSocketTemplate cmp_node_composite_in[]= {
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
@@ -42,6 +39,8 @@ static bNodeSocketTemplate cmp_node_composite_in[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* applies to render pipeline */
static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
@@ -97,6 +96,8 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i
generate_preview(data, node, in[0]->data);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_composite(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -104,7 +105,10 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_composite_in, NULL);
node_type_size(&ntype, 80, 60, 200);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_composite);
+#endif
+
/* Do not allow muting for this node. */
node_type_internal_connect(&ntype, NULL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.c b/source/blender/nodes/composite/nodes/node_composite_crop.c
index 8d676fd6d9f..9b1483d95cf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_crop.c
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_crop_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if (in[0]->data) {
@@ -101,7 +103,9 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
}
}
-static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTwoXYs *nxy= MEM_callocN(sizeof(NodeTwoXYs), "node xy data");
node->storage= nxy;
@@ -120,7 +124,9 @@ void register_node_type_cmp_crop(bNodeTreeType *ttype)
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_crop);
node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_crop);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index b5a78015d76..1948709ec84 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -41,6 +41,8 @@ static bNodeSocketTemplate cmp_node_time_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
RenderData *rd= data;
@@ -50,12 +52,15 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack *
if (node->custom1 < node->custom2)
fac= (rd->cfra - node->custom1)/(float)(node->custom2-node->custom1);
- fac= curvemapping_evaluateF(node->storage, 0, fac);
+ curvemapping_initialize(node->storage);
+ fac = curvemapping_evaluateF(node->storage, 0, fac);
+
out[0]->vec[0]= CLAMPIS(fac, 0.0f, 1.0f);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
-static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= 1;
node->custom2= 250;
@@ -71,7 +76,9 @@ void register_node_type_cmp_curve_time(bNodeTreeType *ttype)
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_curves_time);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_curves_time);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -89,15 +96,20 @@ static bNodeSocketTemplate cmp_node_curve_vec_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order input: vec */
/* stack order output: vec */
-
+
+ curvemapping_initialize(node->storage);
curvemapping_evaluate_premulRGBF(node->storage, out[0]->vec, in[0]->vec);
}
-static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
}
@@ -111,7 +123,9 @@ void register_node_type_cmp_curve_vec(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 140, 320);
node_type_init(&ntype, node_composit_init_curve_vec);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_curve_vec);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -131,15 +145,19 @@ static bNodeSocketTemplate cmp_node_curve_rgb_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_curves(bNode *node, float *out, float *in)
{
+ curvemapping_initialize(node->storage);
curvemapping_evaluate_premulRGBF(node->storage, out, in);
out[3]= in[3];
}
static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
{
-
+ curvemapping_initialize(node->storage);
+
if (*fac >= 1.0f)
curvemapping_evaluate_premulRGBF(node->storage, out, in);
else if (*fac <= 0.0f) {
@@ -163,6 +181,8 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
if (out[0]->hasoutput==0)
return;
+ curvemapping_initialize(node->storage);
+
/* input no image? then only color operation */
if (in[1]->data==NULL) {
curvemapping_evaluateRGBF(node->storage, out[0]->vec, in[1]->vec);
@@ -184,7 +204,9 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
}
-static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
@@ -198,7 +220,9 @@ void register_node_type_cmp_curve_rgb(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 140, 320);
node_type_init(&ntype, node_composit_init_curve_rgb);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_curve_rgb);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 280ff56be12..1a9852264bf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -44,6 +44,7 @@ static bNodeSocketTemplate cmp_node_defocus_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
// line coefs for point sampling & scancon. data.
typedef struct BokehCoeffs {
@@ -865,7 +866,9 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta
if (zbuf_use && (zbuf_use != zbuf)) free_compbuf(zbuf_use);
}
-static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
/* qdn: defocus node */
NodeDefocus *nbd = MEM_callocN(sizeof(NodeDefocus), "node defocus data");
@@ -891,7 +894,9 @@ void register_node_type_cmp_defocus(bNodeTreeType *ttype)
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_defocus);
node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_defocus);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.c b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
new file mode 100644
index 00000000000..21b703dc9a8
--- /dev/null
+++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.c
@@ -0,0 +1,73 @@
+/*
+ * ***** 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) 2006 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/nodes/composite/nodes/node_composite_despeckle.c
+ * \ingroup cmpnodes
+ */
+
+#include "node_composite_util.h"
+
+/* **************** FILTER ******************** */
+static bNodeSocketTemplate cmp_node_despeckle_in[]= {
+ { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
+ { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
+ { -1, 0, "" }
+};
+static bNodeSocketTemplate cmp_node_despeckle_out[]= {
+ { SOCK_RGBA, 0, N_("Image")},
+ { -1, 0, "" }
+};
+
+#ifdef WITH_COMPOSITOR_LEGACY
+
+static void node_composit_exec_despeckle(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
+{
+ /* pass */
+}
+
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
+{
+ node->custom3 = 0.5f;
+ node->custom4 = 0.5f;
+}
+
+void register_node_type_cmp_despeckle(bNodeTreeType *ttype)
+{
+ static bNodeType ntype;
+
+ node_type_base(ttype, &ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW|NODE_OPTIONS);
+ node_type_socket_templates(&ntype, cmp_node_despeckle_in, cmp_node_despeckle_out);
+ node_type_size(&ntype, 80, 40, 120);
+ node_type_init(&ntype, node_composit_init_despeckle);
+#ifdef WITH_COMPOSITOR_LEGACY
+ node_type_exec(&ntype, node_composit_exec_despeckle);
+#endif
+
+ nodeRegisterType(ttype, &ntype);
+}
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index 53061366b8b..ed43baef420 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_diff_matte_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *inColor2)
{
NodeChroma *c= (NodeChroma *)node->storage;
@@ -126,7 +128,9 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
free_compbuf(imbuf2);
}
-static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage= c;
@@ -143,7 +147,9 @@ void register_node_type_cmp_diff_matte(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_diff_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_diff_matte);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index 5977d291388..f53c64b990a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_dilateerode_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void morpho_dilate(CompBuf *cbuf)
{
int x, y;
@@ -146,7 +148,9 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
}
}
-static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeDilateErode *data = MEM_callocN(sizeof(NodeDilateErode), "NodeDilateErode");
data->falloff = PROP_SMOOTH;
@@ -161,7 +165,9 @@ void register_node_type_cmp_dilateerode(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_dilateerode_in, cmp_node_dilateerode_out);
node_type_size(&ntype, 130, 100, 320);
node_type_init(&ntype, node_composit_init_dilateerode);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_dilateerode);
+#endif
node_type_storage(&ntype, "NodeDilateErode", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
index 73e28658309..2878d303632 100644
--- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
@@ -42,6 +42,8 @@ static bNodeSocketTemplate cmp_node_dblur_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap,
float center_x, float center_y, float dist, float angle, float spin, float zoom)
{
@@ -122,6 +124,8 @@ static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack
out[0]->data = dblur(node, new, ndbd->iter, ndbd->wrap, ndbd->center_x, ndbd->center_y, ndbd->distance, ndbd->angle, ndbd->spin, ndbd->zoom);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeDBlurData *ndbd = MEM_callocN(sizeof(NodeDBlurData), "node dblur data");
@@ -139,7 +143,9 @@ void register_node_type_cmp_dblur(bNodeTreeType *ttype)
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_dblur);
node_type_storage(&ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_dblur);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c
index 49cba801d5a..51ccc2a4d39 100644
--- a/source/blender/nodes/composite/nodes/node_composite_displace.c
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.c
@@ -47,6 +47,8 @@ static bNodeSocketTemplate cmp_node_displace_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* minimum distance (in pixels) a pixel has to be displaced
* in order to take effect */
#define DISPLACE_EPSILON 0.01f
@@ -182,6 +184,8 @@ static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeSt
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_displace(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -189,7 +193,9 @@ void register_node_type_cmp_displace(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DISPLACE, "Displace", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_displace_in, cmp_node_displace_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_displace);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index 86634487776..7a101ff43b5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_distance_matte_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* note, keyvals is passed on from caller as stack array */
/* might have been nicer as temp struct though... */
static void do_distance_matte(bNode *node, float *out, float *in)
@@ -182,7 +184,9 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
free_compbuf(inbuf);
}
-static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage= c;
@@ -200,7 +204,9 @@ void register_node_type_cmp_distance_matte(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_distance_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_distance_matte);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index c206b9a1a5d..63a54efea74 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -42,6 +42,8 @@ static bNodeSocketTemplate cmp_node_doubleedgemask_out[]= {
{ -1, 0, "" } // output socket array terminator
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
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;
@@ -1271,6 +1273,8 @@ static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, b
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype)
{
static bNodeType ntype; // allocate a node type data structure
@@ -1278,7 +1282,9 @@ void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out);
node_type_size(&ntype, 210, 210, 210);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_doubleedgemask);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
index 18a86680245..a97322a17c0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.c
@@ -46,7 +46,7 @@ static bNodeSocketTemplate cmp_node_ellipsemask_out[]= {
{ -1, 0, "" }
};
-static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeEllipseMask *data = MEM_callocN(sizeof(NodeEllipseMask), "NodeEllipseMask");
data->x = 0.5;
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index be5aab74e02..0b12c03682b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_filter_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
{
float *row1, *row2, *row3;
@@ -219,6 +221,7 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in,
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
void register_node_type_cmp_filter(bNodeTreeType *ttype)
{
@@ -228,7 +231,9 @@ void register_node_type_cmp_filter(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_filter_in, cmp_node_filter_out);
node_type_size(&ntype, 80, 40, 120);
node_type_label(&ntype, node_filter_label);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_filter);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c
index 44e93c08509..147e7591af7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_flip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_flip.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_flip_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if (in[0]->data) {
@@ -88,6 +90,8 @@ static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_flip(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -95,7 +99,9 @@ void register_node_type_cmp_flip(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_flip_in, cmp_node_flip_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_flip);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_gamma.c b/source/blender/nodes/composite/nodes/node_composite_gamma.c
index f681eb4f630..87155478035 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_gamma_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac)
{
int i=0;
@@ -75,6 +77,8 @@ static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_gamma(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -82,7 +86,9 @@ void register_node_type_cmp_gamma(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_GAMMA, "Gamma", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_gamma_in, cmp_node_gamma_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_gamma);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index 17a23d4295e..7d6c0cb1a29 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -41,6 +41,7 @@ static bNodeSocketTemplate cmp_node_glare_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
// mix two images, src buffer does not have to be same size,
static void mixImages(CompBuf *dst, CompBuf *src, float mix)
@@ -474,7 +475,9 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack
out[0]->data = new;
}
-static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeGlare *ndg = MEM_callocN(sizeof(NodeGlare), "node glare data");
ndg->quality = 1;
@@ -499,7 +502,9 @@ void register_node_type_cmp_glare(bNodeTreeType *ttype)
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_glare);
node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_glare);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index 32bfc048cc7..c8784ceedb7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_hue_sat_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
{
NodeHueSat *nhs= node->storage;
@@ -93,7 +95,9 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
}
}
-static void node_composit_init_hue_sat(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_hue_sat(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeHueSat *nhs= MEM_callocN(sizeof(NodeHueSat), "node hue sat");
node->storage= nhs;
@@ -111,7 +115,9 @@ void register_node_type_cmp_hue_sat(bNodeTreeType *ttype)
node_type_size(&ntype, 150, 80, 250);
node_type_init(&ntype, node_composit_init_hue_sat);
node_type_storage(&ntype, "NodeHueSat", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_hue_sat);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
index d40abbe5f4d..42077cd5c06 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -43,12 +43,16 @@ static bNodeSocketTemplate cmp_node_huecorrect_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_huecorrect(bNode *node, float *out, float *in)
{
float hsv[3], f;
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
+ curvemapping_initialize(node->storage);
+
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 0, hsv[0]);
hsv[0] += f-0.5f;
@@ -77,6 +81,8 @@ static void do_huecorrect_fac(bNode *node, float *out, float *in, float *fac)
rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
+ curvemapping_initialize(node->storage);
+
/* adjust hue, scaling returned default 0.5 up to 1 */
f = curvemapping_evaluateF(node->storage, 0, hsv[0]);
hsv[0] += f-0.5f;
@@ -116,7 +122,7 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode
out[0]->data = pass_on_compbuf(cbuf);
return;
}
-
+
/* input no image? then only color operation */
if (in[1]->data==NULL) {
do_huecorrect_fac(node, out[0]->vec, in[1]->vec, in[0]->vec);
@@ -135,7 +141,9 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode
}
-static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_huecorrect(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
CurveMapping *cumapping = node->storage= curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
int c;
@@ -160,7 +168,9 @@ void register_node_type_cmp_huecorrect(bNodeTreeType *ttype)
node_type_size(&ntype, 320, 140, 400);
node_type_init(&ntype, node_composit_init_huecorrect);
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_huecorrect);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c
index 09be1c54503..31a3a765ebe 100644
--- a/source/blender/nodes/composite/nodes/node_composite_idMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_idmask_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* stackbuf should be zeroed */
static void do_idmask(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
{
@@ -106,6 +108,7 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in,
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
void register_node_type_cmp_idmask(bNodeTreeType *ttype)
{
@@ -114,7 +117,9 @@ void register_node_type_cmp_idmask(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_idmask_in, cmp_node_idmask_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_idmask);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 3060496bb9e..96a92055ca9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -322,6 +322,8 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
return rect;
}
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* note: this function is used for multilayer too, to ensure uniform
* handling with BKE_image_get_ibuf() */
static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *iuser)
@@ -519,7 +521,9 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
}
}
-static void node_composit_init_image(bNodeTree *ntree, bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_image(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
@@ -563,7 +567,9 @@ void register_node_type_cmp_image(bNodeTreeType *ttype)
node_type_init(&ntype, node_composit_init_image);
node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image);
node_type_update(&ntype, cmp_node_image_update, NULL);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_image);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -571,6 +577,8 @@ void register_node_type_cmp_image(bNodeTreeType *ttype)
/* **************** RENDER RESULT ******************** */
+#ifdef WITH_COMPOSITOR_LEGACY
+
static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, int recty, int passcode)
{
float *fp= RE_RenderLayerGetPass(rl, passcode);
@@ -653,8 +661,6 @@ static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStac
out[RRES_OUT_TRANSM_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_COLOR);
}
-
-
static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
Scene *sce= (Scene *)node->id;
@@ -704,6 +710,8 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
RE_ReleaseResult(re);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_rlayers(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -711,7 +719,9 @@ void register_node_type_cmp_rlayers(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out);
node_type_size(&ntype, 150, 100, 300);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_rlayers);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.c b/source/blender/nodes/composite/nodes/node_composite_inpaint.c
index dc4177bd2a4..25ecf428b4a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_inpaint.c
+++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.c
@@ -44,10 +44,15 @@ static bNodeSocketTemplate cmp_node_inpaint_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_inpaint(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
+ /* pass */
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_inpaint(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -55,7 +60,9 @@ void register_node_type_cmp_inpaint(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_inpaint_in, cmp_node_inpaint_out);
node_type_size(&ntype, 130, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_inpaint);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index 2a91647d6f5..b0e656b173b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_invert_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_invert(bNode *node, float *out, float *in)
{
if (node->custom1 & CMP_CHAN_RGB) {
@@ -115,7 +117,9 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
}
}
-static void node_composit_init_invert(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_invert(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1 |= CMP_CHAN_RGB;
}
@@ -129,7 +133,9 @@ void register_node_type_cmp_invert(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_invert_in, cmp_node_invert_out);
node_type_size(&ntype, 120, 120, 140);
node_type_init(&ntype, node_composit_init_invert);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_invert);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.c b/source/blender/nodes/composite/nodes/node_composite_keying.c
index f3074bc8ed3..6553df350ff 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keying.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keying.c
@@ -60,11 +60,14 @@ static bNodeSocketTemplate cmp_node_keying_out[] = {
{ -1, 0, "" }
};
-static void exec(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
+#ifdef WITH_COMPOSITOR_LEGACY
+static void node_composit_exec_keying(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
+ /* pass */
}
+#endif /* WITH_COMPOSITOR_LEGACY */
-static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeKeyingData *data;
@@ -91,7 +94,9 @@ void register_node_type_cmp_keying(bNodeTreeType *ttype)
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_keying);
node_type_storage(&ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage);
- node_type_exec(&ntype, exec);
+#ifdef WITH_COMPOSITOR_LEGACY
+ node_type_exec(&ntype, node_composit_exec_keying);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
index 73423e2bdd3..e16b7e5d885 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.c
@@ -50,6 +50,7 @@ static bNodeSocketTemplate cmp_node_keyingscreen_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
static void compute_gradient_screen(RenderData *rd, NodeKeyingScreenData *keyingscreen_data, MovieClip *clip, CompBuf *screenbuf)
{
@@ -157,7 +158,7 @@ static void compute_gradient_screen(RenderData *rd, NodeKeyingScreenData *keying
BLI_freelistN(&edges);
}
-static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
+static void node_composit_exec_keyingscreen(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
NodeKeyingScreenData *keyingscreen_data = node->storage;
RenderData *rd = data;
@@ -178,7 +179,9 @@ static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **
out[0]->data = screenbuf;
}
-static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeKeyingScreenData *data;
@@ -196,7 +199,9 @@ void register_node_type_cmp_keyingscreen(bNodeTreeType *ttype)
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_keyingscreen);
node_type_storage(&ntype, "NodeKeyingScreenData", node_free_standard_storage, node_copy_standard_storage);
- node_type_exec(&ntype, exec);
+#ifdef WITH_COMPOSITOR_LEGACY
+ node_type_exec(&ntype, node_composit_exec_keyingscreen);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.c b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
index 7635a391441..a4983cce8b8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lensdist.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_lensdist_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* assumes *dst is type RGBA */
static void lensDistort(CompBuf *dst, CompBuf *src, float kr, float kg, float kb, int jit, int proj, int fit)
{
@@ -182,8 +184,9 @@ static void node_composit_exec_lensdist(void *UNUSED(data), bNode *node, bNodeSt
out[0]->data = new;
}
+#endif /* WITH_COMPOSITOR_LEGACY */
-static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeLensDist *nld = MEM_callocN(sizeof(NodeLensDist), "node lensdist data");
nld->jit = nld->proj = nld->fit = 0;
@@ -200,7 +203,9 @@ void register_node_type_cmp_lensdist(bNodeTreeType *ttype)
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_lensdist);
node_type_storage(&ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_lensdist);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index 1952756d397..601516c5bb0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -45,7 +45,9 @@ static bNodeSocketTemplate cmp_node_view_levels_out[]={
{-1, 0, ""}
};
-static void fill_bins(bNode* node, CompBuf* in, int* bins)
+#ifdef WITH_COMPOSITOR_LEGACY
+
+static void fill_bins(bNode *node, CompBuf* in, int* bins)
{
float value[4];
int ivalue=0;
@@ -102,7 +104,7 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
}
}
-static float brightness_mean(bNode* node, CompBuf* in)
+static float brightness_mean(bNode *node, CompBuf* in)
{
float sum=0.0;
int numPixels=0.0;
@@ -153,7 +155,7 @@ static float brightness_mean(bNode* node, CompBuf* in)
return sum/numPixels;
}
-static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
+static float brightness_standard_deviation(bNode *node, CompBuf* in, float mean)
{
float sum=0.0;
int numPixels=0.0;
@@ -309,7 +311,9 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
free_compbuf(histogram);
}
-static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1=1; /*All channels*/
}
@@ -323,7 +327,9 @@ void register_node_type_cmp_view_levels(bNodeTreeType *ttype)
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_view_levels);
node_type_storage(&ntype, "ImageUser", NULL, NULL);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_view_levels);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index 955d94942a4..61cd4493f39 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_luma_matte_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_luma_matte(bNode *node, float *out, float *in)
{
NodeChroma *c=(NodeChroma *)node->storage;
@@ -96,7 +98,9 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
free_compbuf(cbuf);
}
-static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeChroma *c= MEM_callocN(sizeof(NodeChroma), "node chroma");
node->storage=c;
@@ -113,7 +117,9 @@ void register_node_type_cmp_luma_matte(bNodeTreeType *ttype)
node_type_size(&ntype, 200, 80, 250);
node_type_init(&ntype, node_composit_init_luma_matte);
node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_luma_matte);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
index a41d010ee95..04d2eaff4f4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_mapuv_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* foreach UV, use these values to read in cbuf and write to stackbuf */
/* stackbuf should be zeroed */
static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float threshold)
@@ -162,6 +164,8 @@ static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_mapuv(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -169,7 +173,9 @@ void register_node_type_cmp_mapuv(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_mapuv_in, cmp_node_mapuv_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_mapuv);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
index 1d296d540f9..be69c11b35f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
@@ -42,6 +42,8 @@ static bNodeSocketTemplate cmp_node_map_value_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_map_value(bNode *node, float *out, float *src)
{
TexMapping *texmap= node->storage;
@@ -76,8 +78,9 @@ static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeS
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
-static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_tex_mapping();
}
@@ -91,7 +94,9 @@ void register_node_type_cmp_map_value(bNodeTreeType *ttype)
node_type_size(&ntype, 100, 60, 150);
node_type_init(&ntype, node_composit_init_map_value);
node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_map_value);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c
index f4cbd1b7f6f..3463c1a8413 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.c
@@ -45,7 +45,8 @@ static bNodeSocketTemplate cmp_node_mask_out[] = {
{ -1, 0, "" }
};
-static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
+#ifdef WITH_COMPOSITOR_LEGACY
+static void node_composit_exec_mask(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
if (node->id) {
Mask *mask = (Mask *)node->id;
@@ -84,8 +85,9 @@ static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **
out[0]->data = stackbuf;
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
-static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeMask *data = MEM_callocN(sizeof(NodeMask), STRINGIFY(NodeMask));
data->size_x = data->size_y = 256;
@@ -103,7 +105,9 @@ void register_node_type_cmp_mask(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, NULL, cmp_node_mask_out);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_mask);
- node_type_exec(&ntype, exec);
+#ifdef WITH_COMPOSITOR_LEGACY
+ node_type_exec(&ntype, node_composit_exec_mask);
+#endif
node_type_storage(&ntype, "NodeMask", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index 7cf337f2f88..1bddfe0852a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_math_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_math(bNode *node, float *out, float *in, float *in2)
{
switch (node->custom1) {
@@ -195,6 +197,8 @@ static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack
out[0]->data= stackbuf;
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_math(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -203,7 +207,9 @@ void register_node_type_cmp_math(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out);
node_type_size(&ntype, 120, 110, 160);
node_type_label(&ntype, node_math_label);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_math);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index 6f8891f2b81..e2c9a5abcb1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_mix_rgb_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_mix_rgb(bNode *node, float *out, float *in1, float *in2, float *fac)
{
float col[3];
@@ -81,6 +83,8 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in,
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
/* custom1 = mix type */
void register_node_type_cmp_mix_rgb(bNodeTreeType *ttype)
{
@@ -90,7 +94,9 @@ void register_node_type_cmp_mix_rgb(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
node_type_size(&ntype, 110, 60, 120);
node_type_label(&ntype, node_blend_label);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_mix_rgb);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
index e8f09ae08d7..370cff5e0d7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
@@ -42,6 +42,8 @@ static bNodeSocketTemplate cmp_node_movieclip_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, MovieClipUser *user)
{
ImBuf *orig_ibuf, *ibuf;
@@ -138,6 +140,8 @@ static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **U
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
MovieClipUser *user = MEM_callocN(sizeof(MovieClipUser), "node movie clip user");
@@ -155,7 +159,9 @@ void register_node_type_cmp_movieclip(bNodeTreeType *ttype)
node_type_size(&ntype, 120, 80, 300);
node_type_init(&ntype, init);
node_type_storage(&ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_movieclip);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index 65fe3b251d0..9f4cd467c94 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -47,7 +47,8 @@ static bNodeSocketTemplate cmp_node_moviedistortion_out[] = {
{ -1, 0, "" }
};
-static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+#ifdef WITH_COMPOSITOR_LEGACY
+static void node_composit_exec_moviedistortion(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
if (in[0]->data) {
if (node->id) {
@@ -104,6 +105,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
}
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
static const char *label(bNode *node)
{
@@ -135,7 +137,10 @@ void register_node_type_cmp_moviedistortion(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out);
node_type_size(&ntype, 140, 100, 320);
node_type_label(&ntype, label);
- node_type_exec(&ntype, exec);
+#ifdef WITH_COMPOSITOR_LEGACY
+ node_type_exec(&ntype, node_composit_exec_moviedistortion);
+#endif
+
node_type_storage(&ntype, NULL, storage_free, storage_copy);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index 99a1f9ea520..6f1e86e2760 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_normal_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_normal(bNode *node, float *out, float *in)
{
bNodeSocket *sock= node->outputs.first;
@@ -77,10 +79,10 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac
out[1]->data= stackbuf;
}
-
-
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
bNodeSocket *sock= node->outputs.first;
@@ -99,7 +101,9 @@ void register_node_type_cmp_normal(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_normal_in, cmp_node_normal_out);
node_type_init(&ntype, init);
node_type_size(&ntype, 100, 60, 200);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_normal);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index 4697ab74a95..1d2312d8280 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_normalize_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_normalize(bNode *UNUSED(node), float *out, float *src, float *min, float *mult)
{
float res;
@@ -102,6 +104,8 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_normalize(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -109,7 +113,9 @@ void register_node_type_cmp_normalize(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_NORMALIZE, "Normalize", NODE_CLASS_OP_VECTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_normalize_in, cmp_node_normalize_out);
node_type_size(&ntype, 100, 60, 150);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_normalize);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index 8a0d7200079..399cb1d1557 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -166,7 +166,7 @@ void ntreeCompositOutputFileSetLayer(bNode *node, bNodeSocket *sock, const char
ntreeCompositOutputFileUniqueLayer(&node->inputs, sock, name, '_');
}
-static void init_output_file(bNodeTree *ntree, bNode* node, bNodeTemplate *ntemp)
+static void init_output_file(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp)
{
NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
ImageFormatData *format = NULL;
@@ -227,6 +227,8 @@ static void update_output_file(bNodeTree *UNUSED(ntree), bNode *node)
}
}
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* write input data into individual files */
static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack **in)
{
@@ -386,7 +388,7 @@ static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack
IMB_exr_close(exrhandle);
}
-static void exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
+static void node_composit_exec_outputfile(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
RenderData *rd= data;
NodeImageMultiFile *nimf= node->storage;
@@ -403,6 +405,7 @@ static void exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStac
else
exec_output_file_singlelayer(rd, node, in);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
void register_node_type_cmp_output_file(bNodeTreeType *ttype)
{
@@ -414,7 +417,9 @@ void register_node_type_cmp_output_file(bNodeTreeType *ttype)
node_type_init(&ntype, init_output_file);
node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file);
node_type_update(&ntype, update_output_file, NULL);
- node_type_exec(&ntype, exec_output_file);
+#ifdef WITH_COMPOSITOR_LEGACY
+ node_type_exec(&ntype, node_composit_exec_outputfile);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.c b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
index 63b10b80462..d791983b069 100644
--- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c
+++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_premulkey_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
if (out[0]->hasoutput==0)
@@ -61,6 +63,8 @@ static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeS
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_premulkey(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -68,7 +72,9 @@ void register_node_type_cmp_premulkey(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_premulkey_in, cmp_node_premulkey_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_premulkey);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c
index beab47442d5..65c1dcdb7bb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c
@@ -39,6 +39,18 @@ static bNodeSocketTemplate cmp_node_rgb_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
+static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
+{
+ bNodeSocket *sock= node->outputs.first;
+ float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
+
+ copy_v4_v4(out[0]->vec, col);
+}
+
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void node_composit_init_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
bNodeSocket *sock= node->outputs.first;
@@ -50,14 +62,6 @@ static void node_composit_init_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeT
col[3] = 1.0f;
}
-static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
-{
- bNodeSocket *sock= node->outputs.first;
- float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
-
- copy_v4_v4(out[0]->vec, col);
-}
-
void register_node_type_cmp_rgb(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -66,7 +70,9 @@ void register_node_type_cmp_rgb(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, NULL, cmp_node_rgb_out);
node_type_init(&ntype, node_composit_init_rgb);
node_type_size(&ntype, 140, 80, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_rgb);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index 773be2fb41e..8968fd5fb3a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_rotate_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* only supports RGBA nodes now */
static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
@@ -121,7 +123,9 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
}
}
-static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= 1; /* Bilinear Filter*/
}
@@ -134,7 +138,9 @@ void register_node_type_cmp_rotate(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, cmp_node_rotate_in, cmp_node_rotate_out);
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_rotate);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_rotate);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index 1df67724762..2224d653c37 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_scale_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* only supports RGBA nodes now */
/* node->custom1 stores if input values are absolute or relative scale */
static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
@@ -182,6 +184,8 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_scale(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -189,7 +193,9 @@ void register_node_type_cmp_scale(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_scale);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index 2433cb37763..ebc18cd19eb 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -46,6 +46,8 @@ static bNodeSocketTemplate cmp_node_sephsva_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_sephsva(bNode *UNUSED(node), float *out, float *in)
{
float h, s, v;
@@ -99,6 +101,8 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_sephsva(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -106,7 +110,9 @@ void register_node_type_cmp_sephsva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPHSVA, "Separate HSVA", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_sephsva_in, cmp_node_sephsva_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_sephsva);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -125,6 +131,8 @@ static bNodeSocketTemplate cmp_node_combhsva_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_comb_hsva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r, g, b;
@@ -168,6 +176,8 @@ static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeSt
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_combhsva(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -175,7 +185,9 @@ void register_node_type_cmp_combhsva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBHSVA, "Combine HSVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combhsva_in, cmp_node_combhsva_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_combhsva);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
index 988656ac454..0c989ed3fc6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_seprgba_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
/* stack order out: bw channels */
@@ -77,6 +79,8 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node),
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_seprgba(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -84,7 +88,9 @@ void register_node_type_cmp_seprgba(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPRGBA, "Separate RGBA", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_seprgba_in, cmp_node_seprgba_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_seprgba);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -104,6 +110,8 @@ static bNodeSocketTemplate cmp_node_combrgba_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_combrgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
out[0] = in1[0];
@@ -145,6 +153,8 @@ static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeSt
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_combrgba(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -152,7 +162,9 @@ void register_node_type_cmp_combrgba(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBRGBA, "Combine RGBA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combrgba_in, cmp_node_combrgba_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_combrgba);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index 486c0ed61ee..ccae7cfe57f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -46,6 +46,8 @@ static bNodeSocketTemplate cmp_node_sepycca_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_sepycca_601(bNode *UNUSED(node), float *out, float *in)
{
float y, cb, cr;
@@ -146,6 +148,8 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_sepycca(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -153,7 +157,9 @@ void register_node_type_cmp_sepycca(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPYCCA, "Separate YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_sepycca_in, cmp_node_sepycca_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_sepycca);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -173,6 +179,8 @@ static bNodeSocketTemplate cmp_node_combycca_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_comb_ycca_601(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r, g, b;
@@ -291,6 +299,8 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_combycca(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -298,7 +308,9 @@ void register_node_type_cmp_combycca(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBYCCA, "Combine YCbCrA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combycca_in, cmp_node_combycca_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_combycca);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index fdaae7307f0..9b8c805b0f0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -46,6 +46,8 @@ static bNodeSocketTemplate cmp_node_sepyuva_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_sepyuva(bNode *UNUSED(node), float *out, float *in)
{
float y, u, v;
@@ -99,6 +101,9 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+
void register_node_type_cmp_sepyuva(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -106,7 +111,9 @@ void register_node_type_cmp_sepyuva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SEPYUVA, "Separate YUVA", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_sepyuva_in, cmp_node_sepyuva_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_sepyuva);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -126,6 +133,8 @@ static bNodeSocketTemplate cmp_node_combyuva_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_comb_yuva(bNode *UNUSED(node), float *out, float *in1, float *in2, float *in3, float *in4)
{
float r, g, b;
@@ -167,9 +176,11 @@ static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeSt
do_comb_yuva, CB_VAL, CB_VAL, CB_VAL, CB_VAL);
out[0]->data= stackbuf;
- }
+ }
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_combyuva(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -177,7 +188,9 @@ void register_node_type_cmp_combyuva(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_COMBYUVA, "Combine YUVA", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_combyuva_in, cmp_node_combyuva_out);
node_type_size(&ntype, 80, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_combyuva);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
index c273807c54d..503815b74a0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
@@ -43,6 +43,8 @@ static bNodeSocketTemplate cmp_node_setalpha_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
/* stack order out: RGBA image */
@@ -73,6 +75,9 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+
void register_node_type_cmp_setalpha(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -80,7 +85,9 @@ void register_node_type_cmp_setalpha(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_setalpha_in, cmp_node_setalpha_out);
node_type_size(&ntype, 120, 40, 140);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_setalpha);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index abccbb83bd0..f6811f526f7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -39,6 +39,8 @@ static bNodeSocketTemplate cmp_node_splitviewer_in[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac)
{
if (*fac==0.0f) {
@@ -139,7 +141,9 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
}
}
-static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
@@ -158,7 +162,10 @@ void register_node_type_cmp_splitviewer(bNodeTreeType *ttype)
node_type_size(&ntype, 140, 100, 320);
node_type_init(&ntype, node_composit_init_splitviewer);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_splitviewer);
+#endif
+
/* Do not allow muting for this node. */
node_type_internal_connect(&ntype, NULL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
index fabdf8c0536..fdf0b38e844 100644
--- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
+++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_stabilize2d_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
if (in[0]->data && node->id) {
@@ -67,6 +69,8 @@ static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack *
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_stabilize2d(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -74,7 +78,9 @@ void register_node_type_cmp_stabilize2d(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_stabilize2d_in, cmp_node_stabilize2d_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_stabilize2d);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 95458ad755b..3fedccd7d12 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_texture_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
/* called without rect allocated */
static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco)
{
@@ -142,6 +144,8 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_texture(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -149,7 +153,9 @@ void register_node_type_cmp_texture(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_OPTIONS|NODE_PREVIEW);
node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out);
node_type_size(&ntype, 120, 80, 240);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_texture);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index 50006e599e5..5e4efe2f3b1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -41,6 +41,7 @@ static bNodeSocketTemplate cmp_node_tonemap_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
static float avgLogLum(CompBuf *src, float* auto_key, float* Lav, float* Cav)
{
@@ -146,7 +147,9 @@ static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeSta
free_compbuf(img);
}
-static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTonemap *ntm = MEM_callocN(sizeof(NodeTonemap), "node tonemap data");
ntm->type = 1;
@@ -171,7 +174,9 @@ void register_node_type_cmp_tonemap(bNodeTreeType *ttype)
node_type_size(&ntype, 150, 120, 200);
node_type_init(&ntype, node_composit_init_tonemap);
node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_tonemap);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.c b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
index 09eb42b4d93..4364ca61ba1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_trackpos.c
+++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
@@ -26,7 +26,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/nodes/composite/nodes/node_composite_movieclip.c
+/** \file blender/nodes/composite/nodes/node_composite_trackpos.c
* \ingroup cmpnodes
*/
@@ -39,10 +39,15 @@ static bNodeSocketTemplate cmp_node_trackpos_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_trackpos(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
{
+ /* pass */
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTrackPosData *data = MEM_callocN(sizeof(NodeTrackPosData), "node track position data");
@@ -59,7 +64,9 @@ void register_node_type_cmp_trackpos(bNodeTreeType *ttype)
node_type_size(&ntype, 120, 80, 300);
node_type_init(&ntype, init);
node_type_storage(&ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_trackpos);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c
index 8af55cde852..a8ef0286f2f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_transform.c
+++ b/source/blender/nodes/composite/nodes/node_composite_transform.c
@@ -48,6 +48,8 @@ static bNodeSocketTemplate cmp_node_transform_out[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, float scale, int filter_type)
{
CompBuf *stackbuf = alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, TRUE);
@@ -127,6 +129,8 @@ static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeS
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_transform(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -134,7 +138,9 @@ void register_node_type_cmp_transform(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_transform_in, cmp_node_transform_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_transform);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index e147b100fce..649902ff908 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -46,6 +46,8 @@ static bNodeSocketTemplate cmp_node_translate_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
{
if (in[0]->data) {
@@ -59,6 +61,8 @@ static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node)
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_translate(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -66,7 +70,9 @@ void register_node_type_cmp_translate(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_translate_in, cmp_node_translate_out);
node_type_size(&ntype, 140, 100, 320);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_translate);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
index 429ba262164..87a776c7bea 100644
--- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
@@ -44,6 +44,8 @@ static bNodeSocketTemplate cmp_node_valtorgb_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_colorband_composit(bNode *node, float *out, float *in)
{
do_colorband(node->storage, in[0], out);
@@ -78,7 +80,9 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
}
}
-static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+#endif /* WITH_COMPOSITOR_LEGACY */
+
+static void node_composit_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_colorband(1);
}
@@ -92,7 +96,9 @@ void register_node_type_cmp_valtorgb(bNodeTreeType *ttype)
node_type_size(&ntype, 240, 200, 300);
node_type_init(&ntype, node_composit_init_valtorgb);
node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_valtorgb);
+#endif
nodeRegisterType(ttype, &ntype);
}
@@ -109,6 +115,8 @@ static bNodeSocketTemplate cmp_node_rgbtobw_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_rgbtobw(bNode *UNUSED(node), float *out, float *in)
{
out[0] = rgb_to_bw(in);
@@ -137,6 +145,8 @@ static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeSta
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_rgbtobw(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -144,7 +154,9 @@ void register_node_type_cmp_rgbtobw(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0);
node_type_socket_templates(&ntype, cmp_node_rgbtobw_in, cmp_node_rgbtobw_out);
node_type_size(&ntype, 80, 40, 120);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_rgbtobw);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_value.c b/source/blender/nodes/composite/nodes/node_composite_value.c
index 8d39b38c2fe..63ab4fcb58f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_value.c
+++ b/source/blender/nodes/composite/nodes/node_composite_value.c
@@ -49,6 +49,8 @@ static void node_composit_init_value(bNodeTree *UNUSED(ntree), bNode *node, bNod
dval->max = FLT_MAX;
}
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
{
bNodeSocket *sock= node->outputs.first;
@@ -57,6 +59,8 @@ static void node_composit_exec_value(void *UNUSED(data), bNode *node, bNodeStack
out[0]->vec[0]= val;
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_value(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -65,7 +69,9 @@ void register_node_type_cmp_value(bNodeTreeType *ttype)
node_type_socket_templates(&ntype, NULL, cmp_node_value_out);
node_type_init(&ntype, node_composit_init_value);
node_type_size(&ntype, 80, 40, 120);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_value);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
index e1a20a65227..62c2c02836a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
@@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_vecblur_out[] = {
{ -1, 0, "" }
};
-
+#ifdef WITH_COMPOSITOR_LEGACY
static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
{
@@ -85,6 +85,8 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta
free_compbuf(img);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeBlurData *nbd = MEM_callocN(sizeof(NodeBlurData), "node blur data");
@@ -103,7 +105,9 @@ void register_node_type_cmp_vecblur(bNodeTreeType *ttype)
node_type_size(&ntype, 120, 80, 200);
node_type_init(&ntype, node_composit_init_vecblur);
node_type_storage(&ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_vecblur);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index e97863a9463..6321b1def4d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -41,6 +41,7 @@ static bNodeSocketTemplate cmp_node_viewer_in[] = {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
{
@@ -122,6 +123,8 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
}
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user");
@@ -142,7 +145,10 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype)
node_type_size(&ntype, 80, 60, 200);
node_type_init(&ntype, node_composit_init_viewer);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_viewer);
+#endif
+
node_type_internal_connect(&ntype, NULL);
nodeRegisterType(ttype, &ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
index e431ff17be5..3decbe8d230 100644
--- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -48,6 +48,8 @@ static bNodeSocketTemplate cmp_node_zcombine_out[]= {
{ -1, 0, "" }
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *src2, float *z2)
{
float alpha;
@@ -219,9 +221,10 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
out[0]->data= stackbuf;
}
-
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
void register_node_type_cmp_zcombine(bNodeTreeType *ttype)
{
static bNodeType ntype;
@@ -229,7 +232,9 @@ void register_node_type_cmp_zcombine(bNodeTreeType *ttype)
node_type_base(ttype, &ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, NODE_OPTIONS);
node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out);
node_type_size(&ntype, 80, 40, 120);
+#ifdef WITH_COMPOSITOR_LEGACY
node_type_exec(&ntype, node_composit_exec_zcombine);
+#endif
nodeRegisterType(ttype, &ntype);
}
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 8e550ef3d4b..ffa636fa952 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -571,7 +571,7 @@ static ListBase node_reroute_internal_connect(bNodeTree *ntree, bNode *node)
return ret;
}
-static void node_reroute_init(bNodeTree *ntree, bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_reroute_init(bNodeTree *ntree, bNode *node, bNodeTemplate *UNUSED(ntemp))
{
/* Note: Cannot use socket templates for this, since it would reset the socket type
* on each file read via the template verification procedure.
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c
index 2821c3e3fe6..9c65323337e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.c
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c
@@ -36,7 +36,7 @@ static bNodeSocketTemplate sh_node_attribute_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeShaderAttribute *attr = MEM_callocN(sizeof(NodeShaderAttribute), "NodeShaderAttribute");
node->storage = attr;
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index be7f3c1c614..0c08f1bc215 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -55,7 +55,7 @@ static void node_shader_exec_curve_vec(void *UNUSED(data), bNode *node, bNodeSta
curvemapping_evaluate3F(node->storage, out[0]->vec, vec);
}
-static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f);
}
@@ -65,6 +65,7 @@ static int gpu_shader_curve_vec(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
float *array;
int size;
+ curvemapping_initialize(node->storage);
curvemapping_table_RGBA(node->storage, &array, &size);
return GPU_stack_link(mat, "curves_vec", in, out, GPU_texture(size, array));
}
@@ -111,7 +112,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeSta
}
}
-static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
@@ -120,6 +121,8 @@ static int gpu_shader_curve_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
{
float *array;
int size;
+
+ curvemapping_initialize(node->storage);
curvemapping_table_RGBA(node->storage, &array, &size);
return GPU_stack_link(mat, "curves_rgb", in, out, GPU_texture(size, array));
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c
index aa108271ec3..f23158ab5d4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geom.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geom.c
@@ -120,7 +120,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
}
}
-static void node_shader_init_geometry(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_geometry(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index c260cc421b3..4508f66543e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -67,7 +67,7 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack
}
-static void node_shader_init_mapping(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_mapping(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_tex_mapping();
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index 758660f7d0c..57865e072e7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -200,7 +200,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
}
-static void node_shader_init_material(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_material(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= SH_NODE_MAT_DIFF|SH_NODE_MAT_SPEC;
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
index dda451004a3..0c1e7dcb995 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
@@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_tex_checker_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexChecker *tex = MEM_callocN(sizeof(NodeTexChecker), "NodeTexChecker");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
index e3300c89a01..572f06e007b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -39,7 +39,7 @@ static bNodeSocketTemplate sh_node_tex_environment_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexEnvironment *tex = MEM_callocN(sizeof(NodeTexEnvironment), "NodeTexEnvironment");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
index 20a524ad00c..a7f869155fa 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
@@ -40,7 +40,7 @@ static bNodeSocketTemplate sh_node_tex_gradient_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexGradient *tex = MEM_callocN(sizeof(NodeTexGradient), "NodeTexGradient");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index d4d43c1430c..176c50bcabb 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -40,7 +40,7 @@ static bNodeSocketTemplate sh_node_tex_image_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexImage *tex = MEM_callocN(sizeof(NodeTexImage), "NodeTexImage");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
index 8d7607a9c72..b9f1b5c1d21 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
@@ -42,7 +42,7 @@ static bNodeSocketTemplate sh_node_tex_magic_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexMagic *tex = MEM_callocN(sizeof(NodeTexMagic), "NodeTexMagic");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
index e71695df680..60b4f65f0b4 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
@@ -46,7 +46,7 @@ static bNodeSocketTemplate sh_node_tex_musgrave_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexMusgrave *tex = MEM_callocN(sizeof(NodeTexMusgrave), "NodeTexMusgrave");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
index 95b81c5e1fb..bd049300048 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
@@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_tex_noise_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexNoise *tex = MEM_callocN(sizeof(NodeTexNoise), "NodeTexNoise");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
index 48020c10aa0..977d689ace6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
@@ -39,7 +39,7 @@ static bNodeSocketTemplate sh_node_tex_sky_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexSky *tex = MEM_callocN(sizeof(NodeTexSky), "NodeTexSky");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
index e654666db26..22baa3853ac 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_tex_voronoi_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexVoronoi *tex = MEM_callocN(sizeof(NodeTexVoronoi), "NodeTexVoronoi");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
index 8a6994e7b73..8a099521ee9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
@@ -44,7 +44,7 @@ static bNodeSocketTemplate sh_node_tex_wave_out[]= {
{ -1, 0, "" }
};
-static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
NodeTexWave *tex = MEM_callocN(sizeof(NodeTexWave), "NodeTexWave");
default_tex_mapping(&tex->base.tex_mapping);
diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
index fb3316c2036..d3094200f83 100644
--- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
@@ -57,7 +57,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac
}
}
-static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= add_colorband(1);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index 7435034845f..f6259962529 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -50,7 +50,7 @@ static bNodeSocketTemplate outputs[]= {
{ -1, 0, "" }
};
-static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->custom3 = 0.5; /* offset */
node->custom4 = 1.0; /* squash */
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index a56d69a6657..543b39ec75e 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -49,6 +49,7 @@ static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNU
if (node->custom1 < node->custom2)
fac = (p->cfra - node->custom1)/(float)(node->custom2-node->custom1);
+ curvemapping_initialize(node->storage);
fac = curvemapping_evaluateF(node->storage, 0, fac);
out[0] = CLAMPIS(fac, 0.0f, 1.0f);
}
@@ -59,7 +60,7 @@ static void time_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out
}
-static void time_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void time_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->custom1= 1;
node->custom2= 250;
@@ -105,7 +106,7 @@ static void rgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
tex_output(node, in, out[0], &rgb_colorfn, data);
}
-static void rgb_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void rgb_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index d49a1edd70c..7ce91c37295 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -86,7 +86,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
tex_output(node, in, out[0], &colorfn, data);
}
-static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
node->storage= iuser;
diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index 9383d5675cb..ce22bc00a55 100644
--- a/source/blender/nodes/texture/nodes/node_texture_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -141,7 +141,7 @@ static void assign_index(struct bNode *node)
node->custom1 = index;
}
-static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
TexNodeOutput *tno = MEM_callocN(sizeof(TexNodeOutput), "TEX_output");
node->storage= tno;
diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c
index 3b33383c73b..102f6e1c428 100644
--- a/source/blender/nodes/texture/nodes/node_texture_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -281,7 +281,7 @@ ProcDef(stucci)
/* --- */
-static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
Tex *tex = MEM_callocN(sizeof(Tex), "Tex");
node->storage= tex;
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
index 10db0debd5b..515613509f6 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
@@ -57,7 +57,7 @@ static void valtorgb_exec(void *data, bNode *node, bNodeStack **in, bNodeStack *
tex_output(node, in, out[0], &valtorgb_colorfn, data);
}
-static void valtorgb_init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void valtorgb_init(bNodeTree *UNUSED(ntree), bNode *node, bNodeTemplate *UNUSED(ntemp))
{
node->storage = add_colorband(1);
}
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
index f3e5b300ced..e02efc79da0 100644
--- a/source/blender/python/bmesh/bmesh_py_api.c
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -97,9 +97,9 @@ static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value)
}
static struct PyMethodDef BPy_BM_methods[] = {
- {"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc},
- {"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc},
- {NULL, NULL, 0, NULL}
+ {"new", (PyCFunction)bpy_bm_new, METH_NOARGS, bpy_bm_new_doc},
+ {"from_edit_mesh", (PyCFunction)bpy_bm_from_edit_mesh, METH_O, bpy_bm_from_edit_mesh_doc},
+ {NULL, NULL, 0, NULL}
};
PyDoc_STRVAR(BPy_BM_doc,
diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index 8e7c4810b08..c16b1fb901f 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -420,7 +420,7 @@ static PyObject *bpy_bmesh_fmod_getattro(PyObject *UNUSED(self), PyObject *pynam
}
PyErr_Format(PyExc_AttributeError,
- "BMeshOpsModule: operator \"%.200s\" doesn't exist",
+ "BMeshOpsModule: operator \"%.200s\" doesn't exist",
name);
return NULL;
}
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 9270aec8d95..d7d9baf35ed 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -55,34 +55,34 @@
/* scene does not use BM_* flags. */
PyC_FlagSet bpy_bm_scene_vert_edge_face_flags[] = {
- {1, "VERT"},
- {2, "EDGE"},
- {4, "FACE"},
- {0, NULL}
+ {1, "VERT"},
+ {2, "EDGE"},
+ {4, "FACE"},
+ {0, NULL}
};
PyC_FlagSet bpy_bm_htype_vert_edge_face_flags[] = {
- {BM_VERT, "VERT"},
- {BM_EDGE, "EDGE"},
- {BM_FACE, "FACE"},
- {0, NULL}
+ {BM_VERT, "VERT"},
+ {BM_EDGE, "EDGE"},
+ {BM_FACE, "FACE"},
+ {0, NULL}
};
PyC_FlagSet bpy_bm_htype_all_flags[] = {
- {BM_VERT, "VERT"},
- {BM_LOOP, "EDGE"},
- {BM_FACE, "FACE"},
- {BM_LOOP, "LOOP"},
- {0, NULL}
+ {BM_VERT, "VERT"},
+ {BM_LOOP, "EDGE"},
+ {BM_FACE, "FACE"},
+ {BM_LOOP, "LOOP"},
+ {0, NULL}
};
PyC_FlagSet bpy_bm_hflag_all_flags[] = {
- {BM_ELEM_SELECT, "SELECT"},
- {BM_ELEM_HIDDEN, "HIDE"},
- {BM_ELEM_SEAM, "SEAM"},
- {BM_ELEM_SMOOTH, "SMOOTH"},
- {BM_ELEM_TAG, "TAG"},
- {0, NULL}
+ {BM_ELEM_SELECT, "SELECT"},
+ {BM_ELEM_HIDDEN, "HIDE"},
+ {BM_ELEM_SEAM, "SEAM"},
+ {BM_ELEM_SMOOTH, "SMOOTH"},
+ {BM_ELEM_TAG, "TAG"},
+ {0, NULL}
};
/* py-type definitions
@@ -556,131 +556,131 @@ static PyObject *bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
}
static PyGetSetDef bpy_bmesh_getseters[] = {
- {(char *)"verts", (getter)bpy_bmvertseq_get, (setter)NULL, (char *)bpy_bmvertseq_doc, NULL},
- {(char *)"edges", (getter)bpy_bmedgeseq_get, (setter)NULL, (char *)bpy_bmedgeseq_doc, NULL},
- {(char *)"faces", (getter)bpy_bmfaceseq_get, (setter)NULL, (char *)bpy_bmfaceseq_doc, NULL},
- {(char *)"loops", (getter)bpy_bmloopseq_get, (setter)NULL, (char *)bpy_bmloopseq_doc, NULL},
- {(char *)"select_mode", (getter)bpy_bmesh_select_mode_get, (setter)bpy_bmesh_select_mode_set, (char *)bpy_bmesh_select_mode_doc, NULL},
+ {(char *)"verts", (getter)bpy_bmvertseq_get, (setter)NULL, (char *)bpy_bmvertseq_doc, NULL},
+ {(char *)"edges", (getter)bpy_bmedgeseq_get, (setter)NULL, (char *)bpy_bmedgeseq_doc, NULL},
+ {(char *)"faces", (getter)bpy_bmfaceseq_get, (setter)NULL, (char *)bpy_bmfaceseq_doc, NULL},
+ {(char *)"loops", (getter)bpy_bmloopseq_get, (setter)NULL, (char *)bpy_bmloopseq_doc, NULL},
+ {(char *)"select_mode", (getter)bpy_bmesh_select_mode_get, (setter)bpy_bmesh_select_mode_set, (char *)bpy_bmesh_select_mode_doc, NULL},
- {(char *)"select_history", (getter)bpy_bmesh_select_history_get, (setter)bpy_bmesh_select_history_set, (char *)bpy_bmesh_select_history_doc, NULL},
+ {(char *)"select_history", (getter)bpy_bmesh_select_history_get, (setter)bpy_bmesh_select_history_set, (char *)bpy_bmesh_select_history_doc, NULL},
- /* readonly checks */
- {(char *)"is_wrapped", (getter)bpy_bmesh_is_wrapped_get, (setter)NULL, (char *)bpy_bmesh_is_wrapped_doc, NULL}, /* as with mathutils */
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+ /* readonly checks */
+ {(char *)"is_wrapped", (getter)bpy_bmesh_is_wrapped_get, (setter)NULL, (char *)bpy_bmesh_is_wrapped_doc, NULL}, /* as with mathutils */
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmvert_getseters[] = {
- /* generic */
- {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
- {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
- {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
- {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
-
- {(char *)"co", (getter)bpy_bmvert_co_get, (setter)bpy_bmvert_co_set, (char *)bpy_bmvert_co_doc, NULL},
- {(char *)"normal", (getter)bpy_bmvert_normal_get, (setter)bpy_bmvert_normal_set, (char *)bpy_bmvert_normal_doc, NULL},
-
- /* connectivity data */
- {(char *)"link_edges", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_edges_doc, (void *)BM_EDGES_OF_VERT},
- {(char *)"link_faces", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_faces_doc, (void *)BM_FACES_OF_VERT},
- {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_loops_doc, (void *)BM_LOOPS_OF_VERT},
-
- /* readonly checks */
- {(char *)"is_manifold", (getter)bpy_bmvert_is_manifold_get, (setter)NULL, (char *)bpy_bmvert_is_manifold_doc, NULL},
- {(char *)"is_wire", (getter)bpy_bmvert_is_wire_get, (setter)NULL, (char *)bpy_bmvert_is_wire_doc, NULL},
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
-
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ /* generic */
+ {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
+ {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
+ {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
+ {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
+
+ {(char *)"co", (getter)bpy_bmvert_co_get, (setter)bpy_bmvert_co_set, (char *)bpy_bmvert_co_doc, NULL},
+ {(char *)"normal", (getter)bpy_bmvert_normal_get, (setter)bpy_bmvert_normal_set, (char *)bpy_bmvert_normal_doc, NULL},
+
+ /* connectivity data */
+ {(char *)"link_edges", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_edges_doc, (void *)BM_EDGES_OF_VERT},
+ {(char *)"link_faces", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_faces_doc, (void *)BM_FACES_OF_VERT},
+ {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_loops_doc, (void *)BM_LOOPS_OF_VERT},
+
+ /* readonly checks */
+ {(char *)"is_manifold", (getter)bpy_bmvert_is_manifold_get, (setter)NULL, (char *)bpy_bmvert_is_manifold_doc, NULL},
+ {(char *)"is_wire", (getter)bpy_bmvert_is_wire_get, (setter)NULL, (char *)bpy_bmvert_is_wire_doc, NULL},
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmedge_getseters[] = {
- /* generic */
- {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
- {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
- {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
- {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
+ /* generic */
+ {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
+ {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
+ {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
+ {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
- {(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH},
- {(char *)"seam", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_seam_doc, (void *)BM_ELEM_SEAM},
+ {(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH},
+ {(char *)"seam", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_seam_doc, (void *)BM_ELEM_SEAM},
- /* connectivity data */
- {(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_verts_doc, (void *)BM_VERTS_OF_EDGE},
+ /* connectivity data */
+ {(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_verts_doc, (void *)BM_VERTS_OF_EDGE},
- {(char *)"link_faces", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_link_faces_doc, (void *)BM_FACES_OF_EDGE},
- {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_link_loops_doc, (void *)BM_LOOPS_OF_EDGE},
+ {(char *)"link_faces", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_link_faces_doc, (void *)BM_FACES_OF_EDGE},
+ {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_link_loops_doc, (void *)BM_LOOPS_OF_EDGE},
- /* readonly checks */
- {(char *)"is_manifold", (getter)bpy_bmedge_is_manifold_get, (setter)NULL, (char *)bpy_bmedge_is_manifold_doc, NULL},
- {(char *)"is_wire", (getter)bpy_bmedge_is_wire_get, (setter)NULL, (char *)bpy_bmedge_is_wire_doc, NULL},
- {(char *)"is_boundary", (getter)bpy_bmedge_is_boundary_get, (setter)NULL, (char *)bpy_bmedge_is_boundary_doc, NULL},
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+ /* readonly checks */
+ {(char *)"is_manifold", (getter)bpy_bmedge_is_manifold_get, (setter)NULL, (char *)bpy_bmedge_is_manifold_doc, NULL},
+ {(char *)"is_wire", (getter)bpy_bmedge_is_wire_get, (setter)NULL, (char *)bpy_bmedge_is_wire_doc, NULL},
+ {(char *)"is_boundary", (getter)bpy_bmedge_is_boundary_get, (setter)NULL, (char *)bpy_bmedge_is_boundary_doc, NULL},
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmface_getseters[] = {
- /* generic */
- {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
- {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
- {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
- {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
+ /* generic */
+ {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
+ {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
+ {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
+ {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
- {(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH},
+ {(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH},
- {(char *)"normal", (getter)bpy_bmface_normal_get, (setter)bpy_bmface_normal_set, (char *)bpy_bmface_normal_doc, NULL},
+ {(char *)"normal", (getter)bpy_bmface_normal_get, (setter)bpy_bmface_normal_set, (char *)bpy_bmface_normal_doc, NULL},
- {(char *)"material_index", (getter)bpy_bmface_material_index_get, (setter)bpy_bmface_material_index_set, (char *)bpy_bmface_material_index_doc, NULL},
+ {(char *)"material_index", (getter)bpy_bmface_material_index_get, (setter)bpy_bmface_material_index_set, (char *)bpy_bmface_material_index_doc, NULL},
- /* connectivity data */
- {(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_verts_doc, (void *)BM_VERTS_OF_FACE},
- {(char *)"edges", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_edges_doc, (void *)BM_EDGES_OF_FACE},
- {(char *)"loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_loops_doc, (void *)BM_LOOPS_OF_FACE},
+ /* connectivity data */
+ {(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_verts_doc, (void *)BM_VERTS_OF_FACE},
+ {(char *)"edges", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_edges_doc, (void *)BM_EDGES_OF_FACE},
+ {(char *)"loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_loops_doc, (void *)BM_LOOPS_OF_FACE},
- /* readonly checks */
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+ /* readonly checks */
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmloop_getseters[] = {
- /* generic */
- // flags are available but not used for loops.
- // {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
- // {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
- {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
- {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
-
- {(char *)"vert", (getter)bpy_bmloop_vert_get, (setter)NULL, (char *)bpy_bmloop_vert_doc, NULL},
- {(char *)"edge", (getter)bpy_bmloop_edge_get, (setter)NULL, (char *)bpy_bmloop_edge_doc, NULL},
- {(char *)"face", (getter)bpy_bmloop_face_get, (setter)NULL, (char *)bpy_bmloop_face_doc, NULL},
-
- /* connectivity data */
- {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmloops_link_loops_doc, (void *)BM_LOOPS_OF_LOOP},
- {(char *)"link_loop_next", (getter)bpy_bmloop_link_loop_next_get, (setter)NULL, (char *)bpy_bmloop_link_loop_next_doc, NULL},
- {(char *)"link_loop_prev", (getter)bpy_bmloop_link_loop_prev_get, (setter)NULL, (char *)bpy_bmloop_link_loop_prev_doc, NULL},
-
- /* readonly checks */
- {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
-
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ /* generic */
+ // flags are available but not used for loops.
+ // {(char *)"select", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_select_doc, (void *)BM_ELEM_SELECT},
+ // {(char *)"hide", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_hide_doc, (void *)BM_ELEM_HIDDEN},
+ {(char *)"tag", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc, (void *)BM_ELEM_TAG},
+ {(char *)"index", (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc, NULL},
+
+ {(char *)"vert", (getter)bpy_bmloop_vert_get, (setter)NULL, (char *)bpy_bmloop_vert_doc, NULL},
+ {(char *)"edge", (getter)bpy_bmloop_edge_get, (setter)NULL, (char *)bpy_bmloop_edge_doc, NULL},
+ {(char *)"face", (getter)bpy_bmloop_face_get, (setter)NULL, (char *)bpy_bmloop_face_doc, NULL},
+
+ /* connectivity data */
+ {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmloops_link_loops_doc, (void *)BM_LOOPS_OF_LOOP},
+ {(char *)"link_loop_next", (getter)bpy_bmloop_link_loop_next_get, (setter)NULL, (char *)bpy_bmloop_link_loop_next_doc, NULL},
+ {(char *)"link_loop_prev", (getter)bpy_bmloop_link_loop_prev_get, (setter)NULL, (char *)bpy_bmloop_link_loop_prev_doc, NULL},
+
+ /* readonly checks */
+ {(char *)"is_valid", (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmvertseq_getseters[] = {
- {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_VERT},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_VERT},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmedgeseq_getseters[] = {
- {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_EDGE},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_EDGE},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmfaceseq_getseters[] = {
- {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_FACE},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_FACE},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmloopseq_getseters[] = {
- {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_LOOP},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"layers", (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_LOOP},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -2159,12 +2159,14 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
"|Oi:BMElemSeq.sort",
(char **)kwlist,
&keyfunc, &reverse))
+ {
return NULL;
+ }
}
if (keyfunc != NULL && !PyCallable_Check(keyfunc)) {
PyErr_SetString(PyExc_TypeError,
- "the 'key' argument is not a callable object");
+ "the 'key' argument is not a callable object");
return NULL;
}
@@ -2278,129 +2280,129 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
}
static struct PyMethodDef bpy_bmesh_methods[] = {
- /* utility */
- {"copy", (PyCFunction)bpy_bmesh_copy, METH_NOARGS, bpy_bmesh_copy_doc},
- {"clear", (PyCFunction)bpy_bmesh_clear, METH_NOARGS, bpy_bmesh_clear_doc},
- {"free", (PyCFunction)bpy_bmesh_free, METH_NOARGS, bpy_bmesh_free_doc},
-
- /* conversion */
- {"from_object", (PyCFunction)bpy_bmesh_from_object, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_object_doc},
- {"from_mesh", (PyCFunction)bpy_bmesh_from_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_mesh_doc},
- {"to_mesh", (PyCFunction)bpy_bmesh_to_mesh, METH_VARARGS, bpy_bmesh_to_mesh_doc},
-
- /* meshdata */
- {"select_flush_mode", (PyCFunction)bpy_bmesh_select_flush_mode, METH_NOARGS, bpy_bmesh_select_flush_mode_doc},
- {"select_flush", (PyCFunction)bpy_bmesh_select_flush, METH_O, bpy_bmesh_select_flush_doc},
- {"normal_update", (PyCFunction)bpy_bmesh_normal_update, METH_VARARGS, bpy_bmesh_normal_update_doc},
- {"transform", (PyCFunction)bpy_bmesh_transform, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_transform_doc},
- {NULL, NULL, 0, NULL}
+ /* utility */
+ {"copy", (PyCFunction)bpy_bmesh_copy, METH_NOARGS, bpy_bmesh_copy_doc},
+ {"clear", (PyCFunction)bpy_bmesh_clear, METH_NOARGS, bpy_bmesh_clear_doc},
+ {"free", (PyCFunction)bpy_bmesh_free, METH_NOARGS, bpy_bmesh_free_doc},
+
+ /* conversion */
+ {"from_object", (PyCFunction)bpy_bmesh_from_object, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_object_doc},
+ {"from_mesh", (PyCFunction)bpy_bmesh_from_mesh, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_mesh_doc},
+ {"to_mesh", (PyCFunction)bpy_bmesh_to_mesh, METH_VARARGS, bpy_bmesh_to_mesh_doc},
+
+ /* meshdata */
+ {"select_flush_mode", (PyCFunction)bpy_bmesh_select_flush_mode, METH_NOARGS, bpy_bmesh_select_flush_mode_doc},
+ {"select_flush", (PyCFunction)bpy_bmesh_select_flush, METH_O, bpy_bmesh_select_flush_doc},
+ {"normal_update", (PyCFunction)bpy_bmesh_normal_update, METH_VARARGS, bpy_bmesh_normal_update_doc},
+ {"transform", (PyCFunction)bpy_bmesh_transform, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_transform_doc},
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmvert_methods[] = {
- {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
- {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
- {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
- {"copy_from_face_interp", (PyCFunction)bpy_bmvert_copy_from_face_interp, METH_VARARGS, bpy_bmvert_copy_from_face_interp_doc},
- {"copy_from_vert_interp", (PyCFunction)bpy_bmvert_copy_from_vert_interp, METH_VARARGS, bpy_bmvert_copy_from_vert_interp_doc},
+ {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
+ {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
+ {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+ {"copy_from_face_interp", (PyCFunction)bpy_bmvert_copy_from_face_interp, METH_VARARGS, bpy_bmvert_copy_from_face_interp_doc},
+ {"copy_from_vert_interp", (PyCFunction)bpy_bmvert_copy_from_vert_interp, METH_VARARGS, bpy_bmvert_copy_from_vert_interp_doc},
- {"calc_vert_angle", (PyCFunction)bpy_bmvert_calc_edge_angle, METH_NOARGS, bpy_bmvert_calc_edge_angle_doc},
- {"calc_shell_factor", (PyCFunction)bpy_bmvert_calc_shell_factor, METH_NOARGS, bpy_bmvert_calc_shell_factor_doc},
+ {"calc_vert_angle", (PyCFunction)bpy_bmvert_calc_edge_angle, METH_NOARGS, bpy_bmvert_calc_edge_angle_doc},
+ {"calc_shell_factor", (PyCFunction)bpy_bmvert_calc_shell_factor, METH_NOARGS, bpy_bmvert_calc_shell_factor_doc},
- {"normal_update", (PyCFunction)bpy_bmvert_normal_update, METH_NOARGS, bpy_bmvert_normal_update_doc},
+ {"normal_update", (PyCFunction)bpy_bmvert_normal_update, METH_NOARGS, bpy_bmvert_normal_update_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmedge_methods[] = {
- {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
- {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
- {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+ {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
+ {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
+ {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
- {"other_vert", (PyCFunction)bpy_bmedge_other_vert, METH_O, bpy_bmedge_other_vert_doc},
+ {"other_vert", (PyCFunction)bpy_bmedge_other_vert, METH_O, bpy_bmedge_other_vert_doc},
- {"calc_length", (PyCFunction)bpy_bmedge_calc_length, METH_NOARGS, bpy_bmedge_calc_length_doc},
- {"calc_face_angle", (PyCFunction)bpy_bmedge_calc_face_angle, METH_NOARGS, bpy_bmedge_calc_face_angle_doc},
- {"calc_tangent", (PyCFunction)bpy_bmedge_calc_tangent, METH_VARARGS, bpy_bmedge_calc_tangent_doc},
+ {"calc_length", (PyCFunction)bpy_bmedge_calc_length, METH_NOARGS, bpy_bmedge_calc_length_doc},
+ {"calc_face_angle", (PyCFunction)bpy_bmedge_calc_face_angle, METH_NOARGS, bpy_bmedge_calc_face_angle_doc},
+ {"calc_tangent", (PyCFunction)bpy_bmedge_calc_tangent, METH_VARARGS, bpy_bmedge_calc_tangent_doc},
- {"normal_update", (PyCFunction)bpy_bmedge_normal_update, METH_NOARGS, bpy_bmedge_normal_update_doc},
+ {"normal_update", (PyCFunction)bpy_bmedge_normal_update, METH_NOARGS, bpy_bmedge_normal_update_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmface_methods[] = {
- {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
- {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
+ {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
+ {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
- {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
- {"copy_from_face_interp", (PyCFunction)bpy_bmface_copy_from_face_interp, METH_O, bpy_bmface_copy_from_face_interp_doc},
+ {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+ {"copy_from_face_interp", (PyCFunction)bpy_bmface_copy_from_face_interp, METH_O, bpy_bmface_copy_from_face_interp_doc},
- {"copy", (PyCFunction)bpy_bmface_copy, METH_VARARGS | METH_KEYWORDS, bpy_bmface_copy_doc},
+ {"copy", (PyCFunction)bpy_bmface_copy, METH_VARARGS | METH_KEYWORDS, bpy_bmface_copy_doc},
- {"calc_area", (PyCFunction)bpy_bmface_calc_area, METH_NOARGS, bpy_bmface_calc_area_doc},
- {"calc_perimeter", (PyCFunction)bpy_bmface_calc_perimeter, METH_NOARGS, bpy_bmface_calc_perimeter_doc},
- {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc},
- {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc},
+ {"calc_area", (PyCFunction)bpy_bmface_calc_area, METH_NOARGS, bpy_bmface_calc_area_doc},
+ {"calc_perimeter", (PyCFunction)bpy_bmface_calc_perimeter, METH_NOARGS, bpy_bmface_calc_perimeter_doc},
+ {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc},
+ {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc},
- {"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc},
+ {"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc},
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmloop_methods[] = {
- {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
- {"copy_from_face_interp", (PyCFunction)bpy_bmloop_copy_from_face_interp, METH_O, bpy_bmloop_copy_from_face_interp_doc},
+ {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+ {"copy_from_face_interp", (PyCFunction)bpy_bmloop_copy_from_face_interp, METH_O, bpy_bmloop_copy_from_face_interp_doc},
- {"calc_angle", (PyCFunction)bpy_bmloop_calc_angle, METH_NOARGS, bpy_bmloop_calc_angle_doc},
- {"calc_normal", (PyCFunction)bpy_bmloop_calc_normal, METH_NOARGS, bpy_bmloop_calc_normal_doc},
- {"calc_tangent", (PyCFunction)bpy_bmloop_calc_tangent, METH_NOARGS, bpy_bmloop_calc_tangent_doc},
- {NULL, NULL, 0, NULL}
+ {"calc_angle", (PyCFunction)bpy_bmloop_calc_angle, METH_NOARGS, bpy_bmloop_calc_angle_doc},
+ {"calc_normal", (PyCFunction)bpy_bmloop_calc_normal, METH_NOARGS, bpy_bmloop_calc_normal_doc},
+ {"calc_tangent", (PyCFunction)bpy_bmloop_calc_tangent, METH_NOARGS, bpy_bmloop_calc_tangent_doc},
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmelemseq_methods[] = {
- /* odd function, initializes index values */
- {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
- {NULL, NULL, 0, NULL}
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmvertseq_methods[] = {
- {"new", (PyCFunction)bpy_bmvertseq_new, METH_VARARGS, bpy_bmvertseq_new_doc},
- {"remove", (PyCFunction)bpy_bmvertseq_remove, METH_O, bpy_bmvertseq_remove_doc},
+ {"new", (PyCFunction)bpy_bmvertseq_new, METH_VARARGS, bpy_bmvertseq_new_doc},
+ {"remove", (PyCFunction)bpy_bmvertseq_remove, METH_O, bpy_bmvertseq_remove_doc},
- /* odd function, initializes index values */
- {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
- {"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
- {NULL, NULL, 0, NULL}
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmedgeseq_methods[] = {
- {"new", (PyCFunction)bpy_bmedgeseq_new, METH_VARARGS, bpy_bmedgeseq_new_doc},
- {"remove", (PyCFunction)bpy_bmedgeseq_remove, METH_O, bpy_bmedgeseq_remove_doc},
- /* 'bpy_bmelemseq_get' for different purpose */
- {"get", (PyCFunction)bpy_bmedgeseq_get__method, METH_VARARGS, bpy_bmedgeseq_get__method_doc},
-
- /* odd function, initializes index values */
- {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
- {"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
- {NULL, NULL, 0, NULL}
+ {"new", (PyCFunction)bpy_bmedgeseq_new, METH_VARARGS, bpy_bmedgeseq_new_doc},
+ {"remove", (PyCFunction)bpy_bmedgeseq_remove, METH_O, bpy_bmedgeseq_remove_doc},
+ /* 'bpy_bmelemseq_get' for different purpose */
+ {"get", (PyCFunction)bpy_bmedgeseq_get__method, METH_VARARGS, bpy_bmedgeseq_get__method_doc},
+
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmfaceseq_methods[] = {
- {"new", (PyCFunction)bpy_bmfaceseq_new, METH_VARARGS, bpy_bmfaceseq_new_doc},
- {"remove", (PyCFunction)bpy_bmfaceseq_remove, METH_O, bpy_bmfaceseq_remove_doc},
- /* 'bpy_bmelemseq_get' for different purpose */
- {"get", (PyCFunction)bpy_bmfaceseq_get__method, METH_VARARGS, bpy_bmfaceseq_get__method_doc},
-
- /* odd function, initializes index values */
- {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
- {"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
- {NULL, NULL, 0, NULL}
+ {"new", (PyCFunction)bpy_bmfaceseq_new, METH_VARARGS, bpy_bmfaceseq_new_doc},
+ {"remove", (PyCFunction)bpy_bmfaceseq_remove, METH_O, bpy_bmfaceseq_remove_doc},
+ /* 'bpy_bmelemseq_get' for different purpose */
+ {"get", (PyCFunction)bpy_bmfaceseq_get__method, METH_VARARGS, bpy_bmfaceseq_get__method_doc},
+
+ /* odd function, initializes index values */
+ {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+ {"sort", (PyCFunction)bpy_bmelemseq_sort, METH_VARARGS | METH_KEYWORDS, bpy_bmelemseq_sort_doc},
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmloopseq_methods[] = {
- /* odd function, initializes index values */
- /* no: index_update() function since we cant iterate over loops */
- /* no: sort() function since we cant iterate over loops */
- {NULL, NULL, 0, NULL}
+ /* odd function, initializes index values */
+ /* no: index_update() function since we cant iterate over loops */
+ /* no: sort() function since we cant iterate over loops */
+ {NULL, NULL, 0, NULL}
};
/* Sequences
@@ -2635,29 +2637,29 @@ static int bpy_bmelem_ass_subscript(BPy_BMElem *self, BPy_BMLayerItem *key, PyOb
}
static PySequenceMethods bpy_bmelemseq_as_sequence = {
- (lenfunc)bpy_bmelemseq_length, /* sq_length */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
- (ssizeargfunc)bpy_bmelemseq_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
- NULL, /* sq_slice */
- (ssizeobjargproc)NULL, /* sq_ass_item */
- NULL, /* *was* sq_ass_slice */
- (objobjproc)bpy_bmelemseq_contains, /* sq_contains */
- (binaryfunc) NULL, /* sq_inplace_concat */
- (ssizeargfunc) NULL, /* sq_inplace_repeat */
+ (lenfunc)bpy_bmelemseq_length, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+ (ssizeargfunc)bpy_bmelemseq_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
+ NULL, /* sq_slice */
+ (ssizeobjargproc)NULL, /* sq_ass_item */
+ NULL, /* *was* sq_ass_slice */
+ (objobjproc)bpy_bmelemseq_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods bpy_bmelemseq_as_mapping = {
- (lenfunc)bpy_bmelemseq_length, /* mp_length */
- (binaryfunc)bpy_bmelemseq_subscript, /* mp_subscript */
- (objobjargproc)NULL, /* mp_ass_subscript */
+ (lenfunc)bpy_bmelemseq_length, /* mp_length */
+ (binaryfunc)bpy_bmelemseq_subscript, /* mp_subscript */
+ (objobjargproc)NULL, /* mp_ass_subscript */
};
/* for customdata access */
static PyMappingMethods bpy_bm_elem_as_mapping = {
- (lenfunc)NULL, /* mp_length */ /* keep this empty, messes up 'if elem: ...' test */
- (binaryfunc)bpy_bmelem_subscript, /* mp_subscript */
- (objobjargproc)bpy_bmelem_ass_subscript, /* mp_ass_subscript */
+ (lenfunc)NULL, /* mp_length */ /* keep this empty, messes up 'if elem: ...' test */
+ (binaryfunc)bpy_bmelem_subscript, /* mp_subscript */
+ (objobjargproc)bpy_bmelem_ass_subscript, /* mp_ass_subscript */
};
/* Iterator
@@ -3053,15 +3055,15 @@ void BPy_BM_init_types(void)
* ********************* */
static struct PyModuleDef BPy_BM_types_module_def = {
- PyModuleDef_HEAD_INIT,
- "bmesh.types", /* m_name */
- NULL, /* m_doc */
- 0, /* m_size */
- NULL, /* m_methods */
- NULL, /* m_reload */
- NULL, /* m_traverse */
- NULL, /* m_clear */
- NULL, /* m_free */
+ PyModuleDef_HEAD_INIT,
+ "bmesh.types", /* m_name */
+ NULL, /* m_doc */
+ 0, /* m_size */
+ NULL, /* m_methods */
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL, /* m_free */
};
PyObject *BPyInit_bmesh_types(void)
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index d484ad5c87e..e45a39a0643 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -175,64 +175,64 @@ static PyObject *bpy_bmlayeritem_name_get(BPy_BMLayerItem *self, void *UNUSED(fl
}
static PyGetSetDef bpy_bmlayeraccess_vert_getseters[] = {
- {(char *)"deform", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__deform_doc, (void *)CD_MDEFORMVERT},
+ {(char *)"deform", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__deform_doc, (void *)CD_MDEFORMVERT},
- {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
- {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
- {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
- {(char *)"shape", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__shape_doc, (void *)CD_SHAPEKEY},
- {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
+ {(char *)"shape", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__shape_doc, (void *)CD_SHAPEKEY},
+ {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmlayeraccess_edge_getseters[] = {
- {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
- {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
- {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
- {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
- {(char *)"crease", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__crease_doc, (void *)CD_CREASE},
+ {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
+ {(char *)"crease", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__crease_doc, (void *)CD_CREASE},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmlayeraccess_face_getseters[] = {
- {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
- {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
- {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
- {(char *)"tex", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__tex_doc, (void *)CD_MTEXPOLY},
+ {(char *)"tex", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__tex_doc, (void *)CD_MTEXPOLY},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmlayeraccess_loop_getseters[] = {
- {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
- {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
- {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+ {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+ {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+ {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
- {(char *)"uv", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__uv_doc, (void *)CD_MLOOPUV},
- {(char *)"color", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__color_doc, (void *)CD_MLOOPCOL},
+ {(char *)"uv", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__uv_doc, (void *)CD_MLOOPUV},
+ {(char *)"color", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__color_doc, (void *)CD_MLOOPCOL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmlayercollection_getseters[] = {
- /* BMESH_TODO, make writeable */
- {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)bpy_bmlayercollection_active_doc, NULL},
- {(char *)"is_singleton", (getter)bpy_bmlayercollection_is_singleton_get, (setter)NULL, (char *)bpy_bmlayercollection_is_singleton_doc, NULL},
+ /* BMESH_TODO, make writeable */
+ {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)bpy_bmlayercollection_active_doc, NULL},
+ {(char *)"is_singleton", (getter)bpy_bmlayercollection_is_singleton_get, (setter)NULL, (char *)bpy_bmlayercollection_is_singleton_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
static PyGetSetDef bpy_bmlayeritem_getseters[] = {
- /* BMESH_TODO, make writeable */
- {(char *)"name", (getter)bpy_bmlayeritem_name_get, (setter)NULL, (char *)bpy_bmlayercollection_name_doc, NULL},
+ /* BMESH_TODO, make writeable */
+ {(char *)"name", (getter)bpy_bmlayeritem_name_get, (setter)NULL, (char *)bpy_bmlayercollection_name_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
@@ -556,20 +556,20 @@ static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject
}
static struct PyMethodDef bpy_bmlayeritem_methods[] = {
- {"copy_from", (PyCFunction)bpy_bmlayeritem_copy_from, METH_O, bpy_bmlayeritem_copy_from_doc},
- {NULL, NULL, 0, NULL}
+ {"copy_from", (PyCFunction)bpy_bmlayeritem_copy_from, METH_O, bpy_bmlayeritem_copy_from_doc},
+ {NULL, NULL, 0, NULL}
};
static struct PyMethodDef bpy_bmelemseq_methods[] = {
- {"verify", (PyCFunction)bpy_bmlayercollection_verify, METH_NOARGS, bpy_bmlayercollection_verify_doc},
- {"new", (PyCFunction)bpy_bmlayercollection_new, METH_VARARGS, bpy_bmlayercollection_new_doc},
- {"remove", (PyCFunction)bpy_bmlayercollection_remove, METH_O, bpy_bmlayercollection_remove_doc},
-
- {"keys", (PyCFunction)bpy_bmlayercollection_keys, METH_NOARGS, bpy_bmlayercollection_keys_doc},
- {"values", (PyCFunction)bpy_bmlayercollection_values, METH_NOARGS, bpy_bmlayercollection_values_doc},
- {"items", (PyCFunction)bpy_bmlayercollection_items, METH_NOARGS, bpy_bmlayercollection_items_doc},
- {"get", (PyCFunction)bpy_bmlayercollection_get, METH_VARARGS, bpy_bmlayercollection_get_doc},
- {NULL, NULL, 0, NULL}
+ {"verify", (PyCFunction)bpy_bmlayercollection_verify, METH_NOARGS, bpy_bmlayercollection_verify_doc},
+ {"new", (PyCFunction)bpy_bmlayercollection_new, METH_VARARGS, bpy_bmlayercollection_new_doc},
+ {"remove", (PyCFunction)bpy_bmlayercollection_remove, METH_O, bpy_bmlayercollection_remove_doc},
+
+ {"keys", (PyCFunction)bpy_bmlayercollection_keys, METH_NOARGS, bpy_bmlayercollection_keys_doc},
+ {"values", (PyCFunction)bpy_bmlayercollection_values, METH_NOARGS, bpy_bmlayercollection_values_doc},
+ {"items", (PyCFunction)bpy_bmlayercollection_items, METH_NOARGS, bpy_bmlayercollection_items_doc},
+ {"get", (PyCFunction)bpy_bmlayercollection_get, METH_VARARGS, bpy_bmlayercollection_get_doc},
+ {NULL, NULL, 0, NULL}
};
/* Sequences
@@ -724,22 +724,22 @@ static int bpy_bmlayercollection_contains(BPy_BMLayerCollection *self, PyObject
}
static PySequenceMethods bpy_bmlayercollection_as_sequence = {
- (lenfunc)bpy_bmlayercollection_length, /* sq_length */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
- (ssizeargfunc)bpy_bmlayercollection_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
- NULL, /* sq_slice */
- (ssizeobjargproc)NULL, /* sq_ass_item */
- NULL, /* *was* sq_ass_slice */
- (objobjproc)bpy_bmlayercollection_contains, /* sq_contains */
- (binaryfunc) NULL, /* sq_inplace_concat */
- (ssizeargfunc) NULL, /* sq_inplace_repeat */
+ (lenfunc)bpy_bmlayercollection_length, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+ (ssizeargfunc)bpy_bmlayercollection_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
+ NULL, /* sq_slice */
+ (ssizeobjargproc)NULL, /* sq_ass_item */
+ NULL, /* *was* sq_ass_slice */
+ (objobjproc)bpy_bmlayercollection_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods bpy_bmlayercollection_as_mapping = {
- (lenfunc)bpy_bmlayercollection_length, /* mp_length */
- (binaryfunc)bpy_bmlayercollection_subscript, /* mp_subscript */
- (objobjargproc)NULL, /* mp_ass_subscript */
+ (lenfunc)bpy_bmlayercollection_length, /* mp_length */
+ (binaryfunc)bpy_bmlayercollection_subscript, /* mp_subscript */
+ (objobjargproc)NULL, /* mp_ass_subscript */
};
/* Iterator
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 1b21f62a115..b5fee2a3e8e 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -91,10 +91,10 @@ static int bpy_bmtexpoly_image_set(BPy_BMTexPoly *self, PyObject *value, void *U
}
static PyGetSetDef bpy_bmtexpoly_getseters[] = {
- /* attributes match rna_def_mtpoly */
- {(char *)"image", (getter)bpy_bmtexpoly_image_get, (setter)bpy_bmtexpoly_image_set, (char *)bpy_bmtexpoly_image_doc, NULL},
+ /* attributes match rna_def_mtpoly */
+ {(char *)"image", (getter)bpy_bmtexpoly_image_get, (setter)bpy_bmtexpoly_image_set, (char *)bpy_bmtexpoly_image_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
PyTypeObject BPy_BMTexPoly_Type = {{{0}}}; /* bm.loops.layers.uv.active */
@@ -201,13 +201,13 @@ static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag
}
static PyGetSetDef bpy_bmloopuv_getseters[] = {
- /* attributes match rna_def_mloopuv */
- {(char *)"uv", (getter)bpy_bmloopuv_uv_get, (setter)bpy_bmloopuv_uv_set, (char *)bpy_bmloopuv_uv_doc, NULL},
- {(char *)"pin_uv", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__pin_uv_doc, (void *)MLOOPUV_PINNED},
- {(char *)"select", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_doc, (void *)MLOOPUV_VERTSEL},
- {(char *)"select_edge", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_edge_doc, (void *)MLOOPUV_EDGESEL},
+ /* attributes match rna_def_mloopuv */
+ {(char *)"uv", (getter)bpy_bmloopuv_uv_get, (setter)bpy_bmloopuv_uv_set, (char *)bpy_bmloopuv_uv_doc, NULL},
+ {(char *)"pin_uv", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__pin_uv_doc, (void *)MLOOPUV_PINNED},
+ {(char *)"select", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_doc, (void *)MLOOPUV_VERTSEL},
+ {(char *)"select_edge", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_edge_doc, (void *)MLOOPUV_EDGESEL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
PyTypeObject BPy_BMLoopUV_Type = {{{0}}}; /* bm.loops.layers.uv.active */
@@ -485,21 +485,21 @@ static int bpy_bmdeformvert_contains(BPy_BMDeformVert *self, PyObject *value)
/* only defined for __contains__ */
static PySequenceMethods bpy_bmdeformvert_as_sequence = {
- (lenfunc)bpy_bmdeformvert_len, /* sq_length */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
-
- /* note: if this is set PySequence_Check() returns True,
- * but in this case we dont want to be treated as a seq */
- NULL, /* sq_item */
-
- NULL, /* sq_slice */
- NULL, /* sq_ass_item */
- NULL, /* *was* sq_ass_slice */
- (objobjproc)bpy_bmdeformvert_contains, /* sq_contains */
- (binaryfunc) NULL, /* sq_inplace_concat */
- (ssizeargfunc) NULL, /* sq_inplace_repeat */
-};
+ (lenfunc)bpy_bmdeformvert_len, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+
+ /* note: if this is set PySequence_Check() returns True,
+ * but in this case we dont want to be treated as a seq */
+ NULL, /* sq_item */
+
+ NULL, /* sq_slice */
+ NULL, /* sq_ass_item */
+ NULL, /* *was* sq_ass_slice */
+ (objobjproc)bpy_bmdeformvert_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
+ };
static PyMappingMethods bpy_bmdeformvert_as_mapping = {
(lenfunc)bpy_bmdeformvert_len,
@@ -631,13 +631,13 @@ static PyObject *bpy_bmdeformvert_clear(BPy_BMDeformVert *self)
}
static struct PyMethodDef bpy_bmdeformvert_methods[] = {
- {"keys", (PyCFunction)bpy_bmdeformvert_keys, METH_NOARGS, bpy_bmdeformvert_keys_doc},
- {"values", (PyCFunction)bpy_bmdeformvert_values, METH_NOARGS, bpy_bmdeformvert_values_doc},
- {"items", (PyCFunction)bpy_bmdeformvert_items, METH_NOARGS, bpy_bmdeformvert_items_doc},
- {"get", (PyCFunction)bpy_bmdeformvert_get, METH_VARARGS, bpy_bmdeformvert_get_doc},
- /* BMESH_TODO pop, popitem, update */
- {"clear", (PyCFunction)bpy_bmdeformvert_clear, METH_NOARGS, bpy_bmdeformvert_clear_doc},
- {NULL, NULL, 0, NULL}
+ {"keys", (PyCFunction)bpy_bmdeformvert_keys, METH_NOARGS, bpy_bmdeformvert_keys_doc},
+ {"values", (PyCFunction)bpy_bmdeformvert_values, METH_NOARGS, bpy_bmdeformvert_values_doc},
+ {"items", (PyCFunction)bpy_bmdeformvert_items, METH_NOARGS, bpy_bmdeformvert_items_doc},
+ {"get", (PyCFunction)bpy_bmdeformvert_get, METH_VARARGS, bpy_bmdeformvert_get_doc},
+ /* BMESH_TODO pop, popitem, update */
+ {"clear", (PyCFunction)bpy_bmdeformvert_clear, METH_NOARGS, bpy_bmdeformvert_clear_doc},
+ {NULL, NULL, 0, NULL}
};
PyTypeObject BPy_BMDeformVert_Type = {{{0}}}; /* bm.loops.layers.uv.active */
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
index 40d39539894..c3adc8366bd 100644
--- a/source/blender/python/bmesh/bmesh_py_types_select.c
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -68,8 +68,8 @@ static PyObject *bpy_bmeditselseq_active_get(BPy_BMEditSelSeq *self, void *UNUSE
}
static PyGetSetDef bpy_bmeditselseq_getseters[] = {
- {(char *)"active", (getter)bpy_bmeditselseq_active_get, (setter)NULL, (char *)bpy_bmeditselseq_active_doc, NULL},
- {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+ {(char *)"active", (getter)bpy_bmeditselseq_active_get, (setter)NULL, (char *)bpy_bmeditselseq_active_doc, NULL},
+ {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
PyDoc_STRVAR(bpy_bmeditselseq_validate_doc,
@@ -159,12 +159,12 @@ static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *val
}
static struct PyMethodDef bpy_bmeditselseq_methods[] = {
- {"validate", (PyCFunction)bpy_bmeditselseq_validate, METH_NOARGS, bpy_bmeditselseq_validate_doc},
- {"clear", (PyCFunction)bpy_bmeditselseq_clear, METH_NOARGS, bpy_bmeditselseq_clear_doc},
+ {"validate", (PyCFunction)bpy_bmeditselseq_validate, METH_NOARGS, bpy_bmeditselseq_validate_doc},
+ {"clear", (PyCFunction)bpy_bmeditselseq_clear, METH_NOARGS, bpy_bmeditselseq_clear_doc},
- {"add", (PyCFunction)bpy_bmeditselseq_add, METH_O, bpy_bmeditselseq_add_doc},
- {"remove", (PyCFunction)bpy_bmeditselseq_remove, METH_O, bpy_bmeditselseq_remove_doc},
- {NULL, NULL, 0, NULL}
+ {"add", (PyCFunction)bpy_bmeditselseq_add, METH_O, bpy_bmeditselseq_add_doc},
+ {"remove", (PyCFunction)bpy_bmeditselseq_remove, METH_O, bpy_bmeditselseq_remove_doc},
+ {NULL, NULL, 0, NULL}
};
@@ -313,22 +313,22 @@ static int bpy_bmeditselseq_contains(BPy_BMEditSelSeq *self, PyObject *value)
}
static PySequenceMethods bpy_bmeditselseq_as_sequence = {
- (lenfunc)bpy_bmeditselseq_length, /* sq_length */
- NULL, /* sq_concat */
- NULL, /* sq_repeat */
- (ssizeargfunc)bpy_bmeditselseq_subscript_int,/* sq_item */ /* Only set this so PySequence_Check() returns True */
- NULL, /* sq_slice */
- (ssizeobjargproc)NULL, /* sq_ass_item */
- NULL, /* *was* sq_ass_slice */
- (objobjproc)bpy_bmeditselseq_contains, /* sq_contains */
- (binaryfunc) NULL, /* sq_inplace_concat */
- (ssizeargfunc) NULL, /* sq_inplace_repeat */
+ (lenfunc)bpy_bmeditselseq_length, /* sq_length */
+ NULL, /* sq_concat */
+ NULL, /* sq_repeat */
+ (ssizeargfunc)bpy_bmeditselseq_subscript_int,/* sq_item */ /* Only set this so PySequence_Check() returns True */
+ NULL, /* sq_slice */
+ (ssizeobjargproc)NULL, /* sq_ass_item */
+ NULL, /* *was* sq_ass_slice */
+ (objobjproc)bpy_bmeditselseq_contains, /* sq_contains */
+ (binaryfunc) NULL, /* sq_inplace_concat */
+ (ssizeargfunc) NULL, /* sq_inplace_repeat */
};
static PyMappingMethods bpy_bmeditselseq_as_mapping = {
- (lenfunc)bpy_bmeditselseq_length, /* mp_length */
- (binaryfunc)bpy_bmeditselseq_subscript, /* mp_subscript */
- (objobjargproc)NULL, /* mp_ass_subscript */
+ (lenfunc)bpy_bmeditselseq_length, /* mp_length */
+ (binaryfunc)bpy_bmeditselseq_subscript, /* mp_subscript */
+ (objobjargproc)NULL, /* mp_ass_subscript */
};
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
index 4417bc2ce8d..b70df53aff0 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -39,9 +39,7 @@
#include "../mathutils/mathutils.h"
#include "bmesh.h"
-
#include "bmesh_py_types.h"
-
#include "bmesh_py_utils.h" /* own include */
@@ -653,18 +651,18 @@ static PyObject *bpy_bm_utils_loop_separate(PyObject *UNUSED(self), BPy_BMLoop *
static struct PyMethodDef BPy_BM_utils_methods[] = {
- {"vert_collapse_edge", (PyCFunction)bpy_bm_utils_vert_collapse_edge, METH_VARARGS, bpy_bm_utils_vert_collapse_edge_doc},
- {"vert_collapse_faces", (PyCFunction)bpy_bm_utils_vert_collapse_faces, METH_VARARGS, bpy_bm_utils_vert_collapse_faces_doc},
- {"vert_dissolve", (PyCFunction)bpy_bm_utils_vert_dissolve, METH_VARARGS, bpy_bm_utils_vert_dissolve_doc}, /* could use METH_O */
- {"vert_separate", (PyCFunction)bpy_bm_utils_vert_separate, METH_VARARGS, bpy_bm_utils_vert_separate_doc},
- {"edge_split", (PyCFunction)bpy_bm_utils_edge_split, METH_VARARGS, bpy_bm_utils_edge_split_doc},
- {"edge_rotate", (PyCFunction)bpy_bm_utils_edge_rotate, METH_VARARGS, bpy_bm_utils_edge_rotate_doc},
- {"face_split", (PyCFunction)bpy_bm_utils_face_split, METH_VARARGS | METH_KEYWORDS, bpy_bm_utils_face_split_doc},
- {"face_join", (PyCFunction)bpy_bm_utils_face_join, METH_VARARGS, bpy_bm_utils_face_join_doc},
- {"face_vert_separate", (PyCFunction)bpy_bm_utils_face_vert_separate, METH_VARARGS, bpy_bm_utils_face_vert_separate_doc},
- {"face_flip", (PyCFunction)bpy_bm_utils_face_flip, METH_O, bpy_bm_utils_face_flip_doc},
- {"loop_separate", (PyCFunction)bpy_bm_utils_loop_separate, METH_O, bpy_bm_utils_loop_separate_doc},
- {NULL, NULL, 0, NULL}
+ {"vert_collapse_edge", (PyCFunction)bpy_bm_utils_vert_collapse_edge, METH_VARARGS, bpy_bm_utils_vert_collapse_edge_doc},
+ {"vert_collapse_faces", (PyCFunction)bpy_bm_utils_vert_collapse_faces, METH_VARARGS, bpy_bm_utils_vert_collapse_faces_doc},
+ {"vert_dissolve", (PyCFunction)bpy_bm_utils_vert_dissolve, METH_VARARGS, bpy_bm_utils_vert_dissolve_doc}, /* could use METH_O */
+ {"vert_separate", (PyCFunction)bpy_bm_utils_vert_separate, METH_VARARGS, bpy_bm_utils_vert_separate_doc},
+ {"edge_split", (PyCFunction)bpy_bm_utils_edge_split, METH_VARARGS, bpy_bm_utils_edge_split_doc},
+ {"edge_rotate", (PyCFunction)bpy_bm_utils_edge_rotate, METH_VARARGS, bpy_bm_utils_edge_rotate_doc},
+ {"face_split", (PyCFunction)bpy_bm_utils_face_split, METH_VARARGS | METH_KEYWORDS, bpy_bm_utils_face_split_doc},
+ {"face_join", (PyCFunction)bpy_bm_utils_face_join, METH_VARARGS, bpy_bm_utils_face_join_doc},
+ {"face_vert_separate", (PyCFunction)bpy_bm_utils_face_vert_separate, METH_VARARGS, bpy_bm_utils_face_vert_separate_doc},
+ {"face_flip", (PyCFunction)bpy_bm_utils_face_flip, METH_O, bpy_bm_utils_face_flip_doc},
+ {"loop_separate", (PyCFunction)bpy_bm_utils_loop_separate, METH_O, bpy_bm_utils_loop_separate_doc},
+ {NULL, NULL, 0, NULL}
};
@@ -672,15 +670,15 @@ PyDoc_STRVAR(BPy_BM_utils_doc,
"This module provides access to blenders bmesh data structures."
);
static struct PyModuleDef BPy_BM_utils_module_def = {
- PyModuleDef_HEAD_INIT,
- "bmesh.utils", /* m_name */
- BPy_BM_utils_doc, /* m_doc */
- 0, /* m_size */
- BPy_BM_utils_methods, /* m_methods */
- NULL, /* m_reload */
- NULL, /* m_traverse */
- NULL, /* m_clear */
- NULL, /* m_free */
+ PyModuleDef_HEAD_INIT,
+ "bmesh.utils", /* m_name */
+ BPy_BM_utils_doc, /* m_doc */
+ 0, /* m_size */
+ BPy_BM_utils_methods, /* m_methods */
+ NULL, /* m_reload */
+ NULL, /* m_traverse */
+ NULL, /* m_clear */
+ NULL, /* m_free */
};
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index 4d5c02dad68..0f0250fb8d5 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -115,12 +115,12 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
PyObject *list;
int absolute = FALSE;
- int packed = FALSE;
- int local = FALSE;
+ int packed = FALSE;
+ int local = FALSE;
static const char *kwlist[] = {"absolute", "packed", "local", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kw, "|ii:blend_paths",
- (char **)kwlist, &absolute, &packed))
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "|iii:blend_paths",
+ (char **)kwlist, &absolute, &packed, &local))
{
return NULL;
}
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 90ea589fde4..55ef217e781 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -160,7 +160,9 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
if (!PyArg_ParseTuple(args, "sO|O!si:_bpy.ops.call",
&opname, &context_dict, &PyDict_Type, &kw, &context_str, &is_undo))
+ {
return NULL;
+ }
ot = WM_operatortype_find(opname, TRUE);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index bd660ae0001..4ae8e821298 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -369,7 +369,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop,
Py_ssize_t start, Py_ssize_t stop, Py_ssize_t length);
-static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
+static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, const short order_fallback);
/* bpyrna vector/euler/quat callbacks */
static unsigned char mathutils_rna_array_cb_index = -1; /* index for our callbacks */
@@ -571,7 +571,7 @@ static Mathutils_Callback mathutils_rna_matrix_cb = {
NULL
};
-static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback)
+static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, const short order_fallback)
{
/* attempt to get order */
if (*prop_eul_order == NULL)
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 583831b1655..468ef3788c1 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -701,7 +701,7 @@ PyTypeObject euler_Type = {
* (i.e. it was allocated elsewhere by MEM_mallocN())
* pass Py_NEW - if vector is not a WRAPPER and managed by PYTHON
* (i.e. it must be created here with PyMEM_malloc())*/
-PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type)
+PyObject *Euler_CreatePyObject(float *eul, const short order, int type, PyTypeObject *base_type)
{
EulerObject *self;
@@ -738,7 +738,7 @@ PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *
return (PyObject *)self;
}
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, const short order,
unsigned char cb_type, unsigned char cb_subtype)
{
EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index bcbc6c60ca7..e04d45e4630 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -48,8 +48,8 @@ typedef struct {
* blender (stored in blend_data). This is an either/or struct not both */
//prototypes
-PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type);
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+PyObject *Euler_CreatePyObject(float *eul, const short order, int type, PyTypeObject *base_type);
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, const short order,
unsigned char cb_type, unsigned char cb_subtype);
short euler_order_from_string(const char *str, const char *error_prefix);
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index d98c6e9d2fd..be519ded88e 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -995,7 +995,7 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
if (eul_compat) {
if (order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat);
- else mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
+ else mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
}
else {
if (order == 1) mat3_to_eul(eul, mat);
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index f8b09ae8b1b..47df4c7363f 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -88,8 +88,8 @@ typedef struct QuicktimeExport {
AudioStreamBasicDescription audioInputFormat, audioOutputFormat;
AudioStreamPacketDescription *audioOutputPktDesc;
SInt64 audioFilePos;
- char* audioInputBuffer;
- char* audioOutputBuffer;
+ char *audioInputBuffer;
+ char *audioOutputBuffer;
UInt32 audioCodecMaxOutputPacketSize;
UInt64 audioTotalExportedFrames, audioTotalSavedFrames;
UInt64 audioLastFrame;
diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m
index 073fb31ff96..e30b8331fc0 100644
--- a/source/blender/quicktime/apple/qtkit_import.m
+++ b/source/blender/quicktime/apple/qtkit_import.m
@@ -153,8 +153,9 @@ static ImBuf * nsImageToiBuf(NSImage *sourceImage, int width, int height)
ibuf = IMB_allocImBuf (width, height, 32, IB_rect);
if (!ibuf) {
- if(QTIME_DEBUG) printf("quicktime_import: could not allocate memory for the " \
- "image.\n");
+ if (QTIME_DEBUG) {
+ printf("quicktime_import: could not allocate memory for the image.\n");
+ }
return NULL;
}
@@ -455,8 +456,7 @@ ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags)
ibuf = IMB_allocImBuf(bitmapSize.width, bitmapSize.height, 32/*RGBA*/, 0);
if (!ibuf) {
fprintf(stderr,
- "imb_cocoaLoadImage: could not allocate memory for the " \
- "image.\n");
+ "imb_cocoaLoadImage: could not allocate memory for the image.\n");
[bitmapImage release];
[pool drain];
return NULL;
diff --git a/source/blender/render/intern/include/rayobject.h b/source/blender/render/intern/include/rayobject.h
index ce20ce4ea46..7752baadff4 100644
--- a/source/blender/render/intern/include/rayobject.h
+++ b/source/blender/render/intern/include/rayobject.h
@@ -55,14 +55,14 @@ int RE_rayobject_raycast(RayObject *r, struct Isect *i);
/* Acceleration Structures */
-RayObject* RE_rayobject_octree_create(int ocres, int size);
-RayObject* RE_rayobject_instance_create(RayObject *target, float transform[][4], void *ob, void *target_ob);
-RayObject* RE_rayobject_empty_create(void);
+RayObject *RE_rayobject_octree_create(int ocres, int size);
+RayObject *RE_rayobject_instance_create(RayObject *target, float transform[][4], void *ob, void *target_ob);
+RayObject *RE_rayobject_empty_create(void);
-RayObject* RE_rayobject_blibvh_create(int size); /* BLI_kdopbvh.c */
-RayObject* RE_rayobject_vbvh_create(int size); /* raytrace/rayobject_vbvh.c */
-RayObject* RE_rayobject_svbvh_create(int size); /* raytrace/rayobject_svbvh.c */
-RayObject* RE_rayobject_qbvh_create(int size); /* raytrace/rayobject_qbvh.c */
+RayObject *RE_rayobject_blibvh_create(int size); /* BLI_kdopbvh.c */
+RayObject *RE_rayobject_vbvh_create(int size); /* raytrace/rayobject_vbvh.c */
+RayObject *RE_rayobject_svbvh_create(int size); /* raytrace/rayobject_svbvh.c */
+RayObject *RE_rayobject_qbvh_create(int size); /* raytrace/rayobject_qbvh.c */
/* Building */
@@ -85,7 +85,7 @@ typedef struct RayFace {
#define RE_rayface_isQuad(a) ((a)->quad)
-RayObject* RE_rayface_from_vlak(RayFace *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
+RayObject *RE_rayface_from_vlak(RayFace *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
/* RayObject representing faces directly from a given VlakRen structure. Thus
* allowing to save memory, but making code triangle intersection dependent on
@@ -96,7 +96,7 @@ typedef struct VlakPrimitive {
struct VlakRen *face;
} VlakPrimitive;
-RayObject* RE_vlakprimitive_from_vlak(VlakPrimitive *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
+RayObject *RE_vlakprimitive_from_vlak(VlakPrimitive *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
/* Bounding Box */
@@ -118,4 +118,3 @@ void RE_rayobject_hint_bb(RayObject *r, struct RayHint *hint, float *min, float
#endif
#endif
-
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index f34bd352e62..ebacdee0c97 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -3824,6 +3824,11 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
lar->ld2= la->att2;
lar->curfalloff = curvemapping_copy(la->curfalloff);
+ if (lar->curfalloff) {
+ /* so threads don't conflict on init */
+ curvemapping_initialize(lar->curfalloff);
+ }
+
if (lar->type==LA_SPOT) {
normalize_v3(lar->imat[0]);
@@ -5242,13 +5247,15 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
/* precalculate amount of radians 1 pixel rotates */
if (pano) {
/* size of 1 pixel mapped to viewplane coords */
- float psize= (re->viewplane.xmax-re->viewplane.xmin)/(float)re->winx;
+ float psize;
+
+ psize = BLI_RCT_SIZE_X(&re->viewplane) / (float)re->winx;
/* x angle of a pixel */
- pixelphix= atan(psize/re->clipsta);
+ pixelphix = atan(psize / re->clipsta);
- psize= (re->viewplane.ymax-re->viewplane.ymin)/(float)re->winy;
+ psize = BLI_RCT_SIZE_Y(&re->viewplane) / (float)re->winy;
/* y angle of a pixel */
- pixelphiy= atan(psize/re->clipsta);
+ pixelphiy = atan(psize / re->clipsta);
}
zmulx= re->winx/2;
zmuly= re->winy/2;
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 0a90a55b3bc..e4fb87e8e4f 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -396,16 +396,16 @@ static float square_rctf(rctf *rf)
{
float x, y;
- x= rf->xmax- rf->xmin;
- y= rf->ymax- rf->ymin;
- return (x*y);
+ x = BLI_RCT_SIZE_X(rf);
+ y = BLI_RCT_SIZE_Y(rf);
+ return x * y;
}
static float clipx_rctf(rctf *rf, float x1, float x2)
{
float size;
- size= rf->xmax - rf->xmin;
+ size = BLI_RCT_SIZE_X(rf);
if (rf->xmin<x1) {
rf->xmin = x1;
@@ -418,7 +418,7 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
return 0.0;
}
else if (size!=0.0f) {
- return (rf->xmax - rf->xmin)/size;
+ return BLI_RCT_SIZE_X(rf) / size;
}
return 1.0;
}
@@ -427,7 +427,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
{
float size;
- size= rf->ymax - rf->ymin;
+ size = BLI_RCT_SIZE_Y(rf);
if (rf->ymin<y1) {
rf->ymin = y1;
@@ -440,8 +440,8 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
rf->ymin = rf->ymax;
return 0.0;
}
- else if (size!=0.0f) {
- return (rf->ymax - rf->ymin)/size;
+ else if (size != 0.0f) {
+ return BLI_RCT_SIZE_Y(rf) / size;
}
return 1.0;
@@ -717,7 +717,7 @@ static int ibuf_get_color_clip_bilerp(float col[4], ImBuf *ibuf, float u, float
return ibuf_get_color_clip(col, ibuf, (int)u, (int)v, extflag);
}
-static void area_sample(TexResult* texr, ImBuf* ibuf, float fx, float fy, afdata_t* AFD)
+static void area_sample(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
{
int xs, ys, clip = 0;
float tc[4], xsd, ysd, cw = 0.f;
@@ -839,7 +839,7 @@ static void imp2radangle(float A, float B, float C, float F, float* a, float* b,
}
}
-static void ewa_eval(TexResult* texr, ImBuf* ibuf, float fx, float fy, afdata_t* AFD)
+static void ewa_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
{
/* 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... */
@@ -926,7 +926,7 @@ static void ewa_eval(TexResult* texr, ImBuf* ibuf, float fx, float fy, afdata_t*
texr->ta = texr->talpha ? texr->ta*d : 1.f; /* TXF alpha (clip ? cw*d : 1.f); */
}
-static void feline_eval(TexResult* texr, ImBuf* ibuf, float fx, float fy, afdata_t* AFD)
+static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata_t *AFD)
{
const int maxn = AFD->iProbes - 1;
const float ll = ((AFD->majrad == AFD->minrad) ? 2.f*AFD->majrad : 2.f*(AFD->majrad - AFD->minrad)) / (maxn ? (float)maxn : 1.f);
@@ -1219,7 +1219,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
ImBuf *previbuf, *curibuf;
float levf;
int maxlev;
- ImBuf* mipmaps[IB_MIPMAP_LEVELS + 1];
+ ImBuf *mipmaps[IB_MIPMAP_LEVELS + 1];
/* modify ellipse minor axis if too eccentric, use for area sampling as well
* scaling dxt/dyt as done in pbrt is not the same
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index cc8f6682781..7efdba77943 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -610,8 +610,8 @@ void initparts(Render *re)
}
else disprect.ymax = ymaxb;
- rectx = disprect.xmax - disprect.xmin;
- recty = disprect.ymax - disprect.ymin;
+ rectx = BLI_RCT_SIZE_X(&disprect);
+ recty = BLI_RCT_SIZE_Y(&disprect);
/* so, now can we add this part? */
if (rectx > 0 && recty > 0) {
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 3d2b1608906..9a524831388 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -59,6 +59,7 @@
#include "BKE_writeavi.h" /* <------ should be replaced once with generic movie module */
#include "BLI_math.h"
+#include "BLI_rect.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_path_util.h"
@@ -438,8 +439,8 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
re->winy = winy;
if (disprect) {
re->disprect = *disprect;
- re->rectx = disprect->xmax - disprect->xmin;
- re->recty = disprect->ymax - disprect->ymin;
+ re->rectx = BLI_RCT_SIZE_X(disprect);
+ re->recty = BLI_RCT_SIZE_Y(disprect);
}
else {
re->disprect.xmin = re->disprect.ymin = 0;
@@ -671,15 +672,15 @@ static void *do_part_thread(void *pa_v)
float panorama_pixel_rot(Render *re)
{
float psize, phi, xfac;
- float borderfac = (float)(re->disprect.xmax - re->disprect.xmin) / (float)re->winx;
+ float borderfac = (float)BLI_RCT_SIZE_X(&re->disprect) / (float)re->winx;
/* size of 1 pixel mapped to viewplane coords */
- psize = (re->viewplane.xmax - re->viewplane.xmin) / (float)(re->winx);
+ psize = BLI_RCT_SIZE_X(&re->viewplane) / (float)re->winx;
/* angle of a pixel */
phi = atan(psize / re->clipsta);
/* correction factor for viewplane shifting, first calculate how much the viewplane angle is */
- xfac = borderfac * ((re->viewplane.xmax - re->viewplane.xmin)) / (float)re->xparts;
+ xfac = borderfac * BLI_RCT_SIZE_X(&re->viewplane) / (float)re->xparts;
xfac = atan(0.5f * xfac / re->clipsta);
/* and how much the same viewplane angle is wrapped */
psize = 0.5f * phi * ((float)re->partx);
@@ -712,7 +713,7 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
float phi = panorama_pixel_rot(re);
R.panodxp = (re->winx - (best->disprect.xmin + best->disprect.xmax) ) / 2;
- R.panodxv = ((viewplane->xmax - viewplane->xmin) * R.panodxp) / (float)(re->winx);
+ R.panodxv = (BLI_RCT_SIZE_X(viewplane) * R.panodxp) / (float)(re->winx);
/* shift viewplane */
R.viewplane.xmin = viewplane->xmin + R.panodxv;
@@ -739,8 +740,8 @@ static RenderPart *find_next_part(Render *re, int minx)
/* find center of rendered parts, image center counts for 1 too */
for (pa = re->parts.first; pa; pa = pa->next) {
if (pa->ready) {
- centx += (pa->disprect.xmin + pa->disprect.xmax) / 2;
- centy += (pa->disprect.ymin + pa->disprect.ymax) / 2;
+ centx += BLI_RCT_CENTER_X(&pa->disprect);
+ centy += BLI_RCT_CENTER_Y(&pa->disprect);
tot++;
}
}
@@ -750,8 +751,8 @@ static RenderPart *find_next_part(Render *re, int minx)
/* closest of the non-rendering parts */
for (pa = re->parts.first; pa; pa = pa->next) {
if (pa->ready == 0 && pa->nr == 0) {
- long long int distx = centx - (pa->disprect.xmin + pa->disprect.xmax) / 2;
- long long int disty = centy - (pa->disprect.ymin + pa->disprect.ymax) / 2;
+ long long int distx = centx - BLI_RCT_CENTER_X(&pa->disprect);
+ long long int disty = centy - BLI_RCT_CENTER_Y(&pa->disprect);
distx = (long long int)sqrt(distx * distx + disty * disty);
if (distx < mindist) {
if (re->r.mode & R_PANORAMA) {
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index 3c1a18316ca..49c2bf1d053 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -379,6 +379,7 @@ static void accum_density(void *userdata, int index, float squared_dist)
}
if (pdr->density_curve && dist != 0.0f) {
+ curvemapping_initialize(pdr->density_curve);
density = curvemapping_evaluateF(pdr->density_curve, 0, density/dist)*dist;
}
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 5da661e7182..ce200b34d39 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -43,6 +43,7 @@
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
+#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
@@ -420,8 +421,8 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
SceneRenderLayer *srl;
int rectx, recty, nr;
- rectx = partrct->xmax - partrct->xmin;
- recty = partrct->ymax - partrct->ymin;
+ rectx = BLI_RCT_SIZE_X(partrct);
+ recty = BLI_RCT_SIZE_Y(partrct);
if (rectx <= 0 || recty <= 0)
return NULL;
@@ -558,8 +559,8 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
}
/* border render; calculate offset for use in compositor. compo is centralized coords */
- rr->xof = re->disprect.xmin + (re->disprect.xmax - re->disprect.xmin) / 2 - re->winx / 2;
- rr->yof = re->disprect.ymin + (re->disprect.ymax - re->disprect.ymin) / 2 - re->winy / 2;
+ rr->xof = re->disprect.xmin + BLI_RCT_CENTER_X(&re->disprect) - (re->winx / 2);
+ rr->yof = re->disprect.ymin + BLI_RCT_CENTER_Y(&re->disprect) - (re->winy / 2);
return rr;
}
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 3d0816e048d..14c178c10f9 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1703,7 +1703,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
if (!shi->osatex && (tex->type == TEX_IMAGE) && tex->ima) {
/* in case we have no proper derivatives, fall back to
* computing du/dv it based on image size */
- ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
+ ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
if (ibuf) {
du = 1.f/(float)ibuf->x;
dv = 1.f/(float)ibuf->y;
@@ -1878,7 +1878,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
/* resolve image dimensions */
if (found_deriv_map || (mtex->texflag&MTEX_BUMP_TEXTURESPACE)!=0) {
- ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
+ ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
if (ibuf) {
dimx = ibuf->x;
dimy = ibuf->y;
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index a6b2c98f9d3..c009c7b7394 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -107,11 +107,11 @@ void calc_view_vector(float *view, float x, float y)
}
/* move x and y to real viewplane coords */
- x= (x/(float)R.winx);
- view[0]= R.viewplane.xmin + x*(R.viewplane.xmax - R.viewplane.xmin);
+ x = (x / (float)R.winx);
+ view[0] = R.viewplane.xmin + x * BLI_RCT_SIZE_X(&R.viewplane);
- y= (y/(float)R.winy);
- view[1]= R.viewplane.ymin + y*(R.viewplane.ymax - R.viewplane.ymin);
+ y = (y / (float)R.winy);
+ view[1] = R.viewplane.ymin + y * BLI_RCT_SIZE_Y(&R.viewplane);
// if (R.flag & R_SEC_FIELD) {
// if (R.r.mode & R_ODDFIELD) view[1]= (y+R.ystart)*R.ycor;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 90876610f1a..2d7a64bad04 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -1496,7 +1496,7 @@ static void bound_rectf(rctf *box, const float v1[2])
static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
{
- /* if level > 0 we create new branches and go deeper*/
+ /* if level > 0 we create new branches and go deeper */
if (level > 0) {
ISBBranch *left, *right;
int i;
@@ -1506,10 +1506,10 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
root->divider[1]= 0.5f*(root->box.ymin+root->box.ymax);
/* find best splitpoint */
- if (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
- i= root->index= 0;
+ if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+ i = root->index = 0;
else
- i= root->index= 1;
+ i = root->index = 1;
left= root->left= BLI_memarena_alloc(mem, sizeof(ISBBranch));
right= root->right= BLI_memarena_alloc(mem, sizeof(ISBBranch));
@@ -1551,10 +1551,10 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
root->divider[1]/= BSPMAX_SAMPLE;
/* find best splitpoint */
- if (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
- i= root->index= 0;
+ if (BLI_RCT_SIZE_X(&root->box) > BLI_RCT_SIZE_Y(&root->box))
+ i = root->index = 0;
else
- i= root->index= 1;
+ i = root->index = 1;
/* new branches */
left= root->left= BLI_memarena_alloc(mem, sizeof(ISBBranch));
@@ -1824,7 +1824,7 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
if ((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
if (face->box.zmin < samp->zco[2]) {
- if (BLI_in_rctf_v((rctf *)&face->box, samp->zco)) {
+ if (BLI_rctf_isect_pt_v((rctf *)&face->box, samp->zco)) {
int inshadow= 0;
if (face->type) {
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index e209baa49a8..6883710d1be 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -1192,6 +1192,7 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
visifac*= lar->distkw/(lar->distkw+lar->ld2*dist[0]*dist[0]);
break;
case LA_FALLOFF_CURVE:
+ /* curvemapping_initialize is called from #add_render_lamp */
visifac = curvemapping_evaluateF(lar->curfalloff, 0, dist[0]/lar->dist);
break;
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 584790b4cda..ff7c8cd2ea7 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -245,8 +245,8 @@ void WM_operator_py_idname(char *to, const char *from);
/* *************** menu types ******************** */
void WM_menutype_init(void);
struct MenuType *WM_menutype_find(const char *idname, int quiet);
-int WM_menutype_add(struct MenuType* mt);
-void WM_menutype_freelink(struct MenuType* mt);
+int WM_menutype_add(struct MenuType *mt);
+void WM_menutype_freelink(struct MenuType *mt);
void WM_menutype_free(void);
/* default operator callbacks for border/circle/lasso */
@@ -301,14 +301,35 @@ void WM_framebuffer_index_set(int index);
int WM_framebuffer_to_index(unsigned int col);
/* threaded Jobs Manager */
-#define WM_JOB_PRIORITY 1
-#define WM_JOB_EXCL_RENDER 2
-#define WM_JOB_PROGRESS 4
-#define WM_JOB_SUSPEND 8
-
-struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void *owner, const char *name, int flag);
-
-int WM_jobs_test(struct wmWindowManager *wm, void *owner);
+enum {
+ WM_JOB_PRIORITY = (1 << 0),
+ WM_JOB_EXCL_RENDER = (1 << 1),
+ WM_JOB_PROGRESS = (1 << 2),
+ WM_JOB_SUSPEND = (1 << 3)
+};
+
+/* identifying jobs by owner alone is unreliable, this isnt saved, order can change */
+enum {
+ WM_JOB_TYPE_ANY = -1,
+ WM_JOB_TYPE_COMPOSITE,
+ WM_JOB_TYPE_RENDER,
+ WM_JOB_TYPE_RENDER_PREVIEW, /* UI preview */
+ WM_JOB_TYPE_SCREENCAST,
+ WM_JOB_TYPE_OBJECT_SIM_OCEAN,
+ WM_JOB_TYPE_OBJECT_SIM_FLUID,
+ WM_JOB_TYPE_OBJECT_BAKE_TEXTURE,
+ WM_JOB_TYPE_FILESEL_THUMBNAIL,
+ WM_JOB_TYPE_CLIP_BUILD_PROXY,
+ WM_JOB_TYPE_CLIP_TRACK_MARKERS,
+ WM_JOB_TYPE_CLIP_SOLVE_CAMERA,
+ WM_JOB_TYPE_SEQ_BUILD_PROXY,
+ /* add as needed, screencast, seq proxy build
+ * if having hard coded values is a problem */
+};
+
+struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void *owner, const char *name, int flag, int job_type);
+
+int WM_jobs_test(struct wmWindowManager *wm, void *owner, int job_type);
float WM_jobs_progress(struct wmWindowManager *wm, void *owner);
char *WM_jobs_name(struct wmWindowManager *wm, void *owner);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 10a383df5c9..60c61dbe88c 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -922,7 +922,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event,
ScrArea *sa = CTX_wm_area(C);
if (ar && ar->regiontype == RGN_TYPE_WINDOW && event &&
- BLI_in_rcti_v(&ar->winrct, &event->x))
+ BLI_rcti_isect_pt_v(&ar->winrct, &event->x))
{
winrect = &ar->winrct;
}
@@ -1642,17 +1642,17 @@ static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
rcti rect = *handler->bblocal;
BLI_rcti_translate(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
- if (BLI_in_rcti_v(&rect, &event->x))
+ if (BLI_rcti_isect_pt_v(&rect, &event->x))
return 1;
- else if (event->type == MOUSEMOVE && BLI_in_rcti_v(&rect, &event->prevx))
+ else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(&rect, &event->prevx))
return 1;
else
return 0;
}
else {
- if (BLI_in_rcti_v(handler->bbwin, &event->x))
+ if (BLI_rcti_isect_pt_v(handler->bbwin, &event->x))
return 1;
- else if (event->type == MOUSEMOVE && BLI_in_rcti_v(handler->bbwin, &event->prevx))
+ else if (event->type == MOUSEMOVE && BLI_rcti_isect_pt_v(handler->bbwin, &event->prevx))
return 1;
else
return 0;
@@ -1888,10 +1888,10 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
{
if (wm_event_always_pass(event))
return 1;
- if (BLI_in_rcti_v(rect, &event->x))
+ if (BLI_rcti_isect_pt_v(rect, &event->x))
return 1;
if (event->type == MOUSEMOVE) {
- if (BLI_in_rcti_v(rect, &event->prevx)) {
+ if (BLI_rcti_isect_pt_v(rect, &event->prevx)) {
return 1;
}
return 0;
@@ -1906,7 +1906,7 @@ static ScrArea *area_event_inside(bContext *C, const int xy[2])
if (screen)
for (sa = screen->areabase.first; sa; sa = sa->next)
- if (BLI_in_rcti_v(&sa->totrct, xy))
+ if (BLI_rcti_isect_pt_v(&sa->totrct, xy))
return sa;
return NULL;
}
@@ -1919,7 +1919,7 @@ static ARegion *region_event_inside(bContext *C, const int xy[2])
if (screen && area)
for (ar = area->regionbase.first; ar; ar = ar->next)
- if (BLI_in_rcti_v(&ar->winrct, xy))
+ if (BLI_rcti_isect_pt_v(&ar->winrct, xy))
return ar;
return NULL;
}
@@ -1950,7 +1950,7 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
/* if previous position was not in current region, we have to set a temp new context */
- if (ar == NULL || !BLI_in_rcti_v(&ar->winrct, &event->prevx)) {
+ if (ar == NULL || !BLI_rcti_isect_pt_v(&ar->winrct, &event->prevx)) {
ScrArea *sa = CTX_wm_area(C);
CTX_wm_area_set(C, area_event_inside(C, &event->prevx));
@@ -2125,7 +2125,7 @@ void wm_event_do_handlers(bContext *C)
if (CTX_wm_window(C) == NULL)
return;
- doit |= (BLI_in_rcti_v(&ar->winrct, &event->x));
+ doit |= (BLI_rcti_isect_pt_v(&ar->winrct, &event->x));
if (action & WM_HANDLER_BREAK)
break;
@@ -2617,12 +2617,13 @@ static void attach_ndof_data(wmEvent *event, const GHOST_TEventNDOFMotionData *g
wmNDOFMotionData *data = MEM_mallocN(sizeof(wmNDOFMotionData), "customdata NDOF");
const float s = U.ndof_sensitivity;
+ const float rs = U.ndof_orbit_sensitivity;
data->tx = s * ghost->tx;
- data->rx = s * ghost->rx;
- data->ry = s * ghost->ry;
- data->rz = s * ghost->rz;
+ data->rx = rs * ghost->rx;
+ data->ry = rs * ghost->ry;
+ data->rz = rs * ghost->rz;
if (U.ndof_flag & NDOF_ZOOM_UPDOWN) {
/* rotate so Y is where Z was */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 660117de9f7..48b552acf26 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -380,8 +380,6 @@ void WM_file_read(bContext *C, const char *filepath, ReportList *reports)
/* assume automated tasks with background, don't write recent file list */
const int do_history = (G.background == FALSE) && (CTX_wm_manager(C)->op_undo_depth == 0);
- BKE_vfont_free_global_ttf();
-
/* put aside screens to match with persistent windows later */
/* also exit screens and editors */
wm_window_match_init(C, &wmbase);
@@ -490,9 +488,7 @@ int WM_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory
ListBase wmbase;
char tstr[FILE_MAX];
int success = 0;
-
- BKE_vfont_free_global_ttf();
-
+
G.relbase_valid = 0;
if (!from_memory) {
char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index c9f1a2587df..2928ba024e5 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -130,8 +130,8 @@ int wm_gesture_evaluate(wmGesture *gesture)
{
if (gesture->type == WM_GESTURE_TWEAK) {
rcti *rect = gesture->customdata;
- int dx = rect->xmax - rect->xmin;
- int dy = rect->ymax - rect->ymin;
+ int dx = BLI_RCT_SIZE_X(rect);
+ int dy = BLI_RCT_SIZE_Y(rect);
if (ABS(dx) + ABS(dy) > U.tweak_threshold) {
int theta = (int)floor(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI + 0.5f);
int val = EVT_GESTURE_W;
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 9047532c92c..8c2272e4707 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -367,19 +367,19 @@ static void wait_for_console_key(void)
/* note, doesnt run exit() call WM_exit() for that */
void WM_exit_ext(bContext *C, const short do_python)
{
- wmWindow *win;
+ wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
sound_exit();
-
/* first wrap up running stuff, we assume only the active WM is running */
/* modal handlers are on window level freed, others too? */
/* note; same code copied in wm_files.c */
- if (C && CTX_wm_manager(C)) {
-
- WM_jobs_stop_all(CTX_wm_manager(C));
-
- for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
+ if (C && wm) {
+ wmWindow *win;
+
+ WM_jobs_stop_all(wm);
+
+ for (win = wm->windows.first; win; win = win->next) {
CTX_wm_window_set(C, win); /* needed by operator close callbacks */
WM_event_remove_handlers(C, &win->handlers);
@@ -399,8 +399,6 @@ void WM_exit_ext(bContext *C, const short do_python)
// BIF_GlobalReebFree();
// BIF_freeRetarget();
BIF_freeTemplates(C);
-
- BKE_vfont_free_global_ttf(); /* bke_font.h */
free_openrecent();
@@ -408,7 +406,7 @@ void WM_exit_ext(bContext *C, const short do_python)
ED_preview_free_dbase(); /* frees a Main dbase, before free_blender! */
- if (C && CTX_wm_manager(C))
+ if (C && wm)
wm_free_reports(C); /* before free_blender! - since the ListBases get freed there */
BKE_sequencer_free_clipboard(); /* sequencer.c */
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index ce0c7e13454..e3d6b0f73e1 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -114,7 +114,7 @@ struct wmJob {
/* internal */
void *owner;
int flag;
- short suspended, running, ready, do_update, stop;
+ short suspended, running, ready, do_update, stop, job_type;
float progress;
/* for display in header, identification */
@@ -136,13 +136,13 @@ struct wmJob {
*/
static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
{
- wmJob *steve, *found = NULL;
+ wmJob *wm_job, *found = NULL;
- for (steve = wm->jobs.first; steve; steve = steve->next)
- if (steve->owner == owner) {
- found = steve;
- if (name && strcmp(steve->name, name) == 0)
- return steve;
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
+ if (wm_job->owner == owner) {
+ found = wm_job;
+ if (name && strcmp(wm_job->name, name) == 0)
+ return wm_job;
}
return found;
@@ -153,112 +153,118 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
/* returns current or adds new job, but doesnt run it */
/* every owner only gets a single job, adding a new one will stop running stop and
* when stopped it starts the new one */
-wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag)
+wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
{
- wmJob *steve = wm_job_find(wm, owner, name);
+ wmJob *wm_job = wm_job_find(wm, owner, name);
- if (steve == NULL) {
- steve = MEM_callocN(sizeof(wmJob), "new job");
+ if (wm_job == NULL) {
+ wm_job = MEM_callocN(sizeof(wmJob), "new job");
- BLI_addtail(&wm->jobs, steve);
- steve->win = win;
- steve->owner = owner;
- steve->flag = flag;
- BLI_strncpy(steve->name, name, sizeof(steve->name));
+ BLI_addtail(&wm->jobs, wm_job);
+ wm_job->win = win;
+ wm_job->owner = owner;
+ wm_job->flag = flag;
+ wm_job->job_type = job_type;
+ BLI_strncpy(wm_job->name, name, sizeof(wm_job->name));
}
- return steve;
+ return wm_job;
}
/* returns true if job runs, for UI (progress) indicators */
-int WM_jobs_test(wmWindowManager *wm, void *owner)
+int WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
{
- wmJob *steve;
+ wmJob *wm_job;
/* job can be running or about to run (suspended) */
- for (steve = wm->jobs.first; steve; steve = steve->next)
- if (steve->owner == owner)
- if (steve->running || steve->suspended)
- return 1;
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->owner == owner) {
+ if (job_type == WM_JOB_TYPE_ANY || (wm_job->job_type == job_type)) {
+ if (wm_job->running || wm_job->suspended) {
+ return TRUE;
+ }
+ }
+ }
+ }
- return 0;
+ return FALSE;
}
float WM_jobs_progress(wmWindowManager *wm, void *owner)
{
- wmJob *steve = wm_job_find(wm, owner, NULL);
+ wmJob *wm_job = wm_job_find(wm, owner, NULL);
- if (steve && steve->flag & WM_JOB_PROGRESS)
- return steve->progress;
+ if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
+ return wm_job->progress;
return 0.0;
}
char *WM_jobs_name(wmWindowManager *wm, void *owner)
{
- wmJob *steve = wm_job_find(wm, owner, NULL);
+ wmJob *wm_job = wm_job_find(wm, owner, NULL);
- if (steve)
- return steve->name;
+ if (wm_job)
+ return wm_job->name;
return NULL;
}
-int WM_jobs_is_running(wmJob *steve)
+int WM_jobs_is_running(wmJob *wm_job)
{
- return steve->running;
+ return wm_job->running;
}
-void *WM_jobs_customdata_get(wmJob *steve)
+void *WM_jobs_customdata_get(wmJob *wm_job)
{
- if (!steve->customdata) {
- return steve->run_customdata;
+ if (!wm_job->customdata) {
+ return wm_job->run_customdata;
}
else {
- return steve->customdata;
+ return wm_job->customdata;
}
}
-void WM_jobs_customdata_set(wmJob *steve, void *customdata, void (*free)(void *))
+void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void (*free)(void *))
{
/* pending job? just free */
- if (steve->customdata)
- steve->free(steve->customdata);
+ if (wm_job->customdata)
+ wm_job->free(wm_job->customdata);
- steve->customdata = customdata;
- steve->free = free;
+ wm_job->customdata = customdata;
+ wm_job->free = free;
- if (steve->running) {
+ if (wm_job->running) {
/* signal job to end */
- steve->stop = 1;
+ wm_job->stop = TRUE;
}
}
-void WM_jobs_timer(wmJob *steve, double timestep, unsigned int note, unsigned int endnote)
+void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
{
- steve->timestep = timestep;
- steve->note = note;
- steve->endnote = endnote;
+ wm_job->timestep = timestep;
+ wm_job->note = note;
+ wm_job->endnote = endnote;
}
-void WM_jobs_callbacks(wmJob *steve,
+void WM_jobs_callbacks(wmJob *wm_job,
void (*startjob)(void *, short *, short *, float *),
void (*initjob)(void *),
void (*update)(void *),
void (*endjob)(void *))
{
- steve->startjob = startjob;
- steve->initjob = initjob;
- steve->update = update;
- steve->endjob = endjob;
+ wm_job->startjob = startjob;
+ wm_job->initjob = initjob;
+ wm_job->update = update;
+ wm_job->endjob = endjob;
}
static void *do_job_thread(void *job_v)
{
- wmJob *steve = job_v;
+ wmJob *wm_job = job_v;
- steve->startjob(steve->run_customdata, &steve->stop, &steve->do_update, &steve->progress);
- steve->ready = 1;
+ wm_job->startjob(wm_job->run_customdata, &wm_job->stop, &wm_job->do_update, &wm_job->progress);
+ wm_job->ready = TRUE;
return NULL;
}
@@ -266,36 +272,38 @@ static void *do_job_thread(void *job_v)
/* don't allow same startjob to be executed twice */
static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
{
- wmJob *steve;
- int suspend = 0;
+ wmJob *wm_job;
+ int suspend = FALSE;
/* job added with suspend flag, we wait 1 timer step before activating it */
if (test->flag & WM_JOB_SUSPEND) {
- suspend = 1;
+ suspend = TRUE;
test->flag &= ~WM_JOB_SUSPEND;
}
else {
/* check other jobs */
- for (steve = wm->jobs.first; steve; steve = steve->next) {
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
/* obvious case, no test needed */
- if (steve == test || !steve->running) continue;
+ if (wm_job == test || !wm_job->running) {
+ continue;
+ }
/* if new job is not render, then check for same startjob */
if (0 == (test->flag & WM_JOB_EXCL_RENDER))
- if (steve->startjob != test->startjob)
+ if (wm_job->startjob != test->startjob)
continue;
/* if new job is render, any render job should be stopped */
if (test->flag & WM_JOB_EXCL_RENDER)
- if (0 == (steve->flag & WM_JOB_EXCL_RENDER))
+ if (0 == (wm_job->flag & WM_JOB_EXCL_RENDER))
continue;
- suspend = 1;
+ suspend = TRUE;
/* if this job has higher priority, stop others */
if (test->flag & WM_JOB_PRIORITY) {
- steve->stop = 1;
- // printf("job stopped: %s\n", steve->name);
+ wm_job->stop = TRUE;
+ // printf("job stopped: %s\n", wm_job->name);
}
}
}
@@ -307,110 +315,113 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
/* if job running, the same owner gave it a new job */
/* if different owner starts existing startjob, it suspends itself */
-void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
+void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
{
- if (steve->running) {
+ if (wm_job->running) {
/* signal job to end and restart */
- steve->stop = 1;
- // printf("job started a running job, ending... %s\n", steve->name);
+ wm_job->stop = TRUE;
+ // printf("job started a running job, ending... %s\n", wm_job->name);
}
else {
- if (steve->customdata && steve->startjob) {
+ if (wm_job->customdata && wm_job->startjob) {
- wm_jobs_test_suspend_stop(wm, steve);
+ wm_jobs_test_suspend_stop(wm, wm_job);
- if (steve->suspended == 0) {
+ if (wm_job->suspended == FALSE) {
/* copy to ensure proper free in end */
- steve->run_customdata = steve->customdata;
- steve->run_free = steve->free;
- steve->free = NULL;
- steve->customdata = NULL;
- steve->running = 1;
+ wm_job->run_customdata = wm_job->customdata;
+ wm_job->run_free = wm_job->free;
+ wm_job->free = NULL;
+ wm_job->customdata = NULL;
+ wm_job->running = TRUE;
- if (steve->initjob)
- steve->initjob(steve->run_customdata);
+ if (wm_job->initjob)
+ wm_job->initjob(wm_job->run_customdata);
- steve->stop = 0;
- steve->ready = 0;
- steve->progress = 0.0;
+ wm_job->stop = FALSE;
+ wm_job->ready = FALSE;
+ wm_job->progress = 0.0;
- // printf("job started: %s\n", steve->name);
+ // printf("job started: %s\n", wm_job->name);
- BLI_init_threads(&steve->threads, do_job_thread, 1);
- BLI_insert_thread(&steve->threads, steve);
+ BLI_init_threads(&wm_job->threads, do_job_thread, 1);
+ BLI_insert_thread(&wm_job->threads, wm_job);
}
/* restarted job has timer already */
- if (steve->wt == NULL)
- steve->wt = WM_event_add_timer(wm, steve->win, TIMERJOBS, steve->timestep);
+ if (wm_job->wt == NULL)
+ wm_job->wt = WM_event_add_timer(wm, wm_job->win, TIMERJOBS, wm_job->timestep);
if (G.debug & G_DEBUG_JOBS)
- steve->start_time = PIL_check_seconds_timer();
+ wm_job->start_time = PIL_check_seconds_timer();
}
else printf("job fails, not initialized\n");
}
}
/* stop job, free data completely */
-static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *steve)
+static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
{
- if (steve->running) {
+ if (wm_job->running) {
/* signal job to end */
- steve->stop = 1;
- BLI_end_threads(&steve->threads);
+ wm_job->stop = TRUE;
+ BLI_end_threads(&wm_job->threads);
- if (steve->endjob)
- steve->endjob(steve->run_customdata);
+ if (wm_job->endjob)
+ wm_job->endjob(wm_job->run_customdata);
}
- if (steve->wt)
- WM_event_remove_timer(wm, steve->win, steve->wt);
- if (steve->customdata)
- steve->free(steve->customdata);
- if (steve->run_customdata)
- steve->run_free(steve->run_customdata);
+ if (wm_job->wt)
+ WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
+ if (wm_job->customdata)
+ wm_job->free(wm_job->customdata);
+ if (wm_job->run_customdata)
+ wm_job->run_free(wm_job->run_customdata);
- /* remove steve */
- BLI_remlink(&wm->jobs, steve);
- MEM_freeN(steve);
+ /* remove wm_job */
+ BLI_remlink(&wm->jobs, wm_job);
+ MEM_freeN(wm_job);
}
void WM_jobs_stop_all(wmWindowManager *wm)
{
- wmJob *steve;
+ wmJob *wm_job;
- while ((steve = wm->jobs.first))
- wm_jobs_kill_job(wm, steve);
+ while ((wm_job = wm->jobs.first))
+ wm_jobs_kill_job(wm, wm_job);
}
/* signal job(s) from this owner or callback to stop, timer is required to get handled */
void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob)
{
- wmJob *steve;
+ wmJob *wm_job;
- for (steve = wm->jobs.first; steve; steve = steve->next)
- if (steve->owner == owner || steve->startjob == startjob)
- if (steve->running)
- steve->stop = 1;
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->owner == owner || wm_job->startjob == startjob) {
+ if (wm_job->running) {
+ wm_job->stop = TRUE;
+ }
+ }
+ }
}
/* actually terminate thread and job timer */
void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, short int *, short int *, float *))
{
- wmJob *steve;
+ wmJob *wm_job;
- steve = wm->jobs.first;
- while (steve) {
- if (steve->owner == owner || steve->startjob == startjob) {
- wmJob *bill = steve;
- steve = steve->next;
+ wm_job = wm->jobs.first;
+ while (wm_job) {
+ if (wm_job->owner == owner || wm_job->startjob == startjob) {
+ wmJob *bill = wm_job;
+ wm_job = wm_job->next;
wm_jobs_kill_job(wm, bill);
}
else {
- steve = steve->next;
+ wm_job = wm_job->next;
}
}
}
@@ -419,11 +430,11 @@ void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, sho
/* kill job entirely, also removes timer itself */
void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
{
- wmJob *steve;
+ wmJob *wm_job;
- for (steve = wm->jobs.first; steve; steve = steve->next) {
- if (steve->wt == wt) {
- wm_jobs_kill_job(wm, steve);
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->wt == wt) {
+ wm_jobs_kill_job(wm, wm_job);
return;
}
}
@@ -432,85 +443,85 @@ void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
/* hardcoded to event TIMERJOBS */
void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
{
- wmJob *steve = wm->jobs.first, *stevenext;
+ wmJob *wm_job, *wm_jobnext;
float total_progress = 0.f;
float jobs_progress = 0;
- for (; steve; steve = stevenext) {
- stevenext = steve->next;
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_jobnext) {
+ wm_jobnext = wm_job->next;
- if (steve->wt == wt) {
+ if (wm_job->wt == wt) {
/* running threads */
- if (steve->threads.first) {
+ if (wm_job->threads.first) {
/* always call note and update when ready */
- if (steve->do_update || steve->ready) {
- if (steve->update)
- steve->update(steve->run_customdata);
- if (steve->note)
- WM_event_add_notifier(C, steve->note, NULL);
+ if (wm_job->do_update || wm_job->ready) {
+ if (wm_job->update)
+ wm_job->update(wm_job->run_customdata);
+ if (wm_job->note)
+ WM_event_add_notifier(C, wm_job->note, NULL);
- if (steve->flag & WM_JOB_PROGRESS)
+ if (wm_job->flag & WM_JOB_PROGRESS)
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
- steve->do_update = FALSE;
+ wm_job->do_update = FALSE;
}
- if (steve->ready) {
- if (steve->endjob)
- steve->endjob(steve->run_customdata);
+ if (wm_job->ready) {
+ if (wm_job->endjob)
+ wm_job->endjob(wm_job->run_customdata);
/* free own data */
- steve->run_free(steve->run_customdata);
- steve->run_customdata = NULL;
- steve->run_free = NULL;
+ wm_job->run_free(wm_job->run_customdata);
+ wm_job->run_customdata = NULL;
+ wm_job->run_free = NULL;
- // if (steve->stop) printf("job ready but stopped %s\n", steve->name);
- // else printf("job finished %s\n", steve->name);
+ // if (wm_job->stop) printf("job ready but stopped %s\n", wm_job->name);
+ // else printf("job finished %s\n", wm_job->name);
if (G.debug & G_DEBUG_JOBS) {
- printf("Job '%s' finished in %f seconds\n", steve->name,
- PIL_check_seconds_timer() - steve->start_time);
+ printf("Job '%s' finished in %f seconds\n", wm_job->name,
+ PIL_check_seconds_timer() - wm_job->start_time);
}
- steve->running = 0;
- BLI_end_threads(&steve->threads);
+ wm_job->running = FALSE;
+ BLI_end_threads(&wm_job->threads);
- if (steve->endnote)
- WM_event_add_notifier(C, steve->endnote, NULL);
+ if (wm_job->endnote)
+ WM_event_add_notifier(C, wm_job->endnote, NULL);
WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
- /* new job added for steve? */
- if (steve->customdata) {
- // printf("job restarted with new data %s\n", steve->name);
- WM_jobs_start(wm, steve);
+ /* new job added for wm_job? */
+ if (wm_job->customdata) {
+ // printf("job restarted with new data %s\n", wm_job->name);
+ WM_jobs_start(wm, wm_job);
}
else {
- WM_event_remove_timer(wm, steve->win, steve->wt);
- steve->wt = NULL;
+ WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
+ wm_job->wt = NULL;
- /* remove steve */
- BLI_remlink(&wm->jobs, steve);
- MEM_freeN(steve);
+ /* remove wm_job */
+ BLI_remlink(&wm->jobs, wm_job);
+ MEM_freeN(wm_job);
}
}
- else if (steve->flag & WM_JOB_PROGRESS) {
+ else if (wm_job->flag & WM_JOB_PROGRESS) {
/* accumulate global progress for running jobs */
jobs_progress++;
- total_progress += steve->progress;
+ total_progress += wm_job->progress;
}
}
- else if (steve->suspended) {
- WM_jobs_start(wm, steve);
+ else if (wm_job->suspended) {
+ WM_jobs_start(wm, wm_job);
}
}
- else if (steve->threads.first && !steve->ready) {
- if (steve->flag & WM_JOB_PROGRESS) {
+ else if (wm_job->threads.first && !wm_job->ready) {
+ if (wm_job->flag & WM_JOB_PROGRESS) {
/* accumulate global progress for running jobs */
jobs_progress++;
- total_progress += steve->progress;
+ total_progress += wm_job->progress;
}
}
}
@@ -530,11 +541,13 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
int WM_jobs_has_running(wmWindowManager *wm)
{
- wmJob *steve;
+ wmJob *wm_job;
- for (steve = wm->jobs.first; steve; steve = steve->next)
- if (steve->running)
- return 1;
+ for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+ if (wm_job->running) {
+ return TRUE;
+ }
+ }
- return 0;
+ return FALSE;
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 59e0614b18a..67cd202591d 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -965,7 +965,7 @@ int WM_operator_check_ui_enabled(const bContext *C, const char *idname)
wmWindowManager *wm = CTX_wm_manager(C);
Scene *scene = CTX_data_scene(C);
- return !(ED_undo_valid(C, idname) == 0 || WM_jobs_test(wm, scene));
+ return !(ED_undo_valid(C, idname) == 0 || WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY));
}
wmOperator *WM_operator_last_redo(const bContext *C)
@@ -1866,6 +1866,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
static void WM_OT_link_append(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
ot->name = "Link/Append from Library";
ot->idname = "WM_OT_link_append";
ot->description = "Link or Append from a Library .blend file";
@@ -1881,11 +1883,17 @@ static void WM_OT_link_append(wmOperatorType *ot)
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES,
FILE_DEFAULTDISPLAY);
- RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending");
- RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects");
- RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer");
- RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup");
-}
+ /* better not save _any_ settings for this operator */
+ /* properties */
+ prop = RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "active_layer", 1, "Active Layer", "Put the linked objects on the active layer");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "instance_groups", 1, "Instance Groups", "Create instances for each group as a DupliGroup");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+}
/* *************** recover last session **************** */
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 3c791cb6e5d..0074d6236db 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -49,11 +49,12 @@
#include "PIL_time.h"
+#include "BLI_fileops.h"
#include "BLI_listbase.h"
-#include "BLI_string.h"
#include "BLI_path_util.h"
-#include "BLI_fileops.h"
#include "BLI_rect.h"
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -65,22 +66,12 @@
#include "BIF_gl.h"
#include "BIF_glutil.h"
-#ifdef WITH_QUICKTIME
-# ifdef _WIN32
-# include <QTML.h>
-# include <Movies.h>
-# elif defined(__APPLE__)
-# include <QuickTime/Movies.h>
-# endif /* __APPLE__ */
-#endif /* WITH_QUICKTIME */
-
#include "DNA_scene_types.h"
-#include "BLI_utildefines.h"
#include "ED_datafiles.h" /* for fonts */
-#include "wm_event_types.h"
#include "GHOST_C-api.h"
#include "BLF_api.h"
+#include "wm_event_types.h"
typedef struct PlayState {
@@ -708,12 +699,6 @@ void playanim_window_open(const char *title, int posx, int posy, int sizex, int
inital_state = start_maximized ? GHOST_kWindowStateFullScreen : GHOST_kWindowStateNormal;
else
inital_state = start_maximized ? GHOST_kWindowStateMaximized : GHOST_kWindowStateNormal;
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
- {
- extern int macPrefState; /* creator.c */
- initial_state += macPrefState;
- }
-#endif
g_WS.ghost_window = GHOST_CreateWindow(g_WS.ghost_system,
title,
@@ -827,26 +812,6 @@ void playanim(int argc, const char **argv)
}
}
-#ifdef WITH_QUICKTIME
-#if defined(_WIN32) || defined(__APPLE__) && !defined(GHOST_COCOA)
- /* Initialize QuickTime */
-#ifndef noErr
-#define noErr 0
-#endif
-
-#ifdef _WIN32
- if (InitializeQTML(0) != noErr)
- G.have_quicktime = FALSE;
- else
- G.have_quicktime = TRUE;
-#endif /* _WIN32 */
- if (EnterMovies() != noErr)
- G.have_quicktime = FALSE;
- else
-#endif /* _WIN32 || __APPLE__ && !defined(GHOST_COCOA)*/
- G.have_quicktime = TRUE;
-#endif /* WITH_QUICKTIME */
-
if (argc > 1) {
BLI_strncpy(filepath, argv[1], sizeof(filepath));
}
@@ -1098,16 +1063,6 @@ void playanim(int argc, const char **argv)
ps.picture = ps.picture->next;
}
-#ifdef WITH_QUICKTIME
-#if defined(_WIN32) || defined(__APPLE__) && !defined(GHOST_COCOA)
- if (G.have_quicktime) {
- ExitMovies();
-#ifdef _WIN32
- TerminateQTML();
-#endif /* _WIN32 */
- }
-#endif /* _WIN32 || __APPLE__ && !defined(GHOST_COCOA) */
-#endif /* WITH_QUICKTIME */
/* cleanup */
#ifndef USE_IMB_CACHE
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index c9fb2644cfa..adf54af240b 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -116,8 +116,8 @@ void wm_subwindow_getsize(wmWindow *win, int swinid, int *x, int *y)
wmSubWindow *swin = swin_from_swinid(win, swinid);
if (swin) {
- *x = swin->winrct.xmax - swin->winrct.xmin + 1;
- *y = swin->winrct.ymax - swin->winrct.ymin + 1;
+ *x = BLI_RCT_SIZE_X(&swin->winrct) + 1;
+ *y = BLI_RCT_SIZE_Y(&swin->winrct) + 1;
}
}
@@ -256,13 +256,13 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
win->curswin = _curswin;
_curwindow = win;
- width = _curswin->winrct.xmax - _curswin->winrct.xmin + 1;
- height = _curswin->winrct.ymax - _curswin->winrct.ymin + 1;
+ width = BLI_RCT_SIZE_X(&_curswin->winrct) + 1;
+ height = BLI_RCT_SIZE_Y(&_curswin->winrct) + 1;
glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
if (srct) {
- width = srct->xmax - srct->xmin + 1;
- height = srct->ymax - srct->ymin + 1;
+ width = BLI_RCT_SIZE_X(srct) + 1;
+ height = BLI_RCT_SIZE_Y(srct) + 1;
glScissor(srct->xmin, srct->ymin, width, height);
}
else
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index c2aa99352e9..b83b93454e6 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -340,12 +340,6 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
wm_get_screensize(&scr_w, &scr_h);
posy = (scr_h - win->posy - win->sizey);
-#if defined(__APPLE__) && !defined(GHOST_COCOA)
- {
- extern int macPrefState; /* creator.c */
- initial_state += macPrefState;
- }
-#endif
/* Disable AA for now, as GL_SELECT (used for border, lasso, ... select)
* doesn't work well when AA is initialized, even if not used. */
ghostwin = GHOST_CreateWindow(g_system, title,
@@ -464,8 +458,8 @@ wmWindow *WM_window_open(bContext *C, rcti *rect)
win->posx = rect->xmin;
win->posy = rect->ymin;
- win->sizex = rect->xmax - rect->xmin;
- win->sizey = rect->ymax - rect->ymin;
+ win->sizex = BLI_RCT_SIZE_X(rect);
+ win->sizey = BLI_RCT_SIZE_Y(rect);
win->drawmethod = -1;
win->drawdata = NULL;
@@ -500,8 +494,8 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
win->posy = position->ymin;
}
- win->sizex = position->xmax - position->xmin;
- win->sizey = position->ymax - position->ymin;
+ win->sizex = BLI_RCT_SIZE_X(position);
+ win->sizey = BLI_RCT_SIZE_Y(position);
if (win->ghostwin) {
wm_window_set_size(win, win->sizex, win->sizey);
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 30f6c564688..95a8a7db635 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -285,25 +285,29 @@ enum {
/* for event checks */
/* only used for KM_TEXTINPUT, so assume that we want all user-inputtable ascii codes included */
-#define ISTEXTINPUT(event) (event >=' ' && event <=255)
+#define ISTEXTINPUT(event) (event >= ' ' && event <= 255)
/* test whether the event is a key on the keyboard */
-#define ISKEYBOARD(event) (event >=' ' && event <=320)
+#define ISKEYBOARD(event) (event >= ' ' && event <= 320)
/* test whether the event is a modifier key */
-#define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == OSKEY)
+#define ISKEYMODIFIER(event) ((event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) || event == OSKEY)
/* test whether the event is a mouse button */
-#define ISMOUSE(event) (event >= LEFTMOUSE && event <= MOUSEROTATE)
+#define ISMOUSE(event) (event >= LEFTMOUSE && event <= MOUSEROTATE)
/* test whether the event is tweak event */
-#define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
+#define ISTWEAK(event) (event >= EVT_TWEAK_L && event <= EVT_GESTURE)
/* test whether the event is a NDOF event */
-#define ISNDOF(event) (event >= NDOF_MOTION && event < NDOF_LAST)
+#define ISNDOF(event) (event >= NDOF_MOTION && event < NDOF_LAST)
/* test whether event type is acceptable as hotkey, excluding modifiers */
-#define ISHOTKEY(event) ((ISKEYBOARD(event) || ISMOUSE(event) || ISNDOF(event)) && event!=ESCKEY && !(event>=LEFTCTRLKEY && event<=LEFTSHIFTKEY) && !(event>=UNKNOWNKEY && event<=GRLESSKEY))
+#define ISHOTKEY(event) \
+ ((ISKEYBOARD(event) || ISMOUSE(event) || ISNDOF(event)) && \
+ (event != ESCKEY) && \
+ (event >= LEFTCTRLKEY && event <= LEFTSHIFTKEY) == FALSE && \
+ (event >= UNKNOWNKEY && event <= GRLESSKEY) == FALSE)
/* **************** BLENDER GESTURE EVENTS (0x5000) **************** */
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 5a71b51c5dd..44991adcc9d 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -110,7 +110,7 @@ endif()
ge_scenegraph
bf_ikplugin
bf_intern_itasc
- bf_intern_ik
+ bf_intern_iksolver
bf_intern_smoke
bf_modifiers
bf_intern_moto
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 9ae2cb0c353..b600c08f4dc 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -183,7 +183,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct
/* rna */
float *give_cursor(struct Scene *scene, struct View3D *v3d) {return (float *) NULL;}
void WM_menutype_free(void) {}
-void WM_menutype_freelink(struct MenuType* mt) {}
+void WM_menutype_freelink(struct MenuType *mt) {}
int WM_menutype_add(struct MenuType *mt) {return 0;}
int WM_operator_props_dialog_popup(struct bContext *C, struct wmOperator *op, int width, int height) {return 0;}
int WM_operator_confirm(struct bContext *C, struct wmOperator *op, struct wmEvent *event) {return 0;}
@@ -418,7 +418,7 @@ void uiTemplateColorWheel(struct uiLayout *layout, struct PointerRNA *ptr, char
void uiTemplateHistogram(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand) {}
void uiTemplateReportsBanner(struct uiLayout *layout, struct bContext *C, struct wmOperator *op) {}
void uiTemplateWaveform(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand) {}
-void uiTemplateVectorscope(struct uiLayout *_self, struct PointerRNA *data, char* property, int expand) {}
+void uiTemplateVectorscope(struct uiLayout *_self, struct PointerRNA *data, char *property, int expand) {}
void uiTemplateNodeLink(struct uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input) {}
void uiTemplateNodeView(struct uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input) {}
void uiTemplateTextureUser(struct uiLayout *layout, struct bContext *C) {}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index a3a3a13130c..26ca390239b 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -862,7 +862,6 @@ endif()
bf_intern_bsp
bf_intern_decimate
bf_intern_elbeem
- bf_intern_ik
bf_intern_memutil
bf_intern_guardedalloc
bf_intern_ctr
@@ -934,6 +933,10 @@ endif()
list(APPEND BLENDER_SORTED_LIBS bf_intern_guardedalloc_cpp)
endif()
+ if(WITH_IK_SOLVER)
+ list_insert_after(BLENDER_SORTED_LIBS "bf_intern_elbeem" "bf_intern_iksolver")
+ endif()
+
if(WITH_IK_ITASC)
list(APPEND BLENDER_SORTED_LIBS bf_intern_itasc)
endif()
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 3e884d1aa38..80981c08c5e 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1274,6 +1274,10 @@ int main(int argc, const char **argv)
IMB_init();
+#ifdef WITH_FFMPEG
+ IMB_ffmpeg_init();
+#endif
+
BLI_callback_global_init();
#ifdef WITH_GAMEENGINE
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index cef068ccbaa..1b8f857c2cb 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -458,7 +458,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
// itself is unaware of the extra space, so we clear the whole region for it.
glClearColor(scene->gm.framing.col[0], scene->gm.framing.col[1], scene->gm.framing.col[2], 1.0f);
glViewport(ar->winrct.xmin, ar->winrct.ymin,
- ar->winrct.xmax - ar->winrct.xmin, ar->winrct.ymax - ar->winrct.ymin);
+ BLI_RCT_SIZE_X(&ar->winrct), BLI_RCT_SIZE_Y(&ar->winrct));
glClear(GL_COLOR_BUFFER_BIT);
}
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 93eeaaf05fb..9f155a6ebc3 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -657,19 +657,19 @@ void BL_ConvertSensors(struct Object* blenderobject,
if (gamecont) {
logicmgr->RegisterToSensor(gamecont,gamesensor);
- } else {
- printf(
- "Warning, sensor \"%s\" could not find its controller "
- "(link %d of %d) from object \"%s\"\n"
- "\tthere has been an error converting the blender controller for the game engine,"
- "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2);
}
- } else {
- printf(
- "Warning, sensor \"%s\" has lost a link to a controller "
- "(link %d of %d) from object \"%s\"\n"
- "\tpossible causes are partially appended objects or an error reading the file,"
- "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2);
+ else {
+ printf("Warning, sensor \"%s\" could not find its controller "
+ "(link %d of %d) from object \"%s\"\n"
+ "\tthere has been an error converting the blender controller for the game engine,"
+ "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2);
+ }
+ }
+ else {
+ printf("Warning, sensor \"%s\" has lost a link to a controller "
+ "(link %d of %d) from object \"%s\"\n"
+ "\tpossible causes are partially appended objects or an error reading the file,"
+ "logic may be incorrect\n", sens->name, i+1, sens->totlinks, blenderobject->id.name+2);
}
}
// special case: Keyboard sensor with no link
diff --git a/source/gameengine/Expressions/BoolValue.cpp b/source/gameengine/Expressions/BoolValue.cpp
index b3c4dc144df..40997a25be1 100644
--- a/source/gameengine/Expressions/BoolValue.cpp
+++ b/source/gameengine/Expressions/BoolValue.cpp
@@ -139,7 +139,7 @@ this object
default:
{
ret = new CErrorValue(val->GetText() + op2str(op) +
- "[operator not allowed on booleans]");
+ "[operator not allowed on booleans]");
break;
}
}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index eccb83fe80c..21de7011eda 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -464,31 +464,34 @@ bool GPG_Application::processEvent(GHOST_IEvent* event)
handled = false;
break;
- case GHOST_kEventWindowUpdate:
- {
- GHOST_IWindow* window = event->getWindow();
- if (!m_system->validWindow(window)) break;
- // Update the state of the game engine
- if (m_kxsystem && !m_exitRequested)
- {
- // Proceed to next frame
- window->activateDrawingContext();
-
- // first check if we want to exit
- m_exitRequested = m_ketsjiengine->GetExitCode();
-
- // kick the engine
- bool renderFrame = m_ketsjiengine->NextFrame();
- if (renderFrame)
- {
- // render the frame
- m_ketsjiengine->Render();
- }
- }
- m_exitString = m_ketsjiengine->GetExitString();
- }
- break;
-
+ // The player now runs as often as it can (repsecting vsync and fixedtime).
+ // This allows the player to break 100fps, but this code is being left here
+ // as reference. (see EngineNextFrame)
+ //case GHOST_kEventWindowUpdate:
+ // {
+ // GHOST_IWindow* window = event->getWindow();
+ // if (!m_system->validWindow(window)) break;
+ // // Update the state of the game engine
+ // if (m_kxsystem && !m_exitRequested)
+ // {
+ // // Proceed to next frame
+ // window->activateDrawingContext();
+
+ // // first check if we want to exit
+ // m_exitRequested = m_ketsjiengine->GetExitCode();
+ //
+ // // kick the engine
+ // bool renderFrame = m_ketsjiengine->NextFrame();
+ // if (renderFrame)
+ // {
+ // // render the frame
+ // m_ketsjiengine->Render();
+ // }
+ // }
+ // m_exitString = m_ketsjiengine->GetExitString();
+ // }
+ // break;
+ //
case GHOST_kEventWindowSize:
{
GHOST_IWindow* window = event->getWindow();
@@ -789,6 +792,28 @@ void GPG_Application::stopEngine()
m_engineRunning = false;
}
+void GPG_Application::EngineNextFrame()
+{
+ // Update the state of the game engine
+ if (m_kxsystem && !m_exitRequested)
+ {
+ // Proceed to next frame
+ if (m_mainWindow)
+ m_mainWindow->activateDrawingContext();
+
+ // first check if we want to exit
+ m_exitRequested = m_ketsjiengine->GetExitCode();
+
+ // kick the engine
+ bool renderFrame = m_ketsjiengine->NextFrame();
+ if (renderFrame && m_mainWindow)
+ {
+ // render the frame
+ m_ketsjiengine->Render();
+ }
+ }
+ m_exitString = m_ketsjiengine->GetExitString();
+}
void GPG_Application::exitEngine()
{
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h
index 51dac5cb3f3..e04fcc2a555 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h
@@ -77,6 +77,7 @@ public:
GlobalSettings* getGlobalSettings(void);
bool StartGameEngine(int stereoMode);
void StopGameEngine();
+ void EngineNextFrame();
protected:
bool handleWheel(GHOST_IEvent* event);
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 025611972ce..41f641b4368 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -194,7 +194,7 @@ void usage(const char* program, bool isBlenderPlayer)
}
printf("usage: %s [-w [w h l t]] [-f [fw fh fb ff]] %s[-g gamengineoptions] "
- "[-s stereomode] [-m aasamples] %s\n", program, consoleoption, example_filename);
+ "[-s stereomode] [-m aasamples] %s\n", program, consoleoption, example_filename);
printf(" -h: Prints this command summary\n\n");
printf(" -w: display in a window\n");
printf(" --Optional parameters--\n");
@@ -970,6 +970,8 @@ int main(int argc, char** argv)
{
system->processEvents(false);
system->dispatchEvents();
+ app.EngineNextFrame();
+
if ((exitcode = app.getExitRequested()))
{
run = false;
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index e4e3fb95543..b8cc4ebeff9 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -193,7 +193,7 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap)
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
-void BL_Texture::InitGLCompressedTex(ImBuf* ibuf, bool mipmap)
+void BL_Texture::InitGLCompressedTex(ImBuf *ibuf, bool mipmap)
{
#ifndef WITH_DDS
// Fall back to uncompressed if DDS isn't enabled
@@ -201,11 +201,6 @@ void BL_Texture::InitGLCompressedTex(ImBuf* ibuf, bool mipmap)
return;
#else
glBindTexture(GL_TEXTURE_2D, mTexture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-
if (GPU_upload_dxt_texture(ibuf) == 0) {
InitGLTex(ibuf->rect, ibuf->x, ibuf->y, mipmap);
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index a9602d16430..ac17adaf052 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -1048,7 +1048,9 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay,
{
Py_DECREF(argValue);
PyErr_SetString(PyExc_TypeError,
- "Error in getScreenRay. Invalid 2D coordinate. Expected a normalized 2D screen coordinate, a distance and an optional property argument");
+ "Error in getScreenRay. Invalid 2D coordinate. "
+ "Expected a normalized 2D screen coordinate, "
+ "a distance and an optional property argument");
return NULL;
}
Py_DECREF(argValue);
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 04a806dfd92..3818cef7d6e 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1688,7 +1688,8 @@ PyObject* KX_GameObject::PyReplaceMesh(PyObject* args)
PyObject* KX_GameObject::PyEndObject()
{
- KX_Scene *scene = KX_GetActiveScene();
+ SG_Node* node = this->GetSGNode();
+ KX_Scene* scene = static_cast<KX_Scene*>(node->GetSGClientInfo());
scene->DelayedRemoveObject(this);
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
index e0aba795e01..f49f2473036 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
@@ -27,7 +27,7 @@
/** \file KX_SCA_AddObjectActuator.h
* \ingroup ketsji
- * \attention Previously existed as: \source\gameengine\GameLogic\SCA_AddObjectActuator.h
+ * \attention Previously existed as: source/gameengine/GameLogic/SCA_AddObjectActuator.h
* Please look here for revision history.
*/
diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
index 1a503c074ed..3399ed90667 100644
--- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
@@ -28,7 +28,7 @@
/** \file KX_SCA_EndObjectActuator.h
* \ingroup ketsji
* \brief Add object to the game world on action of this actuator
- * \attention Previously existed as: \source\gameengine\GameLogic\SCA_EndObjectActuator.h
+ * \attention Previously existed as: source/gameengine/GameLogic/SCA_EndObjectActuator.h
* Please look here for revision history.
*/
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
index d756c48f0f9..6db16a0e1b6 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
@@ -28,7 +28,7 @@
/** \file KX_SCA_ReplaceMeshActuator.h
* \ingroup ketsji
* \brief Add object to the game world on action of this actuator
- * \attention Previously existed as: \source\gameengine\GameLogic\SCA_ReplaceMeshActuator.h
+ * \attention Previously existed as: source/gameengine/GameLogic/SCA_ReplaceMeshActuator.h
* Please look here for revision history.
*/
diff --git a/source/gameengine/SceneGraph/SG_ParentRelation.h b/source/gameengine/SceneGraph/SG_ParentRelation.h
index 925c0ed2766..4478ed11bc1 100644
--- a/source/gameengine/SceneGraph/SG_ParentRelation.h
+++ b/source/gameengine/SceneGraph/SG_ParentRelation.h
@@ -82,7 +82,7 @@ public :
* You must provide a way of duplicating an
* instance of an SG_ParentRelation. This should
* return a pointer to a new duplicate allocated
- * on the heap. Responsibilty for deleting the
+ * on the heap. Responsibility for deleting the
* duplicate resides with the caller of this method.
*/
diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp
index 9854da0ea86..17513d20a39 100644
--- a/source/gameengine/VideoTexture/ImageBuff.cpp
+++ b/source/gameengine/VideoTexture/ImageBuff.cpp
@@ -144,7 +144,7 @@ void ImageBuff::clear (short width, short height, unsigned char color)
// img must point to a array of RGBA data of size width*height
void ImageBuff::plot (unsigned char * img, short width, short height, short x, short y, short mode)
{
- struct ImBuf* tmpbuf;
+ struct ImBuf *tmpbuf;
if (m_size[0] == 0 || m_size[1] == 0 || width <= 0 || height <= 0)
return;
diff --git a/source/gameengine/VideoTexture/ImageBuff.h b/source/gameengine/VideoTexture/ImageBuff.h
index b3e7386c899..b2bdbc17dc9 100644
--- a/source/gameengine/VideoTexture/ImageBuff.h
+++ b/source/gameengine/VideoTexture/ImageBuff.h
@@ -38,7 +38,7 @@ struct ImBuf;
class ImageBuff : public ImageBase
{
private:
- struct ImBuf* m_imbuf; // temporary structure for buffer manipulation
+ struct ImBuf *m_imbuf; // temporary structure for buffer manipulation
public:
/// constructor
ImageBuff (void) : ImageBase(true), m_imbuf(NULL) {}
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 4586a50e6a9..1ba944aa955 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -52,8 +52,6 @@ const long timeScale = 1000;
#define CATCH_EXCP catch (Exception & exp) \
{ exp.report(); m_status = SourceError; }
-extern "C" void do_init_ffmpeg();
-
// class RenderVideo
// constructor
@@ -521,8 +519,6 @@ void VideoFFmpeg::releaseFrame(AVFrame* frame)
// open video file
void VideoFFmpeg::openFile (char * filename)
{
- do_init_ffmpeg();
-
if (openStream(filename, NULL, NULL) != 0)
return;
@@ -586,8 +582,6 @@ void VideoFFmpeg::openCam (char * file, short camIdx)
char filename[28], rateStr[20];
char *p;
- do_init_ffmpeg();
-
#ifdef WIN32
// video capture on windows only through Video For Windows driver
inputFormat = av_find_input_format("vfwcap");