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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--build_files/scons/tools/btools.py5
-rw-r--r--doc/python_api/rst/info_best_practice.rst46
-rw-r--r--intern/cycles/CMakeLists.txt1
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h2
-rw-r--r--intern/guardedalloc/intern/mallocn.c4
-rw-r--r--release/scripts/modules/console_python.py34
-rw-r--r--release/scripts/startup/bl_operators/console.py19
-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.py87
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py7
-rw-r--r--source/blender/blenfont/intern/blf_dir.c5
-rw-r--r--source/blender/blenfont/intern/blf_font.c24
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c27
-rw-r--r--source/blender/blenkernel/BKE_colortools.h33
-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_node.h1
-rw-r--r--source/blender/blenkernel/BKE_packedFile.h1
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h53
-rw-r--r--source/blender/blenkernel/CMakeLists.txt1
-rw-r--r--source/blender/blenkernel/intern/brush.c5
-rw-r--r--source/blender/blenkernel/intern/colortools.c177
-rw-r--r--source/blender/blenkernel/intern/font.c113
-rw-r--r--source/blender/blenkernel/intern/image.c4
-rw-r--r--source/blender/blenkernel/intern/mask.c16
-rw-r--r--source/blender/blenkernel/intern/mask_rasterize.c45
-rw-r--r--source/blender/blenkernel/intern/node.c98
-rw-r--r--source/blender/blenkernel/intern/packedFile.c12
-rw-r--r--source/blender/blenkernel/intern/seqcache.c122
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c550
-rw-r--r--source/blender/blenkernel/intern/sequencer.c428
-rw-r--r--source/blender/blenkernel/intern/texture.c2
-rw-r--r--source/blender/blenkernel/intern/world.c3
-rw-r--r--source/blender/blenlib/BLI_rect.h9
-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/rct.c12
-rw-r--r--source/blender/blenloader/intern/readfile.c38
-rw-r--r--source/blender/blenloader/intern/versioning_250.c2
-rw-r--r--source/blender/blenloader/intern/writefile.c42
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c4
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c8
-rw-r--r--source/blender/compositor/nodes/COM_TimeNode.cpp1
-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_CurveBaseOperation.cpp14
-rw-r--r--source/blender/compositor/operations/COM_CurveBaseOperation.h3
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.cpp6
-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_VectorCurveOperation.cpp1
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c6
-rw-r--r--source/blender/editors/animation/anim_markers.c5
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c4
-rw-r--r--source/blender/editors/include/ED_clip.h2
-rw-r--r--source/blender/editors/interface/interface.c34
-rw-r--r--source/blender/editors/interface/interface_draw.c66
-rw-r--r--source/blender/editors/interface/interface_handlers.c120
-rw-r--r--source/blender/editors/interface/interface_ops.c14
-rw-r--r--source/blender/editors/interface/interface_panel.c12
-rw-r--r--source/blender/editors/interface/interface_regions.c24
-rw-r--r--source/blender/editors/interface/interface_style.c12
-rw-r--r--source/blender/editors/interface/interface_templates.c39
-rw-r--r--source/blender/editors/interface/interface_widgets.c117
-rw-r--r--source/blender/editors/interface/resources.c4
-rw-r--r--source/blender/editors/interface/view2d.c106
-rw-r--r--source/blender/editors/interface/view2d_ops.c64
-rw-r--r--source/blender/editors/mask/mask_draw.c11
-rw-r--r--source/blender/editors/mesh/editface.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c77
-rw-r--r--source/blender/editors/object/object_modifier.c3
-rw-r--r--source/blender/editors/object/object_vgroup.c3
-rw-r--r--source/blender/editors/render/render_preview.c7
-rw-r--r--source/blender/editors/screen/area.c50
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-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_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_draw.c8
-rw-r--r--source/blender/editors/space_clip/clip_editor.c57
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c6
-rw-r--r--source/blender/editors/space_clip/clip_ops.c9
-rw-r--r--source/blender/editors/space_clip/space_clip.c4
-rw-r--r--source/blender/editors/space_console/space_console.c3
-rw-r--r--source/blender/editors/space_file/filesel.c8
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/editors/space_graph/graph_draw.c4
-rw-r--r--source/blender/editors/space_graph/graph_select.c2
-rw-r--r--source/blender/editors/space_image/image_buttons.c20
-rw-r--r--source/blender/editors/space_image/image_draw.c3
-rw-r--r--source/blender/editors/space_image/image_edit.c5
-rw-r--r--source/blender/editors/space_image/image_ops.c8
-rw-r--r--source/blender/editors/space_image/space_image.c4
-rw-r--r--source/blender/editors/space_logic/logic_buttons.c8
-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.c10
-rw-r--r--source/blender/editors/space_node/node_draw.c2
-rw-r--r--source/blender/editors/space_node/node_edit.c56
-rw-r--r--source/blender/editors/space_node/node_view.c4
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c4
-rw-r--r--source/blender/editors/space_sequencer/CMakeLists.txt1
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c14
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c16
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_modifier.c156
-rw-r--r--source/blender/editors/space_sequencer/sequencer_ops.c4
-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/view3d_draw.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c243
-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.c9
-rw-r--r--source/blender/editors/transform/transform.c16
-rw-r--r--source/blender/editors/transform/transform_conversions.c4
-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/gpu/intern/gpu_material.c1
-rw-r--r--source/blender/makesdna/DNA_color_types.h6
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h60
-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/rna_color.c10
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c41
-rw-r--r--source/blender/makesrna/intern/rna_object.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c412
-rw-r--r--source/blender/makesrna/intern/rna_space.c13
-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_warp.c4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c4
-rw-r--r--source/blender/nodes/CMakeLists.txt4
-rw-r--r--source/blender/nodes/SConscript3
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c19
-rw-r--r--source/blender/nodes/composite/node_composite_util.c4
-rw-r--r--source/blender/nodes/composite/node_composite_util.h7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c9
-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_brightness.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_channelMatte.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_chromaMatte.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorSpill.c8
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorbalance.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_common.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_composite.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_crop.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c30
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_defocus.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_dilate.c6
-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.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c6
-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.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_huecorrect.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_idMask.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_inpaint.c7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keying.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_keyingscreen.c9
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lensdist.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_levels.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_lummaMatte.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapUV.c6
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mapValue.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.c8
-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.c9
-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.c6
-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.c7
-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.c5
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_trackpos.c7
-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.c12
-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/shader/nodes/node_shader_curves.c3
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_curves.c1
-rw-r--r--source/blender/python/intern/bpy.c8
-rw-r--r--source/blender/render/intern/source/convertblender.c5
-rw-r--r--source/blender/render/intern/source/pipeline.c9
-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/shadeoutput.c1
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c7
-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.c2
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c47
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c4
-rw-r--r--source/blender/windowmanager/intern/wm_window.c8
-rw-r--r--source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp3
227 files changed, 3777 insertions, 1188 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fd473889909..338135f4987 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -132,6 +132,7 @@ 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)
@@ -1796,6 +1797,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/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/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/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/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/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_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 50c8603a7c2..cd10bce8ef6 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")
@@ -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,46 @@ 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")
+
+ row.prop(mod, "mute", text="")
+ props = row.operator("sequencer.strip_modifier_remove", text="", icon='X')
+ 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')
+
+
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/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..d47fa5383d4 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)
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 39945bf19b0..302edd8d533 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;
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_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_node.h b/source/blender/blenkernel/BKE_node.h
index 61845619452..c45afbe77a9 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -388,6 +388,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);
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_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 823b1dd14da..7bd1d178296 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);
@@ -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 17b4e9e2507..a04dd2d6b92 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -131,6 +131,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/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/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 20fae973756..85d28f68034 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) {
@@ -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/font.c b/source/blender/blenkernel/intern/font.c
index 49c3d77a527..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;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index d84c20f7a94..2b2128439c7 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2145,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/mask.c b/source/blender/blenkernel/intern/mask.c
index 3c46e7bcd47..1e1cbf8610e 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -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..d39be3b8ed6 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 */
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 7cee9626c3f..62e80645a35 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1425,13 +1425,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
+ * referene 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 +1478,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)
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/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/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
new file mode 100644
index 00000000000..26c2fe03688
--- /dev/null
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -0,0 +1,550 @@
+/*
+ * ***** 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 */
+};
+
+/*********************** 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);
+
+#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 9625fad69a6..3699f802c91 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,46 @@ 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);
+ }
+
+ 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 +2956,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 +2964,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;
@@ -3941,6 +4036,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 +4161,4 @@ int BKE_seqence_is_valid_check(Sequence *seq)
return TRUE;
}
+
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/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index d6579afcd0d..43639b141e1 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -75,6 +75,15 @@ 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
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/rct.c b/source/blender/blenlib/intern/rct.c
index 9c65c26c72b..92cbcd485b6 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -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;
@@ -382,11 +382,11 @@ void BLI_rctf_rcti_copy(rctf *dst, const rcti *src)
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/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index e7722e07442..719081e378d 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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);
}
@@ -4785,6 +4786,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;
@@ -4869,6 +4880,8 @@ static void lib_link_scene(FileData *fd, Main *main)
}
}
seq->anim = NULL;
+
+ lib_link_sequence_modifiers(fd, sce, &seq->modifiers);
}
SEQ_END
@@ -4925,6 +4938,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;
@@ -5037,6 +5073,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
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index d551caea425..ed5ffbf463e 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -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/writefile.c b/source/blender/blenloader/intern/writefile.c
index 2a68af688ed..4ada0c54a93 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);
@@ -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
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index a439eff36f6..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);
}
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/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_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_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_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index 2687fee28ce..c4b4452fbb0 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -79,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);
@@ -199,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;
@@ -273,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;
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_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_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/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 d98f4891dc5..1f317fa4f04 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;
}
}
}
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/interface/interface.c b/source/blender/editors/interface/interface.c
index 62b26f5a8c1..10917f23cdd 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;
@@ -145,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;
@@ -272,7 +272,7 @@ void ui_bounds_block(uiBlock *block)
block->rect.ymax += block->bounds;
}
- block->rect.xmax = block->rect.xmin + maxf(block->rect.xmax - block->rect.xmin, 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;
@@ -300,8 +300,8 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
ui_bounds_block(block);
- width = block->rect.xmax - block->rect.xmin;
- height = block->rect.ymax - block->rect.ymin;
+ 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);
@@ -325,8 +325,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
wm_window_get_size(window, &xmax, &ymax);
- oldwidth = block->rect.xmax - block->rect.xmin;
- oldheight = block->rect.ymax - block->rect.ymin;
+ 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) {
@@ -341,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->rect.xmax - block->rect.xmin;
- height = block->rect.ymax - block->rect.ymin;
+ 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);
@@ -488,10 +488,10 @@ static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines)
if (line->from == NULL || line->to == NULL) return;
- rect.xmin = (line->from->rect.xmin + line->from->rect.xmax) / 2.0f;
- rect.ymin = (line->from->rect.ymin + line->from->rect.ymax) / 2.0f;
- rect.xmax = (line->to->rect.xmin + line->to->rect.xmax) / 2.0f;
- rect.ymax = (line->to->rect.ymin + line->to->rect.ymax) / 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);
@@ -2204,7 +2204,7 @@ void ui_check_but(uiBut *but)
/* safety is 4 to enable small number buttons (like 'users') */
- // okwidth= -4 + (but->rect.xmax - but->rect.xmin); // UNUSED
+ // okwidth= -4 + (BLI_RCT_SIZE_X(&but->rect)); // UNUSED
/* name: */
switch (but->type) {
@@ -2212,7 +2212,7 @@ void ui_check_but(uiBut *but)
case MENU:
case ICONTEXTROW:
- if (but->rect.xmax - but->rect.xmin > 24) {
+ if (BLI_RCT_SIZE_X(&but->rect) > 24.0f) {
UI_GET_BUT_VALUE_INIT(but, value);
ui_set_name_menu(but, (int)value);
}
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 41a827bbda9..a8b50f5c76e 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 = absBLI_RCT_SIZE_X(rect);
+ height = absBLI_RCT_SIZE_Y(rect);
butw = floor(width / 12);
buth = floor(height / 6);
@@ -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);
@@ -1368,8 +1374,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin);
/* 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 +1487,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 +1505,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 +1522,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 +1553,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 +1629,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) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 4010274f687..957482bb379 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -690,10 +690,10 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
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;
}
@@ -714,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->rect.xmax - but->rect.xmin, but->rect.ymax - but->rect.ymin);
+ WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_RCT_SIZE_X(&but->rect), BLI_RCT_SIZE_Y(&but->rect));
return 1;
}
@@ -1295,7 +1295,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->rect.ymax - but->rect.ymin));
+ 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)
@@ -2610,7 +2610,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->rect.xmin + (but->rect.xmax - but->rect.xmin) / 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;
@@ -2621,7 +2621,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->rect.xmin + (2 * (but->rect.xmax - but->rect.xmin) / 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;
@@ -2636,7 +2636,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->rect.xmin + (but->rect.xmax - but->rect.xmin) / 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;
@@ -2645,7 +2645,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->rect.xmin + (2 * ((but->rect.xmax - but->rect.xmin) / 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;
@@ -2673,14 +2673,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->rect.xmax - but->rect.xmin) - 5.0f * but->aspect);
- else if (but->type == HSVSLI) deler = ((but->rect.xmax - but->rect.xmin) / 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->rect.xmax - but->rect.xmin > but->rect.ymax - but->rect.ymin);
- float size = (horizontal) ? (but->rect.xmax - but->rect.xmin) : -(but->rect.ymax - but->rect.ymin);
+ 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->rect.xmax - but->rect.xmin - 5.0f * but->aspect);
+ else deler = (BLI_RCT_SIZE_X(&but->rect) - 5.0f * but->aspect);
f = (float)(mx - data->dragstartx) / deler + data->dragfstart;
@@ -2763,7 +2763,7 @@ 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->rect.xmin + but->rect.xmax) / 2;
+ int halfpos = BLI_RCT_CENTER_X(&but->rect);
click = 2;
if (mx < halfpos)
mx = but->rect.xmin;
@@ -2830,12 +2830,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
#if 0
if (but->type == SLI) {
- f = (float)(mx - but->rect.xmin) / (but->rect.xmax - but->rect.xmin); /* same as below */
+ f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect)); /* same as below */
}
else
#endif
{
- f = (float)(mx - but->rect.xmin) / (but->rect.xmax - but->rect.xmin);
+ f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect));
}
f = softmin + f * softrange;
@@ -2876,7 +2876,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->rect.xmax - but->rect.xmin > but->rect.ymax - but->rect.ymin);
+ int horizontal = (BLI_RCT_SIZE_X(&but->rect) > BLI_RCT_SIZE_Y(&but->rect));
mx = event->x;
my = event->y;
@@ -2945,9 +2945,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);
@@ -2961,16 +2963,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.
+ *
+ * Theactive 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;
}
@@ -3033,7 +3034,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->rect.xmax - but->rect.xmin);
+ rad = BLI_RCT_SIZE_X(&but->rect);
radsq = rad * rad;
if (fp[2] > 0.0f) {
@@ -3141,8 +3142,8 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
/* relative position within box */
- x = ((float)mx_fl - but->rect.xmin) / (but->rect.xmax - but->rect.xmin);
- y = ((float)my_fl - but->rect.ymin) / (but->rect.ymax - but->rect.ymin);
+ 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);
@@ -3539,7 +3540,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->rect.xmax - but->rect.xmin);
+ dx = ((float)(mx - data->draglastx)) / BLI_RCT_SIZE_X(&but->rect);
data->dragcbd->pos += dx;
CLAMP(data->dragcbd->pos, 0.0f, 1.0f);
@@ -3568,7 +3569,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->rect.xmin)) / (but->rect.xmax - but->rect.xmin);
+ 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);
}
@@ -3580,7 +3581,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->rect.xmin + (cbd->pos * (but->rect.xmax - but->rect.xmin));
+ 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) {
@@ -3621,8 +3622,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->rect.xmax - but->rect.xmin) / (cumap->curr.xmax - cumap->curr.xmin);
- zoomy = (but->rect.ymax - but->rect.ymin) / (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; */
@@ -3647,7 +3648,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;
@@ -3660,7 +3661,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;
@@ -3717,8 +3718,8 @@ 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->rect.xmax - but->rect.xmin) / (cumap->curr.xmax - cumap->curr.xmin);
- zoomy = (but->rect.ymax - but->rect.ymin) / (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;
@@ -3727,7 +3728,7 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
fy = ((float)my - but->rect.ymin) / zoomy + offsy;
curvemap_insert(cuma, fx, fy);
- curvemapping_changed(cumap, 0);
+ curvemapping_changed(cumap, FALSE);
changed = 1;
}
@@ -3756,12 +3757,12 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
/* 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;
@@ -3783,11 +3784,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 */
@@ -3822,12 +3823,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);
@@ -3862,7 +3864,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize histogram widget itself */
- hist->height = (but->rect.ymax - but->rect.ymin) + (data->dragstarty - my);
+ hist->height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
else {
/* scale histogram values (dy / 10 for better control) */
@@ -3946,7 +3948,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->rect.ymax - but->rect.ymin) + (data->dragstarty - my);
+ scopes->wavefrm_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
else {
/* scale waveform values */
@@ -4028,7 +4030,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
/* resize vectorscope widget itself */
- scopes->vecscope_height = (but->rect.ymax - but->rect.ymin) + (data->dragstarty - my);
+ scopes->vecscope_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
data->draglastx = mx;
@@ -4098,8 +4100,8 @@ 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->rect.xmax - but->rect.xmin);
- height = abs(but->rect.ymax - but->rect.ymin);
+ width = abs(BLI_RCT_SIZE_X(&but->rect));
+ height = abs(BLI_RCT_SIZE_Y(&but->rect));
butw = floor(width / 12);
buth = floor(height / 6);
@@ -4231,7 +4233,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->rect.ymax - but->rect.ymin) + (data->dragstarty - my);
+ scopes->track_preview_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my);
}
else {
if (!scopes->track_locked) {
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 802000567da..d3b81974479 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>
@@ -71,6 +70,7 @@
#include "ED_image.h" /* for HDR color sampling */
#include "ED_node.h" /* for HDR color sampling */
+#include "ED_clip.h" /* for HDR color sampling */
/* ********************************************************** */
@@ -165,6 +165,18 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int
}
}
}
+ else if (sa->spacetype == SPACE_CLIP) {
+ ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (BLI_in_rcti(&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;
+ }
+ }
+ }
}
}
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 3bbf5b17312..512cda13df1 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -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);
}
}
@@ -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;
@@ -985,8 +985,8 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
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);
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index be118e1982e..35488430b22 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -1095,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);
}
}
@@ -1176,16 +1176,16 @@ 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->rect.ymax < (but->block->rect.ymin + but->block->rect.ymax) / 2) {
- data->bbox.ymin += (but->rect.ymax - but->rect.ymin);
+ 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->rect.ymax - but->rect.ymin);
+ data->bbox.ymax -= BLI_RCT_SIZE_Y(&but->rect);
}
}
else {
@@ -1356,15 +1356,15 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
}
}
- /* aspect = (float)(block->rect.xmax - block->rect.xmin + 4);*/ /*UNUSED*/
+ /* 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->rect.xmin -= 2.0; block->rect.ymin -= 2.0;
//block->rect.xmax += 2.0; block->rect.ymax += 2.0;
- xsize = block->rect.xmax - block->rect.xmin + 4; /* 4 for shadow */
- ysize = block->rect.ymax - block->rect.ymin + 4;
+ xsize = BLI_RCT_SIZE_X(&block->rect) + 4; /* 4 for shadow */
+ ysize = BLI_RCT_SIZE_Y(&block->rect) + 4;
/* aspect /= (float)xsize;*/ /*UNUSED*/
{
@@ -1495,8 +1495,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
/* 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 */
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 7c4f181b9de..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,7 +1517,7 @@ 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, "");
+ 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);
}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index aebdb349bd5..bf5b3fbe8c7 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);
@@ -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;
}
@@ -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);
@@ -2058,10 +2058,10 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa
}
/* rect */
- sx1 = rect->xmin + dx * (rect->xmax - rect->xmin);
- sx2 = rect->xmin + (dx + color_step) * (rect->xmax - rect->xmin);
+ 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)
@@ -2278,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;
@@ -2295,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);
@@ -2360,15 +2361,15 @@ 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) {
rect1.xmax = rect1.xmin + min;
@@ -2380,12 +2381,12 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
}
}
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) {
rect1.ymax = rect1.ymin + min;
@@ -2438,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];
@@ -2461,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);
@@ -2615,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)
@@ -2658,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);
@@ -2724,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;
}
@@ -2786,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);
@@ -3269,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 20e4360b791..ed6b2e00119 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1967,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..86322b0c0ea 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,7 +1457,7 @@ 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;
+ totsize = BLI_RCT_SIZE_X(&v2d->tot);
scrollsize = (float)(hor.xmax - hor.xmin);
if (totsize == 0.0f) totsize = 1.0f; /* avoid divide by zero */
@@ -1498,7 +1498,7 @@ 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;
+ totsize = BLI_RCT_SIZE_Y(&v2d->tot);
scrollsize = (float)(vert.ymax - vert.ymin);
if (totsize == 0.0f) totsize = 1.0f; /* avoid divide by zero */
@@ -1649,10 +1649,10 @@ 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 = (grid->startx - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur);
fac = (float)hor.xmin + fac * (hor.xmax - hor.xmin);
- dfac = (grid->dx) / (v2d->cur.xmax - v2d->cur.xmin);
+ dfac = grid->dx / BLI_RCT_SIZE_X(&v2d->cur);
dfac = dfac * (hor.xmax - hor.xmin);
/* set starting value, and text color */
@@ -1763,10 +1763,10 @@ 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 = (grid->starty - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur);
fac = vert.ymin + fac * (vert.ymax - vert.ymin);
- dfac = (grid->dy) / (v2d->cur.ymax - v2d->cur.ymin);
+ dfac = grid->dy / BLI_RCT_SIZE_Y(&v2d->cur);
dfac = dfac * (vert.ymax - vert.ymin);
/* set starting value, and text color */
@@ -1925,17 +1925,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 +1954,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 +1975,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 +2033,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
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 33b72b34784..258025eefc9 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;
}
@@ -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);
@@ -821,7 +821,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 +840,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 +918,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 +985,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 +1000,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?
@@ -1138,16 +1138,16 @@ 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;
+ 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;
+ 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);
@@ -1201,10 +1201,10 @@ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
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 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;
@@ -1478,7 +1478,7 @@ 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;
+ 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);
@@ -1494,7 +1494,7 @@ 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;
+ 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 +1774,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/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/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 77b20feb78d..63ab2ad6359 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -2126,22 +2126,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);
@@ -2166,6 +2182,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", 1, "Unselected", "Merge selected to other unselected vertices");
}
/************************ Vertex Path Operator *************************/
@@ -2189,23 +2206,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);
@@ -2999,12 +3042,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;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index bbc7a6ace7d..2b1492aa732 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -1462,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;
}
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index b7977c23010..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;
}
}
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 4f62974a3e1..84319061d52 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;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 6f5f5c7dfa3..10bc17ff59e 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();
@@ -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)) {
@@ -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);
@@ -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 {
@@ -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/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e92f7b7a3c2..97a63bb0df0 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -1612,7 +1612,7 @@ 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;
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_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_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..e94b28d22fa 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -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 36199b1908d..20b0ad509d3 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;
}
@@ -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 */
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_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/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..8c5ecb48613 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -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_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 b8ca0deb770..d0f4fe92257 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -274,7 +274,7 @@ static void preview_cb(ScrArea *sa, struct uiBlock *block)
/* while dragging we need to update the rects, otherwise it doesn't end with correct one */
- BLI_rctf_init(&dispf, 15.0f, (block->rect.xmax - block->rect.xmin) - 15.0f, 15.0f, (block->rect.ymax - block->rect.ymin) - 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 036e70913b6..bb31ba42716 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -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"
@@ -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 b969d898882..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 */
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index cc8940201e2..1f655884b73 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -556,8 +556,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 999a8baf34b..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->rect.xmin + line->from->rect.xmax) / 2;
- rectlink.ymin = (int) (line->from->rect.ymin + line->from->rect.ymax) / 2;
- rectlink.xmax = (int) (line->to->rect.xmin + line->to->rect.xmax) / 2;
- rectlink.ymax = (int) (line->to->rect.ymin + line->to->rect.ymax) / 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_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..2816b55651f 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);
}
@@ -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);
@@ -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);
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 1a4c302124f..f58448b39ac 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -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 e4fc19fbd08..4423b340d77 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2018,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;
@@ -2066,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_view.c b/source/blender/editors/space_node/node_view.c
index 27b57885b2b..6f549bd252f 100644
--- a/source/blender/editors/space_node/node_view.c
+++ b/source/blender/editors/space_node/node_view.c
@@ -72,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);
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 4fa8686bce3..b669e705a25 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);
diff --git a/source/blender/editors/space_sequencer/CMakeLists.txt b/source/blender/editors/space_sequencer/CMakeLists.txt
index 7bee8c2bebf..dd5fbb92171 100644
--- a/source/blender/editors/space_sequencer/CMakeLists.txt
+++ b/source/blender/editors/space_sequencer/CMakeLists.txt
@@ -40,6 +40,7 @@ set(SRC
sequencer_buttons.c
sequencer_draw.c
sequencer_edit.c
+ sequencer_modifier.c
sequencer_ops.c
sequencer_scopes.c
sequencer_select.c
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 7dd98c39e4c..25514b3168b 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 */
@@ -929,10 +929,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 +1114,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 5bb3f710133..2dc26a9d5b8 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -372,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);
@@ -2142,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);
@@ -2256,7 +2256,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
/* only zoom out vertically */
if (orig_height > cur_new.ymax - cur_new.ymin) {
- ymid = (cur_new.ymax + cur_new.ymin) / 2;
+ ymid = BLI_RCT_CENTER_Y(&cur_new);
cur_new.ymin = ymid - (orig_height / 2);
cur_new.ymax = ymid + (orig_height / 2);
@@ -2769,11 +2769,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..bad4fcf9135 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -177,5 +177,9 @@ 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);
+
#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..b19d92d67a0
--- /dev/null
+++ b/source/blender/editors/space_sequencer/sequencer_modifier.c
@@ -0,0 +1,156 @@
+/*
+ * ***** 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");
+}
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index 4a1c8f0c006..45ffc997172 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -114,6 +114,10 @@ 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);
}
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/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 199a1751f9d..93f8457e7a3 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -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)
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 310630a65ad..6e0c598d0ce 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 */
@@ -1022,9 +1022,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 +1037,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 +1054,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 +1087,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 +1234,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 +1666,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;
@@ -2643,8 +2784,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_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 8b51e6cf226..71e87e73747 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..49d7c9ba28c 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -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,9 +765,8 @@ 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])) {
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 5f43361b14b..a0b8788dcaa 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 */
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index c22a645eb53..120394aa7c1 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -5548,8 +5548,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 be80e51d53b..7f8c85628a4 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/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/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_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 16e8b8904fa..e7ab6f66408 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"
@@ -167,6 +168,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 +233,39 @@ 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;
+
#define MAXSEQ 32
#define SELECT 1
@@ -352,5 +389,26 @@ 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,
+
+ 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/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_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_object.c b/source/blender/makesrna/intern/rna_object.c
index e1f45e4de17..6dd75e94398 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -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_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 6fc304e6bbb..e14c1db8a76 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,8 +59,20 @@ 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", ""},
+ {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;
@@ -332,8 +345,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 +390,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 +628,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 +654,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 +665,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 +705,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 +715,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);
@@ -724,6 +745,22 @@ static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt)
data->seq = seq;
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;
+ return -1; /* done so bail out */
+ }
+ }
+ }
+ }
+
return 1;
}
@@ -752,12 +789,16 @@ static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
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);
- BKE_sequence_invalidate_cache(scene, seq);
+ if (seq->strip->color_balance == ptr->data)
+ 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 +866,159 @@ 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;
+ 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);
+ BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, path, oldname, smd->name + 2, 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 +1185,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 +1199,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,15 +1227,13 @@ 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", "");
@@ -1049,6 +1241,17 @@ static void rna_def_strip_color_balance(BlenderRNA *brna)
#endif
}
+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");
+
+ RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
+}
+
EnumPropertyItem blend_mode_items[] = {
{SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
{SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
@@ -1062,6 +1265,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 +1495,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 +1723,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 +2211,131 @@ 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_modifiers(BlenderRNA *brna)
+{
+ rna_def_modifier(brna);
+ rna_def_colorbalance_modifier(brna);
+ rna_def_curves_modifier(brna);
+ rna_def_hue_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 +2354,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_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_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..64987a52a21 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -251,4 +251,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/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..351b9309d7a 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;
}
/* *********************************************** */
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 1b9ff610e4c..b44454f38d9 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)
@@ -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..6fbff76e2dd 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,6 +138,8 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
}
}
+#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_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..0bd99f79d3c 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,12 +181,14 @@ 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);
}
+#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");
@@ -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..57baa01d1d9 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,6 +173,7 @@ 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))
{
@@ -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..9bce09b516e 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,6 +114,8 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
free_compbuf(cbuf);
}
+#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");
@@ -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..9456ef8e9d9 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,6 +317,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
free_compbuf(spillmap);
}
+#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");
@@ -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..a8c565eff44 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,6 +176,8 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo
}
}
+#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_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c
index 3a3f94f05cc..90bed8e1e04 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"
@@ -184,7 +183,9 @@ static void group_free_internal(bNodeTreeExec *gexec)
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;
}
}
@@ -231,6 +232,7 @@ void register_node_type_cmp_group(bNodeTreeType *ttype)
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..ed4bd857361 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,6 +103,8 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
}
}
+#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");
@@ -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..ddc93e94061 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,10 +52,13 @@ 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))
{
@@ -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,14 +96,19 @@ 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);
}
+#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,6 +204,8 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
}
+#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..e3d54213719 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,6 +866,8 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta
if (zbuf_use && (zbuf_use != zbuf)) free_compbuf(zbuf_use);
}
+#endif /* WITH_COMPOSITOR_LEGACY */
+
static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
{
/* qdn: defocus node */
@@ -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_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index 53061366b8b..ff4d98dfea4 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,6 +128,8 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
free_compbuf(imbuf2);
}
+#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");
@@ -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..d8dc44c7260 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,6 +148,8 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
}
}
+#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");
@@ -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..7b3dbdb6a58 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,6 +184,8 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
free_compbuf(inbuf);
}
+#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");
@@ -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_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..6989bf59d79 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,6 +475,8 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack
out[0]->data = new;
}
+#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");
@@ -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..7a1ec9e324a 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,6 +95,8 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
}
}
+#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");
@@ -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..7e3f6a5fb3a 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,6 +141,8 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode
}
+#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);
@@ -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..a3c65901121 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,6 +521,8 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
}
}
+#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");
@@ -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..3518f90c027 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,6 +117,8 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
}
}
+#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..b9721910fd1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_keying.c
+++ b/source/blender/nodes/composite/nodes/node_composite_keying.c
@@ -60,9 +60,12 @@ 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))
{
@@ -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..3fc4781fdc3 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,6 +179,8 @@ static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **
out[0]->data = screenbuf;
}
+#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..22281a74016 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,6 +184,7 @@ 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))
{
@@ -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..dfcfb4125f0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -45,6 +45,8 @@ static bNodeSocketTemplate cmp_node_view_levels_out[]={
{-1, 0, ""}
};
+#ifdef WITH_COMPOSITOR_LEGACY
+
static void fill_bins(bNode* node, CompBuf* in, int* bins)
{
float value[4];
@@ -309,6 +311,8 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
free_compbuf(histogram);
}
+#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..a4f6ffe746c 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,6 +98,8 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
free_compbuf(cbuf);
}
+#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");
@@ -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..49dc7323271 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,6 +78,7 @@ 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))
{
@@ -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..5c5bc2a9778 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,6 +85,7 @@ 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))
{
@@ -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..aa92e713adf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -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..87dc1e92438 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,6 +123,8 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
}
}
+#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..420718f8dd9 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,6 +141,8 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
}
}
+#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");
@@ -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..d0ead67431c 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,6 +147,8 @@ static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeSta
free_compbuf(img);
}
+#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");
@@ -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 a40400c85f5..4364ca61ba1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_trackpos.c
+++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.c
@@ -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..b3b6218a265 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,6 +80,8 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
}
}
+#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/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index be7f3c1c614..512182ebe12 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -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));
}
@@ -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/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index a56d69a6657..35e14c592a7 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);
}
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/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index f34bd352e62..6bd95e824eb 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]);
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 3d2b1608906..01b1f00ff98 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"
@@ -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/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/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 10a383df5c9..577a472b40d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -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 af24ea81fe6..8c2272e4707 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -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();
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 3c791cb6e5d..9fc3bf9cece 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 {
@@ -827,26 +818,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 +1069,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..0fa29bf3f14 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;
}
}
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index c2aa99352e9..fe3c2d0e901 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -464,8 +464,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 +500,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/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/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);