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.txt55
-rw-r--r--build_files/build_environment/cmake/llvm.cmake1
-rw-r--r--build_files/build_environment/cmake/setup_mingw32.cmake1
-rw-r--r--build_files/build_environment/cmake/setup_mingw64.cmake1
-rw-r--r--build_files/build_environment/cmake/zlib_mingw.cmake1
-rw-r--r--build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake1
-rw-r--r--build_files/cmake/Modules/FindLLVM.cmake1
-rw-r--r--build_files/cmake/macros.cmake45
-rw-r--r--doc/python_api/examples/blf.py1
-rw-r--r--doc/python_api/examples/bmesh.ops.1.py64
-rw-r--r--doc/python_api/examples/bpy.app.handlers.1.py1
-rw-r--r--doc/python_api/examples/bpy.app.handlers.py1
-rw-r--r--doc/python_api/examples/bpy.app.translations.py7
-rw-r--r--doc/python_api/examples/bpy.props.2.py1
-rw-r--r--doc/python_api/examples/bpy.props.3.py1
-rw-r--r--doc/python_api/examples/bpy.props.4.py1
-rw-r--r--doc/python_api/examples/bpy.props.5.py6
-rw-r--r--doc/python_api/examples/bpy.types.AddonPreferences.1.py20
-rw-r--r--doc/python_api/examples/bpy.types.Menu.2.py1
-rw-r--r--doc/python_api/examples/bpy.types.Menu.3.py6
-rw-r--r--doc/python_api/examples/bpy.types.Menu.4.py2
-rw-r--r--doc/python_api/examples/bpy.types.NodeTree.py1
-rw-r--r--doc/python_api/examples/bpy.types.Operator.1.py1
-rw-r--r--doc/python_api/examples/bpy.types.Operator.2.py1
-rw-r--r--doc/python_api/examples/bpy.types.Operator.4.py1
-rw-r--r--doc/python_api/examples/bpy.types.Operator.py1
-rw-r--r--doc/python_api/examples/bpy.types.PropertyGroup.py1
-rw-r--r--doc/python_api/examples/bpy.types.WindowManager.popup_menu.py1
-rw-r--r--doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py1
-rw-r--r--doc/python_api/examples/gpu.offscreen.1.py30
-rw-r--r--extern/rangetree/CMakeLists.txt1
-rw-r--r--intern/cycles/CMakeLists.txt1
-rw-r--r--intern/cycles/blender/CMakeLists.txt1
-rw-r--r--intern/cycles/blender/addon/ui.py42
-rw-r--r--intern/cycles/blender/addon/version_update.py2
-rw-r--r--intern/cycles/blender/blender_camera.cpp1
-rw-r--r--intern/cycles/blender/blender_object.cpp1
-rw-r--r--intern/cycles/blender/blender_session.cpp27
-rw-r--r--intern/cycles/blender/blender_sync.cpp2
-rw-r--r--intern/cycles/blender/blender_util.h6
-rw-r--r--intern/cycles/device/device_cuda.cpp2
-rw-r--r--intern/cycles/graph/CMakeLists.txt1
-rw-r--r--intern/cycles/kernel/CMakeLists.txt1
-rw-r--r--intern/cycles/kernel/closure/bsdf.h20
-rw-r--r--intern/cycles/kernel/osl/CMakeLists.txt1
-rw-r--r--intern/cycles/kernel/shaders/CMakeLists.txt1
-rw-r--r--intern/cycles/kernel/shaders/node_ambient_occlusion.osl8
-rw-r--r--intern/cycles/kernel/svm/svm.h2
-rw-r--r--intern/cycles/render/light.cpp2
-rw-r--r--intern/cycles/render/nodes.cpp6
-rw-r--r--intern/cycles/test/CMakeLists.txt3
-rw-r--r--intern/cycles/util/util_ssef.h2
-rw-r--r--intern/dualcon/CMakeLists.txt1
-rw-r--r--intern/eigen/intern/matrix.cc3
-rw-r--r--intern/ghost/GHOST_IContext.h1
-rw-r--r--intern/ghost/GHOST_IEvent.h1
-rw-r--r--intern/ghost/GHOST_ISystem.h1
-rw-r--r--intern/ghost/GHOST_ITimerTask.h1
-rw-r--r--intern/ghost/GHOST_IWindow.h1
-rw-r--r--intern/ghost/GHOST_Rect.h1
-rw-r--r--intern/ghost/GHOST_Types.h1
-rw-r--r--intern/ghost/intern/GHOST_Buttons.h1
-rw-r--r--intern/ghost/intern/GHOST_CallbackEventConsumer.h1
-rw-r--r--intern/ghost/intern/GHOST_Debug.h1
-rw-r--r--intern/ghost/intern/GHOST_DisplayManager.h1
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerCocoa.h1
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerWin32.h1
-rw-r--r--intern/ghost/intern/GHOST_DisplayManagerX11.h1
-rw-r--r--intern/ghost/intern/GHOST_DropTargetWin32.cpp1
-rw-r--r--intern/ghost/intern/GHOST_Event.h1
-rw-r--r--intern/ghost/intern/GHOST_EventButton.h1
-rw-r--r--intern/ghost/intern/GHOST_EventCursor.h1
-rw-r--r--intern/ghost/intern/GHOST_EventDragnDrop.h1
-rw-r--r--intern/ghost/intern/GHOST_EventKey.h1
-rw-r--r--intern/ghost/intern/GHOST_EventManager.h1
-rw-r--r--intern/ghost/intern/GHOST_EventPrinter.cpp1
-rw-r--r--intern/ghost/intern/GHOST_EventPrinter.h1
-rw-r--r--intern/ghost/intern/GHOST_EventString.h1
-rw-r--r--intern/ghost/intern/GHOST_EventTrackpad.h1
-rw-r--r--intern/ghost/intern/GHOST_EventWheel.h1
-rw-r--r--intern/ghost/intern/GHOST_ISystem.cpp1
-rw-r--r--intern/ghost/intern/GHOST_ISystemPaths.cpp3
-rw-r--r--intern/ghost/intern/GHOST_ModifierKeys.h1
-rw-r--r--intern/ghost/intern/GHOST_Rect.cpp1
-rw-r--r--intern/ghost/intern/GHOST_System.cpp1
-rw-r--r--intern/ghost/intern/GHOST_System.h1
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h1
-rw-r--r--intern/ghost/intern/GHOST_SystemPaths.h2
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsWin32.h1
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp12
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h1
-rw-r--r--intern/ghost/intern/GHOST_TimerManager.h1
-rw-r--r--intern/ghost/intern/GHOST_TimerTask.h1
-rw-r--r--intern/ghost/intern/GHOST_Window.cpp1
-rw-r--r--intern/ghost/intern/GHOST_Window.h1
-rw-r--r--intern/ghost/intern/GHOST_WindowManager.h1
-rw-r--r--intern/ghost/test/multitest/Basic.h1
-rw-r--r--intern/ghost/test/multitest/EventToBuf.h1
-rw-r--r--intern/ghost/test/multitest/GL.h1
-rw-r--r--intern/ghost/test/multitest/ScrollBar.h1
-rw-r--r--intern/ghost/test/multitest/Util.h1
-rw-r--r--intern/ghost/test/multitest/WindowData.h1
-rw-r--r--intern/mikktspace/CMakeLists.txt1
-rw-r--r--intern/smoke/CMakeLists.txt1
-rw-r--r--release/datafiles/blender_icons.svg309
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_drag.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_lmb.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_lmb_drag.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_mmb.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_mmb_drag.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_move.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_rmb.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_mouse_rmb_drag.datbin0 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_restrict_view_off.datbin1048 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons16/icon16_restrict_view_on.datbin1048 -> 1048 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_drag.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_lmb.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_lmb_drag.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_mmb.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_mmb_drag.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_move.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_rmb.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_mouse_rmb_drag.datbin0 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_restrict_view_off.datbin4120 -> 4120 bytes
-rw-r--r--release/datafiles/blender_icons32/icon32_restrict_view_on.datbin4120 -> 4120 bytes
-rw-r--r--release/datafiles/preview.blendbin795192 -> 721736 bytes
-rw-r--r--release/datafiles/preview_cycles.blendbin1363956 -> 1278812 bytes
-rw-r--r--release/datafiles/userdef/userdef_default_theme.c1076
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils_spell_check.py2
-rw-r--r--release/scripts/modules/bpy/utils/previews.py23
-rw-r--r--release/scripts/modules/bpy_types.py3
-rw-r--r--release/scripts/modules/keyingsets_utils.py1
-rw-r--r--release/scripts/presets/interface_theme/blender_27x.xml (renamed from release/scripts/presets/interface_theme/flatty_dark_blueberry.xml)993
-rw-r--r--release/scripts/presets/keyconfig/3dsmax.py2
-rw-r--r--release/scripts/presets/keyconfig/blender_27x.py3975
-rw-r--r--release/scripts/presets/keyconfig/maya.py2
-rw-r--r--release/scripts/startup/bl_operators/__init__.py2
-rw-r--r--release/scripts/startup/bl_operators/add_mesh_torus.py100
-rw-r--r--release/scripts/startup/bl_operators/anim.py141
-rw-r--r--release/scripts/startup/bl_operators/bmesh/find_adjacent.py1
-rw-r--r--release/scripts/startup/bl_operators/clip.py21
-rw-r--r--release/scripts/startup/bl_operators/console.py12
-rw-r--r--release/scripts/startup/bl_operators/file.py149
-rw-r--r--release/scripts/startup/bl_operators/freestyle.py16
-rw-r--r--release/scripts/startup/bl_operators/image.py4
-rw-r--r--release/scripts/startup/bl_operators/mesh.py22
-rw-r--r--release/scripts/startup/bl_operators/node.py66
-rw-r--r--release/scripts/startup/bl_operators/object.py185
-rw-r--r--release/scripts/startup/bl_operators/object_align.py67
-rw-r--r--release/scripts/startup/bl_operators/object_quick_effects.py171
-rw-r--r--release/scripts/startup/bl_operators/object_randomize_transform.py98
-rw-r--r--release/scripts/startup/bl_operators/presets.py97
-rw-r--r--release/scripts/startup/bl_operators/rigidbody.py78
-rw-r--r--release/scripts/startup/bl_operators/screen_play_rendered_anim.py49
-rw-r--r--release/scripts/startup/bl_operators/sequencer.py10
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_follow_active.py18
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_lightmap.py86
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_smart_project.py459
-rw-r--r--release/scripts/startup/bl_operators/vertexpaint_dirt.py52
-rw-r--r--release/scripts/startup/bl_operators/view3d.py94
-rw-r--r--release/scripts/startup/bl_operators/wm.py598
-rw-r--r--release/scripts/startup/bl_ui/properties_data_camera.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_data_lightprobe.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py20
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py2
-rw-r--r--release/scripts/startup/bl_ui/properties_material.py6
-rw-r--r--release/scripts/startup/bl_ui/properties_object.py12
-rw-r--r--release/scripts/startup/bl_ui/properties_particle.py85
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_common.py37
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_field.py6
-rw-r--r--release/scripts/startup/bl_ui/properties_render.py13
-rw-r--r--release/scripts/startup/bl_ui/properties_scene.py38
-rw-r--r--release/scripts/startup/bl_ui/properties_texture.py19
-rw-r--r--release/scripts/startup/bl_ui/properties_view_layer.py15
-rw-r--r--release/scripts/startup/bl_ui/properties_world.py7
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py12
-rw-r--r--release/scripts/startup/bl_ui/space_dopesheet.py235
-rw-r--r--release/scripts/startup/bl_ui/space_filebrowser.py37
-rw-r--r--release/scripts/startup/bl_ui/space_graph.py52
-rw-r--r--release/scripts/startup/bl_ui/space_image.py40
-rw-r--r--release/scripts/startup/bl_ui/space_nla.py35
-rw-r--r--release/scripts/startup/bl_ui/space_node.py77
-rw-r--r--release/scripts/startup/bl_ui/space_outliner.py110
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py35
-rw-r--r--release/scripts/startup/bl_ui/space_statusbar.py43
-rw-r--r--release/scripts/startup/bl_ui/space_text.py43
-rw-r--r--release/scripts/startup/bl_ui/space_time.py24
-rw-r--r--release/scripts/startup/bl_ui/space_toolsystem_toolbar.py39
-rw-r--r--release/scripts/startup/bl_ui/space_topbar.py105
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py81
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py318
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py1
-rw-r--r--release/scripts/templates_py/addon_add_object.py25
-rw-r--r--release/scripts/templates_py/background_job.py26
-rw-r--r--release/scripts/templates_py/batch_export.py2
-rw-r--r--release/scripts/templates_py/custom_nodes.py3
-rw-r--r--release/scripts/templates_py/manipulator_operator.py3
-rw-r--r--release/scripts/templates_py/manipulator_operator_target.py2
-rw-r--r--release/scripts/templates_py/manipulator_simple.py2
-rw-r--r--release/scripts/templates_py/operator_file_export.py30
-rw-r--r--release/scripts/templates_py/operator_file_import.py30
-rw-r--r--release/scripts/templates_py/operator_mesh_add.py104
-rw-r--r--release/scripts/templates_py/operator_modal_draw.py1
-rw-r--r--release/scripts/templates_py/operator_modal_view3d.py6
-rw-r--r--release/scripts/templates_py/ui_menu.py1
-rw-r--r--release/scripts/templates_py/ui_menu_simple.py1
-rw-r--r--release/scripts/templates_py/ui_previews_dynamic_enum.py18
-rw-r--r--source/CMakeLists.txt1
-rw-r--r--source/blender/alembic/intern/abc_customdata.cc44
-rw-r--r--source/blender/alembic/intern/abc_exporter.cc2
-rw-r--r--source/blender/alembic/intern/alembic_capi.cc1
-rw-r--r--source/blender/avi/intern/avi_intern.h1
-rw-r--r--source/blender/avi/intern/avi_options.c1
-rw-r--r--source/blender/blenfont/intern/blf_font.c15
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c53
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h9
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h15
-rw-r--r--source/blender/blenkernel/BKE_action.h1
-rw-r--r--source/blender/blenkernel/BKE_armature.h1
-rw-r--r--source/blender/blenkernel/BKE_blender_user_menu.h49
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/BKE_bmfont.h1
-rw-r--r--source/blender/blenkernel/BKE_bmfont_types.h1
-rw-r--r--source/blender/blenkernel/BKE_brush.h1
-rw-r--r--source/blender/blenkernel/BKE_camera.h3
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h1
-rw-r--r--source/blender/blenkernel/BKE_cloth.h7
-rw-r--r--source/blender/blenkernel/BKE_collection.h7
-rw-r--r--source/blender/blenkernel/BKE_collision.h36
-rw-r--r--source/blender/blenkernel/BKE_constraint.h1
-rw-r--r--source/blender/blenkernel/BKE_context.h1
-rw-r--r--source/blender/blenkernel/BKE_curve.h2
-rw-r--r--source/blender/blenkernel/BKE_customdata.h1
-rw-r--r--source/blender/blenkernel/BKE_customdata_file.h1
-rw-r--r--source/blender/blenkernel/BKE_data_transfer.h4
-rw-r--r--source/blender/blenkernel/BKE_deform.h2
-rw-r--r--source/blender/blenkernel/BKE_dynamicpaint.h2
-rw-r--r--source/blender/blenkernel/BKE_effect.h38
-rw-r--r--source/blender/blenkernel/BKE_fluidsim.h1
-rw-r--r--source/blender/blenkernel/BKE_font.h1
-rw-r--r--source/blender/blenkernel/BKE_freestyle.h1
-rw-r--r--source/blender/blenkernel/BKE_image.h1
-rw-r--r--source/blender/blenkernel/BKE_ipo.h1
-rw-r--r--source/blender/blenkernel/BKE_key.h2
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/BKE_library_override.h9
-rw-r--r--source/blender/blenkernel/BKE_mesh.h4
-rw-r--r--source/blender/blenkernel/BKE_mesh_iterators.h4
-rw-r--r--source/blender/blenkernel/BKE_mesh_remap.h28
-rw-r--r--source/blender/blenkernel/BKE_mesh_runtime.h16
-rw-r--r--source/blender/blenkernel/BKE_mesh_tangent.h1
-rw-r--r--source/blender/blenkernel/BKE_modifier.h5
-rw-r--r--source/blender/blenkernel/BKE_multires.h11
-rw-r--r--source/blender/blenkernel/BKE_nla.h1
-rw-r--r--source/blender/blenkernel/BKE_node.h8
-rw-r--r--source/blender/blenkernel/BKE_object.h4
-rw-r--r--source/blender/blenkernel/BKE_packedFile.h1
-rw-r--r--source/blender/blenkernel/BKE_particle.h2
-rw-r--r--source/blender/blenkernel/BKE_report.h1
-rw-r--r--source/blender/blenkernel/BKE_rigidbody.h4
-rw-r--r--source/blender/blenkernel/BKE_screen.h8
-rw-r--r--source/blender/blenkernel/BKE_shrinkwrap.h2
-rw-r--r--source/blender/blenkernel/BKE_softbody.h1
-rw-r--r--source/blender/blenkernel/BKE_studiolight.h27
-rw-r--r--source/blender/blenkernel/BKE_subsurf.h1
-rw-r--r--source/blender/blenkernel/BKE_texture.h1
-rw-r--r--source/blender/blenkernel/BKE_world.h1
-rw-r--r--source/blender/blenkernel/BKE_writeavi.h1
-rw-r--r--source/blender/blenkernel/BKE_writeffmpeg.h1
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c85
-rw-r--r--source/blender/blenkernel/intern/action.c1
-rw-r--r--source/blender/blenkernel/intern/armature.c1
-rw-r--r--source/blender/blenkernel/intern/blender.c12
-rw-r--r--source/blender/blenkernel/intern/blender_user_menu.c120
-rw-r--r--source/blender/blenkernel/intern/boids.c3
-rw-r--r--source/blender/blenkernel/intern/camera.c4
-rw-r--r--source/blender/blenkernel/intern/cloth.c12
-rw-r--r--source/blender/blenkernel/intern/collection.c33
-rw-r--r--source/blender/blenkernel/intern/collision.c195
-rw-r--r--source/blender/blenkernel/intern/constraint.c167
-rw-r--r--source/blender/blenkernel/intern/crazyspace.c2
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/customdata_file.c1
-rw-r--r--source/blender/blenkernel/intern/data_transfer.c387
-rw-r--r--source/blender/blenkernel/intern/deform.c40
-rw-r--r--source/blender/blenkernel/intern/displist.c5
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c60
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c13
-rw-r--r--source/blender/blenkernel/intern/editmesh_tangent.c6
-rw-r--r--source/blender/blenkernel/intern/effect.c283
-rw-r--r--source/blender/blenkernel/intern/fcurve.c1
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c1
-rw-r--r--source/blender/blenkernel/intern/icons.c1
-rw-r--r--source/blender/blenkernel/intern/idprop.c1
-rw-r--r--source/blender/blenkernel/intern/ipo.c1
-rw-r--r--source/blender/blenkernel/intern/key.c8
-rw-r--r--source/blender/blenkernel/intern/lamp.c2
-rw-r--r--source/blender/blenkernel/intern/lattice.c6
-rw-r--r--source/blender/blenkernel/intern/layer.c82
-rw-r--r--source/blender/blenkernel/intern/library.c8
-rw-r--r--source/blender/blenkernel/intern/library_override.c23
-rw-r--r--source/blender/blenkernel/intern/library_query.c4
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenkernel/intern/mesh.c3
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.c34
-rw-r--r--source/blender/blenkernel/intern/mesh_iterators.c37
-rw-r--r--source/blender/blenkernel/intern/mesh_remap.c197
-rw-r--r--source/blender/blenkernel/intern/mesh_runtime.c152
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.c5
-rw-r--r--source/blender/blenkernel/intern/modifier.c18
-rw-r--r--source/blender/blenkernel/intern/modifiers_bmesh.c249
-rw-r--r--source/blender/blenkernel/intern/multires.c89
-rw-r--r--source/blender/blenkernel/intern/node.c6
-rw-r--r--source/blender/blenkernel/intern/object.c65
-rw-r--r--source/blender/blenkernel/intern/object_deform.c1
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c51
-rw-r--r--source/blender/blenkernel/intern/object_update.c4
-rw-r--r--source/blender/blenkernel/intern/paint.c8
-rw-r--r--source/blender/blenkernel/intern/particle.c120
-rw-r--r--source/blender/blenkernel/intern/particle_system.c46
-rw-r--r--source/blender/blenkernel/intern/pointcache.c10
-rw-r--r--source/blender/blenkernel/intern/rigidbody.c305
-rw-r--r--source/blender/blenkernel/intern/scene.c7
-rw-r--r--source/blender/blenkernel/intern/screen.c16
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c10
-rw-r--r--source/blender/blenkernel/intern/smoke.c20
-rw-r--r--source/blender/blenkernel/intern/softbody.c112
-rw-r--r--source/blender/blenkernel/intern/studiolight.c346
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c9
-rw-r--r--source/blender/blenkernel/intern/workspace.c9
-rw-r--r--source/blender/blenlib/BLI_boxpack_2d.h1
-rw-r--r--source/blender/blenlib/BLI_dynlib.h1
-rw-r--r--source/blender/blenlib/BLI_fileops_types.h1
-rw-r--r--source/blender/blenlib/BLI_jitter_2d.h1
-rw-r--r--source/blender/blenlib/BLI_linklist_stack.h1
-rw-r--r--source/blender/blenlib/BLI_math_color_blend.h1
-rw-r--r--source/blender/blenlib/BLI_math_geom.h1
-rw-r--r--source/blender/blenlib/BLI_math_matrix.h1
-rw-r--r--source/blender/blenlib/BLI_math_rotation.h1
-rw-r--r--source/blender/blenlib/BLI_math_solvers.h1
-rw-r--r--source/blender/blenlib/BLI_math_statistics.h1
-rw-r--r--source/blender/blenlib/BLI_scanfill.h1
-rw-r--r--source/blender/blenlib/BLI_task.h1
-rw-r--r--source/blender/blenlib/BLI_threads.h1
-rw-r--r--source/blender/blenlib/BLI_utildefines.h4
-rw-r--r--source/blender/blenlib/BLI_vfontdata.h1
-rw-r--r--source/blender/blenlib/BLI_winstuff.h1
-rw-r--r--source/blender/blenlib/intern/BLI_heap.c1
-rw-r--r--source/blender/blenlib/intern/dynlib.c1
-rw-r--r--source/blender/blenlib/intern/fnmatch.c2
-rw-r--r--source/blender/blenlib/intern/hash_mm2a.c1
-rw-r--r--source/blender/blenlib/intern/math_solvers.c1
-rw-r--r--source/blender/blenlib/intern/threads.c1
-rw-r--r--source/blender/blenloader/BLO_readfile.h3
-rw-r--r--source/blender/blenloader/BLO_runtime.h1
-rw-r--r--source/blender/blenloader/BLO_undofile.h1
-rw-r--r--source/blender/blenloader/BLO_writefile.h1
-rw-r--r--source/blender/blenloader/CMakeLists.txt1
-rw-r--r--source/blender/blenloader/intern/readblenentry.c1
-rw-r--r--source/blender/blenloader/intern/readfile.c113
-rw-r--r--source/blender/blenloader/intern/readfile.h1
-rw-r--r--source/blender/blenloader/intern/runtime.c1
-rw-r--r--source/blender/blenloader/intern/versioning_280.c89
-rw-r--r--source/blender/blenloader/intern/versioning_defaults.c7
-rw-r--r--source/blender/blenloader/intern/writefile.c33
-rw-r--r--source/blender/bmesh/CMakeLists.txt6
-rw-r--r--source/blender/bmesh/bmesh.h6
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h18
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c1
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c (renamed from source/blender/bmesh/intern/bmesh_queries.c)2
-rw-r--r--source/blender/bmesh/intern/bmesh_query.h (renamed from source/blender/bmesh/intern/bmesh_queries.h)4
-rw-r--r--source/blender/bmesh/intern/bmesh_query_inline.h (renamed from source/blender/bmesh/intern/bmesh_queries_inline.h)2
-rw-r--r--source/blender/bmesh/operators/bmo_beautify.c1
-rw-r--r--source/blender/bmesh/operators/bmo_smooth_laplacian.c1
-rw-r--r--source/blender/bmesh/tools/bmesh_beautify.c1
-rw-r--r--source/blender/collada/AnimationExporter.h1
-rw-r--r--source/blender/collada/ArmatureImporter.cpp4
-rw-r--r--source/blender/collada/ControllerExporter.cpp13
-rw-r--r--source/blender/collada/DocumentExporter.cpp2
-rw-r--r--source/blender/collada/DocumentImporter.cpp13
-rw-r--r--source/blender/collada/ErrorHandler.h1
-rw-r--r--source/blender/collada/ExtraHandler.h1
-rw-r--r--source/blender/collada/GeometryExporter.cpp12
-rw-r--r--source/blender/collada/SceneExporter.cpp1
-rw-r--r--source/blender/collada/SceneExporter.h1
-rw-r--r--source/blender/collada/SkinInfo.cpp3
-rw-r--r--source/blender/collada/collada_internal.cpp1
-rw-r--r--source/blender/collada/collada_utils.cpp28
-rw-r--r--source/blender/collada/collada_utils.h3
-rw-r--r--source/blender/compositor/intern/COM_CPUDevice.cpp1
-rw-r--r--source/blender/compositor/intern/COM_Device.cpp1
-rw-r--r--source/blender/compositor/intern/COM_MemoryProxy.cpp1
-rw-r--r--source/blender/compositor/intern/COM_SocketReader.cpp2
-rw-r--r--source/blender/compositor/nodes/COM_CropNode.h2
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp1
-rw-r--r--source/blender/compositor/nodes/COM_TranslateNode.cpp1
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_BrightnessOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ChannelMatteOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ChromaMatteOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_CompositorOperation.h1
-rw-r--r--source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_DisplaceOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_EllipseMaskOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.h1
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_InpaintOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_InvertOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_MapUVOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_OutputFileOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_PixelateOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_QualityStepHelper.cpp1
-rw-r--r--source/blender/compositor/operations/COM_SunBeamsOperation.cpp1
-rw-r--r--source/blender/compositor/operations/COM_TranslateOperation.cpp1
-rw-r--r--source/blender/depsgraph/CMakeLists.txt2
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_build.h19
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_physics.h85
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder.cc6
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc64
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.h5
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc157
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h8
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc2
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc3
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h5
-rw-r--r--source/blender/depsgraph/intern/depsgraph_build.cc76
-rw-r--r--source/blender/depsgraph/intern/depsgraph_intern.h7
-rw-r--r--source/blender/depsgraph/intern/depsgraph_physics.cc242
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_type_defines.cc1
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h1
-rw-r--r--source/blender/draw/CMakeLists.txt4
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c9
-rw-r--r--source/blender/draw/engines/eevee/eevee_lookdev.c13
-rw-r--r--source/blender/draw/engines/eevee/eevee_materials.c2
-rw-r--r--source/blender/draw/engines/eevee/eevee_render.c2
-rw-r--r--source/blender/draw/engines/eevee/shaders/ltc_lib.glsl1
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl15
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl11
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl6
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl14
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_forward_depth_frag.glsl14
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl30
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl32
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl8
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl39
-rw-r--r--source/blender/draw/engines/workbench/solid_mode.c9
-rw-r--r--source/blender/draw/engines/workbench/transparent_mode.c1
-rw-r--r--source/blender/draw/engines/workbench/workbench_data.c22
-rw-r--r--source/blender/draw/engines/workbench/workbench_deferred.c182
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_aa.c87
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_fxaa.c62
-rw-r--r--source/blender/draw/engines/workbench/workbench_effect_taa.c292
-rw-r--r--source/blender/draw/engines/workbench/workbench_forward.c184
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c94
-rw-r--r--source/blender/draw/engines/workbench/workbench_private.h81
-rw-r--r--source/blender/draw/intern/DRW_render.h2
-rw-r--r--source/blender/draw/intern/draw_anim_viz.c1
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c8
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c8
-rw-r--r--source/blender/draw/intern/draw_common.c4
-rw-r--r--source/blender/draw/intern/draw_hair.c4
-rw-r--r--source/blender/draw/intern/draw_manager.c77
-rw-r--r--source/blender/draw/modes/object_mode.c32
-rw-r--r--source/blender/draw/modes/overlay_mode.c1
-rw-r--r--source/blender/draw/modes/paint_texture_mode.c7
-rw-r--r--source/blender/draw/modes/paint_vertex_mode.c7
-rw-r--r--source/blender/draw/modes/paint_weight_mode.c9
-rw-r--r--source/blender/draw/modes/shaders/common_fxaa_lib.glsl1
-rw-r--r--source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl2
-rw-r--r--source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl34
-rw-r--r--source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl48
-rw-r--r--source/blender/draw/modes/shaders/paint_texture_frag.glsl4
-rw-r--r--source/blender/draw/modes/shaders/paint_vertex_frag.glsl4
-rw-r--r--source/blender/draw/modes/shaders/paint_wire_frag.glsl4
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c9
-rw-r--r--source/blender/editors/animation/anim_channels_edit.c23
-rw-r--r--source/blender/editors/animation/anim_draw.c15
-rw-r--r--source/blender/editors/animation/anim_filter.c26
-rw-r--r--source/blender/editors/animation/anim_markers.c27
-rw-r--r--source/blender/editors/animation/anim_ops.c4
-rw-r--r--source/blender/editors/animation/drivers.c2
-rw-r--r--source/blender/editors/animation/keyframes_draw.c6
-rw-r--r--source/blender/editors/animation/keyframes_edit.c1
-rw-r--r--source/blender/editors/animation/keyframing.c2
-rw-r--r--source/blender/editors/animation/keyingsets.c6
-rw-r--r--source/blender/editors/armature/armature_intern.h1
-rw-r--r--source/blender/editors/armature/armature_naming.c1
-rw-r--r--source/blender/editors/armature/armature_ops.c11
-rw-r--r--source/blender/editors/armature/armature_relations.c1
-rw-r--r--source/blender/editors/armature/armature_select.c2
-rw-r--r--source/blender/editors/armature/armature_skinning.c17
-rw-r--r--source/blender/editors/armature/meshlaplacian.c5
-rw-r--r--source/blender/editors/armature/meshlaplacian.h1
-rw-r--r--source/blender/editors/armature/pose_edit.c20
-rw-r--r--source/blender/editors/armature/pose_lib.c27
-rw-r--r--source/blender/editors/armature/pose_select.c3
-rw-r--r--source/blender/editors/armature/pose_slide.c6
-rw-r--r--source/blender/editors/curve/curve_ops.c4
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/curve/editcurve_paint.c17
-rw-r--r--source/blender/editors/datafiles/CMakeLists.txt4
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c41
-rw-r--r--source/blender/editors/gpencil/gpencil_brush.c15
-rw-r--r--source/blender/editors/gpencil/gpencil_convert.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_data.c6
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c16
-rw-r--r--source/blender/editors/gpencil/gpencil_intern.h12
-rw-r--r--source/blender/editors/gpencil/gpencil_interpolate.c28
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c4
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c35
-rw-r--r--source/blender/editors/gpencil/gpencil_select.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c10
-rw-r--r--source/blender/editors/include/BIF_gl.h1
-rw-r--r--source/blender/editors/include/ED_anim_api.h6
-rw-r--r--source/blender/editors/include/ED_clip.h10
-rw-r--r--source/blender/editors/include/ED_datafiles.h1
-rw-r--r--source/blender/editors/include/ED_fileselect.h1
-rw-r--r--source/blender/editors/include/ED_image.h5
-rw-r--r--source/blender/editors/include/ED_keyframing.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h24
-rw-r--r--source/blender/editors/include/ED_node.h1
-rw-r--r--source/blender/editors/include/ED_outliner.h2
-rw-r--r--source/blender/editors/include/ED_particle.h1
-rw-r--r--source/blender/editors/include/ED_physics.h7
-rw-r--r--source/blender/editors/include/ED_screen.h150
-rw-r--r--source/blender/editors/include/ED_sequencer.h4
-rw-r--r--source/blender/editors/include/ED_sound.h1
-rw-r--r--source/blender/editors/include/ED_transverts.h2
-rw-r--r--source/blender/editors/include/ED_undo.h1
-rw-r--r--source/blender/editors/include/ED_util.h1
-rw-r--r--source/blender/editors/include/ED_uvedit.h1
-rw-r--r--source/blender/editors/include/ED_view3d.h29
-rw-r--r--source/blender/editors/include/UI_icons.h29
-rw-r--r--source/blender/editors/include/UI_interface.h51
-rw-r--r--source/blender/editors/interface/CMakeLists.txt4
-rw-r--r--source/blender/editors/interface/interface.c45
-rw-r--r--source/blender/editors/interface/interface_context_menu.c817
-rw-r--r--source/blender/editors/interface/interface_draw.c285
-rw-r--r--source/blender/editors/interface/interface_eyedropper.c1
-rw-r--r--source/blender/editors/interface/interface_eyedropper_color.c2
-rw-r--r--source/blender/editors/interface/interface_eyedropper_colorband.c2
-rw-r--r--source/blender/editors/interface/interface_eyedropper_datablock.c2
-rw-r--r--source/blender/editors/interface/interface_eyedropper_depth.c2
-rw-r--r--source/blender/editors/interface/interface_eyedropper_driver.c2
-rw-r--r--source/blender/editors/interface/interface_handlers.c765
-rw-r--r--source/blender/editors/interface/interface_icons.c122
-rw-r--r--source/blender/editors/interface/interface_intern.h27
-rw-r--r--source/blender/editors/interface/interface_layout.c139
-rw-r--r--source/blender/editors/interface/interface_ops.c59
-rw-r--r--source/blender/editors/interface/interface_panel.c89
-rw-r--r--source/blender/editors/interface/interface_query.c127
-rw-r--r--source/blender/editors/interface/interface_region_hud.c7
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c15
-rw-r--r--source/blender/editors/interface/interface_region_search.c40
-rw-r--r--source/blender/editors/interface/interface_style.c1
-rw-r--r--source/blender/editors/interface/interface_templates.c347
-rw-r--r--source/blender/editors/interface/interface_utils.c5
-rw-r--r--source/blender/editors/interface/interface_widgets.c534
-rw-r--r--source/blender/editors/interface/resources.c1486
-rw-r--r--source/blender/editors/interface/view2d.c27
-rw-r--r--source/blender/editors/interface/view2d_ops.c101
-rw-r--r--source/blender/editors/lattice/editlattice_tools.c2
-rw-r--r--source/blender/editors/manipulator_library/manipulator_draw_utils.c5
-rw-r--r--source/blender/editors/manipulator_library/manipulator_library_intern.h1
-rw-r--r--source/blender/editors/manipulator_library/manipulator_library_presets.c1
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c11
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c13
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c23
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c27
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c27
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c13
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c15
-rw-r--r--source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c9
-rw-r--r--source/blender/editors/mask/mask_draw.c33
-rw-r--r--source/blender/editors/mask/mask_edit.c9
-rw-r--r--source/blender/editors/mask/mask_editaction.c1
-rw-r--r--source/blender/editors/mask/mask_intern.h4
-rw-r--r--source/blender/editors/mask/mask_ops.c4
-rw-r--r--source/blender/editors/mesh/editface.c37
-rw-r--r--source/blender/editors/mesh/editmesh_bevel.c6
-rw-r--r--source/blender/editors/mesh/editmesh_bisect.c9
-rw-r--r--source/blender/editors/mesh/editmesh_extrude.c6
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c4
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c43
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c20
-rw-r--r--source/blender/editors/mesh/editmesh_select.c2
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c19
-rw-r--r--source/blender/editors/mesh/editmesh_undo.c2
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c4
-rw-r--r--source/blender/editors/mesh/mesh_data.c14
-rw-r--r--source/blender/editors/mesh/mesh_intern.h2
-rw-r--r--source/blender/editors/mesh/mesh_mirror.c149
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c732
-rw-r--r--source/blender/editors/mesh/mesh_ops.c25
-rw-r--r--source/blender/editors/mesh/meshtools.c182
-rw-r--r--source/blender/editors/metaball/mball_intern.h1
-rw-r--r--source/blender/editors/metaball/mball_ops.c2
-rw-r--r--source/blender/editors/object/object_add.c38
-rw-r--r--source/blender/editors/object/object_bake.c8
-rw-r--r--source/blender/editors/object/object_constraint.c7
-rw-r--r--source/blender/editors/object/object_data_transfer.c4
-rw-r--r--source/blender/editors/object/object_edit.c62
-rw-r--r--source/blender/editors/object/object_facemap_ops.c4
-rw-r--r--source/blender/editors/object/object_group.c7
-rw-r--r--source/blender/editors/object/object_hook.c3
-rw-r--r--source/blender/editors/object/object_intern.h5
-rw-r--r--source/blender/editors/object/object_modifier.c45
-rw-r--r--source/blender/editors/object/object_ops.c24
-rw-r--r--source/blender/editors/object/object_relations.c9
-rw-r--r--source/blender/editors/object/object_select.c20
-rw-r--r--source/blender/editors/object/object_shapekey.c9
-rw-r--r--source/blender/editors/object/object_vgroup.c75
-rw-r--r--source/blender/editors/physics/particle_boids.c1
-rw-r--r--source/blender/editors/physics/particle_edit.c39
-rw-r--r--source/blender/editors/physics/particle_object.c49
-rw-r--r--source/blender/editors/physics/physics_fluid.c1
-rw-r--r--source/blender/editors/physics/physics_intern.h1
-rw-r--r--source/blender/editors/physics/physics_ops.c4
-rw-r--r--source/blender/editors/physics/physics_pointcache.c5
-rw-r--r--source/blender/editors/physics/rigidbody_constraint.c9
-rw-r--r--source/blender/editors/physics/rigidbody_object.c5
-rw-r--r--source/blender/editors/physics/rigidbody_world.c11
-rw-r--r--source/blender/editors/render/render_intern.h1
-rw-r--r--source/blender/editors/render/render_internal.c2
-rw-r--r--source/blender/editors/render/render_opengl.c4
-rw-r--r--source/blender/editors/render/render_ops.c1
-rw-r--r--source/blender/editors/render/render_preview.c51
-rw-r--r--source/blender/editors/render/render_shading.c9
-rw-r--r--source/blender/editors/render/render_update.c2
-rw-r--r--source/blender/editors/render/render_view.c1
-rw-r--r--source/blender/editors/screen/CMakeLists.txt2
-rw-r--r--source/blender/editors/screen/area.c145
-rw-r--r--source/blender/editors/screen/glutil.c5
-rw-r--r--source/blender/editors/screen/screen_context.c7
-rw-r--r--source/blender/editors/screen/screen_draw.c31
-rw-r--r--source/blender/editors/screen/screen_edit.c462
-rw-r--r--source/blender/editors/screen/screen_geometry.c462
-rw-r--r--source/blender/editors/screen/screen_intern.h25
-rw-r--r--source/blender/editors/screen/screen_ops.c333
-rw-r--r--source/blender/editors/screen/screen_user_menu.c269
-rw-r--r--source/blender/editors/screen/screendump.c266
-rw-r--r--source/blender/editors/screen/workspace_edit.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c93
-rw-r--r--source/blender/editors/sculpt_paint/paint_curve.c9
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c136
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c122
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_2d.c177
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c96
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_undo.c30
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h72
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c13
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c72
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c127
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c43
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c32
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_proj.c39
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c17
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c21
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h8
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c2
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c22
-rw-r--r--source/blender/editors/sound/sound_intern.h1
-rw-r--r--source/blender/editors/sound/sound_ops.c2
-rw-r--r--source/blender/editors/space_action/action_data.c12
-rw-r--r--source/blender/editors/space_action/action_draw.c9
-rw-r--r--source/blender/editors/space_action/action_edit.c4
-rw-r--r--source/blender/editors/space_action/action_intern.h1
-rw-r--r--source/blender/editors/space_action/action_select.c2
-rw-r--r--source/blender/editors/space_action/space_action.c42
-rw-r--r--source/blender/editors/space_api/spacetypes.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h3
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c14
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c5
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c4
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c9
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_draw.c57
-rw-r--r--source/blender/editors/space_clip/clip_editor.c10
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c15
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_ops.c4
-rw-r--r--source/blender/editors/space_clip/clip_toolbar.c4
-rw-r--r--source/blender/editors/space_clip/clip_utils.c9
-rw-r--r--source/blender/editors/space_clip/space_clip.c19
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c10
-rw-r--r--source/blender/editors/space_clip/tracking_ops_orient.c6
-rw-r--r--source/blender/editors/space_clip/tracking_ops_stabilize.c3
-rw-r--r--source/blender/editors/space_clip/tracking_select.c2
-rw-r--r--source/blender/editors/space_console/space_console.c7
-rw-r--r--source/blender/editors/space_file/file_draw.c7
-rw-r--r--source/blender/editors/space_file/file_intern.h1
-rw-r--r--source/blender/editors/space_file/file_ops.c14
-rw-r--r--source/blender/editors/space_file/file_panels.c3
-rw-r--r--source/blender/editors/space_file/filelist.h1
-rw-r--r--source/blender/editors/space_file/fsmenu.h1
-rw-r--r--source/blender/editors/space_file/space_file.c13
-rw-r--r--source/blender/editors/space_graph/graph_buttons.c6
-rw-r--r--source/blender/editors/space_graph/graph_draw.c73
-rw-r--r--source/blender/editors/space_graph/graph_edit.c4
-rw-r--r--source/blender/editors/space_graph/graph_intern.h8
-rw-r--r--source/blender/editors/space_graph/graph_ops.c2
-rw-r--r--source/blender/editors/space_graph/graph_select.c2
-rw-r--r--source/blender/editors/space_graph/graph_utils.c53
-rw-r--r--source/blender/editors/space_graph/space_graph.c46
-rw-r--r--source/blender/editors/space_image/image_buttons.c7
-rw-r--r--source/blender/editors/space_image/image_draw.c37
-rw-r--r--source/blender/editors/space_image/image_edit.c5
-rw-r--r--source/blender/editors/space_image/image_intern.h3
-rw-r--r--source/blender/editors/space_image/image_ops.c31
-rw-r--r--source/blender/editors/space_image/space_image.c9
-rw-r--r--source/blender/editors/space_info/info_draw.c3
-rw-r--r--source/blender/editors/space_info/info_stats.c30
-rw-r--r--source/blender/editors/space_info/space_info.c7
-rw-r--r--source/blender/editors/space_info/textview.c7
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c12
-rw-r--r--source/blender/editors/space_nla/nla_channels.c4
-rw-r--r--source/blender/editors/space_nla/nla_draw.c51
-rw-r--r--source/blender/editors/space_nla/nla_intern.h5
-rw-r--r--source/blender/editors/space_nla/nla_ops.c4
-rw-r--r--source/blender/editors/space_nla/nla_select.c2
-rw-r--r--source/blender/editors/space_nla/space_nla.c5
-rw-r--r--source/blender/editors/space_node/drawnode.c19
-rw-r--r--source/blender/editors/space_node/node_add.c3
-rw-r--r--source/blender/editors/space_node/node_buttons.c8
-rw-r--r--source/blender/editors/space_node/node_draw.c46
-rw-r--r--source/blender/editors/space_node/node_edit.c10
-rw-r--r--source/blender/editors/space_node/node_group.c4
-rw-r--r--source/blender/editors/space_node/node_intern.h4
-rw-r--r--source/blender/editors/space_node/node_ops.c2
-rw-r--r--source/blender/editors/space_node/node_relationships.c4
-rw-r--r--source/blender/editors/space_node/node_select.c2
-rw-r--r--source/blender/editors/space_node/node_templates.c1
-rw-r--r--source/blender/editors/space_node/node_toolbar.c2
-rw-r--r--source/blender/editors/space_node/space_node.c6
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c30
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c271
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c13
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h2
-rw-r--r--source/blender/editors/space_outliner/outliner_ops.c14
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c87
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c18
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c14
-rw-r--r--source/blender/editors/space_script/script_intern.h1
-rw-r--r--source/blender/editors/space_script/space_script.c4
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_draw.c80
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c28
-rw-r--r--source/blender/editors/space_sequencer/sequencer_intern.h11
-rw-r--r--source/blender/editors/space_sequencer/sequencer_modifier.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c3
-rw-r--r--source/blender/editors/space_sequencer/sequencer_view.c2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c8
-rw-r--r--source/blender/editors/space_statusbar/space_statusbar.c21
-rw-r--r--source/blender/editors/space_text/space_text.c12
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c13
-rw-r--r--source/blender/editors/space_text/text_draw.c11
-rw-r--r--source/blender/editors/space_text/text_header.c3
-rw-r--r--source/blender/editors/space_text/text_intern.h3
-rw-r--r--source/blender/editors/space_text/text_ops.c18
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c1
-rw-r--r--source/blender/editors/space_userpref/userpref_intern.h1
-rw-r--r--source/blender/editors/space_userpref/userpref_ops.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c27
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c21
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c26
-rw-r--r--source/blender/editors/space_view3d/view3d_buttons.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c56
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c133
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_header.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_manipulator_forcefield.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c29
-rw-r--r--source/blender/editors/space_view3d/view3d_manipulator_ruler.c25
-rw-r--r--source/blender/editors/space_view3d/view3d_ops.c11
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c33
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_toolbar.c130
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c4
-rw-r--r--source/blender/editors/transform/transform.c141
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c19
-rw-r--r--source/blender/editors/transform/transform_conversions.c1
-rw-r--r--source/blender/editors/transform/transform_generics.c1
-rw-r--r--source/blender/editors/transform/transform_manipulator_2d.c6
-rw-r--r--source/blender/editors/transform/transform_manipulator_3d.c136
-rw-r--r--source/blender/editors/transform/transform_ops.c9
-rw-r--r--source/blender/editors/transform/transform_snap.c10
-rw-r--r--source/blender/editors/undo/ed_undo.c2
-rw-r--r--source/blender/editors/util/ed_transverts.c2
-rw-r--r--source/blender/editors/util/ed_util.c5
-rw-r--r--source/blender/editors/uvedit/uvedit_buttons.c3
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c52
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c8
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c1
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.h1
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c11
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c15
-rw-r--r--source/blender/freestyle/intern/system/PythonInterpreter.h2
-rw-r--r--source/blender/gpu/CMakeLists.txt3
-rw-r--r--source/blender/gpu/GPU_basic_shader.h1
-rw-r--r--source/blender/gpu/GPU_draw.h18
-rw-r--r--source/blender/gpu/GPU_framebuffer.h3
-rw-r--r--source/blender/gpu/GPU_material.h3
-rw-r--r--source/blender/gpu/GPU_state.h63
-rw-r--r--source/blender/gpu/GPU_texture.h8
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c15
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c10
-rw-r--r--source/blender/gpu/intern/gpu_codegen.h1
-rw-r--r--source/blender/gpu/intern/gpu_draw.c45
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c1
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.c10
-rw-r--r--source/blender/gpu/intern/gpu_material.c6
-rw-r--r--source/blender/gpu/intern/gpu_shader_private.h1
-rw-r--r--source/blender/gpu/intern/gpu_state.c153
-rw-r--r--source/blender/gpu/intern/gpu_texture.c73
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl10
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl4
-rw-r--r--source/blender/gpu/shaders/gpu_shader_basic_frag.glsl1
-rw-r--r--source/blender/gpu/shaders/gpu_shader_basic_vert.glsl1
-rw-r--r--source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl1
-rw-r--r--source/blender/gpu/shaders/gpu_shader_vertex_world.glsl1
-rw-r--r--source/blender/ikplugin/intern/ikplugin_api.c1
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c1
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp1
-rw-r--r--source/blender/imbuf/CMakeLists.txt2
-rw-r--r--source/blender/imbuf/IMB_thumbs.h1
-rw-r--r--source/blender/imbuf/intern/IMB_allocimbuf.h1
-rw-r--r--source/blender/imbuf/intern/IMB_filetype.h1
-rw-r--r--source/blender/imbuf/intern/IMB_filter.h1
-rw-r--r--source/blender/imbuf/intern/cache.c1
-rw-r--r--source/blender/imbuf/intern/dds/BlockDXT.cpp1
-rw-r--r--source/blender/imbuf/intern/dds/ColorBlock.cpp1
-rw-r--r--source/blender/imbuf/intern/dds/DirectDrawSurface.cpp1
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.cpp1
-rw-r--r--source/blender/imbuf/intern/dds/FlipDXT.h1
-rw-r--r--source/blender/imbuf/intern/dds/Image.cpp2
-rw-r--r--source/blender/imbuf/intern/dds/Stream.cpp1
-rw-r--r--source/blender/imbuf/intern/filetype.c1
-rw-r--r--source/blender/imbuf/intern/imbuf.h1
-rw-r--r--source/blender/imbuf/intern/iris.c1
-rw-r--r--source/blender/imbuf/intern/module.c1
-rw-r--r--source/blender/imbuf/intern/oiio/openimageio_api.cpp2
-rw-r--r--source/blender/imbuf/intern/png.c1
-rw-r--r--source/blender/makesdna/DNA_ID.h1
-rw-r--r--source/blender/makesdna/DNA_action_types.h18
-rw-r--r--source/blender/makesdna/DNA_curve_types.h1
-rw-r--r--source/blender/makesdna/DNA_effect_types.h1
-rw-r--r--source/blender/makesdna/DNA_fileglobal_types.h1
-rw-r--r--source/blender/makesdna/DNA_ipo_types.h3
-rw-r--r--source/blender/makesdna/DNA_lamp_types.h1
-rw-r--r--source/blender/makesdna/DNA_lattice_types.h1
-rw-r--r--source/blender/makesdna/DNA_layer_types.h17
-rw-r--r--source/blender/makesdna/DNA_listBase.h1
-rw-r--r--source/blender/makesdna/DNA_material_types.h1
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h5
-rw-r--r--source/blender/makesdna/DNA_nla_types.h1
-rw-r--r--source/blender/makesdna/DNA_object_fluidsim_types.h1
-rw-r--r--source/blender/makesdna/DNA_object_force_types.h1
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/makesdna/DNA_outliner_types.h1
-rw-r--r--source/blender/makesdna/DNA_packedFile_types.h2
-rw-r--r--source/blender/makesdna/DNA_rigidbody_types.h38
-rw-r--r--source/blender/makesdna/DNA_scene_types.h22
-rw-r--r--source/blender/makesdna/DNA_screen_types.h1
-rw-r--r--source/blender/makesdna/DNA_sdna_types.h1
-rw-r--r--source/blender/makesdna/DNA_space_types.h2
-rw-r--r--source/blender/makesdna/DNA_speaker_types.h1
-rw-r--r--source/blender/makesdna/DNA_texture_types.h1
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h66
-rw-r--r--source/blender/makesdna/DNA_vec_types.h1
-rw-r--r--source/blender/makesdna/DNA_view2d_types.h1
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h13
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h5
-rw-r--r--source/blender/makesdna/DNA_workspace_types.h3
-rw-r--r--source/blender/makesdna/DNA_world_types.h1
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c41
-rw-r--r--source/blender/makesrna/RNA_access.h51
-rw-r--r--source/blender/makesrna/RNA_define.h15
-rw-r--r--source/blender/makesrna/RNA_enum_types.h8
-rw-r--r--source/blender/makesrna/RNA_types.h9
-rw-r--r--source/blender/makesrna/intern/makesrna.c42
-rw-r--r--source/blender/makesrna/intern/rna_ID.c17
-rw-r--r--source/blender/makesrna/intern/rna_access.c338
-rw-r--r--source/blender/makesrna/intern/rna_action.c27
-rw-r--r--source/blender/makesrna/intern/rna_animation.c6
-rw-r--r--source/blender/makesrna/intern/rna_armature.c14
-rw-r--r--source/blender/makesrna/intern/rna_camera_api.c1
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4
-rw-r--r--source/blender/makesrna/intern/rna_context.c1
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
-rw-r--r--source/blender/makesrna/intern/rna_curve_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_define.c66
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c2
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c2
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c2
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c4
-rw-r--r--source/blender/makesrna/intern/rna_group.c106
-rw-r--r--source/blender/makesrna/intern/rna_image.c3
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c3
-rw-r--r--source/blender/makesrna/intern/rna_internal.h26
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h28
-rw-r--r--source/blender/makesrna/intern/rna_lattice_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_layer.c3
-rw-r--r--source/blender/makesrna/intern/rna_lightprobe.c1
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c24
-rw-r--r--source/blender/makesrna/intern/rna_material.c1
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c1
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c8
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c36
-rw-r--r--source/blender/makesrna/intern/rna_object.c38
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c62
-rw-r--r--source/blender/makesrna/intern/rna_packedfile.c1
-rw-r--r--source/blender/makesrna/intern/rna_particle.c16
-rw-r--r--source/blender/makesrna/intern/rna_pose.c6
-rw-r--r--source/blender/makesrna/intern/rna_pose_api.c1
-rw-r--r--source/blender/makesrna/intern/rna_render.c2
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c73
-rw-r--r--source/blender/makesrna/intern/rna_rna.c56
-rw-r--r--source/blender/makesrna/intern/rna_scene.c33
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c32
-rw-r--r--source/blender/makesrna/intern/rna_screen.c15
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c5
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c236
-rw-r--r--source/blender/makesrna/intern/rna_speaker.c1
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c4
-rw-r--r--source/blender/makesrna/intern/rna_ui.c11
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c38
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c186
-rw-r--r--source/blender/makesrna/intern/rna_wm.c10
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c14
-rw-r--r--source/blender/makesrna/intern/rna_wm_manipulator.c2
-rw-r--r--source/blender/makesrna/intern/rna_wm_manipulator_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_workspace.c4
-rw-r--r--source/blender/makesrna/intern/rna_workspace_api.c12
-rwxr-xr-xsource/blender/makesrna/rna_cleanup/rna_cleaner.py1
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c12
-rw-r--r--source/blender/modifiers/intern/MOD_array.c1
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c6
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c2
-rw-r--r--source/blender/modifiers/intern/MOD_build.c1
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c10
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c14
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c2
-rw-r--r--source/blender/modifiers/intern/MOD_correctivesmooth.c6
-rw-r--r--source/blender/modifiers/intern/MOD_curve.c6
-rw-r--r--source/blender/modifiers/intern/MOD_datatransfer.c35
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c2
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c17
-rw-r--r--source/blender/modifiers/intern/MOD_dynamicpaint.c10
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c1
-rw-r--r--source/blender/modifiers/intern/MOD_explode.c10
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.h1
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c8
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c12
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciansmooth.c10
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c8
-rw-r--r--source/blender/modifiers/intern/MOD_meshcache.c13
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c18
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.c6
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c5
-rw-r--r--source/blender/modifiers/intern/MOD_none.c2
-rw-r--r--source/blender/modifiers/intern/MOD_normal_edit.c5
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c15
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c8
-rw-r--r--source/blender/modifiers/intern/MOD_particlesystem.c29
-rw-r--r--source/blender/modifiers/intern/MOD_shapekey.c30
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c10
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c7
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c2
-rw-r--r--source/blender/modifiers/intern/MOD_smoke.c16
-rw-r--r--source/blender/modifiers/intern/MOD_smooth.c4
-rw-r--r--source/blender/modifiers/intern/MOD_softbody.c11
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c3
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c11
-rw-r--r--source/blender/modifiers/intern/MOD_surface.c2
-rw-r--r--source/blender/modifiers/intern/MOD_surfacedeform.c2
-rw-r--r--source/blender/modifiers/intern/MOD_util.c167
-rw-r--r--source/blender/modifiers/intern/MOD_util.h26
-rw-r--r--source/blender/modifiers/intern/MOD_uvwarp.c35
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c12
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c17
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.c4
-rw-r--r--source/blender/modifiers/intern/MOD_weightvg_util.h2
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c6
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c7
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c8
-rw-r--r--source/blender/modifiers/intern/MOD_wireframe.c1
-rw-r--r--source/blender/nodes/NOD_shader.h2
-rw-r--r--source/blender/nodes/composite/node_composite_tree.c5
-rw-r--r--source/blender/nodes/composite/node_composite_util.c2
-rw-r--r--source/blender/nodes/composite/node_composite_util.h3
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_common.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_switch.c1
-rw-r--r--source/blender/nodes/intern/node_common.c2
-rw-r--r--source/blender/nodes/intern/node_common.h2
-rw-r--r--source/blender/nodes/intern/node_exec.c2
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c2
-rw-r--r--source/blender/nodes/shader/node_shader_util.c3
-rw-r--r--source/blender/nodes/shader/node_shader_util.h2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c9
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_attribute.c1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_light_falloff.c1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_object_info.c1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_particle_info.c1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_principled.c1
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_volume_scatter.c1
-rw-r--r--source/blender/nodes/texture/node_texture_util.c2
-rw-r--r--source/blender/nodes/texture/node_texture_util.h2
-rw-r--r--source/blender/physics/BPH_mass_spring.h3
-rw-r--r--source/blender/physics/CMakeLists.txt1
-rw-r--r--source/blender/physics/intern/BPH_mass_spring.cpp31
-rw-r--r--source/blender/physics/intern/hair_volume.cpp4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c1
-rw-r--r--source/blender/python/generic/blf_py_api.c35
-rw-r--r--source/blender/python/generic/bpy_internal_import.c4
-rw-r--r--source/blender/python/generic/imbuf_py_api.c26
-rw-r--r--source/blender/python/generic/py_capi_utils.c8
-rw-r--r--source/blender/python/generic/py_capi_utils.h1
-rw-r--r--source/blender/python/generic/python_utildefines.h1
-rw-r--r--source/blender/python/intern/bpy.c4
-rw-r--r--source/blender/python/intern/bpy_app_alembic.h1
-rw-r--r--source/blender/python/intern/bpy_app_openvdb.h1
-rw-r--r--source/blender/python/intern/bpy_app_translations.c1
-rw-r--r--source/blender/python/intern/bpy_library_write.c2
-rw-r--r--source/blender/python/intern/bpy_manipulator_wrap.c1
-rw-r--r--source/blender/python/intern/bpy_manipulator_wrap.h1
-rw-r--r--source/blender/python/intern/bpy_msgbus.c1
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c1
-rw-r--r--source/blender/python/intern/bpy_path.c1
-rw-r--r--source/blender/python/intern/bpy_props.c23
-rw-r--r--source/blender/python/intern/bpy_rna.c31
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c5
-rw-r--r--source/blender/python/intern/bpy_rna_array.c47
-rw-r--r--source/blender/python/intern/bpy_rna_id_collection.c3
-rw-r--r--source/blender/python/intern/gpu.c1
-rw-r--r--source/blender/python/intern/gpu_offscreen.c3
-rw-r--r--source/blender/python/mathutils/mathutils.c7
-rw-r--r--source/blender/python/mathutils/mathutils.h2
-rw-r--r--source/blender/python/mathutils/mathutils_Color.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Euler.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Matrix.c4
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c5
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c3
-rw-r--r--source/blender/python/simple_enum_gen.py4
-rw-r--r--source/blender/render/extern/include/RE_engine.h11
-rw-r--r--source/blender/render/extern/include/RE_multires_bake.h2
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h3
-rw-r--r--source/blender/render/intern/include/initrender.h1
-rw-r--r--source/blender/render/intern/include/render_result.h1
-rw-r--r--source/blender/render/intern/include/render_types.h2
-rw-r--r--source/blender/render/intern/include/renderpipeline.h1
-rw-r--r--source/blender/render/intern/include/texture.h1
-rw-r--r--source/blender/render/intern/include/zbuf.h1
-rw-r--r--source/blender/render/intern/source/external_engine.c10
-rw-r--r--source/blender/render/intern/source/initrender.c3
-rw-r--r--source/blender/render/intern/source/multires_bake.c2
-rw-r--r--source/blender/render/intern/source/pipeline.c19
-rw-r--r--source/blender/render/intern/source/pointdensity.c1
-rw-r--r--source/blender/render/intern/source/render_texture.c1
-rw-r--r--source/blender/windowmanager/WM_api.h28
-rw-r--r--source/blender/windowmanager/WM_keymap.h9
-rw-r--r--source/blender/windowmanager/WM_types.h8
-rw-r--r--source/blender/windowmanager/intern/wm.c2
-rw-r--r--source/blender/windowmanager/intern/wm_dragdrop.c5
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c316
-rw-r--r--source/blender/windowmanager/intern/wm_files.c2
-rw-r--r--source/blender/windowmanager/intern/wm_files_link.c2
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c10
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c13
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c5
-rw-r--r--source/blender/windowmanager/intern/wm_operator_props.c6
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c174
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c5
-rw-r--r--source/blender/windowmanager/intern/wm_window.c191
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_group_type.c1
-rw-r--r--source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h1
-rw-r--r--source/blender/windowmanager/wm.h2
-rw-r--r--source/blender/windowmanager/wm_cursors.h1
-rw-r--r--source/blender/windowmanager/wm_draw.h1
-rw-r--r--source/blender/windowmanager/wm_event_types.h1
-rw-r--r--source/blender/windowmanager/wm_files.h1
-rw-r--r--source/blender/windowmanager/wm_window.h4
-rw-r--r--source/creator/creator.c5
-rw-r--r--tests/gtests/blenlib/BLI_array_utils_test.cc1
-rw-r--r--tests/gtests/guardedalloc/guardedalloc_overflow_test.cc1
-rw-r--r--tests/gtests/testing/testing_main.cc1
-rwxr-xr-xtests/python/modules/render_report.py1
-rwxr-xr-xtests/python/modules/test_utils.py1
-rw-r--r--tests/python/rna_array.py1
1119 files changed, 20938 insertions, 14593 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06d31e0e143..4d2bcc4b0af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -439,7 +439,7 @@ mark_as_advanced(WITH_MEM_VALGRIND)
option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
mark_as_advanced(WITH_CXX_GUARDEDALLOC)
-option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" OFF)
+option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
mark_as_advanced(WITH_ASSERT_ABORT)
option(WITH_BOOST "Enable features depending on boost" ON)
@@ -806,7 +806,8 @@ set(C_WARNINGS)
set(CXX_WARNINGS)
# for gcc -Wno-blah-blah
-set(CC_REMOVE_STRICT_FLAGS)
+set(C_REMOVE_STRICT_FLAGS)
+set(CXX_REMOVE_STRICT_FLAGS)
# libraries to link the binary with passed to target_link_libraries()
# known as LLIBS to scons
@@ -1415,16 +1416,22 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif()
# flags to undo strict flags
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DEPRECATED_DECLARATIONS -Wno-deprecated-declarations)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_TYPE_LIMITS -Wno-type-limits)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_IN_BOOL_CONTEXT -Wno-int-in-bool-context)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_FORMAT -Wno-format)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_SWITCH -Wno-switch)
+
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CLASS_MEMACCESS -Wno-class-memaccess)
if(CMAKE_COMPILER_IS_GNUCC AND (NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "7.0"))
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_IMPLICIT_FALLTHROUGH -Wno-implicit-fallthrough)
endif()
if(NOT APPLE)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -1453,23 +1460,23 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
# ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNUSED_MACROS -Wunused-macros)
# flags to undo strict flags
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
-
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
- ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
-
- ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
- ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
- ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
- ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
- ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
+
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
+ ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
+
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
+ ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
diff --git a/build_files/build_environment/cmake/llvm.cmake b/build_files/build_environment/cmake/llvm.cmake
index 60f94b3a499..6c59101f543 100644
--- a/build_files/build_environment/cmake/llvm.cmake
+++ b/build_files/build_environment/cmake/llvm.cmake
@@ -58,4 +58,3 @@ if(MSVC)
DEPENDEES mkdir update patch download configure build install
)
endif()
-
diff --git a/build_files/build_environment/cmake/setup_mingw32.cmake b/build_files/build_environment/cmake/setup_mingw32.cmake
index f0d99356da0..96221bb5e10 100644
--- a/build_files/build_environment/cmake/setup_mingw32.cmake
+++ b/build_files/build_environment/cmake/setup_mingw32.cmake
@@ -216,4 +216,3 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe")
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe"
)
endif()
-
diff --git a/build_files/build_environment/cmake/setup_mingw64.cmake b/build_files/build_environment/cmake/setup_mingw64.cmake
index 14f75d410b4..9a45051ebf6 100644
--- a/build_files/build_environment/cmake/setup_mingw64.cmake
+++ b/build_files/build_environment/cmake/setup_mingw64.cmake
@@ -216,4 +216,3 @@ if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe")
COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe"
)
endif()
-
diff --git a/build_files/build_environment/cmake/zlib_mingw.cmake b/build_files/build_environment/cmake/zlib_mingw.cmake
index 13345f29ffa..56578857a47 100644
--- a/build_files/build_environment/cmake/zlib_mingw.cmake
+++ b/build_files/build_environment/cmake/zlib_mingw.cmake
@@ -37,4 +37,3 @@ endif()
if(MSVC)
set_target_properties(external_zlib_mingw PROPERTIES FOLDER Mingw)
endif()
-
diff --git a/build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake b/build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake
index 796be8db87d..ba8c4fce285 100644
--- a/build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake
+++ b/build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake
@@ -79,4 +79,3 @@ macro( select_library_configurations basename )
${basename}_LIBRARY_DEBUG
)
endmacro( select_library_configurations )
-
diff --git a/build_files/cmake/Modules/FindLLVM.cmake b/build_files/cmake/Modules/FindLLVM.cmake
index f5f3db3fc71..a40a71cb58e 100644
--- a/build_files/cmake/Modules/FindLLVM.cmake
+++ b/build_files/cmake/Modules/FindLLVM.cmake
@@ -93,4 +93,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LLVM DEFAULT_MSG
MARK_AS_ADVANCED(
LLVM_LIBRARY
)
-
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 8cf90d0d22c..545b0e8ce5d 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -674,7 +674,9 @@ function(SETUP_BLENDER_SORTED_LIBS)
extern_openjpeg
ge_videotex
bf_dna
+
bf_blenfont
+ bf_gpu # duplicate for blenfont
bf_blentranslation
bf_intern_audaspace
audaspace
@@ -1054,13 +1056,19 @@ macro(remove_cc_flag
endmacro()
-macro(add_cc_flag
+macro(add_c_flag
flag)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
endmacro()
+macro(add_cxx_flag
+ flag)
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+endmacro()
+
macro(remove_strict_flags)
if(CMAKE_COMPILER_IS_GNUCC)
@@ -1083,7 +1091,8 @@ macro(remove_strict_flags)
)
# negate flags implied by '-Wall'
- add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
+ add_c_flag("${C_REMOVE_STRICT_FLAGS}")
+ add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
@@ -1095,7 +1104,8 @@ macro(remove_strict_flags)
)
# negate flags implied by '-Wall'
- add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
+ add_c_flag("${C_REMOVE_STRICT_FLAGS}")
+ add_cxx_flag("${CXX_REMOVE_STRICT_FLAGS}")
endif()
if(MSVC)
@@ -1125,28 +1135,39 @@ endmacro()
# note, we can only append flags on a single file so we need to negate the options.
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
# probably add more removals here.
-macro(remove_strict_flags_file
+macro(remove_strict_c_flags_file
filenames)
-
foreach(_SOURCE ${ARGV})
-
if(CMAKE_COMPILER_IS_GNUCC OR
- (CMAKE_C_COMPILER_ID MATCHES "Clang"))
-
+ (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set_source_files_properties(${_SOURCE}
PROPERTIES
- COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"
+ COMPILE_FLAGS "${C_REMOVE_STRICT_FLAGS}"
)
endif()
-
if(MSVC)
# TODO
endif()
-
endforeach()
-
unset(_SOURCE)
+endmacro()
+macro(remove_strict_cxx_flags_file
+ filenames)
+ remove_strict_c_flags_file(${filenames} ${ARHV})
+ foreach(_SOURCE ${ARGV})
+ if(CMAKE_COMPILER_IS_GNUCC OR
+ (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
+ set_source_files_properties(${_SOURCE}
+ PROPERTIES
+ COMPILE_FLAGS "${CXX_REMOVE_STRICT_FLAGS}"
+ )
+ endif()
+ if(MSVC)
+ # TODO
+ endif()
+ endforeach()
+ unset(_SOURCE)
endmacro()
# External libs may need 'signed char' to be default.
diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py
index e288ac9db66..5e1a2ef64a7 100644
--- a/doc/python_api/examples/blf.py
+++ b/doc/python_api/examples/blf.py
@@ -15,6 +15,7 @@ font_info = {
"handler": None,
}
+
def init():
"""init function - runs once"""
import os
diff --git a/doc/python_api/examples/bmesh.ops.1.py b/doc/python_api/examples/bmesh.ops.1.py
index b307624467f..d6a5b1222d8 100644
--- a/doc/python_api/examples/bmesh.ops.1.py
+++ b/doc/python_api/examples/bmesh.ops.1.py
@@ -10,22 +10,22 @@ bm = bmesh.new()
# Add a circle XXX, should return all geometry created, not just verts.
bmesh.ops.create_circle(
- bm,
- cap_ends=False,
- radius=0.2,
- segments=8)
+ bm,
+ cap_ends=False,
+ radius=0.2,
+ segments=8)
# Spin and deal with geometry on side 'a'
edges_start_a = bm.edges[:]
geom_start_a = bm.verts[:] + edges_start_a
ret = bmesh.ops.spin(
- bm,
- geom=geom_start_a,
- angle=math.radians(180.0),
- steps=8,
- axis=(1.0, 0.0, 0.0),
- cent=(0.0, 1.0, 0.0))
+ bm,
+ geom=geom_start_a,
+ angle=math.radians(180.0),
+ steps=8,
+ axis=(1.0, 0.0, 0.0),
+ cent=(0.0, 1.0, 0.0))
edges_end_a = [ele for ele in ret["geom_last"]
if isinstance(ele, bmesh.types.BMEdge)]
del ret
@@ -33,8 +33,8 @@ del ret
# Extrude and create geometry on side 'b'
ret = bmesh.ops.extrude_edge_only(
- bm,
- edges=edges_start_a)
+ bm,
+ edges=edges_start_a)
geom_extrude_mid = ret["geom"]
del ret
@@ -45,19 +45,19 @@ verts_extrude_b = [ele for ele in geom_extrude_mid
edges_extrude_b = [ele for ele in geom_extrude_mid
if isinstance(ele, bmesh.types.BMEdge) and ele.is_boundary]
bmesh.ops.translate(
- bm,
- verts=verts_extrude_b,
- vec=(0.0, 0.0, 1.0))
+ bm,
+ verts=verts_extrude_b,
+ vec=(0.0, 0.0, 1.0))
# Create the circle on side 'b'
ret = bmesh.ops.spin(
- bm,
- geom=verts_extrude_b + edges_extrude_b,
- angle=-math.radians(180.0),
- steps=8,
- axis=(1.0, 0.0, 0.0),
- cent=(0.0, 1.0, 1.0))
+ bm,
+ geom=verts_extrude_b + edges_extrude_b,
+ angle=-math.radians(180.0),
+ steps=8,
+ axis=(1.0, 0.0, 0.0),
+ cent=(0.0, 1.0, 1.0))
edges_end_b = [ele for ele in ret["geom_last"]
if isinstance(ele, bmesh.types.BMEdge)]
del ret
@@ -65,30 +65,30 @@ del ret
# Bridge the resulting edge loops of both spins 'a & b'
bmesh.ops.bridge_loops(
- bm,
- edges=edges_end_a + edges_end_b)
+ bm,
+ edges=edges_end_a + edges_end_b)
# Now we have made a links of the chain, make a copy and rotate it
# (so this looks something like a chain)
ret = bmesh.ops.duplicate(
- bm,
- geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
+ bm,
+ geom=bm.verts[:] + bm.edges[:] + bm.faces[:])
geom_dupe = ret["geom"]
verts_dupe = [ele for ele in geom_dupe if isinstance(ele, bmesh.types.BMVert)]
del ret
# position the new link
bmesh.ops.translate(
- bm,
- verts=verts_dupe,
- vec=(0.0, 0.0, 2.0))
+ bm,
+ verts=verts_dupe,
+ vec=(0.0, 0.0, 2.0))
bmesh.ops.rotate(
- bm,
- verts=verts_dupe,
- cent=(0.0, 1.0, 0.0),
- matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
+ bm,
+ verts=verts_dupe,
+ cent=(0.0, 1.0, 0.0),
+ matrix=mathutils.Matrix.Rotation(math.radians(90.0), 3, 'Z'))
# Done with creating the mesh, simply link it into the scene so we can see it
diff --git a/doc/python_api/examples/bpy.app.handlers.1.py b/doc/python_api/examples/bpy.app.handlers.1.py
index 245ac199d58..34b16c27b86 100644
--- a/doc/python_api/examples/bpy.app.handlers.1.py
+++ b/doc/python_api/examples/bpy.app.handlers.1.py
@@ -17,4 +17,5 @@ from bpy.app.handlers import persistent
def load_handler(dummy):
print("Load Handler:", bpy.data.filepath)
+
bpy.app.handlers.load_post.append(load_handler)
diff --git a/doc/python_api/examples/bpy.app.handlers.py b/doc/python_api/examples/bpy.app.handlers.py
index 078f9df77f2..808115119b9 100644
--- a/doc/python_api/examples/bpy.app.handlers.py
+++ b/doc/python_api/examples/bpy.app.handlers.py
@@ -11,4 +11,5 @@ import bpy
def my_handler(scene):
print("Frame Change", scene.frame_current)
+
bpy.app.handlers.frame_change_pre.append(my_handler)
diff --git a/doc/python_api/examples/bpy.app.translations.py b/doc/python_api/examples/bpy.app.translations.py
index 4256147ef31..d18344f43be 100644
--- a/doc/python_api/examples/bpy.app.translations.py
+++ b/doc/python_api/examples/bpy.app.translations.py
@@ -54,19 +54,19 @@ translations_tuple = (
"Copyright (C) 2013 The Blender Foundation.",
"This file is distributed under the same license as the Blender package.",
"FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
- ),
+ ),
(("Operator", "Render: Copy Settings"),
(("bpy.types.SCENE_OT_render_copy_settings",),
()),
("fr_FR", "Rendu : copier réglages",
(False, ())),
- ),
+ ),
(("*", "Copy render settings from current scene to others"),
(("bpy.types.SCENE_OT_render_copy_settings",),
()),
("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres",
(False, ())),
- ),
+ ),
# ... etc, all messages from your addon.
)
@@ -81,6 +81,7 @@ for msg in translations_tuple:
# Define remaining addon (operators, UI...) here.
+
def register():
# Usual operator/UI/etc. registration...
diff --git a/doc/python_api/examples/bpy.props.2.py b/doc/python_api/examples/bpy.props.2.py
index ec9c838f5f2..aeb3bab65b4 100644
--- a/doc/python_api/examples/bpy.props.2.py
+++ b/doc/python_api/examples/bpy.props.2.py
@@ -14,6 +14,7 @@ class MaterialSettings(bpy.types.PropertyGroup):
my_float = bpy.props.FloatProperty()
my_string = bpy.props.StringProperty()
+
bpy.utils.register_class(MaterialSettings)
bpy.types.Material.my_settings = \
diff --git a/doc/python_api/examples/bpy.props.3.py b/doc/python_api/examples/bpy.props.3.py
index 807edde8f58..340618e5ca4 100644
--- a/doc/python_api/examples/bpy.props.3.py
+++ b/doc/python_api/examples/bpy.props.3.py
@@ -14,6 +14,7 @@ class SceneSettingItem(bpy.types.PropertyGroup):
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
value = bpy.props.IntProperty(name="Test Prop", default=22)
+
bpy.utils.register_class(SceneSettingItem)
bpy.types.Scene.my_settings = \
diff --git a/doc/python_api/examples/bpy.props.4.py b/doc/python_api/examples/bpy.props.4.py
index 2b44d94f72a..daab18c8986 100644
--- a/doc/python_api/examples/bpy.props.4.py
+++ b/doc/python_api/examples/bpy.props.4.py
@@ -14,6 +14,7 @@ import bpy
def update_func(self, context):
print("my test function", self)
+
bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func)
bpy.context.scene.testprop = 11.0
diff --git a/doc/python_api/examples/bpy.props.5.py b/doc/python_api/examples/bpy.props.5.py
index a9e79fa0272..c428b4743f8 100644
--- a/doc/python_api/examples/bpy.props.5.py
+++ b/doc/python_api/examples/bpy.props.5.py
@@ -19,6 +19,7 @@ def get_float(self):
def set_float(self, value):
self["testprop"] = value
+
bpy.types.Scene.test_float = bpy.props.FloatProperty(get=get_float, set=set_float)
@@ -27,6 +28,7 @@ def get_date(self):
import datetime
return str(datetime.datetime.now())
+
bpy.types.Scene.test_date = bpy.props.StringProperty(get=get_date)
@@ -40,6 +42,7 @@ def get_array(self):
def set_array(self, values):
self["somebool"] = values[0] and values[1]
+
bpy.types.Scene.test_array = bpy.props.BoolVectorProperty(size=2, get=get_array, set=set_array)
@@ -50,7 +53,7 @@ test_items = [
("GREEN", "Green", "", 2),
("BLUE", "Blue", "", 3),
("YELLOW", "Yellow", "", 4),
- ]
+]
def get_enum(self):
@@ -61,6 +64,7 @@ def get_enum(self):
def set_enum(self, value):
print("setting value", value)
+
bpy.types.Scene.test_enum = bpy.props.EnumProperty(items=test_items, get=get_enum, set=set_enum)
diff --git a/doc/python_api/examples/bpy.types.AddonPreferences.1.py b/doc/python_api/examples/bpy.types.AddonPreferences.1.py
index e478ba9b19a..e6c720e0fad 100644
--- a/doc/python_api/examples/bpy.types.AddonPreferences.1.py
+++ b/doc/python_api/examples/bpy.types.AddonPreferences.1.py
@@ -9,7 +9,7 @@ bl_info = {
"wiki_url": "",
"tracker_url": "",
"category": "Object",
- }
+}
import bpy
@@ -23,17 +23,17 @@ class ExampleAddonPreferences(AddonPreferences):
bl_idname = __name__
filepath = StringProperty(
- name="Example File Path",
- subtype='FILE_PATH',
- )
+ name="Example File Path",
+ subtype='FILE_PATH',
+ )
number = IntProperty(
- name="Example Number",
- default=4,
- )
+ name="Example Number",
+ default=4,
+ )
boolean = BoolProperty(
- name="Example Boolean",
- default=False,
- )
+ name="Example Boolean",
+ default=False,
+ )
def draw(self, context):
layout = self.layout
diff --git a/doc/python_api/examples/bpy.types.Menu.2.py b/doc/python_api/examples/bpy.types.Menu.2.py
index 50460f65b3d..a1cce0c3ce2 100644
--- a/doc/python_api/examples/bpy.types.Menu.2.py
+++ b/doc/python_api/examples/bpy.types.Menu.2.py
@@ -14,4 +14,5 @@ import bpy
def menu_draw(self, context):
self.layout.operator("wm.save_homefile")
+
bpy.types.INFO_MT_file.append(menu_draw)
diff --git a/doc/python_api/examples/bpy.types.Menu.3.py b/doc/python_api/examples/bpy.types.Menu.3.py
index 47c81366db4..9fe39535bbf 100644
--- a/doc/python_api/examples/bpy.types.Menu.3.py
+++ b/doc/python_api/examples/bpy.types.Menu.3.py
@@ -32,7 +32,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
# variable used for all preset values
preset_defines = [
"obj = bpy.context.object"
- ]
+ ]
# properties to store in the preset
preset_values = [
@@ -42,7 +42,7 @@ class AddPresetObjectDraw(AddPresetBase, Operator):
"obj.show_name",
"obj.show_axis",
"obj.show_wire",
- ]
+ ]
# where to store the preset
preset_subdir = "object/draw"
@@ -61,7 +61,7 @@ def panel_func(self, context):
classes = (
OBJECT_MT_draw_presets,
AddPresetObjectDraw,
- )
+)
def register():
diff --git a/doc/python_api/examples/bpy.types.Menu.4.py b/doc/python_api/examples/bpy.types.Menu.4.py
index 04ceb6654da..869def8bfe0 100644
--- a/doc/python_api/examples/bpy.types.Menu.4.py
+++ b/doc/python_api/examples/bpy.types.Menu.4.py
@@ -60,6 +60,7 @@ def menu_func(self, context):
layout.separator()
layout.operator(WM_OT_button_context_test.bl_idname)
+
classes = (
WM_OT_button_context_test,
WM_MT_button_context,
@@ -77,5 +78,6 @@ def unregister():
bpy.utils.unregister_class(cls)
bpy.types.WM_MT_button_context.remove(menu_func)
+
if __name__ == "__main__":
register()
diff --git a/doc/python_api/examples/bpy.types.NodeTree.py b/doc/python_api/examples/bpy.types.NodeTree.py
index da2986636ea..e969c1a41dc 100644
--- a/doc/python_api/examples/bpy.types.NodeTree.py
+++ b/doc/python_api/examples/bpy.types.NodeTree.py
@@ -21,4 +21,5 @@ class CyclesNodeTree(bpy.types.NodeTree):
def poll(cls, context):
return context.scene.render.engine == 'CYCLES'
+
bpy.utils.register_class(CyclesNodeTree)
diff --git a/doc/python_api/examples/bpy.types.Operator.1.py b/doc/python_api/examples/bpy.types.Operator.1.py
index 1ba13c040ba..f09ae969001 100644
--- a/doc/python_api/examples/bpy.types.Operator.1.py
+++ b/doc/python_api/examples/bpy.types.Operator.1.py
@@ -42,6 +42,7 @@ class SimpleMouseOperator(bpy.types.Operator):
self.y = event.mouse_y
return self.execute(context)
+
bpy.utils.register_class(SimpleMouseOperator)
# Test call to the newly defined operator.
diff --git a/doc/python_api/examples/bpy.types.Operator.2.py b/doc/python_api/examples/bpy.types.Operator.2.py
index e2f9a3a84c4..d1f0edf15aa 100644
--- a/doc/python_api/examples/bpy.types.Operator.2.py
+++ b/doc/python_api/examples/bpy.types.Operator.2.py
@@ -42,6 +42,7 @@ def menu_func(self, context):
self.layout.operator_context = 'INVOKE_DEFAULT'
self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
+
# Register and add to the file selector
bpy.utils.register_class(ExportSomeData)
bpy.types.INFO_MT_file_export.append(menu_func)
diff --git a/doc/python_api/examples/bpy.types.Operator.4.py b/doc/python_api/examples/bpy.types.Operator.4.py
index e5bc6e5c70d..90d1157343d 100644
--- a/doc/python_api/examples/bpy.types.Operator.4.py
+++ b/doc/python_api/examples/bpy.types.Operator.4.py
@@ -41,6 +41,7 @@ class CustomDrawOperator(bpy.types.Operator):
col.prop(self, "my_string")
+
bpy.utils.register_class(CustomDrawOperator)
# test call
diff --git a/doc/python_api/examples/bpy.types.Operator.py b/doc/python_api/examples/bpy.types.Operator.py
index 4baa9380aa6..c9bf169f73e 100644
--- a/doc/python_api/examples/bpy.types.Operator.py
+++ b/doc/python_api/examples/bpy.types.Operator.py
@@ -22,6 +22,7 @@ class HelloWorldOperator(bpy.types.Operator):
print("Hello World")
return {'FINISHED'}
+
bpy.utils.register_class(HelloWorldOperator)
# test call to the newly defined operator
diff --git a/doc/python_api/examples/bpy.types.PropertyGroup.py b/doc/python_api/examples/bpy.types.PropertyGroup.py
index 2c2aa6d9b11..974142a79b2 100644
--- a/doc/python_api/examples/bpy.types.PropertyGroup.py
+++ b/doc/python_api/examples/bpy.types.PropertyGroup.py
@@ -31,6 +31,7 @@ class MyPropertyGroup(bpy.types.PropertyGroup):
custom_1 = bpy.props.FloatProperty(name="My Float")
custom_2 = bpy.props.IntProperty(name="My Int")
+
bpy.utils.register_class(MyPropertyGroup)
bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=MyPropertyGroup)
diff --git a/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py b/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py
index 8d2e101be5f..e6329f677f7 100644
--- a/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py
+++ b/doc/python_api/examples/bpy.types.WindowManager.popup_menu.py
@@ -10,4 +10,5 @@ import bpy
def draw(self, context):
self.layout.label("Hello World")
+
bpy.context.window_manager.popup_menu(draw, title="Greeting", icon='INFO')
diff --git a/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py b/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py
index 6889fe75277..d46ffcc8373 100644
--- a/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py
+++ b/doc/python_api/examples/bpy.types.bpy_struct.keyframe_insert.1.py
@@ -12,6 +12,7 @@ from bpy.props import PointerProperty
class MyPropGroup(bpy.types.PropertyGroup):
nested = bpy.props.FloatProperty(name="Nested", default=0.0)
+
# register it so its available for all bones
bpy.utils.register_class(MyPropGroup)
bpy.types.Bone.my_prop = PointerProperty(type=MyPropGroup,
diff --git a/doc/python_api/examples/gpu.offscreen.1.py b/doc/python_api/examples/gpu.offscreen.1.py
index ff1a7ad7cce..bb34603bd23 100644
--- a/doc/python_api/examples/gpu.offscreen.1.py
+++ b/doc/python_api/examples/gpu.offscreen.1.py
@@ -23,9 +23,9 @@ class OffScreenDraw(bpy.types.Operator):
@staticmethod
def handle_add(self, context):
OffScreenDraw._handle_draw = bpy.types.SpaceView3D.draw_handler_add(
- self.draw_callback_px, (self, context),
- 'WINDOW', 'POST_PIXEL',
- )
+ self.draw_callback_px, (self, context),
+ 'WINDOW', 'POST_PIXEL',
+ )
@staticmethod
def handle_remove():
@@ -58,20 +58,20 @@ class OffScreenDraw(bpy.types.Operator):
modelview_matrix = camera.matrix_world.inverted()
projection_matrix = camera.calc_matrix_camera(
- render.resolution_x,
- render.resolution_y,
- render.pixel_aspect_x,
- render.pixel_aspect_y,
- )
+ render.resolution_x,
+ render.resolution_y,
+ render.pixel_aspect_x,
+ render.pixel_aspect_y,
+ )
offscreen.draw_view3d(
- scene,
- render_layer,
- context.space_data,
- context.region,
- projection_matrix,
- modelview_matrix,
- )
+ scene,
+ render_layer,
+ context.space_data,
+ context.region,
+ projection_matrix,
+ modelview_matrix,
+ )
@staticmethod
def _opengl_draw(context, texture, aspect_ratio, scale):
diff --git a/extern/rangetree/CMakeLists.txt b/extern/rangetree/CMakeLists.txt
index e8e9b15f8b1..77c293e851a 100644
--- a/extern/rangetree/CMakeLists.txt
+++ b/extern/rangetree/CMakeLists.txt
@@ -28,4 +28,3 @@ set(SRC
)
blender_add_lib(extern_rangetree "${SRC}" "${INC}" "")
-
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 233bc639fd8..0740aa51039 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -355,4 +355,3 @@ endif()
if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
delayed_do_install(${CMAKE_BINARY_DIR}/bin)
endif()
-
diff --git a/intern/cycles/blender/CMakeLists.txt b/intern/cycles/blender/CMakeLists.txt
index 77c72777aa6..9a26ce86bc9 100644
--- a/intern/cycles/blender/CMakeLists.txt
+++ b/intern/cycles/blender/CMakeLists.txt
@@ -63,4 +63,3 @@ endif()
add_dependencies(bf_intern_cycles bf_rna)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${ADDON_FILES}" ${CYCLES_INSTALL_PATH})
-
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 2f9c486367a..f8bc9ca8512 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -193,7 +193,7 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel):
row = layout.row(align=True)
row.prop(cscene, "seed")
- row.prop(cscene, "use_animated_seed", text="", icon="TIME")
+ row.prop(cscene, "use_animated_seed", text="", icon='TIME')
layout.prop(cscene, "sampling_pattern", text="Pattern")
@@ -847,7 +847,7 @@ class CYCLES_CAMERA_PT_dof_aperture(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
cam = context.camera
ccam = cam.cycles
@@ -878,7 +878,7 @@ class CYCLES_CAMERA_PT_dof_viewport(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
cam = context.camera
dof_options = cam.gpu_dof
@@ -1126,31 +1126,30 @@ class CYCLES_LAMP_PT_lamp(CyclesButtonsPanel, Panel):
layout.prop(lamp, "type", expand=True)
- split = layout.split()
- col = split.column(align=True)
+ layout.use_property_split = True
+
+ col = layout.column()
if lamp.type in {'POINT', 'SUN', 'SPOT'}:
col.prop(lamp, "shadow_soft_size", text="Size")
elif lamp.type == 'AREA':
- col.prop(lamp, "shape", text="")
+ col.prop(lamp, "shape", text="Shape")
sub = col.column(align=True)
if lamp.shape in {'SQUARE', 'DISK'}:
sub.prop(lamp, "size")
elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
sub.prop(lamp, "size", text="Size X")
- sub.prop(lamp, "size_y", text="Size Y")
+ sub.prop(lamp, "size_y", text="Y")
if not (lamp.type == 'AREA' and clamp.is_portal):
- sub = col.column(align=True)
+ sub = col.column()
if use_branched_path(context):
subsub = sub.row(align=True)
subsub.active = use_sample_all_lights(context)
subsub.prop(clamp, "samples")
sub.prop(clamp, "max_bounces")
- col = split.column()
-
sub = col.column(align=True)
sub.active = not (lamp.type == 'AREA' and clamp.is_portal)
sub.prop(clamp, "cast_shadow")
@@ -1192,17 +1191,12 @@ class CYCLES_LAMP_PT_spot(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
-
lamp = context.lamp
+ layout.use_property_split = True
- split = layout.split()
-
- col = split.column()
- sub = col.column()
- sub.prop(lamp, "spot_size", text="Size")
- sub.prop(lamp, "spot_blend", text="Blend", slider=True)
-
- col = split.column()
+ col = layout.column()
+ col.prop(lamp, "spot_size", text="Size")
+ col.prop(lamp, "spot_blend", text="Blend", slider=True)
col.prop(lamp, "show_cone")
@@ -1545,6 +1539,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
+ layout.use_property_decorate = False # No animation.
scene = context.scene
cscene = scene.cycles
@@ -1573,7 +1568,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
if cscene.bake_type == 'NORMAL':
col.prop(cbk, "normal_space", text="Space")
- sub = col.row(align=True)
+ sub = col.column(align=True)
sub.prop(cbk, "normal_r", text="Swizzle R")
sub.prop(cbk, "normal_g", text="G")
sub.prop(cbk, "normal_b", text="B")
@@ -1595,6 +1590,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}:
row = col.row(align=True)
+ row.use_property_split = False
row.prop(cbk, "use_pass_direct", toggle=True)
row.prop(cbk, "use_pass_indirect", toggle=True)
row.prop(cbk, "use_pass_color", toggle=True)
@@ -1613,10 +1609,12 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
sub.prop(cbk, "use_cage", text="Cage")
if cbk.use_cage:
sub.prop(cbk, "cage_extrusion", text="Extrusion")
- sub.prop_search(cbk, "cage_object", scene, "objects", text="")
+ sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object")
else:
sub.prop(cbk, "cage_extrusion", text="Ray Distance")
+ layout.separator()
+
layout.operator("object.bake", icon='RENDER_STILL').type = cscene.bake_type
@@ -1783,7 +1781,7 @@ def draw_pause(self, context):
if view.shading.type == 'RENDERED':
cscene = scene.cycles
- layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
+ layout.prop(cscene, "preview_pause", icon='PAUSE', text="")
def get_panels():
diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py
index d3948f8fbb5..3334ccd65fd 100644
--- a/intern/cycles/blender/addon/version_update.py
+++ b/intern/cycles/blender/addon/version_update.py
@@ -481,7 +481,7 @@ def do_versions(self):
cworld = world.cycles
# World MIS
if not cworld.is_property_set("sampling_method"):
- if cworld.get("sample_as_light", False):
+ if cworld.get("sample_as_light", True):
cworld.sampling_method = 'MANUAL'
else:
cworld.sampling_method = 'NONE'
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index aea63b6b31f..c5df5842bad 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -457,6 +457,7 @@ static void blender_camera_sync(Camera *cam,
cam->matrix = blender_camera_matrix(bcam->matrix,
bcam->type,
bcam->panorama_type);
+ cam->motion.clear();
cam->motion.resize(bcam->motion_steps, cam->matrix);
cam->use_perspective_motion = false;
cam->shuttertime = bcam->shuttertime;
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index e0737d5118a..6d6b367209d 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -448,6 +448,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
mesh->motion_steps = motion_steps;
}
+ object->motion.clear();
object->motion.resize(motion_steps, transform_empty());
if(motion_steps) {
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index eec13d04d7d..cd55155e33b 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -54,6 +54,7 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::BlendData& b_data,
bool preview_osl)
: session(NULL),
+ sync(NULL),
b_engine(b_engine),
b_userpref(b_userpref),
b_data(b_data),
@@ -81,6 +82,7 @@ BlenderSession::BlenderSession(BL::RenderEngine& b_engine,
BL::RegionView3D& b_rv3d,
int width, int height)
: session(NULL),
+ sync(NULL),
b_engine(b_engine),
b_userpref(b_userpref),
b_data(b_data),
@@ -209,11 +211,8 @@ void BlenderSession::reset_session(BL::BlendData& b_data, BL::Depsgraph& b_depsg
/* if scene or session parameters changed, it's easier to simply re-create
* them rather than trying to distinguish which settings need to be updated
*/
-
- delete session;
-
+ free_session();
create_session();
-
return;
}
@@ -449,11 +448,11 @@ void BlenderSession::render(BL::Depsgraph& b_depsgraph_)
BL::Object b_camera_override(b_engine.camera_override());
sync->sync_camera(b_render, b_camera_override, width, height, b_rview_name.c_str());
sync->sync_data(b_render,
- b_depsgraph,
- b_v3d,
- b_camera_override,
- width, height,
- &python_thread_state);
+ b_depsgraph,
+ b_v3d,
+ b_camera_override,
+ width, height,
+ &python_thread_state);
builtin_images_load();
/* Make sure all views have different noise patterns. - hardcoded value just to make it random */
@@ -610,11 +609,11 @@ void BlenderSession::bake(BL::Depsgraph& b_depsgraph_,
BL::Object b_camera_override(b_engine.camera_override());
sync->sync_camera(b_render, b_camera_override, width, height, "");
sync->sync_data(b_render,
- b_depsgraph,
- b_v3d,
- b_camera_override,
- width, height,
- &python_thread_state);
+ b_depsgraph,
+ b_v3d,
+ b_camera_override,
+ width, height,
+ &python_thread_state);
builtin_images_load();
}
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 0c27786f241..80aa68d9756 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -177,7 +177,7 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
}
void BlenderSync::sync_data(BL::RenderSettings& b_render,
- BL::Depsgraph& b_depsgraph,
+ BL::Depsgraph& b_depsgraph,
BL::SpaceView3D& b_v3d,
BL::Object& b_override,
int width, int height,
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index e9ede91c295..4e754d22984 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -293,7 +293,7 @@ static inline int4 get_int4(const BL::Array<int, 4>& array)
return make_int4(array[0], array[1], array[2], array[3]);
}
-static inline uint get_layer(const BL::Array<int, 20>& array)
+static inline uint get_layer(const BL::Array<bool, 20>& array)
{
uint layer = 0;
@@ -304,8 +304,8 @@ static inline uint get_layer(const BL::Array<int, 20>& array)
return layer;
}
-static inline uint get_layer(const BL::Array<int, 20>& array,
- const BL::Array<int, 8>& local_array,
+static inline uint get_layer(const BL::Array<bool, 20>& array,
+ const BL::Array<bool, 8>& local_array,
bool is_light = false,
uint view_layers = (1 << 20) - 1)
{
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 3ba5a8de8ff..656ad07d657 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -385,7 +385,7 @@ public:
VLOG(1) << "Found nvcc " << nvcc
<< ", CUDA version " << cuda_version
<< ".";
- const int major = cuda_version / 10, minor = cuda_version & 10;
+ const int major = cuda_version / 10, minor = cuda_version % 10;
if(cuda_version == 0) {
cuda_error_message("CUDA nvcc compiler version could not be parsed.");
return false;
diff --git a/intern/cycles/graph/CMakeLists.txt b/intern/cycles/graph/CMakeLists.txt
index 168ca0210e7..0ce56c2b2e6 100644
--- a/intern/cycles/graph/CMakeLists.txt
+++ b/intern/cycles/graph/CMakeLists.txt
@@ -20,4 +20,3 @@ include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})
cycles_add_library(cycles_graph ${SRC} ${SRC_HEADERS})
-
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index c2688cd71f7..95cdefdd94b 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -520,4 +520,3 @@ delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTAL
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_GEOM_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/geom)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/util)
delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SPLIT_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/split)
-
diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h
index d8ff69ca241..c1b02cd4be1 100644
--- a/intern/cycles/kernel/closure/bsdf.h
+++ b/intern/cycles/kernel/closure/bsdf.h
@@ -72,15 +72,15 @@ ccl_device_inline float bsdf_get_roughness_squared(const ShaderClosure *sc)
return bsdf_get_specular_roughness_squared(sc);
}
-ccl_device_forceinline int bsdf_sample(KernelGlobals *kg,
- ShaderData *sd,
- const ShaderClosure *sc,
- float randu,
- float randv,
- float3 *eval,
- float3 *omega_in,
- differential3 *domega_in,
- float *pdf)
+ccl_device_inline int bsdf_sample(KernelGlobals *kg,
+ ShaderData *sd,
+ const ShaderClosure *sc,
+ float randu,
+ float randv,
+ float3 *eval,
+ float3 *omega_in,
+ differential3 *domega_in,
+ float *pdf)
{
int label;
@@ -210,7 +210,7 @@ ccl_device_forceinline int bsdf_sample(KernelGlobals *kg,
#ifndef __KERNEL_CUDA__
ccl_device
#else
-ccl_device_forceinline
+ccl_device_inline
#endif
float3 bsdf_eval(KernelGlobals *kg,
ShaderData *sd,
diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt
index 159de63a044..adca45c5c76 100644
--- a/intern/cycles/kernel/osl/CMakeLists.txt
+++ b/intern/cycles/kernel/osl/CMakeLists.txt
@@ -31,4 +31,3 @@ include_directories(${INC})
include_directories(SYSTEM ${INC_SYS})
cycles_add_library(cycles_kernel_osl ${SRC} ${HEADER_SRC})
-
diff --git a/intern/cycles/kernel/shaders/CMakeLists.txt b/intern/cycles/kernel/shaders/CMakeLists.txt
index 40720bc3682..9ee78d160a4 100644
--- a/intern/cycles/kernel/shaders/CMakeLists.txt
+++ b/intern/cycles/kernel/shaders/CMakeLists.txt
@@ -127,4 +127,3 @@ cycles_set_solution_folder(cycles_osl_shaders)
# CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)
delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "${SRC_OSL_HEADERS}" ${CYCLES_INSTALL_PATH}/shader)
-
diff --git a/intern/cycles/kernel/shaders/node_ambient_occlusion.osl b/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
index d7ffa3c1606..825cccd59ce 100644
--- a/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
+++ b/intern/cycles/kernel/shaders/node_ambient_occlusion.osl
@@ -17,13 +17,13 @@
#include "stdosl.h"
shader node_ambient_occlusion(
- color ColorIn = color(0.8, 0.8, 0.8),
- int samples = 8,
+ color ColorIn = color(1.0, 1.0, 1.0),
+ int samples = 16,
float Distance = 1.0,
normal Normal = N,
int inside = 0,
- int only_local = 1,
- output color ColorOut = color(0.8, 0.8, 0.8),
+ int only_local = 0,
+ output color ColorOut = color(1.0, 1.0, 1.0),
output float AO = 1.0)
{
int global_radius = (Distance == 0.0 && !isconnected(Distance));
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h
index 10d5fe0e42b..2bee4bc7b69 100644
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@ -144,7 +144,6 @@ CCL_NAMESPACE_END
#include "kernel/svm/svm_color_util.h"
#include "kernel/svm/svm_math_util.h"
-#include "kernel/svm/svm_ao.h"
#include "kernel/svm/svm_attribute.h"
#include "kernel/svm/svm_gradient.h"
#include "kernel/svm/svm_blackbody.h"
@@ -185,6 +184,7 @@ CCL_NAMESPACE_END
#include "kernel/svm/svm_bump.h"
#ifdef __SHADER_RAYTRACE__
+# include "kernel/svm/svm_ao.h"
# include "kernel/svm/svm_bevel.h"
#endif
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 5a58ef1aa8e..94072d7da09 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -587,7 +587,7 @@ void LightManager::device_update_background(Device *device,
double time_start = time_dt();
if(max(res.x, res.y) < 512) {
/* Small enough resolution, faster to do single-threaded. */
- background_cdf(0, res.x, res.x, res.y, &pixels, cond_cdf);
+ background_cdf(0, res.y, res.x, res.y, &pixels, cond_cdf);
}
else {
/* Threaded evaluation for large resolution. */
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 59ac6257499..e7f13f3123f 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2792,14 +2792,14 @@ NODE_DEFINE(AmbientOcclusionNode)
{
NodeType* type = NodeType::add("ambient_occlusion", create, NodeType::SHADER);
- SOCKET_INT(samples, "Samples", 8);
+ SOCKET_INT(samples, "Samples", 16);
- SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f));
+ SOCKET_IN_COLOR(color, "Color", make_float3(1.0f, 1.0f, 1.0f));
SOCKET_IN_FLOAT(distance, "Distance", 1.0f);
SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL);
SOCKET_BOOLEAN(inside, "Inside", false);
- SOCKET_BOOLEAN(only_local, "Only Local", true);
+ SOCKET_BOOLEAN(only_local, "Only Local", false);
SOCKET_OUT_COLOR(color, "Color");
SOCKET_OUT_FLOAT(ao, "AO");
diff --git a/intern/cycles/test/CMakeLists.txt b/intern/cycles/test/CMakeLists.txt
index 46c525eb3bb..332e0d8cc78 100644
--- a/intern/cycles/test/CMakeLists.txt
+++ b/intern/cycles/test/CMakeLists.txt
@@ -91,7 +91,8 @@ link_directories(${OPENIMAGEIO_LIBPATH}
${JPEG_LIBPATH}
${ZLIB_LIBPATH}
${TIFF_LIBPATH}
- ${OPENEXR_LIBPATH})
+ ${OPENEXR_LIBPATH}
+ ${OPENCOLORIO_LIBPATH})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
diff --git a/intern/cycles/util/util_ssef.h b/intern/cycles/util/util_ssef.h
index bb007ff84a9..e9a617bb2cc 100644
--- a/intern/cycles/util/util_ssef.h
+++ b/intern/cycles/util/util_ssef.h
@@ -606,7 +606,7 @@ ccl_device_inline const ssef uint32_to_float(const ssei &in)
template<size_t S1, size_t S2, size_t S3, size_t S4>
ccl_device_inline const ssef set_sign_bit(const ssef &a)
{
- return a ^ cast(ssei(S1 << 31, S2 << 31, S3 << 31, S4 << 31));
+ return cast(cast(a) ^ ssei(S1 << 31, S2 << 31, S3 << 31, S4 << 31));
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/intern/dualcon/CMakeLists.txt b/intern/dualcon/CMakeLists.txt
index 213379e852e..bd8c2eff504 100644
--- a/intern/dualcon/CMakeLists.txt
+++ b/intern/dualcon/CMakeLists.txt
@@ -46,4 +46,3 @@ set(SRC
)
blender_add_lib(bf_intern_dualcon "${SRC}" "${INC}" "${INC_SYS}")
-
diff --git a/intern/eigen/intern/matrix.cc b/intern/eigen/intern/matrix.cc
index 5e00540f27c..bcd5273fd74 100644
--- a/intern/eigen/intern/matrix.cc
+++ b/intern/eigen/intern/matrix.cc
@@ -48,6 +48,9 @@ bool EIG_invert_m4_m4(float inverse[4][4], const float matrix[4][4])
Matrix4f R;
bool invertible = true;
M.computeInverseWithCheck(R, invertible, 0.0f);
+ if (!invertible) {
+ R = R.Zero();
+ }
memcpy(inverse, R.data(), sizeof(float)*4*4);
return invertible;
}
diff --git a/intern/ghost/GHOST_IContext.h b/intern/ghost/GHOST_IContext.h
index 5b027a614ab..22b63486398 100644
--- a/intern/ghost/GHOST_IContext.h
+++ b/intern/ghost/GHOST_IContext.h
@@ -75,4 +75,3 @@ public:
};
#endif // __GHOST_IContext_H__
-
diff --git a/intern/ghost/GHOST_IEvent.h b/intern/ghost/GHOST_IEvent.h
index 83273716950..2842e009493 100644
--- a/intern/ghost/GHOST_IEvent.h
+++ b/intern/ghost/GHOST_IEvent.h
@@ -91,4 +91,3 @@ public:
};
#endif // __GHOST_IEVENT_H__
-
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 1a6c0f9a1bf..07273c40d17 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -462,4 +462,3 @@ protected:
};
#endif // __GHOST_ISYSTEM_H__
-
diff --git a/intern/ghost/GHOST_ITimerTask.h b/intern/ghost/GHOST_ITimerTask.h
index dd3db5623cc..6ae62952e98 100644
--- a/intern/ghost/GHOST_ITimerTask.h
+++ b/intern/ghost/GHOST_ITimerTask.h
@@ -91,4 +91,3 @@ public:
};
#endif // __GHOST_ITIMERTASK_H__
-
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 5a3403bcbd3..b2f9fe24944 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -368,4 +368,3 @@ public:
};
#endif // __GHOST_IWINDOW_H__
-
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index c2ea8db0a66..7906d169cda 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -257,4 +257,3 @@ inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
}
#endif // __GHOST_RECT_H__
-
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index b206bb677a7..1fc1d1a3e56 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -557,4 +557,3 @@ typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_T
#endif
#endif // __GHOST_TYPES_H__
-
diff --git a/intern/ghost/intern/GHOST_Buttons.h b/intern/ghost/intern/GHOST_Buttons.h
index aed9a3cc81f..d9d4e4a32b9 100644
--- a/intern/ghost/intern/GHOST_Buttons.h
+++ b/intern/ghost/intern/GHOST_Buttons.h
@@ -75,4 +75,3 @@ struct GHOST_Buttons {
};
#endif // __GHOST_BUTTONS_H__
-
diff --git a/intern/ghost/intern/GHOST_CallbackEventConsumer.h b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
index 3505d651fa3..789ce1e1a72 100644
--- a/intern/ghost/intern/GHOST_CallbackEventConsumer.h
+++ b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
@@ -80,4 +80,3 @@ protected:
};
#endif // __GHOST_CALLBACKEVENTCONSUMER_H__
-
diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h
index 658c9bf5d2c..b899027f051 100644
--- a/intern/ghost/intern/GHOST_Debug.h
+++ b/intern/ghost/intern/GHOST_Debug.h
@@ -84,4 +84,3 @@
#endif // GHOST_DEBUG
#endif // __GHOST_DEBUG_H__
-
diff --git a/intern/ghost/intern/GHOST_DisplayManager.h b/intern/ghost/intern/GHOST_DisplayManager.h
index 02a742a54db..20d724f6106 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.h
+++ b/intern/ghost/intern/GHOST_DisplayManager.h
@@ -142,4 +142,3 @@ protected:
#endif // __GHOST_DISPLAYMANAGER_H__
-
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
index 3ce0b4e2239..17343cb901d 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
@@ -103,4 +103,3 @@ protected:
#endif // __GHOST_DISPLAYMANAGERCOCOA_H__
-
diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.h b/intern/ghost/intern/GHOST_DisplayManagerWin32.h
index f0d6d62083c..997accf7e96 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerWin32.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.h
@@ -98,4 +98,3 @@ protected:
#endif // __GHOST_DISPLAYMANAGERWIN32_H__
-
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.h b/intern/ghost/intern/GHOST_DisplayManagerX11.h
index 857a8a5fce8..e330e7756e3 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.h
@@ -120,4 +120,3 @@ private:
#endif //
-
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 79d7a2d48b4..de12dfad815 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -392,4 +392,3 @@ void printLastError(void)
}
}
#endif // GHOST_DEBUG
-
diff --git a/intern/ghost/intern/GHOST_Event.h b/intern/ghost/intern/GHOST_Event.h
index 278870738c2..a0aef6550eb 100644
--- a/intern/ghost/intern/GHOST_Event.h
+++ b/intern/ghost/intern/GHOST_Event.h
@@ -104,4 +104,3 @@ protected:
};
#endif // __GHOST_EVENT_H__
-
diff --git a/intern/ghost/intern/GHOST_EventButton.h b/intern/ghost/intern/GHOST_EventButton.h
index ef5c5efa202..2f004c3ca00 100644
--- a/intern/ghost/intern/GHOST_EventButton.h
+++ b/intern/ghost/intern/GHOST_EventButton.h
@@ -63,4 +63,3 @@ protected:
};
#endif // __GHOST_EVENTBUTTON_H__
-
diff --git a/intern/ghost/intern/GHOST_EventCursor.h b/intern/ghost/intern/GHOST_EventCursor.h
index 1c6f762cd9e..05b1caee081 100644
--- a/intern/ghost/intern/GHOST_EventCursor.h
+++ b/intern/ghost/intern/GHOST_EventCursor.h
@@ -65,4 +65,3 @@ protected:
#endif // __GHOST_EVENTCURSOR_H__
-
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index c9f4f08b53c..2f10c2e8f99 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -133,4 +133,3 @@ protected:
};
#endif // __GHOST_EVENTDRAGNDROP_H__
-
diff --git a/intern/ghost/intern/GHOST_EventKey.h b/intern/ghost/intern/GHOST_EventKey.h
index 7e867596503..8052625496a 100644
--- a/intern/ghost/intern/GHOST_EventKey.h
+++ b/intern/ghost/intern/GHOST_EventKey.h
@@ -89,4 +89,3 @@ protected:
};
#endif // __GHOST_EVENTKEY_H__
-
diff --git a/intern/ghost/intern/GHOST_EventManager.h b/intern/ghost/intern/GHOST_EventManager.h
index efad19616ad..651dd29536e 100644
--- a/intern/ghost/intern/GHOST_EventManager.h
+++ b/intern/ghost/intern/GHOST_EventManager.h
@@ -161,4 +161,3 @@ protected:
};
#endif // __GHOST_EVENTMANAGER_H__
-
diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp
index 221b85b80ba..359db162c04 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.cpp
+++ b/intern/ghost/intern/GHOST_EventPrinter.cpp
@@ -338,4 +338,3 @@ void GHOST_EventPrinter::getKeyString(GHOST_TKey key, char str[32]) const
sprintf(str, "%s", tstr);
}
}
-
diff --git a/intern/ghost/intern/GHOST_EventPrinter.h b/intern/ghost/intern/GHOST_EventPrinter.h
index 0cbb7ca467d..d4c49ae8294 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.h
+++ b/intern/ghost/intern/GHOST_EventPrinter.h
@@ -61,4 +61,3 @@ protected:
};
#endif // __GHOST_EVENTPRINTER_H__
-
diff --git a/intern/ghost/intern/GHOST_EventString.h b/intern/ghost/intern/GHOST_EventString.h
index 391af0f8e2d..a0cb35bead6 100644
--- a/intern/ghost/intern/GHOST_EventString.h
+++ b/intern/ghost/intern/GHOST_EventString.h
@@ -64,4 +64,3 @@ public:
};
#endif // __GHOST_EVENTSTRING_H__
-
diff --git a/intern/ghost/intern/GHOST_EventTrackpad.h b/intern/ghost/intern/GHOST_EventTrackpad.h
index b4e80b5fd06..faf0f1697d0 100644
--- a/intern/ghost/intern/GHOST_EventTrackpad.h
+++ b/intern/ghost/intern/GHOST_EventTrackpad.h
@@ -72,4 +72,3 @@ protected:
#endif // _GHOST_EVENT_PAN_H_
-
diff --git a/intern/ghost/intern/GHOST_EventWheel.h b/intern/ghost/intern/GHOST_EventWheel.h
index a632492acb9..c4e1c1af38c 100644
--- a/intern/ghost/intern/GHOST_EventWheel.h
+++ b/intern/ghost/intern/GHOST_EventWheel.h
@@ -65,4 +65,3 @@ protected:
#endif // __GHOST_EVENTWHEEL_H__
-
diff --git a/intern/ghost/intern/GHOST_ISystem.cpp b/intern/ghost/intern/GHOST_ISystem.cpp
index 37d5926ffc2..21cec19328e 100644
--- a/intern/ghost/intern/GHOST_ISystem.cpp
+++ b/intern/ghost/intern/GHOST_ISystem.cpp
@@ -105,4 +105,3 @@ GHOST_ISystem *GHOST_ISystem::getSystem()
{
return m_system;
}
-
diff --git a/intern/ghost/intern/GHOST_ISystemPaths.cpp b/intern/ghost/intern/GHOST_ISystemPaths.cpp
index 8bd7fbe4f9b..57062a76fd5 100644
--- a/intern/ghost/intern/GHOST_ISystemPaths.cpp
+++ b/intern/ghost/intern/GHOST_ISystemPaths.cpp
@@ -96,6 +96,3 @@ GHOST_ISystemPaths *GHOST_ISystemPaths::get()
}
return m_systemPaths;
}
-
-
-
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.h b/intern/ghost/intern/GHOST_ModifierKeys.h
index a30b66c4634..72bcbcb5e01 100644
--- a/intern/ghost/intern/GHOST_ModifierKeys.h
+++ b/intern/ghost/intern/GHOST_ModifierKeys.h
@@ -100,4 +100,3 @@ struct GHOST_ModifierKeys {
};
#endif // __GHOST_MODIFIERKEYS_H__
-
diff --git a/intern/ghost/intern/GHOST_Rect.cpp b/intern/ghost/intern/GHOST_Rect.cpp
index 646dae9f242..780ac9aaf53 100644
--- a/intern/ghost/intern/GHOST_Rect.cpp
+++ b/intern/ghost/intern/GHOST_Rect.cpp
@@ -138,4 +138,3 @@ bool GHOST_Rect::clip(GHOST_Rect& r) const
}
return clipped;
}
-
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index f849993ae6d..0629eacc3ff 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -390,4 +390,3 @@ bool GHOST_System::useNativePixel(void)
m_nativePixel = true;
return 1;
}
-
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 6831b3d07d9..2fd8603516d 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -396,4 +396,3 @@ inline GHOST_NDOFManager *GHOST_System::getNDOFManager() const
#endif
#endif // __GHOST_SYSTEM_H__
-
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index f0702737b46..57b6a683c71 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -323,4 +323,3 @@ protected:
};
#endif // __GHOST_SYSTEMCOCOA_H__
-
diff --git a/intern/ghost/intern/GHOST_SystemPaths.h b/intern/ghost/intern/GHOST_SystemPaths.h
index fbaa8ad8ba5..25e696fc081 100644
--- a/intern/ghost/intern/GHOST_SystemPaths.h
+++ b/intern/ghost/intern/GHOST_SystemPaths.h
@@ -77,5 +77,3 @@ public:
};
#endif
-
-
diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.h b/intern/ghost/intern/GHOST_SystemPathsWin32.h
index 5685a57eba8..caa90a956aa 100644
--- a/intern/ghost/intern/GHOST_SystemPathsWin32.h
+++ b/intern/ghost/intern/GHOST_SystemPathsWin32.h
@@ -90,4 +90,3 @@ public:
};
#endif // __GHOST_SYSTEMPATHSWIN32_H__
-
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index b97bf1d089c..17c41e96be4 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -325,7 +325,8 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
);
HDC mHDC = GetDC(wnd);
-
+ HDC prev_hdc = wglGetCurrentDC();
+ HGLRC prev_context = wglGetCurrentContext();
#if defined(WITH_GL_PROFILE_CORE)
for (int minor = 5; minor >= 0; --minor) {
context = new GHOST_ContextWGL(
@@ -337,7 +338,7 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY);
if (context->initializeDrawingContext()) {
- return context;
+ goto finished;
}
else {
delete context;
@@ -353,7 +354,7 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY);
if (context->initializeDrawingContext()) {
- return context;
+ goto finished;
}
else {
MessageBox(
@@ -386,8 +387,9 @@ GHOST_IContext *GHOST_SystemWin32::createOffscreenContext()
#else
# error // must specify either core or compat at build time
#endif
-
- return NULL;
+finished:
+ wglMakeCurrent(prev_hdc, prev_context);
+ return context;
}
/**
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index d318b894d87..4564bebe4fc 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -438,4 +438,3 @@ private:
};
#endif
-
diff --git a/intern/ghost/intern/GHOST_TimerManager.h b/intern/ghost/intern/GHOST_TimerManager.h
index 78026a743eb..8a06b37c73a 100644
--- a/intern/ghost/intern/GHOST_TimerManager.h
+++ b/intern/ghost/intern/GHOST_TimerManager.h
@@ -127,4 +127,3 @@ protected:
};
#endif // __GHOST_TIMERMANAGER_H__
-
diff --git a/intern/ghost/intern/GHOST_TimerTask.h b/intern/ghost/intern/GHOST_TimerTask.h
index fa35fd134f5..bf28700ad58 100644
--- a/intern/ghost/intern/GHOST_TimerTask.h
+++ b/intern/ghost/intern/GHOST_TimerTask.h
@@ -193,4 +193,3 @@ protected:
};
#endif // __GHOST_TIMERTASK_H__
-
diff --git a/intern/ghost/intern/GHOST_Window.cpp b/intern/ghost/intern/GHOST_Window.cpp
index 6596028d5a1..6931ede067e 100644
--- a/intern/ghost/intern/GHOST_Window.cpp
+++ b/intern/ghost/intern/GHOST_Window.cpp
@@ -242,4 +242,3 @@ bool GHOST_Window::getModifiedState()
{
return m_isUnsavedChanges;
}
-
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index 413a3315225..e6a4682ee7c 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -461,4 +461,3 @@ inline GHOST_TStandardCursor GHOST_Window::getCursorShape() const
}
#endif // _GHOST_WINDOW_H
-
diff --git a/intern/ghost/intern/GHOST_WindowManager.h b/intern/ghost/intern/GHOST_WindowManager.h
index a7dde2af39c..46a1e6c09cd 100644
--- a/intern/ghost/intern/GHOST_WindowManager.h
+++ b/intern/ghost/intern/GHOST_WindowManager.h
@@ -168,4 +168,3 @@ protected:
};
#endif // __GHOST_WINDOWMANAGER_H__
-
diff --git a/intern/ghost/test/multitest/Basic.h b/intern/ghost/test/multitest/Basic.h
index 86d68ef06cb..3b550af609a 100644
--- a/intern/ghost/test/multitest/Basic.h
+++ b/intern/ghost/test/multitest/Basic.h
@@ -38,4 +38,3 @@ void rect_copy (int dst[2][2], int src[2][2]);
int rect_contains_pt (int rect[2][2], int pt[2]);
int rect_width (int rect[2][2]);
int rect_height (int rect[2][2]);
-
diff --git a/intern/ghost/test/multitest/EventToBuf.h b/intern/ghost/test/multitest/EventToBuf.h
index 23b61a4cf2a..9eb24970584 100644
--- a/intern/ghost/test/multitest/EventToBuf.h
+++ b/intern/ghost/test/multitest/EventToBuf.h
@@ -27,4 +27,3 @@
char *eventtype_to_string(GHOST_TEventType type);
void event_to_buf(GHOST_EventHandle evt, char buf[128]);
-
diff --git a/intern/ghost/test/multitest/GL.h b/intern/ghost/test/multitest/GL.h
index 4a82623f9f9..292fc5b37ca 100644
--- a/intern/ghost/test/multitest/GL.h
+++ b/intern/ghost/test/multitest/GL.h
@@ -37,4 +37,3 @@
#else // defined(WIN32) || defined(__APPLE__)
#include <GL/gl.h>
#endif // defined(WIN32) || defined(__APPLE__)
-
diff --git a/intern/ghost/test/multitest/ScrollBar.h b/intern/ghost/test/multitest/ScrollBar.h
index dd737539bf2..752ed9056b8 100644
--- a/intern/ghost/test/multitest/ScrollBar.h
+++ b/intern/ghost/test/multitest/ScrollBar.h
@@ -50,4 +50,3 @@ void scrollbar_get_rect (ScrollBar *sb, int rect_r[2][2]);
void scrollbar_get_thumb (ScrollBar *sb, int thumb_r[2][2]);
void scrollbar_free (ScrollBar *sb);
-
diff --git a/intern/ghost/test/multitest/Util.h b/intern/ghost/test/multitest/Util.h
index 4652a0bbf4d..87ec72f5e89 100644
--- a/intern/ghost/test/multitest/Util.h
+++ b/intern/ghost/test/multitest/Util.h
@@ -29,4 +29,3 @@ void* memdbl (void *mem, int *size_pr, int item_size);
char* string_dup (char *str);
void fatal (char *fmt, ...);
-
diff --git a/intern/ghost/test/multitest/WindowData.h b/intern/ghost/test/multitest/WindowData.h
index 0e6c7518843..ca8199bddd8 100644
--- a/intern/ghost/test/multitest/WindowData.h
+++ b/intern/ghost/test/multitest/WindowData.h
@@ -33,4 +33,3 @@ typedef struct _WindowData WindowData;
WindowData* windowdata_new (void *data, WindowDataHandler handler);
void windowdata_handle (WindowData *wb, GHOST_EventHandle evt);
void windowdata_free (WindowData *wb);
-
diff --git a/intern/mikktspace/CMakeLists.txt b/intern/mikktspace/CMakeLists.txt
index 299ec7fe501..a4d02093ee1 100644
--- a/intern/mikktspace/CMakeLists.txt
+++ b/intern/mikktspace/CMakeLists.txt
@@ -45,4 +45,3 @@ set(SRC
)
blender_add_lib(bf_intern_mikktspace "${SRC}" "${INC}" "${INC_SYS}")
-
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index 57678ecf2f8..a95d8281974 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -99,4 +99,3 @@ if(WITH_FFTW3)
endif()
blender_add_lib(bf_intern_smoke "${SRC}" "${INC}" "${INC_SYS}")
-
diff --git a/release/datafiles/blender_icons.svg b/release/datafiles/blender_icons.svg
index 7379dee3573..a14f2903b71 100644
--- a/release/datafiles/blender_icons.svg
+++ b/release/datafiles/blender_icons.svg
@@ -92369,7 +92369,7 @@
sodipodi:nodetypes="ccccc"
id="path9152-7-3"
d="M 46.49945,103.49527 V 92.492523 l 10.996287,2.228527 v 6.75793 z"
- style="fill:none;stroke:url(#linearGradient15188);stroke-width:1.0000248px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"/>
+ style="fill:none;stroke:url(#linearGradient15188);stroke-width:1.0000248px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" />
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
@@ -92825,7 +92825,7 @@
</g>
<g
style="display:inline;enable-background:new"
- transform="translate(168.01766,170.03707)"
+ transform="translate(168.01766,128.03044)"
id="ICON_GRID-3"
mask="url(#mask25369-1)">
<rect
@@ -92861,8 +92861,8 @@
inkscape:connector-curvature="0" />
</g>
<g
- style="display:inline;enable-background:new;opacity:0.25"
- transform="translate(188.9552,170.08067)"
+ style="display:inline;opacity:0.25;enable-background:new"
+ transform="translate(188.9552,128.07404)"
id="ICON_GRID-3-7"
mask="url(#mask25369-1-6)">
<rect
@@ -92897,6 +92897,307 @@
id="path36201-6-9"
inkscape:connector-curvature="0" />
</g>
+ <g
+ style="display:inline;enable-background:new"
+ id="g9502">
+ <g
+ transform="translate(-84.000002,1e-5)"
+ id="g10350-2"
+ style="display:inline;enable-background:new">
+ <rect
+ ry="3.0625"
+ rx="3.0625"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ id="rect10334-4"
+ width="10"
+ height="15"
+ x="152.5"
+ y="451.5" />
+ <g
+ transform="translate(-523,-55.999969)"
+ id="g10338-4" />
+ <g
+ id="g8140-7">
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path10340-2"
+ d="M 165.5,459.5 V 454"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ <path
+ sodipodi:open="true"
+ d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454"
+ sodipodi:end="0"
+ sodipodi:start="5.8166094"
+ sodipodi:ry="5.5"
+ sodipodi:rx="9.3798456"
+ sodipodi:cy="454"
+ sodipodi:cx="156.12387"
+ sodipodi:type="arc"
+ id="path10342-8"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke" />
+ <path
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ d="m 167.50001,457.60147 v -4.05761"
+ id="path10344-2"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ </g>
+ <g
+ id="g8200-9">
+ <path
+ transform="translate(-523,-55.99997)"
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ d="m 680.5,513.49997 -0.01,-4.03235"
+ style="display:inline;opacity:0.5;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new"
+ id="path10336-9" />
+ <rect
+ ry="3.0625"
+ rx="3.0625"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ id="rect8195-2"
+ width="10"
+ height="15"
+ x="152.5"
+ y="451.5" />
+ </g>
+ </g>
+ <g
+ transform="translate(-63.000001)"
+ id="g3173"
+ style="display:inline;enable-background:new">
+ <path
+ sodipodi:nodetypes="cssssssc"
+ inkscape:connector-curvature="0"
+ id="rect10312-1"
+ d="m 152.5,459.50001 v 4.0165 c 0,1.65287 1.33066,2.98353 2.98353,2.98353 h 4.03294 c 1.65287,0 2.98353,-1.33066 2.98353,-2.98353 v -9.03297 c 0,-1.65287 -1.33066,-2.98353 -2.98353,-2.98353 H 158.5"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ <path
+ sodipodi:nodetypes="cssscccc"
+ inkscape:connector-curvature="0"
+ id="rect10312-0-4"
+ d="m 156.5,451.50001 h -1.0165 c -0.64696,0 -1.24455,0.20387 -1.73231,0.55112 -0.75838,0.53993 -1.25122,1.4265 -1.25122,2.43241 v 3.01647 l 4.00824,0.008 -0.008,-5.97178 z"
+ style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" />
+ <g
+ transform="translate(0,1e-5)"
+ style="display:inline;enable-background:new"
+ id="g8140-4-9">
+ <path
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ d="M 165.5,459.5 V 454"
+ id="path10340-6-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke"
+ id="path10342-2-8"
+ sodipodi:type="arc"
+ sodipodi:cx="156.12387"
+ sodipodi:cy="454"
+ sodipodi:rx="9.3798456"
+ sodipodi:ry="5.5"
+ sodipodi:start="5.8166094"
+ sodipodi:end="0"
+ d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454"
+ sodipodi:open="true" />
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path10344-4-0"
+ d="m 167.50001,457.60147 v -4.05761"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ </g>
+ </g>
+ <g
+ transform="translate(-63.000001)"
+ id="g3161"
+ style="display:inline;enable-background:new">
+ <rect
+ ry="2.9835341"
+ rx="2.9835341"
+ y="451.50003"
+ x="173.5"
+ height="14.999969"
+ width="10"
+ id="rect10298-7-6"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ <rect
+ style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ id="rect10300-9-6"
+ width="2"
+ height="5.0000005"
+ x="177.5"
+ y="454.5"
+ rx="0.546875"
+ ry="0.546875" />
+ <g
+ id="g8181-5"
+ style="display:inline;enable-background:new"
+ transform="translate(21,1e-5)">
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path8170-5"
+ d="M 165.5,459.5 V 454"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ <path
+ sodipodi:open="true"
+ d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454"
+ sodipodi:end="0"
+ sodipodi:start="5.8166094"
+ sodipodi:ry="5.5"
+ sodipodi:rx="9.3798456"
+ sodipodi:cy="454"
+ sodipodi:cx="156.12387"
+ sodipodi:type="arc"
+ id="path8175-8"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke" />
+ <path
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ d="m 167.50001,457.60147 v -4.05761"
+ id="path8178-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ </g>
+ </g>
+ <g
+ transform="translate(-63.000001)"
+ id="g3149"
+ style="display:inline;enable-background:new">
+ <path
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ d="m 204.49995,459.50001 v 4.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 h 1.01647"
+ id="path10426-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cssssssc" />
+ <path
+ style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new"
+ d="m 200.49995,451.50001 h 1.0165 c 1.65287,0 2.98353,1.33066 2.98353,2.98353 v 3.01647 l -4.00824,0.008 z"
+ id="path10430-1"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cssccc" />
+ <g
+ transform="translate(41.999999,1e-5)"
+ style="display:inline;enable-background:new"
+ id="g8193-3">
+ <path
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ d="M 165.5,459.5 V 454"
+ id="path8185-2"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke"
+ id="path8189-2"
+ sodipodi:type="arc"
+ sodipodi:cx="156.12387"
+ sodipodi:cy="454"
+ sodipodi:rx="9.3798456"
+ sodipodi:ry="5.5"
+ sodipodi:start="5.8166094"
+ sodipodi:end="0"
+ d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454"
+ sodipodi:open="true" />
+ <path
+ sodipodi:nodetypes="cc"
+ inkscape:connector-curvature="0"
+ id="path8191-4"
+ d="m 167.50001,457.60147 v -4.05761"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ </g>
+ </g>
+ <g
+ transform="translate(-648,-55.99996)"
+ id="g8280"
+ style="display:inline;enable-background:new">
+ <rect
+ style="opacity:0;vector-effect:none;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ id="rect8272"
+ width="15.999999"
+ height="15.999999"
+ x="-669"
+ y="506.99997"
+ transform="scale(-1,1)" />
+ <path
+ transform="scale(-1,1)"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ d="m -655.5,515.49997 v 4.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 H -661.5"
+ id="path8274"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cssssssc" />
+ <g
+ id="g8276"
+ transform="translate(-20)" />
+ <path
+ style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new"
+ d="m 659.5,507.49997 h -1.0165 c -0.64696,0 -1.24455,0.20387 -1.73231,0.55112 -0.75838,0.53993 -1.25122,1.4265 -1.25122,2.43241 v 3.01647 l 4.00824,0.008 -0.008,-5.97178 z"
+ id="path8278"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cssscccc" />
+ </g>
+ <g
+ style="display:inline;enable-background:new"
+ id="g8290"
+ transform="translate(-606,-55.99996)">
+ <rect
+ transform="scale(-1,1)"
+ y="506.99997"
+ x="-669"
+ height="15.999999"
+ width="15.999999"
+ id="rect8282"
+ style="opacity:0;vector-effect:none;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ <path
+ sodipodi:nodetypes="cssssssc"
+ inkscape:connector-curvature="0"
+ id="path8284"
+ d="m 665.49995,515.49997 v 4.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 h 1.01647"
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ <g
+ transform="translate(-20)"
+ id="g8286" />
+ <path
+ sodipodi:nodetypes="cssccc"
+ inkscape:connector-curvature="0"
+ id="path8288"
+ d="m 661.49995,507.49997 h 1.0165 c 1.65287,0 2.98353,1.33066 2.98353,2.98353 v 3.01647 l -4.00824,0.008 z"
+ style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" />
+ </g>
+ <g
+ transform="translate(-647,-34.99996)"
+ id="g8300"
+ style="display:inline;enable-background:new">
+ <rect
+ style="opacity:0;vector-effect:none;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ id="rect8292"
+ width="15.999999"
+ height="15.999999"
+ x="673"
+ y="485.99997" />
+ <rect
+ style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"
+ id="rect8294"
+ width="10"
+ height="14.999969"
+ x="675.5"
+ y="486.5"
+ rx="2.9835341"
+ ry="2.9835341" />
+ <rect
+ ry="0.546875"
+ rx="0.546875"
+ y="489.49997"
+ x="679.5"
+ height="5.0000005"
+ width="2"
+ id="rect8296"
+ style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" />
+ <g
+ transform="translate(0,-21)"
+ id="g8298" />
+ </g>
+ </g>
</g>
<g
inkscape:groupmode="layer"
diff --git a/release/datafiles/blender_icons16/icon16_mouse_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_drag.dat
new file mode 100644
index 00000000000..f925ef9e155
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_mouse_lmb.dat b/release/datafiles/blender_icons16/icon16_mouse_lmb.dat
new file mode 100644
index 00000000000..26dc81ea390
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_lmb.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_mouse_lmb_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_lmb_drag.dat
new file mode 100644
index 00000000000..2d71f6e5e24
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_lmb_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_mouse_mmb.dat b/release/datafiles/blender_icons16/icon16_mouse_mmb.dat
new file mode 100644
index 00000000000..703f0ed2795
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_mmb.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_mouse_mmb_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_mmb_drag.dat
new file mode 100644
index 00000000000..685a2bc3a1f
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_mmb_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_mouse_move.dat b/release/datafiles/blender_icons16/icon16_mouse_move.dat
new file mode 100644
index 00000000000..2767722211b
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_move.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_mouse_rmb.dat b/release/datafiles/blender_icons16/icon16_mouse_rmb.dat
new file mode 100644
index 00000000000..5179fa2487f
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_rmb.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_mouse_rmb_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_rmb_drag.dat
new file mode 100644
index 00000000000..8292197e06b
--- /dev/null
+++ b/release/datafiles/blender_icons16/icon16_mouse_rmb_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_restrict_view_off.dat b/release/datafiles/blender_icons16/icon16_restrict_view_off.dat
index 320c1be5259..78e529fdf75 100644
--- a/release/datafiles/blender_icons16/icon16_restrict_view_off.dat
+++ b/release/datafiles/blender_icons16/icon16_restrict_view_off.dat
Binary files differ
diff --git a/release/datafiles/blender_icons16/icon16_restrict_view_on.dat b/release/datafiles/blender_icons16/icon16_restrict_view_on.dat
index 279d744a012..24d58a126a3 100644
--- a/release/datafiles/blender_icons16/icon16_restrict_view_on.dat
+++ b/release/datafiles/blender_icons16/icon16_restrict_view_on.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_drag.dat
new file mode 100644
index 00000000000..ef137d3b2ae
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_lmb.dat b/release/datafiles/blender_icons32/icon32_mouse_lmb.dat
new file mode 100644
index 00000000000..8b26ccf1f87
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_lmb.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_lmb_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_lmb_drag.dat
new file mode 100644
index 00000000000..f6d7cca095b
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_lmb_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_mmb.dat b/release/datafiles/blender_icons32/icon32_mouse_mmb.dat
new file mode 100644
index 00000000000..59312073226
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_mmb.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_mmb_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_mmb_drag.dat
new file mode 100644
index 00000000000..79c96a08dd3
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_mmb_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_move.dat b/release/datafiles/blender_icons32/icon32_mouse_move.dat
new file mode 100644
index 00000000000..51aff1f445c
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_move.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_rmb.dat b/release/datafiles/blender_icons32/icon32_mouse_rmb.dat
new file mode 100644
index 00000000000..10e10b0d755
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_rmb.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_mouse_rmb_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_rmb_drag.dat
new file mode 100644
index 00000000000..6dff7737ba0
--- /dev/null
+++ b/release/datafiles/blender_icons32/icon32_mouse_rmb_drag.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_restrict_view_off.dat b/release/datafiles/blender_icons32/icon32_restrict_view_off.dat
index ec850df393e..c5cfc01e38e 100644
--- a/release/datafiles/blender_icons32/icon32_restrict_view_off.dat
+++ b/release/datafiles/blender_icons32/icon32_restrict_view_off.dat
Binary files differ
diff --git a/release/datafiles/blender_icons32/icon32_restrict_view_on.dat b/release/datafiles/blender_icons32/icon32_restrict_view_on.dat
index 07e66cc51a9..3512212c209 100644
--- a/release/datafiles/blender_icons32/icon32_restrict_view_on.dat
+++ b/release/datafiles/blender_icons32/icon32_restrict_view_on.dat
Binary files differ
diff --git a/release/datafiles/preview.blend b/release/datafiles/preview.blend
index c22245eacc5..7e30e2dcf00 100644
--- a/release/datafiles/preview.blend
+++ b/release/datafiles/preview.blend
Binary files differ
diff --git a/release/datafiles/preview_cycles.blend b/release/datafiles/preview_cycles.blend
index ed32ea530d6..60c0ed5f763 100644
--- a/release/datafiles/preview_cycles.blend
+++ b/release/datafiles/preview_cycles.blend
Binary files differ
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
new file mode 100644
index 00000000000..f26ace08ed5
--- /dev/null
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -0,0 +1,1076 @@
+/*
+ * Generated by 'source/tools/utils/blender_theme_as_c.py'
+ *
+ * Do not hand edit this file!
+ */
+
+#include "DNA_userdef_types.h"
+
+#include "BLO_readfile.h"
+
+#ifdef __LITTLE_ENDIAN__
+# define RGBA(c) {((c) >> 24) & 0xff, ((c) >> 16) & 0xff, ((c) >> 8) & 0xff, (c) & 0xff}
+# define RGB(c) {((c) >> 16) & 0xff, ((c) >> 8) & 0xff, (c) & 0xff}
+#else
+# define RGBA(c) {(c) & 0xff, ((c) >> 8) & 0xff, ((c) >> 16) & 0xff, ((c) >> 24) & 0xff}
+# define RGB(c) {(c) & 0xff, ((c) >> 8) & 0xff, ((c) >> 16) & 0xff}
+#endif
+
+const bTheme U_theme_default = {
+ .name = "Default",
+ .tui = {
+ .wcol_regular = {
+ .outline = RGBA(0x38393eff),
+ .inner = RGBA(0x505158ff),
+ .inner_sel = RGBA(0x80858aff),
+ .item = RGBA(0x38393eff),
+ .text = RGBA(0xebebebff),
+ .text_sel = RGBA(0xffffffff),
+ .shadedown = -5,
+ .roundness = 0.2f,
+ },
+ .wcol_tool = {
+ .outline = RGBA(0x2f2f34ff),
+ .inner = RGBA(0x505158ff),
+ .inner_sel = RGBA(0x2f2f34ff),
+ .item = RGBA(0xe6ebffff),
+ .text = RGBA(0xf2f2f2ff),
+ .text_sel = RGBA(0xffffffff),
+ .shadedown = -5,
+ .roundness = 0.2f,
+ },
+ .wcol_toolbar_item = {
+ .outline = RGBA(0x191919ff),
+ .inner = RGBA(0x505158ff),
+ .inner_sel = RGBA(0x2d2d33ff),
+ .item = RGBA(0x191919ff),
+ .text = RGBA(0xffffffff),
+ .text_sel = RGBA(0xffffffff),
+ .roundness = 0.25f,
+ },
+ .wcol_text = {
+ .outline = RGBA(0x43454dff),
+ .inner = RGBA(0x2d2e33ff),
+ .inner_sel = RGBA(0x717280ff),
+ .item = RGBA(0x599eb3ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shaded = 1,
+ .shadetop = -3,
+ .roundness = 0.2f,
+ },
+ .wcol_radio = {
+ .outline = RGBA(0x424352ff),
+ .inner = RGBA(0x505158ff),
+ .inner_sel = RGBA(0x2d2d33ff),
+ .item = RGBA(0xffffffff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shadetop = 5,
+ .shadedown = -5,
+ .roundness = 0.2f,
+ },
+ .wcol_option = {
+ .outline = RGBA(0x424352ff),
+ .inner = RGBA(0x5c5c66cc),
+ .inner_sel = RGBA(0x70707cff),
+ .item = RGBA(0xffffffff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shadedown = -15,
+ .roundness = 0.25f,
+ },
+ .wcol_toggle = {
+ .outline = RGBA(0x43434dff),
+ .inner = RGBA(0x595966ff),
+ .inner_sel = RGBA(0x3f7d80ff),
+ .item = RGBA(0x191919ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .roundness = 0.25f,
+ },
+ .wcol_num = {
+ .outline = RGBA(0x46464dff),
+ .inner = RGBA(0x505158ff),
+ .inner_sel = RGBA(0x3f7780ff),
+ .item = RGBA(0x46464dff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shaded = 1,
+ .roundness = 0.3f,
+ },
+ .wcol_numslider = {
+ .outline = RGBA(0x46464dff),
+ .inner = RGBA(0x3f3f47ff),
+ .inner_sel = RGBA(0x3f7780ff),
+ .item = RGBA(0x505158ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shaded = 1,
+ .shadetop = -4,
+ .roundness = 0.4f,
+ },
+ .wcol_tab = {
+ .outline = RGBA(0x28292dff),
+ .inner = RGBA(0x323239ff),
+ .inner_sel = RGBA(0x43444bff),
+ .item = RGBA(0x28292dff),
+ .text = RGBA(0xbebebeff),
+ .text_sel = RGBA(0xffffffff),
+ .roundness = 0.15f,
+ },
+ .wcol_menu = {
+ .outline = RGBA(0x43454dff),
+ .inner = RGBA(0x29282eff),
+ .inner_sel = RGBA(0x505158ff),
+ .item = RGBA(0xe6e6e6ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xccccccff),
+ .shadetop = 10,
+ .shadedown = -10,
+ .roundness = 0.2f,
+ },
+ .wcol_pulldown = {
+ .outline = RGBA(0x43454dff),
+ .inner = RGBA(0x29282e99),
+ .inner_sel = RGBA(0x505158ff),
+ .item = RGBA(0x696a72ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shadetop = 25,
+ .shadedown = -20,
+ .roundness = 0.2f,
+ },
+ .wcol_menu_back = {
+ .outline = RGBA(0x29282eff),
+ .inner = RGBA(0x1f1f1fef),
+ .inner_sel = RGBA(0x505158ff),
+ .item = RGBA(0x696a72ff),
+ .text = RGBA(0xb3b3b3ff),
+ .text_sel = RGBA(0xffffffff),
+ .shadetop = 25,
+ .shadedown = -20,
+ .roundness = 0.25f,
+ },
+ .wcol_menu_item = {
+ .inner_sel = RGBA(0x505158ff),
+ .item = RGBA(0xacacac80),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shadetop = 38,
+ .roundness = 0.25f,
+ },
+ .wcol_tooltip = {
+ .outline = RGBA(0x2f3035ff),
+ .inner = RGBA(0x19191aef),
+ .inner_sel = RGBA(0x19191aef),
+ .item = RGBA(0x19191aef),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shadetop = 25,
+ .shadedown = -20,
+ .roundness = 0.25f,
+ },
+ .wcol_box = {
+ .outline = RGBA(0x2d2e33ff),
+ .inner = RGBA(0x43454dff),
+ .inner_sel = RGBA(0x3f7780ff),
+ .item = RGBA(0x191919ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .roundness = 0.2f,
+ },
+ .wcol_scroll = {
+ .outline = RGBA(0x2f3035ff),
+ .inner = RGBA(0x585a6700),
+ .inner_sel = RGBA(0x599eb3ff),
+ .item = RGBA(0x585a67ff),
+ .text = RGBA(0xffffffff),
+ .text_sel = RGBA(0xffffffff),
+ .shadetop = 5,
+ .shadedown = -5,
+ .roundness = 0.5f,
+ },
+ .wcol_progress = {
+ .outline = RGBA(0xb3b3b3ff),
+ .inner = RGBA(0xccccccff),
+ .inner_sel = RGBA(0x646464b4),
+ .item = RGBA(0x599eb3ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .roundness = 0.25f,
+ },
+ .wcol_list_item = {
+ .outline = RGBA(0x28292dff),
+ .inner = RGBA(0x28292d00),
+ .inner_sel = RGBA(0x5f616fff),
+ .item = RGBA(0x599eb3ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .roundness = 0.2f,
+ },
+ .wcol_pie_menu = {
+ .outline = RGBA(0x29282eff),
+ .inner = RGBA(0x29282eff),
+ .inner_sel = RGBA(0x505158ff),
+ .item = RGBA(0x696a72ff),
+ .text = RGBA(0xeeeeeeff),
+ .text_sel = RGBA(0xffffffff),
+ .shadetop = 10,
+ .shadedown = -10,
+ .roundness = 0.5f,
+ },
+ .wcol_state = {
+ .inner_anim = RGBA(0x73be4cff),
+ .inner_anim_sel = RGBA(0x5aa633ff),
+ .inner_key = RGBA(0xf0eb64ff),
+ .inner_key_sel = RGBA(0xd7d34bff),
+ .inner_driven = RGBA(0xb400ffff),
+ .inner_driven_sel = RGBA(0x9900e6ff),
+ .blend = 0.5f,
+ },
+ .widget_emboss = RGBA(0x00000005),
+ .menu_shadow_fac = 0.3f,
+ .menu_shadow_width = 4,
+ .editor_outline = RGBA(0x1c1d20ff),
+ .icon_alpha = 1.0f,
+ .icon_saturation = 0.4f,
+ .xaxis = RGBA(0xff3352ff),
+ .yaxis = RGBA(0x8bdc00ff),
+ .zaxis = RGBA(0x2890ffff),
+ .manipulator_hi = RGBA(0xffffffff),
+ .manipulator_primary = RGBA(0xf5f14dff),
+ .manipulator_secondary = RGBA(0x63ffffff),
+ .manipulator_a = RGBA(0x4da84dff),
+ .manipulator_b = RGBA(0xa33535ff),
+ },
+ .tbuts = {
+ .back = RGBA(0x3a3c4200),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ },
+ .tv3d = {
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c4200),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303500),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .gradients = {
+ .gradient = RGBA(0x2d2d2e00),
+ .high_gradient = RGBA(0x474748ff),
+ .show_grad = 1,
+ },
+ .grid = RGBA(0x1f1f23ff),
+ .wire = RGBA(0x000000ff),
+ .wire_edit = RGBA(0x111111ff),
+ .select = RGBA(0xed5700ff),
+ .lamp = RGBA(0x000000ff),
+ .speaker = RGBA(0x000000ff),
+ .empty = RGBA(0x000000ff),
+ .camera = RGBA(0x000000ff),
+ .active = RGBA(0xffa028ff),
+ .transform = RGBA(0xffffffff),
+ .vertex = RGBA(0x000000ff),
+ .vertex_select = RGBA(0xff8500ff),
+ .vertex_bevel = RGBA(0x00a5ffff),
+ .edge = RGBA(0x000000ff),
+ .edge_select = RGBA(0xffa000ff),
+ .edge_seam = RGBA(0xdb2512ff),
+ .edge_sharp = RGBA(0x00ffffff),
+ .edge_facesel = RGBA(0x4b4b4bff),
+ .edge_crease = RGBA(0xcc0099ff),
+ .edge_bevel = RGBA(0x00a5ffff),
+ .face = RGBA(0x00000012),
+ .face_select = RGBA(0xff85004d),
+ .face_dot = RGBA(0xff8500ff),
+ .extra_edge_len = RGBA(0x150806ff),
+ .extra_edge_angle = RGBA(0x4d4d00ff),
+ .extra_face_angle = RGBA(0x0000ccff),
+ .extra_face_area = RGBA(0x004d00ff),
+ .normal = RGBA(0x22ddddff),
+ .vertex_normal = RGBA(0x2361ddff),
+ .loop_normal = RGBA(0xdd23ddff),
+ .bone_solid = RGBA(0xc8c8c8ff),
+ .bone_pose = RGBA(0x50c8ff50),
+ .bone_pose_active = RGBA(0x8cffff50),
+ .cframe = RGBA(0x60c040ff),
+ .time_keyframe = RGBA(0xddd700ff),
+ .time_gp_keyframe = RGBA(0xb5e61dff),
+ .freestyle_edge_mark = RGBA(0x7fff7fff),
+ .freestyle_face_mark = RGBA(0x7fff7f33),
+ .nurb_uline = RGBA(0x909000ff),
+ .nurb_vline = RGBA(0x803060ff),
+ .act_spline = RGBA(0xdb2512ff),
+ .nurb_sel_uline = RGBA(0xf0ff40ff),
+ .nurb_sel_vline = RGBA(0xf090a0ff),
+ .lastsel_point = RGBA(0xffffffff),
+ .handle_free = RGBA(0x000000ff),
+ .handle_auto = RGBA(0x909000ff),
+ .handle_vect = RGBA(0x409030ff),
+ .handle_align = RGBA(0x803060ff),
+ .handle_sel_free = RGBA(0x000000ff),
+ .handle_sel_auto = RGBA(0xf0ff40ff),
+ .handle_sel_vect = RGBA(0x40c030ff),
+ .handle_sel_align = RGBA(0xf090a0ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 3,
+ .editmesh_active = RGBA(0xffffff80),
+ .clipping_border_3d = RGBA(0x313131ff),
+ .bundle_solid = RGBA(0xc8c8c8ff),
+ .camera_path = RGBA(0x000000ff),
+ .gp_vertex_size = 3,
+ .gp_vertex = RGBA(0x000000ff),
+ .gp_vertex_select = RGBA(0xff8500ff),
+ .skin_root = RGBA(0xb44d4dff),
+ .paint_curve_pivot = RGBA(0xff7f7f7f),
+ .paint_curve_handle = RGBA(0x7fff7f7f),
+ },
+ .tfile = {
+ .back = RGBA(0x2f303500),
+ .title = RGBA(0xffffffff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x29282eff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .hilite = RGBA(0x5b8199ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ },
+ .tipo = {
+ .back = RGBA(0x2f303500),
+ .title = RGBA(0xffffffff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x29282eff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .list = RGBA(0x29282eff),
+ .list_title = RGBA(0xffffffff),
+ .list_text = RGBA(0xccccccff),
+ .list_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .shade1 = RGBA(0x96969600),
+ .shade2 = RGBA(0x29282e64),
+ .grid = RGBA(0x17171aff),
+ .group = RGBA(0x247f0dff),
+ .group_active = RGBA(0x46a431ff),
+ .vertex_select = RGBA(0xff8500ff),
+ .cframe = RGBA(0x308837ff),
+ .lastsel_point = RGBA(0xffffffff),
+ .handle_auto = RGBA(0x909000ff),
+ .handle_vect = RGBA(0x409030ff),
+ .handle_align = RGBA(0x803060ff),
+ .handle_auto_clamped = RGBA(0x994030ff),
+ .handle_sel_auto = RGBA(0xf0ff40ff),
+ .handle_sel_vect = RGBA(0x40c030ff),
+ .handle_sel_align = RGBA(0xf090a0ff),
+ .handle_sel_auto_clamped = RGBA(0xf0af90ff),
+ .ds_channel = RGBA(0x26537fff),
+ .ds_subchannel = RGBA(0x6a90b2ff),
+ .vertex_size = 6,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .handle_vertex_select = RGBA(0xff8500ff),
+ .handle_vertex_size = 5,
+ },
+ .tinfo = {
+ .back = RGBA(0x3a3c4200),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .info_selected = RGBA(0x6080ffff),
+ .info_selected_text = RGBA(0xffffffff),
+ .info_error = RGBA(0x990000ff),
+ .info_error_text = RGBA(0xffffffff),
+ .info_warning = RGBA(0xb36a00ff),
+ .info_warning_text = RGBA(0xffffffff),
+ .info_info = RGBA(0x668000ff),
+ .info_info_text = RGBA(0xffffffff),
+ .info_debug = RGBA(0xd3d3d3ff),
+ },
+ .tact = {
+ .back = RGBA(0x3a3c4200),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .list = RGBA(0x29282eff),
+ .list_title = RGBA(0xd8d8d8ff),
+ .list_text = RGBA(0xffffffff),
+ .list_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .shade1 = RGBA(0xc0c0c000),
+ .shade2 = RGBA(0x70707064),
+ .hilite = RGBA(0x60c040ff),
+ .grid = RGBA(0x17171aff),
+ .group = RGBA(0x278c0eff),
+ .group_active = RGBA(0x4eb335ff),
+ .strip = RGBA(0x1a151580),
+ .strip_select = RGBA(0xff8c00ff),
+ .cframe = RGBA(0x308837ff),
+ .ds_channel = RGBA(0x2e6399ff),
+ .ds_subchannel = RGBA(0x5a7996ff),
+ .keytype_keyframe = RGBA(0xe8e8e8ff),
+ .keytype_extreme = RGBA(0xe8b3ccff),
+ .keytype_breakdown = RGBA(0xb3dbe8ff),
+ .keytype_jitter = RGBA(0x94e575ff),
+ .keytype_keyframe_select = RGBA(0xffbe33ff),
+ .keytype_extreme_select = RGBA(0xf28080ff),
+ .keytype_breakdown_select = RGBA(0x54bfedff),
+ .keytype_jitter_select = RGBA(0x61c042ff),
+ .keyborder = RGBA(0x000000ff),
+ .keyborder_select = RGBA(0x000000ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .keyframe_scale_fac = 1.0f,
+ .handle_vertex_size = 4,
+ .anim_active = RGBA(0x66310066),
+ },
+ .tnla = {
+ .back = RGBA(0x2f303500),
+ .title = RGBA(0xffffffff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x29282eff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .list = RGBA(0x29282eff),
+ .list_title = RGBA(0xffffffff),
+ .list_text = RGBA(0xccccccff),
+ .list_text_hi = RGBA(0xccccccff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .shade1 = RGBA(0x96969600),
+ .grid = RGBA(0x5e5e5eff),
+ .strip = RGBA(0x0c0a0a80),
+ .strip_select = RGBA(0xff8c00ff),
+ .cframe = RGBA(0x308837ff),
+ .keyborder = RGBA(0x000000ff),
+ .keyborder_select = RGBA(0x000000ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .handle_vertex_size = 4,
+ .anim_active = RGBA(0xcc701a66),
+ .anim_non_active = RGBA(0x9987614d),
+ .nla_tweaking = RGBA(0x4df31a4d),
+ .nla_tweakdupli = RGBA(0xd90000ff),
+ .nla_transition = RGBA(0x1c2630ff),
+ .nla_transition_sel = RGBA(0x2e75dbff),
+ .nla_meta = RGBA(0x332642ff),
+ .nla_meta_sel = RGBA(0x692196ff),
+ .nla_sound = RGBA(0x2b3d3dff),
+ .nla_sound_sel = RGBA(0x1f7a7aff),
+ },
+ .tseq = {
+ .back = RGBA(0x3a3c4200),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .shade1 = RGBA(0xa0a0a000),
+ .grid = RGBA(0x404040ff),
+ .vertex_select = RGBA(0xff8500ff),
+ .bone_pose = RGBA(0x50c8ff50),
+ .cframe = RGBA(0x308837ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .movie = RGBA(0x516987ff),
+ .movieclip = RGBA(0x20208fff),
+ .image = RGBA(0x6d5881ff),
+ .scene = RGBA(0x4e983eff),
+ .audio = RGBA(0x2e8f8fff),
+ .effect = RGBA(0xa9547cff),
+ .transition = RGBA(0xa25f6fff),
+ .meta = RGBA(0x6d9183ff),
+ .text_strip = RGBA(0xa29700ff),
+ .gp_vertex_size = 3,
+ .gp_vertex_select = RGBA(0xff8500ff),
+ .metadatatext = RGBA(0xffffffff),
+ },
+ .tima = {
+ .back = RGBA(0x44444400),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .wire_edit = RGBA(0xc0c0c0ff),
+ .vertex_select = RGBA(0xff8500ff),
+ .edge_select = RGBA(0xff8500ff),
+ .face = RGBA(0xffffff0a),
+ .face_select = RGBA(0xff85003c),
+ .face_dot = RGBA(0xff8500ff),
+ .cframe = RGBA(0x60c040ff),
+ .freestyle_face_mark = RGBA(0x7fff7f33),
+ .handle_auto = RGBA(0x909000ff),
+ .handle_align = RGBA(0x803060ff),
+ .handle_sel_auto = RGBA(0xf0ff40ff),
+ .handle_sel_align = RGBA(0xf090a0ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 3,
+ .editmesh_active = RGBA(0xffffff80),
+ .handle_vertex_select = RGBA(0xffff00ff),
+ .handle_vertex_size = 5,
+ .gp_vertex_size = 3,
+ .gp_vertex_select = RGBA(0xff8500ff),
+ .preview_back = RGBA(0x727272ff),
+ .preview_stitch_face = RGBA(0x7f7f0033),
+ .preview_stitch_edge = RGBA(0xff00ff33),
+ .preview_stitch_vert = RGBA(0x0000ff33),
+ .preview_stitch_stitchable = RGBA(0x00ff00ff),
+ .preview_stitch_unstitchable = RGBA(0xff0000ff),
+ .preview_stitch_active = RGBA(0xe1d2c323),
+ .uv_shadow = RGBA(0x707070ff),
+ .uv_others = RGBA(0x606060ff),
+ .paint_curve_pivot = RGBA(0xff7f7f7f),
+ .paint_curve_handle = RGBA(0x7fff7f7f),
+ .metadatatext = RGBA(0xffffffff),
+ },
+ .text = {
+ .back = RGBA(0x22242700),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .shade2 = RGBA(0x19191aff),
+ .hilite = RGBA(0xff0000ff),
+ .grid = RGBA(0x313133ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .syntaxl = RGBA(0xf6e162ff),
+ .syntaxs = RGBA(0xff734dff),
+ .syntaxb = RGBA(0xff1961ff),
+ .syntaxn = RGBA(0x50dbffff),
+ .syntaxv = RGBA(0x95d600ff),
+ .syntaxc = RGBA(0x939393ff),
+ .syntaxd = RGBA(0xad80ffff),
+ .syntaxr = RGBA(0xc4753bff),
+ },
+ .toops = {
+ .back = RGBA(0x3a3c4200),
+ .title = RGBA(0xffffffff),
+ .text = RGBA(0xdededeff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3f3f45ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .match = RGBA(0x337f334c),
+ .selected_highlight = RGBA(0x747a834c),
+ },
+ .ttime = {
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ },
+ .tnode = {
+ .back = RGBA(0x2a2c3200),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .list = RGBA(0x29282eff),
+ .list_title = RGBA(0xffffffff),
+ .list_text = RGBA(0xccccccff),
+ .list_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .shade2 = RGBA(0x7f707064),
+ .wire = RGBA(0x808080ff),
+ .select = RGBA(0x099be6ff),
+ .active = RGBA(0xffffffff),
+ .edge_select = RGBA(0xffffffff),
+ .console_output = RGBA(0xdfc300ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .syntaxl = RGBA(0x5a5c66ff),
+ .syntaxs = RGBA(0x977474ff),
+ .syntaxb = RGBA(0xffcb4dff),
+ .syntaxn = RGBA(0xff6675ff),
+ .syntaxv = RGBA(0x66c4ffff),
+ .syntaxc = RGBA(0x59b36aff),
+ .syntaxd = RGBA(0x749797ff),
+ .syntaxr = RGBA(0x808080ff),
+ .nodeclass_output = RGBA(0xff6675ff),
+ .nodeclass_filter = RGBA(0x6c696fff),
+ .nodeclass_vector = RGBA(0x9999ffff),
+ .nodeclass_texture = RGBA(0xffc399ff),
+ .nodeclass_shader = RGBA(0xa7ff99ff),
+ .nodeclass_script = RGBA(0x6c696fff),
+ .nodeclass_pattern = RGBA(0x6c696fff),
+ .nodeclass_layout = RGBA(0x6c696fff),
+ .movie = RGBA(0x9b9b9ba0),
+ .gp_vertex_size = 3,
+ .gp_vertex_select = RGBA(0xff8500ff),
+ },
+ .tuserpref = {
+ .back = RGBA(0x3a3c4200),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ },
+ .tconsole = {
+ .back = RGBA(0x22242700),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .console_output = RGBA(0xb3c2ffff),
+ .console_input = RGBA(0xffffffff),
+ .console_info = RGBA(0x47b347ff),
+ .console_error = RGBA(0xde6f6fff),
+ .console_cursor = RGBA(0xde5959ff),
+ .console_select = RGBA(0xffffff30),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ },
+ .tclip = {
+ .back = RGBA(0x3a3c4200),
+ .title = RGBA(0xeeeeeeff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x3a3c42ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .list = RGBA(0x666666ff),
+ .list_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .strip = RGBA(0x0c0a0a80),
+ .strip_select = RGBA(0xff8c00ff),
+ .cframe = RGBA(0x308837ff),
+ .handle_auto = RGBA(0x909000ff),
+ .handle_align = RGBA(0x803060ff),
+ .handle_sel_auto = RGBA(0xf0ff40ff),
+ .handle_sel_align = RGBA(0xf090a0ff),
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .handle_vertex_select = RGBA(0xffff00ff),
+ .handle_vertex_size = 5,
+ .marker = RGBA(0x7f7f00ff),
+ .act_marker = RGBA(0xffffffff),
+ .sel_marker = RGBA(0xffff00ff),
+ .dis_marker = RGBA(0x7f0000ff),
+ .lock_marker = RGBA(0x7f7f7fff),
+ .path_before = RGBA(0xff0000ff),
+ .path_after = RGBA(0x0000ffff),
+ .gp_vertex_size = 1,
+ },
+ .ttopbar = {
+ .back = RGBA(0x43444b00),
+ .title = RGBA(0xffffffff),
+ .text = RGBA(0xffffffff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x1f1f23ff),
+ .header_text = RGBA(0xeeeeeeff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f303599),
+ .button_title = RGBA(0xffffffff),
+ .button_text = RGBA(0xffffffff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .gp_vertex_size = 3,
+ },
+ .tstatusbar = {
+ .back = RGBA(0x29282e00),
+ .title = RGBA(0xe4e8ffff),
+ .text = RGBA(0x747a83ff),
+ .text_hi = RGBA(0xffffffff),
+ .header = RGBA(0x1f1f23ff),
+ .header_text = RGBA(0x959eaaff),
+ .header_text_hi = RGBA(0xffffffff),
+ .tab_active = RGBA(0x43444bff),
+ .tab_inactive = RGBA(0x323239ff),
+ .tab_back = RGBA(0x1f1f23ff),
+ .tab_outline = RGBA(0x28292dff),
+ .button = RGBA(0x2f3035ff),
+ .button_text_hi = RGBA(0xffffffff),
+ .panelcolors = {
+ .header = RGBA(0x3a3c42cc),
+ .back = RGBA(0x2c2e33b3),
+ .sub_back = RGBA(0x0000003e),
+ .show_header = 1,
+ .show_back = 1,
+ },
+ .vertex_size = 3,
+ .outline_width = 1,
+ .facedot_size = 4,
+ .gp_vertex_size = 3,
+ },
+ .tarm = {
+ {
+ .solid = RGBA(0x9a0000ff),
+ .select = RGBA(0xbd1111ff),
+ .active = RGBA(0xf70a0aff),
+ },
+ {
+ .solid = RGBA(0xf74018ff),
+ .select = RGBA(0xf66913ff),
+ .active = RGBA(0xfa9900ff),
+ },
+ {
+ .solid = RGBA(0x1e9109ff),
+ .select = RGBA(0x59b70bff),
+ .active = RGBA(0x83ef1dff),
+ },
+ {
+ .solid = RGBA(0x0a3694ff),
+ .select = RGBA(0x3667dfff),
+ .active = RGBA(0x5ec1efff),
+ },
+ {
+ .solid = RGBA(0xa9294eff),
+ .select = RGBA(0xc1416aff),
+ .active = RGBA(0xf05d91ff),
+ },
+ {
+ .solid = RGBA(0x430c78ff),
+ .select = RGBA(0x543aa3ff),
+ .active = RGBA(0x8764d5ff),
+ },
+ {
+ .solid = RGBA(0x24785aff),
+ .select = RGBA(0x3c9579ff),
+ .active = RGBA(0x6fb6abff),
+ },
+ {
+ .solid = RGBA(0x4b707cff),
+ .select = RGBA(0x6a8691ff),
+ .active = RGBA(0x9bc2cdff),
+ },
+ {
+ .solid = RGBA(0xf4c90cff),
+ .select = RGBA(0xeec236ff),
+ .active = RGBA(0xf3ff00ff),
+ },
+ {
+ .solid = RGBA(0x1e2024ff),
+ .select = RGBA(0x484c56ff),
+ .active = RGBA(0xffffffff),
+ },
+ {
+ .solid = RGBA(0x6f2f6aff),
+ .select = RGBA(0x9845beff),
+ .active = RGBA(0xd330d6ff),
+ },
+ {
+ .solid = RGBA(0x6c8e22ff),
+ .select = RGBA(0x7fb022ff),
+ .active = RGBA(0xbbef5bff),
+ },
+ {
+ .solid = RGBA(0x8d8d8dff),
+ .select = RGBA(0xb0b0b0ff),
+ .active = RGBA(0xdededeff),
+ },
+ {
+ .solid = RGBA(0x834326ff),
+ .select = RGBA(0x8b5811ff),
+ .active = RGBA(0xbd6a11ff),
+ },
+ {
+ .solid = RGBA(0x08310eff),
+ .select = RGBA(0x1c430bff),
+ .active = RGBA(0x34622bff),
+ },
+ {
+ .solid = RGBA(0x000000ff),
+ .select = RGBA(0x000000ff),
+ .active = RGBA(0x000000ff),
+ },
+ {
+ .solid = RGBA(0x000000ff),
+ .select = RGBA(0x000000ff),
+ .active = RGBA(0x000000ff),
+ },
+ {
+ .solid = RGBA(0x000000ff),
+ .select = RGBA(0x000000ff),
+ .active = RGBA(0x000000ff),
+ },
+ {
+ .solid = RGBA(0x000000ff),
+ .select = RGBA(0x000000ff),
+ .active = RGBA(0x000000ff),
+ },
+ {
+ .solid = RGBA(0x000000ff),
+ .select = RGBA(0x000000ff),
+ .active = RGBA(0x000000ff),
+ },
+ },
+};
diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
index c8f62801af9..b811c1c7d71 100644
--- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
+++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py
@@ -163,7 +163,7 @@ class SpellChecker:
"rolloff",
"runtime",
"scanline",
- "screencast", "screenshot", "screenshots",
+ "screenshot", "screenshots",
"seekability",
"selfcollision",
"shadowbuffer", "shadowbuffers",
diff --git a/release/scripts/modules/bpy/utils/previews.py b/release/scripts/modules/bpy/utils/previews.py
index 568116b027c..a3baf8f878c 100644
--- a/release/scripts/modules/bpy/utils/previews.py
+++ b/release/scripts/modules/bpy/utils/previews.py
@@ -37,7 +37,7 @@ __all__ = (
"new",
"remove",
"ImagePreviewCollection",
- )
+)
import _bpy
_utils_previews = _bpy._utils_previews
@@ -76,9 +76,9 @@ class ImagePreviewCollection(dict):
return
raise ResourceWarning(
- "<%s id=%s[%d]>: left open, remove with "
- "'bpy.utils.previews.remove()'" %
- (self.__class__.__name__, self._uuid, len(self)))
+ f"{self!r}: left open, remove with "
+ "'bpy.utils.previews.remove()'"
+ )
self.close()
def _gen_key(self, name):
@@ -86,17 +86,17 @@ class ImagePreviewCollection(dict):
def new(self, name):
if name in self:
- raise KeyError("key %r already exists" % name)
+ raise KeyError(f"key {name!r} already exists")
p = self[name] = _utils_previews.new(
- self._gen_key(name))
+ self._gen_key(name))
return p
new.__doc__ = _utils_previews.new.__doc__
def load(self, name, path, path_type, force_reload=False):
if name in self:
- raise KeyError("key %r already exists" % name)
+ raise KeyError("key {name!r} already exists")
p = self[name] = _utils_previews.load(
- self._gen_key(name), path, path_type, force_reload)
+ self._gen_key(name), path, path_type, force_reload)
return p
load.__doc__ = _utils_previews.load.__doc__
@@ -116,11 +116,7 @@ class ImagePreviewCollection(dict):
super().__delitem__(key)
def __repr__(self):
- return "<%s id=%s[%d], %s>" % (
- self.__class__.__name__,
- self._uuid,
- len(self),
- super().__repr__())
+ return f"<{self.__class__.__name__:s} id={self._uuid:s}[{len(self):d}], {super()!r}>"
def new():
@@ -149,5 +145,6 @@ import atexit
def exit_clear_warning():
del ImagePreviewCollection.__del__
+
atexit.register(exit_clear_warning)
del atexit, exit_clear_warning
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 6cca60bd49e..ee49e8a6630 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -969,7 +969,8 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
# helper function for (optionally) collapsed header menus
# only usable within headers
if context.area.show_menus:
- cls.draw_menus(layout, context)
+ # Align menus to space them closely.
+ cls.draw_menus(layout.row(align=True), context)
else:
layout.menu(cls.__name__, icon='COLLAPSEMENU')
diff --git a/release/scripts/modules/keyingsets_utils.py b/release/scripts/modules/keyingsets_utils.py
index 48071117bd4..470bb7258f9 100644
--- a/release/scripts/modules/keyingsets_utils.py
+++ b/release/scripts/modules/keyingsets_utils.py
@@ -258,4 +258,3 @@ def RKS_GEN_bendy_bones(ksi, context, ks, data):
ks.paths.add(id_block, path, group_method='NAMED', group_name=grouping)
else:
ks.paths.add(id_block, path)
-
diff --git a/release/scripts/presets/interface_theme/flatty_dark_blueberry.xml b/release/scripts/presets/interface_theme/blender_27x.xml
index eb6c8e68511..6a78dd5fc8f 100644
--- a/release/scripts/presets/interface_theme/flatty_dark_blueberry.xml
+++ b/release/scripts/presets/interface_theme/blender_27x.xml
@@ -1,105 +1,105 @@
<bpy>
<Theme>
<user_interface>
- <ThemeUserInterface menu_shadow_fac="0.3"
- menu_shadow_width="4"
+ <ThemeUserInterface menu_shadow_fac="0.5"
+ menu_shadow_width="12"
icon_file=""
icon_alpha="1"
- icon_saturation="0.4"
- widget_emboss="#00000005"
- editor_outline="#1c1d20"
- axis_x="#dc4242"
- axis_y="#42dc42"
- axis_z="#4242dc"
+ icon_saturation="1"
+ widget_emboss="#ffffff05"
+ editor_outline="#3f3f3f"
+ axis_x="#dc0000"
+ axis_y="#00dc00"
+ axis_z="#0000dc"
manipulator_hi="#ffffff"
- manipulator_primary="#e3ff33"
- manipulator_secondary="#33ffff"
+ manipulator_primary="#deff0d"
+ manipulator_secondary="#00ffff"
manipulator_a="#177f17"
manipulator_b="#7f1717">
<wcol_regular>
- <ThemeWidgetColors outline="#38393e"
- inner="#505158ff"
- inner_sel="#407180ff"
- item="#38393eff"
- text="#eeeeee"
+ <ThemeWidgetColors outline="#191919"
+ inner="#999999ff"
+ inner_sel="#646464ff"
+ item="#191919ff"
+ text="#000000"
text_sel="#ffffff"
show_shaded="FALSE"
shadetop="0"
- shadedown="-5"
- roundness="0.4">
+ shadedown="0"
+ roundness="0.5">
</ThemeWidgetColors>
</wcol_regular>
<wcol_tool>
- <ThemeWidgetColors outline="#2f2f34"
- inner="#505158ff"
- inner_sel="#599eb3ff"
- item="#e6ebffff"
- text="#f2f2f2"
+ <ThemeWidgetColors outline="#191919"
+ inner="#999999ff"
+ inner_sel="#646464ff"
+ item="#191919ff"
+ text="#000000"
text_sel="#ffffff"
- show_shaded="FALSE"
- shadetop="0"
- shadedown="-5"
+ show_shaded="TRUE"
+ shadetop="15"
+ shadedown="-15"
roundness="0.4">
</ThemeWidgetColors>
</wcol_tool>
<wcol_toolbar_item>
- <ThemeWidgetColors outline="#191919"
- inner="#505158ff"
- inner_sel="#2d2d33ff"
- item="#191919ff"
+ <ThemeWidgetColors outline="#000000"
+ inner="#464646ff"
+ inner_sel="#ccccccff"
+ item="#000000ff"
text="#ffffff"
- text_sel="#ffffff"
+ text_sel="#333333"
show_shaded="FALSE"
shadetop="0"
shadedown="0"
- roundness="0.5">
+ roundness="0.6">
</ThemeWidgetColors>
</wcol_toolbar_item>
<wcol_radio>
- <ThemeWidgetColors outline="#2d2e33"
- inner="#505158ff"
- inner_sel="#2d2d33ff"
+ <ThemeWidgetColors outline="#000000"
+ inner="#464646ff"
+ inner_sel="#5680c2ff"
item="#ffffffff"
- text="#eeeeee"
- text_sel="#ffffff"
- show_shaded="FALSE"
- shadetop="5"
- shadedown="-5"
+ text="#ffffff"
+ text_sel="#000000"
+ show_shaded="TRUE"
+ shadetop="15"
+ shadedown="-15"
roundness="0.4">
</ThemeWidgetColors>
</wcol_radio>
<wcol_text>
- <ThemeWidgetColors outline="#43454d"
- inner="#2d2e33ff"
- inner_sel="#717280ff"
- item="#599eb3ff"
- text="#eeeeee"
+ <ThemeWidgetColors outline="#191919"
+ inner="#999999ff"
+ inner_sel="#999999ff"
+ item="#5a5a5aff"
+ text="#000000"
text_sel="#ffffff"
show_shaded="TRUE"
- shadetop="-3"
- shadedown="0"
+ shadetop="0"
+ shadedown="25"
roundness="0.4">
</ThemeWidgetColors>
</wcol_text>
<wcol_option>
- <ThemeWidgetColors outline="#2d2e33"
- inner="#2d2e33ff"
- inner_sel="#595966ff"
+ <ThemeWidgetColors outline="#000000"
+ inner="#464646ff"
+ inner_sel="#464646ff"
item="#ffffffff"
- text="#eeeeee"
+ text="#000000"
text_sel="#ffffff"
- show_shaded="FALSE"
- shadetop="0"
+ show_shaded="TRUE"
+ shadetop="15"
shadedown="-15"
- roundness="0.5">
+ roundness="0.666666">
</ThemeWidgetColors>
</wcol_option>
<wcol_toggle>
- <ThemeWidgetColors outline="#43434d"
- inner="#595966ff"
- inner_sel="#599eb3ff"
+ <ThemeWidgetColors outline="#191919"
+ inner="#999999ff"
+ inner_sel="#646464ff"
item="#191919ff"
- text="#eeeeee"
+ text="#000000"
text_sel="#ffffff"
show_shaded="FALSE"
shadetop="0"
@@ -108,37 +108,37 @@
</ThemeWidgetColors>
</wcol_toggle>
<wcol_num>
- <ThemeWidgetColors outline="#46464d"
- inner="#505158ff"
- inner_sel="#3f7180ff"
- item="#46464dff"
- text="#eeeeee"
+ <ThemeWidgetColors outline="#191919"
+ inner="#b4b4b4ff"
+ inner_sel="#999999ff"
+ item="#5a5a5aff"
+ text="#000000"
text_sel="#ffffff"
- show_shaded="FALSE"
- shadetop="0"
+ show_shaded="TRUE"
+ shadetop="-20"
shadedown="0"
- roundness="0.8">
+ roundness="1">
</ThemeWidgetColors>
</wcol_num>
<wcol_numslider>
- <ThemeWidgetColors outline="#46464d"
- inner="#3f3f47ff"
- inner_sel="#3f7180ff"
- item="#505158ff"
- text="#eeeeee"
+ <ThemeWidgetColors outline="#191919"
+ inner="#b4b4b4ff"
+ inner_sel="#999999ff"
+ item="#808080ff"
+ text="#000000"
text_sel="#ffffff"
show_shaded="TRUE"
- shadetop="-4"
+ shadetop="-20"
shadedown="0"
- roundness="0.8">
+ roundness="1">
</ThemeWidgetColors>
</wcol_numslider>
<wcol_box>
- <ThemeWidgetColors outline="#2d2e33"
- inner="#43454dff"
- inner_sel="#599eb3ff"
+ <ThemeWidgetColors outline="#191919"
+ inner="#808080ff"
+ inner_sel="#646464ff"
item="#191919ff"
- text="#eeeeee"
+ text="#000000"
text_sel="#ffffff"
show_shaded="FALSE"
shadetop="0"
@@ -147,25 +147,25 @@
</ThemeWidgetColors>
</wcol_box>
<wcol_menu>
- <ThemeWidgetColors outline="#2d2d2d"
- inner="#29282eff"
- inner_sel="#505158ff"
- item="#e6e6e6ff"
- text="#eeeeee"
+ <ThemeWidgetColors outline="#000000"
+ inner="#464646ff"
+ inner_sel="#464646ff"
+ item="#ffffffff"
+ text="#ffffff"
text_sel="#cccccc"
- show_shaded="FALSE"
- shadetop="10"
- shadedown="-10"
+ show_shaded="TRUE"
+ shadetop="15"
+ shadedown="-15"
roundness="0.4">
</ThemeWidgetColors>
</wcol_menu>
<wcol_pulldown>
- <ThemeWidgetColors outline="#29282e"
- inner="#29282e99"
- inner_sel="#505158ff"
+ <ThemeWidgetColors outline="#000000"
+ inner="#3f3f3fff"
+ inner_sel="#5680c2ff"
item="#ffffffff"
- text="#eeeeee"
- text_sel="#ffffff"
+ text="#000000"
+ text_sel="#000000"
show_shaded="FALSE"
shadetop="25"
shadedown="-20"
@@ -173,11 +173,11 @@
</ThemeWidgetColors>
</wcol_pulldown>
<wcol_menu_back>
- <ThemeWidgetColors outline="#1f1f1f"
- inner="#1f1f1fef"
- inner_sel="#505158ff"
+ <ThemeWidgetColors outline="#000000"
+ inner="#191919e6"
+ inner_sel="#2d2d2de6"
item="#646464ff"
- text="#b3b3b3"
+ text="#a0a0a0"
text_sel="#ffffff"
show_shaded="FALSE"
shadetop="25"
@@ -186,13 +186,13 @@
</ThemeWidgetColors>
</wcol_menu_back>
<wcol_pie_menu>
- <ThemeWidgetColors outline="#4d4d4d"
- inner="#1a1a1aff"
- inner_sel="#599eb3ff"
- item="#599eb3ff"
- text="#eeeeee"
+ <ThemeWidgetColors outline="#0a0a0a"
+ inner="#191919e6"
+ inner_sel="#8c8c8cff"
+ item="#2d2d2de6"
+ text="#a0a0a0"
text_sel="#ffffff"
- show_shaded="FALSE"
+ show_shaded="TRUE"
shadetop="10"
shadedown="-10"
roundness="1">
@@ -200,10 +200,10 @@
</wcol_pie_menu>
<wcol_tooltip>
<ThemeWidgetColors outline="#000000"
- inner="#1f1f1fef"
+ inner="#191919e6"
inner_sel="#2d2d2de6"
item="#646464ff"
- text="#eeeeee"
+ text="#ffffff"
text_sel="#ffffff"
show_shaded="FALSE"
shadetop="25"
@@ -214,35 +214,35 @@
<wcol_menu_item>
<ThemeWidgetColors outline="#000000"
inner="#00000000"
- inner_sel="#505158ff"
+ inner_sel="#5680c2ff"
item="#acacac80"
- text="#eeeeee"
- text_sel="#ffffff"
- show_shaded="FALSE"
+ text="#ffffff"
+ text_sel="#000000"
+ show_shaded="TRUE"
shadetop="38"
shadedown="0"
roundness="0.5">
</ThemeWidgetColors>
</wcol_menu_item>
<wcol_scroll>
- <ThemeWidgetColors outline="#2f3035"
- inner="#585a6700"
- inner_sel="#599eb3ff"
- item="#585a67ff"
- text="#ffffff"
+ <ThemeWidgetColors outline="#323232"
+ inner="#505050b4"
+ inner_sel="#646464b4"
+ item="#808080ff"
+ text="#000000"
text_sel="#ffffff"
- show_shaded="FALSE"
+ show_shaded="TRUE"
shadetop="5"
shadedown="-5"
roundness="1">
</ThemeWidgetColors>
</wcol_scroll>
<wcol_progress>
- <ThemeWidgetColors outline="#b3b3b3"
- inner="#ccccccff"
+ <ThemeWidgetColors outline="#000000"
+ inner="#bebebeff"
inner_sel="#646464b4"
- item="#599eb3ff"
- text="#eeeeee"
+ item="#808080ff"
+ text="#000000"
text_sel="#ffffff"
show_shaded="FALSE"
shadetop="0"
@@ -251,11 +251,11 @@
</ThemeWidgetColors>
</wcol_progress>
<wcol_list_item>
- <ThemeWidgetColors outline="#28292d"
- inner="#28292d00"
- inner_sel="#5f616fff"
- item="#599eb3ff"
- text="#eeeeee"
+ <ThemeWidgetColors outline="#000000"
+ inner="#00000000"
+ inner_sel="#5680c2ff"
+ item="#5a5a5aff"
+ text="#000000"
text_sel="#ffffff"
show_shaded="FALSE"
shadetop="0"
@@ -276,25 +276,25 @@
</ThemeWidgetStateColors>
</wcol_state>
<wcol_tab>
- <ThemeWidgetColors outline="#28292d"
- inner="#38393fff"
- inner_sel="#43444bff"
- item="#28292dff"
- text="#ffffff"
- text_sel="#ffffff"
+ <ThemeWidgetColors outline="#3c3c3c"
+ inner="#535353ff"
+ inner_sel="#727272ff"
+ item="#5a5a5aff"
+ text="#000000"
+ text_sel="#000000"
show_shaded="FALSE"
shadetop="0"
shadedown="0"
- roundness="0.3">
+ roundness="0.5">
</ThemeWidgetColors>
</wcol_tab>
</ThemeUserInterface>
</user_interface>
<view_3d>
- <ThemeView3D grid="#1f2023"
+ <ThemeView3D grid="#404040"
clipping_border_3d="#313131ff"
wire="#000000"
- wire_edit="#407980"
+ wire_edit="#000000"
gp_vertex="#000000"
gp_vertex_select="#ff8500"
gp_vertex_size="3"
@@ -302,11 +302,11 @@
object_selected="#f15800"
object_active="#ffaa40"
text_keyframe="#ddd700"
- camera="#b6b6b6"
- empty="#b6b6b6"
- lamp="#b6b6b633"
- speaker="#b6b6b6"
- vertex="#407980"
+ camera="#000000"
+ empty="#000000"
+ lamp="#00000028"
+ speaker="#000000"
+ vertex="#000000"
vertex_select="#ff8500"
vertex_size="3"
vertex_bevel="#00a5ff"
@@ -319,9 +319,9 @@
edge_facesel="#4b4b4b"
freestyle_edge_mark="#7fff7f"
face="#00000012"
- face_select="#ff85004d"
+ face_select="#ff85003c"
face_dot="#ff8500"
- facedot_size="3"
+ facedot_size="4"
freestyle_face_mark="#7fff7f33"
nurb_uline="#909000"
nurb_vline="#803060"
@@ -337,10 +337,10 @@
handle_sel_auto="#f0ff40"
handle_sel_align="#f090a0"
lastsel_point="#ffffff"
- extra_edge_len="#150806"
- extra_edge_angle="#4d4d00"
- extra_face_angle="#0000cc"
- extra_face_area="#004d00"
+ extra_edge_len="#200000"
+ extra_edge_angle="#000000"
+ extra_face_angle="#000080"
+ extra_face_area="#002000"
editmesh_active="#ffffff80"
normal="#22dddd"
vertex_normal="#2361dd"
@@ -351,38 +351,39 @@
bundle_solid="#c8c8c8"
camera_path="#000000"
skin_root="#b44d4d"
- view_overlay="#808080"
+ view_overlay="#000000"
transform="#ffffff"
frame_current="#60c040"
paint_curve_handle="#7fff7f7f"
paint_curve_pivot="#ff7f7f7f"
outline_width="1">
<space>
- <ThemeSpaceGradient title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGradient title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282e00"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303500"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#72727280"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<gradients>
- <ThemeGradientColors show_grad="TRUE"
- gradient="#2d2d2e"
- high_gradient="#474748">
+ <ThemeGradientColors show_grad="FALSE"
+ gradient="#000000"
+ high_gradient="#393939">
</ThemeGradientColors>
</gradients>
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGradient>
@@ -390,14 +391,14 @@
</ThemeView3D>
</view_3d>
<graph_editor>
- <ThemeGraphEditor grid="#17171a"
- frame_current="#308837"
+ <ThemeGraphEditor grid="#5e5e5e"
+ frame_current="#60c040"
window_sliders="#969696"
- channels_region="#29282e"
- dopesheet_channel="#26537f"
- dopesheet_subchannel="#6a90b2"
- channel_group="#247f0d"
- active_channels_group="#46a431"
+ channels_region="#707070"
+ dopesheet_channel="#52606e"
+ dopesheet_subchannel="#7c8996"
+ channel_group="#4f6549"
+ active_channels_group="#87b17d"
vertex="#000000"
vertex_select="#ff8500"
vertex_size="6"
@@ -418,62 +419,64 @@
handle_vertex_select="#ff8500"
handle_vertex_size="5">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#6b6b6b"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
</space>
<space_list>
- <ThemeSpaceListGeneric list="#29282e"
- list_title="#ffffff"
- list_text="#cccccc"
+ <ThemeSpaceListGeneric list="#666666"
+ list_title="#000000"
+ list_text="#000000"
list_text_hi="#ffffff">
</ThemeSpaceListGeneric>
</space_list>
</ThemeGraphEditor>
</graph_editor>
<file_browser>
- <ThemeFileBrowser selected_file="#5b8199">
+ <ThemeFileBrowser selected_file="#ff8c19">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
- text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ <ThemeSpaceGeneric back="#4c4c4c"
+ title="#000000"
+ text="#fafafa"
+ text_hi="#0f0f0f"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -497,56 +500,57 @@
tweak_duplicate="#d90000"
keyframe_border="#000000ff"
keyframe_border_selected="#000000ff"
- frame_current="#308837">
+ frame_current="#60c040">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#6b6b6b"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
</space>
<space_list>
- <ThemeSpaceListGeneric list="#29282e"
- list_title="#ffffff"
- list_text="#cccccc"
- list_text_hi="#cccccc">
+ <ThemeSpaceListGeneric list="#666666"
+ list_title="#000000"
+ list_text="#000000"
+ list_text_hi="#ffffff">
</ThemeSpaceListGeneric>
</space_list>
</ThemeNLAEditor>
</nla_editor>
<dopesheet_editor>
- <ThemeDopeSheet grid="#17171a"
- frame_current="#308837"
+ <ThemeDopeSheet grid="#5e5e5e"
+ frame_current="#60c040"
value_sliders="#000000"
view_sliders="#969696"
- dopesheet_channel="#2e6399"
- dopesheet_subchannel="#7aa4cc"
+ dopesheet_channel="#52606e"
+ dopesheet_subchannel="#7c8996"
channels="#707070"
channels_selected="#60c040"
- channel_group="#278c0e"
- active_channels_group="#4eb335"
- long_key="#1a1515"
+ channel_group="#4f6549"
+ active_channels_group="#87b17d"
+ long_key="#0c0a0a"
long_key_selected="#ff8c00"
keyframe="#e8e8e8"
- keyframe_selected="#ffbe33"
+ keyframe_selected="#ffbe32"
keyframe_extreme="#e8b3cc"
keyframe_extreme_selected="#f28080"
keyframe_breakdown="#b3dbe8"
@@ -556,36 +560,37 @@
keyframe_border="#000000ff"
keyframe_border_selected="#000000ff"
keyframe_scale_factor="1"
- summary="#66310066">
+ summary="#cc701a66">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#6b6b6b"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
</space>
<space_list>
- <ThemeSpaceListGeneric list="#29282e"
- list_title="#ffffff"
- list_text="#cccccc"
+ <ThemeSpaceListGeneric list="#666666"
+ list_title="#000000"
+ list_text="#000000"
list_text_hi="#ffffff">
</ThemeSpaceListGeneric>
</space_list>
@@ -604,17 +609,17 @@
face_select="#ff85003c"
face_dot="#ff8500"
facedot_size="3"
- freestyle_face_mark="#7fff7f33"
+ freestyle_face_mark="#00000000"
editmesh_active="#ffffff80"
wire_edit="#c0c0c0"
edge_select="#ff8500"
- scope_back="#727272ff"
+ scope_back="#0000004c"
preview_stitch_face="#7f7f0033"
preview_stitch_edge="#ff00ff33"
preview_stitch_vert="#0000ff33"
preview_stitch_stitchable="#00ff00ff"
preview_stitch_unstitchable="#ff0000ff"
- preview_stitch_active="#e1d2c323"
+ preview_stitch_active="#00000000"
uv_shadow="#707070ff"
uv_others="#606060ff"
frame_current="#60c040"
@@ -634,26 +639,27 @@
paint_curve_handle="#7fff7f7f"
paint_curve_pivot="#ff7f7f7f">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#353535"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#72727280"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -675,33 +681,34 @@
transition_strip="#a25f6f"
meta_strip="#6d9183"
text_strip="#a29700"
- frame_current="#308837"
+ frame_current="#60c040"
keyframe="#ff8500"
draw_action="#50c8ff"
preview_back="#000000"
metadatabg="#000000"
metadatatext="#ffffff">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#747474"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#72727280"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -711,26 +718,27 @@
<properties>
<ThemeProperties>
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#727272"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -738,38 +746,39 @@
</ThemeProperties>
</properties>
<text_editor>
- <ThemeTextEditor line_numbers_background="#313133"
- selected_text="#19191a"
+ <ThemeTextEditor line_numbers_background="#404040"
+ selected_text="#c67777"
cursor="#ff0000"
- syntax_builtin="#ff1961"
- syntax_symbols="#ff734d"
- syntax_special="#95d600"
- syntax_preprocessor="#ad80ff"
- syntax_reserved="#c4753b"
- syntax_comment="#939393"
- syntax_string="#f6e162"
- syntax_numbers="#50dbff">
+ syntax_builtin="#800050"
+ syntax_symbols="#4c4c4c"
+ syntax_special="#5f5f00"
+ syntax_preprocessor="#32008c"
+ syntax_reserved="#8c3c00"
+ syntax_comment="#006432"
+ syntax_string="#640000"
+ syntax_numbers="#0000c8">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#999999"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -780,59 +789,60 @@
<ThemeNodeEditor gp_vertex="#000000"
gp_vertex_select="#ff8500"
gp_vertex_size="3"
- node_selected="#099be6"
- node_active="#ffffff"
- wire="#808080"
- wire_inner="#808080"
+ node_selected="#f15800"
+ node_active="#ffaa40"
+ wire="#000000"
+ wire_inner="#737373"
wire_select="#ffffff"
selected_text="#7f7070"
- node_backdrop="#5a5c66ff"
- converter_node="#66c4ff"
- color_node="#ffcb4d"
- group_node="#59b36a"
- group_socket_node="#dfc300"
+ node_backdrop="#9b9b9ba0"
+ converter_node="#686a75"
+ color_node="#6c696f"
+ group_node="#69756e"
+ group_socket_node="#dfca35"
frame_node="#9b9b9ba0"
matte_node="#977474"
distor_node="#749797"
- noodle_curving="0"
- input_node="#ff6675"
- output_node="#ff6675"
+ noodle_curving="5"
+ input_node="#646464"
+ output_node="#646464"
filter_node="#6c696f"
- vector_node="#9999ff"
- texture_node="#ffc399"
- shader_node="#a7ff99"
+ vector_node="#6c696f"
+ texture_node="#6c696f"
+ shader_node="#6c696f"
script_node="#6c696f"
pattern_node="#6c696f"
layout_node="#6c696f">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#393939"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#72727280"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
</space>
<space_list>
- <ThemeSpaceListGeneric list="#29282e"
- list_title="#ffffff"
- list_text="#cccccc"
+ <ThemeSpaceListGeneric list="#a5a5a5"
+ list_title="#000000"
+ list_text="#000000"
list_text_hi="#ffffff">
</ThemeSpaceListGeneric>
</space_list>
@@ -840,28 +850,29 @@
</node_editor>
<outliner>
<ThemeOutliner match="#337f33"
- selected_highlight="#7297d0">
+ selected_highlight="#82878c">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#727272"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -871,35 +882,36 @@
<info>
<ThemeInfo info_selected="#6080ff"
info_selected_text="#ffffff"
- info_error="#990000"
- info_error_text="#ffffff"
- info_warning="#b36a00"
- info_warning_text="#ffffff"
- info_info="#668000"
- info_info_text="#ffffff"
- info_debug="#d3d3d3"
+ info_error="#dc0000"
+ info_error_text="#000000"
+ info_warning="#dc8060"
+ info_warning_text="#000000"
+ info_info="#00aa00"
+ info_info_text="#000000"
+ info_debug="#c4c4c4"
info_debug_text="#000000">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#727272"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -909,26 +921,27 @@
<user_preferences>
<ThemeUserPreferences>
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#727272"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -936,33 +949,34 @@
</ThemeUserPreferences>
</user_preferences>
<console>
- <ThemeConsole line_output="#b3c2ff"
+ <ThemeConsole line_output="#6080ff"
line_input="#ffffff"
- line_info="#47b347"
- line_error="#de6f6f"
- cursor="#de5959"
+ line_info="#00aa00"
+ line_error="#dc6060"
+ cursor="#dc6060"
select="#ffffff30">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#000000"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#2f3035ff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#727272ff"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -971,8 +985,8 @@
</console>
<clip_editor>
<ThemeClipEditor gp_vertex="#000000"
- gp_vertex_select="#000000"
- gp_vertex_size="1"
+ gp_vertex_select="#ff8500"
+ gp_vertex_size="3"
marker_outline="#000000"
marker="#7f7f00"
active_marker="#ffffff"
@@ -981,7 +995,7 @@
locked_marker="#7f7f7f"
path_before="#ff0000"
path_after="#0000ff"
- frame_current="#308837"
+ frame_current="#60c040"
strips="#0c0a0a"
strips_selected="#ff8c00"
handle_free="#000000"
@@ -996,26 +1010,27 @@
handle_vertex_select="#ffff00"
handle_vertex_size="5">
<space>
- <ThemeSpaceGeneric back="#2f3035"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#393939"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#72727280"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000019"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -1032,26 +1047,27 @@
<topbar>
<ThemeTopBar>
<space>
- <ThemeSpaceGeneric back="#43444b"
- title="#ffffff"
- text="#ffffff"
+ <ThemeSpaceGeneric back="#727272"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#29282eff"
- header_text="#eeeeee"
+ header="#535353ff"
+ header_text="#000000"
header_text_hi="#ffffff"
- button="#2f303599"
- button_title="#ffffff"
- button_text="#ffffff"
+ button="#72727280"
+ button_title="#000000"
+ button_text="#000000"
button_text_hi="#ffffff"
- tab_active="#446499"
- tab_inactive="#28292d"
- tab_back="#28292dff"
- tab_outline="#28292d">
+ tab_active="#727272"
+ tab_inactive="#535353"
+ tab_back="#404040ff"
+ tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#29282eff"
- back="#3e3f46ff"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000000"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -1061,12 +1077,12 @@
<statusbar>
<ThemeStatusBar>
<space>
- <ThemeSpaceGeneric back="#09090a"
- title="#8f8f8f"
- text="#8f8f8f"
+ <ThemeSpaceGeneric back="#393939"
+ title="#000000"
+ text="#000000"
text_hi="#ffffff"
- header="#252528ff"
- header_text="#cbcbcb"
+ header="#727272ff"
+ header_text="#000000"
header_text_hi="#ffffff"
button="#72727280"
button_title="#000000"
@@ -1077,10 +1093,11 @@
tab_back="#404040ff"
tab_outline="#3c3c3c">
<panelcolors>
- <ThemePanelColors header="#5f5f5fff"
- back="#46464699"
- show_header="TRUE"
- show_back="TRUE">
+ <ThemePanelColors header="#00000019"
+ back="#72727280"
+ sub_back="#00000000"
+ show_header="FALSE"
+ show_back="FALSE">
</ThemePanelColors>
</panelcolors>
</ThemeSpaceGeneric>
@@ -1192,7 +1209,7 @@
</Theme>
<ThemeStyle>
<panel_title>
- <ThemeFontStyle points="11"
+ <ThemeFontStyle points="12"
font_kerning_style="FITTED"
shadow="1"
shadow_offset_x="0"
@@ -1214,10 +1231,10 @@
<widget>
<ThemeFontStyle points="11"
font_kerning_style="FITTED"
- shadow="5"
+ shadow="0"
shadow_offset_x="0"
- shadow_offset_y="-1"
- shadow_alpha="0.5"
+ shadow_offset_y="0"
+ shadow_alpha="0.25"
shadow_value="0">
</ThemeFontStyle>
</widget>
diff --git a/release/scripts/presets/keyconfig/3dsmax.py b/release/scripts/presets/keyconfig/3dsmax.py
index ed51bf95a84..8bce68a0a30 100644
--- a/release/scripts/presets/keyconfig/3dsmax.py
+++ b/release/scripts/presets/keyconfig/3dsmax.py
@@ -88,7 +88,6 @@ kmi = km.keymap_items.new('screen.screen_full_area', 'UP_ARROW', 'PRESS', ctrl=T
kmi = km.keymap_items.new('screen.screen_full_area', 'DOWN_ARROW', 'PRESS', ctrl=True)
kmi = km.keymap_items.new('screen.screen_full_area', 'SPACE', 'PRESS', shift=True)
kmi = km.keymap_items.new('screen.screenshot', 'F3', 'PRESS', ctrl=True)
-kmi = km.keymap_items.new('screen.screencast', 'F3', 'PRESS', alt=True)
kmi = km.keymap_items.new('screen.region_quadview', 'W', 'PRESS', alt=True)
kmi = km.keymap_items.new('screen.repeat_history', 'F3', 'PRESS', shift=True)
kmi = km.keymap_items.new('screen.repeat_last', 'R', 'PRESS', shift=True)
@@ -2433,4 +2432,3 @@ kmi = km.keymap_items.new_modal('SELECT', 'LEFTMOUSE', 'RELEASE', any=True)
kmi = km.keymap_items.new_modal('SELECT', 'RIGHTMOUSE', 'RELEASE', any=True)
kmi = km.keymap_items.new_modal('BEGIN', 'MIDDLEMOUSE', 'PRESS')
kmi = km.keymap_items.new_modal('DESELECT', 'MIDDLEMOUSE', 'RELEASE')
-
diff --git a/release/scripts/presets/keyconfig/blender_27x.py b/release/scripts/presets/keyconfig/blender_27x.py
new file mode 100644
index 00000000000..9410c20bac2
--- /dev/null
+++ b/release/scripts/presets/keyconfig/blender_27x.py
@@ -0,0 +1,3975 @@
+import bpy
+from sys import platform
+
+def kmi_props_setattr(kmi_props, attr, value):
+ try:
+ setattr(kmi_props, attr, value)
+ except AttributeError:
+ print("Warning: property '%s' not found in keymap item '%s'" %
+ (attr, kmi_props.__class__.__name__))
+ except Exception as e:
+ print("Warning: %r" % e)
+
+import os
+wm = bpy.context.window_manager
+kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])
+del os
+
+# Map Image Editor Tool: VIEW, Select Border
+km = kc.keymaps.new('Image Editor Tool: VIEW, Select Border', space_type='IMAGE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('uv.select_border', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+
+# Map Image Editor Tool: VIEW, Select Circle
+km = kc.keymaps.new('Image Editor Tool: VIEW, Select Circle', space_type='IMAGE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('uv.select_circle', 'ACTIONMOUSE', 'PRESS')
+
+# Map Image Editor Tool: VIEW, Select Lasso
+km = kc.keymaps.new('Image Editor Tool: VIEW, Select Lasso', space_type='IMAGE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('uv.select_lasso', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+
+# Map 3D View Tool: All, Cursor
+km = kc.keymaps.new('3D View Tool: All, Cursor', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'cursor_transform', True)
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: OBJECT, Select Border
+km = kc.keymaps.new('3D View Tool: OBJECT, Select Border', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.select_border', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('view3d.select_border', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+
+# Map 3D View Tool: OBJECT, Select Circle
+km = kc.keymaps.new('3D View Tool: OBJECT, Select Circle', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.select_circle', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('view3d.select_circle', 'ACTIONMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+
+# Map 3D View Tool: OBJECT, Select Lasso
+km = kc.keymaps.new('3D View Tool: OBJECT, Select Lasso', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+
+# Map 3D View Tool: OBJECT, Move
+km = kc.keymaps.new('3D View Tool: OBJECT, Move', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: OBJECT, Rotate
+km = kc.keymaps.new('3D View Tool: OBJECT, Rotate', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.rotate', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: OBJECT, Scale
+km = kc.keymaps.new('3D View Tool: OBJECT, Scale', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.resize', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: OBJECT, Ruler/Protractor
+km = kc.keymaps.new('3D View Tool: OBJECT, Ruler/Protractor', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.ruler_add', 'EVT_TWEAK_A', 'ANY')
+
+# Map 3D View Tool: POSE, Breakdowner
+km = kc.keymaps.new('3D View Tool: POSE, Breakdowner', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('pose.breakdown', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: POSE, Push
+km = kc.keymaps.new('3D View Tool: POSE, Push', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('pose.push', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: POSE, Relax
+km = kc.keymaps.new('3D View Tool: POSE, Relax', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('pose.relax', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_ARMATURE, Roll
+km = kc.keymaps.new('3D View Tool: EDIT_ARMATURE, Roll', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.transform', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'mode', 'BONE_ROLL')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_ARMATURE, Bone Size
+km = kc.keymaps.new('3D View Tool: EDIT_ARMATURE, Bone Size', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.transform', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'BONE_SIZE')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_ARMATURE, Bone Envelope
+km = kc.keymaps.new('3D View Tool: EDIT_ARMATURE, Bone Envelope', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.transform', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'BONE_ENVELOPE')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_ARMATURE, Extrude
+km = kc.keymaps.new('3D View Tool: EDIT_ARMATURE, Extrude', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('armature.click_extrude', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_ARMATURE, Extrude to Cursor
+km = kc.keymaps.new('3D View Tool: EDIT_ARMATURE, Extrude to Cursor', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('armature.click_extrude', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Add Cube
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Add Cube', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.cursor3d', 'ACTIONMOUSE', 'CLICK')
+kmi = km.keymap_items.new('mesh.primitive_cube_add_manipulator', 'EVT_TWEAK_A', 'ANY')
+
+# Map 3D View Tool: EDIT_MESH, Extrude Region
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Extrude Region', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.extrude_context_move', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties.TRANSFORM_OT_translate, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Extrude Individual
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Extrude Individual', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.extrude_faces_move', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties.TRANSFORM_OT_shrink_fatten, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Extrude to Cursor
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Extrude to Cursor', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Inset Faces
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Inset Faces', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.inset', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Bevel
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Bevel', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.bevel', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Loop Cut
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Loop Cut', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.loopcut_slide', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Offset Edge Loop Cut
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Offset Edge Loop Cut', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.offset_edge_loops_slide', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Knife
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Knife', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.knife_tool', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+
+# Map 3D View Tool: EDIT_MESH, Bisect
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Bisect', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.bisect', 'EVT_TWEAK_A', 'ANY')
+
+# Map 3D View Tool: EDIT_MESH, Poly Build
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Poly Build', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.polybuild_face_at_cursor_move', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties.TRANSFORM_OT_translate, 'release_confirm', True)
+kmi = km.keymap_items.new('mesh.polybuild_split_at_cursor_move', 'ACTIONMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties.TRANSFORM_OT_translate, 'release_confirm', True)
+kmi = km.keymap_items.new('mesh.polybuild_dissolve_at_cursor', 'ACTIONMOUSE', 'CLICK', alt=True)
+kmi = km.keymap_items.new('mesh.polybuild_hover', 'MOUSEMOVE', 'ANY', alt=True)
+kmi_props_setattr(kmi.properties, 'use_boundary', False)
+kmi = km.keymap_items.new('mesh.polybuild_hover', 'MOUSEMOVE', 'ANY', any=True)
+kmi_props_setattr(kmi.properties, 'use_boundary', True)
+
+# Map 3D View Tool: EDIT_MESH, Spin
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Spin', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.spin', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Spin (Duplicate)
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Spin (Duplicate)', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.spin', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'dupli', True)
+
+# Map 3D View Tool: EDIT_MESH, Smooth
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Smooth', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.vertices_smooth', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Randomize
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Randomize', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.vertex_random', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_MESH, Edge Slide
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Edge Slide', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.edge_slide', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Vertex Slide
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Vertex Slide', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.vert_slide', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Shrink/Fatten
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Shrink/Fatten', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.shrink_fatten', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Push/Pull
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Push/Pull', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('transform.push_pull', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Rip Region
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Rip Region', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.rip_move', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties.TRANSFORM_OT_translate, 'release_confirm', True)
+
+# Map 3D View Tool: EDIT_MESH, Rip Edge
+km = kc.keymaps.new('3D View Tool: EDIT_MESH, Rip Edge', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.rip_edge_edge_move', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: EDIT_CURVE, Draw
+km = kc.keymaps.new('3D View Tool: EDIT_CURVE, Draw', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('curve.draw', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+
+# Map 3D View Tool: EDIT_CURVE, Extrude Cursor
+km = kc.keymaps.new('3D View Tool: EDIT_CURVE, Extrude Cursor', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('curve.vertex_add', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: PARTICLE, Cursor Click
+km = kc.keymaps.new('3D View Tool: PARTICLE, Cursor Click', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.cursor3d', 'ACTIONMOUSE', 'CLICK')
+
+# Map 3D View Tool: PAINT_WEIGHT, Sample Weight
+km = kc.keymaps.new('3D View Tool: PAINT_WEIGHT, Sample Weight', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.weight_sample', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: PAINT_WEIGHT, Sample Vertex Group
+km = kc.keymaps.new('3D View Tool: PAINT_WEIGHT, Sample Vertex Group', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.weight_sample_group', 'ACTIONMOUSE', 'PRESS')
+
+# Map 3D View Tool: PAINT_WEIGHT, Gradient
+km = kc.keymaps.new('3D View Tool: PAINT_WEIGHT, Gradient', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.weight_gradient', 'EVT_TWEAK_A', 'ANY')
+
+# Map Window
+km = kc.keymaps.new('Window', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('wm.window_new', 'W', 'PRESS', ctrl=True, alt=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('wm.read_homefile', 'N', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('wm.call_menu', 'O', 'PRESS', shift=True, oskey=True)
+ kmi_props_setattr(kmi.properties, 'name', 'INFO_MT_file_open_recent')
+ kmi = km.keymap_items.new('wm.open_mainfile', 'O', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('wm.save_mainfile', 'S', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('wm.save_as_mainfile', 'S', 'PRESS', shift=True, oskey=True)
+ kmi = km.keymap_items.new('wm.quit_blender', 'Q', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('wm.read_homefile', 'N', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.save_homefile', 'U', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'O', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'INFO_MT_file_open_recent')
+kmi = km.keymap_items.new('wm.open_mainfile', 'O', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.open_mainfile', 'F1', 'PRESS')
+kmi = km.keymap_items.new('wm.link', 'O', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('wm.append', 'F1', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.save_mainfile', 'S', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.save_mainfile', 'W', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.save_as_mainfile', 'S', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('wm.save_as_mainfile', 'F2', 'PRESS')
+kmi = km.keymap_items.new('wm.save_as_mainfile', 'S', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'copy', True)
+kmi = km.keymap_items.new('wm.window_fullscreen_toggle', 'F11', 'PRESS', alt=True)
+kmi = km.keymap_items.new('wm.quit_blender', 'Q', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.doc_view_manual_ui_context', 'F1', 'PRESS', alt=True)
+kmi = km.keymap_items.new('wm.redraw_timer', 'T', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('wm.debug_menu', 'D', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'NDOF_BUTTON_MENU', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'USERPREF_MT_ndof_settings')
+kmi = km.keymap_items.new('wm.search_menu', 'SPACE', 'PRESS')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F3', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'NODE_EDITOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F4', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'CONSOLE')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F5', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'VIEW_3D')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F6', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'GRAPH_EDITOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F7', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'PROPERTIES')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F8', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'SEQUENCE_EDITOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F9', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'OUTLINER')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F10', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'IMAGE_EDITOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F11', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'TEXT_EDITOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'F12', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'area.type')
+kmi_props_setattr(kmi.properties, 'value', 'DOPESHEET_EDITOR')
+kmi = km.keymap_items.new('wm.context_scale_float', 'NDOF_BUTTON_PLUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'user_preferences.inputs.ndof_sensitivity')
+kmi_props_setattr(kmi.properties, 'value', 1.1)
+kmi = km.keymap_items.new('wm.context_scale_float', 'NDOF_BUTTON_MINUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'user_preferences.inputs.ndof_sensitivity')
+kmi_props_setattr(kmi.properties, 'value', 1.0 / 1.0)
+kmi = km.keymap_items.new('wm.context_scale_float', 'NDOF_BUTTON_PLUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'user_preferences.inputs.ndof_sensitivity')
+kmi_props_setattr(kmi.properties, 'value', 1.5)
+kmi = km.keymap_items.new('wm.context_scale_float', 'NDOF_BUTTON_MINUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'user_preferences.inputs.ndof_sensitivity')
+kmi_props_setattr(kmi.properties, 'value', 2.0 / 3.0)
+kmi = km.keymap_items.new('info.reports_display_update', 'TIMER_REPORT', 'ANY', any=True)
+
+# Map Screen
+km = kc.keymaps.new('Screen', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('screen.animation_step', 'TIMER0', 'ANY', any=True)
+kmi = km.keymap_items.new('screen.region_blend', 'TIMERREGION', 'ANY', any=True)
+kmi = km.keymap_items.new('screen.screen_set', 'RIGHT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('screen.screen_set', 'LEFT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('screen.screen_full_area', 'SPACE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('screen.screen_full_area', 'SPACE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'use_hide_panels', True)
+kmi = km.keymap_items.new('screen.screenshot', 'F3', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('screen.screencast', 'F3', 'PRESS', alt=True)
+kmi = km.keymap_items.new('screen.space_context_cycle', 'TAB', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'NEXT')
+kmi = km.keymap_items.new('screen.space_context_cycle', 'TAB', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'PREV')
+kmi = km.keymap_items.new('screen.region_quadview', 'Q', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('screen.repeat_history', 'F3', 'PRESS')
+kmi = km.keymap_items.new('screen.repeat_last', 'R', 'PRESS', shift=True)
+kmi = km.keymap_items.new('screen.region_flip', 'F5', 'PRESS')
+kmi = km.keymap_items.new('screen.redo_last', 'F6', 'PRESS')
+kmi = km.keymap_items.new('script.reload', 'F8', 'PRESS')
+kmi = km.keymap_items.new('file.execute', 'RET', 'PRESS')
+kmi = km.keymap_items.new('file.execute', 'NUMPAD_ENTER', 'PRESS')
+kmi = km.keymap_items.new('file.cancel', 'ESC', 'PRESS')
+if platform == "darwin":
+ kmi = km.keymap_items.new('ed.undo', 'Z', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('ed.redo', 'Z', 'PRESS', shift=True, oskey=True)
+ kmi = km.keymap_items.new('ed.undo_history', 'Z', 'PRESS', alt=True, oskey=True)
+kmi = km.keymap_items.new('ed.undo', 'Z', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('ed.redo', 'Z', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('ed.undo_history', 'Z', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('render.render', 'F12', 'PRESS')
+kmi_props_setattr(kmi.properties, 'use_viewport', True)
+kmi = km.keymap_items.new('render.render', 'F12', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'animation', True)
+kmi_props_setattr(kmi.properties, 'use_viewport', True)
+kmi = km.keymap_items.new('render.view_cancel', 'ESC', 'PRESS')
+kmi = km.keymap_items.new('render.view_show', 'F11', 'PRESS')
+kmi = km.keymap_items.new('render.play_rendered_anim', 'F11', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('screen.userpref_show', 'COMMA', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('screen.userpref_show', 'U', 'PRESS', ctrl=True, alt=True)
+
+# Map Screen Editing
+km = kc.keymaps.new('Screen Editing', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('screen.actionzone', 'LEFTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'modifier', 0)
+kmi = km.keymap_items.new('screen.actionzone', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'modifier', 1)
+kmi = km.keymap_items.new('screen.actionzone', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'modifier', 2)
+kmi = km.keymap_items.new('screen.area_split', 'NONE', 'ANY')
+kmi = km.keymap_items.new('screen.area_join', 'NONE', 'ANY')
+kmi = km.keymap_items.new('screen.area_dupli', 'NONE', 'ANY', shift=True)
+kmi = km.keymap_items.new('screen.area_swap', 'NONE', 'ANY', ctrl=True)
+kmi = km.keymap_items.new('screen.region_scale', 'NONE', 'ANY')
+kmi = km.keymap_items.new('screen.screen_full_area', 'NONE', 'ANY')
+kmi_props_setattr(kmi.properties, 'use_hide_panels', True)
+kmi = km.keymap_items.new('screen.area_move', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('screen.area_options', 'RIGHTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('screen.header', 'F9', 'PRESS', alt=True)
+
+# Map User Interface
+km = kc.keymaps.new('User Interface', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('ui.eyedropper_color', 'E', 'PRESS')
+kmi = km.keymap_items.new('ui.eyedropper_colorband', 'E', 'PRESS')
+kmi = km.keymap_items.new('ui.eyedropper_colorband_point', 'E', 'PRESS', alt=True)
+kmi = km.keymap_items.new('ui.eyedropper_id', 'E', 'PRESS')
+kmi = km.keymap_items.new('ui.eyedropper_depth', 'E', 'PRESS')
+kmi = km.keymap_items.new('ui.copy_data_path_button', 'C', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('ui.copy_data_path_button', 'C', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'full_path', True)
+kmi = km.keymap_items.new('anim.keyframe_insert_button', 'I', 'PRESS')
+kmi = km.keymap_items.new('anim.keyframe_delete_button', 'I', 'PRESS', alt=True)
+kmi = km.keymap_items.new('anim.keyframe_clear_button', 'I', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('anim.driver_button_add', 'D', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('anim.driver_button_remove', 'D', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('anim.keyingset_button_add', 'K', 'PRESS')
+kmi = km.keymap_items.new('anim.keyingset_button_remove', 'K', 'PRESS', alt=True)
+
+# Map View2D
+km = kc.keymaps.new('View2D', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view2d.scroller_activate', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.scroller_activate', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.pan', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.pan', 'MIDDLEMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view2d.pan', 'TRACKPADPAN', 'ANY')
+kmi = km.keymap_items.new('view2d.scroll_right', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view2d.scroll_left', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view2d.scroll_down', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view2d.scroll_up', 'WHEELUPMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view2d.ndof', 'NDOF_MOTION', 'ANY')
+kmi = km.keymap_items.new('view2d.zoom_out', 'WHEELOUTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.zoom_in', 'WHEELINMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.zoom_out', 'NUMPAD_MINUS', 'PRESS')
+kmi = km.keymap_items.new('view2d.zoom_in', 'NUMPAD_PLUS', 'PRESS')
+kmi = km.keymap_items.new('view2d.zoom', 'TRACKPADPAN', 'ANY', ctrl=True)
+kmi = km.keymap_items.new('view2d.smoothview', 'TIMER1', 'ANY', any=True)
+kmi = km.keymap_items.new('view2d.scroll_down', 'WHEELDOWNMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.scroll_up', 'WHEELUPMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.scroll_right', 'WHEELDOWNMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.scroll_left', 'WHEELUPMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.zoom', 'MIDDLEMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view2d.zoom', 'TRACKPADZOOM', 'ANY')
+kmi = km.keymap_items.new('view2d.zoom_border', 'B', 'PRESS', shift=True)
+
+# Map Header
+km = kc.keymaps.new('Header', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('screen.header_toolbox', 'RIGHTMOUSE', 'PRESS')
+
+# Map View2D Buttons List
+km = kc.keymaps.new('View2D Buttons List', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view2d.scroller_activate', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.scroller_activate', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.pan', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.pan', 'TRACKPADPAN', 'ANY')
+kmi = km.keymap_items.new('view2d.scroll_down', 'WHEELDOWNMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.scroll_up', 'WHEELUPMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view2d.scroll_down', 'PAGE_DOWN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'page', True)
+kmi = km.keymap_items.new('view2d.scroll_up', 'PAGE_UP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'page', True)
+kmi = km.keymap_items.new('view2d.zoom', 'MIDDLEMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view2d.zoom', 'TRACKPADZOOM', 'ANY')
+kmi = km.keymap_items.new('view2d.zoom', 'TRACKPADPAN', 'ANY', ctrl=True)
+kmi = km.keymap_items.new('view2d.zoom_out', 'NUMPAD_MINUS', 'PRESS')
+kmi = km.keymap_items.new('view2d.zoom_in', 'NUMPAD_PLUS', 'PRESS')
+kmi = km.keymap_items.new('view2d.reset', 'HOME', 'PRESS')
+
+# Map Frames
+km = kc.keymaps.new('Frames', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('screen.frame_offset', 'UP_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'delta', 10)
+kmi = km.keymap_items.new('screen.frame_offset', 'DOWN_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'delta', -10)
+kmi = km.keymap_items.new('screen.frame_offset', 'LEFT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('screen.frame_offset', 'RIGHT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('screen.frame_offset', 'WHEELDOWNMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('screen.frame_offset', 'WHEELUPMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('screen.frame_jump', 'UP_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'end', True)
+kmi = km.keymap_items.new('screen.frame_jump', 'DOWN_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'end', False)
+kmi = km.keymap_items.new('screen.frame_jump', 'RIGHT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'end', True)
+kmi = km.keymap_items.new('screen.frame_jump', 'LEFT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'end', False)
+kmi = km.keymap_items.new('screen.keyframe_jump', 'UP_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'next', True)
+kmi = km.keymap_items.new('screen.keyframe_jump', 'DOWN_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'next', False)
+kmi = km.keymap_items.new('screen.keyframe_jump', 'MEDIA_LAST', 'PRESS')
+kmi_props_setattr(kmi.properties, 'next', True)
+kmi = km.keymap_items.new('screen.keyframe_jump', 'MEDIA_FIRST', 'PRESS')
+kmi_props_setattr(kmi.properties, 'next', False)
+kmi = km.keymap_items.new('screen.animation_play', 'A', 'PRESS', alt=True)
+kmi = km.keymap_items.new('screen.animation_play', 'A', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'reverse', True)
+kmi = km.keymap_items.new('screen.animation_cancel', 'ESC', 'PRESS')
+kmi = km.keymap_items.new('screen.animation_play', 'MEDIA_PLAY', 'PRESS')
+kmi = km.keymap_items.new('screen.animation_cancel', 'MEDIA_STOP', 'PRESS')
+
+# Map Property Editor
+km = kc.keymaps.new('Property Editor', space_type='PROPERTIES', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('buttons.toolbox', 'RIGHTMOUSE', 'PRESS')
+
+# Map Markers
+km = kc.keymaps.new('Markers', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('marker.add', 'M', 'PRESS')
+kmi = km.keymap_items.new('marker.move', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('marker.duplicate', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('marker.select', 'SELECTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('marker.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('marker.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'camera', True)
+kmi = km.keymap_items.new('marker.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'camera', True)
+kmi = km.keymap_items.new('marker.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('marker.select_all', 'A', 'PRESS')
+kmi = km.keymap_items.new('marker.delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('marker.delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('marker.rename', 'M', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('marker.move', 'G', 'PRESS')
+kmi = km.keymap_items.new('marker.camera_bind', 'B', 'PRESS', ctrl=True)
+
+# Map Animation
+km = kc.keymaps.new('Animation', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('anim.change_frame', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('wm.context_toggle', 'T', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.show_seconds')
+kmi = km.keymap_items.new('anim.previewrange_set', 'P', 'PRESS')
+kmi = km.keymap_items.new('anim.previewrange_clear', 'P', 'PRESS', alt=True)
+
+# Map Dopesheet
+km = kc.keymaps.new('Dopesheet', space_type='DOPESHEET_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('action.clickselect', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'channel', False)
+kmi = km.keymap_items.new('action.clickselect', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'column', True)
+kmi_props_setattr(kmi.properties, 'channel', False)
+kmi = km.keymap_items.new('action.clickselect', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'channel', False)
+kmi = km.keymap_items.new('action.clickselect', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'column', True)
+kmi_props_setattr(kmi.properties, 'channel', False)
+kmi = km.keymap_items.new('action.clickselect', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'channel', True)
+kmi = km.keymap_items.new('action.clickselect', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'channel', True)
+kmi = km.keymap_items.new('action.select_leftright', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CHECK')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('action.select_leftright', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CHECK')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('action.select_leftright', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'LEFT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('action.select_leftright', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'RIGHT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('action.select_all_toggle', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'invert', False)
+kmi = km.keymap_items.new('action.select_all_toggle', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'invert', True)
+kmi = km.keymap_items.new('action.select_border', 'B', 'PRESS')
+kmi_props_setattr(kmi.properties, 'axis_range', False)
+kmi = km.keymap_items.new('action.select_border', 'B', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'axis_range', True)
+kmi = km.keymap_items.new('action.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('action.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('action.select_circle', 'C', 'PRESS')
+kmi = km.keymap_items.new('action.select_column', 'K', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'KEYS')
+kmi = km.keymap_items.new('action.select_column', 'K', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CFRA')
+kmi = km.keymap_items.new('action.select_column', 'K', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'MARKERS_COLUMN')
+kmi = km.keymap_items.new('action.select_column', 'K', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'MARKERS_BETWEEN')
+kmi = km.keymap_items.new('action.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('action.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('action.select_linked', 'L', 'PRESS')
+kmi = km.keymap_items.new('action.frame_jump', 'G', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('action.snap', 'S', 'PRESS', shift=True)
+kmi = km.keymap_items.new('action.mirror', 'M', 'PRESS', shift=True)
+kmi = km.keymap_items.new('action.handle_type', 'V', 'PRESS')
+kmi = km.keymap_items.new('action.interpolation_type', 'T', 'PRESS')
+kmi = km.keymap_items.new('action.extrapolation_type', 'E', 'PRESS', shift=True)
+kmi = km.keymap_items.new('action.keyframe_type', 'R', 'PRESS')
+kmi = km.keymap_items.new('action.sample', 'O', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'DOPESHEET_MT_delete')
+kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'DOPESHEET_MT_delete')
+kmi = km.keymap_items.new('action.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('action.keyframe_insert', 'I', 'PRESS')
+kmi = km.keymap_items.new('action.copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('action.paste', 'V', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('action.paste', 'V', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'flipped', True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('action.copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('action.paste', 'V', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('action.paste', 'V', 'PRESS', shift=True, oskey=True)
+ kmi_props_setattr(kmi.properties, 'flipped', True)
+kmi = km.keymap_items.new('action.previewrange_set', 'P', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('action.view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('action.view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('action.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('action.view_frame', 'NUMPAD_0', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_editable_toggle', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_find', 'F', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('transform.transform', 'G', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_TRANSLATE')
+kmi = km.keymap_items.new('transform.transform', 'EVT_TWEAK_S', 'ANY')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_TRANSLATE')
+kmi = km.keymap_items.new('transform.transform', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_EXTEND')
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_SCALE')
+kmi = km.keymap_items.new('transform.transform', 'T', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_SLIDE')
+kmi = km.keymap_items.new('wm.context_toggle', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_proportional_action')
+kmi = km.keymap_items.new('marker.add', 'M', 'PRESS')
+kmi = km.keymap_items.new('marker.rename', 'M', 'PRESS', ctrl=True)
+
+# Map Dopesheet Generic
+km = kc.keymaps.new('Dopesheet Generic', space_type='DOPESHEET_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('action.properties', 'N', 'PRESS')
+
+# Map Outliner
+km = kc.keymaps.new('Outliner', space_type='OUTLINER', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('outliner.highlight_update', 'MOUSEMOVE', 'ANY', any=True)
+kmi = km.keymap_items.new('outliner.item_rename', 'LEFTMOUSE', 'DOUBLE_CLICK')
+kmi = km.keymap_items.new('outliner.item_activate', 'LEFTMOUSE', 'CLICK')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'recursive', False)
+kmi = km.keymap_items.new('outliner.item_activate', 'LEFTMOUSE', 'CLICK', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'recursive', False)
+kmi = km.keymap_items.new('outliner.item_activate', 'LEFTMOUSE', 'CLICK', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'recursive', True)
+kmi = km.keymap_items.new('outliner.item_activate', 'LEFTMOUSE', 'CLICK', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'recursive', True)
+kmi = km.keymap_items.new('outliner.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('outliner.item_openclose', 'RET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'all', False)
+kmi = km.keymap_items.new('outliner.item_openclose', 'RET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'all', True)
+kmi = km.keymap_items.new('outliner.item_rename', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('outliner.operation', 'RIGHTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('outliner.item_drag_drop', 'EVT_TWEAK_L', 'ANY')
+kmi = km.keymap_items.new('outliner.show_hierarchy', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('outliner.show_active', 'PERIOD', 'PRESS')
+kmi = km.keymap_items.new('outliner.show_active', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('outliner.scroll_page', 'PAGE_DOWN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'up', False)
+kmi = km.keymap_items.new('outliner.scroll_page', 'PAGE_UP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'up', True)
+kmi = km.keymap_items.new('outliner.show_one_level', 'NUMPAD_PLUS', 'PRESS')
+kmi = km.keymap_items.new('outliner.show_one_level', 'NUMPAD_MINUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'open', False)
+kmi = km.keymap_items.new('outliner.selected_toggle', 'A', 'PRESS')
+kmi = km.keymap_items.new('outliner.expanded_toggle', 'A', 'PRESS', shift=True)
+kmi = km.keymap_items.new('outliner.keyingset_add_selected', 'K', 'PRESS')
+kmi = km.keymap_items.new('outliner.keyingset_remove_selected', 'K', 'PRESS', alt=True)
+kmi = km.keymap_items.new('anim.keyframe_insert', 'I', 'PRESS')
+kmi = km.keymap_items.new('anim.keyframe_delete', 'I', 'PRESS', alt=True)
+kmi = km.keymap_items.new('outliner.drivers_add_selected', 'D', 'PRESS')
+kmi = km.keymap_items.new('outliner.drivers_delete_selected', 'D', 'PRESS', alt=True)
+kmi = km.keymap_items.new('outliner.collection_new', 'C', 'PRESS')
+kmi = km.keymap_items.new('outliner.collection_delete', 'X', 'PRESS')
+
+# Map 3D View Generic
+km = kc.keymaps.new('3D View Generic', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.properties', 'N', 'PRESS')
+kmi = km.keymap_items.new('view3d.toolshelf', 'T', 'PRESS')
+
+# Map Grease Pencil
+km = kc.keymaps.new('Grease Pencil', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('gpencil.draw', 'LEFTMOUSE', 'PRESS', key_modifier='D')
+kmi_props_setattr(kmi.properties, 'mode', 'DRAW')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('gpencil.draw', 'LEFTMOUSE', 'PRESS', ctrl=True, key_modifier='D')
+kmi_props_setattr(kmi.properties, 'mode', 'DRAW_STRAIGHT')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('gpencil.draw', 'RIGHTMOUSE', 'PRESS', ctrl=True, key_modifier='D')
+kmi_props_setattr(kmi.properties, 'mode', 'DRAW_POLY')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('gpencil.draw', 'RIGHTMOUSE', 'PRESS', key_modifier='D')
+kmi_props_setattr(kmi.properties, 'mode', 'ERASER')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('gpencil.draw', 'ERASER', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'ERASER')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('gpencil.editmode_toggle', 'TAB', 'PRESS', key_modifier='D')
+kmi = km.keymap_items.new('wm.call_menu_pie', 'Q', 'PRESS', key_modifier='D')
+kmi_props_setattr(kmi.properties, 'name', 'GPENCIL_MT_pie_tool_palette')
+kmi = km.keymap_items.new('wm.call_menu_pie', 'W', 'PRESS', key_modifier='D')
+kmi_props_setattr(kmi.properties, 'name', 'GPENCIL_MT_pie_settings_palette')
+kmi = km.keymap_items.new('gpencil.blank_frame_add', 'B', 'PRESS', key_modifier='D')
+kmi = km.keymap_items.new('gpencil.active_frames_delete_all', 'X', 'PRESS', key_modifier='D')
+
+# Map Grease Pencil Stroke Edit Mode
+km = kc.keymaps.new('Grease Pencil Stroke Edit Mode', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('gpencil.editmode_toggle', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('wm.call_menu_pie', 'E', 'PRESS', key_modifier='D')
+kmi_props_setattr(kmi.properties, 'name', 'GPENCIL_MT_pie_sculpt')
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'user_preferences.edit.grease_pencil_eraser_radius')
+kmi = km.keymap_items.new('gpencil.interpolate', 'E', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('gpencil.interpolate_sequence', 'E', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('gpencil.brush_paint', 'LEFTMOUSE', 'PRESS', key_modifier='E')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('gpencil.brush_paint', 'LEFTMOUSE', 'PRESS', ctrl=True, key_modifier='E')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('gpencil.brush_paint', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='E')
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.gpencil_sculpt.brush.strength')
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.gpencil_sculpt.brush.size')
+kmi = km.keymap_items.new('gpencil.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('gpencil.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('gpencil.select_circle', 'C', 'PRESS')
+kmi = km.keymap_items.new('gpencil.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('gpencil.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('gpencil.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('gpencil.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('gpencil.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('gpencil.select', 'SELECTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('gpencil.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('gpencil.select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'entire_strokes', True)
+kmi = km.keymap_items.new('gpencil.select_linked', 'L', 'PRESS')
+kmi = km.keymap_items.new('gpencil.select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.select_grouped', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('gpencil.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_gpencil_delete')
+kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_gpencil_delete')
+kmi = km.keymap_items.new('gpencil.dissolve', 'X', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.dissolve', 'DEL', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.active_frames_delete_all', 'X', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'GPENCIL_MT_gpencil_edit_specials')
+kmi = km.keymap_items.new('gpencil.stroke_join', 'J', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.stroke_join', 'J', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'JOINCOPY')
+kmi = km.keymap_items.new('gpencil.copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.paste', 'V', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('gpencil.copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('gpencil.paste', 'V', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('wm.call_menu', 'S', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'GPENCIL_MT_snap')
+kmi = km.keymap_items.new('gpencil.convert', 'C', 'PRESS', alt=True)
+kmi = km.keymap_items.new('gpencil.reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('gpencil.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('gpencil.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('gpencil.selection_opacity_toggle', 'H', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('gpencil.layer_isolate', 'NUMPAD_ASTERIX', 'PRESS')
+kmi = km.keymap_items.new('gpencil.move_to_layer', 'M', 'PRESS')
+kmi = km.keymap_items.new('gpencil.brush_select', 'ONE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 0)
+kmi = km.keymap_items.new('gpencil.brush_select', 'TWO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 1)
+kmi = km.keymap_items.new('gpencil.brush_select', 'THREE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 2)
+kmi = km.keymap_items.new('gpencil.brush_select', 'FOUR', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 3)
+kmi = km.keymap_items.new('gpencil.brush_select', 'FIVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 4)
+kmi = km.keymap_items.new('gpencil.brush_select', 'SIX', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 5)
+kmi = km.keymap_items.new('gpencil.brush_select', 'SEVEN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 6)
+kmi = km.keymap_items.new('gpencil.brush_select', 'EIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 7)
+kmi = km.keymap_items.new('gpencil.brush_select', 'NINE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 8)
+kmi = km.keymap_items.new('gpencil.brush_select', 'ZERO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'index', 9)
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('transform.bend', 'W', 'PRESS', shift=True)
+kmi = km.keymap_items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'GPENCIL_SHRINKFATTEN')
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'ENABLED')
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'CONNECTED')
+
+# Map Face Mask
+km = kc.keymaps.new('Face Mask', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.face_select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('paint.face_select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('paint.face_select_hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('paint.face_select_hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('paint.face_select_reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('paint.face_select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('paint.face_select_linked_pick', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('paint.face_select_linked_pick', 'L', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+
+# Map Weight Paint Vertex Selection
+km = kc.keymaps.new('Weight Paint Vertex Selection', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.vert_select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('paint.vert_select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('view3d.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('view3d.select_circle', 'C', 'PRESS')
+
+# Map Pose
+km = kc.keymaps.new('Pose', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('object.parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'INFO_MT_add')
+kmi = km.keymap_items.new('pose.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('pose.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('pose.reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_pose_apply')
+kmi = km.keymap_items.new('pose.rot_clear', 'R', 'PRESS', alt=True)
+kmi = km.keymap_items.new('pose.loc_clear', 'G', 'PRESS', alt=True)
+kmi = km.keymap_items.new('pose.scale_clear', 'S', 'PRESS', alt=True)
+kmi = km.keymap_items.new('pose.quaternions_flip', 'F', 'PRESS', alt=True)
+kmi = km.keymap_items.new('pose.rotation_mode_set', 'R', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('pose.copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('pose.paste', 'V', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'flipped', False)
+kmi = km.keymap_items.new('pose.paste', 'V', 'PRESS', shift=True, ctrl=True)
+if platform == "darwin":
+ kmi_props_setattr(kmi.properties, 'flipped', True)
+ kmi = km.keymap_items.new('pose.copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('pose.paste', 'V', 'PRESS', oskey=True)
+ kmi_props_setattr(kmi.properties, 'flipped', False)
+ kmi = km.keymap_items.new('pose.paste', 'V', 'PRESS', shift=True, oskey=True)
+kmi_props_setattr(kmi.properties, 'flipped', True)
+kmi = km.keymap_items.new('pose.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('pose.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('pose.select_parent', 'P', 'PRESS', shift=True)
+kmi = km.keymap_items.new('pose.select_hierarchy', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'PARENT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('pose.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'PARENT')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('pose.select_hierarchy', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'CHILD')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('pose.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'CHILD')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('pose.select_linked', 'L', 'PRESS')
+kmi = km.keymap_items.new('pose.select_grouped', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('pose.select_mirror', 'F', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('pose.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('pose.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('pose.ik_add', 'I', 'PRESS', shift=True)
+kmi = km.keymap_items.new('pose.ik_clear', 'I', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'G', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_pose_group')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_bone_options_toggle')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_bone_options_enable')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_bone_options_disable')
+kmi = km.keymap_items.new('armature.layers_show_all', 'ACCENT_GRAVE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('armature.armature_layers', 'M', 'PRESS', shift=True)
+kmi = km.keymap_items.new('pose.bone_layers', 'M', 'PRESS')
+kmi = km.keymap_items.new('pose.toggle_bone_selection_overlay', 'Z', 'PRESS')
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'BONE_SIZE')
+kmi = km.keymap_items.new('anim.keyframe_insert_menu', 'I', 'PRESS')
+kmi = km.keymap_items.new('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True)
+kmi = km.keymap_items.new('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('poselib.browse_interactive', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('poselib.pose_add', 'L', 'PRESS', shift=True)
+kmi = km.keymap_items.new('poselib.pose_remove', 'L', 'PRESS', alt=True)
+kmi = km.keymap_items.new('poselib.pose_rename', 'L', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('pose.push', 'E', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('pose.relax', 'E', 'PRESS', alt=True)
+kmi = km.keymap_items.new('pose.breakdown', 'E', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_pose_specials')
+kmi = km.keymap_items.new('wm.call_menu', 'P', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_pose_propagate')
+
+# Map Object Mode
+km = kc.keymaps.new('Object Mode', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_proportional_edit_objects')
+kmi = km.keymap_items.new('object.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('object.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('object.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('object.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('object.select_linked', 'L', 'PRESS', shift=True)
+kmi = km.keymap_items.new('object.select_grouped', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('object.select_mirror', 'M', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'PARENT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('object.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'PARENT')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'CHILD')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('object.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'CHILD')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('object.parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('object.parent_no_inverse_set', 'P', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('object.parent_clear', 'P', 'PRESS', alt=True)
+kmi = km.keymap_items.new('object.track_set', 'T', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('object.track_clear', 'T', 'PRESS', alt=True)
+kmi = km.keymap_items.new('object.constraint_add_with_targets', 'C', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('object.constraints_clear', 'C', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('object.location_clear', 'G', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'clear_delta', False)
+kmi = km.keymap_items.new('object.rotation_clear', 'R', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'clear_delta', False)
+kmi = km.keymap_items.new('object.scale_clear', 'S', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'clear_delta', False)
+kmi = km.keymap_items.new('object.origin_clear', 'O', 'PRESS', alt=True)
+kmi = km.keymap_items.new('object.delete', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'use_global', False)
+kmi = km.keymap_items.new('object.delete', 'X', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'use_global', True)
+kmi = km.keymap_items.new('object.delete', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'use_global', False)
+kmi = km.keymap_items.new('object.delete', 'DEL', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'use_global', True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'INFO_MT_add')
+kmi = km.keymap_items.new('object.duplicates_make_real', 'A', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_object_apply')
+kmi = km.keymap_items.new('wm.call_menu', 'U', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_make_single_user')
+kmi = km.keymap_items.new('wm.call_menu', 'L', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_make_links')
+kmi = km.keymap_items.new('object.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('object.duplicate_move_linked', 'D', 'PRESS', alt=True)
+kmi = km.keymap_items.new('object.join', 'J', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('object.convert', 'C', 'PRESS', alt=True)
+kmi = km.keymap_items.new('object.proxy_make', 'P', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('object.make_local', 'L', 'PRESS')
+kmi = km.keymap_items.new('anim.keyframe_insert_menu', 'I', 'PRESS')
+kmi = km.keymap_items.new('anim.keyframe_delete_v3d', 'I', 'PRESS', alt=True)
+kmi = km.keymap_items.new('anim.keying_set_active_set', 'I', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('collection.create', 'G', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('collection.objects_remove', 'G', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('collection.objects_remove_all', 'G', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('collection.objects_add_active', 'G', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('collection.objects_remove_active', 'G', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_object_specials')
+kmi = km.keymap_items.new('object.data_transfer', 'T', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 0)
+kmi = km.keymap_items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 1)
+kmi = km.keymap_items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 2)
+kmi = km.keymap_items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 3)
+kmi = km.keymap_items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 4)
+kmi = km.keymap_items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 5)
+kmi = km.keymap_items.new('object.move_to_collection', 'M', 'PRESS')
+
+# Map Paint Curve
+km = kc.keymaps.new('Paint Curve', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paintcurve.add_point_slide', 'ACTIONMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('paintcurve.select', 'SELECTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('paintcurve.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('paintcurve.slide', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('paintcurve.slide', 'ACTIONMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'align', True)
+kmi = km.keymap_items.new('paintcurve.select', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('paintcurve.cursor', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('paintcurve.delete_point', 'X', 'PRESS')
+kmi = km.keymap_items.new('paintcurve.delete_point', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('paintcurve.draw', 'RET', 'PRESS')
+kmi = km.keymap_items.new('paintcurve.draw', 'NUMPAD_ENTER', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+
+# Map Curve
+km = kc.keymaps.new('Curve', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'INFO_MT_edit_curve_add')
+kmi = km.keymap_items.new('curve.handle_type_set', 'V', 'PRESS')
+kmi = km.keymap_items.new('curve.vertex_add', 'ACTIONMOUSE', 'CLICK', ctrl=True)
+kmi = km.keymap_items.new('curve.draw', 'ACTIONMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('curve.draw', 'PEN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'wait_for_input', False)
+kmi = km.keymap_items.new('curve.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('curve.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('curve.select_row', 'R', 'PRESS', shift=True)
+kmi = km.keymap_items.new('curve.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('curve.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('curve.select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('curve.select_similar', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('curve.select_linked_pick', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('curve.select_linked_pick', 'L', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('curve.shortest_path_pick', 'SELECTMOUSE', 'CLICK', ctrl=True)
+kmi = km.keymap_items.new('curve.separate', 'P', 'PRESS')
+kmi = km.keymap_items.new('curve.split', 'Y', 'PRESS')
+kmi = km.keymap_items.new('curve.extrude_move', 'E', 'PRESS')
+kmi = km.keymap_items.new('curve.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('curve.make_segment', 'F', 'PRESS')
+kmi = km.keymap_items.new('curve.cyclic_toggle', 'C', 'PRESS', alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_curve_delete')
+kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_curve_delete')
+kmi = km.keymap_items.new('curve.dissolve_verts', 'X', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('curve.dissolve_verts', 'DEL', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('curve.tilt_clear', 'T', 'PRESS', alt=True)
+kmi = km.keymap_items.new('transform.tilt', 'T', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CURVE_SHRINKFATTEN')
+kmi = km.keymap_items.new('curve.reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('curve.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('curve.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('curve.normals_make_consistent', 'N', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_curve_specials')
+kmi = km.keymap_items.new('wm.call_menu', 'H', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_hook')
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'ENABLED')
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'CONNECTED')
+
+# Map Image Paint
+km = kc.keymaps.new('Image Paint', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.image_paint', 'LEFTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'NORMAL')
+kmi = km.keymap_items.new('paint.image_paint', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'INVERT')
+kmi = km.keymap_items.new('paint.brush_colors_flip', 'X', 'PRESS')
+kmi = km.keymap_items.new('paint.grab_clone', 'RIGHTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('paint.sample_color', 'S', 'PRESS')
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 0)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 1)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 2)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 3)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 4)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 5)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 6)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 7)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 8)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 9)
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 10)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 11)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 12)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 13)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 14)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 15)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 16)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 17)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 18)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'image_paint')
+kmi_props_setattr(kmi.properties, 'index', 19)
+kmi = km.keymap_items.new('brush.scale_size', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 0.9)
+kmi = km.keymap_items.new('brush.scale_size', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 1.0 / 0.9)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.image_paint.brush.size')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.size')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_size')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.image_paint.brush.mask_texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.image_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.image_paint.brush.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', 'tool_settings.unified_paint_settings.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', 'tool_settings.unified_paint_settings.use_unified_color')
+kmi_props_setattr(kmi.properties, 'zoom_path', 'space_data.zoom')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.image_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', True)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.image_paint.brush.strength')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.strength')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_strength')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.image_paint.brush.mask_texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.image_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.image_paint.brush.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', 'tool_settings.unified_paint_settings.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', 'tool_settings.unified_paint_settings.use_unified_color')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.image_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', True)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.image_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', '')
+kmi_props_setattr(kmi.properties, 'use_secondary', '')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.image_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.image_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.image_paint.brush.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', 'tool_settings.unified_paint_settings.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', 'tool_settings.unified_paint_settings.use_unified_color')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.image_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.image_paint.brush.mask_texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', '')
+kmi_props_setattr(kmi.properties, 'use_secondary', '')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.image_paint.brush.mask_texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.image_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.image_paint.brush.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', 'tool_settings.unified_paint_settings.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', 'tool_settings.unified_paint_settings.use_unified_color')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.image_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', True)
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'SCALE')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'ROTATION')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'SCALE')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'ROTATION')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('wm.context_toggle', 'M', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'image_paint_object.data.use_paint_mask')
+kmi = km.keymap_items.new('wm.context_toggle', 'S', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.image_paint.brush.use_smooth_stroke')
+kmi = km.keymap_items.new('wm.call_menu', 'R', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_angle_control')
+kmi = km.keymap_items.new('wm.context_menu_enum', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.image_paint.brush.stroke_method')
+
+# Map Vertex Paint
+km = kc.keymaps.new('Vertex Paint', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.vertex_paint', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('paint.brush_colors_flip', 'X', 'PRESS')
+kmi = km.keymap_items.new('paint.sample_color', 'S', 'PRESS')
+kmi = km.keymap_items.new('paint.vertex_color_set', 'K', 'PRESS', shift=True)
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 0)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 1)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 2)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 3)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 4)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 5)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 6)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 7)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 8)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 9)
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 10)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 11)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 12)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 13)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 14)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 15)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 16)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 17)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 18)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'vertex_paint')
+kmi_props_setattr(kmi.properties, 'index', 19)
+kmi = km.keymap_items.new('brush.scale_size', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 0.9)
+kmi = km.keymap_items.new('brush.scale_size', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 1.0 / 0.9)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.vertex_paint.brush.size')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.size')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_size')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.vertex_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.vertex_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.vertex_paint.brush.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', 'tool_settings.unified_paint_settings.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', 'tool_settings.unified_paint_settings.use_unified_color')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.vertex_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.vertex_paint.brush.strength')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.strength')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_strength')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.vertex_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.vertex_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.vertex_paint.brush.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', 'tool_settings.unified_paint_settings.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', 'tool_settings.unified_paint_settings.use_unified_color')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.vertex_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.vertex_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', '')
+kmi_props_setattr(kmi.properties, 'use_secondary', '')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.vertex_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.vertex_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', 'tool_settings.vertex_paint.brush.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', 'tool_settings.unified_paint_settings.color')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', 'tool_settings.unified_paint_settings.use_unified_color')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.vertex_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'SCALE')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'ROTATION')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'SCALE')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'ROTATION')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('wm.context_toggle', 'M', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'vertex_paint_object.data.use_paint_mask')
+kmi = km.keymap_items.new('wm.context_toggle', 'S', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.vertex_paint.brush.use_smooth_stroke')
+kmi = km.keymap_items.new('wm.call_menu', 'R', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_angle_control')
+kmi = km.keymap_items.new('wm.context_menu_enum', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.vertex_paint.brush.stroke_method')
+
+# Map Weight Paint
+km = kc.keymaps.new('Weight Paint', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('paint.weight_paint', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('paint.weight_sample', 'ACTIONMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('paint.weight_sample_group', 'ACTIONMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('paint.weight_gradient', 'LEFTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'type', 'LINEAR')
+kmi = km.keymap_items.new('paint.weight_gradient', 'LEFTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'type', 'RADIAL')
+kmi = km.keymap_items.new('paint.weight_set', 'K', 'PRESS', shift=True)
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 0)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 1)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 2)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 3)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 4)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 5)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 6)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 7)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 8)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 9)
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 10)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 11)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 12)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 13)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 14)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 15)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 16)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 17)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 18)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'weight_paint')
+kmi_props_setattr(kmi.properties, 'index', 19)
+kmi = km.keymap_items.new('brush.scale_size', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 0.9)
+kmi = km.keymap_items.new('brush.scale_size', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 1.0 / 0.9)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.weight_paint.brush.size')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.size')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_size')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.weight_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.weight_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.weight_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.weight_paint.brush.strength')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.strength')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_strength')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.weight_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.weight_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.weight_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.weight_paint.brush.weight')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.weight')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_weight')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.weight_paint.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.weight_paint.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.weight_paint.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.context_menu_enum', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.vertex_paint.brush.stroke_method')
+kmi = km.keymap_items.new('wm.context_toggle', 'M', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'weight_paint_object.data.use_paint_mask')
+kmi = km.keymap_items.new('wm.context_toggle', 'V', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'weight_paint_object.data.use_paint_mask_vertex')
+kmi = km.keymap_items.new('wm.context_toggle', 'S', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.weight_paint.brush.use_smooth_stroke')
+
+# Map Sculpt
+km = kc.keymaps.new('Sculpt', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('sculpt.brush_stroke', 'LEFTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'NORMAL')
+kmi = km.keymap_items.new('sculpt.brush_stroke', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'INVERT')
+kmi = km.keymap_items.new('sculpt.brush_stroke', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'SMOOTH')
+kmi = km.keymap_items.new('paint.hide_show', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'action', 'SHOW')
+kmi_props_setattr(kmi.properties, 'area', 'INSIDE')
+kmi = km.keymap_items.new('paint.hide_show', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'HIDE')
+kmi_props_setattr(kmi.properties, 'area', 'INSIDE')
+kmi = km.keymap_items.new('paint.hide_show', 'H', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'action', 'SHOW')
+kmi_props_setattr(kmi.properties, 'area', 'ALL')
+kmi = km.keymap_items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 0)
+kmi = km.keymap_items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 1)
+kmi = km.keymap_items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 2)
+kmi = km.keymap_items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 3)
+kmi = km.keymap_items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 4)
+kmi = km.keymap_items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 5)
+kmi = km.keymap_items.new('paint.mask_flood_fill', 'M', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'VALUE')
+kmi_props_setattr(kmi.properties, 'value', 0.0)
+kmi = km.keymap_items.new('paint.mask_flood_fill', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'INVERT')
+kmi = km.keymap_items.new('paint.mask_lasso_gesture', 'LEFTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('wm.context_toggle', 'M', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'scene.tool_settings.sculpt.show_mask')
+kmi = km.keymap_items.new('sculpt.dynamic_topology_toggle', 'D', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('sculpt.set_detail_size', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('object.subdivision_set', 'PAGE_UP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'level', 1)
+kmi_props_setattr(kmi.properties, 'relative', True)
+kmi = km.keymap_items.new('object.subdivision_set', 'PAGE_DOWN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'level', -1)
+kmi_props_setattr(kmi.properties, 'relative', True)
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 0)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 1)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 2)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 3)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 4)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 5)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 6)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 7)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 8)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 9)
+kmi = km.keymap_items.new('brush.active_index_set', 'ONE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 10)
+kmi = km.keymap_items.new('brush.active_index_set', 'TWO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 11)
+kmi = km.keymap_items.new('brush.active_index_set', 'THREE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 12)
+kmi = km.keymap_items.new('brush.active_index_set', 'FOUR', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 13)
+kmi = km.keymap_items.new('brush.active_index_set', 'FIVE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 14)
+kmi = km.keymap_items.new('brush.active_index_set', 'SIX', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 15)
+kmi = km.keymap_items.new('brush.active_index_set', 'SEVEN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 16)
+kmi = km.keymap_items.new('brush.active_index_set', 'EIGHT', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 17)
+kmi = km.keymap_items.new('brush.active_index_set', 'NINE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 18)
+kmi = km.keymap_items.new('brush.active_index_set', 'ZERO', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'sculpt')
+kmi_props_setattr(kmi.properties, 'index', 19)
+kmi = km.keymap_items.new('brush.scale_size', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 0.9)
+kmi = km.keymap_items.new('brush.scale_size', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 1.0 / 0.9)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.sculpt.brush.size')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.size')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_size')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.sculpt.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.sculpt.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.sculpt.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.sculpt.brush.strength')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.strength')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_strength')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.sculpt.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.sculpt.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.sculpt.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.sculpt.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', '')
+kmi_props_setattr(kmi.properties, 'use_secondary', '')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.sculpt.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.sculpt.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.sculpt.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'SCALE')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'ROTATION')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'SCALE')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('brush.stencil_control', 'RIGHTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'ROTATION')
+kmi_props_setattr(kmi.properties, 'texmode', 'SECONDARY')
+kmi = km.keymap_items.new('paint.brush_select', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'DRAW')
+kmi = km.keymap_items.new('paint.brush_select', 'S', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'SMOOTH')
+kmi = km.keymap_items.new('paint.brush_select', 'P', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'PINCH')
+kmi = km.keymap_items.new('paint.brush_select', 'I', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'INFLATE')
+kmi = km.keymap_items.new('paint.brush_select', 'G', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'GRAB')
+kmi = km.keymap_items.new('paint.brush_select', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'LAYER')
+kmi = km.keymap_items.new('paint.brush_select', 'T', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'FLATTEN')
+kmi = km.keymap_items.new('paint.brush_select', 'C', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'CLAY')
+kmi = km.keymap_items.new('paint.brush_select', 'C', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'CREASE')
+kmi = km.keymap_items.new('paint.brush_select', 'K', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'SNAKE_HOOK')
+kmi = km.keymap_items.new('paint.brush_select', 'M', 'PRESS')
+kmi_props_setattr(kmi.properties, 'paint_mode', 'SCULPT')
+kmi_props_setattr(kmi.properties, 'sculpt_tool', 'MASK')
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi_props_setattr(kmi.properties, 'create_missing', True)
+kmi = km.keymap_items.new('wm.context_menu_enum', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.sculpt.brush.stroke_method')
+kmi = km.keymap_items.new('wm.context_toggle', 'S', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.sculpt.brush.use_smooth_stroke')
+kmi = km.keymap_items.new('wm.call_menu', 'R', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_angle_control')
+
+# Map Mesh
+km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.offset_edge_loops_slide', 'R', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('mesh.inset', 'I', 'PRESS')
+kmi = km.keymap_items.new('mesh.poke', 'P', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.bevel', 'B', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'vertex_only', False)
+kmi = km.keymap_items.new('mesh.bevel', 'B', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'vertex_only', True)
+kmi = km.keymap_items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', False)
+kmi = km.keymap_items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', False)
+kmi = km.keymap_items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('mesh.shortest_path_pick', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'use_fill', False)
+kmi = km.keymap_items.new('mesh.shortest_path_pick', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'use_fill', True)
+kmi = km.keymap_items.new('mesh.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('mesh.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.select_next_item', 'NUMPAD_PLUS', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('mesh.select_prev_item', 'NUMPAD_MINUS', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('mesh.select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.select_linked_pick', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('mesh.select_linked_pick', 'L', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'G', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_select_similar')
+kmi = km.keymap_items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_select_mode')
+kmi = km.keymap_items.new('mesh.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('mesh.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('mesh.reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'inside', False)
+kmi = km.keymap_items.new('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'inside', True)
+kmi = km.keymap_items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS')
+kmi = km.keymap_items.new('wm.call_menu', 'E', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_extrude')
+kmi = km.keymap_items.new('transform.edge_crease', 'E', 'PRESS', shift=True)
+kmi = km.keymap_items.new('mesh.spin', 'R', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.fill', 'F', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'quad_method', 'BEAUTY')
+kmi_props_setattr(kmi.properties, 'ngon_method', 'BEAUTY')
+kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'quad_method', 'FIXED')
+kmi_props_setattr(kmi.properties, 'ngon_method', 'CLIP')
+kmi = km.keymap_items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.rip_move', 'V', 'PRESS')
+kmi_props_setattr(kmi.properties.MESH_OT_rip, 'use_fill', False)
+kmi = km.keymap_items.new('mesh.rip_move', 'V', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties.MESH_OT_rip, 'use_fill', True)
+kmi = km.keymap_items.new('mesh.rip_edge_move', 'D', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.merge', 'M', 'PRESS', alt=True)
+kmi = km.keymap_items.new('transform.shrink_fatten', 'S', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.edge_face_add', 'F', 'PRESS')
+kmi = km.keymap_items.new('mesh.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'INFO_MT_mesh_add')
+kmi = km.keymap_items.new('mesh.separate', 'P', 'PRESS')
+kmi = km.keymap_items.new('mesh.split', 'Y', 'PRESS')
+kmi = km.keymap_items.new('mesh.vert_connect_path', 'J', 'PRESS')
+kmi = km.keymap_items.new('transform.vert_slide', 'V', 'PRESS', shift=True)
+kmi = km.keymap_items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', ctrl=True)
+kmi_props_setattr(kmi.properties, 'rotate_source', True)
+kmi = km.keymap_items.new('mesh.dupli_extrude_cursor', 'ACTIONMOUSE', 'CLICK', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'rotate_source', False)
+kmi = km.keymap_items.new('wm.call_menu', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_delete')
+kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_delete')
+kmi = km.keymap_items.new('mesh.dissolve_mode', 'X', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.dissolve_mode', 'DEL', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.knife_tool', 'K', 'PRESS')
+kmi_props_setattr(kmi.properties, 'use_occlude_geometry', True)
+kmi_props_setattr(kmi.properties, 'only_selected', False)
+kmi = km.keymap_items.new('mesh.knife_tool', 'K', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'use_occlude_geometry', False)
+kmi_props_setattr(kmi.properties, 'only_selected', True)
+kmi = km.keymap_items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_specials')
+kmi = km.keymap_items.new('wm.call_menu', 'F', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_faces')
+kmi = km.keymap_items.new('wm.call_menu', 'E', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_edges')
+kmi = km.keymap_items.new('wm.call_menu', 'V', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_mesh_vertices')
+kmi = km.keymap_items.new('wm.call_menu', 'H', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_hook')
+kmi = km.keymap_items.new('wm.call_menu', 'U', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_uv_map')
+kmi = km.keymap_items.new('wm.call_menu', 'G', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_vertex_group')
+kmi = km.keymap_items.new('object.subdivision_set', 'ZERO', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 0)
+kmi = km.keymap_items.new('object.subdivision_set', 'ONE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 1)
+kmi = km.keymap_items.new('object.subdivision_set', 'TWO', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 2)
+kmi = km.keymap_items.new('object.subdivision_set', 'THREE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 3)
+kmi = km.keymap_items.new('object.subdivision_set', 'FOUR', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 4)
+kmi = km.keymap_items.new('object.subdivision_set', 'FIVE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'level', 5)
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'ENABLED')
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'CONNECTED')
+
+# Map Armature
+km = kc.keymaps.new('Armature', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('armature.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('armature.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('armature.reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('armature.align', 'A', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('armature.calculate_roll', 'N', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('armature.roll_clear', 'R', 'PRESS', alt=True)
+kmi = km.keymap_items.new('armature.switch_direction', 'F', 'PRESS', alt=True)
+kmi = km.keymap_items.new('armature.bone_primitive_add', 'A', 'PRESS', shift=True)
+kmi = km.keymap_items.new('armature.parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('armature.parent_clear', 'P', 'PRESS', alt=True)
+kmi = km.keymap_items.new('armature.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('armature.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('armature.select_mirror', 'M', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('armature.select_hierarchy', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'PARENT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('armature.select_hierarchy', 'LEFT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'PARENT')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('armature.select_hierarchy', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'CHILD')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('armature.select_hierarchy', 'RIGHT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'CHILD')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('armature.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('armature.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('armature.select_similar', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('armature.select_linked', 'L', 'PRESS')
+kmi = km.keymap_items.new('armature.shortest_path_pick', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_armature_delete')
+kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_edit_armature_delete')
+kmi = km.keymap_items.new('armature.dissolve', 'X', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('armature.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('armature.extrude_move', 'E', 'PRESS')
+kmi = km.keymap_items.new('armature.extrude_forked', 'E', 'PRESS', shift=True)
+kmi = km.keymap_items.new('armature.click_extrude', 'ACTIONMOUSE', 'CLICK', ctrl=True)
+kmi = km.keymap_items.new('armature.fill', 'F', 'PRESS')
+kmi = km.keymap_items.new('armature.merge', 'M', 'PRESS', alt=True)
+kmi = km.keymap_items.new('armature.split', 'Y', 'PRESS')
+kmi = km.keymap_items.new('armature.separate', 'P', 'PRESS')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_bone_options_toggle')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_bone_options_enable')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_bone_options_disable')
+kmi = km.keymap_items.new('armature.layers_show_all', 'ACCENT_GRAVE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('armature.armature_layers', 'M', 'PRESS', shift=True)
+kmi = km.keymap_items.new('armature.bone_layers', 'M', 'PRESS')
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'BONE_SIZE')
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'BONE_ENVELOPE')
+kmi = km.keymap_items.new('transform.transform', 'R', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'BONE_ROLL')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_armature_specials')
+
+# Map Metaball
+km = kc.keymaps.new('Metaball', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('object.metaball_add', 'A', 'PRESS', shift=True)
+kmi = km.keymap_items.new('mball.reveal_metaelems', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mball.hide_metaelems', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('mball.hide_metaelems', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('mball.delete_metaelems', 'X', 'PRESS')
+kmi = km.keymap_items.new('mball.delete_metaelems', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('mball.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('mball.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('mball.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('mball.select_similar', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'ENABLED')
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'CONNECTED')
+
+# Map Lattice
+km = kc.keymaps.new('Lattice', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('lattice.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('lattice.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('lattice.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('lattice.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('lattice.flip', 'F', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'H', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_hook')
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'ENABLED')
+
+# Map Particle
+km = kc.keymaps.new('Particle', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('particle.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('particle.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('particle.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('particle.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('particle.select_linked', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('particle.select_linked', 'L', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('particle.delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('particle.delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('particle.reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('particle.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('particle.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('particle.brush_edit', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('particle.brush_edit', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.particle_edit.brush.size')
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.particle_edit.brush.strength')
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_particle_specials')
+kmi = km.keymap_items.new('particle.weight_set', 'K', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'ENABLED')
+
+# Map Font
+km = kc.keymaps.new('Font', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('font.style_toggle', 'B', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'style', 'BOLD')
+kmi = km.keymap_items.new('font.style_toggle', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'style', 'ITALIC')
+kmi = km.keymap_items.new('font.style_toggle', 'U', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'style', 'UNDERLINE')
+kmi = km.keymap_items.new('font.style_toggle', 'P', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'style', 'SMALL_CAPS')
+kmi = km.keymap_items.new('font.delete', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_OR_SELECTION')
+kmi = km.keymap_items.new('font.delete', 'DEL', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('font.delete', 'BACK_SPACE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_OR_SELECTION')
+kmi = km.keymap_items.new('font.delete', 'BACK_SPACE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_OR_SELECTION')
+kmi = km.keymap_items.new('font.delete', 'BACK_SPACE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('font.move', 'HOME', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+kmi = km.keymap_items.new('font.move', 'END', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('font.move', 'LEFT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('font.move', 'RIGHT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_CHARACTER')
+kmi = km.keymap_items.new('font.move', 'LEFT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('font.move', 'RIGHT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('font.move', 'UP_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_LINE')
+kmi = km.keymap_items.new('font.move', 'DOWN_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_LINE')
+kmi = km.keymap_items.new('font.move', 'PAGE_UP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_PAGE')
+kmi = km.keymap_items.new('font.move', 'PAGE_DOWN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_PAGE')
+kmi = km.keymap_items.new('font.move_select', 'HOME', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+kmi = km.keymap_items.new('font.move_select', 'END', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('font.move_select', 'LEFT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('font.move_select', 'RIGHT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_CHARACTER')
+kmi = km.keymap_items.new('font.move_select', 'LEFT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('font.move_select', 'RIGHT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('font.move_select', 'UP_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_LINE')
+kmi = km.keymap_items.new('font.move_select', 'DOWN_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_LINE')
+kmi = km.keymap_items.new('font.move_select', 'PAGE_UP', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_PAGE')
+kmi = km.keymap_items.new('font.move_select', 'PAGE_DOWN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_PAGE')
+kmi = km.keymap_items.new('font.change_spacing', 'LEFT_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('font.change_spacing', 'RIGHT_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('font.change_character', 'UP_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('font.change_character', 'DOWN_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('font.select_all', 'A', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('font.text_copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('font.text_cut', 'X', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('font.text_paste', 'V', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('font.select_all', 'A', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('font.text_copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('font.text_cut', 'X', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('font.text_paste', 'V', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('font.line_break', 'RET', 'PRESS')
+kmi = km.keymap_items.new('font.text_insert', 'TEXTINPUT', 'ANY', any=True)
+kmi = km.keymap_items.new('font.text_insert', 'BACK_SPACE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'accent', True)
+
+# Map Object Non-modal
+km = kc.keymaps.new('Object Non-modal', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('object.mode_set', 'TAB', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'EDIT')
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('object.mode_set', 'TAB', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'POSE')
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('object.mode_set', 'V', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'VERTEX_PAINT')
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('object.mode_set', 'TAB', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'WEIGHT_PAINT')
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('object.origin_set', 'C', 'PRESS', shift=True, ctrl=True, alt=True)
+
+# Map 3D View
+km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('view3d.cursor3d', 'ACTIONMOUSE', 'CLICK')
+kmi = km.keymap_items.new('view3d.rotate', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('view3d.move', 'MIDDLEMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.zoom', 'MIDDLEMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view3d.dolly', 'MIDDLEMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'use_all_regions', True)
+kmi = km.keymap_items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi_props_setattr(kmi.properties, 'use_all_regions', False)
+kmi = km.keymap_items.new('view3d.view_lock_to_active', 'NUMPAD_PERIOD', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.view_lock_clear', 'NUMPAD_PERIOD', 'PRESS', alt=True)
+kmi = km.keymap_items.new('view3d.navigate', 'F', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.smoothview', 'TIMER1', 'ANY', any=True)
+kmi = km.keymap_items.new('view3d.rotate', 'TRACKPADPAN', 'ANY')
+kmi = km.keymap_items.new('view3d.rotate', 'MOUSEROTATE', 'ANY')
+kmi = km.keymap_items.new('view3d.move', 'TRACKPADPAN', 'ANY', shift=True)
+kmi = km.keymap_items.new('view3d.zoom', 'TRACKPADZOOM', 'ANY')
+kmi = km.keymap_items.new('view3d.zoom', 'TRACKPADPAN', 'ANY', ctrl=True)
+kmi = km.keymap_items.new('view3d.zoom', 'NUMPAD_PLUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('view3d.zoom', 'NUMPAD_MINUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('view3d.zoom', 'MINUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('view3d.zoom', 'WHEELINMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('view3d.dolly', 'NUMPAD_PLUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('view3d.dolly', 'NUMPAD_MINUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('view3d.dolly', 'EQUAL', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'delta', 1)
+kmi = km.keymap_items.new('view3d.dolly', 'MINUS', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'delta', -1)
+kmi = km.keymap_items.new('view3d.zoom_camera_1_to_1', 'NUMPAD_ENTER', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.view_center_camera', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('view3d.view_center_lock', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('view3d.view_center_cursor', 'HOME', 'PRESS', alt=True)
+kmi = km.keymap_items.new('view3d.view_center_pick', 'F', 'PRESS', alt=True)
+kmi = km.keymap_items.new('view3d.view_all', 'HOME', 'PRESS')
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi = km.keymap_items.new('view3d.view_all', 'HOME', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'use_all_regions', True)
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi = km.keymap_items.new('view3d.view_all', 'C', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'center', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_0', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'CAMERA')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'FRONT')
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_2', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'ORBITDOWN')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'RIGHT')
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_4', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'ORBITLEFT')
+kmi = km.keymap_items.new('view3d.view_persportho', 'NUMPAD_5', 'PRESS')
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_6', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'ORBITRIGHT')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'TOP')
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_8', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'ORBITUP')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'BACK')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'LEFT')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'BOTTOM')
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANDOWN')
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANLEFT')
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANRIGHT')
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANUP')
+kmi = km.keymap_items.new('view3d.view_roll', 'NUMPAD_4', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'LEFT')
+kmi = km.keymap_items.new('view3d.view_roll', 'NUMPAD_6', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'RIGHT')
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_9', 'PRESS')
+kmi_props_setattr(kmi.properties, 'angle', 3.1415927410125732)
+kmi_props_setattr(kmi.properties, 'type', 'ORBITRIGHT')
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANRIGHT')
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANLEFT')
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANUP')
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PANDOWN')
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'type', 'ORBITLEFT')
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'type', 'ORBITRIGHT')
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'type', 'ORBITUP')
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'type', 'ORBITDOWN')
+kmi = km.keymap_items.new('view3d.view_roll', 'WHEELUPMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'LEFT')
+kmi = km.keymap_items.new('view3d.view_roll', 'WHEELDOWNMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'RIGHT')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'FRONT')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'RIGHT')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'TOP')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'BACK')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'LEFT')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'BOTTOM')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.ndof_orbit_zoom', 'NDOF_MOTION', 'ANY')
+kmi = km.keymap_items.new('view3d.ndof_orbit', 'NDOF_MOTION', 'ANY', ctrl=True)
+kmi = km.keymap_items.new('view3d.ndof_pan', 'NDOF_MOTION', 'ANY', shift=True)
+kmi = km.keymap_items.new('view3d.ndof_all', 'NDOF_MOTION', 'ANY', shift=True, ctrl=True)
+kmi = km.keymap_items.new('view3d.view_selected', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'use_all_regions', False)
+kmi = km.keymap_items.new('view3d.view_roll', 'NDOF_BUTTON_ROLL_CCW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LEFT')
+kmi = km.keymap_items.new('view3d.view_roll', 'NDOF_BUTTON_ROLL_CCW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'RIGHT')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_FRONT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'FRONT')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_BACK', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'BACK')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_LEFT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LEFT')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_RIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'RIGHT')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_TOP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'TOP')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_BOTTOM', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'BOTTOM')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_FRONT', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'FRONT')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_RIGHT', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'RIGHT')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_TOP', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'TOP')
+kmi_props_setattr(kmi.properties, 'align_active', True)
+kmi = km.keymap_items.new('view3d.layers', 'ACCENT_GRAVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'nr', 0)
+kmi = km.keymap_items.new('view3d.layers', 'ONE', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 1)
+kmi = km.keymap_items.new('view3d.layers', 'TWO', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 2)
+kmi = km.keymap_items.new('view3d.layers', 'THREE', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 3)
+kmi = km.keymap_items.new('view3d.layers', 'FOUR', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 4)
+kmi = km.keymap_items.new('view3d.layers', 'FIVE', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 5)
+kmi = km.keymap_items.new('view3d.layers', 'SIX', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 6)
+kmi = km.keymap_items.new('view3d.layers', 'SEVEN', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 7)
+kmi = km.keymap_items.new('view3d.layers', 'EIGHT', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 8)
+kmi = km.keymap_items.new('view3d.layers', 'NINE', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 9)
+kmi = km.keymap_items.new('view3d.layers', 'ZERO', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'nr', 10)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'Z', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.shading.type')
+kmi_props_setattr(kmi.properties, 'value_1', 'SOLID')
+kmi_props_setattr(kmi.properties, 'value_2', 'TEXTURED')
+kmi = km.keymap_items.new('view3d.toggle_render', 'Z', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.toggle_xray_draw_option', 'Z', 'PRESS')
+kmi = km.keymap_items.new('wm.context_toggle', 'Z', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.use_occlude_geometry')
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', False)
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi_props_setattr(kmi.properties, 'enumerate', False)
+kmi_props_setattr(kmi.properties, 'object', False)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi_props_setattr(kmi.properties, 'enumerate', False)
+kmi_props_setattr(kmi.properties, 'object', False)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', False)
+kmi_props_setattr(kmi.properties, 'center', True)
+kmi_props_setattr(kmi.properties, 'enumerate', False)
+kmi_props_setattr(kmi.properties, 'object', True)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', False)
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi_props_setattr(kmi.properties, 'enumerate', True)
+kmi_props_setattr(kmi.properties, 'object', False)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi_props_setattr(kmi.properties, 'center', True)
+kmi_props_setattr(kmi.properties, 'enumerate', False)
+kmi_props_setattr(kmi.properties, 'object', False)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', False)
+kmi_props_setattr(kmi.properties, 'center', True)
+kmi_props_setattr(kmi.properties, 'enumerate', True)
+kmi_props_setattr(kmi.properties, 'object', False)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi_props_setattr(kmi.properties, 'enumerate', True)
+kmi_props_setattr(kmi.properties, 'object', False)
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi_props_setattr(kmi.properties, 'center', True)
+kmi_props_setattr(kmi.properties, 'enumerate', True)
+kmi_props_setattr(kmi.properties, 'object', False)
+kmi = km.keymap_items.new('view3d.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('view3d.select_circle', 'C', 'PRESS')
+kmi = km.keymap_items.new('view3d.clip_border', 'B', 'PRESS', alt=True)
+kmi = km.keymap_items.new('view3d.zoom_border', 'B', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.render_border', 'B', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'camera_only', True)
+kmi = km.keymap_items.new('view3d.render_border', 'B', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'camera_only', False)
+kmi = km.keymap_items.new('view3d.clear_render_border', 'B', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'S', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'VIEW3D_MT_snap')
+if platform == "darwin":
+ kmi = km.keymap_items.new('view3d.copybuffer', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('view3d.pastebuffer', 'V', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('view3d.copybuffer', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view3d.pastebuffer', 'V', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.transform_pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'BOUNDING_BOX_CENTER')
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.transform_pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'MEDIAN_POINT')
+kmi = km.keymap_items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_transform_pivot_point_align')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.transform_pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'CURSOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.transform_pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'INDIVIDUAL_ORIGINS')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.transform_pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'ACTIVE_ELEMENT')
+kmi = km.keymap_items.new('wm.context_toggle', 'SPACE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.show_manipulator')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('transform.bend', 'W', 'PRESS', shift=True)
+kmi = km.keymap_items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('transform.select_orientation', 'SPACE', 'PRESS', alt=True)
+kmi = km.keymap_items.new('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'use', True)
+kmi = km.keymap_items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_snap')
+kmi = km.keymap_items.new('wm.context_menu_enum', 'TAB', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.snap_element')
+kmi = km.keymap_items.new('object.transform_axis_target', 'T', 'PRESS', shift=True)
+kmi = km.keymap_items.new('transform.translate', 'T', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'texture_space', True)
+kmi = km.keymap_items.new('transform.resize', 'T', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'texture_space', True)
+kmi = km.keymap_items.new('transform.skin_resize', 'A', 'PRESS', ctrl=True)
+
+# Map Manipulators
+km = kc.keymaps.new('Manipulators', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+
+# Map Backdrop Transform Widget
+km = kc.keymaps.new('Backdrop Transform Widget', space_type='NODE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Backdrop Crop Widget
+km = kc.keymaps.new('Backdrop Crop Widget', space_type='NODE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Sun Beams Widget
+km = kc.keymaps.new('Sun Beams Widget', space_type='NODE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Corner Pin Widget
+km = kc.keymaps.new('Corner Pin Widget', space_type='NODE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map UV Transform Manipulator
+km = kc.keymaps.new('UV Transform Manipulator', space_type='IMAGE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Spot Lamp Widgets
+km = kc.keymaps.new('Spot Lamp Widgets', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Area Lamp Widgets
+km = kc.keymaps.new('Area Lamp Widgets', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Target Lamp Widgets
+km = kc.keymaps.new('Target Lamp Widgets', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Force Field Widgets
+km = kc.keymaps.new('Force Field Widgets', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Camera Widgets
+km = kc.keymaps.new('Camera Widgets', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Camera View Widgets
+km = kc.keymaps.new('Camera View Widgets', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Armature Spline Widgets
+km = kc.keymaps.new('Armature Spline Widgets', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map View3D Navigate
+km = kc.keymaps.new('View3D Navigate', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('manipulatorgroup.manipulator_tweak', 'LEFTMOUSE', 'PRESS', any=True)
+
+# Map Animation Channels
+km = kc.keymaps.new('Animation Channels', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('anim.channels_click', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_click', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('anim.channels_click', 'LEFTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'children_only', True)
+kmi = km.keymap_items.new('anim.channels_rename', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('anim.channels_rename', 'LEFTMOUSE', 'DOUBLE_CLICK')
+kmi = km.keymap_items.new('anim.channel_select_keys', 'LEFTMOUSE', 'DOUBLE_CLICK')
+kmi = km.keymap_items.new('anim.channel_select_keys', 'LEFTMOUSE', 'DOUBLE_CLICK', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('anim.channels_find', 'F', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('anim.channels_select_all_toggle', 'A', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_select_all_toggle', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'invert', True)
+kmi = km.keymap_items.new('anim.channels_select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_select_border', 'EVT_TWEAK_L', 'ANY')
+kmi = km.keymap_items.new('anim.channels_delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_setting_toggle', 'W', 'PRESS', shift=True)
+kmi = km.keymap_items.new('anim.channels_setting_enable', 'W', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('anim.channels_setting_disable', 'W', 'PRESS', alt=True)
+kmi = km.keymap_items.new('anim.channels_editable_toggle', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_expand', 'NUMPAD_PLUS', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_collapse', 'NUMPAD_MINUS', 'PRESS')
+kmi = km.keymap_items.new('anim.channels_expand', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'all', False)
+kmi = km.keymap_items.new('anim.channels_collapse', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'all', False)
+kmi = km.keymap_items.new('anim.channels_move', 'PAGE_UP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'UP')
+kmi = km.keymap_items.new('anim.channels_move', 'PAGE_DOWN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'DOWN')
+kmi = km.keymap_items.new('anim.channels_move', 'PAGE_UP', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'TOP')
+kmi = km.keymap_items.new('anim.channels_move', 'PAGE_DOWN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'BOTTOM')
+kmi = km.keymap_items.new('anim.channels_group', 'G', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('anim.channels_ungroup', 'G', 'PRESS', alt=True)
+
+# Map UV Editor
+km = kc.keymaps.new('UV Editor', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('wm.context_toggle', 'Q', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_uv_sculpt')
+kmi = km.keymap_items.new('uv.mark_seam', 'E', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('uv.select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('uv.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('uv.select_loop', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('uv.select_loop', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('uv.select_split', 'Y', 'PRESS')
+kmi = km.keymap_items.new('uv.select_border', 'B', 'PRESS')
+kmi_props_setattr(kmi.properties, 'pinned', False)
+kmi = km.keymap_items.new('uv.select_border', 'B', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'pinned', True)
+kmi = km.keymap_items.new('uv.circle_select', 'C', 'PRESS')
+kmi = km.keymap_items.new('uv.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('uv.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('uv.select_linked', 'L', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('uv.select_linked_pick', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('uv.select_linked', 'L', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('uv.select_linked_pick', 'L', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('uv.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('uv.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('uv.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('uv.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('uv.select_pinned', 'P', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'IMAGE_MT_uvs_weldalign')
+kmi = km.keymap_items.new('uv.stitch', 'V', 'PRESS')
+kmi = km.keymap_items.new('uv.pin', 'P', 'PRESS')
+kmi_props_setattr(kmi.properties, 'clear', False)
+kmi = km.keymap_items.new('uv.pin', 'P', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'clear', True)
+kmi = km.keymap_items.new('uv.unwrap', 'E', 'PRESS')
+kmi = km.keymap_items.new('uv.minimize_stretch', 'V', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('uv.pack_islands', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('uv.average_islands_scale', 'A', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('uv.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('uv.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('uv.reveal', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('uv.cursor_set', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('wm.call_menu', 'S', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'IMAGE_MT_uvs_snap')
+kmi = km.keymap_items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'name', 'IMAGE_MT_uvs_select_mode')
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit')
+kmi_props_setattr(kmi.properties, 'value_1', 'DISABLED')
+kmi_props_setattr(kmi.properties, 'value_2', 'ENABLED')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_snap')
+kmi = km.keymap_items.new('wm.context_menu_enum', 'TAB', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.snap_uv_element')
+
+# Map UV Sculpt
+km = kc.keymaps.new('UV Sculpt', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('wm.context_toggle', 'Q', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_uv_sculpt')
+kmi = km.keymap_items.new('sculpt.uv_sculpt_stroke', 'LEFTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'NORMAL')
+kmi = km.keymap_items.new('sculpt.uv_sculpt_stroke', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'INVERT')
+kmi = km.keymap_items.new('sculpt.uv_sculpt_stroke', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'RELAX')
+kmi = km.keymap_items.new('brush.scale_size', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 0.9)
+kmi = km.keymap_items.new('brush.scale_size', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'scalar', 1.0 / 0.9)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.uv_sculpt.brush.size')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.size')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_size')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.uv_sculpt.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.uv_sculpt.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.uv_sculpt.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('wm.radial_control', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path_primary', 'tool_settings.uv_sculpt.brush.strength')
+kmi_props_setattr(kmi.properties, 'data_path_secondary', 'tool_settings.unified_paint_settings.strength')
+kmi_props_setattr(kmi.properties, 'use_secondary', 'tool_settings.unified_paint_settings.use_unified_strength')
+kmi_props_setattr(kmi.properties, 'rotation_path', 'tool_settings.uv_sculpt.brush.texture_slot.angle')
+kmi_props_setattr(kmi.properties, 'color_path', 'tool_settings.uv_sculpt.brush.cursor_color_add')
+kmi_props_setattr(kmi.properties, 'fill_color_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_path', '')
+kmi_props_setattr(kmi.properties, 'fill_color_override_test_path', '')
+kmi_props_setattr(kmi.properties, 'zoom_path', '')
+kmi_props_setattr(kmi.properties, 'image_id', 'tool_settings.uv_sculpt.brush')
+kmi_props_setattr(kmi.properties, 'secondary_tex', False)
+kmi = km.keymap_items.new('brush.uv_sculpt_tool_set', 'S', 'PRESS')
+kmi_props_setattr(kmi.properties, 'tool', 'RELAX')
+kmi = km.keymap_items.new('brush.uv_sculpt_tool_set', 'P', 'PRESS')
+kmi_props_setattr(kmi.properties, 'tool', 'PINCH')
+kmi = km.keymap_items.new('brush.uv_sculpt_tool_set', 'G', 'PRESS')
+kmi_props_setattr(kmi.properties, 'tool', 'GRAB')
+
+# Map Mask Editing
+km = kc.keymaps.new('Mask Editing', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('mask.new', 'N', 'PRESS', alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'MASK_MT_add')
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.proportional_edit_falloff')
+kmi_props_setattr(kmi.properties, 'wrap', True)
+kmi = km.keymap_items.new('wm.context_toggle', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_proportional_edit_mask')
+kmi = km.keymap_items.new('mask.add_vertex_slide', 'ACTIONMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mask.add_feather_vertex_slide', 'ACTIONMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('mask.delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('mask.delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('mask.select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', False)
+kmi = km.keymap_items.new('mask.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('mask.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('mask.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('mask.select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mask.select_linked_pick', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('mask.select_linked_pick', 'L', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('mask.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('mask.select_circle', 'C', 'PRESS')
+kmi = km.keymap_items.new('mask.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('mask.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('mask.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mask.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mask.hide_view_clear', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mask.hide_view_set', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('mask.hide_view_set', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('clip.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('mask.cyclic_toggle', 'C', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mask.slide_point', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('mask.slide_spline_curvature', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('mask.handle_type_set', 'V', 'PRESS')
+kmi = km.keymap_items.new('mask.normals_make_consistent', 'N', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mask.parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mask.parent_clear', 'P', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mask.shape_key_insert', 'I', 'PRESS')
+kmi = km.keymap_items.new('mask.shape_key_clear', 'I', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mask.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('mask.copy_splines', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mask.paste_splines', 'V', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('uv.cursor_set', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'MASK_SHRINKFATTEN')
+
+# Map Graph Editor Generic
+km = kc.keymaps.new('Graph Editor Generic', space_type='GRAPH_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('graph.properties', 'N', 'PRESS')
+kmi = km.keymap_items.new('graph.extrapolation_type', 'E', 'PRESS', shift=True)
+kmi = km.keymap_items.new('anim.channels_find', 'F', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('graph.hide', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('graph.hide', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('graph.reveal', 'H', 'PRESS', alt=True)
+
+# Map Graph Editor
+km = kc.keymaps.new('Graph Editor', space_type='GRAPH_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('wm.context_toggle', 'H', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.show_handles')
+kmi = km.keymap_items.new('graph.cursor_set', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('graph.clickselect', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'curves', False)
+kmi = km.keymap_items.new('graph.clickselect', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'column', True)
+kmi_props_setattr(kmi.properties, 'curves', False)
+kmi = km.keymap_items.new('graph.clickselect', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'curves', False)
+kmi = km.keymap_items.new('graph.clickselect', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'column', True)
+kmi_props_setattr(kmi.properties, 'curves', False)
+kmi = km.keymap_items.new('graph.clickselect', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'curves', True)
+kmi = km.keymap_items.new('graph.clickselect', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'column', False)
+kmi_props_setattr(kmi.properties, 'curves', True)
+kmi = km.keymap_items.new('graph.select_leftright', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CHECK')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('graph.select_leftright', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CHECK')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('graph.select_leftright', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'LEFT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('graph.select_leftright', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'RIGHT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('graph.select_all_toggle', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'invert', False)
+kmi = km.keymap_items.new('graph.select_all_toggle', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'invert', True)
+kmi = km.keymap_items.new('graph.select_border', 'B', 'PRESS')
+kmi_props_setattr(kmi.properties, 'axis_range', False)
+kmi_props_setattr(kmi.properties, 'include_handles', False)
+kmi = km.keymap_items.new('graph.select_border', 'B', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'axis_range', True)
+kmi_props_setattr(kmi.properties, 'include_handles', False)
+kmi = km.keymap_items.new('graph.select_border', 'B', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'axis_range', False)
+kmi_props_setattr(kmi.properties, 'include_handles', True)
+kmi = km.keymap_items.new('graph.select_border', 'B', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'axis_range', True)
+kmi_props_setattr(kmi.properties, 'include_handles', True)
+kmi = km.keymap_items.new('graph.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('graph.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('graph.select_circle', 'C', 'PRESS')
+kmi = km.keymap_items.new('graph.select_column', 'K', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'KEYS')
+kmi = km.keymap_items.new('graph.select_column', 'K', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CFRA')
+kmi = km.keymap_items.new('graph.select_column', 'K', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'mode', 'MARKERS_COLUMN')
+kmi = km.keymap_items.new('graph.select_column', 'K', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'mode', 'MARKERS_BETWEEN')
+kmi = km.keymap_items.new('graph.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('graph.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('graph.select_linked', 'L', 'PRESS')
+kmi = km.keymap_items.new('graph.frame_jump', 'G', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('graph.snap', 'S', 'PRESS', shift=True)
+kmi = km.keymap_items.new('graph.mirror', 'M', 'PRESS', shift=True)
+kmi = km.keymap_items.new('graph.handle_type', 'V', 'PRESS')
+kmi = km.keymap_items.new('graph.interpolation_type', 'T', 'PRESS')
+kmi = km.keymap_items.new('graph.easing_type', 'E', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('graph.smooth', 'O', 'PRESS', alt=True)
+kmi = km.keymap_items.new('graph.sample', 'O', 'PRESS', shift=True)
+kmi = km.keymap_items.new('graph.bake', 'C', 'PRESS', alt=True)
+kmi = km.keymap_items.new('wm.call_menu', 'X', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'GRAPH_MT_delete')
+kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'GRAPH_MT_delete')
+kmi = km.keymap_items.new('graph.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('graph.keyframe_insert', 'I', 'PRESS')
+kmi = km.keymap_items.new('graph.click_insert', 'ACTIONMOUSE', 'CLICK', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('graph.click_insert', 'ACTIONMOUSE', 'CLICK', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('graph.copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('graph.paste', 'V', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('graph.paste', 'V', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'flipped', True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('graph.copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('graph.paste', 'V', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('graph.paste', 'V', 'PRESS', shift=True, oskey=True)
+ kmi_props_setattr(kmi.properties, 'flipped', True)
+kmi = km.keymap_items.new('graph.previewrange_set', 'P', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('graph.view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('graph.view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('graph.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('graph.view_frame', 'NUMPAD_0', 'PRESS')
+kmi = km.keymap_items.new('graph.fmodifier_add', 'M', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'only_active', False)
+kmi = km.keymap_items.new('anim.channels_editable_toggle', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.transform', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_EXTEND')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('wm.context_toggle', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_proportional_fcurve')
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'BOUNDING_BOX_CENTER')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'CURSOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'INDIVIDUAL_ORIGINS')
+kmi = km.keymap_items.new('marker.add', 'M', 'PRESS')
+kmi = km.keymap_items.new('marker.rename', 'M', 'PRESS', ctrl=True)
+
+# Map Image Generic
+km = kc.keymaps.new('Image Generic', space_type='IMAGE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('image.new', 'N', 'PRESS', alt=True)
+kmi = km.keymap_items.new('image.open', 'O', 'PRESS', alt=True)
+kmi = km.keymap_items.new('image.reload', 'R', 'PRESS', alt=True)
+kmi = km.keymap_items.new('image.read_viewlayers', 'R', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('image.save', 'S', 'PRESS', alt=True)
+kmi = km.keymap_items.new('image.save_as', 'F3', 'PRESS')
+kmi = km.keymap_items.new('image.properties', 'N', 'PRESS')
+kmi = km.keymap_items.new('image.toolshelf', 'T', 'PRESS')
+kmi = km.keymap_items.new('image.cycle_render_slot', 'J', 'PRESS')
+kmi = km.keymap_items.new('image.cycle_render_slot', 'J', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'reverse', True)
+
+# Map Image
+km = kc.keymaps.new('Image', space_type='IMAGE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('image.view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('image.view_all', 'HOME', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'fit_view', True)
+kmi = km.keymap_items.new('image.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('image.view_pan', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('image.view_pan', 'MIDDLEMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('image.view_pan', 'TRACKPADPAN', 'ANY')
+kmi = km.keymap_items.new('image.view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('image.view_ndof', 'NDOF_MOTION', 'ANY')
+kmi = km.keymap_items.new('image.view_zoom_in', 'WHEELINMOUSE', 'PRESS')
+kmi = km.keymap_items.new('image.view_zoom_out', 'WHEELOUTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('image.view_zoom_in', 'NUMPAD_PLUS', 'PRESS')
+kmi = km.keymap_items.new('image.view_zoom_out', 'NUMPAD_MINUS', 'PRESS')
+kmi = km.keymap_items.new('image.view_zoom', 'MIDDLEMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('image.view_zoom', 'TRACKPADZOOM', 'ANY')
+kmi = km.keymap_items.new('image.view_zoom', 'TRACKPADPAN', 'ANY', ctrl=True)
+kmi = km.keymap_items.new('image.view_zoom_border', 'B', 'PRESS', shift=True)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_8', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'ratio', 8.0)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_4', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'ratio', 4.0)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_2', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'ratio', 2.0)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_8', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'ratio', 8.0)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_4', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'ratio', 4.0)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_2', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'ratio', 2.0)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_1', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 1.0)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_2', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 0.5)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_4', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 0.25)
+kmi = km.keymap_items.new('image.view_zoom_ratio', 'NUMPAD_8', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 0.125)
+kmi = km.keymap_items.new('image.change_frame', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('image.sample', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('image.curves_point_set', 'ACTIONMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'point', 'BLACK_POINT')
+kmi = km.keymap_items.new('image.curves_point_set', 'ACTIONMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'point', 'WHITE_POINT')
+kmi = km.keymap_items.new('object.mode_set', 'TAB', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'EDIT')
+kmi_props_setattr(kmi.properties, 'toggle', True)
+kmi = km.keymap_items.new('wm.context_set_int', 'ONE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 0)
+kmi = km.keymap_items.new('wm.context_set_int', 'TWO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 1)
+kmi = km.keymap_items.new('wm.context_set_int', 'THREE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 2)
+kmi = km.keymap_items.new('wm.context_set_int', 'FOUR', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 3)
+kmi = km.keymap_items.new('wm.context_set_int', 'FIVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 4)
+kmi = km.keymap_items.new('wm.context_set_int', 'SIX', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 5)
+kmi = km.keymap_items.new('wm.context_set_int', 'SEVEN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 6)
+kmi = km.keymap_items.new('wm.context_set_int', 'EIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.image.render_slots.active_index')
+kmi_props_setattr(kmi.properties, 'value', 7)
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'CENTER')
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'MEDIAN')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'CURSOR')
+kmi = km.keymap_items.new('image.render_border', 'B', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('image.clear_render_border', 'B', 'PRESS', ctrl=True, alt=True)
+
+# Map Node Generic
+km = kc.keymaps.new('Node Generic', space_type='NODE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('node.properties', 'N', 'PRESS')
+kmi = km.keymap_items.new('node.toolbar', 'T', 'PRESS')
+
+# Map Node Editor
+km = kc.keymaps.new('Node Editor', space_type='NODE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select', 'ACTIONMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select_border', 'EVT_TWEAK_S', 'ANY')
+kmi_props_setattr(kmi.properties, 'tweak', True)
+kmi = km.keymap_items.new('node.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('node.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('node.select_circle', 'C', 'PRESS')
+kmi = km.keymap_items.new('node.link', 'LEFTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'detach', False)
+kmi = km.keymap_items.new('node.link', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'detach', True)
+kmi = km.keymap_items.new('node.resize', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('node.add_reroute', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('node.links_cut', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.select_link_viewer', 'LEFTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('node.backimage_move', 'MIDDLEMOUSE', 'PRESS', alt=True)
+kmi = km.keymap_items.new('node.backimage_zoom', 'V', 'PRESS')
+kmi_props_setattr(kmi.properties, 'factor', 1.0 / 1.2)
+kmi = km.keymap_items.new('node.backimage_zoom', 'V', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'factor', 1.2)
+kmi = km.keymap_items.new('node.backimage_fit', 'HOME', 'PRESS', alt=True)
+kmi = km.keymap_items.new('node.backimage_sample', 'ACTIONMOUSE', 'PRESS', alt=True)
+kmi = km.keymap_items.new('node.link_make', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'replace', False)
+kmi = km.keymap_items.new('node.link_make', 'F', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'replace', True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'NODE_MT_add')
+kmi = km.keymap_items.new('node.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('node.duplicate_move_keep_inputs', 'D', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('node.parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.detach', 'P', 'PRESS', alt=True)
+kmi = km.keymap_items.new('node.join', 'J', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.hide_toggle', 'H', 'PRESS')
+kmi = km.keymap_items.new('node.mute_toggle', 'M', 'PRESS')
+kmi = km.keymap_items.new('node.preview_toggle', 'H', 'PRESS', shift=True)
+kmi = km.keymap_items.new('node.hide_socket_toggle', 'H', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('node.view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('node.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('node.select_border', 'B', 'PRESS')
+kmi_props_setattr(kmi.properties, 'tweak', False)
+kmi = km.keymap_items.new('node.delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('node.delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('node.delete_reconnect', 'X', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('node.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('node.select_linked_to', 'L', 'PRESS', shift=True)
+kmi = km.keymap_items.new('node.select_linked_from', 'L', 'PRESS')
+kmi = km.keymap_items.new('node.select_grouped', 'G', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('node.select_grouped', 'G', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('node.select_same_type_step', 'RIGHT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'prev', False)
+kmi = km.keymap_items.new('node.select_same_type_step', 'LEFT_BRACKET', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'prev', True)
+kmi = km.keymap_items.new('node.find_node', 'F', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.group_make', 'G', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.group_ungroup', 'G', 'PRESS', alt=True)
+kmi = km.keymap_items.new('node.group_separate', 'P', 'PRESS')
+kmi = km.keymap_items.new('node.group_edit', 'TAB', 'PRESS')
+kmi_props_setattr(kmi.properties, 'exit', False)
+kmi = km.keymap_items.new('node.group_edit', 'TAB', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'exit', True)
+kmi = km.keymap_items.new('node.read_viewlayers', 'R', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.render_changed', 'Z', 'PRESS')
+kmi = km.keymap_items.new('node.clipboard_copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.clipboard_paste', 'V', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('node.clipboard_copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('node.clipboard_paste', 'V', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('node.viewer_border', 'B', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('node.clear_viewer_border', 'B', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('node.translate_attach', 'G', 'PRESS')
+kmi = km.keymap_items.new('node.translate_attach', 'EVT_TWEAK_A', 'ANY')
+kmi = km.keymap_items.new('node.translate_attach', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_A', 'ANY')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi_props_setattr(kmi.properties, 'release_confirm', True)
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('node.move_detach_links', 'D', 'PRESS', alt=True)
+kmi = km.keymap_items.new('node.move_detach_links_release', 'EVT_TWEAK_A', 'ANY', alt=True)
+kmi = km.keymap_items.new('node.move_detach_links', 'EVT_TWEAK_S', 'ANY', alt=True)
+kmi = km.keymap_items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.use_snap')
+kmi = km.keymap_items.new('wm.context_menu_enum', 'TAB', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'tool_settings.snap_node_element')
+
+# Map Info
+km = kc.keymaps.new('Info', space_type='INFO', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('info.select_pick', 'SELECTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('info.select_all_toggle', 'A', 'PRESS')
+kmi = km.keymap_items.new('info.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('info.report_replay', 'R', 'PRESS')
+kmi = km.keymap_items.new('info.report_delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('info.report_delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('info.report_copy', 'C', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('info.report_copy', 'C', 'PRESS', oskey=True)
+
+# Map File Browser
+km = kc.keymaps.new('File Browser', space_type='FILE_BROWSER', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('file.parent', 'UP_ARROW', 'PRESS', alt=True)
+kmi = km.keymap_items.new('file.previous', 'LEFT_ARROW', 'PRESS', alt=True)
+kmi = km.keymap_items.new('file.next', 'RIGHT_ARROW', 'PRESS', alt=True)
+kmi = km.keymap_items.new('file.refresh', 'R', 'PRESS')
+kmi = km.keymap_items.new('file.parent', 'P', 'PRESS')
+kmi = km.keymap_items.new('file.previous', 'BACK_SPACE', 'PRESS')
+kmi = km.keymap_items.new('file.next', 'BACK_SPACE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.context_toggle', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.params.show_hidden')
+kmi = km.keymap_items.new('file.directory_new', 'I', 'PRESS')
+kmi = km.keymap_items.new('file.delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('file.delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('file.smoothscroll', 'TIMER1', 'ANY', any=True)
+kmi = km.keymap_items.new('file.bookmark_toggle', 'T', 'PRESS')
+kmi = km.keymap_items.new('file.bookmark_add', 'B', 'PRESS', ctrl=True)
+
+# Map File Browser Main
+km = kc.keymaps.new('File Browser Main', space_type='FILE_BROWSER', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('file.execute', 'LEFTMOUSE', 'DOUBLE_CLICK')
+kmi_props_setattr(kmi.properties, 'need_active', True)
+kmi = km.keymap_items.new('file.refresh', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('file.select', 'LEFTMOUSE', 'CLICK')
+kmi = km.keymap_items.new('file.select', 'LEFTMOUSE', 'CLICK', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('file.select', 'LEFTMOUSE', 'CLICK', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'fill', True)
+kmi = km.keymap_items.new('file.select', 'RIGHTMOUSE', 'CLICK')
+kmi_props_setattr(kmi.properties, 'open', False)
+kmi = km.keymap_items.new('file.select', 'RIGHTMOUSE', 'CLICK', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'open', False)
+kmi = km.keymap_items.new('file.select', 'RIGHTMOUSE', 'CLICK', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'fill', True)
+kmi_props_setattr(kmi.properties, 'open', False)
+kmi = km.keymap_items.new('file.select_walk', 'UP_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'UP')
+kmi = km.keymap_items.new('file.select_walk', 'UP_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'UP')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('file.select_walk', 'UP_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'UP')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'fill', True)
+kmi = km.keymap_items.new('file.select_walk', 'DOWN_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'DOWN')
+kmi = km.keymap_items.new('file.select_walk', 'DOWN_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'DOWN')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('file.select_walk', 'DOWN_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'DOWN')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'fill', True)
+kmi = km.keymap_items.new('file.select_walk', 'LEFT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'LEFT')
+kmi = km.keymap_items.new('file.select_walk', 'LEFT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'LEFT')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('file.select_walk', 'LEFT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'LEFT')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'fill', True)
+kmi = km.keymap_items.new('file.select_walk', 'RIGHT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'direction', 'RIGHT')
+kmi = km.keymap_items.new('file.select_walk', 'RIGHT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'direction', 'RIGHT')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('file.select_walk', 'RIGHT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'RIGHT')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'fill', True)
+kmi = km.keymap_items.new('file.previous', 'BUTTON4MOUSE', 'CLICK')
+kmi = km.keymap_items.new('file.next', 'BUTTON5MOUSE', 'CLICK')
+kmi = km.keymap_items.new('file.select_all_toggle', 'A', 'PRESS')
+kmi = km.keymap_items.new('file.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('file.select_border', 'EVT_TWEAK_L', 'ANY')
+kmi = km.keymap_items.new('file.rename', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('file.highlight', 'MOUSEMOVE', 'ANY', any=True)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_PLUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'increment', 1)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_PLUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'increment', 10)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'increment', 100)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_MINUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'increment', -1)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_MINUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'increment', -10)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'increment', -100)
+
+# Map File Browser Buttons
+km = kc.keymaps.new('File Browser Buttons', space_type='FILE_BROWSER', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_PLUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'increment', 1)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_PLUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'increment', 10)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'increment', 100)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_MINUS', 'PRESS')
+kmi_props_setattr(kmi.properties, 'increment', -1)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_MINUS', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'increment', -10)
+kmi = km.keymap_items.new('file.filenum', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'increment', -100)
+
+# Map NLA Generic
+km = kc.keymaps.new('NLA Generic', space_type='NLA_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('nla.properties', 'N', 'PRESS')
+kmi = km.keymap_items.new('nla.tweakmode_enter', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('nla.tweakmode_exit', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('nla.tweakmode_enter', 'TAB', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'isolate_action', True)
+kmi = km.keymap_items.new('nla.tweakmode_exit', 'TAB', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'isolate_action', True)
+kmi = km.keymap_items.new('anim.channels_find', 'F', 'PRESS', ctrl=True)
+
+# Map NLA Channels
+km = kc.keymaps.new('NLA Channels', space_type='NLA_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('nla.channels_click', 'LEFTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('nla.channels_click', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('nla.tracks_add', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'above_selected', False)
+kmi = km.keymap_items.new('nla.tracks_add', 'A', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'above_selected', True)
+kmi = km.keymap_items.new('nla.tracks_delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('nla.tracks_delete', 'DEL', 'PRESS')
+
+# Map NLA Editor
+km = kc.keymaps.new('NLA Editor', space_type='NLA_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('nla.click_select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('nla.click_select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('nla.select_leftright', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CHECK')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('nla.select_leftright', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'mode', 'CHECK')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('nla.select_leftright', 'LEFT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'LEFT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('nla.select_leftright', 'RIGHT_BRACKET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'RIGHT')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('nla.select_all_toggle', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'invert', False)
+kmi = km.keymap_items.new('nla.select_all_toggle', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'invert', True)
+kmi = km.keymap_items.new('nla.select_border', 'B', 'PRESS')
+kmi_props_setattr(kmi.properties, 'axis_range', False)
+kmi = km.keymap_items.new('nla.select_border', 'B', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'axis_range', True)
+kmi = km.keymap_items.new('nla.previewrange_set', 'P', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('nla.view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('nla.view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('nla.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('nla.view_frame', 'NUMPAD_0', 'PRESS')
+kmi = km.keymap_items.new('nla.actionclip_add', 'A', 'PRESS', shift=True)
+kmi = km.keymap_items.new('nla.transition_add', 'T', 'PRESS', shift=True)
+kmi = km.keymap_items.new('nla.soundclip_add', 'K', 'PRESS', shift=True)
+kmi = km.keymap_items.new('nla.meta_add', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('nla.meta_remove', 'G', 'PRESS', alt=True)
+kmi = km.keymap_items.new('nla.duplicate', 'D', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'linked', False)
+kmi = km.keymap_items.new('nla.duplicate', 'D', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'linked', True)
+kmi = km.keymap_items.new('nla.make_single_user', 'U', 'PRESS')
+kmi = km.keymap_items.new('nla.delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('nla.delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('nla.split', 'Y', 'PRESS')
+kmi = km.keymap_items.new('nla.mute_toggle', 'H', 'PRESS')
+kmi = km.keymap_items.new('nla.swap', 'F', 'PRESS', alt=True)
+kmi = km.keymap_items.new('nla.move_up', 'PAGE_UP', 'PRESS')
+kmi = km.keymap_items.new('nla.move_down', 'PAGE_DOWN', 'PRESS')
+kmi = km.keymap_items.new('nla.apply_scale', 'A', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('nla.clear_scale', 'S', 'PRESS', alt=True)
+kmi = km.keymap_items.new('nla.snap', 'S', 'PRESS', shift=True)
+kmi = km.keymap_items.new('nla.fmodifier_add', 'M', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('transform.transform', 'G', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi = km.keymap_items.new('transform.transform', 'EVT_TWEAK_S', 'ANY')
+kmi_props_setattr(kmi.properties, 'mode', 'TRANSLATION')
+kmi = km.keymap_items.new('transform.transform', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_EXTEND')
+kmi = km.keymap_items.new('transform.transform', 'S', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_SCALE')
+kmi = km.keymap_items.new('marker.add', 'M', 'PRESS')
+kmi = km.keymap_items.new('marker.rename', 'M', 'PRESS', ctrl=True)
+
+# Map Text Generic
+km = kc.keymaps.new('Text Generic', space_type='TEXT_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('text.start_find', 'F', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('text.start_find', 'F', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('text.jump', 'J', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.find', 'G', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.replace', 'H', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.properties', 'T', 'PRESS', ctrl=True)
+
+# Map Text
+km = kc.keymaps.new('Text', space_type='TEXT_EDITOR', region_type='WINDOW', modal=False)
+
+if platform == "darwin":
+ kmi = km.keymap_items.new('text.move', 'LEFT_ARROW', 'PRESS', oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+ kmi = km.keymap_items.new('text.move', 'RIGHT_ARROW', 'PRESS', oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+ kmi = km.keymap_items.new('text.move', 'LEFT_ARROW', 'PRESS', alt=True)
+ kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+ kmi = km.keymap_items.new('text.move', 'RIGHT_ARROW', 'PRESS', alt=True)
+ kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+ kmi = km.keymap_items.new('text.move', 'UP_ARROW', 'PRESS', oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'FILE_TOP')
+ kmi = km.keymap_items.new('text.move', 'DOWN_ARROW', 'PRESS', oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'FILE_BOTTOM')
+ kmi = km.keymap_items.new('text.move_select', 'LEFT_ARROW', 'PRESS', shift=True, oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+ kmi = km.keymap_items.new('text.move_select', 'RIGHT_ARROW', 'PRESS', shift=True, oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+ kmi = km.keymap_items.new('text.move_select', 'LEFT_ARROW', 'PRESS', shift=True, alt=True)
+ kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+ kmi = km.keymap_items.new('text.move_select', 'RIGHT_ARROW', 'PRESS', shift=True, alt=True)
+ kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+ kmi = km.keymap_items.new('text.move_select', 'UP_ARROW', 'PRESS', shift=True, oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'FILE_TOP')
+ kmi = km.keymap_items.new('text.move_select', 'DOWN_ARROW', 'PRESS', shift=True, oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'FILE_BOTTOM')
+ kmi = km.keymap_items.new('text.delete', 'BACK_SPACE', 'PRESS', alt=True)
+ kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+ kmi = km.keymap_items.new('text.save', 'S', 'PRESS', alt=True, oskey=True)
+ kmi = km.keymap_items.new('text.save_as', 'S', 'PRESS', shift=True, alt=True, oskey=True)
+ kmi = km.keymap_items.new('text.cut', 'X', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('text.copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('text.paste', 'V', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('text.find_set_selected', 'E', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('text.select_all', 'A', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('text.select_line', 'A', 'PRESS', shift=True, oskey=True)
+kmi = km.keymap_items.new('wm.context_cycle_int', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', False)
+kmi = km.keymap_items.new('wm.context_cycle_int', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', True)
+kmi = km.keymap_items.new('wm.context_cycle_int', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', False)
+kmi = km.keymap_items.new('wm.context_cycle_int', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', True)
+kmi = km.keymap_items.new('text.new', 'N', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.open', 'O', 'PRESS', alt=True)
+kmi = km.keymap_items.new('text.reload', 'R', 'PRESS', alt=True)
+kmi = km.keymap_items.new('text.save', 'S', 'PRESS', alt=True)
+kmi = km.keymap_items.new('text.save_as', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('text.run_script', 'P', 'PRESS', alt=True)
+kmi = km.keymap_items.new('text.cut', 'X', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.paste', 'V', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.cut', 'DEL', 'PRESS', shift=True)
+kmi = km.keymap_items.new('text.copy', 'INSERT', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.paste', 'INSERT', 'PRESS', shift=True)
+kmi = km.keymap_items.new('text.duplicate_line', 'D', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.select_all', 'A', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.select_line', 'A', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('text.select_word', 'LEFTMOUSE', 'DOUBLE_CLICK')
+kmi = km.keymap_items.new('text.move_lines', 'UP_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'UP')
+kmi = km.keymap_items.new('text.move_lines', 'DOWN_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'direction', 'DOWN')
+kmi = km.keymap_items.new('text.indent', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('text.unindent', 'TAB', 'PRESS', shift=True)
+kmi = km.keymap_items.new('text.uncomment', 'D', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('text.move', 'HOME', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+kmi = km.keymap_items.new('text.move', 'END', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('text.move', 'E', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('text.move', 'E', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('text.move', 'LEFT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('text.move', 'RIGHT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_CHARACTER')
+kmi = km.keymap_items.new('text.move', 'LEFT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('text.move', 'RIGHT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('text.move', 'UP_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_LINE')
+kmi = km.keymap_items.new('text.move', 'DOWN_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_LINE')
+kmi = km.keymap_items.new('text.move', 'PAGE_UP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_PAGE')
+kmi = km.keymap_items.new('text.move', 'PAGE_DOWN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_PAGE')
+kmi = km.keymap_items.new('text.move', 'HOME', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'FILE_TOP')
+kmi = km.keymap_items.new('text.move', 'END', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'FILE_BOTTOM')
+kmi = km.keymap_items.new('text.move_select', 'HOME', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+kmi = km.keymap_items.new('text.move_select', 'END', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('text.move_select', 'LEFT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('text.move_select', 'RIGHT_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_CHARACTER')
+kmi = km.keymap_items.new('text.move_select', 'LEFT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('text.move_select', 'RIGHT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('text.move_select', 'UP_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_LINE')
+kmi = km.keymap_items.new('text.move_select', 'DOWN_ARROW', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_LINE')
+kmi = km.keymap_items.new('text.move_select', 'PAGE_UP', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_PAGE')
+kmi = km.keymap_items.new('text.move_select', 'PAGE_DOWN', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_PAGE')
+kmi = km.keymap_items.new('text.move_select', 'HOME', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'FILE_TOP')
+kmi = km.keymap_items.new('text.move_select', 'END', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'FILE_BOTTOM')
+kmi = km.keymap_items.new('text.delete', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_CHARACTER')
+kmi = km.keymap_items.new('text.delete', 'BACK_SPACE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('text.delete', 'BACK_SPACE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('text.delete', 'DEL', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('text.delete', 'BACK_SPACE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('text.overwrite_toggle', 'INSERT', 'PRESS')
+kmi = km.keymap_items.new('text.scroll_bar', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('text.scroll_bar', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('text.scroll', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('text.scroll', 'TRACKPADPAN', 'ANY')
+kmi = km.keymap_items.new('text.selection_set', 'EVT_TWEAK_L', 'ANY')
+kmi = km.keymap_items.new('text.cursor_set', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('text.selection_set', 'LEFTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'select', True)
+kmi = km.keymap_items.new('text.scroll', 'WHEELUPMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'lines', -1)
+kmi = km.keymap_items.new('text.scroll', 'WHEELDOWNMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'lines', 1)
+kmi = km.keymap_items.new('text.line_break', 'RET', 'PRESS')
+kmi = km.keymap_items.new('text.line_break', 'NUMPAD_ENTER', 'PRESS')
+kmi = km.keymap_items.new('wm.call_menu', 'RIGHTMOUSE', 'PRESS', any=True)
+kmi_props_setattr(kmi.properties, 'name', 'TEXT_MT_toolbox')
+kmi = km.keymap_items.new('text.autocomplete', 'SPACE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('text.line_number', 'TEXTINPUT', 'ANY', any=True)
+kmi = km.keymap_items.new('text.insert', 'TEXTINPUT', 'ANY', any=True)
+
+# Map SequencerCommon
+km = kc.keymaps.new('SequencerCommon', space_type='SEQUENCE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('sequencer.properties', 'N', 'PRESS')
+kmi = km.keymap_items.new('wm.context_toggle', 'O', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'scene.sequence_editor.show_overlay')
+kmi = km.keymap_items.new('sequencer.view_toggle', 'TAB', 'PRESS', ctrl=True)
+
+# Map Sequencer
+km = kc.keymaps.new('Sequencer', space_type='SEQUENCE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('sequencer.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('sequencer.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('sequencer.cut', 'K', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'SOFT')
+kmi = km.keymap_items.new('sequencer.cut', 'K', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'HARD')
+kmi = km.keymap_items.new('sequencer.mute', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('sequencer.mute', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('sequencer.unmute', 'H', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('sequencer.unmute', 'H', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('sequencer.lock', 'L', 'PRESS', shift=True)
+kmi = km.keymap_items.new('sequencer.unlock', 'L', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('sequencer.reassign_inputs', 'R', 'PRESS')
+kmi = km.keymap_items.new('sequencer.reload', 'R', 'PRESS', alt=True)
+kmi = km.keymap_items.new('sequencer.reload', 'R', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'adjust_length', True)
+kmi = km.keymap_items.new('sequencer.offset_clear', 'O', 'PRESS', alt=True)
+kmi = km.keymap_items.new('sequencer.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('sequencer.delete', 'X', 'PRESS')
+kmi = km.keymap_items.new('sequencer.delete', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('sequencer.copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('sequencer.paste', 'V', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('sequencer.copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('sequencer.paste', 'V', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('sequencer.images_separate', 'Y', 'PRESS')
+kmi = km.keymap_items.new('sequencer.meta_toggle', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('sequencer.meta_make', 'G', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('sequencer.meta_separate', 'G', 'PRESS', alt=True)
+kmi = km.keymap_items.new('sequencer.view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('sequencer.view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('sequencer.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('sequencer.view_frame', 'NUMPAD_0', 'PRESS')
+kmi = km.keymap_items.new('sequencer.strip_jump', 'PAGE_UP', 'PRESS')
+kmi_props_setattr(kmi.properties, 'next', True)
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi = km.keymap_items.new('sequencer.strip_jump', 'PAGE_DOWN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'next', False)
+kmi_props_setattr(kmi.properties, 'center', False)
+kmi = km.keymap_items.new('sequencer.strip_jump', 'PAGE_UP', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'next', True)
+kmi_props_setattr(kmi.properties, 'center', True)
+kmi = km.keymap_items.new('sequencer.strip_jump', 'PAGE_DOWN', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'next', False)
+kmi_props_setattr(kmi.properties, 'center', True)
+kmi = km.keymap_items.new('sequencer.swap', 'LEFT_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'side', 'LEFT')
+kmi = km.keymap_items.new('sequencer.swap', 'RIGHT_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'side', 'RIGHT')
+kmi = km.keymap_items.new('sequencer.gap_remove', 'BACK_SPACE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'all', False)
+kmi = km.keymap_items.new('sequencer.gap_remove', 'BACK_SPACE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'all', True)
+kmi = km.keymap_items.new('sequencer.gap_insert', 'EQUAL', 'PRESS', shift=True)
+kmi = km.keymap_items.new('sequencer.snap', 'S', 'PRESS', shift=True)
+kmi = km.keymap_items.new('sequencer.swap_inputs', 'S', 'PRESS', alt=True)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'ONE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 1)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'TWO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 2)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'THREE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 3)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'FOUR', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 4)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'FIVE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 5)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'SIX', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 6)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'SEVEN', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 7)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'EIGHT', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 8)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'NINE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 9)
+kmi = km.keymap_items.new('sequencer.cut_multicam', 'ZERO', 'PRESS')
+kmi_props_setattr(kmi.properties, 'camera', 10)
+kmi = km.keymap_items.new('sequencer.select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'linked_handle', False)
+kmi_props_setattr(kmi.properties, 'left_right', 'NONE')
+kmi_props_setattr(kmi.properties, 'linked_time', False)
+kmi = km.keymap_items.new('sequencer.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'linked_handle', False)
+kmi_props_setattr(kmi.properties, 'left_right', 'NONE')
+kmi_props_setattr(kmi.properties, 'linked_time', False)
+kmi = km.keymap_items.new('sequencer.select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'linked_handle', True)
+kmi_props_setattr(kmi.properties, 'left_right', 'NONE')
+kmi_props_setattr(kmi.properties, 'linked_time', False)
+kmi = km.keymap_items.new('sequencer.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'linked_handle', True)
+kmi_props_setattr(kmi.properties, 'left_right', 'NONE')
+kmi_props_setattr(kmi.properties, 'linked_time', False)
+kmi = km.keymap_items.new('sequencer.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi_props_setattr(kmi.properties, 'linked_handle', False)
+kmi_props_setattr(kmi.properties, 'left_right', 'MOUSE')
+kmi_props_setattr(kmi.properties, 'linked_time', True)
+kmi = km.keymap_items.new('sequencer.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi_props_setattr(kmi.properties, 'linked_handle', False)
+kmi_props_setattr(kmi.properties, 'left_right', 'NONE')
+kmi_props_setattr(kmi.properties, 'linked_time', True)
+kmi = km.keymap_items.new('sequencer.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('sequencer.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('sequencer.select_linked_pick', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('sequencer.select_linked_pick', 'L', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('sequencer.select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('sequencer.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('sequencer.select_grouped', 'G', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'SEQUENCER_MT_add')
+kmi = km.keymap_items.new('wm.call_menu', 'C', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'SEQUENCER_MT_change')
+kmi = km.keymap_items.new('sequencer.slip', 'S', 'PRESS')
+kmi = km.keymap_items.new('wm.context_set_int', 'O', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'scene.sequence_editor.overlay_frame')
+kmi_props_setattr(kmi.properties, 'value', 0)
+kmi = km.keymap_items.new('transform.seq_slide', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.seq_slide', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.transform', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'mode', 'TIME_EXTEND')
+kmi = km.keymap_items.new('marker.add', 'M', 'PRESS')
+kmi = km.keymap_items.new('marker.rename', 'M', 'PRESS', ctrl=True)
+
+# Map SequencerPreview
+km = kc.keymaps.new('SequencerPreview', space_type='SEQUENCE_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('sequencer.view_all_preview', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('sequencer.view_all_preview', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('sequencer.view_ghost_border', 'O', 'PRESS')
+kmi = km.keymap_items.new('sequencer.view_zoom_ratio', 'NUMPAD_1', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 1.0)
+kmi = km.keymap_items.new('sequencer.sample', 'ACTIONMOUSE', 'PRESS')
+
+# Map Console
+km = kc.keymaps.new('Console', space_type='CONSOLE', region_type='WINDOW', modal=False)
+
+if platform == "darwin":
+ kmi = km.keymap_items.new('console.move', 'LEFT_ARROW', 'PRESS', oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+ kmi = km.keymap_items.new('console.move', 'RIGHT_ARROW', 'PRESS', oskey=True)
+ kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('console.move', 'LEFT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('console.move', 'RIGHT_ARROW', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('console.move', 'HOME', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LINE_BEGIN')
+kmi = km.keymap_items.new('console.move', 'END', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'LINE_END')
+kmi = km.keymap_items.new('wm.context_cycle_int', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', False)
+kmi = km.keymap_items.new('wm.context_cycle_int', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', True)
+kmi = km.keymap_items.new('wm.context_cycle_int', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', False)
+kmi = km.keymap_items.new('wm.context_cycle_int', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.font_size')
+kmi_props_setattr(kmi.properties, 'reverse', True)
+kmi = km.keymap_items.new('console.move', 'LEFT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('console.move', 'RIGHT_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_CHARACTER')
+kmi = km.keymap_items.new('console.history_cycle', 'UP_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'reverse', True)
+kmi = km.keymap_items.new('console.history_cycle', 'DOWN_ARROW', 'PRESS')
+kmi_props_setattr(kmi.properties, 'reverse', False)
+kmi = km.keymap_items.new('console.delete', 'DEL', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_CHARACTER')
+kmi = km.keymap_items.new('console.delete', 'BACK_SPACE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('console.delete', 'BACK_SPACE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_CHARACTER')
+kmi = km.keymap_items.new('console.delete', 'DEL', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'NEXT_WORD')
+kmi = km.keymap_items.new('console.delete', 'BACK_SPACE', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'type', 'PREVIOUS_WORD')
+kmi = km.keymap_items.new('console.clear_line', 'RET', 'PRESS', shift=True)
+kmi = km.keymap_items.new('console.clear_line', 'NUMPAD_ENTER', 'PRESS', shift=True)
+kmi = km.keymap_items.new('console.execute', 'RET', 'PRESS')
+kmi_props_setattr(kmi.properties, 'interactive', True)
+kmi = km.keymap_items.new('console.execute', 'NUMPAD_ENTER', 'PRESS')
+kmi_props_setattr(kmi.properties, 'interactive', True)
+kmi = km.keymap_items.new('console.autocomplete', 'SPACE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('console.copy_as_script', 'C', 'PRESS', shift=True, ctrl=True)
+kmi = km.keymap_items.new('console.copy', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('console.paste', 'V', 'PRESS', ctrl=True)
+if platform == "darwin":
+ kmi = km.keymap_items.new('console.copy', 'C', 'PRESS', oskey=True)
+ kmi = km.keymap_items.new('console.paste', 'V', 'PRESS', oskey=True)
+kmi = km.keymap_items.new('console.select_set', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('console.select_word', 'LEFTMOUSE', 'DOUBLE_CLICK')
+kmi = km.keymap_items.new('console.insert', 'TAB', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'text', '\t')
+kmi = km.keymap_items.new('console.indent', 'TAB', 'PRESS')
+kmi = km.keymap_items.new('console.unindent', 'TAB', 'PRESS', shift=True)
+kmi = km.keymap_items.new('console.insert', 'TEXTINPUT', 'ANY', any=True)
+
+# Map Clip
+km = kc.keymaps.new('Clip', space_type='CLIP_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('clip.open', 'O', 'PRESS', alt=True)
+kmi = km.keymap_items.new('clip.tools', 'T', 'PRESS')
+kmi = km.keymap_items.new('clip.properties', 'N', 'PRESS')
+kmi = km.keymap_items.new('clip.track_markers', 'LEFT_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'backwards', True)
+kmi_props_setattr(kmi.properties, 'sequence', False)
+kmi = km.keymap_items.new('clip.track_markers', 'RIGHT_ARROW', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'backwards', False)
+kmi_props_setattr(kmi.properties, 'sequence', False)
+kmi = km.keymap_items.new('clip.track_markers', 'T', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'backwards', False)
+kmi_props_setattr(kmi.properties, 'sequence', True)
+kmi = km.keymap_items.new('clip.track_markers', 'T', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'backwards', True)
+kmi_props_setattr(kmi.properties, 'sequence', True)
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'TAB', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.mode')
+kmi_props_setattr(kmi.properties, 'value_1', 'TRACKING')
+kmi_props_setattr(kmi.properties, 'value_2', 'MASK')
+kmi = km.keymap_items.new('clip.solve_camera', 'S', 'PRESS', shift=True)
+kmi = km.keymap_items.new('clip.set_solver_keyframe', 'Q', 'PRESS')
+kmi_props_setattr(kmi.properties, 'keyframe', 'KEYFRAME_A')
+kmi = km.keymap_items.new('clip.set_solver_keyframe', 'E', 'PRESS')
+kmi_props_setattr(kmi.properties, 'keyframe', 'KEYFRAME_B')
+kmi = km.keymap_items.new('clip.prefetch', 'P', 'PRESS')
+
+# Map Clip Editor
+km = kc.keymaps.new('Clip Editor', space_type='CLIP_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('clip.view_pan', 'MIDDLEMOUSE', 'PRESS')
+kmi = km.keymap_items.new('clip.view_pan', 'MIDDLEMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new('clip.view_pan', 'TRACKPADPAN', 'ANY')
+kmi = km.keymap_items.new('clip.view_zoom', 'MIDDLEMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('clip.view_zoom', 'TRACKPADZOOM', 'ANY')
+kmi = km.keymap_items.new('clip.view_zoom', 'TRACKPADPAN', 'ANY', ctrl=True)
+kmi = km.keymap_items.new('clip.view_zoom_in', 'WHEELINMOUSE', 'PRESS')
+kmi = km.keymap_items.new('clip.view_zoom_out', 'WHEELOUTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('clip.view_zoom_in', 'NUMPAD_PLUS', 'PRESS')
+kmi = km.keymap_items.new('clip.view_zoom_out', 'NUMPAD_MINUS', 'PRESS')
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_8', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'ratio', 8.0)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_4', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'ratio', 4.0)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_2', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'ratio', 2.0)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_8', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'ratio', 8.0)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_4', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'ratio', 4.0)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_2', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'ratio', 2.0)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_1', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 1.0)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_2', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 0.5)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_4', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 0.25)
+kmi = km.keymap_items.new('clip.view_zoom_ratio', 'NUMPAD_8', 'PRESS')
+kmi_props_setattr(kmi.properties, 'ratio', 0.125)
+kmi = km.keymap_items.new('clip.view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('clip.view_all', 'F', 'PRESS')
+kmi_props_setattr(kmi.properties, 'fit_view', True)
+kmi = km.keymap_items.new('clip.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('clip.view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('clip.view_ndof', 'NDOF_MOTION', 'ANY')
+kmi = km.keymap_items.new('clip.frame_jump', 'LEFT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'position', 'PATHSTART')
+kmi = km.keymap_items.new('clip.frame_jump', 'RIGHT_ARROW', 'PRESS', shift=True, ctrl=True)
+kmi_props_setattr(kmi.properties, 'position', 'PATHEND')
+kmi = km.keymap_items.new('clip.frame_jump', 'LEFT_ARROW', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'position', 'FAILEDPREV')
+kmi = km.keymap_items.new('clip.frame_jump', 'RIGHT_ARROW', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'position', 'PATHSTART')
+kmi = km.keymap_items.new('clip.change_frame', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('clip.select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('clip.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('clip.select_all', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('clip.select_all', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('clip.select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('clip.select_circle', 'C', 'PRESS')
+kmi = km.keymap_items.new('wm.call_menu', 'G', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'name', 'CLIP_MT_select_grouped')
+kmi = km.keymap_items.new('clip.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', False)
+kmi = km.keymap_items.new('clip.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True, alt=True)
+kmi_props_setattr(kmi.properties, 'deselect', True)
+kmi = km.keymap_items.new('clip.add_marker_slide', 'LEFTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('clip.delete_marker', 'DEL', 'PRESS', shift=True)
+kmi = km.keymap_items.new('clip.delete_marker', 'X', 'PRESS', shift=True)
+kmi = km.keymap_items.new('clip.slide_marker', 'LEFTMOUSE', 'PRESS')
+kmi = km.keymap_items.new('clip.disable_markers', 'D', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('clip.delete_track', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('clip.delete_track', 'X', 'PRESS')
+kmi = km.keymap_items.new('clip.lock_tracks', 'L', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'LOCK')
+kmi = km.keymap_items.new('clip.lock_tracks', 'L', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'action', 'UNLOCK')
+kmi = km.keymap_items.new('clip.hide_tracks', 'H', 'PRESS')
+kmi_props_setattr(kmi.properties, 'unselected', False)
+kmi = km.keymap_items.new('clip.hide_tracks', 'H', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'unselected', True)
+kmi = km.keymap_items.new('clip.hide_tracks_clear', 'H', 'PRESS', alt=True)
+kmi = km.keymap_items.new('clip.slide_plane_marker', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('clip.keyframe_insert', 'I', 'PRESS')
+kmi = km.keymap_items.new('clip.keyframe_delete', 'I', 'PRESS', alt=True)
+kmi = km.keymap_items.new('clip.join_tracks', 'J', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi_props_setattr(kmi.properties, 'name', 'CLIP_MT_tracking_specials')
+kmi = km.keymap_items.new('wm.context_toggle', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.lock_selection')
+kmi = km.keymap_items.new('wm.context_toggle', 'D', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.show_disabled')
+kmi = km.keymap_items.new('wm.context_toggle', 'S', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.show_marker_search')
+kmi = km.keymap_items.new('wm.context_toggle', 'M', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.use_mute_footage')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('clip.clear_track_path', 'T', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'action', 'REMAINED')
+kmi_props_setattr(kmi.properties, 'clear_active', False)
+kmi = km.keymap_items.new('clip.clear_track_path', 'T', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'action', 'UPTO')
+kmi_props_setattr(kmi.properties, 'clear_active', False)
+kmi = km.keymap_items.new('clip.clear_track_path', 'T', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'action', 'ALL')
+kmi_props_setattr(kmi.properties, 'clear_active', False)
+kmi = km.keymap_items.new('clip.cursor_set', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'BOUNDING_BOX_CENTER')
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'MEDIAN_POINT')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'CURSOR')
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.pivot_point')
+kmi_props_setattr(kmi.properties, 'value', 'INDIVIDUAL_ORIGINS')
+kmi = km.keymap_items.new('clip.copy_tracks', 'C', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('clip.paste_tracks', 'V', 'PRESS', ctrl=True)
+
+# Map Clip Graph Editor
+km = kc.keymaps.new('Clip Graph Editor', space_type='CLIP_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('clip.change_frame', 'ACTIONMOUSE', 'PRESS')
+kmi = km.keymap_items.new('clip.graph_select', 'SELECTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', False)
+kmi = km.keymap_items.new('clip.graph_select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('clip.graph_select_all_markers', 'A', 'PRESS')
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('clip.graph_select_all_markers', 'I', 'PRESS', ctrl=True)
+kmi_props_setattr(kmi.properties, 'action', 'INVERT')
+kmi = km.keymap_items.new('clip.graph_select_border', 'B', 'PRESS')
+kmi = km.keymap_items.new('clip.graph_delete_curve', 'DEL', 'PRESS')
+kmi = km.keymap_items.new('clip.graph_delete_curve', 'X', 'PRESS')
+kmi = km.keymap_items.new('clip.graph_delete_knot', 'DEL', 'PRESS', shift=True)
+kmi = km.keymap_items.new('clip.graph_delete_knot', 'X', 'PRESS', shift=True)
+kmi = km.keymap_items.new('clip.graph_view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('clip.graph_view_all', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('clip.graph_center_current_frame', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('wm.context_toggle', 'L', 'PRESS')
+kmi_props_setattr(kmi.properties, 'data_path', 'space_data.lock_time_cursor')
+kmi = km.keymap_items.new('clip.clear_track_path', 'T', 'PRESS', alt=True)
+kmi_props_setattr(kmi.properties, 'action', 'REMAINED')
+kmi_props_setattr(kmi.properties, 'clear_active', True)
+kmi = km.keymap_items.new('clip.clear_track_path', 'T', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'action', 'UPTO')
+kmi_props_setattr(kmi.properties, 'clear_active', True)
+kmi = km.keymap_items.new('clip.clear_track_path', 'T', 'PRESS', shift=True, alt=True)
+kmi_props_setattr(kmi.properties, 'action', 'ALL')
+kmi_props_setattr(kmi.properties, 'clear_active', True)
+kmi = km.keymap_items.new('clip.graph_disable_markers', 'D', 'PRESS', shift=True)
+kmi_props_setattr(kmi.properties, 'action', 'TOGGLE')
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+
+# Map Clip Dopesheet Editor
+km = kc.keymaps.new('Clip Dopesheet Editor', space_type='CLIP_EDITOR', region_type='WINDOW', modal=False)
+
+kmi = km.keymap_items.new('clip.dopesheet_select_channel', 'LEFTMOUSE', 'PRESS')
+kmi_props_setattr(kmi.properties, 'extend', True)
+kmi = km.keymap_items.new('clip.dopesheet_view_all', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('clip.dopesheet_view_all', 'NDOF_BUTTON_FIT', 'PRESS')
diff --git a/release/scripts/presets/keyconfig/maya.py b/release/scripts/presets/keyconfig/maya.py
index c5d09434452..da1446f6f43 100644
--- a/release/scripts/presets/keyconfig/maya.py
+++ b/release/scripts/presets/keyconfig/maya.py
@@ -86,7 +86,6 @@ kmi = km.keymap_items.new('screen.screen_set', 'LEFT_ARROW', 'PRESS', ctrl=True)
kmi.properties.delta = -1
kmi = km.keymap_items.new('screen.screen_full_area', 'SPACE', 'PRESS', shift=True)
kmi = km.keymap_items.new('screen.screenshot', 'F3', 'PRESS', ctrl=True)
-kmi = km.keymap_items.new('screen.screencast', 'F3', 'PRESS', alt=True)
kmi = km.keymap_items.new('screen.region_quadview', 'SPACE', 'PRESS')
kmi = km.keymap_items.new('screen.repeat_history', 'F3', 'PRESS')
kmi = km.keymap_items.new('screen.repeat_last', 'G', 'PRESS')
@@ -1916,4 +1915,3 @@ kmi.properties.action = 'TOGGLE'
kmi = km.keymap_items.new('transform.translate', 'W', 'PRESS')
kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
kmi = km.keymap_items.new('transform.resize', 'R', 'PRESS')
-
diff --git a/release/scripts/startup/bl_operators/__init__.py b/release/scripts/startup/bl_operators/__init__.py
index 1e0dbe6925e..de538634595 100644
--- a/release/scripts/startup/bl_operators/__init__.py
+++ b/release/scripts/startup/bl_operators/__init__.py
@@ -48,7 +48,7 @@ _modules = [
"vertexpaint_dirt",
"view3d",
"wm",
- ]
+]
import bpy
diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py
index 53f51af430f..cc7f69ca7ca 100644
--- a/release/scripts/startup/bl_operators/add_mesh_torus.py
+++ b/release/scripts/startup/bl_operators/add_mesh_torus.py
@@ -135,63 +135,63 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
self.abso_minor_rad = self.major_radius - self.minor_radius
major_segments = IntProperty(
- name="Major Segments",
- description="Number of segments for the main ring of the torus",
- min=3, max=256,
- default=48,
- )
+ name="Major Segments",
+ description="Number of segments for the main ring of the torus",
+ min=3, max=256,
+ default=48,
+ )
minor_segments = IntProperty(
- name="Minor Segments",
- description="Number of segments for the minor ring of the torus",
- min=3, max=256,
- default=12,
- )
+ name="Minor Segments",
+ description="Number of segments for the minor ring of the torus",
+ min=3, max=256,
+ default=12,
+ )
mode = bpy.props.EnumProperty(
- name="Torus Dimensions",
- items=(("MAJOR_MINOR", "Major/Minor",
- "Use the major/minor radii for torus dimensions"),
- ("EXT_INT", "Exterior/Interior",
- "Use the exterior/interior radii for torus dimensions")),
- update=mode_update_callback,
- )
+ name="Torus Dimensions",
+ items=(("MAJOR_MINOR", "Major/Minor",
+ "Use the major/minor radii for torus dimensions"),
+ ("EXT_INT", "Exterior/Interior",
+ "Use the exterior/interior radii for torus dimensions")),
+ update=mode_update_callback,
+ )
major_radius = FloatProperty(
- name="Major Radius",
- description=("Radius from the origin to the "
- "center of the cross sections"),
- min=0.01, max=100.0,
- default=1.0,
- subtype='DISTANCE',
- unit='LENGTH',
- )
+ name="Major Radius",
+ description=("Radius from the origin to the "
+ "center of the cross sections"),
+ min=0.01, max=100.0,
+ default=1.0,
+ subtype='DISTANCE',
+ unit='LENGTH',
+ )
minor_radius = FloatProperty(
- name="Minor Radius",
- description="Radius of the torus' cross section",
- min=0.01, max=100.0,
- default=0.25,
- subtype='DISTANCE',
- unit='LENGTH',
- )
+ name="Minor Radius",
+ description="Radius of the torus' cross section",
+ min=0.01, max=100.0,
+ default=0.25,
+ subtype='DISTANCE',
+ unit='LENGTH',
+ )
abso_major_rad = FloatProperty(
- name="Exterior Radius",
- description="Total Exterior Radius of the torus",
- min=0.01, max=100.0,
- default=1.25,
- subtype='DISTANCE',
- unit='LENGTH',
- )
+ name="Exterior Radius",
+ description="Total Exterior Radius of the torus",
+ min=0.01, max=100.0,
+ default=1.25,
+ subtype='DISTANCE',
+ unit='LENGTH',
+ )
abso_minor_rad = FloatProperty(
- name="Interior Radius",
- description="Total Interior Radius of the torus",
- min=0.01, max=100.0,
- default=0.75,
- subtype='DISTANCE',
- unit='LENGTH',
- )
+ name="Interior Radius",
+ description="Total Interior Radius of the torus",
+ min=0.01, max=100.0,
+ default=0.75,
+ subtype='DISTANCE',
+ unit='LENGTH',
+ )
generate_uvs = BoolProperty(
- name="Generate UVs",
- description="Generate a default UV map",
- default=False,
- )
+ name="Generate UVs",
+ description="Generate a default UV map",
+ default=False,
+ )
def draw(self, context):
layout = self.layout
diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py
index 0632f9bc3ca..250c88b9009 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -41,23 +41,23 @@ class ANIM_OT_keying_set_export(Operator):
bl_label = "Export Keying Set..."
filepath = StringProperty(
- subtype='FILE_PATH',
- )
+ subtype='FILE_PATH',
+ )
filter_folder = BoolProperty(
- name="Filter folders",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter folders",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_text = BoolProperty(
- name="Filter text",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter text",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_python = BoolProperty(
- name="Filter python",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter python",
+ default=True,
+ options={'HIDDEN'},
+ )
def execute(self, context):
if not self.filepath:
@@ -204,58 +204,59 @@ class BakeAction(Operator):
bl_options = {'REGISTER', 'UNDO'}
frame_start = IntProperty(
- name="Start Frame",
- description="Start frame for baking",
- min=0, max=300000,
- default=1,
- )
+ name="Start Frame",
+ description="Start frame for baking",
+ min=0, max=300000,
+ default=1,
+ )
frame_end = IntProperty(
- name="End Frame",
- description="End frame for baking",
- min=1, max=300000,
- default=250,
- )
+ name="End Frame",
+ description="End frame for baking",
+ min=1, max=300000,
+ default=250,
+ )
step = IntProperty(
- name="Frame Step",
- description="Frame Step",
- min=1, max=120,
- default=1,
- )
+ name="Frame Step",
+ description="Frame Step",
+ min=1, max=120,
+ default=1,
+ )
only_selected = BoolProperty(
- name="Only Selected Bones",
- description="Only key selected bones (Pose baking only)",
- default=True,
- )
+ name="Only Selected Bones",
+ description="Only key selected bones (Pose baking only)",
+ default=True,
+ )
visual_keying = BoolProperty(
- name="Visual Keying",
- description="Keyframe from the final transformations (with constraints applied)",
- default=False,
- )
+ name="Visual Keying",
+ description="Keyframe from the final transformations (with constraints applied)",
+ default=False,
+ )
clear_constraints = BoolProperty(
- name="Clear Constraints",
- description="Remove all constraints from keyed object/bones, and do 'visual' keying",
- default=False,
- )
+ name="Clear Constraints",
+ description="Remove all constraints from keyed object/bones, and do 'visual' keying",
+ default=False,
+ )
clear_parents = BoolProperty(
- name="Clear Parents",
- description="Bake animation onto the object then clear parents (objects only)",
- default=False,
- )
+ name="Clear Parents",
+ description="Bake animation onto the object then clear parents (objects only)",
+ default=False,
+ )
use_current_action = BoolProperty(
- name="Overwrite Current Action",
- description="Bake animation into current action, instead of creating a new one "
- "(useful for baking only part of bones in an armature)",
- default=False,
- )
+ name="Overwrite Current Action",
+ description="Bake animation into current action, instead of creating a new one "
+ "(useful for baking only part of bones in an armature)",
+ default=False,
+ )
bake_types = EnumProperty(
- name="Bake Data",
- description="Which data's transformations to bake",
- options={'ENUM_FLAG'},
- items=(('POSE', "Pose", "Bake bones transformations"),
- ('OBJECT', "Object", "Bake object transformations"),
- ),
- default={'POSE'},
- )
+ name="Bake Data",
+ description="Which data's transformations to bake",
+ options={'ENUM_FLAG'},
+ items=(
+ ('POSE', "Pose", "Bake bones transformations"),
+ ('OBJECT', "Object", "Bake object transformations"),
+ ),
+ default={'POSE'},
+ )
def execute(self, context):
from bpy_extras import anim_utils
@@ -296,16 +297,16 @@ class BakeAction(Operator):
class ClearUselessActions(Operator):
"""Mark actions with no F-Curves for deletion after save & reload of """ \
- """file preserving \"action libraries\""""
+ """file preserving \"action libraries\""""
bl_idname = "anim.clear_useless_actions"
bl_label = "Clear Useless Actions"
bl_options = {'REGISTER', 'UNDO'}
only_unused = BoolProperty(
- name="Only Unused",
- description="Only unused (Fake User only) actions get considered",
- default=True,
- )
+ name="Only Unused",
+ description="Only unused (Fake User only) actions get considered",
+ default=True,
+ )
@classmethod
def poll(cls, context):
@@ -316,8 +317,10 @@ class ClearUselessActions(Operator):
for action in bpy.data.actions:
# if only user is "fake" user...
- if ((self.only_unused is False) or
- (action.use_fake_user and action.users == 1)):
+ if (
+ (self.only_unused is False) or
+ (action.use_fake_user and action.users == 1)
+ ):
# if it has F-Curves, then it's a "action library"
# (i.e. walk, wave, jump, etc.)
@@ -339,10 +342,10 @@ class UpdateAnimatedTransformConstraint(Operator):
bl_options = {'REGISTER', 'UNDO'}
use_convert_to_radians = BoolProperty(
- name="Convert To Radians",
- description="Convert fcurves/drivers affecting rotations to radians (Warning: use this only once!)",
- default=True,
- )
+ name="Convert To Radians",
+ description="Convert fcurves/drivers affecting rotations to radians (Warning: use this only once!)",
+ default=True,
+ )
def execute(self, context):
import animsys_refactor
diff --git a/release/scripts/startup/bl_operators/bmesh/find_adjacent.py b/release/scripts/startup/bl_operators/bmesh/find_adjacent.py
index ff2e09c6bb5..2e2d4c948d2 100644
--- a/release/scripts/startup/bl_operators/bmesh/find_adjacent.py
+++ b/release/scripts/startup/bl_operators/bmesh/find_adjacent.py
@@ -350,4 +350,3 @@ def select_prev(bm, report):
break
return True
-
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py
index e67b275a3ee..5f3075b403f 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -134,10 +134,10 @@ class CLIP_OT_filter_tracks(bpy.types.Operator):
bl_options = {'UNDO', 'REGISTER'}
track_threshold = FloatProperty(
- name="Track Threshold",
- description="Filter Threshold to select problematic tracks",
- default=5.0,
- )
+ name="Track Threshold",
+ description="Filter Threshold to select problematic tracks",
+ default=5.0,
+ )
@staticmethod
def _filter_values(context, threshold):
@@ -165,9 +165,10 @@ class CLIP_OT_filter_tracks(bpy.types.Operator):
# Find tracks with markers in both this frame and the previous one.
relevant_tracks = [
- track for track in clip.tracking.tracks
- if (track.markers.find_frame(frame) and
- track.markers.find_frame(frame - 1))]
+ track for track in clip.tracking.tracks
+ if (track.markers.find_frame(frame) and
+ track.markers.find_frame(frame - 1))
+ ]
if not relevant_tracks:
continue
@@ -399,7 +400,7 @@ class CLIP_OT_delete_proxy(Operator):
class CLIP_OT_set_viewport_background(Operator):
"""Set current movie clip as a camera background in 3D view-port """ \
- """(works only when a 3D view-port is visible)"""
+ """(works only when a 3D view-port is visible)"""
bl_idname = "clip.set_viewport_background"
bl_label = "Set as Background"
@@ -1047,13 +1048,13 @@ class CLIP_OT_track_settings_to_track(bpy.types.Operator):
"use_green_channel",
"use_blue_channel",
"weight"
- )
+ )
_attrs_marker = (
"pattern_corners",
"search_min",
"search_max",
- )
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py
index 0025967c97c..2d32f84805e 100644
--- a/release/scripts/startup/bl_operators/console.py
+++ b/release/scripts/startup/bl_operators/console.py
@@ -38,8 +38,8 @@ class ConsoleExec(Operator):
bl_label = "Console Execute"
interactive = BoolProperty(
- options={'SKIP_SAVE'},
- )
+ options={'SKIP_SAVE'},
+ )
@classmethod
def poll(cls, context):
@@ -61,7 +61,7 @@ class ConsoleExec(Operator):
class ConsoleAutocomplete(Operator):
"""Evaluate the namespace up until the cursor and give a list of """ \
- """options or complete the name if there is only one"""
+ """options or complete the name if there is only one"""
bl_idname = "console.autocomplete"
bl_label = "Console Autocomplete"
@@ -138,9 +138,9 @@ class ConsoleLanguage(Operator):
bl_label = "Console Language"
language = StringProperty(
- name="Language",
- maxlen=32,
- )
+ name="Language",
+ maxlen=32,
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/file.py b/release/scripts/startup/bl_operators/file.py
index 8d947d19a82..cf03b4fccdb 100644
--- a/release/scripts/startup/bl_operators/file.py
+++ b/release/scripts/startup/bl_operators/file.py
@@ -38,59 +38,59 @@ class WM_OT_previews_batch_generate(Operator):
# -----------
# File props.
files = CollectionProperty(
- type=bpy.types.OperatorFileListElement,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ type=bpy.types.OperatorFileListElement,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
directory = StringProperty(
- maxlen=1024,
- subtype='FILE_PATH',
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ maxlen=1024,
+ subtype='FILE_PATH',
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
# Show only images/videos, and directories!
filter_blender = BoolProperty(
- default=True,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ default=True,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
filter_folder = BoolProperty(
- default=True,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ default=True,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
# -----------
# Own props.
use_scenes = BoolProperty(
- default=True,
- name="Scenes",
- description="Generate scenes' previews",
- )
+ default=True,
+ name="Scenes",
+ description="Generate scenes' previews",
+ )
use_collections = BoolProperty(
- default=True,
- name="Collections",
- description="Generate collections' previews",
- )
+ default=True,
+ name="Collections",
+ description="Generate collections' previews",
+ )
use_objects = BoolProperty(
- default=True,
- name="Objects",
- description="Generate objects' previews",
- )
+ default=True,
+ name="Objects",
+ description="Generate objects' previews",
+ )
use_intern_data = BoolProperty(
- default=True,
- name="Mat/Tex/...",
- description="Generate 'internal' previews (materials, textures, images, etc.)",
- )
+ default=True,
+ name="Mat/Tex/...",
+ description="Generate 'internal' previews (materials, textures, images, etc.)",
+ )
use_trusted = BoolProperty(
- default=False,
- name="Trusted Blend Files",
- description="Enable python evaluation for selected files",
- )
+ default=False,
+ name="Trusted Blend Files",
+ description="Enable python evaluation for selected files",
+ )
use_backups = BoolProperty(
- default=True,
- name="Save Backups",
- description="Keep a backup (.blend1) version of the files when saving with generated previews",
- )
+ default=True,
+ name="Save Backups",
+ description="Keep a backup (.blend1) version of the files when saving with generated previews",
+ )
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
@@ -148,58 +148,59 @@ class WM_OT_previews_batch_clear(Operator):
# -----------
# File props.
files = CollectionProperty(
- type=bpy.types.OperatorFileListElement,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ type=bpy.types.OperatorFileListElement,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
directory = StringProperty(
- maxlen=1024,
- subtype='FILE_PATH',
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ maxlen=1024,
+ subtype='FILE_PATH',
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
# Show only images/videos, and directories!
filter_blender = BoolProperty(
- default=True,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ default=True,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
filter_folder = BoolProperty(
- default=True,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ default=True,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
# -----------
# Own props.
use_scenes = BoolProperty(
- default=True,
- name="Scenes",
- description="Clear scenes' previews",
- )
- use_collections = BoolProperty(default=True,
- name="Collections",
- description="Clear collections' previews",
- )
+ default=True,
+ name="Scenes",
+ description="Clear scenes' previews",
+ )
+ use_collections = BoolProperty(
+ default=True,
+ name="Collections",
+ description="Clear collections' previews",
+ )
use_objects = BoolProperty(
- default=True,
- name="Objects",
- description="Clear objects' previews",
- )
+ default=True,
+ name="Objects",
+ description="Clear objects' previews",
+ )
use_intern_data = BoolProperty(
- default=True,
- name="Mat/Tex/...",
- description="Clear 'internal' previews (materials, textures, images, etc.)",
- )
+ default=True,
+ name="Mat/Tex/...",
+ description="Clear 'internal' previews (materials, textures, images, etc.)",
+ )
use_trusted = BoolProperty(
- default=False,
- name="Trusted Blend Files",
- description="Enable python evaluation for selected files",
- )
+ default=False,
+ name="Trusted Blend Files",
+ description="Enable python evaluation for selected files",
+ )
use_backups = BoolProperty(
- default=True,
- name="Save Backups",
- description="Keep a backup (.blend1) version of the files when saving with cleared previews",
- )
+ default=True,
+ name="Save Backups",
+ description="Keep a backup (.blend1) version of the files when saving with cleared previews",
+ )
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
diff --git a/release/scripts/startup/bl_operators/freestyle.py b/release/scripts/startup/bl_operators/freestyle.py
index d3023f8e582..88368792b8b 100644
--- a/release/scripts/startup/bl_operators/freestyle.py
+++ b/release/scripts/startup/bl_operators/freestyle.py
@@ -35,15 +35,15 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
bl_options = {'INTERNAL'}
type = EnumProperty(
- name="Type", description="Type of the modifier to work on",
- items=(("COLOR", "Color", "Color modifier type"),
- ("ALPHA", "Alpha", "Alpha modifier type"),
- ("THICKNESS", "Thickness", "Thickness modifier type")),
- )
+ name="Type", description="Type of the modifier to work on",
+ items=(("COLOR", "Color", "Color modifier type"),
+ ("ALPHA", "Alpha", "Alpha modifier type"),
+ ("THICKNESS", "Thickness", "Thickness modifier type")),
+ )
name = StringProperty(
- name="Name",
- description="Name of the modifier to work on",
- )
+ name="Name",
+ description="Name of the modifier to work on",
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
index c2ca271de66..5c5ca329cda 100644
--- a/release/scripts/startup/bl_operators/image.py
+++ b/release/scripts/startup/bl_operators/image.py
@@ -30,8 +30,8 @@ class EditExternally(Operator):
bl_options = {'REGISTER'}
filepath = StringProperty(
- subtype='FILE_PATH',
- )
+ subtype='FILE_PATH',
+ )
@staticmethod
def _editor_guess(context):
diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py
index 8543847122d..87b589a5d46 100644
--- a/release/scripts/startup/bl_operators/mesh.py
+++ b/release/scripts/startup/bl_operators/mesh.py
@@ -34,18 +34,20 @@ class MeshMirrorUV(Operator):
bl_options = {'REGISTER', 'UNDO'}
direction = EnumProperty(
- name="Axis Direction",
- items=(('POSITIVE', "Positive", ""),
- ('NEGATIVE', "Negative", "")),
- )
+ name="Axis Direction",
+ items=(
+ ('POSITIVE', "Positive", ""),
+ ('NEGATIVE', "Negative", ""),
+ ),
+ )
precision = IntProperty(
- name="Precision",
- description=("Tolerance for finding vertex duplicates"),
- min=1, max=16,
- soft_min=1, soft_max=16,
- default=3,
- )
+ name="Precision",
+ description=("Tolerance for finding vertex duplicates"),
+ min=1, max=16,
+ soft_min=1, soft_max=16,
+ default=3,
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py
index 40876e2b069..bb8f991e526 100644
--- a/release/scripts/startup/bl_operators/node.py
+++ b/release/scripts/startup/bl_operators/node.py
@@ -35,31 +35,31 @@ from bpy.props import (
class NodeSetting(PropertyGroup):
value = StringProperty(
- name="Value",
- description="Python expression to be evaluated "
- "as the initial node setting",
- default="",
- )
+ name="Value",
+ description="Python expression to be evaluated "
+ "as the initial node setting",
+ default="",
+ )
# Base class for node 'Add' operators
class NodeAddOperator:
type = StringProperty(
- name="Node Type",
- description="Node type",
- )
+ name="Node Type",
+ description="Node type",
+ )
use_transform = BoolProperty(
- name="Use Transform",
- description="Start transform operator after inserting the node",
- default=False,
- )
+ name="Use Transform",
+ description="Start transform operator after inserting the node",
+ default=False,
+ )
settings = CollectionProperty(
- name="Settings",
- description="Settings to be applied on the newly created node",
- type=NodeSetting,
- options={'SKIP_SAVE'},
- )
+ name="Settings",
+ description="Settings to be applied on the newly created node",
+ type=NodeSetting,
+ options={'SKIP_SAVE'},
+ )
@staticmethod
def store_mouse_cursor(context, event):
@@ -70,7 +70,7 @@ class NodeAddOperator:
if context.region.type == 'WINDOW':
# convert mouse position to the View2D for later node placement
space.cursor_location_from_region(
- event.mouse_region_x, event.mouse_region_y)
+ event.mouse_region_x, event.mouse_region_y)
else:
space.cursor_location = tree.view_center
@@ -99,8 +99,8 @@ class NodeAddOperator:
setattr(node, setting.name, value)
except AttributeError as e:
self.report(
- {'ERROR_INVALID_INPUT'},
- "Node has no attribute " + setting.name)
+ {'ERROR_INVALID_INPUT'},
+ "Node has no attribute " + setting.name)
print(str(e))
# Continue despite invalid attribute
@@ -153,9 +153,9 @@ class NODE_OT_add_and_link_node(NodeAddOperator, Operator):
bl_options = {'REGISTER', 'UNDO'}
link_socket_index = IntProperty(
- name="Link Socket Index",
- description="Index of the socket to link",
- )
+ name="Link Socket Index",
+ description="Index of the socket to link",
+ )
def execute(self, context):
space = context.space_data
@@ -195,11 +195,11 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
nodetype = getattr(bpy.types, item.nodetype, None)
if nodetype:
enum_items.append(
- (str(index),
- item.label,
- nodetype.bl_rna.description,
- index,
- ))
+ (str(index),
+ item.label,
+ nodetype.bl_rna.description,
+ index,
+ ))
return enum_items
# Look up the item based on index
@@ -211,10 +211,10 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
return None
node_item = EnumProperty(
- name="Node Type",
- description="Node type",
- items=node_enum_items,
- )
+ name="Node Type",
+ description="Node type",
+ items=node_enum_items,
+ )
def execute(self, context):
item = self.find_node_item(context)
@@ -233,7 +233,7 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
if self.use_transform:
bpy.ops.node.translate_attach_remove_on_cancel(
- 'INVOKE_DEFAULT')
+ 'INVOKE_DEFAULT')
return {'FINISHED'}
else:
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index 0959cbec448..fb321463d33 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -36,22 +36,22 @@ class SelectPattern(Operator):
bl_options = {'REGISTER', 'UNDO'}
pattern = StringProperty(
- name="Pattern",
- description="Name filter using '*', '?' and "
- "'[abc]' unix style wildcards",
- maxlen=64,
- default="*",
- )
+ name="Pattern",
+ description="Name filter using '*', '?' and "
+ "'[abc]' unix style wildcards",
+ maxlen=64,
+ default="*",
+ )
case_sensitive = BoolProperty(
- name="Case Sensitive",
- description="Do a case sensitive compare",
- default=False,
- )
+ name="Case Sensitive",
+ description="Do a case sensitive compare",
+ default=False,
+ )
extend = BoolProperty(
- name="Extend",
- description="Extend the existing selection",
- default=True,
- )
+ name="Extend",
+ description="Extend the existing selection",
+ default=True,
+ )
def execute(self, context):
@@ -116,10 +116,10 @@ class SelectCamera(Operator):
bl_options = {'REGISTER', 'UNDO'}
extend = BoolProperty(
- name="Extend",
- description="Extend the selection",
- default=False
- )
+ name="Extend",
+ description="Extend the selection",
+ default=False
+ )
def execute(self, context):
scene = context.scene
@@ -147,24 +147,24 @@ class SelectCamera(Operator):
class SelectHierarchy(Operator):
"""Select object relative to the active object's position """ \
- """in the hierarchy"""
+ """in the hierarchy"""
bl_idname = "object.select_hierarchy"
bl_label = "Select Hierarchy"
bl_options = {'REGISTER', 'UNDO'}
direction = EnumProperty(
- items=(('PARENT', "Parent", ""),
- ('CHILD', "Child", ""),
- ),
- name="Direction",
- description="Direction to select in the hierarchy",
- default='PARENT')
+ items=(('PARENT', "Parent", ""),
+ ('CHILD', "Child", ""),
+ ),
+ name="Direction",
+ description="Direction to select in the hierarchy",
+ default='PARENT')
extend = BoolProperty(
- name="Extend",
- description="Extend the existing selection",
- default=False,
- )
+ name="Extend",
+ description="Extend the existing selection",
+ default=False,
+ )
@classmethod
def poll(cls, context):
@@ -222,18 +222,18 @@ class SubdivisionSet(Operator):
bl_options = {'REGISTER', 'UNDO'}
level = IntProperty(
- name="Level",
- min=-100, max=100,
- soft_min=-6, soft_max=6,
- default=1,
- )
+ name="Level",
+ min=-100, max=100,
+ soft_min=-6, soft_max=6,
+ default=1,
+ )
relative = BoolProperty(
- name="Relative",
- description=("Apply the subsurf level as an offset "
- "relative to the current level"),
- default=False,
- )
+ name="Relative",
+ description=("Apply the subsurf level as an offset "
+ "relative to the current level"),
+ default=False,
+ )
@classmethod
def poll(cls, context):
@@ -306,36 +306,36 @@ class SubdivisionSet(Operator):
class ShapeTransfer(Operator):
"""Copy another selected objects active shape to this one by """ \
- """applying the relative offsets"""
+ """applying the relative offsets"""
bl_idname = "object.shape_key_transfer"
bl_label = "Transfer Shape Key"
bl_options = {'REGISTER', 'UNDO'}
mode = EnumProperty(
- items=(('OFFSET',
- "Offset",
- "Apply the relative positional offset",
- ),
- ('RELATIVE_FACE',
- "Relative Face",
- "Calculate relative position (using faces)",
- ),
- ('RELATIVE_EDGE',
- "Relative Edge",
- "Calculate relative position (using edges)",
- ),
- ),
- name="Transformation Mode",
- description="Relative shape positions to the new shape method",
- default='OFFSET',
- )
+ items=(('OFFSET',
+ "Offset",
+ "Apply the relative positional offset",
+ ),
+ ('RELATIVE_FACE',
+ "Relative Face",
+ "Calculate relative position (using faces)",
+ ),
+ ('RELATIVE_EDGE',
+ "Relative Edge",
+ "Calculate relative position (using edges)",
+ ),
+ ),
+ name="Transformation Mode",
+ description="Relative shape positions to the new shape method",
+ default='OFFSET',
+ )
use_clamp = BoolProperty(
- name="Clamp Offset",
- description=("Clamp the transformation to the distance each "
- "vertex moves in the original shape"),
- default=False,
- )
+ name="Clamp Offset",
+ description=("Clamp the transformation to the distance each "
+ "vertex moves in the original shape"),
+ default=False,
+ )
def _main(self, ob_act, objects, mode='OFFSET', use_clamp=False):
@@ -368,7 +368,7 @@ class ShapeTransfer(Operator):
orig_normals = me_nos(me.vertices)
# actual mesh vertex location isn't as reliable as the base shape :S
- #~ orig_coords = me_cos(me.vertices)
+ # orig_coords = me_cos(me.vertices)
orig_coords = me_cos(me.shape_keys.key_blocks[0].data)
for ob_other in objects:
@@ -498,7 +498,7 @@ class ShapeTransfer(Operator):
class JoinUVs(Operator):
"""Transfer UV Maps from active to selected objects """ \
- """(needs matching geometry)"""
+ """(needs matching geometry)"""
bl_idname = "object.join_uvs"
bl_label = "Transfer UV Maps"
bl_options = {'REGISTER', 'UNDO'}
@@ -658,7 +658,7 @@ class MakeDupliFace(Operator):
class IsolateTypeRender(Operator):
"""Hide unselected render objects of same type as active """ \
- """by setting the hide render flag"""
+ """by setting the hide render flag"""
bl_idname = "object.isolate_type_render"
bl_label = "Restrict Render Unselected"
bl_options = {'REGISTER', 'UNDO'}
@@ -691,38 +691,27 @@ class ClearAllRestrictRender(Operator):
class TransformsToDeltas(Operator):
"""Convert normal object transforms to delta transforms, """ \
- """any existing delta transforms will be included as well"""
+ """any existing delta transforms will be included as well"""
bl_idname = "object.transforms_to_deltas"
bl_label = "Transforms to Deltas"
bl_options = {'REGISTER', 'UNDO'}
mode = EnumProperty(
- items=(('ALL',
- "All Transforms",
- "Transfer location, rotation, and scale transforms",
- ),
- ('LOC',
- "Location",
- "Transfer location transforms only",
- ),
- ('ROT',
- "Rotation",
- "Transfer rotation transforms only",
- ),
- ('SCALE',
- "Scale",
- "Transfer scale transforms only",
- ),
- ),
- name="Mode",
- description="Which transforms to transfer",
- default='ALL',
- )
+ items=(
+ ('ALL', "All Transforms", "Transfer location, rotation, and scale transforms"),
+ ('LOC', "Location", "Transfer location transforms only"),
+ ('ROT', "Rotation", "Transfer rotation transforms only"),
+ ('SCALE', "Scale", "Transfer scale transforms only"),
+ ),
+ name="Mode",
+ description="Which transforms to transfer",
+ default='ALL',
+ )
reset_values = BoolProperty(
- name="Reset Values",
- description=("Clear transform values after transferring to deltas"),
- default=True,
- )
+ name="Reset Values",
+ description=("Clear transform values after transferring to deltas"),
+ default=True,
+ )
@classmethod
def poll(cls, context):
@@ -788,11 +777,11 @@ class TransformsToDeltasAnim(Operator):
def execute(self, context):
# map from standard transform paths to "new" transform paths
STANDARD_TO_DELTA_PATHS = {
- "location" : "delta_location",
- "rotation_euler" : "delta_rotation_euler",
- "rotation_quaternion" : "delta_rotation_quaternion",
- #"rotation_axis_angle" : "delta_rotation_axis_angle",
- "scale" : "delta_scale"
+ "location": "delta_location",
+ "rotation_euler": "delta_rotation_euler",
+ "rotation_quaternion": "delta_rotation_quaternion",
+ # "rotation_axis_angle" : "delta_rotation_axis_angle",
+ "scale": "delta_scale"
}
DELTA_PATHS = STANDARD_TO_DELTA_PATHS.values()
@@ -852,8 +841,8 @@ class TransformsToDeltasAnim(Operator):
fcu.data_path = "delta_rotation_quaternion"
obj.rotation_quaternion.identity()
# XXX: currently not implemented
- #~ elif fcu.data_path == "rotation_axis_angle":
- #~ fcu.data_path = "delta_rotation_axis_angle"
+ # ~ elif fcu.data_path == "rotation_axis_angle":
+ # ~ fcu.data_path = "delta_rotation_axis_angle"
elif fcu.data_path == "scale":
fcu.data_path = "delta_scale"
obj.scale = 1.0, 1.0, 1.0
diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py
index 03b0d4f04a2..11c1514e4bf 100644
--- a/release/scripts/startup/bl_operators/object_align.py
+++ b/release/scripts/startup/bl_operators/object_align.py
@@ -364,40 +364,45 @@ class AlignObjects(Operator):
bl_options = {'REGISTER', 'UNDO'}
bb_quality = BoolProperty(
- name="High Quality",
- description=("Enables high quality calculation of the "
- "bounding box for perfect results on complex "
- "shape meshes with rotation/scale (Slow)"),
- default=True,
- )
+ name="High Quality",
+ description=(
+ "Enables high quality calculation of the "
+ "bounding box for perfect results on complex "
+ "shape meshes with rotation/scale (Slow)"
+ ),
+ default=True,
+ )
align_mode = EnumProperty(
- name="Align Mode:",
- description="Side of object to use for alignment",
- items=(('OPT_1', "Negative Sides", ""),
- ('OPT_2', "Centers", ""),
- ('OPT_3', "Positive Sides", ""),
- ),
- default='OPT_2',
- )
+ name="Align Mode:",
+ description="Side of object to use for alignment",
+ items=(
+ ('OPT_1', "Negative Sides", ""),
+ ('OPT_2', "Centers", ""),
+ ('OPT_3', "Positive Sides", ""),
+ ),
+ default='OPT_2',
+ )
relative_to = EnumProperty(
- name="Relative To:",
- description="Reference location to align to",
- items=(('OPT_1', "Scene Origin", "Use the Scene Origin as the position for the selected objects to align to"),
- ('OPT_2', "3D Cursor", "Use the 3D cursor as the position for the selected objects to align to"),
- ('OPT_3', "Selection", "Use the selected objects as the position for the selected objects to align to"),
- ('OPT_4', "Active", "Use the active object as the position for the selected objects to align to"),
- ),
- default='OPT_4',
- )
+ name="Relative To:",
+ description="Reference location to align to",
+ items=(
+ ('OPT_1', "Scene Origin", "Use the Scene Origin as the position for the selected objects to align to"),
+ ('OPT_2', "3D Cursor", "Use the 3D cursor as the position for the selected objects to align to"),
+ ('OPT_3', "Selection", "Use the selected objects as the position for the selected objects to align to"),
+ ('OPT_4', "Active", "Use the active object as the position for the selected objects to align to"),
+ ),
+ default='OPT_4',
+ )
align_axis = EnumProperty(
- name="Align",
- description="Align to axis",
- items=(('X', "X", ""),
- ('Y', "Y", ""),
- ('Z', "Z", ""),
- ),
- options={'ENUM_FLAG'},
- )
+ name="Align",
+ description="Align to axis",
+ items=(
+ ('X', "X", ""),
+ ('Y', "Y", ""),
+ ('Z', "Z", ""),
+ ),
+ options={'ENUM_FLAG'},
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py
index 70334fb0f23..f087022b6fd 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -53,24 +53,26 @@ class QuickFur(Operator):
bl_options = {'REGISTER', 'UNDO'}
density = EnumProperty(
- name="Fur Density",
- items=(('LIGHT', "Light", ""),
- ('MEDIUM', "Medium", ""),
- ('HEAVY', "Heavy", "")),
- default='MEDIUM',
- )
+ name="Fur Density",
+ items=(
+ ('LIGHT', "Light", ""),
+ ('MEDIUM', "Medium", ""),
+ ('HEAVY', "Heavy", "")
+ ),
+ default='MEDIUM',
+ )
view_percentage = IntProperty(
- name="View %",
- min=1, max=100,
- soft_min=1, soft_max=100,
- default=10,
- )
+ name="View %",
+ min=1, max=100,
+ soft_min=1, soft_max=100,
+ default=10,
+ )
length = FloatProperty(
- name="Length",
- min=0.001, max=100,
- soft_min=0.01, soft_max=10,
- default=0.1,
- )
+ name="Length",
+ min=0.001, max=100,
+ soft_min=0.01, soft_max=10,
+ default=0.1,
+ )
def execute(self, context):
fake_context = context.copy()
@@ -117,49 +119,51 @@ class QuickExplode(Operator):
bl_options = {'REGISTER', 'UNDO'}
style = EnumProperty(
- name="Explode Style",
- items=(('EXPLODE', "Explode", ""),
- ('BLEND', "Blend", "")),
- default='EXPLODE',
- )
+ name="Explode Style",
+ items=(
+ ('EXPLODE', "Explode", ""),
+ ('BLEND', "Blend", ""),
+ ),
+ default='EXPLODE',
+ )
amount = IntProperty(
- name="Amount of pieces",
- min=2, max=10000,
- soft_min=2, soft_max=10000,
- default=100,
- )
+ name="Amount of pieces",
+ min=2, max=10000,
+ soft_min=2, soft_max=10000,
+ default=100,
+ )
frame_duration = IntProperty(
- name="Duration",
- min=1, max=300000,
- soft_min=1, soft_max=10000,
- default=50,
- )
+ name="Duration",
+ min=1, max=300000,
+ soft_min=1, soft_max=10000,
+ default=50,
+ )
frame_start = IntProperty(
- name="Start Frame",
- min=1, max=300000,
- soft_min=1, soft_max=10000,
- default=1,
- )
+ name="Start Frame",
+ min=1, max=300000,
+ soft_min=1, soft_max=10000,
+ default=1,
+ )
frame_end = IntProperty(
- name="End Frame",
- min=1, max=300000,
- soft_min=1, soft_max=10000,
- default=10,
- )
+ name="End Frame",
+ min=1, max=300000,
+ soft_min=1, soft_max=10000,
+ default=10,
+ )
velocity = FloatProperty(
- name="Outwards Velocity",
- min=0, max=300000,
- soft_min=0, soft_max=10,
- default=1,
- )
+ name="Outwards Velocity",
+ min=0, max=300000,
+ soft_min=0, soft_max=10,
+ default=1,
+ )
fade = BoolProperty(
- name="Fade",
- description="Fade the pieces over time",
- default=True,
- )
+ name="Fade",
+ description="Fade the pieces over time",
+ default=True,
+ )
def execute(self, context):
fake_context = context.copy()
@@ -303,19 +307,20 @@ class QuickSmoke(Operator):
bl_options = {'REGISTER', 'UNDO'}
style = EnumProperty(
- name="Smoke Style",
- items=(('SMOKE', "Smoke", ""),
- ('FIRE', "Fire", ""),
- ('BOTH', "Smoke + Fire", ""),
- ),
- default='SMOKE',
- )
+ name="Smoke Style",
+ items=(
+ ('SMOKE', "Smoke", ""),
+ ('FIRE', "Fire", ""),
+ ('BOTH', "Smoke + Fire", ""),
+ ),
+ default='SMOKE',
+ )
show_flows = BoolProperty(
- name="Render Smoke Objects",
- description="Keep the smoke objects visible during rendering",
- default=False,
- )
+ name="Render Smoke Objects",
+ description="Keep the smoke objects visible during rendering",
+ default=False,
+ )
def execute(self, context):
if not bpy.app.build_options.mod_smoke:
@@ -390,7 +395,7 @@ class QuickSmoke(Operator):
node_principled = nodes.new(type='ShaderNodeVolumePrincipled')
node_principled.location = grid_location(4, 1)
links.new(node_principled.outputs["Volume"],
- node_out.inputs["Volume"])
+ node_out.inputs["Volume"])
node_principled.inputs["Density"].default_value = 5.0
@@ -406,29 +411,31 @@ class QuickFluid(Operator):
bl_options = {'REGISTER', 'UNDO'}
style = EnumProperty(
- name="Fluid Style",
- items=(('INFLOW', "Inflow", ""),
- ('BASIC', "Basic", "")),
- default='BASIC',
- )
+ name="Fluid Style",
+ items=(
+ ('INFLOW', "Inflow", ""),
+ ('BASIC', "Basic", ""),
+ ),
+ default='BASIC',
+ )
initial_velocity = FloatVectorProperty(
- name="Initial Velocity",
- description="Initial velocity of the fluid",
- min=-100.0, max=100.0,
- default=(0.0, 0.0, 0.0),
- subtype='VELOCITY',
- )
+ name="Initial Velocity",
+ description="Initial velocity of the fluid",
+ min=-100.0, max=100.0,
+ default=(0.0, 0.0, 0.0),
+ subtype='VELOCITY',
+ )
show_flows = BoolProperty(
- name="Render Fluid Objects",
- description="Keep the fluid objects visible during rendering",
- default=False,
- )
+ name="Render Fluid Objects",
+ description="Keep the fluid objects visible during rendering",
+ default=False,
+ )
start_baking = BoolProperty(
- name="Start Fluid Bake",
- description=("Start baking the fluid immediately "
- "after creating the domain object"),
- default=False,
- )
+ name="Start Fluid Bake",
+ description=("Start baking the fluid immediately "
+ "after creating the domain object"),
+ default=False,
+ )
def execute(self, context):
if not bpy.app.build_options.mod_fluid:
diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py
index a91e1a5b031..dbc9461ad5a 100644
--- a/release/scripts/startup/bl_operators/object_randomize_transform.py
+++ b/release/scripts/startup/bl_operators/object_randomize_transform.py
@@ -104,55 +104,55 @@ class RandomizeLocRotSize(Operator):
bl_options = {'REGISTER', 'UNDO'}
random_seed = IntProperty(
- name="Random Seed",
- description="Seed value for the random generator",
- min=0,
- max=10000,
- default=0,
- )
+ name="Random Seed",
+ description="Seed value for the random generator",
+ min=0,
+ max=10000,
+ default=0,
+ )
use_delta = BoolProperty(
- name="Transform Delta",
- description=("Randomize delta transform values "
- "instead of regular transform"),
- default=False,
- )
+ name="Transform Delta",
+ description=("Randomize delta transform values "
+ "instead of regular transform"),
+ default=False,
+ )
use_loc = BoolProperty(
- name="Randomize Location",
- description="Randomize the location values",
- default=True,
- )
+ name="Randomize Location",
+ description="Randomize the location values",
+ default=True,
+ )
loc = FloatVectorProperty(
- name="Location",
- description=("Maximum distance the objects "
- "can spread over each axis"),
- min=-100.0,
- max=100.0,
- default=(0.0, 0.0, 0.0),
- subtype='TRANSLATION',
- )
+ name="Location",
+ description=("Maximum distance the objects "
+ "can spread over each axis"),
+ min=-100.0,
+ max=100.0,
+ default=(0.0, 0.0, 0.0),
+ subtype='TRANSLATION',
+ )
use_rot = BoolProperty(
- name="Randomize Rotation",
- description="Randomize the rotation values",
- default=True,
- )
+ name="Randomize Rotation",
+ description="Randomize the rotation values",
+ default=True,
+ )
rot = FloatVectorProperty(
- name="Rotation",
- description="Maximum rotation over each axis",
- min=-3.141592, # math.pi
- max=+3.141592,
- default=(0.0, 0.0, 0.0),
- subtype='EULER',
- )
+ name="Rotation",
+ description="Maximum rotation over each axis",
+ min=-3.141592, # math.pi
+ max=+3.141592,
+ default=(0.0, 0.0, 0.0),
+ subtype='EULER',
+ )
use_scale = BoolProperty(
- name="Randomize Scale",
- description="Randomize the scale values",
- default=True,
- )
+ name="Randomize Scale",
+ description="Randomize the scale values",
+ default=True,
+ )
scale_even = BoolProperty(
- name="Scale Even",
- description="Use the same scale value for all axis",
- default=False,
- )
+ name="Scale Even",
+ description="Use the same scale value for all axis",
+ default=False,
+ )
'''scale_min = FloatProperty(
name="Minimun Scale Factor",
@@ -162,13 +162,13 @@ class RandomizeLocRotSize(Operator):
)'''
scale = FloatVectorProperty(
- name="Scale",
- description="Maximum scale randomization over each axis",
- min=-100.0,
- max=100.0,
- default=(1.0, 1.0, 1.0),
- subtype='TRANSLATION',
- )
+ name="Scale",
+ description="Maximum scale randomization over each axis",
+ min=-100.0,
+ max=100.0,
+ default=(1.0, 1.0, 1.0),
+ subtype='TRANSLATION',
+ )
def execute(self, context):
seed = self.random_seed
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index 5c1ca0ab2ad..780183fb713 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -29,6 +29,7 @@ WindowManager.preset_name = StringProperty(
default="New Preset"
)
+
class AddPresetBase:
"""Base preset class, only for subclassing
subclasses must define
@@ -41,26 +42,26 @@ class AddPresetBase:
bl_options = {'REGISTER', 'INTERNAL'}
name = StringProperty(
- name="Name",
- description="Name of the preset, used to make the path name",
- maxlen=64,
- options={'SKIP_SAVE'},
- )
+ name="Name",
+ description="Name of the preset, used to make the path name",
+ maxlen=64,
+ options={'SKIP_SAVE'},
+ )
remove_name = BoolProperty(
- default=False,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ default=False,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
remove_active = BoolProperty(
- default=False,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ default=False,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
# needed for mix-ins
order = [
"name",
"remove_name",
"remove_active",
- ]
+ ]
@staticmethod
def as_filename(name): # could reuse for other presets
@@ -225,14 +226,14 @@ class ExecutePreset(Operator):
bl_label = "Execute a Python Preset"
filepath = StringProperty(
- subtype='FILE_PATH',
- options={'SKIP_SAVE'},
- )
+ subtype='FILE_PATH',
+ options={'SKIP_SAVE'},
+ )
menu_idname = StringProperty(
- name="Menu ID Name",
- description="ID name of the menu this was called from",
- options={'SKIP_SAVE'},
- )
+ name="Menu ID Name",
+ description="ID name of the menu this was called from",
+ options={'SKIP_SAVE'},
+ )
def execute(self, context):
from os.path import basename, splitext
@@ -268,22 +269,26 @@ class PresetMenu(Panel):
@classmethod
def draw_panel_header(cls, layout):
layout.emboss = 'NONE'
- layout.popover(cls.bl_space_type,
- cls.bl_region_type,
- cls.__name__,
- icon='PRESET',
- text='')
+ layout.popover(
+ cls.bl_space_type,
+ cls.bl_region_type,
+ cls.__name__,
+ icon='PRESET',
+ text="",
+ )
@classmethod
def draw_menu(cls, layout, text=None):
- if text == None:
+ if text is None:
text = cls.bl_label
- layout.popover(cls.bl_space_type,
- cls.bl_region_type,
- cls.__name__,
- icon='PRESET',
- text=text)
+ layout.popover(
+ cls.bl_space_type,
+ cls.bl_region_type,
+ cls.__name__,
+ icon='PRESET',
+ text=text,
+ )
def draw(self, context):
layout = self.layout
@@ -329,10 +334,10 @@ class AddPresetCamera(AddPresetBase, Operator):
preset_subdir = "camera"
use_focal_length = BoolProperty(
- name="Include Focal Length",
- description="Include focal length into the preset",
- options={'SKIP_SAVE'},
- )
+ name="Include Focal Length",
+ description="Include focal length into the preset",
+ options={'SKIP_SAVE'},
+ )
@property
def preset_values(self):
@@ -397,12 +402,12 @@ class AddPresetFluid(AddPresetBase, Operator):
preset_defines = [
"fluid = bpy.context.fluid"
- ]
+ ]
preset_values = [
"fluid.settings.viscosity_base",
"fluid.settings.viscosity_exponent",
- ]
+ ]
preset_subdir = "fluid"
@@ -434,7 +439,7 @@ class AddPresetHairDynamics(AddPresetBase, Operator):
"settings.density_strength",
"settings.voxel_cell_size",
"settings.pin_stiffness",
- ]
+ ]
class AddPresetInteraction(AddPresetBase, Operator):
@@ -476,11 +481,11 @@ class AddPresetTrackingCamera(AddPresetBase, Operator):
preset_subdir = "tracking_camera"
use_focal_length = BoolProperty(
- name="Include Focal Length",
- description="Include focal length into the preset",
- options={'SKIP_SAVE'},
- default=True
- )
+ name="Include Focal Length",
+ description="Include focal length into the preset",
+ options={'SKIP_SAVE'},
+ default=True
+ )
@property
def preset_values(self):
@@ -601,10 +606,10 @@ class AddPresetOperator(AddPresetBase, Operator):
preset_menu = "WM_MT_operator_presets"
operator = StringProperty(
- name="Operator",
- maxlen=64,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ name="Operator",
+ maxlen=64,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
preset_defines = [
"op = bpy.context.active_operator",
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py
index e10a2a2915e..9fa8188e946 100644
--- a/release/scripts/startup/bl_operators/rigidbody.py
+++ b/release/scripts/startup/bl_operators/rigidbody.py
@@ -51,7 +51,7 @@ class CopyRigidbodySettings(Operator):
"mesh_source",
"use_deform",
"enabled",
- )
+ )
@classmethod
def poll(cls, context):
@@ -93,23 +93,23 @@ class BakeToKeyframes(Operator):
bl_options = {'REGISTER', 'UNDO'}
frame_start = IntProperty(
- name="Start Frame",
- description="Start frame for baking",
- min=0, max=300000,
- default=1,
- )
+ name="Start Frame",
+ description="Start frame for baking",
+ min=0, max=300000,
+ default=1,
+ )
frame_end = IntProperty(
- name="End Frame",
- description="End frame for baking",
- min=1, max=300000,
- default=250,
- )
+ name="End Frame",
+ description="End frame for baking",
+ min=1, max=300000,
+ default=250,
+ )
step = IntProperty(
- name="Frame Step",
- description="Frame Step",
- min=1, max=120,
- default=1,
- )
+ name="Frame Step",
+ description="Frame Step",
+ min=1, max=120,
+ default=1,
+ )
@classmethod
def poll(cls, context):
@@ -217,28 +217,34 @@ class ConnectRigidBodies(Operator):
bl_options = {'REGISTER', 'UNDO'}
con_type = EnumProperty(
- name="Type",
- description="Type of generated constraint",
- # XXX Would be nice to get icons too, but currently not possible ;)
- items=tuple((e.identifier, e.name, e.description, e. value)
- for e in bpy.types.RigidBodyConstraint.bl_rna.properties["type"].enum_items),
- default='FIXED',
- )
+ name="Type",
+ description="Type of generated constraint",
+ # XXX Would be nice to get icons too, but currently not possible ;)
+ items=tuple(
+ (e.identifier, e.name, e.description, e. value)
+ for e in bpy.types.RigidBodyConstraint.bl_rna.properties["type"].enum_items
+ ),
+ default='FIXED',
+ )
pivot_type = EnumProperty(
- name="Location",
- description="Constraint pivot location",
- items=(('CENTER', "Center", "Pivot location is between the constrained rigid bodies"),
- ('ACTIVE', "Active", "Pivot location is at the active object position"),
- ('SELECTED', "Selected", "Pivot location is at the selected object position")),
- default='CENTER',
- )
+ name="Location",
+ description="Constraint pivot location",
+ items=(
+ ('CENTER', "Center", "Pivot location is between the constrained rigid bodies"),
+ ('ACTIVE', "Active", "Pivot location is at the active object position"),
+ ('SELECTED', "Selected", "Pivot location is at the selected object position"),
+ ),
+ default='CENTER',
+ )
connection_pattern = EnumProperty(
- name="Connection Pattern",
- description="Pattern used to connect objects",
- items=(('SELECTED_TO_ACTIVE', "Selected to Active", "Connect selected objects to the active object"),
- ('CHAIN_DISTANCE', "Chain by Distance", "Connect objects as a chain based on distance, starting at the active object")),
- default='SELECTED_TO_ACTIVE',
- )
+ name="Connection Pattern",
+ description="Pattern used to connect objects",
+ items=(
+ ('SELECTED_TO_ACTIVE', "Selected to Active", "Connect selected objects to the active object"),
+ ('CHAIN_DISTANCE', "Chain by Distance", "Connect objects as a chain based on distance, starting at the active object"),
+ ),
+ default='SELECTED_TO_ACTIVE',
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
index e32c1ac0f81..46cf07be0f5 100644
--- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
+++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
@@ -75,10 +75,12 @@ class PlayRenderedAnim(Operator):
def execute(self, context):
import subprocess
+ from shlex import quote
scene = context.scene
rd = scene.render
prefs = context.user_preferences
+ fps_final = rd.fps / rd.fps_base
preset = prefs.filepaths.animation_player_preset
player_path = prefs.filepaths.animation_player
@@ -103,7 +105,7 @@ class PlayRenderedAnim(Operator):
file_b = rd.frame_path(frame=int(frame_tmp / 10))
file = ("".join((c if file_b[i] == c else "#")
- for i, c in enumerate(file_a)))
+ for i, c in enumerate(file_a)))
del file_a, file_b, frame_tmp
file = bpy.path.abspath(file) # expand '//'
else:
@@ -112,15 +114,15 @@ class PlayRenderedAnim(Operator):
file = rd.frame_path(frame=scene.frame_start, preview=scene.use_preview_range)
file = bpy.path.abspath(file) # expand '//'
if not os.path.exists(file):
- self.report({'WARNING'}, "File %r not found" % file)
+ self.report({'WARNING'}, f"File {file!r} not found")
path_valid = False
- #one last try for full range if we used preview range
+ # one last try for full range if we used preview range
if scene.use_preview_range and not path_valid:
file = rd.frame_path(frame=scene.frame_start, preview=False)
file = bpy.path.abspath(file) # expand '//'
if not os.path.exists(file):
- self.report({'WARNING'}, "File %r not found" % file)
+ self.report({'WARNING'}, f"File {file!r} not found")
cmd = [player_path]
# extra options, fps controls etc.
@@ -131,31 +133,34 @@ class PlayRenderedAnim(Operator):
frame_start = scene.frame_start
frame_end = scene.frame_end
if preset == 'INTERNAL':
- opts = ["-a",
- "-f", str(rd.fps), str(rd.fps_base),
- "-s", str(frame_start),
- "-e", str(frame_end),
- "-j", str(scene.frame_step),
- file]
+ opts = [
+ "-a",
+ "-f", str(rd.fps), str(rd.fps_base),
+ "-s", str(frame_start),
+ "-e", str(frame_end),
+ "-j", str(scene.frame_step),
+ file,
+ ]
cmd.extend(opts)
elif preset == 'DJV':
- opts = [file, "-playback_speed", "%d" % int(rd.fps / rd.fps_base)]
+ opts = [file, "-playback_speed", str(int(fps_final))]
cmd.extend(opts)
elif preset == 'FRAMECYCLER':
- opts = [file, "%d-%d" % (scene.frame_start, scene.frame_end)]
+ opts = [file, f"{scene.frame_start:d}-{scene.frame_end:d}"]
cmd.extend(opts)
elif preset == 'RV':
- opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file]
+ opts = ["-fps", str(rd.fps), "-play", f"[ {file} ]"]
cmd.extend(opts)
elif preset == 'MPLAYER':
opts = []
if is_movie:
opts.append(file)
else:
- opts += [("mf://%s" % file.replace("#", "?")),
- "-mf",
- "fps=%.4f" % (rd.fps / rd.fps_base),
- ]
+ opts += [
+ ("mf://" + file.replace("#", "?")),
+ "-mf",
+ f"fps={fps_final:4f}"
+ ]
opts += ["-loop", "0", "-really-quiet", "-fs"]
cmd.extend(opts)
@@ -163,7 +168,7 @@ class PlayRenderedAnim(Operator):
cmd.append(file)
# launch it
- print("Executing command:\n %r" % " ".join(cmd))
+ print("Executing command:\n ", " ".join(quote(c) for c in cmd))
# workaround for boost 1.46, can be eventually removed. bug: [#32350]
env_copy = os.environ.copy()
@@ -174,9 +179,11 @@ class PlayRenderedAnim(Operator):
try:
subprocess.Popen(cmd, env=env_copy)
except Exception as e:
- self.report({'ERROR'},
- "Couldn't run external animation player with command "
- "%r\n%s" % (" ".join(cmd), str(e)))
+ self.report(
+ {'ERROR'},
+ "Couldn't run external animation player with command "
+ f"{cmd!r}\n{e!s}",
+ )
return {'CANCELLED'}
return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py
index 337492bc8a7..c9a7aa93805 100644
--- a/release/scripts/startup/bl_operators/sequencer.py
+++ b/release/scripts/startup/bl_operators/sequencer.py
@@ -83,11 +83,11 @@ class SequencerCutMulticam(Operator):
bl_options = {'REGISTER', 'UNDO'}
camera = IntProperty(
- name="Camera",
- min=1, max=32,
- soft_min=1, soft_max=32,
- default=1,
- )
+ name="Camera",
+ min=1, max=32,
+ soft_min=1, soft_max=32,
+ default=1,
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
index 29cefd83328..7620b354a08 100644
--- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py
+++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
@@ -18,7 +18,7 @@
# <pep8 compliant>
-#for full docs see...
+# for full docs see...
# http://mediawiki.blender.org/index.php/Scripts/Manual/UV_Calculate/Follow_active_quads
import bpy
@@ -227,14 +227,14 @@ class FollowActiveQuads(Operator):
bl_options = {'REGISTER', 'UNDO'}
mode = bpy.props.EnumProperty(
- name="Edge Length Mode",
- description="Method to space UV edge loops",
- items=(('EVEN', "Even", "Space all UVs evenly"),
- ('LENGTH', "Length", "Average space UVs edge length of each loop"),
- ('LENGTH_AVERAGE', "Length Average", "Average space UVs edge length of each loop"),
- ),
- default='LENGTH_AVERAGE',
- )
+ name="Edge Length Mode",
+ description="Method to space UV edge loops",
+ items=(('EVEN', "Even", "Space all UVs evenly"),
+ ('LENGTH', "Length", "Average space UVs edge length of each loop"),
+ ('LENGTH_AVERAGE', "Length Average", "Average space UVs edge length of each loop"),
+ ),
+ default='LENGTH_AVERAGE',
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index ff7bab4102a..0d5bc3136a5 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -33,7 +33,7 @@ class prettyface:
"yoff",
"has_parent",
"rot",
- )
+ )
def __init__(self, data):
self.has_parent = False
@@ -63,9 +63,9 @@ class prettyface:
self.width = self.height = d * 2
- #else:
- # print(len(data), data)
- # raise "Error"
+ # else:
+ # print(len(data), data)
+ # raise "Error"
for pf in data:
pf.has_parent = True
@@ -460,7 +460,7 @@ def lightmap_uvpack(meshes,
# Tall boxes in groups of 2
for d, boxes in list(odd_dict.items()):
if d[1] < max_int_dimension:
- #\boxes.sort(key = lambda a: len(a.children))
+ # boxes.sort(key=lambda a: len(a.children))
while len(boxes) >= 2:
# print("foo", len(boxes))
ok = True
@@ -597,6 +597,7 @@ def unwrap(operator, context, **kwargs):
return {'FINISHED'}
+
from bpy.props import BoolProperty, FloatProperty, IntProperty
@@ -616,50 +617,55 @@ class LightMapPack(Operator):
bl_options = {'UNDO'}
PREF_CONTEXT = bpy.props.EnumProperty(
- name="Selection",
- items=(('SEL_FACES', "Selected Faces", "Space all UVs evenly"),
- ('ALL_FACES', "All Faces", "Average space UVs edge length of each loop"),
- ('ALL_OBJECTS', "Selected Mesh Object", "Average space UVs edge length of each loop")
- ),
- )
+ name="Selection",
+ items=(
+ ('SEL_FACES', "Selected Faces", "Space all UVs evenly"),
+ ('ALL_FACES', "All Faces", "Average space UVs edge length of each loop"),
+ ('ALL_OBJECTS', "Selected Mesh Object", "Average space UVs edge length of each loop")
+ ),
+ )
# Image & UVs...
PREF_PACK_IN_ONE = BoolProperty(
- name="Share Tex Space",
- description=("Objects Share texture space, map all objects "
- "into 1 uvmap"),
- default=True,
- )
+ name="Share Tex Space",
+ description=(
+ "Objects Share texture space, map all objects "
+ "into 1 uvmap"
+ ),
+ default=True,
+ )
PREF_NEW_UVLAYER = BoolProperty(
- name="New UV Map",
- description="Create a new UV map for every mesh packed",
- default=False,
- )
+ name="New UV Map",
+ description="Create a new UV map for every mesh packed",
+ default=False,
+ )
PREF_APPLY_IMAGE = BoolProperty(
- name="New Image",
- description=("Assign new images for every mesh (only one if "
- "shared tex space enabled)"),
- default=False,
- )
+ name="New Image",
+ description=(
+ "Assign new images for every mesh (only one if "
+ "shared tex space enabled)"
+ ),
+ default=False,
+ )
PREF_IMG_PX_SIZE = IntProperty(
- name="Image Size",
- description="Width and Height for the new image",
- min=64, max=5000,
- default=512,
- )
+ name="Image Size",
+ description="Width and Height for the new image",
+ min=64, max=5000,
+ default=512,
+ )
# UV Packing...
PREF_BOX_DIV = IntProperty(
- name="Pack Quality",
- description="Pre Packing before the complex boxpack",
- min=1, max=48,
- default=12,
- )
+ name="Pack Quality",
+ description="Pre Packing before the complex boxpack",
+ min=1, max=48,
+ default=12,
+ )
PREF_MARGIN_DIV = FloatProperty(
- name="Margin",
- description="Size of the margin as a division of the UV",
- min=0.001, max=1.0,
- default=0.1,
- )
+ name="Margin",
+ description="Size of the margin as a division of the UV",
+ min=0.001, max=1.0,
+ default=0.1,
+ )
def execute(self, context):
kwargs = self.as_keywords()
diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
index 25783653414..aebc0ae0313 100644
--- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py
+++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
@@ -26,7 +26,7 @@ from mathutils import (
import bpy
from bpy.types import Operator
-DEG_TO_RAD = 0.017453292519943295 # pi/180.0
+DEG_TO_RAD = 0.017453292519943295 # pi/180.0
# see bugs:
# - T31598 (when too small).
# - T48086 (when too big).
@@ -38,6 +38,7 @@ global USER_FILL_HOLES_QUALITY
USER_FILL_HOLES = None
USER_FILL_HOLES_QUALITY = None
+
def pointInTri2D(v, v1, v2, v3):
key = v1.x, v1.y, v2.x, v2.y, v3.x, v3.y
@@ -93,20 +94,25 @@ def pointInTri2D(v, v1, v2, v3):
def boundsIsland(faces):
- minx = maxx = faces[0].uv[0][0] # Set initial bounds.
+ minx = maxx = faces[0].uv[0][0] # Set initial bounds.
miny = maxy = faces[0].uv[0][1]
# print len(faces), minx, maxx, miny , maxy
for f in faces:
for uv in f.uv:
- x= uv.x
- y= uv.y
- if x<minx: minx= x
- if y<miny: miny= y
- if x>maxx: maxx= x
- if y>maxy: maxy= y
+ x = uv.x
+ y = uv.y
+ if x < minx:
+ minx = x
+ if y < miny:
+ miny = y
+ if x > maxx:
+ maxx = x
+ if y > maxy:
+ maxy = y
return minx, miny, maxx, maxy
+
"""
def boundsEdgeLoop(edges):
minx = maxx = edges[0][0] # Set initial bounds.
@@ -128,45 +134,51 @@ def boundsEdgeLoop(edges):
# Only for UV's
# only returns outline edges for intersection tests. and unique points.
+
def island2Edge(island):
# Vert index edges
edges = {}
- unique_points= {}
+ unique_points = {}
for f in island:
- f_uvkey= map(tuple, f.uv)
-
+ f_uvkey = map(tuple, f.uv)
for vIdx, edkey in enumerate(f.edge_keys):
unique_points[f_uvkey[vIdx]] = f.uv[vIdx]
- if f.v[vIdx].index > f.v[vIdx-1].index:
- i1= vIdx-1; i2= vIdx
+ if f.v[vIdx].index > f.v[vIdx - 1].index:
+ i1 = vIdx - 1
+ i2 = vIdx
else:
- i1= vIdx; i2= vIdx-1
+ i1 = vIdx
+ i2 = vIdx - 1
- try: edges[ f_uvkey[i1], f_uvkey[i2] ] *= 0 # sets any edge with more than 1 user to 0 are not returned.
- except: edges[ f_uvkey[i1], f_uvkey[i2] ] = (f.uv[i1] - f.uv[i2]).length,
+ try:
+ edges[f_uvkey[i1], f_uvkey[i2]] *= 0 # sets any edge with more than 1 user to 0 are not returned.
+ except:
+ edges[f_uvkey[i1], f_uvkey[i2]] = (f.uv[i1] - f.uv[i2]).length,
# If 2 are the same then they will be together, but full [a,b] order is not correct.
# Sort by length
-
length_sorted_edges = [(Vector(key[0]), Vector(key[1]), value) for key, value in edges.items() if value != 0]
- try: length_sorted_edges.sort(key = lambda A: -A[2]) # largest first
- except: length_sorted_edges.sort(lambda A, B: cmp(B[2], A[2]))
+ try:
+ length_sorted_edges.sort(key=lambda A: -A[2]) # largest first
+ except:
+ length_sorted_edges.sort(lambda A, B: cmp(B[2], A[2]))
# Its okay to leave the length in there.
- #for e in length_sorted_edges:
+ # for e in length_sorted_edges:
# e.pop(2)
# return edges and unique points
return length_sorted_edges, [v.to_3d() for v in unique_points.values()]
+
# ========================= NOT WORKING????
# Find if a points inside an edge loop, unordered.
# pt is and x/y
@@ -190,6 +202,7 @@ def pointInEdges(pt, edges):
return intersectCount % 2
"""
+
def pointInIsland(pt, island):
vec1, vec2, vec3 = Vector(), Vector(), Vector()
for f in island:
@@ -212,7 +225,7 @@ def pointInIsland(pt, island):
# box is (left,bottom, right, top)
def islandIntersectUvIsland(source, target, SourceOffset):
# Is 1 point in the box, inside the vertLoops
- edgeLoopsSource = source[6] # Pretend this is offset
+ edgeLoopsSource = source[6] # Pretend this is offset
edgeLoopsTarget = target[6]
# Edge intersect test
@@ -220,24 +233,24 @@ def islandIntersectUvIsland(source, target, SourceOffset):
for seg in edgeLoopsTarget:
i = geometry.intersect_line_line_2d(seg[0],
seg[1],
- SourceOffset+ed[0],
- SourceOffset+ed[1],
+ SourceOffset + ed[0],
+ SourceOffset + ed[1],
)
if i:
- return 1 # LINE INTERSECTION
+ return 1 # LINE INTERSECTION
# 1 test for source being totally inside target
SourceOffset.resize_3d()
for pv in source[7]:
- if pointInIsland(pv+SourceOffset, target[0]):
- return 2 # SOURCE INSIDE TARGET
+ if pointInIsland(pv + SourceOffset, target[0]):
+ return 2 # SOURCE INSIDE TARGET
# 2 test for a part of the target being totally inside the source.
for pv in target[7]:
- if pointInIsland(pv-SourceOffset, source[0]):
- return 3 # PART OF TARGET INSIDE SOURCE.
+ if pointInIsland(pv - SourceOffset, source[0]):
+ return 3 # PART OF TARGET INSIDE SOURCE.
- return 0 # NO INTERSECTION
+ return 0 # NO INTERSECTION
def rotate_uvs(uv_points, angle):
@@ -249,7 +262,7 @@ def rotate_uvs(uv_points, angle):
def optiRotateUvIsland(faces):
- uv_points = [uv for f in faces for uv in f.uv]
+ uv_points = [uv for f in faces for uv in f.uv]
angle = geometry.box_fit_2d(uv_points)
if angle != 0.0:
@@ -270,81 +283,78 @@ def mergeUvIslands(islandList):
global USER_FILL_HOLES
global USER_FILL_HOLES_QUALITY
-
# Pack islands to bottom LHS
# Sync with island
- #islandTotFaceArea = [] # A list of floats, each island area
- #islandArea = [] # a list of tuples ( area, w,h)
-
+ # islandTotFaceArea = [] # A list of floats, each island area
+ # islandArea = [] # a list of tuples ( area, w,h)
decoratedIslandList = []
islandIdx = len(islandList)
while islandIdx:
- islandIdx-=1
+ islandIdx -= 1
minx, miny, maxx, maxy = boundsIsland(islandList[islandIdx])
- w, h = maxx-minx, maxy-miny
+ w, h = maxx - minx, maxy - miny
totFaceArea = 0
- offset= Vector((minx, miny))
+ offset = Vector((minx, miny))
for f in islandList[islandIdx]:
for uv in f.uv:
uv -= offset
totFaceArea += f.area
- islandBoundsArea = w*h
+ islandBoundsArea = w * h
efficiency = abs(islandBoundsArea - totFaceArea)
# UV Edge list used for intersections as well as unique points.
edges, uniqueEdgePoints = island2Edge(islandList[islandIdx])
- decoratedIslandList.append([islandList[islandIdx], totFaceArea, efficiency, islandBoundsArea, w,h, edges, uniqueEdgePoints])
-
+ decoratedIslandList.append([islandList[islandIdx], totFaceArea, efficiency, islandBoundsArea, w, h, edges, uniqueEdgePoints])
# Sort by island bounding box area, smallest face area first.
# no.. chance that to most simple edge loop first.
- decoratedIslandListAreaSort =decoratedIslandList[:]
+ decoratedIslandListAreaSort = decoratedIslandList[:]
- decoratedIslandListAreaSort.sort(key = lambda A: A[3])
+ decoratedIslandListAreaSort.sort(key=lambda A: A[3])
# sort by efficiency, Least Efficient first.
decoratedIslandListEfficSort = decoratedIslandList[:]
# decoratedIslandListEfficSort.sort(lambda A, B: cmp(B[2], A[2]))
- decoratedIslandListEfficSort.sort(key = lambda A: -A[2])
+ decoratedIslandListEfficSort.sort(key=lambda A: -A[2])
# ================================================== THESE CAN BE TWEAKED.
# This is a quality value for the number of tests.
# from 1 to 4, generic quality value is from 1 to 100
- USER_STEP_QUALITY = ((USER_FILL_HOLES_QUALITY - 1) / 25.0) + 1
+ USER_STEP_QUALITY = ((USER_FILL_HOLES_QUALITY - 1) / 25.0) + 1
# If 100 will test as long as there is enough free space.
# this is rarely enough, and testing takes a while, so lower quality speeds this up.
# 1 means they have the same quality
- USER_FREE_SPACE_TO_TEST_QUALITY = 1 + (((100 - USER_FILL_HOLES_QUALITY)/100.0) *5)
+ USER_FREE_SPACE_TO_TEST_QUALITY = 1 + (((100 - USER_FILL_HOLES_QUALITY) / 100.0) * 5)
- #print 'USER_STEP_QUALITY', USER_STEP_QUALITY
- #print 'USER_FREE_SPACE_TO_TEST_QUALITY', USER_FREE_SPACE_TO_TEST_QUALITY
+ # print 'USER_STEP_QUALITY', USER_STEP_QUALITY
+ # print 'USER_FREE_SPACE_TO_TEST_QUALITY', USER_FREE_SPACE_TO_TEST_QUALITY
removedCount = 0
areaIslandIdx = 0
ctrl = Window.Qual.CTRL
- BREAK= False
+ BREAK = False
while areaIslandIdx < len(decoratedIslandListAreaSort) and not BREAK:
sourceIsland = decoratedIslandListAreaSort[areaIslandIdx]
# Already packed?
if not sourceIsland[0]:
- areaIslandIdx+=1
+ areaIslandIdx += 1
else:
efficIslandIdx = 0
while efficIslandIdx < len(decoratedIslandListEfficSort) and not BREAK:
if Window.GetKeyQualifiers() & ctrl:
- BREAK= True
+ BREAK = True
break
# Now we have 2 islands, if the efficiency of the islands lowers theres an
@@ -355,64 +365,60 @@ def mergeUvIslands(islandList):
targetIsland = decoratedIslandListEfficSort[efficIslandIdx]
-
if sourceIsland[0] == targetIsland[0] or\
- not targetIsland[0] or\
- not sourceIsland[0]:
+ not targetIsland[0] or\
+ not sourceIsland[0]:
pass
else:
#~ ([island, totFaceArea, efficiency, islandArea, w,h])
# Wasted space on target is greater then UV bounding island area.
-
#~ if targetIsland[3] > (sourceIsland[2]) and\ #
- #~ print USER_FREE_SPACE_TO_TEST_QUALITY
+ # ~ print USER_FREE_SPACE_TO_TEST_QUALITY
if targetIsland[2] > (sourceIsland[1] * USER_FREE_SPACE_TO_TEST_QUALITY) and\
- targetIsland[4] > sourceIsland[4] and\
- targetIsland[5] > sourceIsland[5]:
+ targetIsland[4] > sourceIsland[4] and\
+ targetIsland[5] > sourceIsland[5]:
# DEBUG # print '%.10f %.10f' % (targetIsland[3], sourceIsland[1])
# These enough spare space lets move the box until it fits
# How many times does the source fit into the target x/y
- blockTestXUnit = targetIsland[4]/sourceIsland[4]
- blockTestYUnit = targetIsland[5]/sourceIsland[5]
+ blockTestXUnit = targetIsland[4] / sourceIsland[4]
+ blockTestYUnit = targetIsland[5] / sourceIsland[5]
boxLeft = 0
-
# Distance we can move between whilst staying inside the targets bounds.
testWidth = targetIsland[4] - sourceIsland[4]
testHeight = targetIsland[5] - sourceIsland[5]
# Increment we move each test. x/y
- xIncrement = (testWidth / (blockTestXUnit * ((USER_STEP_QUALITY/50)+0.1)))
- yIncrement = (testHeight / (blockTestYUnit * ((USER_STEP_QUALITY/50)+0.1)))
+ xIncrement = (testWidth / (blockTestXUnit * ((USER_STEP_QUALITY / 50) + 0.1)))
+ yIncrement = (testHeight / (blockTestYUnit * ((USER_STEP_QUALITY / 50) + 0.1)))
# Make sure were not moving less then a 3rg of our width/height
- if xIncrement<sourceIsland[4]/3:
- xIncrement= sourceIsland[4]
- if yIncrement<sourceIsland[5]/3:
- yIncrement= sourceIsland[5]
-
+ if xIncrement < sourceIsland[4] / 3:
+ xIncrement = sourceIsland[4]
+ if yIncrement < sourceIsland[5] / 3:
+ yIncrement = sourceIsland[5]
- boxLeft = 0 # Start 1 back so we can jump into the loop.
- boxBottom= 0 #-yIncrement
+ boxLeft = 0 # Start 1 back so we can jump into the loop.
+ boxBottom = 0 # -yIncrement
- #~ testcount= 0
+ # ~ testcount= 0
while boxBottom <= testHeight:
# Should we use this? - not needed for now.
- #~ if Window.GetKeyQualifiers() & ctrl:
- #~ BREAK= True
- #~ break
+ # ~ if Window.GetKeyQualifiers() & ctrl:
+ # ~ BREAK= True
+ # ~ break
- ##testcount+=1
- #print 'Testing intersect'
+ # testcount+=1
+ # print 'Testing intersect'
Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector((boxLeft, boxBottom)))
- #print 'Done', Intersect
+ # print 'Done', Intersect
if Intersect == 1: # Line intersect, don't bother with this any more
pass
@@ -429,93 +435,92 @@ def mergeUvIslands(islandList):
# Move the test along its width + SMALL_NUM
#boxLeft += sourceIsland[4] + SMALL_NUM
boxLeft += sourceIsland[4]
- elif Intersect == 0: # No intersection?? Place it.
+ elif Intersect == 0: # No intersection?? Place it.
# Progress
- removedCount +=1
-#XXX Window.DrawProgressBar(0.0, 'Merged: %i islands, Ctrl to finish early.' % removedCount)
+ removedCount += 1
+# XXX Window.DrawProgressBar(0.0, 'Merged: %i islands, Ctrl to finish early.' % removedCount)
# Move faces into new island and offset
targetIsland[0].extend(sourceIsland[0])
- offset= Vector((boxLeft, boxBottom))
+ offset = Vector((boxLeft, boxBottom))
for f in sourceIsland[0]:
for uv in f.uv:
- uv+= offset
+ uv += offset
del sourceIsland[0][:] # Empty
-
# Move edge loop into new and offset.
# targetIsland[6].extend(sourceIsland[6])
- #while sourceIsland[6]:
- targetIsland[6].extend( [ (\
- (e[0]+offset, e[1]+offset, e[2])\
- ) for e in sourceIsland[6] ] )
+ # while sourceIsland[6]:
+ targetIsland[6].extend([(
+ (e[0] + offset, e[1] + offset, e[2])
+ ) for e in sourceIsland[6]])
del sourceIsland[6][:] # Empty
# Sort by edge length, reverse so biggest are first.
- try: targetIsland[6].sort(key = lambda A: A[2])
- except: targetIsland[6].sort(lambda B,A: cmp(A[2], B[2] ))
-
+ try:
+ targetIsland[6].sort(key=lambda A: A[2])
+ except:
+ targetIsland[6].sort(lambda B, A: cmp(A[2], B[2]))
targetIsland[7].extend(sourceIsland[7])
- offset= Vector((boxLeft, boxBottom, 0.0))
+ offset = Vector((boxLeft, boxBottom, 0.0))
for p in sourceIsland[7]:
- p+= offset
+ p += offset
del sourceIsland[7][:]
-
# Decrement the efficiency
- targetIsland[1]+=sourceIsland[1] # Increment totFaceArea
- targetIsland[2]-=sourceIsland[1] # Decrement efficiency
+ targetIsland[1] += sourceIsland[1] # Increment totFaceArea
+ targetIsland[2] -= sourceIsland[1] # Decrement efficiency
# IF we ever used these again, should set to 0, eg
- sourceIsland[2] = 0 # No area if anyone wants to know
+ sourceIsland[2] = 0 # No area if anyone wants to know
break
-
# INCREMENT NEXT LOCATION
if boxLeft > testWidth:
boxBottom += yIncrement
boxLeft = 0.0
else:
boxLeft += xIncrement
- ##print testcount
+ # print testcount
- efficIslandIdx+=1
- areaIslandIdx+=1
+ efficIslandIdx += 1
+ areaIslandIdx += 1
# Remove empty islands
i = len(islandList)
while i:
- i-=1
+ i -= 1
if not islandList[i]:
- del islandList[i] # Can increment islands removed here.
+ del islandList[i] # Can increment islands removed here.
# Takes groups of faces. assumes face groups are UV groups.
+
+
def getUvIslands(faceGroups, me):
# Get seams so we don't cross over seams
- edge_seams = {} # should be a set
+ edge_seams = {} # should be a set
for ed in me.edges:
if ed.use_seam:
- edge_seams[ed.key] = None # dummy var- use sets!
+ edge_seams[ed.key] = None # dummy var- use sets!
# Done finding seams
-
islandList = []
-#XXX Window.DrawProgressBar(0.0, 'Splitting %d projection groups into UV islands:' % len(faceGroups))
- #print '\tSplitting %d projection groups into UV islands:' % len(faceGroups),
+# XXX Window.DrawProgressBar(0.0, 'Splitting %d projection groups into UV islands:' % len(faceGroups))
+ # print '\tSplitting %d projection groups into UV islands:' % len(faceGroups),
# Find grouped faces
faceGroupIdx = len(faceGroups)
while faceGroupIdx:
- faceGroupIdx-=1
+ faceGroupIdx -= 1
faces = faceGroups[faceGroupIdx]
if not faces:
@@ -526,37 +531,38 @@ def getUvIslands(faceGroups, me):
for i, f in enumerate(faces):
for ed_key in f.edge_keys:
- if ed_key in edge_seams: # DELIMIT SEAMS! ;)
- edge_users[ed_key] = [] # so as not to raise an error
+ if ed_key in edge_seams: # DELIMIT SEAMS! ;)
+ edge_users[ed_key] = [] # so as not to raise an error
else:
- try: edge_users[ed_key].append(i)
- except: edge_users[ed_key] = [i]
+ try:
+ edge_users[ed_key].append(i)
+ except:
+ edge_users[ed_key] = [i]
# Modes
# 0 - face not yet touched.
# 1 - added to island list, and need to search
# 2 - touched and searched - don't touch again.
- face_modes = [0] * len(faces) # initialize zero - untested.
+ face_modes = [0] * len(faces) # initialize zero - untested.
- face_modes[0] = 1 # start the search with face 1
+ face_modes[0] = 1 # start the search with face 1
newIsland = []
newIsland.append(faces[0])
-
ok = True
while ok:
ok = True
while ok:
- ok= False
+ ok = False
for i in range(len(faces)):
- if face_modes[i] == 1: # search
+ if face_modes[i] == 1: # search
for ed_key in faces[i].edge_keys:
for ii in edge_users[ed_key]:
if i != ii and face_modes[ii] == 0:
- face_modes[ii] = ok = 1 # mark as searched
+ face_modes[ii] = ok = 1 # mark as searched
newIsland.append(faces[ii])
# mark as searched, don't look again.
@@ -574,7 +580,7 @@ def getUvIslands(faceGroups, me):
break
# if not ok will stop looping
-#XXX Window.DrawProgressBar(0.1, 'Optimizing Rotation for %i UV Islands' % len(islandList))
+# XXX Window.DrawProgressBar(0.1, 'Optimizing Rotation for %i UV Islands' % len(islandList))
for island in islandList:
optiRotateUvIsland(island)
@@ -584,9 +590,8 @@ def getUvIslands(faceGroups, me):
def packIslands(islandList):
if USER_FILL_HOLES:
-#XXX Window.DrawProgressBar(0.1, 'Merging Islands (Ctrl: skip merge)...')
- mergeUvIslands(islandList) # Modify in place
-
+ # XXX Window.DrawProgressBar(0.1, 'Merging Islands (Ctrl: skip merge)...')
+ mergeUvIslands(islandList) # Modify in place
# Now we have UV islands, we need to pack them.
@@ -603,16 +608,16 @@ def packIslands(islandList):
while islandIdx < len(islandList):
minx, miny, maxx, maxy = boundsIsland(islandList[islandIdx])
- w, h = maxx-minx, maxy-miny
+ w, h = maxx - minx, maxy - miny
if USER_ISLAND_MARGIN:
- minx -= USER_ISLAND_MARGIN# *w
- miny -= USER_ISLAND_MARGIN# *h
- maxx += USER_ISLAND_MARGIN# *w
- maxy += USER_ISLAND_MARGIN# *h
+ minx -= USER_ISLAND_MARGIN # *w
+ miny -= USER_ISLAND_MARGIN # *h
+ maxx += USER_ISLAND_MARGIN # *w
+ maxy += USER_ISLAND_MARGIN # *h
# recalc width and height
- w, h = maxx-minx, maxy-miny
+ w, h = maxx - minx, maxy - miny
if w < SMALL_NUM:
w = SMALL_NUM
@@ -628,24 +633,24 @@ def packIslands(islandList):
# Add to boxList. use the island idx for the BOX id.
packBoxes.append([0, 0, w, h])
- islandIdx+=1
+ islandIdx += 1
# Now we have a list of boxes to pack that syncs
# with the islands.
- #print '\tPacking UV Islands...'
-#XXX Window.DrawProgressBar(0.7, "Packing %i UV Islands..." % len(packBoxes) )
+ # print '\tPacking UV Islands...'
+# XXX Window.DrawProgressBar(0.7, "Packing %i UV Islands..." % len(packBoxes) )
# time1 = time.time()
packWidth, packHeight = geometry.box_pack_2d(packBoxes)
# print 'Box Packing Time:', time.time() - time1
- #if len(pa ckedLs) != len(islandList):
+ # if len(pa ckedLs) != len(islandList):
# raise ValueError("Packed boxes differs from original length")
- #print '\tWriting Packed Data to faces'
-#XXX Window.DrawProgressBar(0.8, "Writing Packed Data to faces")
+ # print '\tWriting Packed Data to faces'
+# XXX Window.DrawProgressBar(0.8, "Writing Packed Data to faces")
# Sort by ID, so there in sync again
islandIdx = len(islandList)
@@ -661,16 +666,16 @@ def packIslands(islandList):
xfactor = yfactor = 1.0 / max(packWidth, packHeight)
while islandIdx:
- islandIdx -=1
+ islandIdx -= 1
# Write the packed values to the UV's
xoffset = packBoxes[islandIdx][0] - islandOffsetList[islandIdx][0]
yoffset = packBoxes[islandIdx][1] - islandOffsetList[islandIdx][1]
- for f in islandList[islandIdx]: # Offsetting the UV's so they fit in there packed box
+ for f in islandList[islandIdx]: # Offsetting the UV's so they fit in there packed box
for uv in f.uv:
- uv.x= (uv.x+xoffset) * xfactor
- uv.y= (uv.y+yoffset) * yfactor
+ uv.x = (uv.x + xoffset) * xfactor
+ uv.y = (uv.y + yoffset) * yfactor
def VectoQuat(vec):
@@ -679,7 +684,8 @@ def VectoQuat(vec):
class thickface:
- __slost__= "v", "uv", "no", "area", "edge_keys"
+ __slost__ = "v", "uv", "no", "area", "edge_keys"
+
def __init__(self, face, uv_layer, mesh_verts):
self.v = [mesh_verts[i] for i in face.vertices]
self.uv = [uv_layer[i].uv for i in face.loop_indices]
@@ -700,18 +706,20 @@ def main_consts():
ROTMAT_2D_POS_45D = Matrix.Rotation(radians(45.0), 2)
RotMatStepRotation = []
- rot_angle = 22.5 #45.0/2
+ rot_angle = 22.5 # 45.0/2
while rot_angle > 0.1:
RotMatStepRotation.append([
Matrix.Rotation(radians(+rot_angle), 2),
Matrix.Rotation(radians(-rot_angle), 2),
- ])
+ ])
- rot_angle = rot_angle/2.0
+ rot_angle = rot_angle / 2.0
global ob
ob = None
+
+
def main(context,
island_margin,
projection_limit,
@@ -741,18 +749,18 @@ def main(context,
# Create the variables.
USER_PROJECTION_LIMIT = projection_limit
USER_ONLY_SELECTED_FACES = True
- USER_SHARE_SPACE = 1 # Only for hole filling.
+ USER_SHARE_SPACE = 1 # Only for hole filling.
USER_STRETCH_ASPECT = stretch_to_bounds
- USER_ISLAND_MARGIN = island_margin # Only for hole filling.
+ USER_ISLAND_MARGIN = island_margin # Only for hole filling.
USER_FILL_HOLES = 0
- USER_FILL_HOLES_QUALITY = 50 # Only for hole filling.
- USER_VIEW_INIT = 0 # Only for hole filling.
+ USER_FILL_HOLES_QUALITY = 50 # Only for hole filling.
+ USER_VIEW_INIT = 0 # Only for hole filling.
is_editmode = (context.active_object.mode == 'EDIT')
if is_editmode:
- obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
+ obList = [ob for ob in [context.active_object] if ob and ob.type == 'MESH']
else:
- obList = [ob for ob in context.selected_editable_objects if ob and ob.type == 'MESH']
+ obList = [ob for ob in context.selected_editable_objects if ob and ob.type == 'MESH']
USER_ONLY_SELECTED_FACES = False
if not obList:
@@ -770,15 +778,14 @@ def main(context,
time.sleep(10)
'''
-#~ XXX if not Draw.PupBlock(ob % len(obList), pup_block):
-#~ XXX return
-#~ XXX del ob
+# ~ XXX if not Draw.PupBlock(ob % len(obList), pup_block):
+# ~ XXX return
+# ~ XXX del ob
# Convert from being button types
USER_PROJECTION_LIMIT_CONVERTED = cos(USER_PROJECTION_LIMIT * DEG_TO_RAD)
- USER_PROJECTION_LIMIT_HALF_CONVERTED = cos((USER_PROJECTION_LIMIT/2) * DEG_TO_RAD)
-
+ USER_PROJECTION_LIMIT_HALF_CONVERTED = cos((USER_PROJECTION_LIMIT / 2) * DEG_TO_RAD)
# Toggle Edit mode
is_editmode = (context.active_object.mode == 'EDIT')
@@ -788,19 +795,18 @@ def main(context,
if USER_SHARE_SPACE:
# Sort by data name so we get consistent results
- obList.sort(key = lambda ob: ob.data.name)
- collected_islandList= []
+ obList.sort(key=lambda ob: ob.data.name)
+ collected_islandList = []
-#XXX Window.WaitCursor(1)
+# XXX Window.WaitCursor(1)
time1 = time.time()
# Tag as False so we don't operate on the same mesh twice.
-#XXX bpy.data.meshes.tag = False
+# XXX bpy.data.meshes.tag = False
for me in bpy.data.meshes:
me.tag = False
-
for ob in obList:
me = ob.data
@@ -810,7 +816,7 @@ def main(context,
# Tag as used
me.tag = True
- if not me.uv_layers: # Mesh has no UV Coords, don't bother.
+ if not me.uv_layers: # Mesh has no UV Coords, don't bother.
me.uv_layers.new()
uv_layer = me.uv_layers.active.data
@@ -821,7 +827,7 @@ def main(context,
else:
meshFaces = [thickface(f, uv_layer, me_verts) for i, f in enumerate(me.polygons)]
-#XXX Window.DrawProgressBar(0.1, 'SmartProj UV Unwrapper, mapping "%s", %i faces.' % (me.name, len(meshFaces)))
+# XXX Window.DrawProgressBar(0.1, 'SmartProj UV Unwrapper, mapping "%s", %i faces.' % (me.name, len(meshFaces)))
# =======
# Generate a projection list from face normals, this is meant to be smart :)
@@ -849,17 +855,15 @@ def main(context,
# 0d is 1.0
# 180 IS -0.59846
-
# Initialize projectVecs
if USER_VIEW_INIT:
# Generate Projection
- projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this along the way
+ projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this along the way
else:
projectVecs = []
newProjectVec = meshFaces[0].no
- newProjectMeshFaces = [] # Popping stuffs it up.
-
+ newProjectMeshFaces = [] # Popping stuffs it up.
# Pretend that the most unique angle is ages away to start the loop off
mostUniqueAngle = -1.0
@@ -867,14 +871,12 @@ def main(context,
# This is popped
tempMeshFaces = meshFaces[:]
-
-
# This while only gathers projection vecs, faces are assigned later on.
while 1:
# If theres none there then start with the largest face
# add all the faces that are close.
- for fIdx in range(len(tempMeshFaces)-1, -1, -1):
+ for fIdx in range(len(tempMeshFaces) - 1, -1, -1):
# Use half the angle limit so we don't overweight faces towards this
# normal and hog all the faces.
if newProjectVec.dot(tempMeshFaces[fIdx].no) > USER_PROJECTION_LIMIT_HALF_CONVERTED:
@@ -892,24 +894,23 @@ def main(context,
for fprop in newProjectMeshFaces:
averageVec += fprop.no * ((fprop.area * user_area_weight) + (1.0 - user_area_weight))
- if averageVec.x != 0 or averageVec.y != 0 or averageVec.z != 0: # Avoid NAN
+ if averageVec.x != 0 or averageVec.y != 0 or averageVec.z != 0: # Avoid NAN
projectVecs.append(averageVec.normalized())
-
# Get the next vec!
# Pick the face thats most different to all existing angles :)
- mostUniqueAngle = 1.0 # 1.0 is 0d. no difference.
- mostUniqueIndex = 0 # dummy
+ mostUniqueAngle = 1.0 # 1.0 is 0d. no difference.
+ mostUniqueIndex = 0 # dummy
- for fIdx in range(len(tempMeshFaces)-1, -1, -1):
- angleDifference = -1.0 # 180d difference.
+ for fIdx in range(len(tempMeshFaces) - 1, -1, -1):
+ angleDifference = -1.0 # 180d difference.
# Get the closest vec angle we are to.
for p in projectVecs:
- temp_angle_diff= p.dot(tempMeshFaces[fIdx].no)
+ temp_angle_diff = p.dot(tempMeshFaces[fIdx].no)
if angleDifference < temp_angle_diff:
- angleDifference= temp_angle_diff
+ angleDifference = temp_angle_diff
if angleDifference < mostUniqueAngle:
# We have a new most different angle
@@ -917,30 +918,28 @@ def main(context,
mostUniqueAngle = angleDifference
if mostUniqueAngle < USER_PROJECTION_LIMIT_CONVERTED:
- #print 'adding', mostUniqueAngle, USER_PROJECTION_LIMIT, len(newProjectMeshFaces)
+ # print 'adding', mostUniqueAngle, USER_PROJECTION_LIMIT, len(newProjectMeshFaces)
# Now weight the vector to all its faces, will give a more direct projection
# if the face its self was not representative of the normal from surrounding faces.
newProjectVec = tempMeshFaces[mostUniqueIndex].no
newProjectMeshFaces = [tempMeshFaces.pop(mostUniqueIndex)]
-
else:
- if len(projectVecs) >= 1: # Must have at least 2 projections
+ if len(projectVecs) >= 1: # Must have at least 2 projections
break
-
# If there are only zero area faces then its possible
# there are no projectionVecs
if not len(projectVecs):
Draw.PupMenu('error, no projection vecs where generated, 0 area faces can cause this.')
return
- faceProjectionGroupList =[[] for i in range(len(projectVecs)) ]
+ faceProjectionGroupList = [[] for i in range(len(projectVecs))]
# MAP and Arrange # We know there are 3 or 4 faces here
- for fIdx in range(len(meshFaces)-1, -1, -1):
+ for fIdx in range(len(meshFaces) - 1, -1, -1):
fvec = meshFaces[fIdx].no
i = len(projectVecs)
@@ -949,11 +948,11 @@ def main(context,
bestAngIdx = 0
# Cycle through the remaining, first already done
- while i-1:
- i-=1
+ while i - 1:
+ i -= 1
newAng = fvec.dot(projectVecs[i])
- if newAng > bestAng: # Reverse logic for dotvecs
+ if newAng > bestAng: # Reverse logic for dotvecs
bestAng = newAng
bestAngIdx = i
@@ -962,7 +961,6 @@ def main(context,
# Cull faceProjectionGroupList,
-
# Now faceProjectionGroupList is full of faces that face match the project Vecs list
for i in range(len(projectVecs)):
# Account for projectVecs having no faces.
@@ -979,7 +977,6 @@ def main(context,
# XXX - note, between mathutils in 2.4 and 2.5 the order changed.
f_uv[j][:] = (MatQuat * v.co).xy
-
if USER_SHARE_SPACE:
# Should we collect and pack later?
islandList = getUvIslands(faceProjectionGroupList, me)
@@ -990,12 +987,11 @@ def main(context,
islandList = getUvIslands(faceProjectionGroupList, me)
packIslands(islandList)
-
# update the mesh here if we need to.
# We want to pack all in 1 go, so pack now
if USER_SHARE_SPACE:
-#XXX Window.DrawProgressBar(0.9, "Box Packing for all objects...")
+ # XXX Window.DrawProgressBar(0.9, "Box Packing for all objects...")
packIslands(collected_islandList)
print("Smart Projection time: %.2f" % (time.time() - time1))
@@ -1006,31 +1002,32 @@ def main(context,
bpy.ops.object.mode_set(mode='EDIT')
if use_aspect:
- import bmesh
- aspect = context.scene.uvedit_aspect(context.active_object)
- if aspect[0] > aspect[1]:
- aspect[0] = aspect[1]/aspect[0];
- aspect[1] = 1.0
- else:
- aspect[1] = aspect[0]/aspect[1];
- aspect[0] = 1.0
+ import bmesh
+ aspect = context.scene.uvedit_aspect(context.active_object)
+ if aspect[0] > aspect[1]:
+ aspect[0] = aspect[1] / aspect[0]
+ aspect[1] = 1.0
+ else:
+ aspect[1] = aspect[0] / aspect[1]
+ aspect[0] = 1.0
- bm = bmesh.from_edit_mesh(me)
+ bm = bmesh.from_edit_mesh(me)
- uv_act = bm.loops.layers.uv.active
+ uv_act = bm.loops.layers.uv.active
- faces = [f for f in bm.faces if f.select]
+ faces = [f for f in bm.faces if f.select]
- for f in faces:
- for l in f.loops:
- l[uv_act].uv[0] *= aspect[0]
- l[uv_act].uv[1] *= aspect[1]
+ for f in faces:
+ for l in f.loops:
+ l[uv_act].uv[0] *= aspect[0]
+ l[uv_act].uv[1] *= aspect[1]
dict_matrix.clear()
-#XXX Window.DrawProgressBar(1.0, "")
-#XXX Window.WaitCursor(0)
-#XXX Window.RedrawAll()
+# XXX Window.DrawProgressBar(1.0, "")
+# XXX Window.WaitCursor(0)
+# XXX Window.RedrawAll()
+
"""
pup_block = [\
@@ -1052,41 +1049,41 @@ from bpy.props import FloatProperty, BoolProperty
class SmartProject(Operator):
"""This script projection unwraps the selected faces of a mesh """ \
- """(it operates on all selected mesh objects, and can be used """ \
- """to unwrap selected faces, or all faces)"""
+ """(it operates on all selected mesh objects, and can be used """ \
+ """to unwrap selected faces, or all faces)"""
bl_idname = "uv.smart_project"
bl_label = "Smart UV Project"
bl_options = {'REGISTER', 'UNDO'}
angle_limit = FloatProperty(
- name="Angle Limit",
- description="Lower for more projection groups, higher for less distortion",
- min=1.0, max=89.0,
- default=66.0,
- )
+ name="Angle Limit",
+ description="Lower for more projection groups, higher for less distortion",
+ min=1.0, max=89.0,
+ default=66.0,
+ )
island_margin = FloatProperty(
- name="Island Margin",
- description="Margin to reduce bleed from adjacent islands",
- unit='LENGTH', subtype='DISTANCE',
- min=0.0, max=1.0,
- default=0.0,
- )
+ name="Island Margin",
+ description="Margin to reduce bleed from adjacent islands",
+ unit='LENGTH', subtype='DISTANCE',
+ min=0.0, max=1.0,
+ default=0.0,
+ )
user_area_weight = FloatProperty(
- name="Area Weight",
- description="Weight projections vector by faces with larger areas",
- min=0.0, max=1.0,
- default=0.0,
- )
+ name="Area Weight",
+ description="Weight projections vector by faces with larger areas",
+ min=0.0, max=1.0,
+ default=0.0,
+ )
use_aspect = BoolProperty(
- name="Correct Aspect",
- description="Map UVs taking image aspect ratio into account",
- default=True
- )
+ name="Correct Aspect",
+ description="Map UVs taking image aspect ratio into account",
+ default=True
+ )
stretch_to_bounds = BoolProperty(
- name="Stretch to UV Bounds",
- description="Stretch the final output to texture bounds",
- default=True,
- )
+ name="Stretch to UV Bounds",
+ description="Stretch the final output to texture bounds",
+ default=True,
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
index f12b76a76ba..1173e0047bb 100644
--- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py
+++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
@@ -139,36 +139,36 @@ class VertexPaintDirt(Operator):
bl_options = {'REGISTER', 'UNDO'}
blur_strength = FloatProperty(
- name="Blur Strength",
- description="Blur strength per iteration",
- min=0.01, max=1.0,
- default=1.0,
- )
+ name="Blur Strength",
+ description="Blur strength per iteration",
+ min=0.01, max=1.0,
+ default=1.0,
+ )
blur_iterations = IntProperty(
- name="Blur Iterations",
- description="Number of times to blur the colors (higher blurs more)",
- min=0, max=40,
- default=1,
- )
+ name="Blur Iterations",
+ description="Number of times to blur the colors (higher blurs more)",
+ min=0, max=40,
+ default=1,
+ )
clean_angle = FloatProperty(
- name="Highlight Angle",
- description="Less than 90 limits the angle used in the tonal range",
- min=0.0, max=pi,
- default=pi,
- unit="ROTATION",
- )
+ name="Highlight Angle",
+ description="Less than 90 limits the angle used in the tonal range",
+ min=0.0, max=pi,
+ default=pi,
+ unit="ROTATION",
+ )
dirt_angle = FloatProperty(
- name="Dirt Angle",
- description="Less than 90 limits the angle used in the tonal range",
- min=0.0, max=pi,
- default=0.0,
- unit="ROTATION",
- )
+ name="Dirt Angle",
+ description="Less than 90 limits the angle used in the tonal range",
+ min=0.0, max=pi,
+ default=0.0,
+ unit="ROTATION",
+ )
dirt_only = BoolProperty(
- name="Dirt Only",
- description="Don't calculate cleans for convex areas",
- default=False,
- )
+ name="Dirt Only",
+ description="Don't calculate cleans for convex areas",
+ default=False,
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py
index 18f91110053..f56c83be7d1 100644
--- a/release/scripts/startup/bl_operators/view3d.py
+++ b/release/scripts/startup/bl_operators/view3d.py
@@ -39,13 +39,16 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(Operator):
totface = mesh.total_face_sel
totedge = mesh.total_edge_sel
- #~ totvert = mesh.total_vert_sel
+ # totvert = mesh.total_vert_sel
if select_mode[2] and totface == 1:
- bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN',
- TRANSFORM_OT_translate={
- "constraint_orientation": 'NORMAL',
- "constraint_axis": (False, False, True)})
+ bpy.ops.mesh.extrude_region_move(
+ 'INVOKE_REGION_WIN',
+ TRANSFORM_OT_translate={
+ "constraint_orientation": 'NORMAL',
+ "constraint_axis": (False, False, True),
+ }
+ )
elif select_mode[2] and totface > 1:
bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
elif select_mode[1] and totedge >= 1:
@@ -77,25 +80,32 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
totface = mesh.total_face_sel
totedge = mesh.total_edge_sel
- #~ totvert = mesh.total_vert_sel
+ # totvert = mesh.total_vert_sel
if totface >= 1:
if use_vert_normals:
- bpy.ops.mesh.extrude_region_shrink_fatten('INVOKE_REGION_WIN',
- TRANSFORM_OT_shrink_fatten={})
+ bpy.ops.mesh.extrude_region_shrink_fatten(
+ 'INVOKE_REGION_WIN',
+ TRANSFORM_OT_shrink_fatten={},
+ )
else:
- bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN',
- TRANSFORM_OT_translate={
- "constraint_orientation": 'NORMAL',
- "constraint_axis": (False, False, True)})
-
- elif totedge == 1:
- bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN',
+ bpy.ops.mesh.extrude_region_move(
+ 'INVOKE_REGION_WIN',
TRANSFORM_OT_translate={
"constraint_orientation": 'NORMAL',
- # not a popular choice, too restrictive for retopo.
- #~ "constraint_axis": (True, True, False)})
- "constraint_axis": (False, False, False)})
+ "constraint_axis": (False, False, True),
+ },
+ )
+
+ elif totedge == 1:
+ bpy.ops.mesh.extrude_region_move(
+ 'INVOKE_REGION_WIN',
+ TRANSFORM_OT_translate={
+ "constraint_orientation": 'NORMAL',
+ # not a popular choice, too restrictive for retopo.
+ # "constraint_axis": (True, True, False)})
+ "constraint_axis": (False, False, False),
+ })
else:
bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
@@ -134,40 +144,40 @@ class VIEW3D_OT_select_or_deselect_all(Operator):
bl_options = {'UNDO'}
extend = BoolProperty(
- name="Extend",
- description="Extend selection instead of deselecting everything first",
- default=False,
- )
+ name="Extend",
+ description="Extend selection instead of deselecting everything first",
+ default=False,
+ )
toggle = BoolProperty(
- name="Toggle",
- description="Toggle the selection",
- default=False,
- )
+ name="Toggle",
+ description="Toggle the selection",
+ default=False,
+ )
deselect = BoolProperty(
- name="Deselect",
- description="Remove from selection",
- default=False,
- )
+ name="Deselect",
+ description="Remove from selection",
+ default=False,
+ )
center = BoolProperty(
- name="Center",
- description="Use the object center when selecting, in editmode used to extend object selection",
- default=False,
- )
+ name="Center",
+ description="Use the object center when selecting, in editmode used to extend object selection",
+ default=False,
+ )
enumerate = BoolProperty(
- name="Enumerate",
- description="List objects under the mouse (object mode only)",
- default=False,
- )
+ name="Enumerate",
+ description="List objects under the mouse (object mode only)",
+ default=False,
+ )
object = BoolProperty(
- name="Object",
- description="Use object selection (editmode only)",
- default=False,
- )
+ name="Object",
+ description="Use object selection (editmode only)",
+ default=False,
+ )
@classmethod
def poll(cls, context):
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index b0a5e19d269..440beaaa240 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -36,37 +36,37 @@ from bpy.app.translations import pgettext_tip as tip_
rna_path_prop = StringProperty(
- name="Context Attributes",
- description="RNA context string",
- maxlen=1024,
- )
+ name="Context Attributes",
+ description="RNA context string",
+ maxlen=1024,
+)
rna_reverse_prop = BoolProperty(
- name="Reverse",
- description="Cycle backwards",
- default=False,
- )
+ name="Reverse",
+ description="Cycle backwards",
+ default=False,
+)
rna_wrap_prop = BoolProperty(
- name="Wrap",
- description="Wrap back to the first/last values",
- default=False,
- )
+ name="Wrap",
+ description="Wrap back to the first/last values",
+ default=False,
+)
rna_relative_prop = BoolProperty(
- name="Relative",
- description="Apply relative to the current value (delta)",
- default=False,
- )
+ name="Relative",
+ description="Apply relative to the current value (delta)",
+ default=False,
+)
rna_space_type_prop = EnumProperty(
- name="Type",
- items=tuple(
- (e.identifier, e.name, "", e. value)
- for e in bpy.types.Space.bl_rna.properties["type"].enum_items
- ),
- default='EMPTY',
- )
+ name="Type",
+ items=tuple(
+ (e.identifier, e.name, "", e. value)
+ for e in bpy.types.Space.bl_rna.properties["type"].enum_items
+ ),
+ default='EMPTY',
+)
def context_path_validate(context, data_path):
@@ -163,14 +163,14 @@ class BRUSH_OT_active_index_set(Operator):
bl_label = "Set Brush Number"
mode = StringProperty(
- name="Mode",
- description="Paint mode to set brush for",
- maxlen=1024,
- )
+ name="Mode",
+ description="Paint mode to set brush for",
+ maxlen=1024,
+ )
index = IntProperty(
- name="Number",
- description="Brush number",
- )
+ name="Number",
+ description="Brush number",
+ )
_attr_dict = {
"sculpt": "use_paint_sculpt",
@@ -201,10 +201,10 @@ class WM_OT_context_set_boolean(Operator):
data_path = rna_path_prop
value = BoolProperty(
- name="Value",
- description="Assignment value",
- default=True,
- )
+ name="Value",
+ description="Assignment value",
+ default=True,
+ )
execute = execute_context_assign
@@ -217,10 +217,10 @@ class WM_OT_context_set_int(Operator): # same as enum
data_path = rna_path_prop
value = IntProperty(
- name="Value",
- description="Assign value",
- default=0,
- )
+ name="Value",
+ description="Assign value",
+ default=0,
+ )
relative = rna_relative_prop
execute = execute_context_assign
@@ -234,10 +234,10 @@ class WM_OT_context_scale_float(Operator):
data_path = rna_path_prop
value = FloatProperty(
- name="Value",
- description="Assign value",
- default=1.0,
- )
+ name="Value",
+ description="Assign value",
+ default=1.0,
+ )
def execute(self, context):
data_path = self.data_path
@@ -262,15 +262,15 @@ class WM_OT_context_scale_int(Operator):
data_path = rna_path_prop
value = FloatProperty(
- name="Value",
- description="Assign value",
- default=1.0,
- )
+ name="Value",
+ description="Assign value",
+ default=1.0,
+ )
always_step = BoolProperty(
- name="Always Step",
- description="Always adjust the value by a minimum of 1 when 'value' is not 1.0",
- default=True,
- )
+ name="Always Step",
+ description="Always adjust the value by a minimum of 1 when 'value' is not 1.0",
+ default=True,
+ )
def execute(self, context):
data_path = self.data_path
@@ -305,10 +305,10 @@ class WM_OT_context_set_float(Operator): # same as enum
data_path = rna_path_prop
value = FloatProperty(
- name="Value",
- description="Assignment value",
- default=0.0,
- )
+ name="Value",
+ description="Assignment value",
+ default=0.0,
+ )
relative = rna_relative_prop
execute = execute_context_assign
@@ -322,10 +322,10 @@ class WM_OT_context_set_string(Operator): # same as enum
data_path = rna_path_prop
value = StringProperty(
- name="Value",
- description="Assign value",
- maxlen=1024,
- )
+ name="Value",
+ description="Assign value",
+ maxlen=1024,
+ )
execute = execute_context_assign
@@ -338,10 +338,10 @@ class WM_OT_context_set_enum(Operator):
data_path = rna_path_prop
value = StringProperty(
- name="Value",
- description="Assignment value (as a string)",
- maxlen=1024,
- )
+ name="Value",
+ description="Assignment value (as a string)",
+ maxlen=1024,
+ )
execute = execute_context_assign
@@ -354,10 +354,10 @@ class WM_OT_context_set_value(Operator):
data_path = rna_path_prop
value = StringProperty(
- name="Value",
- description="Assignment value (as a string)",
- maxlen=1024,
- )
+ name="Value",
+ description="Assignment value (as a string)",
+ maxlen=1024,
+ )
def execute(self, context):
data_path = self.data_path
@@ -394,15 +394,15 @@ class WM_OT_context_toggle_enum(Operator):
data_path = rna_path_prop
value_1 = StringProperty(
- name="Value",
- description="Toggle enum",
- maxlen=1024,
- )
+ name="Value",
+ description="Toggle enum",
+ maxlen=1024,
+ )
value_2 = StringProperty(
- name="Value",
- description="Toggle enum",
- maxlen=1024,
- )
+ name="Value",
+ description="Toggle enum",
+ maxlen=1024,
+ )
def execute(self, context):
data_path = self.data_path
@@ -426,7 +426,7 @@ class WM_OT_context_toggle_enum(Operator):
class WM_OT_context_cycle_int(Operator):
"""Set a context value (useful for cycling active material, """ \
- """vertex keys, groups, etc.)"""
+ """vertex keys, groups, etc.)"""
bl_idname = "wm.context_cycle_int"
bl_label = "Context Int Cycle"
bl_options = {'UNDO', 'INTERNAL'}
@@ -519,7 +519,7 @@ class WM_OT_context_cycle_enum(Operator):
class WM_OT_context_cycle_array(Operator):
"""Set a context array value """ \
- """(useful for cycling the active mesh edit mode)"""
+ """(useful for cycling the active mesh edit mode)"""
bl_idname = "wm.context_cycle_array"
bl_label = "Context Array Cycle"
bl_options = {'UNDO', 'INTERNAL'}
@@ -603,15 +603,15 @@ class WM_OT_operator_pie_enum(Operator):
bl_label = "Operator Enum Pie"
bl_options = {'UNDO', 'INTERNAL'}
data_path = StringProperty(
- name="Operator",
- description="Operator name (in python as string)",
- maxlen=1024,
- )
+ name="Operator",
+ description="Operator name (in python as string)",
+ maxlen=1024,
+ )
prop_string = StringProperty(
- name="Property",
- description="Property name (as a string)",
- maxlen=1024,
- )
+ name="Property",
+ description="Property name (as a string)",
+ maxlen=1024,
+ )
def invoke(self, context, event):
wm = context.window_manager
@@ -648,10 +648,10 @@ class WM_OT_context_set_id(Operator):
data_path = rna_path_prop
value = StringProperty(
- name="Value",
- description="Assign value",
- maxlen=1024,
- )
+ name="Value",
+ description="Assign value",
+ maxlen=1024,
+ )
def execute(self, context):
value = self.value
@@ -679,16 +679,16 @@ class WM_OT_context_set_id(Operator):
doc_id = StringProperty(
- name="Doc ID",
- maxlen=1024,
- options={'HIDDEN'},
- )
+ name="Doc ID",
+ maxlen=1024,
+ options={'HIDDEN'},
+)
data_path_iter = StringProperty(
- description="The data path relative to the context, must point to an iterable")
+ description="The data path relative to the context, must point to an iterable")
data_path_item = StringProperty(
- description="The data path from each iterable to the value (int or float)")
+ description="The data path from each iterable to the value (int or float)")
class WM_OT_context_collection_boolean_set(Operator):
@@ -701,12 +701,12 @@ class WM_OT_context_collection_boolean_set(Operator):
data_path_item = data_path_item
type = EnumProperty(
- name="Type",
- items=(('TOGGLE', "Toggle", ""),
- ('ENABLE', "Enable", ""),
- ('DISABLE', "Disable", ""),
- ),
- )
+ name="Type",
+ items=(('TOGGLE', "Toggle", ""),
+ ('ENABLE', "Enable", ""),
+ ('DISABLE', "Disable", ""),
+ ),
+ )
def execute(self, context):
data_path_iter = self.data_path_iter
@@ -759,18 +759,18 @@ class WM_OT_context_modal_mouse(Operator):
data_path_iter = data_path_iter
data_path_item = data_path_item
header_text = StringProperty(
- name="Header Text",
- description="Text to display in header during scale",
- )
+ name="Header Text",
+ description="Text to display in header during scale",
+ )
input_scale = FloatProperty(
- description="Scale the mouse movement by this value before applying the delta",
- default=0.01,
- )
+ description="Scale the mouse movement by this value before applying the delta",
+ default=0.01,
+ )
invert = BoolProperty(
- description="Invert the mouse input",
- default=False,
- )
+ description="Invert the mouse input",
+ default=False,
+ )
initial_x = IntProperty(options={'HIDDEN'})
def _values_store(self, context):
@@ -865,9 +865,9 @@ class WM_OT_url_open(Operator):
bl_options = {'INTERNAL'}
url = StringProperty(
- name="URL",
- description="URL to open",
- )
+ name="URL",
+ description="URL to open",
+ )
def execute(self, context):
import webbrowser
@@ -882,9 +882,9 @@ class WM_OT_path_open(Operator):
bl_options = {'INTERNAL'}
filepath = StringProperty(
- subtype='FILE_PATH',
- options={'SKIP_SAVE'},
- )
+ subtype='FILE_PATH',
+ options={'SKIP_SAVE'},
+ )
def execute(self, context):
import sys
@@ -1068,44 +1068,44 @@ class WM_OT_doc_view(Operator):
rna_path = StringProperty(
- name="Property Edit",
- description="Property data_path edit",
- maxlen=1024,
- options={'HIDDEN'},
- )
+ name="Property Edit",
+ description="Property data_path edit",
+ maxlen=1024,
+ options={'HIDDEN'},
+)
rna_value = StringProperty(
- name="Property Value",
- description="Property value edit",
- maxlen=1024,
- )
+ name="Property Value",
+ description="Property value edit",
+ maxlen=1024,
+)
rna_property = StringProperty(
- name="Property Name",
- description="Property name edit",
- maxlen=1024,
- )
+ name="Property Name",
+ description="Property name edit",
+ maxlen=1024,
+)
rna_min = FloatProperty(
- name="Min",
- default=-10000.0,
- precision=3,
- )
+ name="Min",
+ default=-10000.0,
+ precision=3,
+)
rna_max = FloatProperty(
- name="Max",
- default=10000.0,
- precision=3,
- )
+ name="Max",
+ default=10000.0,
+ precision=3,
+)
rna_use_soft_limits = BoolProperty(
- name="Use Soft Limits",
- )
+ name="Use Soft Limits",
+)
rna_is_overridable_static = BoolProperty(
- name="Is Statically Overridable",
- default=False,
- )
+ name="Is Statically Overridable",
+ default=False,
+)
class WM_OT_properties_edit(Operator):
@@ -1124,8 +1124,8 @@ class WM_OT_properties_edit(Operator):
soft_min = rna_min
soft_max = rna_max
description = StringProperty(
- name="Tooltip",
- )
+ name="Tooltip",
+ )
def _cmp_props_get(self):
# Changing these properties will refresh the UI
@@ -1363,9 +1363,9 @@ class WM_OT_properties_context_change(Operator):
bl_options = {'INTERNAL'}
context = StringProperty(
- name="Context",
- maxlen=64,
- )
+ name="Context",
+ maxlen=64,
+ )
def execute(self, context):
context.space_data.context = self.context
@@ -1401,8 +1401,8 @@ class WM_OT_keyconfig_activate(Operator):
bl_label = "Activate Keyconfig"
filepath = StringProperty(
- subtype='FILE_PATH',
- )
+ subtype='FILE_PATH',
+ )
def execute(self, context):
if bpy.utils.keyconfig_set(self.filepath, report=self.report):
@@ -1436,8 +1436,8 @@ class WM_OT_appconfig_activate(Operator):
bl_label = "Activate Application Configuration"
filepath = StringProperty(
- subtype='FILE_PATH',
- )
+ subtype='FILE_PATH',
+ )
def execute(self, context):
import os
@@ -1461,9 +1461,9 @@ class WM_OT_sysinfo(Operator):
bl_label = "Save System Info"
filepath = StringProperty(
- subtype='FILE_PATH',
- options={'SKIP_SAVE'},
- )
+ subtype='FILE_PATH',
+ options={'SKIP_SAVE'},
+ )
def execute(self, context):
import sys_info
@@ -1475,7 +1475,7 @@ class WM_OT_sysinfo(Operator):
if not self.filepath:
self.filepath = os.path.join(
- os.path.expanduser("~"), "system-info.txt")
+ os.path.expanduser("~"), "system-info.txt")
wm = context.window_manager
wm.fileselect_add(self)
@@ -1539,29 +1539,29 @@ class WM_OT_keyconfig_import(Operator):
bl_label = "Import Key Configuration..."
filepath = StringProperty(
- subtype='FILE_PATH',
- default="keymap.py",
- )
+ subtype='FILE_PATH',
+ default="keymap.py",
+ )
filter_folder = BoolProperty(
- name="Filter folders",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter folders",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_text = BoolProperty(
- name="Filter text",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter text",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_python = BoolProperty(
- name="Filter python",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter python",
+ default=True,
+ options={'HIDDEN'},
+ )
keep_original = BoolProperty(
- name="Keep original",
- description="Keep original file after copying to configuration folder",
- default=True,
- )
+ name="Keep original",
+ description="Keep original file after copying to configuration folder",
+ default=True,
+ )
def execute(self, context):
import os
@@ -1606,24 +1606,24 @@ class WM_OT_keyconfig_export(Operator):
bl_label = "Export Key Configuration..."
filepath = StringProperty(
- subtype='FILE_PATH',
- default="keymap.py",
- )
+ subtype='FILE_PATH',
+ default="keymap.py",
+ )
filter_folder = BoolProperty(
- name="Filter folders",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter folders",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_text = BoolProperty(
- name="Filter text",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter text",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_python = BoolProperty(
- name="Filter python",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter python",
+ default=True,
+ options={'HIDDEN'},
+ )
def execute(self, context):
from bpy_extras import keyconfig_utils
@@ -1656,9 +1656,9 @@ class WM_OT_keymap_restore(Operator):
bl_label = "Restore Key Map(s)"
all = BoolProperty(
- name="All Keymaps",
- description="Restore all keymaps to default",
- )
+ name="All Keymaps",
+ description="Restore all keymaps to default",
+ )
def execute(self, context):
wm = context.window_manager
@@ -1679,9 +1679,9 @@ class WM_OT_keyitem_restore(Operator):
bl_label = "Restore Key Map Item"
item_id = IntProperty(
- name="Item Identifier",
- description="Identifier of the item to remove",
- )
+ name="Item Identifier",
+ description="Identifier of the item to remove",
+ )
@classmethod
def poll(cls, context):
@@ -1726,9 +1726,9 @@ class WM_OT_keyitem_remove(Operator):
bl_label = "Remove Key Map Item"
item_id = IntProperty(
- name="Item Identifier",
- description="Identifier of the item to remove",
- )
+ name="Item Identifier",
+ description="Identifier of the item to remove",
+ )
@classmethod
def poll(cls, context):
@@ -1794,9 +1794,9 @@ class WM_OT_addon_enable(Operator):
bl_label = "Enable Add-on"
module = StringProperty(
- name="Module",
- description="Module name of the add-on to enable",
- )
+ name="Module",
+ description="Module name of the add-on to enable",
+ )
def execute(self, context):
import addon_utils
@@ -1840,9 +1840,9 @@ class WM_OT_addon_disable(Operator):
bl_label = "Disable Add-on"
module = StringProperty(
- name="Module",
- description="Module name of the add-on to disable",
- )
+ name="Module",
+ description="Module name of the add-on to disable",
+ )
def execute(self, context):
import addon_utils
@@ -1869,8 +1869,8 @@ class WM_OT_owner_enable(Operator):
bl_label = "Enable Add-on"
owner_id = StringProperty(
- name="UI Tag",
- )
+ name="UI Tag",
+ )
def execute(self, context):
workspace = context.workspace
@@ -1884,8 +1884,8 @@ class WM_OT_owner_disable(Operator):
bl_label = "Disable UI Tag"
owner_id = StringProperty(
- name="UI Tag",
- )
+ name="UI Tag",
+ )
def execute(self, context):
workspace = context.workspace
@@ -1900,22 +1900,22 @@ class WM_OT_theme_install(Operator):
bl_label = "Install Theme..."
overwrite = BoolProperty(
- name="Overwrite",
- description="Remove existing theme file if exists",
- default=True,
- )
+ name="Overwrite",
+ description="Remove existing theme file if exists",
+ default=True,
+ )
filepath = StringProperty(
- subtype='FILE_PATH',
- )
+ subtype='FILE_PATH',
+ )
filter_folder = BoolProperty(
- name="Filter folders",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter folders",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_glob = StringProperty(
- default="*.xml",
- options={'HIDDEN'},
- )
+ default="*.xml",
+ options={'HIDDEN'},
+ )
def execute(self, context):
import os
@@ -1977,33 +1977,33 @@ class WM_OT_addon_install(Operator):
bl_label = "Install Add-on from File..."
overwrite = BoolProperty(
- name="Overwrite",
- description="Remove existing add-ons with the same ID",
- default=True,
- )
+ name="Overwrite",
+ description="Remove existing add-ons with the same ID",
+ default=True,
+ )
target = EnumProperty(
- name="Target Path",
- items=(('DEFAULT', "Default", ""),
- ('PREFS', "User Prefs", "")),
- )
+ name="Target Path",
+ items=(('DEFAULT', "Default", ""),
+ ('PREFS', "User Prefs", "")),
+ )
filepath = StringProperty(
- subtype='FILE_PATH',
- )
+ subtype='FILE_PATH',
+ )
filter_folder = BoolProperty(
- name="Filter folders",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter folders",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_python = BoolProperty(
- name="Filter python",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter python",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_glob = StringProperty(
- default="*.py;*.zip",
- options={'HIDDEN'},
- )
+ default="*.py;*.zip",
+ options={'HIDDEN'},
+ )
def execute(self, context):
import addon_utils
@@ -2131,9 +2131,9 @@ class WM_OT_addon_remove(Operator):
bl_label = "Remove Add-on"
module = StringProperty(
- name="Module",
- description="Module name of the add-on to remove",
- )
+ name="Module",
+ description="Module name of the add-on to remove",
+ )
@staticmethod
def path_from_addon(module):
@@ -2191,9 +2191,9 @@ class WM_OT_addon_expand(Operator):
bl_options = {'INTERNAL'}
module = StringProperty(
- name="Module",
- description="Module name of the add-on to expand",
- )
+ name="Module",
+ description="Module name of the add-on to expand",
+ )
def execute(self, context):
import addon_utils
@@ -2215,9 +2215,9 @@ class WM_OT_addon_userpref_show(Operator):
bl_options = {'INTERNAL'}
module = StringProperty(
- name="Module",
- description="Module name of the add-on to expand",
- )
+ name="Module",
+ description="Module name of the add-on to expand",
+ )
def execute(self, context):
import addon_utils
@@ -2246,23 +2246,23 @@ class WM_OT_app_template_install(Operator):
bl_label = "Install Template from File..."
overwrite = BoolProperty(
- name="Overwrite",
- description="Remove existing template with the same ID",
- default=True,
- )
+ name="Overwrite",
+ description="Remove existing template with the same ID",
+ default=True,
+ )
filepath = StringProperty(
- subtype='FILE_PATH',
- )
+ subtype='FILE_PATH',
+ )
filter_folder = BoolProperty(
- name="Filter folders",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter folders",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_glob = StringProperty(
- default="*.zip",
- options={'HIDDEN'},
- )
+ default="*.zip",
+ options={'HIDDEN'},
+ )
def execute(self, context):
import traceback
@@ -2345,16 +2345,16 @@ class WM_OT_tool_set_by_name(Operator):
bl_label = "Set Tool By Name"
name = StringProperty(
- name="Text",
- description="Display name of the tool",
- )
+ name="Text",
+ description="Display name of the tool",
+ )
cycle = BoolProperty(
- name="Cycle",
- description="Cycle through tools in this group",
- default=False,
- options={'SKIP_SAVE'},
- )
+ name="Cycle",
+ description="Cycle through tools in this group",
+ default=False,
+ options={'SKIP_SAVE'},
+ )
space_type = rna_space_type_prop
@@ -2411,21 +2411,21 @@ class WM_OT_studiolight_install(Operator):
bl_label = "Install Custom Studio Light"
files = CollectionProperty(
- name="File Path",
- type=OperatorFileListElement,
- )
+ name="File Path",
+ type=OperatorFileListElement,
+ )
directory = StringProperty(
- subtype='DIR_PATH',
- )
+ subtype='DIR_PATH',
+ )
filter_folder = BoolProperty(
- name="Filter folders",
- default=True,
- options={'HIDDEN'},
- )
+ name="Filter folders",
+ default=True,
+ options={'HIDDEN'},
+ )
filter_glob = StringProperty(
- default="*.png;*.jpg;*.hdr;*.exr",
- options={'HIDDEN'},
- )
+ default="*.png;*.jpg;*.hdr;*.exr",
+ options={'HIDDEN'},
+ )
orientation = EnumProperty(
items=(
("MATCAP", "MatCap", ""),
@@ -2456,7 +2456,7 @@ class WM_OT_studiolight_install(Operator):
for filepath in filepaths:
shutil.copy(str(filepath), str(path_studiolights))
- userpref.studio_lights_refresh()
+ userpref.studio_lights.new(str(path_studiolights.joinpath(filepath.name)), self.orientation)
# print message
msg = (
@@ -2478,34 +2478,23 @@ class WM_OT_studiolight_uninstall(Operator):
bl_label = "Uninstall Studio Light"
index = bpy.props.IntProperty()
+ def _remove_path(self, path):
+ if path.exists():
+ path.unlink()
+
def execute(self, context):
import pathlib
userpref = context.user_preferences
for studio_light in userpref.studio_lights:
if studio_light.index == self.index:
- path = pathlib.Path(studio_light.path)
- if path.exists():
- path.unlink()
- userpref.studio_lights_refresh()
- return {'FINISHED'}
+ self._remove_path(pathlib.Path(studio_light.path))
+ self._remove_path(pathlib.Path(studio_light.path_irr_cache))
+ self._remove_path(pathlib.Path(studio_light.path_sh_cache))
+ userpref.studio_lights.remove(studio_light)
+ return {'FINISHED'}
return {'CANCELLED'}
-class WM_OT_studiolight_expand(Operator):
- bl_idname = "wm.studiolight_expand"
- bl_label = "Expand Studio Light"
- index = bpy.props.IntProperty()
-
- def execute(self, context):
- userpref = context.user_preferences
- for studio_light in userpref.studio_lights:
- if studio_light.index == self.index:
- studio_light.show_expanded = not studio_light.show_expanded
- break
-
- return {'FINISHED'}
-
-
class WM_OT_studiolight_userpref_show(Operator):
"""Show light user preferences"""
bl_idname = "wm.studiolight_userpref_show"
@@ -2572,7 +2561,6 @@ classes = (
WM_OT_owner_disable,
WM_OT_owner_enable,
WM_OT_url_open,
- WM_OT_studiolight_expand,
WM_OT_studiolight_install,
WM_OT_studiolight_uninstall,
WM_OT_studiolight_userpref_show,
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 10709676b85..3b5f21d616e 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -242,7 +242,7 @@ class DATA_PT_camera_dof_aperture(CameraButtonsPanel, Panel):
cam = context.camera
dof_options = cam.gpu_dof
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
if context.engine == 'BLENDER_EEVEE':
col = flow.column()
diff --git a/release/scripts/startup/bl_ui/properties_data_lightprobe.py b/release/scripts/startup/bl_ui/properties_data_lightprobe.py
index f3ccc9f3176..10b66dd0033 100644
--- a/release/scripts/startup/bl_ui/properties_data_lightprobe.py
+++ b/release/scripts/startup/bl_ui/properties_data_lightprobe.py
@@ -155,7 +155,7 @@ class DATA_PT_lightprobe_display(DataButtonsPanel, Panel):
col = layout.column()
- if probe.type != "PLANAR":
+ if probe.type != 'PLANAR':
col.prop(probe, "data_draw_size", text="Size")
else:
col.prop(ob, "empty_draw_size", text="Arrow Size")
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 5ff9f83b1a9..e8015327c1d 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -353,19 +353,16 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
row.active = enable_edit_value
row.prop(kb, "value")
- split = layout.split()
+ layout.use_property_split = True
- col = split.column(align=True)
- col.active = enable_edit_value
- col.label(text="Range:")
- col.prop(kb, "slider_min", text="Min")
- col.prop(kb, "slider_max", text="Max")
+ col = layout.column()
+ sub.active = enable_edit_value
+ sub = col.column(align=True)
+ sub.prop(kb, "slider_min", text="Range Min")
+ sub.prop(kb, "slider_max", text="Max")
- col = split.column(align=True)
- col.active = enable_edit_value
- col.label(text="Blend:")
- col.prop_search(kb, "vertex_group", ob, "vertex_groups", text="")
- col.prop_search(kb, "relative_key", key, "key_blocks", text="")
+ col.prop_search(kb, "vertex_group", ob, "vertex_groups", text="Vertex Group")
+ col.prop_search(kb, "relative_key", key, "key_blocks", text="Relative To")
else:
layout.prop(kb, "interpolation")
@@ -419,6 +416,7 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
obj = context.object
me = context.mesh
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index b79e594095d..29098bdde4e 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1000,7 +1000,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
render = max(scene.cycles.dicing_rate * ob.cycles.dicing_rate, 0.1)
preview = max(scene.cycles.preview_dicing_rate * ob.cycles.dicing_rate, 0.1)
- col.label("Render %.2f px, Preview %.2f px" % (render, preview))
+ col.label(f"Render {render:10.2f} px, Preview {preview:10.2f} px")
def SURFACE(self, layout, ob, md):
layout.label(text="Settings are inside the Physics tab")
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
index 2b298c560c7..fdbf0b240c4 100644
--- a/release/scripts/startup/bl_ui/properties_material.py
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -198,14 +198,14 @@ class EEVEE_MATERIAL_PT_options(MaterialButtonsPanel, Panel):
layout.prop(mat, "blend_method")
- if mat.blend_method != "OPAQUE":
+ if mat.blend_method != 'OPAQUE':
layout.prop(mat, "transparent_shadow_method")
row = layout.row()
- row.active = ((mat.blend_method == "CLIP") or (mat.transparent_shadow_method == "CLIP"))
+ row.active = ((mat.blend_method == 'CLIP') or (mat.transparent_shadow_method == 'CLIP'))
row.prop(mat, "alpha_threshold")
- if mat.blend_method not in {"OPAQUE", "CLIP", "HASHED"}:
+ if mat.blend_method not in {'OPAQUE', 'CLIP', 'HASHED'}:
layout.prop(mat, "show_transparent_backside")
layout.prop(mat, "use_screen_refraction")
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index ea05a639125..63b708ae059 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -50,7 +50,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel):
layout = self.layout
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
ob = context.object
@@ -95,7 +95,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel):
row = layout.row(align=True)
row.prop(ob, "rotation_mode")
- row.label(text="", icon="BLANK1")
+ row.label(text="", icon='BLANK1')
class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel):
@@ -106,7 +106,7 @@ class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=True, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=True, align=False)
ob = context.object
@@ -136,7 +136,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
ob = context.object
@@ -222,7 +222,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
obj = context.object
obj_type = obj.type
@@ -285,7 +285,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
row.prop(ob, "dupli_type", expand=True)
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
if ob.dupli_type == 'FRAMES':
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 8b4104a6c04..05538e71faf 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -500,6 +500,7 @@ class PARTICLE_PT_cache(ParticleButtonsPanel, Panel):
class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel):
bl_label = "Velocity"
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
@classmethod
@@ -626,6 +627,7 @@ class PARTICLE_PT_rotation_angular_velocity(ParticleButtonsPanel, Panel):
class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
bl_label = "Physics"
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
@classmethod
@@ -1012,6 +1014,7 @@ class PARTICLE_PT_boidbrain(ParticleButtonsPanel, Panel):
class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
bl_label = "Render"
+ bl_options = {'DEFAULT_CLOSED'}
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
@classmethod
@@ -1272,6 +1275,8 @@ class PARTICLE_PT_render_collection_use_count(ParticleButtonsPanel, Panel):
subsub.operator("particle.dupliob_remove", icon='ZOOMOUT', text="")
subsub.operator("particle.dupliob_move_up", icon='TRIA_UP', text="")
subsub.operator("particle.dupliob_move_down", icon='TRIA_DOWN', text="")
+ subsub.separator()
+ subsub.operator("particle.dupliob_refresh", icon='FILE_REFRESH', text="")
weight = part.active_dupliweight
if weight:
@@ -1710,30 +1715,74 @@ class PARTICLE_PT_force_fields(ParticleButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
part = particle_get_settings(context)
- row = layout.row()
- row.prop(part, "use_self_effect")
- row.prop(part, "effector_amount", text="Amount")
+ col = layout.column()
+ col.prop(part, "use_self_effect")
+ col.prop(part, "effector_amount", text="Effector Amount")
+
+
+class PARTICLE_PT_force_fields_type1(ParticleButtonsPanel, Panel):
+ bl_label = "Type 1"
+ bl_parent_id = "PARTICLE_PT_force_fields"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
- split = layout.split(percentage=0.2)
- split.label(text="Type 1:")
- split.prop(part.force_field_1, "type", text="")
+ part = particle_get_settings(context)
+
+ col = layout.column()
+ col.prop(part.force_field_1, "type", text="Type 1")
basic_force_field_settings_ui(self, context, part.force_field_1)
- if part.force_field_1.type != 'NONE':
- layout.label(text="Falloff:")
- basic_force_field_falloff_ui(self, context, part.force_field_1)
- if part.force_field_1.type != 'NONE':
- layout.label(text="")
- split = layout.split(percentage=0.2)
- split.label(text="Type 2:")
- split.prop(part.force_field_2, "type", text="")
+class PARTICLE_PT_force_fields_type2(ParticleButtonsPanel, Panel):
+ bl_label = "Type 2"
+ bl_parent_id = "PARTICLE_PT_force_fields"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+
+ part = particle_get_settings(context)
+
+ col = layout.column()
+ col.prop(part.force_field_2, "type", text="Type 2")
basic_force_field_settings_ui(self, context, part.force_field_2)
- if part.force_field_2.type != 'NONE':
- layout.label(text="Falloff:")
+
+
+class PARTICLE_PT_force_fields_type1_falloff(ParticleButtonsPanel, Panel):
+ bl_label = "Falloff"
+ bl_options = {'DEFAULT_CLOSED'}
+ bl_parent_id = "PARTICLE_PT_force_fields_type1"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+
+ part = particle_get_settings(context)
+
+ basic_force_field_falloff_ui(self, context, part.force_field_1)
+
+
+class PARTICLE_PT_force_fields_type2_falloff(ParticleButtonsPanel, Panel):
+ bl_label = "Falloff"
+ bl_options = {'DEFAULT_CLOSED'}
+ bl_parent_id = "PARTICLE_PT_force_fields_type2"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+
+ part = particle_get_settings(context)
+
basic_force_field_falloff_ui(self, context, part.force_field_2)
@@ -1916,6 +1965,10 @@ classes = (
PARTICLE_PT_hair_shape,
PARTICLE_PT_field_weights,
PARTICLE_PT_force_fields,
+ PARTICLE_PT_force_fields_type1,
+ PARTICLE_PT_force_fields_type1_falloff,
+ PARTICLE_PT_force_fields_type2,
+ PARTICLE_PT_force_fields_type2_falloff,
PARTICLE_PT_vertexgroups,
PARTICLE_PT_textures,
PARTICLE_PT_custom_props,
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index b26fbb9e906..e071de0108b 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -139,14 +139,16 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
layout.enabled = False
if not cache.use_external or cachetype == 'SMOKE':
- row = layout.row(align=True)
+ col = layout.column(align=True)
+ col.use_property_split = True
if cachetype not in {'PSYS', 'DYNAMIC_PAINT'}:
- row.enabled = enabled
- row.prop(cache, "frame_start")
- row.prop(cache, "frame_end")
+
+ col.enabled = enabled
+ col.prop(cache, "frame_start", text="Simulation Start")
+ col.prop(cache, "frame_end")
if cachetype not in {'SMOKE', 'CLOTH', 'DYNAMIC_PAINT', 'RIGID_BODY'}:
- row.prop(cache, "frame_step")
+ col.prop(cache, "frame_step")
if cachetype != 'SMOKE':
layout.label(text=cache.info)
@@ -206,9 +208,12 @@ def point_cache_ui(self, context, cache, enabled, cachetype):
def effector_weights_ui(self, context, weights, weight_type):
layout = self.layout
+ layout.use_property_split = True
layout.prop(weights, "group")
+ layout.use_property_split = False
+
split = layout.split()
split.prop(weights, "gravity", slider=True)
@@ -239,6 +244,7 @@ def effector_weights_ui(self, context, weights, weight_type):
def basic_force_field_settings_ui(self, context, field):
layout = self.layout
+ layout.use_property_split = True
if not field or field.type == 'NONE':
return
@@ -274,11 +280,8 @@ def basic_force_field_settings_ui(self, context, field):
if field.type == 'FORCE':
col.prop(field, "use_gravity_falloff", text="Gravitation")
- col.label(text="Effect point")
- col.prop(field, "apply_to_location")
- col.prop(field, "apply_to_rotation")
-
- col.label(text="Collision")
+ col.prop(field, "apply_to_location", text="Affect Location")
+ col.prop(field, "apply_to_rotation", text="Affect Rotation")
col.prop(field, "use_absorption")
@@ -293,15 +296,17 @@ def basic_force_field_falloff_ui(self, context, field):
col.prop(field, "falloff_power", text="Power")
- col.prop(field, "use_min_distance", text="Min Min Distance")
- sub = col.column(align=True)
+ split = layout.split()
+ split.prop(field, "use_min_distance", text="Min Distance")
+ sub = split.column(align=True)
sub.active = field.use_min_distance
- sub.prop(field, "distance_min", text="Min Distance")
+ sub.prop(field, "distance_min", text="")
- col.prop(field, "use_max_distance", text="Use Max Distance")
- sub = col.column(align=True)
+ split = layout.split()
+ split.prop(field, "use_max_distance", text="Max Distance")
+ sub = split.column(align=True)
sub.active = field.use_max_distance
- sub.prop(field, "distance_max", text="Max Distance")
+ sub.prop(field, "distance_max", text="")
classes = (
diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py
index 72b5d9f1574..3b01015047f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_field.py
+++ b/release/scripts/startup/bl_ui/properties_physics_field.py
@@ -43,6 +43,8 @@ class PHYSICS_PT_field(PhysicButtonsPanel, Panel):
@classmethod
def poll(cls, context):
ob = context.object
+ if not ob:
+ return False
return (context.engine in cls.COMPAT_ENGINES) and (ob.field) and (ob.field.type != 'NONE')
def draw(self, context):
@@ -210,7 +212,7 @@ class PHYSICS_PT_collision_particle(PhysicButtonsPanel, Panel):
md = context.collision
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
coll = md.settings
@@ -250,7 +252,7 @@ class PHYSICS_PT_collision_softbody(PhysicButtonsPanel, Panel):
layout = self.layout
layout.use_property_split = True
- flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False)
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
md = context.collision
coll = md.settings
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
index 40cd0e20769..580c31465b3 100644
--- a/release/scripts/startup/bl_ui/properties_render.py
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -104,10 +104,10 @@ class RENDER_PT_dimensions(RenderButtonsPanel, Panel):
custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
if custom_framerate is True:
- fps_label_text = "Custom (%r fps)" % fps_rate
+ fps_label_text = f"Custom ({fps_rate!r} fps)"
show_framerate = True
else:
- fps_label_text = "%r fps" % fps_rate
+ fps_label_text = f"{fps_rate!r} fps"
show_framerate = (preset_label == "Custom")
RENDER_PT_dimensions._frame_rate_args_prev = args
@@ -205,7 +205,8 @@ class RENDER_PT_stamp(RenderButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
- layout.use_property_split = False
+ layout.use_property_split = True
+ layout.use_property_decorate = False # No animation.
rd = context.scene.render
@@ -671,8 +672,8 @@ class RENDER_PT_eevee_shadows(RenderButtonsPanel, Panel):
col = layout.column()
col.prop(props, "shadow_method")
- col.prop(props, "shadow_cube_size")
- col.prop(props, "shadow_cascade_size")
+ col.prop(props, "shadow_cube_size", text="Cube Size")
+ col.prop(props, "shadow_cascade_size", text="Cascade Size")
col.prop(props, "use_shadow_high_bitdepth")
@@ -718,7 +719,7 @@ class RENDER_PT_eevee_indirect_lighting(RenderButtonsPanel, Panel):
col = layout.column()
col.prop(props, "gi_diffuse_bounces")
col.prop(props, "gi_cubemap_resolution")
- col.prop(props, "gi_visibility_resolution")
+ col.prop(props, "gi_visibility_resolution", text="Diffuse Occlusion")
class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index a4991ef5718..1394a9388d0 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -273,7 +273,7 @@ class SCENE_PT_color_management(SceneButtonsPanel, Panel):
col.separator()
- col.prop(scene.sequencer_colorspace_settings, "name", text="Sequencer Color Space")
+ col.prop(scene.sequencer_colorspace_settings, "name", text="Sequencer")
class SCENE_PT_color_management_curves(SceneButtonsPanel, Panel):
@@ -369,6 +369,7 @@ class SCENE_PT_rigid_body_world(SceneButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
scene = context.scene
@@ -386,13 +387,11 @@ class SCENE_PT_rigid_body_world(SceneButtonsPanel, Panel):
col.prop(rbw, "group")
col.prop(rbw, "constraints")
- split = col.split()
-
- col = split.column()
+ col = col.column()
col.prop(rbw, "time_scale", text="Speed")
col.prop(rbw, "use_split_impulse")
- col = split.column()
+ col = col.column()
col.prop(rbw, "steps_per_second", text="Steps Per Second")
col.prop(rbw, "solver_iterations", text="Solver Iterations")
@@ -444,6 +443,15 @@ class SCENE_PT_simplify(SceneButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+
+
+class SCENE_PT_simplify_viewport(SceneButtonsPanel, Panel):
+ bl_label = "Viewport"
+ bl_parent_id = "SCENE_PT_simplify"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
+
+ def draw(self, context):
+ layout = self.layout
layout.use_property_split = True
rd = context.scene.render
@@ -451,13 +459,25 @@ class SCENE_PT_simplify(SceneButtonsPanel, Panel):
layout.active = rd.use_simplify
col = layout.column()
- col.prop(rd, "simplify_subdivision", text="Max Viewport Subdivision")
+ col.prop(rd, "simplify_subdivision", text="Max Subdivision")
col.prop(rd, "simplify_child_particles", text="Max Child Particles")
- col.separator()
+
+class SCENE_PT_simplify_render(SceneButtonsPanel, Panel):
+ bl_label = "Render"
+ bl_parent_id = "SCENE_PT_simplify"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE'}
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+
+ rd = context.scene.render
+
+ layout.active = rd.use_simplify
col = layout.column()
- col.prop(rd, "simplify_subdivision_render", text="Max Render Subdivision")
+ col.prop(rd, "simplify_subdivision_render", text="Max Subdivision")
col.prop(rd, "simplify_child_particles_render", text="Max Child Particles")
@@ -519,6 +539,8 @@ classes = (
SCENE_PT_rigid_body_cache,
SCENE_PT_rigid_body_field_weights,
SCENE_PT_simplify,
+ SCENE_PT_simplify_viewport,
+ SCENE_PT_simplify_render,
SCENE_PT_custom_props,
)
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
index e5bf2c910a0..16e29d1ecc8 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -211,30 +211,25 @@ class TEXTURE_PT_colors(TextureButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
tex = context.texture
- layout.prop(tex, "use_color_ramp", text="Ramp")
- if tex.use_color_ramp:
- layout.template_color_ramp(tex, "color_ramp", expand=True)
-
- split = layout.split()
-
- col = split.column()
- col.label(text="RGB Multiply:")
+ col = layout.column()
sub = col.column(align=True)
- sub.prop(tex, "factor_red", text="R")
+ sub.prop(tex, "factor_red", text="Multiply R")
sub.prop(tex, "factor_green", text="G")
sub.prop(tex, "factor_blue", text="B")
- col = split.column()
- col.label(text="Adjust:")
col.prop(tex, "intensity")
col.prop(tex, "contrast")
col.prop(tex, "saturation")
- col = layout.column()
col.prop(tex, "use_clamp", text="Clamp")
+ col.prop(tex, "use_color_ramp", text="Ramp")
+ if tex.use_color_ramp:
+ layout.use_property_split = False
+ layout.template_color_ramp(tex, "color_ramp", expand=True)
class TextureTypePanel(TextureButtonsPanel):
diff --git a/release/scripts/startup/bl_ui/properties_view_layer.py b/release/scripts/startup/bl_ui/properties_view_layer.py
index 3fc003ac86e..05dc15216a2 100644
--- a/release/scripts/startup/bl_ui/properties_view_layer.py
+++ b/release/scripts/startup/bl_ui/properties_view_layer.py
@@ -38,6 +38,7 @@ class VIEWLAYER_PT_layer(ViewLayerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
scene = context.scene
rd = scene.render
@@ -54,26 +55,20 @@ class VIEWLAYER_PT_eevee_layer_passes(ViewLayerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
scene = context.scene
rd = scene.render
view_layer = context.view_layer
- split = layout.split()
-
- col = split.column()
+ col = layout.column()
col.prop(view_layer, "use_pass_combined")
col.prop(view_layer, "use_pass_z")
col.prop(view_layer, "use_pass_mist")
col.prop(view_layer, "use_pass_normal")
- col.separator()
col.prop(view_layer, "use_pass_ambient_occlusion")
-
- col = split.column()
- col.label(text="Subsurface:")
- row = col.row(align=True)
- row.prop(view_layer, "use_pass_subsurface_direct", text="Direct", toggle=True)
- row.prop(view_layer, "use_pass_subsurface_color", text="Color", toggle=True)
+ col.prop(view_layer, "use_pass_subsurface_direct", text="Subsurface Direct")
+ col.prop(view_layer, "use_pass_subsurface_color", text="Subsurface Color")
classes = (
diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py
index 1ec2d4774e8..bba7f9e132a 100644
--- a/release/scripts/startup/bl_ui/properties_world.py
+++ b/release/scripts/startup/bl_ui/properties_world.py
@@ -74,13 +74,12 @@ class EEVEE_WORLD_PT_mist(WorldButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
world = context.world
- split = layout.split(align=True)
- split.prop(world.mist_settings, "start")
- split.prop(world.mist_settings, "depth")
-
+ layout.prop(world.mist_settings, "start")
+ layout.prop(world.mist_settings, "depth")
layout.prop(world.mist_settings, "falloff")
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index d4ae3121a88..23c3e97ac9a 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -58,17 +58,19 @@ class CLIP_HT_header(Header):
sc = context.space_data
clip = sc.clip
+ CLIP_MT_tracking_editor_menus.draw_collapsible(context, layout)
+
+ layout.separator_spacer()
+
row = layout.row()
row.template_ID(sc, "clip", open="clip.open")
- CLIP_MT_tracking_editor_menus.draw_collapsible(context, layout)
+ layout.separator_spacer()
if clip:
tracking = clip.tracking
active_object = tracking.objects.active
- layout.separator_spacer()
-
if sc.view == 'CLIP':
layout.prop(sc, "pivot_point", text="", icon_only=True)
@@ -118,9 +120,13 @@ class CLIP_HT_header(Header):
CLIP_MT_masking_editor_menus.draw_collapsible(context, layout)
+ layout.separator_spacer()
+
row = layout.row()
row.template_ID(sc, "clip", open="clip.open")
+ layout.separator_spacer()
+
if clip:
row = layout.row()
row.template_ID(sc, "mask", new="mask.new")
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index a238e81d868..e03d53a1870 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -19,12 +19,12 @@
# <pep8 compliant>
import bpy
-from bpy.types import Header, Menu
+from bpy.types import Header, Menu, Panel
from .space_time import *
#######################################
-# DopeSheet Filtering
+# DopeSheet Filtering - Header Buttons
# used for DopeSheet, NLA, and Graph Editors
def dopesheet_filter(layout, context, genericFiltersOnly=False):
@@ -43,66 +43,151 @@ def dopesheet_filter(layout, context, genericFiltersOnly=False):
if not genericFiltersOnly:
if bpy.data.collections:
row = layout.row(align=True)
- row.prop(dopesheet, "show_only_collection_objects", text="")
- if dopesheet.show_only_collection_objects:
- row.prop(dopesheet, "filter_collection", text="")
+ row.prop(dopesheet, "filter_collection", text="")
if not is_nla:
row = layout.row(align=True)
- row.prop(dopesheet, "show_only_matching_fcurves", text="")
- if dopesheet.show_only_matching_fcurves:
- row.prop(dopesheet, "filter_fcurve_name", text="")
- row.prop(dopesheet, "use_multi_word_filter", text="")
+ row.prop(dopesheet, "filter_fcurve_name", text="")
else:
row = layout.row(align=True)
- row.prop(dopesheet, "use_filter_text", text="")
- if dopesheet.use_filter_text:
+ row.prop(dopesheet, "filter_text", text="")
+
+#######################################
+# Dopesheet Filtering Popovers
+
+# Generic Layout - Used as base for filtering popovers used in all animation editors
+# Used for DopeSheet, NLA, and Graph Editors
+
+
+class DopesheetFilterPopoverBase:
+ bl_region_type = 'HEADER'
+ bl_label = "Filters"
+
+ # Generic = Affects all datatypes
+ # XXX: Perhaps we want these to stay in the header instead, for easy/fast access
+ @classmethod
+ def draw_generic_filters(cls, context, layout):
+ dopesheet = context.space_data.dopesheet
+ is_nla = context.area.type == 'NLA_EDITOR'
+
+ col = layout.column(align=True)
+ col.prop(dopesheet, "show_only_selected", icon='NONE')
+ col.prop(dopesheet, "show_hidden", icon='NONE')
+
+ if is_nla:
+ col.prop(dopesheet, "show_missing_nla", icon='NONE')
+ else: # graph and dopesheet editors - F-Curves and drivers only
+ col.prop(dopesheet, "show_only_errors", icon='NONE')
+
+ # Name/Membership Filters
+ # XXX: Perhaps these should just stay in the headers (exclusively)?
+ @classmethod
+ def draw_search_filters(cls, context, layout, generic_filters_only=False):
+ dopesheet = context.space_data.dopesheet
+ is_nla = context.area.type == 'NLA_EDITOR'
+
+ col = layout.column(align=True)
+ col.label("With Name:")
+ if not is_nla:
+ row = col.row(align=True)
+ row.prop(dopesheet, "filter_fcurve_name", text="")
+ else:
+ row = col.row(align=True)
row.prop(dopesheet, "filter_text", text="")
- row.prop(dopesheet, "use_multi_word_filter", text="")
- if not genericFiltersOnly:
- row = layout.row(align=True)
- row.prop(dopesheet, "show_datablock_filters", text="Filters")
-
- if dopesheet.show_datablock_filters:
- row.prop(dopesheet, "show_scenes", text="")
- row.prop(dopesheet, "show_worlds", text="")
- row.prop(dopesheet, "show_nodes", text="")
-
- row.prop(dopesheet, "show_transforms", text="")
-
- if bpy.data.meshes:
- row.prop(dopesheet, "show_meshes", text="")
- if bpy.data.shape_keys:
- row.prop(dopesheet, "show_shapekeys", text="")
- if bpy.data.meshes:
- row.prop(dopesheet, "show_modifiers", text="")
- if bpy.data.materials:
- row.prop(dopesheet, "show_materials", text="")
- if bpy.data.lamps:
- row.prop(dopesheet, "show_lamps", text="")
- if bpy.data.textures:
- row.prop(dopesheet, "show_textures", text="")
- if bpy.data.cameras:
- row.prop(dopesheet, "show_cameras", text="")
- if bpy.data.curves:
- row.prop(dopesheet, "show_curves", text="")
- if bpy.data.metaballs:
- row.prop(dopesheet, "show_metaballs", text="")
- if bpy.data.lattices:
- row.prop(dopesheet, "show_lattices", text="")
- if bpy.data.armatures:
- row.prop(dopesheet, "show_armatures", text="")
- if bpy.data.particles:
- row.prop(dopesheet, "show_particles", text="")
- if bpy.data.speakers:
- row.prop(dopesheet, "show_speakers", text="")
- if bpy.data.linestyles:
- row.prop(dopesheet, "show_linestyles", text="")
- if bpy.data.grease_pencil:
- row.prop(dopesheet, "show_gpencil", text="")
-
- layout.prop(dopesheet, "use_datablock_sort", text="")
+ if (not generic_filters_only) and (bpy.data.collections):
+ col = layout.column(align=True)
+ col.label("In Collection:")
+ col.prop(dopesheet, "filter_collection", text="")
+
+ # Standard = Present in all panels
+ @classmethod
+ def draw_standard_filters(cls, context, layout):
+ dopesheet = context.space_data.dopesheet
+
+ # Object Data Filters
+ layout.label("Include Sub-Object Data:")
+ split = layout.split()
+
+ # TODO: Add per-channel/axis convenience toggles?
+ col = split.column()
+ col.prop(dopesheet, "show_transforms", text="Transforms")
+
+ col = split.column()
+ col.prop(dopesheet, "show_modifiers", text="Modifiers")
+
+ layout.separator()
+
+ # datablock filters
+ layout.label("Include From Types:")
+ flow = layout.grid_flow(row_major=True, columns=2, even_rows=False, align=False)
+
+ flow.prop(dopesheet, "show_scenes", text="Scenes")
+ flow.prop(dopesheet, "show_worlds", text="Worlds")
+ flow.prop(dopesheet, "show_nodes", text="Node Trees")
+
+ if bpy.data.armatures:
+ flow.prop(dopesheet, "show_armatures", text="Armatures")
+ if bpy.data.cameras:
+ flow.prop(dopesheet, "show_cameras", text="Cameras")
+ if bpy.data.grease_pencil:
+ flow.prop(dopesheet, "show_gpencil", text="Grease Pencil Objects")
+ if bpy.data.lamps:
+ flow.prop(dopesheet, "show_lamps", text="Lamps")
+ if bpy.data.materials:
+ flow.prop(dopesheet, "show_materials", text="Materials")
+ if bpy.data.textures:
+ flow.prop(dopesheet, "show_textures", text="Textures")
+ if bpy.data.meshes:
+ flow.prop(dopesheet, "show_meshes", text="Meshes")
+ if bpy.data.shape_keys:
+ flow.prop(dopesheet, "show_shapekeys", text="Shape Keys")
+ if bpy.data.curves:
+ flow.prop(dopesheet, "show_curves", text="Curves")
+ if bpy.data.particles:
+ flow.prop(dopesheet, "show_particles", text="Particles")
+ if bpy.data.lattices:
+ flow.prop(dopesheet, "show_lattices", text="Lattices")
+ if bpy.data.linestyles:
+ flow.prop(dopesheet, "show_linestyles", text="Line Styles")
+ if bpy.data.metaballs:
+ flow.prop(dopesheet, "show_metaballs", text="Metas")
+ if bpy.data.speakers:
+ flow.prop(dopesheet, "show_speakers", text="Speakers")
+
+ layout.separator()
+
+ # performance-related options (users will mostly have these enabled)
+ col = layout.column(align=True)
+ col.label("Options:")
+ col.prop(dopesheet, "use_datablock_sort", icon='NONE')
+
+
+# Popover for Dopesheet Editor(s) - Dopesheet, Action, Shapekey, GPencil, Mask, etc.
+class DOPESHEET_PT_filters(DopesheetFilterPopoverBase, Panel):
+ bl_space_type = 'DOPESHEET_EDITOR'
+ bl_region_type = 'HEADER'
+ bl_label = "Filters"
+
+ def draw(self, context):
+ layout = self.layout
+
+ dopesheet = context.space_data.dopesheet
+ ds_mode = context.space_data.mode
+
+ layout.prop(dopesheet, "show_summary", text="Summary")
+
+ DopesheetFilterPopoverBase.draw_generic_filters(context, layout)
+
+ if ds_mode in {'DOPESHEET', 'ACTION', 'GPENCIL'}:
+ layout.separator()
+ generic_filters_only = ds_mode != 'DOPESHEET'
+ DopesheetFilterPopoverBase.draw_search_filters(context, layout,
+ generic_filters_only=generic_filters_only)
+
+ if ds_mode == 'DOPESHEET':
+ layout.separator()
+ DopesheetFilterPopoverBase.draw_standard_filters(context, layout)
#######################################
@@ -119,19 +204,17 @@ class DOPESHEET_HT_header(Header):
row = layout.row(align=True)
row.template_header()
- # XXX: perhaps our mode menu can be retired eventually when we get editor submodes in the main menu?
- layout.prop(st, "mode", text="")
-
if st.mode == 'TIMELINE':
TIME_MT_editor_menus.draw_collapsible(context, layout)
TIME_HT_editor_buttons.draw_header(context, layout)
else:
+ layout.prop(st, "ui_mode", text="")
+
DOPESHEET_MT_editor_menus.draw_collapsible(context, layout)
DOPESHEET_HT_editor_buttons.draw_header(context, layout)
# Header for "normal" dopesheet editor modes (e.g. Dope Sheet, Action, Shape Keys, etc.)
-# XXX: Temporary, until we have editor submodes in the actual editors menu
class DOPESHEET_HT_editor_buttons(Header):
bl_idname = "DOPESHEET_HT_editor_buttons"
bl_space_type = 'DOPESHEET_EDITOR'
@@ -146,17 +229,20 @@ class DOPESHEET_HT_editor_buttons(Header):
toolsettings = context.tool_settings
if st.mode in {'ACTION', 'SHAPEKEY'}:
+ # TODO: These buttons need some tidying up - Probably by using a popover, and bypassing the template_id() here
row = layout.row(align=True)
row.operator("action.layer_prev", text="", icon='TRIA_DOWN')
row.operator("action.layer_next", text="", icon='TRIA_UP')
- layout.template_ID(st, "action", new="action.new", unlink="action.unlink")
-
row = layout.row(align=True)
row.operator("action.push_down", text="Push Down", icon='NLA_PUSHDOWN')
row.operator("action.stash", text="Stash", icon='FREEZE')
- layout.prop(st.dopesheet, "show_summary", text="Summary")
+ layout.separator_spacer()
+
+ layout.template_ID(st, "action", new="action.new", unlink="action.unlink")
+
+ layout.separator_spacer()
if st.mode == 'DOPESHEET':
dopesheet_filter(layout, context)
@@ -174,12 +260,19 @@ class DOPESHEET_HT_editor_buttons(Header):
row.prop(st.dopesheet, "show_hidden", text="")
row = layout.row(align=True)
- row.prop(st.dopesheet, "use_filter_text", text="")
- if st.dopesheet.use_filter_text:
- row.prop(st.dopesheet, "filter_text", text="")
- row.prop(st.dopesheet, "use_multi_word_filter", text="")
+ row.prop(st.dopesheet, "filter_text", text="")
- layout.separator_spacer()
+ layout.popover(
+ space_type='DOPESHEET_EDITOR',
+ region_type='HEADER',
+ panel_type="DOPESHEET_PT_filters",
+ text="",
+ icon='FILTER',
+ )
+
+ # Grease Pencil mode doesn't need snapping, as it's frame-aligned only
+ if st.mode != 'GPENCIL':
+ layout.prop(st, "auto_snap", text="")
row = layout.row(align=True)
row.prop(toolsettings, "use_proportional_action", text="", icon_only=True)
@@ -187,9 +280,6 @@ class DOPESHEET_HT_editor_buttons(Header):
sub.active = toolsettings.use_proportional_action
sub.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
- # Grease Pencil mode doesn't need snapping, as it's frame-aligned only
- if st.mode != 'GPENCIL':
- layout.prop(st, "auto_snap", text="")
row = layout.row(align=True)
row.operator("action.copy", text="", icon='COPYDOWN')
@@ -235,6 +325,10 @@ class DOPESHEET_MT_view(Menu):
layout.operator("action.properties", icon='MENU_PANEL')
layout.separator()
+ layout.prop(st.dopesheet, "use_multi_word_filter", text="Multi-word Match Search")
+
+ layout.separator()
+
layout.prop(st, "use_realtime_update")
layout.prop(st, "show_frame_indicator")
layout.prop(st, "show_sliders")
@@ -545,6 +639,7 @@ classes = (
DOPESHEET_MT_delete,
DOPESHEET_MT_specials,
DOPESHEET_MT_channel_specials,
+ DOPESHEET_PT_filters,
)
if __name__ == "__main__": # only for live edit.
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
index 2d45d11b423..9d903829bbb 100644
--- a/release/scripts/startup/bl_ui/space_filebrowser.py
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -18,7 +18,7 @@
# <pep8 compliant>
import bpy
-from bpy.types import Header, Panel, Menu
+from bpy.types import Header, Panel, Menu, UIList
class FILEBROWSER_HT_header(Header):
@@ -33,8 +33,7 @@ class FILEBROWSER_HT_header(Header):
if st.active_operator is None:
layout.template_header()
- row = layout.row()
- row.separator()
+ layout.menu("FILEBROWSER_MT_view")
row = layout.row(align=True)
row.operator("file.previous", text="", icon='BACK')
@@ -42,10 +41,8 @@ class FILEBROWSER_HT_header(Header):
row.operator("file.parent", text="", icon='FILE_PARENT')
row.operator("file.refresh", text="", icon='FILE_REFRESH')
- layout.separator()
layout.operator_context = 'EXEC_DEFAULT'
layout.operator("file.directory_new", icon='NEWFOLDER', text="")
- layout.separator()
layout.operator_context = 'INVOKE_DEFAULT'
@@ -53,20 +50,17 @@ class FILEBROWSER_HT_header(Header):
if params:
is_lib_browser = params.use_library_browsing
- layout.prop(params, "recursion_level", text="")
-
layout.prop(params, "display_type", expand=True, text="")
-
- layout.prop(params, "display_size", text="")
-
layout.prop(params, "sort_method", expand=True, text="")
-
layout.prop(params, "show_hidden", text="", icon='FILE_HIDDEN')
+
+ layout.separator_spacer()
+
+ if params:
layout.prop(params, "use_filter", text="", icon='FILTER')
row = layout.row(align=True)
row.active = params.use_filter
-
row.prop(params, "use_filter_folder", text="")
if params.filter_glob:
@@ -95,7 +89,7 @@ class FILEBROWSER_HT_header(Header):
layout.template_running_jobs()
-class FILEBROWSER_UL_dir(bpy.types.UIList):
+class FILEBROWSER_UL_dir(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
direntry = item
# space = context.space_data
@@ -248,6 +242,22 @@ class FILEBROWSER_PT_advanced_filter(Panel):
col.prop(params, "filter_id")
+class FILEBROWSER_MT_view(Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+ st = context.space_data
+ params = st.params
+
+ layout.prop_menu_enum(params, "display_size")
+ layout.prop_menu_enum(params, "recursion_level")
+
+ layout.separator()
+
+ layout.menu("INFO_MT_area")
+
+
classes = (
FILEBROWSER_HT_header,
FILEBROWSER_UL_dir,
@@ -257,6 +267,7 @@ classes = (
FILEBROWSER_PT_bookmarks,
FILEBROWSER_PT_recent_folders,
FILEBROWSER_PT_advanced_filter,
+ FILEBROWSER_MT_view,
)
if __name__ == "__main__": # only for live edit.
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index e655f9d5d15..0a6077e6b57 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -19,15 +19,17 @@
# <pep8 compliant>
import bpy
-from bpy.types import Header, Menu
+from bpy.types import Header, Menu, Panel
+from .space_dopesheet import (
+ DopesheetFilterPopoverBase,
+ dopesheet_filter,
+)
class GRAPH_HT_header(Header):
bl_space_type = 'GRAPH_EDITOR'
def draw(self, context):
- from .space_dopesheet import dopesheet_filter
-
layout = self.layout
toolsettings = context.tool_settings
@@ -36,12 +38,11 @@ class GRAPH_HT_header(Header):
row = layout.row(align=True)
row.template_header()
- layout.prop(st, "mode", text="")
+ # Now a exposed as a sub-space type
+ # layout.prop(st, "mode", text="")
GRAPH_MT_editor_menus.draw_collapsible(context, layout)
- dopesheet_filter(layout, context)
-
row = layout.row(align=True)
row.prop(st, "use_normalization", icon='NORMALIZE_FCURVES', text="Normalize", toggle=True)
sub = row.row(align=True)
@@ -50,13 +51,30 @@ class GRAPH_HT_header(Header):
layout.separator_spacer()
+ dopesheet_filter(layout, context)
+
+ row = layout.row(align=True)
+ if st.has_ghost_curves:
+ row.operator("graph.ghost_curves_clear", text="", icon='GHOST_DISABLED')
+ else:
+ row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED')
+
+ layout.popover(
+ space_type='GRAPH_EDITOR',
+ region_type='HEADER',
+ panel_type="GRAPH_PT_filters",
+ text="",
+ icon='FILTER',
+ )
+
+ layout.prop(st, "auto_snap", text="")
+
row = layout.row(align=True)
row.prop(toolsettings, "use_proportional_fcurve", text="", icon_only=True)
sub = row.row(align=True)
sub.active = toolsettings.use_proportional_fcurve
sub.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
- layout.prop(st, "auto_snap", text="")
layout.prop(st, "pivot_point", icon_only=True)
row = layout.row(align=True)
@@ -64,11 +82,20 @@ class GRAPH_HT_header(Header):
row.operator("graph.paste", text="", icon='PASTEDOWN')
row.operator("graph.paste", text="", icon='PASTEFLIPDOWN').flipped = True
- row = layout.row(align=True)
- if st.has_ghost_curves:
- row.operator("graph.ghost_curves_clear", text="", icon='GHOST_DISABLED')
- else:
- row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED')
+
+class GRAPH_PT_filters(DopesheetFilterPopoverBase, Panel):
+ bl_space_type = 'GRAPH_EDITOR'
+ bl_region_type = 'HEADER'
+ bl_label = "Filters"
+
+ def draw(self, context):
+ layout = self.layout
+
+ DopesheetFilterPopoverBase.draw_generic_filters(context, layout)
+ layout.separator()
+ DopesheetFilterPopoverBase.draw_search_filters(context, layout)
+ layout.separator()
+ DopesheetFilterPopoverBase.draw_standard_filters(context, layout)
class GRAPH_MT_editor_menus(Menu):
@@ -381,6 +408,7 @@ classes = (
GRAPH_MT_delete,
GRAPH_MT_specials,
GRAPH_MT_channel_specials,
+ GRAPH_PT_filters,
)
if __name__ == "__main__": # only for live edit.
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 1acc8cf601d..ba63b2b216e 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -104,7 +104,11 @@ class IMAGE_MT_view(Menu):
ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
for a, b in ratios:
- layout.operator("image.view_zoom_ratio", text=iface_("Zoom %d:%d") % (a, b), translate=False).ratio = a / b
+ layout.operator(
+ "image.view_zoom_ratio",
+ text=iface_(f"Zoom {a:d}:{b:d}"),
+ translate=False,
+ ).ratio = a / b
layout.separator()
@@ -480,14 +484,6 @@ class IMAGE_HT_header(Header):
layout.prop(sima, "mode", text="")
- layout.template_ID(sima, "image", new="image.new", open="image.open")
- if not show_render:
- layout.prop(sima, "use_image_pin", text="")
-
- if show_maskedit:
- row = layout.row()
- row.template_ID(sima, "mask", new="mask.new")
-
# uv editing
if show_uvedit:
uvedit = sima.uv_editor
@@ -504,8 +500,19 @@ class IMAGE_HT_header(Header):
layout.separator_spacer()
+ layout.template_ID(sima, "image", new="image.new", open="image.open")
+
+ if show_maskedit:
+ row = layout.row()
+ row.template_ID(sima, "mask", new="mask.new")
+
+ layout.separator_spacer()
+
if show_uvedit or show_maskedit or mode == 'PAINT':
- layout.prop(sima, "use_realtime_update", icon_only=True, icon='LOCKED')
+ layout.prop(sima, "use_realtime_update", icon_only=True, icon='FILE_REFRESH')
+
+ if not show_render:
+ layout.prop(sima, "use_image_pin", text="")
if show_uvedit:
uvedit = sima.uv_editor
@@ -513,6 +520,13 @@ class IMAGE_HT_header(Header):
mesh = context.edit_object.data
layout.prop_search(mesh.uv_layers, "active", mesh, "uv_layers", text="")
+ # Snap
+ row = layout.row(align=True)
+ row.prop(toolsettings, "use_snap", text="")
+ row.prop(toolsettings, "snap_uv_element", icon_only=True)
+ if toolsettings.snap_uv_element != 'INCREMENT':
+ row.prop(toolsettings, "snap_target", text="")
+
row = layout.row(align=True)
row.prop(toolsettings, "proportional_edit", icon_only=True)
# if toolsettings.proportional_edit != 'DISABLED':
@@ -520,12 +534,6 @@ class IMAGE_HT_header(Header):
sub.active = toolsettings.proportional_edit != 'DISABLED'
sub.prop(toolsettings, "proportional_edit_falloff", icon_only=True)
- row = layout.row(align=True)
- row.prop(toolsettings, "use_snap", text="")
- row.prop(toolsettings, "snap_uv_element", icon_only=True)
- if toolsettings.snap_uv_element != 'INCREMENT':
- row.prop(toolsettings, "snap_target", text="")
-
layout.prop(sima, "pivot_point", icon_only=True)
if ima:
diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py
index 607e2d28d0f..304fc799fea 100644
--- a/release/scripts/startup/bl_ui/space_nla.py
+++ b/release/scripts/startup/bl_ui/space_nla.py
@@ -19,15 +19,17 @@
# <pep8 compliant>
import bpy
-from bpy.types import Header, Menu
+from bpy.types import Header, Menu, Panel
+from .space_dopesheet import (
+ DopesheetFilterPopoverBase,
+ dopesheet_filter,
+)
class NLA_HT_header(Header):
bl_space_type = 'NLA_EDITOR'
def draw(self, context):
- from .space_dopesheet import dopesheet_filter
-
layout = self.layout
st = context.space_data
@@ -37,12 +39,36 @@ class NLA_HT_header(Header):
NLA_MT_editor_menus.draw_collapsible(context, layout)
+ layout.separator_spacer()
+
dopesheet_filter(layout, context)
- layout.separator_spacer()
+ layout.popover(
+ space_type='NLA_EDITOR',
+ region_type='HEADER',
+ panel_type="NLA_PT_filters",
+ text="",
+ icon='FILTER',
+ )
+
layout.prop(st, "auto_snap", text="")
+class NLA_PT_filters(DopesheetFilterPopoverBase, Panel):
+ bl_space_type = 'NLA_EDITOR'
+ bl_region_type = 'HEADER'
+ bl_label = "Filters"
+
+ def draw(self, context):
+ layout = self.layout
+
+ DopesheetFilterPopoverBase.draw_generic_filters(context, layout)
+ layout.separator()
+ DopesheetFilterPopoverBase.draw_search_filters(context, layout)
+ layout.separator()
+ DopesheetFilterPopoverBase.draw_standard_filters(context, layout)
+
+
class NLA_MT_editor_menus(Menu):
bl_idname = "NLA_MT_editor_menus"
bl_label = ""
@@ -218,6 +244,7 @@ classes = (
NLA_MT_marker,
NLA_MT_add,
NLA_MT_edit_transform,
+ NLA_PT_filters,
)
if __name__ == "__main__": # only for live edit.
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index 521c510ad2d..3960f336cd0 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -53,10 +53,20 @@ class NODE_HT_header(Header):
# layout.prop(snode, "tree_type", text="")
if snode.tree_type == 'ShaderNodeTree':
- layout.prop(snode, "shader_type", text="", expand=True)
+ layout.prop(snode, "shader_type", text="")
ob = context.object
if snode.shader_type == 'OBJECT' and ob:
+
+ NODE_MT_editor_menus.draw_collapsible(context, layout)
+
+ # No shader nodes for Eevee lamps
+ if snode_id and not (context.engine == 'BLENDER_EEVEE' and ob.type == 'LAMP'):
+ row = layout.row()
+ row.prop(snode_id, "use_nodes")
+
+ layout.separator_spacer()
+
row = layout.row()
# disable material slot buttons when pinned, cannot find correct slot within id_from (#36589)
row.enabled = not snode.pin
@@ -67,37 +77,46 @@ class NODE_HT_header(Header):
if id_from and ob.type != 'LAMP':
row.template_ID(id_from, "active_material", new="material.new")
- # No shader nodes for Eevee lamps
- if snode_id and not (context.engine == 'BLENDER_EEVEE' and ob.type == 'LAMP'):
- row.prop(snode_id, "use_nodes")
+ if snode.shader_type == 'WORLD':
NODE_MT_editor_menus.draw_collapsible(context, layout)
- if snode.shader_type == 'WORLD':
- row = layout.row()
- row.enabled = not snode.pin
- row.template_ID(scene, "world", new="world.new")
-
if snode_id:
+ row = layout.row()
row.prop(snode_id, "use_nodes")
- NODE_MT_editor_menus.draw_collapsible(context, layout)
+ layout.separator_spacer()
+
+ row = layout.row()
+ row.enabled = not snode.pin
+ row.template_ID(scene, "world", new="world.new")
if snode.shader_type == 'LINESTYLE':
view_layer = context.view_layer
lineset = view_layer.freestyle_settings.linesets.active
- if lineset is not None:
- row = layout.row()
- row.enabled = not snode.pin
- row.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
+ if lineset is not None:
NODE_MT_editor_menus.draw_collapsible(context, layout)
if snode_id:
+ row = layout.row()
row.prop(snode_id, "use_nodes")
+ layout.separator_spacer()
+
+ row = layout.row()
+ row.enabled = not snode.pin
+ row.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
+
elif snode.tree_type == 'TextureNodeTree':
- layout.prop(snode, "texture_type", text="", expand=True)
+ layout.prop(snode, "texture_type", text="")
+
+ NODE_MT_editor_menus.draw_collapsible(context, layout)
+
+ if snode_id:
+ layout.prop(snode_id, "use_nodes")
+
+ layout.separator_spacer()
if id_from:
if snode.texture_type == 'BRUSH':
@@ -105,18 +124,13 @@ class NODE_HT_header(Header):
else:
layout.template_ID(id_from, "active_texture", new="texture.new")
- if snode_id:
- layout.prop(snode_id, "use_nodes")
+ elif snode.tree_type == 'CompositorNodeTree':
NODE_MT_editor_menus.draw_collapsible(context, layout)
- elif snode.tree_type == 'CompositorNodeTree':
-
if snode_id:
layout.prop(snode_id, "use_nodes")
- NODE_MT_editor_menus.draw_collapsible(context, layout)
-
layout.prop(snode, "use_auto_render")
layout.prop(snode, "show_backdrop")
if snode.show_backdrop:
@@ -125,19 +139,19 @@ class NODE_HT_header(Header):
else:
# Custom node tree is edited as independent ID block
- layout.template_ID(snode, "node_tree", new="node.new_node_tree")
NODE_MT_editor_menus.draw_collapsible(context, layout)
+ layout.separator_spacer()
+
+ layout.template_ID(snode, "node_tree", new="node.new_node_tree")
+
layout.separator_spacer()
+ layout.template_running_jobs()
+
layout.prop(snode, "pin", text="")
layout.operator("node.tree_path_parent", text="", icon='FILE_PARENT')
- layout.separator()
-
- # Auto-offset nodes (called "insert_offset" in code)
- layout.prop(snode, "use_insert_offset", text="")
-
# Snap
row = layout.row(align=True)
row.prop(toolsettings, "use_snap", text="")
@@ -149,8 +163,6 @@ class NODE_HT_header(Header):
row.operator("node.clipboard_copy", text="", icon='COPYDOWN')
row.operator("node.clipboard_paste", text="", icon='PASTEDOWN')
- layout.template_running_jobs()
-
class NODE_MT_editor_menus(Menu):
bl_idname = "NODE_MT_editor_menus"
@@ -188,11 +200,18 @@ class NODE_MT_view(Menu):
def draw(self, context):
layout = self.layout
+ snode = context.space_data
+
layout.operator("node.properties", icon='MENU_PANEL')
layout.operator("node.toolbar", icon='MENU_PANEL')
layout.separator()
+ # Auto-offset nodes (called "insert_offset" in code)
+ layout.prop(snode, "use_insert_offset")
+
+ layout.separator()
+
layout.operator("view2d.zoom_in")
layout.operator("view2d.zoom_out")
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index f825546bb47..19f3bcd3b1f 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -35,7 +35,17 @@ class OUTLINER_HT_header(Header):
row = layout.row(align=True)
row.template_header()
- layout.prop(space, "display_mode", text="")
+ layout.prop(space, "display_mode", icon_only=True)
+
+ if display_mode == 'DATA_API':
+ OUTLINER_MT_editor_menus.draw_collapsible(context, layout)
+
+ layout.separator_spacer()
+
+ row = layout.row(align=True)
+ row.prop(space, "filter_text", icon='VIEWZOOM', text="")
+
+ layout.separator_spacer()
row = layout.row(align=True)
if display_mode in {'VIEW_LAYER'}:
@@ -50,9 +60,13 @@ class OUTLINER_HT_header(Header):
sub.active = space.use_filter_id_type
sub.prop(space, "filter_id_type", text="", icon_only=True)
- OUTLINER_MT_editor_menus.draw_collapsible(context, layout)
+ if display_mode == 'VIEW_LAYER':
+ layout.operator("outliner.collection_new", text="", icon='GROUP').nested = True
- if space.display_mode == 'DATA_API':
+ elif display_mode == 'ORPHAN_DATA':
+ layout.operator("outliner.orphans_purge", text="Purge")
+
+ elif space.display_mode == 'DATA_API':
layout.separator()
row = layout.row(align=True)
@@ -70,13 +84,6 @@ class OUTLINER_HT_header(Header):
row = layout.row()
row.label(text="No Keying Set Active")
- row = layout.row(align=True)
- row.prop(space, "use_filter_search", text="")
- if space.use_filter_search:
- row.prop(space, "filter_text", text="")
- row.prop(space, "use_filter_complete", text="")
- row.prop(space, "use_filter_case_sensitive", text="")
-
class OUTLINER_MT_editor_menus(Menu):
bl_idname = "OUTLINER_MT_editor_menus"
@@ -89,35 +96,26 @@ class OUTLINER_MT_editor_menus(Menu):
def draw_menus(layout, context):
space = context.space_data
- layout.menu("OUTLINER_MT_view")
-
if space.display_mode == 'DATA_API':
layout.menu("OUTLINER_MT_edit_datablocks")
- elif space.display_mode == 'ORPHAN_DATA':
- layout.menu("OUTLINER_MT_edit_orphan_data")
-
-class OUTLINER_MT_view(Menu):
- bl_label = "View"
+class OUTLINER_MT_context(Menu):
+ bl_label = "Outliner"
def draw(self, context):
layout = self.layout
- space = context.space_data
-
- if space.display_mode != 'DATA_API':
- layout.prop(space, "use_sort_alpha")
- layout.prop(space, "show_restrict_columns")
- layout.separator()
- layout.operator("outliner.show_active")
-
layout.operator("outliner.show_one_level", text="Show One Level")
layout.operator("outliner.show_one_level", text="Hide One Level").open = False
layout.operator("outliner.show_hierarchy")
layout.separator()
+ layout.operator("outliner.show_active")
+
+ layout.separator()
+
layout.menu("INFO_MT_area")
@@ -136,13 +134,6 @@ class OUTLINER_MT_edit_datablocks(Menu):
layout.operator("outliner.drivers_delete_selected")
-class OUTLINER_MT_edit_orphan_data(Menu):
- bl_label = "Edit"
-
- def draw(self, context):
- layout = self.layout
- layout.operator("outliner.orphans_purge")
-
class OUTLINER_MT_collection_view_layer(Menu):
bl_label = "View Layer"
@@ -188,6 +179,10 @@ class OUTLINER_MT_collection(Menu):
layout.separator()
layout.operator_menu_enum("outliner.id_operation", "type", text="ID Data")
+ layout.separator()
+
+ OUTLINER_MT_context.draw(self, context)
+
class OUTLINER_MT_collection_new(Menu):
bl_label = "Collection"
@@ -197,6 +192,10 @@ class OUTLINER_MT_collection_new(Menu):
layout.operator("outliner.collection_new", text="New").nested = False
+ layout.separator()
+
+ OUTLINER_MT_context.draw(self, context)
+
class OUTLINER_MT_object(Menu):
bl_label = "Object"
@@ -234,6 +233,10 @@ class OUTLINER_MT_object(Menu):
layout.operator_menu_enum("outliner.id_operation", "type", text="ID Data")
+ layout.separator()
+
+ OUTLINER_MT_context.draw(self, context)
+
class OUTLINER_PT_filter(Panel):
bl_space_type = 'OUTLINER'
@@ -246,54 +249,57 @@ class OUTLINER_PT_filter(Panel):
space = context.space_data
display_mode = space.display_mode
- layout.prop(space, "use_filter_collection", text="Collections")
+ layout.prop(space, "use_filter_complete", text="Exact Match Search")
+ layout.prop(space, "use_filter_case_sensitive", text="Case Sensitive Search")
layout.separator()
- col = layout.column()
- col.prop(space, "use_filter_object", text="Objects")
- active = space.use_filter_object
+ if space.display_mode != 'DATA_API':
+ layout.prop(space, "use_sort_alpha")
+ layout.prop(space, "show_restrict_columns")
+ layout.separator()
- sub = col.column(align=True)
- sub.active = active
- sub.prop(space, "filter_state", text="")
- sub.prop(space, "use_filter_object_content", text="Object Contents")
- sub.prop(space, "use_filter_children", text="Object Children")
+ col = layout.column(align=True)
- layout.separator()
+ col.prop(space, "use_filter_collection", text="Collections", icon="GROUP")
+ col.prop(space, "use_filter_object", text="Objects", icon="OBJECT_DATAMODE")
- col = layout.column_flow(align=True)
- col.active = active
+ sub = col.column(align=True)
+ sub.active = space.use_filter_object
if bpy.data.meshes:
- col.prop(space, "use_filter_object_mesh", text="Meshes")
+ sub.prop(space, "use_filter_object_mesh", text="Meshes", icon="MESH_DATA")
if bpy.data.armatures:
- col.prop(space, "use_filter_object_armature", text="Armatures")
+ sub.prop(space, "use_filter_object_armature", text="Armatures", icon="ARMATURE_DATA")
if bpy.data.lamps:
- col.prop(space, "use_filter_object_lamp", text="Lamps")
+ sub.prop(space, "use_filter_object_lamp", text="Lamps", icon="LAMP_DATA")
if bpy.data.cameras:
- col.prop(space, "use_filter_object_camera", text="Cameras")
+ sub.prop(space, "use_filter_object_camera", text="Cameras", icon="CAMERA_DATA")
- col.prop(space, "use_filter_object_empty", text="Empties")
+ sub.prop(space, "use_filter_object_empty", text="Empties", icon="EMPTY_DATA")
if bpy.data.curves or \
bpy.data.metaballs or \
bpy.data.lightprobes or \
bpy.data.lattices or \
bpy.data.fonts or bpy.data.speakers:
- col.prop(space, "use_filter_object_others", text="Others")
+ sub.prop(space, "use_filter_object_others", text="Others")
+
+ subsub = sub.column(align=False)
+ subsub.prop(space, "filter_state", text="")
+ subsub.prop(space, "use_filter_object_content", text="Object Contents")
+ subsub.prop(space, "use_filter_children", text="Object Children")
classes = (
OUTLINER_HT_header,
OUTLINER_MT_editor_menus,
- OUTLINER_MT_view,
OUTLINER_MT_edit_datablocks,
- OUTLINER_MT_edit_orphan_data,
OUTLINER_MT_collection,
OUTLINER_MT_collection_new,
OUTLINER_MT_collection_view_layer,
OUTLINER_MT_object,
+ OUTLINER_MT_context,
OUTLINER_PT_filter,
)
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index ce1d1da038c..dc966850b69 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -83,26 +83,25 @@ class SEQUENCER_HT_header(Header):
SEQUENCER_MT_editor_menus.draw_collapsible(context, layout)
- row = layout.row(align=True)
- row.prop(scene, "use_preview_range", text="", toggle=True)
- row.prop(scene, "lock_frame_selection_to_range", text="", toggle=True)
+ if st.view_type == 'SEQUENCER':
+ layout.prop(st, "show_backdrop", text="Backdrop")
- if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
- layout.prop(st, "display_mode", expand=True, text="")
+ layout.separator_spacer()
+
+ layout.template_running_jobs()
if st.view_type == 'SEQUENCER':
- row = layout.row(align=True)
- row.operator("sequencer.copy", text="", icon='COPYDOWN')
- row.operator("sequencer.paste", text="", icon='PASTEDOWN')
+ layout.separator()
+ layout.operator("sequencer.refresh_all")
+ if st.view_type == 'SEQUENCER_PREVIEW':
layout.separator()
layout.operator("sequencer.refresh_all")
- layout.prop(st, "show_backdrop")
- else:
- if st.view_type == 'SEQUENCER_PREVIEW':
- layout.separator()
- layout.operator("sequencer.refresh_all")
+ if st.view_type in {'PREVIEW', 'SEQUENCER_PREVIEW'}:
+ layout.prop(st, "display_mode", expand=True, text="")
+
+ if st.view_type != 'SEQUENCER':
layout.prop(st, "preview_channels", expand=True, text="")
layout.prop(st, "display_channel", text="Channel")
@@ -134,7 +133,11 @@ class SEQUENCER_HT_header(Header):
props.animation = True
props.sequencer = True
- layout.template_running_jobs()
+ if st.view_type == 'SEQUENCER':
+
+ row = layout.row(align=True)
+ row.operator("sequencer.copy", text="", icon='COPYDOWN')
+ row.operator("sequencer.paste", text="", icon='PASTEDOWN')
class SEQUENCER_MT_editor_menus(Menu):
@@ -702,11 +705,11 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
if i == strip.multicam_source:
sub = row.row(align=True)
sub.enabled = False
- sub.operator("sequencer.cut_multicam", text="%d" % i).camera = i
+ sub.operator("sequencer.cut_multicam", text=f"{i:d}").camera = i
else:
sub_1 = row.row(align=True)
sub_1.enabled = True
- sub_1.operator("sequencer.cut_multicam", text="%d" % i).camera = i
+ sub_1.operator("sequencer.cut_multicam", text=f"{i:d}").camera = i
if strip.channel > BT_ROW and (strip_channel - 1) % BT_ROW:
for i in range(strip.channel, strip_channel + ((BT_ROW + 1 - strip_channel) % BT_ROW)):
diff --git a/release/scripts/startup/bl_ui/space_statusbar.py b/release/scripts/startup/bl_ui/space_statusbar.py
index 3a6fc4925d8..dbcfbf165ce 100644
--- a/release/scripts/startup/bl_ui/space_statusbar.py
+++ b/release/scripts/startup/bl_ui/space_statusbar.py
@@ -25,38 +25,14 @@ class STATUSBAR_HT_header(Header):
bl_space_type = 'STATUSBAR'
def draw(self, context):
- area = context.area
- region = context.region
-
- if region.alignment == 'RIGHT':
- if region == area.regions[0]:
- self.draw_right(context)
- else:
- self.draw_center(context)
- else:
- self.draw_left(context)
-
- def draw_left(self, context):
layout = self.layout
- row = layout.row(align=True)
- if (bpy.data.filepath):
- row.label(text=bpy.data.filepath, translate=False)
- if bpy.data.is_dirty:
- row.label("(Modified)")
-
- def draw_center(self, context):
- layout = self.layout
+ # input status
+ layout.template_input_status()
- scene = context.scene
- view_layer = context.view_layer
-
- layout.label(text=scene.statistics(view_layer), translate=False)
-
- def draw_right(self, context):
- layout = self.layout
+ layout.separator_spacer()
- layout.template_running_jobs()
+ # messages
layout.template_reports_banner()
row = layout.row(align=True)
@@ -70,7 +46,16 @@ class STATUSBAR_HT_header(Header):
# include last so text doesn't push buttons out of the header
row.label(bpy.app.autoexec_fail_message)
- return
+
+ layout.template_running_jobs()
+
+ layout.separator_spacer()
+
+ # stats
+ scene = context.scene
+ view_layer = context.view_layer
+
+ layout.label(text=scene.statistics(view_layer), translate=False)
classes = (
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index b1af82c95fe..95124d2be83 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -41,40 +41,49 @@ class TEXT_HT_header(Header):
sub.alert = True
sub.operator("text.resolve_conflict", text="", icon='HELP')
+ layout.separator_spacer()
+
row = layout.row(align=True)
row.template_ID(st, "text", new="text.new", unlink="text.unlink", open="text.open")
+ layout.separator_spacer()
+
row = layout.row(align=True)
row.prop(st, "show_line_numbers", text="")
row.prop(st, "show_word_wrap", text="")
row.prop(st, "show_syntax_highlight", text="")
if text:
- osl = text.name.endswith(".osl") or text.name.endswith(".oso")
+ is_osl = text.name.endswith((".osl", ".osl"))
- if osl:
+ row = layout.row()
+ if text.filepath:
+ if text.is_dirty:
+ row.label(
+ iface_(f"File: *{text.filepath} (unsaved)"),
+ translate=False,
+ )
+ else:
+ row.label(
+ iface_(f"File: {text.filepath}"),
+ translate=False,
+ )
+ else:
+ row.label(
+ "Text: External"
+ if text.library
+ else "Text: Internal"
+ )
+ if is_osl:
row = layout.row()
row.operator("node.shader_script_update")
else:
row = layout.row()
- row.operator("text.run_script")
-
- row = layout.row()
row.active = text.name.endswith(".py")
row.prop(text, "use_module")
- row = layout.row()
- if text.filepath:
- if text.is_dirty:
- row.label(text=iface_("File: *%r (unsaved)") %
- text.filepath, translate=False)
- else:
- row.label(text=iface_("File: %r") %
- text.filepath, translate=False)
- else:
- row.label(text="Text: External"
- if text.library
- else "Text: Internal")
+ row = layout.row()
+ row.operator("text.run_script")
class TEXT_MT_editor_menus(Menu):
diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py
index 358a813fd0f..179f1c90d2e 100644
--- a/release/scripts/startup/bl_ui/space_time.py
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -38,9 +38,9 @@ class TIME_HT_editor_buttons(Header):
layout.separator_spacer()
- row = layout.row(align=True)
- row.prop(toolsettings, "use_keyframe_insert_auto", text="", toggle=True)
+ layout.prop(toolsettings, "use_keyframe_insert_auto", text="", toggle=True)
+ row = layout.row(align=True)
row.operator("screen.frame_jump", text="", icon='REW').end = False
row.operator("screen.keyframe_jump", text="", icon='PREV_KEYFRAME').next = False
if not screen.is_animation_playing:
@@ -91,14 +91,18 @@ class TIME_MT_editor_menus(Menu):
@staticmethod
def draw_menus(layout, context):
- layout.popover(space_type='DOPESHEET_EDITOR',
- region_type='HEADER',
- panel_type="TIME_PT_playback",
- text="Playback")
- layout.popover(space_type='DOPESHEET_EDITOR',
- region_type='HEADER',
- panel_type="TIME_PT_keyframing_settings",
- text="Keying")
+ layout.popover(
+ space_type='DOPESHEET_EDITOR',
+ region_type='HEADER',
+ panel_type="TIME_PT_playback",
+ text="Playback",
+ )
+ layout.popover(
+ space_type='DOPESHEET_EDITOR',
+ region_type='HEADER',
+ panel_type="TIME_PT_keyframing_settings",
+ text="Keying",
+ )
layout.menu("TIME_MT_view")
layout.menu("TIME_MT_marker")
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
index c1331425572..110611cf7ab 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py
@@ -83,6 +83,12 @@ def generate_from_brushes_ex(
class _defs_view3d_generic:
@ToolDef.from_fn
def cursor():
+ def draw_settings(context, layout, tool):
+ wm = context.window_manager
+ props = tool.operator_properties("view3d.cursor3d")
+ layout.prop(props, "use_depth")
+ layout.prop(props, "orientation")
+
return dict(
text="Cursor",
icon="ops.generic.cursor",
@@ -93,6 +99,7 @@ class _defs_view3d_generic:
dict(type='EVT_TWEAK_A', value='ANY'),
),
),
+ draw_settings=draw_settings,
)
@ToolDef.from_fn
@@ -124,36 +131,39 @@ class _defs_transform:
def translate():
return dict(
text="Move",
- cursor='SCROLL_XY',
+ # cursor='SCROLL_XY',
icon="ops.transform.translate",
widget="TRANSFORM_WGT_manipulator",
- keymap=(
- ("transform.translate", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),
- ),
+ # TODO, implement as optional fallback manipulator
+ # keymap=(
+ # ("transform.translate", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),
+ # ),
)
@ToolDef.from_fn
def rotate():
return dict(
text="Rotate",
- cursor='SCROLL_XY',
+ # cursor='SCROLL_XY',
icon="ops.transform.rotate",
widget="TRANSFORM_WGT_manipulator",
- keymap=(
- ("transform.rotate", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),
- ),
+ # TODO, implement as optional fallback manipulator
+ # keymap=(
+ # ("transform.rotate", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),
+ # ),
)
@ToolDef.from_fn
def scale():
return dict(
text="Scale",
- cursor='SCROLL_XY',
+ # cursor='SCROLL_XY',
icon="ops.transform.resize",
widget="TRANSFORM_WGT_manipulator",
- keymap=(
- ("transform.resize", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),
- ),
+ # TODO, implement as optional fallback manipulator
+ # keymap=(
+ # ("transform.resize", dict(release_confirm=True), dict(type='EVT_TWEAK_A', value='ANY')),
+ # ),
)
@ToolDef.from_fn
@@ -166,11 +176,16 @@ class _defs_transform:
@ToolDef.from_fn
def transform():
+ def draw_settings(context, layout, tool):
+ tool_settings = context.tool_settings
+ layout.prop(tool_settings, "use_manipulator_mode")
+
return dict(
text="Transform",
icon="ops.transform.transform",
widget="TRANSFORM_WGT_manipulator",
# No keymap default action, only for manipulators!
+ draw_settings=draw_settings,
)
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 5ea5923c1e0..52d180c36b0 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -270,6 +270,34 @@ class TOPBAR_PT_snapping(Panel):
col.prop(toolsettings, "use_snap_peel_object")
+class TOPBAR_PT_transform_orientations(Panel):
+ bl_space_type = 'TOPBAR'
+ bl_region_type = 'HEADER'
+ bl_label = "Transform Orientations"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ view = context.space_data
+ return (view)
+
+ def draw(self, context):
+ layout = self.layout
+ layout.label("Tranform Orientations")
+
+ scene = context.scene
+ orientation = scene.current_orientation
+
+ col = layout.split(percentage=0.9)
+ col.prop(scene, "transform_orientation", expand=True)
+ col.operator("transform.create_orientation", text="", icon='ZOOMIN', emboss=False)
+
+ if orientation:
+ row = layout.row(align=False)
+ row.prop(orientation, "name", text="")
+ row.operator("transform.delete_orientation", text="", icon='X', emboss=False)
+
+
class INFO_MT_editor_menus(Menu):
bl_idname = "INFO_MT_editor_menus"
bl_label = ""
@@ -297,10 +325,10 @@ class INFO_MT_file(Menu):
layout.operator_context = 'INVOKE_AREA'
layout.operator("wm.read_homefile", text="New", icon='NEW')
layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
- layout.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT')
- layout.operator("wm.revert_mainfile", icon='FILE_REFRESH')
- layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
- layout.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO')
+ layout.menu("INFO_MT_file_open_recent")
+ layout.operator("wm.revert_mainfile")
+ layout.operator("wm.recover_last_session")
+ layout.operator("wm.recover_auto_save", text="Recover Auto Save...")
layout.separator()
@@ -308,15 +336,15 @@ class INFO_MT_file(Menu):
layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK')
layout.operator_context = 'INVOKE_AREA'
- layout.operator("wm.save_as_mainfile", text="Save As...", icon='SAVE_AS')
+ layout.operator("wm.save_as_mainfile", text="Save As...")
layout.operator_context = 'INVOKE_AREA'
- layout.operator("wm.save_as_mainfile", text="Save Copy...", icon='SAVE_COPY').copy = True
+ layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True
layout.separator()
layout.operator_context = 'INVOKE_AREA'
- layout.operator("wm.save_homefile", icon='SAVE_PREFS')
- layout.operator("wm.read_factory_settings", icon='LOAD_FACTORY')
+ layout.operator("wm.save_homefile")
+ layout.operator("wm.read_factory_settings")
layout.separator()
@@ -332,7 +360,7 @@ class INFO_MT_file(Menu):
layout.separator()
- layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA')
+ layout.menu("INFO_MT_file_external_data")
layout.separator()
@@ -443,7 +471,7 @@ class INFO_MT_render(Menu):
layout.separator()
- layout.prop_menu_enum(rd, "display_mode", text="Display Mode", icon='IMAGE_COL')
+ layout.prop_menu_enum(rd, "display_mode", text="Display Mode")
layout.prop(rd, "use_lock_interface", text="Lock Interface")
layout.separator()
@@ -453,7 +481,7 @@ class INFO_MT_render(Menu):
props = layout.operator("render.opengl", text="OpenGL Render Animation", icon='RENDER_ANIMATION')
props.view_context = False
props.animation = True
- layout.menu("INFO_MT_opengl_render", icon='SETTINGS')
+ layout.menu("INFO_MT_opengl_render")
layout.separator()
@@ -499,6 +527,10 @@ class INFO_MT_edit(Menu):
layout.separator()
+ layout.operator("wm.search_menu", text="Operator Search...")
+
+ layout.separator()
+
# Should move elsewhere (impacts outliner & 3D view).
tool_settings = context.tool_settings
layout.prop(tool_settings, "lock_object_mode")
@@ -521,8 +553,12 @@ class INFO_MT_window(Menu):
layout.separator()
+ layout.operator("screen.workspace_cycle", text="Next Workspace").direction = 'NEXT'
+ layout.operator("screen.workspace_cycle", text="Previous Workspace").direction = 'PREV'
+
+ layout.separator()
+
layout.operator("screen.screenshot")
- layout.operator("screen.screencast")
if sys.platform[:3] == "win":
layout.separator()
@@ -530,7 +566,7 @@ class INFO_MT_window(Menu):
if context.scene.render.use_multiview:
layout.separator()
- layout.operator("wm.set_stereo_3d", icon='CAMERA_STEREO')
+ layout.operator("wm.set_stereo_3d")
class INFO_MT_help(Menu):
@@ -576,11 +612,54 @@ class INFO_MT_help(Menu):
layout.operator("wm.splash", icon='BLENDER')
+class TOPBAR_MT_file_specials(Menu):
+ bl_label = "File Context Menu"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("wm.link", text="Link", icon='LINK_BLEND')
+ layout.operator("wm.append", text="Append", icon='APPEND_BLEND')
+
+ layout.separator()
+
+ layout.menu("INFO_MT_file_import", icon='IMPORT')
+ layout.menu("INFO_MT_file_export", icon='EXPORT')
+
+
+class TOPBAR_MT_window_specials(Menu):
+ bl_label = "Window Context Menu"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'EXEC_AREA'
+
+ layout.operator("wm.window_new")
+
+ layout.operator_context = 'INVOKE_AREA'
+
+ layout.operator("screen.area_dupli")
+
+ layout.separator()
+
+ layout.operator("screen.area_split", text="Horizontal Split").direction = 'HORIZONTAL'
+ layout.operator("screen.area_split", text="Vertical Split").direction = 'VERTICAL'
+
+ layout.separator()
+
+ layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
+
+
classes = (
TOPBAR_HT_upper_bar,
TOPBAR_HT_lower_bar,
TOPBAR_PT_pivot_point,
TOPBAR_PT_snapping,
+ TOPBAR_PT_transform_orientations,
+ TOPBAR_MT_file_specials,
+ TOPBAR_MT_window_specials,
INFO_MT_editor_menus,
INFO_MT_file,
INFO_MT_file_import,
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index e7f667f5d5f..4ce14f5ac89 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -73,9 +73,9 @@ class USERPREF_HT_header(Header):
layout.operator("wm.addon_refresh", icon='FILE_REFRESH')
layout.menu("USERPREF_MT_addons_online_resources")
elif userpref.active_section == 'LIGHTS':
- layout.operator('wm.studiolight_install', text="Install MatCap").orientation='MATCAP'
- layout.operator('wm.studiolight_install', text="Install World HDRI").orientation='WORLD'
- layout.operator('wm.studiolight_install', text="Install Camera HDRI").orientation='CAMERA'
+ layout.operator('wm.studiolight_install', text="Install MatCap").orientation = 'MATCAP'
+ layout.operator('wm.studiolight_install', text="Install World HDRI").orientation = 'WORLD'
+ layout.operator('wm.studiolight_install', text="Install Camera HDRI").orientation = 'CAMERA'
elif userpref.active_section == 'THEMES':
layout.operator("ui.reset_default_theme")
layout.operator("wm.theme_install")
@@ -230,7 +230,6 @@ class USERPREF_PT_interface(Panel):
col.prop(view, "ui_scale", text="Scale")
col.prop(view, "ui_line_width", text="Line Width")
col.prop(view, "show_tooltips")
- col.prop(view, "show_tooltips_python")
col.prop(view, "show_object_info", text="Object Info")
col.prop(view, "show_large_cursors")
col.prop(view, "show_view_name", text="View Name")
@@ -238,19 +237,39 @@ class USERPREF_PT_interface(Panel):
col.prop(view, "object_origin_size")
col.separator()
- col.separator()
- col.separator()
- col.prop(view, "show_mini_axis", text="Display Mini Axis")
- sub = col.column()
+ col.prop(view, "show_manipulator_navigate")
+
+ sub = col.column(align=True)
+
+ sub.prop(view, "show_mini_axis", text="Display Mini Axis")
+ sub.active = not view.show_manipulator_navigate
+
+ sub = col.column(align=True)
sub.active = view.show_mini_axis
sub.prop(view, "mini_axis_size", text="Size")
sub.prop(view, "mini_axis_brightness", text="Brightness")
col.separator()
- col.label("Warnings")
- col.prop(view, "use_quit_dialog")
+ # Toolbox doesn't exist yet
+ # col.label(text="Toolbox:")
+ #col.prop(view, "show_column_layout")
+ #col.label(text="Open Toolbox Delay:")
+ #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
+ #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
+ col.prop(view, "show_manipulator", text="Transform Manipulator")
+ # Currently not working
+ # col.prop(view, "show_manipulator_shaded")
+ sub = col.column()
+ sub.active = view.show_manipulator
+ sub.prop(view, "manipulator_size", text="Size")
+
+ col.separator()
+
+ col.label("Development")
+ col.prop(view, "show_tooltips_python")
+ col.prop(view, "show_developer_ui")
row.separator()
row.separator()
@@ -286,24 +305,6 @@ class USERPREF_PT_interface(Panel):
row.separator()
col = row.column()
- # Toolbox doesn't exist yet
- # col.label(text="Toolbox:")
- #col.prop(view, "show_column_layout")
- #col.label(text="Open Toolbox Delay:")
- #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
- #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
- col.prop(view, "show_manipulator")
- # Currently not working
- # col.prop(view, "show_manipulator_shaded")
- sub = col.column()
- sub.active = view.show_manipulator
- sub.prop(view, "manipulator_size", text="Size")
-
- col.prop(view, "show_manipulator_navigate")
-
- col.separator()
- col.separator()
- col.separator()
col.label(text="Menus:")
col.prop(view, "use_mouse_over_open")
@@ -324,6 +325,10 @@ class USERPREF_PT_interface(Panel):
col.separator()
col.prop(view, "show_splash")
+
+ col.label("Warnings")
+ col.prop(view, "use_quit_dialog")
+
col.separator()
col.label(text="App Template:")
@@ -500,12 +505,6 @@ class USERPREF_PT_system(Panel):
col.separator()
- col.label(text="Screencast:")
- col.prop(system, "screencast_fps")
- col.prop(system, "screencast_wait_time")
-
- col.separator()
-
if bpy.app.build_options.cycles:
addon = userpref.addons.get("cycles")
if addon is not None:
@@ -545,8 +544,7 @@ class USERPREF_PT_system(Panel):
col.prop(system, "use_region_overlap")
col.separator()
- col.label(text="Max Viewport Anti-aliasing Method")
- col.prop(system, "max_anti_alias_method", text="")
+ col.prop(system, "gpu_viewport_quality")
col.separator()
@@ -948,7 +946,7 @@ class USERPREF_PT_theme(Panel):
col = split.column()
for i, ui in enumerate(theme.bone_color_sets, 1):
- col.label(text=iface_("Color Set %d:") % i, translate=False)
+ col.label(iface_(f"Color Set {i:d}"), translate=False)
row = col.row()
@@ -1440,12 +1438,13 @@ class USERPREF_PT_addons(Panel):
continue
# check if addon should be visible with current filters
- if ((filter == "All") or
- (filter == info["category"]) or
- (filter == "Enabled" and is_enabled) or
+ if (
+ (filter == "All") or
+ (filter == info["category"]) or
+ (filter == "Enabled" and is_enabled) or
(filter == "Disabled" and not is_enabled) or
(filter == "User" and (mod.__file__.startswith((scripts_addons_folder, userpref_addons_folder))))
- ):
+ ):
if search and search not in info["name"].lower():
if info["author"]:
if search not in info["author"].lower():
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index e780880b1bd..e0a509fb44b 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -65,9 +65,11 @@ class VIEW3D_HT_header(Header):
row.prop(tool_settings.particle_edit, "select_mode", text="", expand=True)
# Occlude geometry
- if ((((shading.type not in {'SOLID', 'TEXTURED'}) or not shading.show_xray) and
- (object_mode == 'PARTICLE_EDIT' or (object_mode == 'EDIT' and obj.type == 'MESH'))) or
- (object_mode in {'WEIGHT_PAINT', 'VERTEX_PAINT'})):
+ if (
+ (((shading.type not in {'SOLID', 'TEXTURED'}) or not shading.show_xray) and
+ (object_mode == 'PARTICLE_EDIT' or (object_mode == 'EDIT' and obj.type == 'MESH'))) or
+ (object_mode in {'WEIGHT_PAINT', 'VERTEX_PAINT'})
+ ):
row = layout.row()
row.prop(view, "use_occlude_geometry", text="")
@@ -95,56 +97,49 @@ class VIEW3D_HT_header(Header):
layout.separator_spacer()
+ # Viewport Settings
+ row = layout.row(align=True)
+ row.prop(shading, "type", text="", expand=True)
+
+ sub = row.row(align=True)
+ sub.enabled = shading.type != 'RENDERED'
+ sub.popover(space_type='VIEW_3D', region_type='HEADER', panel_type="VIEW3D_PT_shading")
+
+ row = layout.row(align=True)
+ row.prop(overlay, "show_overlays", icon='WIRE', text="")
+
+ sub = row.row(align=True)
+ sub.active = overlay.show_overlays
+ sub.popover(space_type='VIEW_3D', region_type='HEADER', panel_type="VIEW3D_PT_overlay")
+
+ layout.separator_spacer()
+
# Mode & Transform Settings
scene = context.scene
- # Orientation & Pivot
+ # Orientation
if object_mode in {'OBJECT', 'EDIT', 'POSE'}:
- layout.prop(scene, "transform_orientation", text="")
+ orientation = scene.transform_orientation
+ current_orientation = scene.current_orientation
+
+ if not current_orientation:
+ trans_orientation = \
+ bpy.types.Scene.bl_rna.properties["transform_orientation"].enum_items[orientation]
+ trans_icon = getattr(trans_orientation, "icon", "BLANK1")
+ trans_name = getattr(trans_orientation, "name", "Orientation")
+ else:
+ trans_icon = "VISIBLE_IPO_OFF"
+ trans_name = getattr(current_orientation, "name", "Orientation")
- pivot_point = tool_settings.transform_pivot_point
- act_pivot_point = bpy.types.ToolSettings.bl_rna.properties["transform_pivot_point"].enum_items[pivot_point]
row = layout.row(align=True)
row.popover(
space_type='TOPBAR',
region_type='HEADER',
- panel_type="TOPBAR_PT_pivot_point",
- icon=act_pivot_point.icon,
- text="",
+ panel_type="TOPBAR_PT_transform_orientations",
+ text=trans_name,
+ icon=trans_icon,
)
- if obj:
- # Proportional editing
- if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
- row = layout.row(align=True)
- row.prop(tool_settings, "proportional_edit", icon_only=True)
-
- sub = row.row(align=True)
- sub.active = tool_settings.proportional_edit != 'DISABLED'
- sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
-
- elif object_mode in {'EDIT', 'PARTICLE_EDIT'}:
- row = layout.row(align=True)
- row.prop(tool_settings, "proportional_edit", icon_only=True)
- sub = row.row(align=True)
- sub.active = tool_settings.proportional_edit != 'DISABLED'
- sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
-
- elif object_mode == 'OBJECT':
- row = layout.row(align=True)
- row.prop(tool_settings, "use_proportional_edit_objects", icon_only=True)
- sub = row.row(align=True)
- sub.active = tool_settings.use_proportional_edit_objects
- sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
- else:
- # Proportional editing
- if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
- row = layout.row(align=True)
- row.prop(tool_settings, "proportional_edit", icon_only=True)
- sub = row.row(align=True)
- sub.active = tool_settings.proportional_edit != 'DISABLED'
- sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
-
# Snap
show_snap = False
if obj is None:
@@ -184,22 +179,49 @@ class VIEW3D_HT_header(Header):
text=""
)
- layout.separator_spacer()
+ # Proportional editing
+ if obj:
+ if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
+ row = layout.row(align=True)
+ row.prop(tool_settings, "proportional_edit", icon_only=True)
- # Viewport Settings
- row = layout.row(align=True)
- row.prop(shading, "type", text="", expand=True)
+ sub = row.row(align=True)
+ sub.active = tool_settings.proportional_edit != 'DISABLED'
+ sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
- sub = row.row(align=True)
- sub.enabled = shading.type != 'RENDERED'
- sub.popover(space_type='VIEW_3D', region_type='HEADER', panel_type="VIEW3D_PT_shading")
+ elif object_mode in {'EDIT', 'PARTICLE_EDIT'}:
+ row = layout.row(align=True)
+ row.prop(tool_settings, "proportional_edit", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = tool_settings.proportional_edit != 'DISABLED'
+ sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
- row = layout.row(align=True)
- row.prop(overlay, "show_overlays", icon="WIRE", text="")
+ elif object_mode == 'OBJECT':
+ row = layout.row(align=True)
+ row.prop(tool_settings, "use_proportional_edit_objects", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = tool_settings.use_proportional_edit_objects
+ sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
+ else:
+ if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
+ row = layout.row(align=True)
+ row.prop(tool_settings, "proportional_edit", icon_only=True)
+ sub = row.row(align=True)
+ sub.active = tool_settings.proportional_edit != 'DISABLED'
+ sub.prop(tool_settings, "proportional_edit_falloff", icon_only=True)
- sub = row.row(align=True)
- sub.active = overlay.show_overlays
- sub.popover(space_type='VIEW_3D', region_type='HEADER', panel_type="VIEW3D_PT_overlay")
+ # Pivot
+ if object_mode in {'OBJECT', 'EDIT', 'POSE'}:
+ pivot_point = tool_settings.transform_pivot_point
+ act_pivot_point = bpy.types.ToolSettings.bl_rna.properties["transform_pivot_point"].enum_items[pivot_point]
+ row = layout.row(align=True)
+ row.popover(
+ space_type='TOPBAR',
+ region_type='HEADER',
+ panel_type="TOPBAR_PT_pivot_point",
+ icon=act_pivot_point.icon,
+ text="",
+ )
class VIEW3D_MT_editor_menus(Menu):
@@ -216,56 +238,54 @@ class VIEW3D_MT_editor_menus(Menu):
edit_object = context.edit_object
gp_edit = context.gpencil_data and context.gpencil_data.use_stroke_edit_mode
- # Use aligned row to squeeze out a bit more space.
- row = layout.row(align=True)
- row.menu("VIEW3D_MT_view")
+ layout.menu("VIEW3D_MT_view")
# Select Menu
if gp_edit:
- row.menu("VIEW3D_MT_select_gpencil")
+ layout.menu("VIEW3D_MT_select_gpencil")
elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
mesh = obj.data
if mesh.use_paint_mask:
- row.menu("VIEW3D_MT_select_paint_mask")
+ layout.menu("VIEW3D_MT_select_paint_mask")
elif mesh.use_paint_mask_vertex and mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
- row.menu("VIEW3D_MT_select_paint_mask_vertex")
+ layout.menu("VIEW3D_MT_select_paint_mask_vertex")
elif mode_string != 'SCULPT':
- row.menu("VIEW3D_MT_select_%s" % mode_string.lower())
+ layout.menu("VIEW3D_MT_select_%s" % mode_string.lower())
if gp_edit:
pass
elif mode_string == 'OBJECT':
- row.menu("INFO_MT_add", text="Add")
+ layout.menu("INFO_MT_add", text="Add")
elif mode_string == 'EDIT_MESH':
- row.menu("INFO_MT_mesh_add", text="Add")
+ layout.menu("INFO_MT_mesh_add", text="Add")
elif mode_string == 'EDIT_CURVE':
- row.menu("INFO_MT_curve_add", text="Add")
+ layout.menu("INFO_MT_curve_add", text="Add")
elif mode_string == 'EDIT_SURFACE':
- row.menu("INFO_MT_surface_add", text="Add")
+ layout.menu("INFO_MT_surface_add", text="Add")
elif mode_string == 'EDIT_METABALL':
- row.menu("INFO_MT_metaball_add", text="Add")
+ layout.menu("INFO_MT_metaball_add", text="Add")
elif mode_string == 'EDIT_ARMATURE':
- row.menu("INFO_MT_edit_armature_add", text="Add")
+ layout.menu("INFO_MT_edit_armature_add", text="Add")
if gp_edit:
- row.menu("VIEW3D_MT_edit_gpencil")
+ layout.menu("VIEW3D_MT_edit_gpencil")
elif edit_object:
- row.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
+ layout.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
if mode_string == 'EDIT_MESH':
- row.menu("VIEW3D_MT_edit_mesh_vertices")
- row.menu("VIEW3D_MT_edit_mesh_edges")
- row.menu("VIEW3D_MT_edit_mesh_faces")
+ layout.menu("VIEW3D_MT_edit_mesh_vertices")
+ layout.menu("VIEW3D_MT_edit_mesh_edges")
+ layout.menu("VIEW3D_MT_edit_mesh_faces")
elif obj:
if mode_string != 'PAINT_TEXTURE':
- row.menu("VIEW3D_MT_%s" % mode_string.lower())
+ layout.menu("VIEW3D_MT_%s" % mode_string.lower())
if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
- row.menu("VIEW3D_MT_brush")
+ layout.menu("VIEW3D_MT_brush")
if mode_string == 'SCULPT':
- row.menu("VIEW3D_MT_hide_mask")
+ layout.menu("VIEW3D_MT_hide_mask")
else:
- row.menu("VIEW3D_MT_object")
+ layout.menu("VIEW3D_MT_object")
# ********** Menu **********
@@ -2644,7 +2664,7 @@ class VIEW3D_MT_edit_mesh_specials(Menu):
layout.operator("mesh.merge", text="Merge Vertices...")
layout.operator("mesh.remove_doubles", text="Remove Double Vertices")
layout.operator("mesh.dissolve_verts")
- layout.operator("mesh.delete", text="Delete Vertices").type = "VERT"
+ layout.operator("mesh.delete", text="Delete Vertices").type = 'VERT'
# Edge Select Commands
if select_mode[1]:
@@ -2655,7 +2675,7 @@ class VIEW3D_MT_edit_mesh_specials(Menu):
layout.separator()
layout.operator("mesh.dissolve_edges")
- layout.operator("mesh.delete", text="Delete Edges").type = "EDGE"
+ layout.operator("mesh.delete", text="Delete Edges").type = 'EDGE'
# Face Select Commands
if select_mode[2]:
@@ -2685,7 +2705,7 @@ class VIEW3D_MT_edit_mesh_specials(Menu):
layout.separator()
layout.operator("mesh.dissolve_faces")
- layout.operator("mesh.delete", text="Delete Faces").type = "FACE"
+ layout.operator("mesh.delete", text="Delete Faces").type = 'FACE'
# General Mesh Commands
@@ -2995,17 +3015,21 @@ class VIEW3D_MT_edit_mesh_shading(Menu):
def draw(self, context):
layout = self.layout
- layout.label(text="Faces:")
- layout.operator("mesh.faces_shade_smooth", text="Smooth")
- layout.operator("mesh.faces_shade_flat", text="Flat")
- layout.label(text="Edges:")
- layout.operator("mesh.mark_sharp", text="Smooth").clear = True
- layout.operator("mesh.mark_sharp", text="Sharp")
- layout.label(text="Vertices:")
- props = layout.operator("mesh.mark_sharp", text="Smooth")
+ layout.operator("mesh.faces_shade_smooth", text="Smooth Faces")
+ layout.operator("mesh.faces_shade_flat", text="Flat Faces")
+
+ layout.separator()
+
+ layout.operator("mesh.mark_sharp", text="Smooth Edges").clear = True
+ layout.operator("mesh.mark_sharp", text="Sharp Edges")
+
+ layout.separator()
+
+ props = layout.operator("mesh.mark_sharp", text="Smooth Vertices")
props.use_verts = True
props.clear = True
- layout.operator("mesh.mark_sharp", text="Sharp").use_verts = True
+
+ layout.operator("mesh.mark_sharp", text="Sharp Vertices").use_verts = True
class VIEW3D_MT_edit_mesh_weights(Menu):
@@ -3668,7 +3692,7 @@ class VIEW3D_PT_shading_lighting(Panel):
view = context.space_data
shading = view.shading
- if shading.type in ('SOLID', 'TEXTURED'):
+ if shading.type == 'SOLID':
layout.row().prop(shading, "light", expand=True)
if shading.light == 'STUDIO':
row = layout.row()
@@ -3676,7 +3700,7 @@ class VIEW3D_PT_shading_lighting(Panel):
sub = row.column()
sub.operator('wm.studiolight_userpref_show', emboss=False, text="", icon='PREFERENCES')
if shading.selected_studio_light.orientation == 'WORLD':
- layout.row().prop(shading, "studiolight_rot_z")
+ layout.row().prop(shading, "studiolight_rotate_z")
elif shading.light == 'MATCAP':
row = layout.row()
@@ -3685,13 +3709,13 @@ class VIEW3D_PT_shading_lighting(Panel):
sub.operator('VIEW3D_OT_toggle_matcap_flip', emboss=False, text="", icon='ARROW_LEFTRIGHT')
sub.operator('wm.studiolight_userpref_show', emboss=False, text="", icon='PREFERENCES')
- elif shading.type in ('MATERIAL'):
+ elif shading.type == 'MATERIAL':
row = layout.row()
row.template_icon_view(shading, "studio_light", show_labels=True)
sub = row.column()
sub.operator('wm.studiolight_userpref_show', emboss=False, text="", icon='PREFERENCES')
if shading.selected_studio_light.orientation == 'WORLD':
- layout.row().prop(shading, "studiolight_rot_z")
+ layout.row().prop(shading, "studiolight_rotate_z")
layout.row().prop(shading, "studiolight_background_alpha")
layout.prop(shading, "use_scene_light")
@@ -3730,7 +3754,7 @@ class VIEW3D_PT_shading_options(Panel):
def poll(cls, context):
view = context.space_data
shading = view.shading
- return shading.type in ['SOLID', 'TEXTURED']
+ return shading.type == 'SOLID'
def draw(self, context):
layout = self.layout
@@ -3742,35 +3766,34 @@ class VIEW3D_PT_shading_options(Panel):
row = layout.row()
row.prop(shading, "show_specular_highlight")
- if shading.type in ('SOLID', 'TEXTURED'):
- row = layout.split(0.4)
- row.prop(shading, "show_xray")
- sub = row.row()
- sub.active = shading.show_xray
- sub.prop(shading, "xray_alpha", text="")
-
- row = layout.split(0.4)
- row.active = not shading.show_xray
- row.prop(shading, "show_shadows")
- sub = row.row()
- sub.active = shading.show_shadows and not shading.show_xray
- sub.prop(shading, "shadow_intensity", text="")
-
- row = layout.split(0.4)
- row.active = not shading.show_xray
- row.prop(shading, "show_cavity")
- sub = row.column(align=True)
- sub.active = not shading.show_xray and shading.show_cavity
- sub.prop(shading, "cavity_ridge_factor")
- sub.prop(shading, "cavity_valley_factor")
-
- row = layout.split(0.4)
- row.prop(shading, "show_object_outline")
- sub = row.row()
- sub.active = shading.show_object_outline
- sub.prop(shading, "object_outline_color", text="")
-
- layout.prop(view, "show_world")
+ row = layout.split(0.4)
+ row.prop(shading, "show_xray")
+ sub = row.row()
+ sub.active = shading.show_xray
+ sub.prop(shading, "xray_alpha", text="")
+
+ row = layout.split(0.4)
+ row.active = not shading.show_xray
+ row.prop(shading, "show_shadows")
+ sub = row.row()
+ sub.active = shading.show_shadows and not shading.show_xray
+ sub.prop(shading, "shadow_intensity", text="")
+
+ row = layout.split(0.4)
+ row.active = not shading.show_xray
+ row.prop(shading, "show_cavity")
+ sub = row.column(align=True)
+ sub.active = not shading.show_xray and shading.show_cavity
+ sub.prop(shading, "cavity_ridge_factor")
+ sub.prop(shading, "cavity_valley_factor")
+
+ row = layout.split(0.4)
+ row.prop(shading, "show_object_outline")
+ sub = row.row()
+ sub.active = shading.show_object_outline
+ sub.prop(shading, "object_outline_color", text="")
+
+ layout.prop(view, "show_world")
class VIEW3D_PT_overlay(Panel):
@@ -3808,7 +3831,7 @@ class VIEW3D_PT_overlay(Panel):
#sub.prop(overlay, "show_onion_skins")
sub.prop(overlay, "show_face_orientation")
sub.prop(overlay, "show_backface_culling")
- if shading.type == "MATERIAL":
+ if shading.type == 'MATERIAL':
sub.prop(overlay, "show_look_dev")
row = col.row()
@@ -3868,6 +3891,7 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
data = context.active_object.data
statvis = tool_settings.statvis
with_freestyle = bpy.app.build_options.freestyle
+ show_developer_ui = context.user_preferences.view.show_developer_ui
col = layout.column()
col.active = display_all
@@ -3890,7 +3914,7 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
sub.prop(data, "show_extra_face_area", text="Face Area")
sub.prop(data, "show_extra_face_angle", text="Face Angle")
- if bpy.app.debug:
+ if show_developer_ui:
sub.prop(data, "show_extra_indices", text="Indices")
if with_freestyle:
@@ -4043,12 +4067,20 @@ class VIEW3D_PT_overlay_paint(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'HEADER'
bl_parent_id = 'VIEW3D_PT_overlay'
- bl_label = "Paint"
+ bl_label = ""
@classmethod
def poll(cls, context):
return context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}
+ def draw_header(self, context):
+ layout = self.layout
+ layout.label(text={
+ 'PAINT_TEXTURE': "Texture Paint",
+ 'PAINT_VERTEX': "Vertex Paint",
+ 'PAINT_WEIGHT': "Weight Paint",
+ }[context.mode])
+
def draw(self, context):
layout = self.layout
view = context.space_data
@@ -4058,11 +4090,15 @@ class VIEW3D_PT_overlay_paint(Panel):
col = layout.column()
col.active = display_all
+ col.prop(overlay, {
+ 'PAINT_TEXTURE': "texture_paint_mode_opacity",
+ 'PAINT_VERTEX': "vertex_paint_mode_opacity",
+ 'PAINT_WEIGHT': "weight_paint_mode_opacity",
+ }[context.mode], text="Opacity")
+
if context.mode in {'PAINT_WEIGHT', 'PAINT_VERTEX'}:
col.prop(overlay, "show_paint_wire")
- col.prop(view, "show_mode_shade_override")
-
class VIEW3D_PT_quad_view(Panel):
bl_space_type = 'VIEW_3D'
@@ -4131,33 +4167,6 @@ class VIEW3D_PT_view3d_stereo(Panel):
split.prop(view, "stereo_3d_volume_alpha", text="Alpha")
-class VIEW3D_PT_transform_orientations(Panel):
- bl_space_type = 'VIEW_3D'
- bl_region_type = 'UI'
- bl_label = "Transform Orientations"
- bl_options = {'DEFAULT_CLOSED'}
-
- @classmethod
- def poll(cls, context):
- view = context.space_data
- return (view)
-
- def draw(self, context):
- layout = self.layout
-
- scene = context.scene
- orientation = scene.current_orientation
-
- row = layout.row(align=True)
- row.prop(scene, "transform_orientation", text="")
- row.operator("transform.create_orientation", text="", icon='ZOOMIN')
-
- if orientation:
- row = layout.row(align=True)
- row.prop(orientation, "name", text="")
- row.operator("transform.delete_orientation", text="", icon='X')
-
-
class VIEW3D_PT_context_properties(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
@@ -4345,7 +4354,6 @@ classes = (
VIEW3D_PT_overlay_pose,
VIEW3D_PT_overlay_paint,
VIEW3D_PT_overlay_sculpt,
- VIEW3D_PT_transform_orientations,
VIEW3D_PT_context_properties,
)
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 390c5bd0abd..a81dfdcfb09 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1021,7 +1021,6 @@ class VIEW3D_PT_sculpt_symmetry(Panel, View3DPaintPanel):
row.prop(sculpt, "lock_y", text="Y", toggle=True)
row.prop(sculpt, "lock_z", text="Z", toggle=True)
-
split = layout.split()
col = split.column()
diff --git a/release/scripts/templates_py/addon_add_object.py b/release/scripts/templates_py/addon_add_object.py
index 56e6e79b94f..b74c0f8ee25 100644
--- a/release/scripts/templates_py/addon_add_object.py
+++ b/release/scripts/templates_py/addon_add_object.py
@@ -8,7 +8,7 @@ bl_info = {
"warning": "",
"wiki_url": "",
"category": "Add Mesh",
- }
+}
import bpy
@@ -22,11 +22,12 @@ def add_object(self, context):
scale_x = self.scale.x
scale_y = self.scale.y
- verts = [Vector((-1 * scale_x, 1 * scale_y, 0)),
- Vector((1 * scale_x, 1 * scale_y, 0)),
- Vector((1 * scale_x, -1 * scale_y, 0)),
- Vector((-1 * scale_x, -1 * scale_y, 0)),
- ]
+ verts = [
+ Vector((-1 * scale_x, 1 * scale_y, 0)),
+ Vector((1 * scale_x, 1 * scale_y, 0)),
+ Vector((1 * scale_x, -1 * scale_y, 0)),
+ Vector((-1 * scale_x, -1 * scale_y, 0)),
+ ]
edges = []
faces = [[0, 1, 2, 3]]
@@ -45,11 +46,11 @@ class OBJECT_OT_add_object(Operator, AddObjectHelper):
bl_options = {'REGISTER', 'UNDO'}
scale = FloatVectorProperty(
- name="scale",
- default=(1.0, 1.0, 1.0),
- subtype='TRANSLATION',
- description="scaling",
- )
+ name="scale",
+ default=(1.0, 1.0, 1.0),
+ subtype='TRANSLATION',
+ description="scaling",
+ )
def execute(self, context):
@@ -72,7 +73,7 @@ def add_object_manual_map():
url_manual_prefix = "https://docs.blender.org/manual/en/dev/"
url_manual_mapping = (
("bpy.ops.mesh.add_object", "editors/3dview/object"),
- )
+ )
return url_manual_prefix, url_manual_mapping
diff --git a/release/scripts/templates_py/background_job.py b/release/scripts/templates_py/background_job.py
index ddd8ce1384e..2f444641a51 100644
--- a/release/scripts/templates_py/background_job.py
+++ b/release/scripts/templates_py/background_job.py
@@ -73,21 +73,27 @@ def main():
# When --help or no args are given, print this help
usage_text = (
- "Run blender in background mode with this script:"
- " blender --background --python " + __file__ + " -- [options]"
- )
+ "Run blender in background mode with this script:"
+ " blender --background --python " + __file__ + " -- [options]"
+ )
parser = argparse.ArgumentParser(description=usage_text)
# Example utility, add some text and renders or saves it (with options)
# Possible types are: string, int, long, choice, float and complex.
- parser.add_argument("-t", "--text", dest="text", type=str, required=True,
- help="This text will be used to render an image")
-
- parser.add_argument("-s", "--save", dest="save_path", metavar='FILE',
- help="Save the generated file to the specified path")
- parser.add_argument("-r", "--render", dest="render_path", metavar='FILE',
- help="Render an image to the specified path")
+ parser.add_argument(
+ "-t", "--text", dest="text", type=str, required=True,
+ help="This text will be used to render an image",
+ )
+
+ parser.add_argument(
+ "-s", "--save", dest="save_path", metavar='FILE',
+ help="Save the generated file to the specified path",
+ )
+ parser.add_argument(
+ "-r", "--render", dest="render_path", metavar='FILE',
+ help="Render an image to the specified path",
+ )
args = parser.parse_args(argv) # In this example we wont use the args
diff --git a/release/scripts/templates_py/batch_export.py b/release/scripts/templates_py/batch_export.py
index 8de7a5e2903..1463915886a 100644
--- a/release/scripts/templates_py/batch_export.py
+++ b/release/scripts/templates_py/batch_export.py
@@ -28,7 +28,7 @@ for obj in selection:
bpy.ops.export_scene.fbx(filepath=fn + ".fbx", use_selection=True)
- ## Can be used for multiple formats
+ # Can be used for multiple formats
# bpy.ops.export_scene.x3d(filepath=fn + ".x3d", use_selection=True)
obj.select_set(action='DESELECT')
diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py
index 8ca748c1d66..23d8ee55e72 100644
--- a/release/scripts/templates_py/custom_nodes.py
+++ b/release/scripts/templates_py/custom_nodes.py
@@ -124,6 +124,8 @@ from nodeitems_utils import NodeCategory, NodeItem
# our own base class with an appropriate poll function,
# so the categories only show up in our own tree type
+
+
class MyNodeCategory(NodeCategory):
@classmethod
def poll(cls, context):
@@ -159,6 +161,7 @@ classes = (
MyCustomNode,
)
+
def register():
from bpy.utils import register_class
for cls in classes:
diff --git a/release/scripts/templates_py/manipulator_operator.py b/release/scripts/templates_py/manipulator_operator.py
index c16de53e694..35e1c5b4fd1 100644
--- a/release/scripts/templates_py/manipulator_operator.py
+++ b/release/scripts/templates_py/manipulator_operator.py
@@ -16,6 +16,7 @@ from bpy.props import (
FloatVectorProperty,
)
+
def main(context, plane_co, plane_no):
obj = context.active_object
matrix = obj.matrix_world.copy()
@@ -218,6 +219,7 @@ classes = (
SelectSideOfPlaneManipulatorGroup,
)
+
def register():
for cls in classes:
bpy.utils.register_class(cls)
@@ -227,5 +229,6 @@ def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/manipulator_operator_target.py b/release/scripts/templates_py/manipulator_operator_target.py
index 0abf6f2f654..ba53b5e10ff 100644
--- a/release/scripts/templates_py/manipulator_operator_target.py
+++ b/release/scripts/templates_py/manipulator_operator_target.py
@@ -8,6 +8,7 @@ from bpy.types import (
ManipulatorGroup,
)
+
class MyCameraWidgetGroup(ManipulatorGroup):
bl_idname = "OBJECT_WGT_test_camera"
bl_label = "Object Camera Test Widget"
@@ -45,4 +46,5 @@ class MyCameraWidgetGroup(ManipulatorGroup):
mpr = self.roll_widget
mpr.matrix_basis = ob.matrix_world.normalized()
+
bpy.utils.register_class(MyCameraWidgetGroup)
diff --git a/release/scripts/templates_py/manipulator_simple.py b/release/scripts/templates_py/manipulator_simple.py
index 7e02940d527..8ddb870cd13 100644
--- a/release/scripts/templates_py/manipulator_simple.py
+++ b/release/scripts/templates_py/manipulator_simple.py
@@ -9,6 +9,7 @@ from bpy.types import (
ManipulatorGroup,
)
+
class MyLampWidgetGroup(ManipulatorGroup):
bl_idname = "OBJECT_WGT_lamp_test"
bl_label = "Test Lamp Widget"
@@ -42,4 +43,5 @@ class MyLampWidgetGroup(ManipulatorGroup):
mpr = self.energy_widget
mpr.matrix_basis = ob.matrix_world.normalized()
+
bpy.utils.register_class(MyLampWidgetGroup)
diff --git a/release/scripts/templates_py/operator_file_export.py b/release/scripts/templates_py/operator_file_export.py
index 38c88069845..8a1eb4ae54c 100644
--- a/release/scripts/templates_py/operator_file_export.py
+++ b/release/scripts/templates_py/operator_file_export.py
@@ -26,26 +26,28 @@ class ExportSomeData(Operator, ExportHelper):
filename_ext = ".txt"
filter_glob = StringProperty(
- default="*.txt",
- options={'HIDDEN'},
- maxlen=255, # Max internal buffer length, longer would be clamped.
- )
+ default="*.txt",
+ options={'HIDDEN'},
+ maxlen=255, # Max internal buffer length, longer would be clamped.
+ )
# List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling.
use_setting = BoolProperty(
- name="Example Boolean",
- description="Example Tooltip",
- default=True,
- )
+ name="Example Boolean",
+ description="Example Tooltip",
+ default=True,
+ )
type = EnumProperty(
- name="Example Enum",
- description="Choose between two items",
- items=(('OPT_A', "First Option", "Description one"),
- ('OPT_B', "Second Option", "Description two")),
- default='OPT_A',
- )
+ name="Example Enum",
+ description="Choose between two items",
+ items=(
+ ('OPT_A', "First Option", "Description one"),
+ ('OPT_B', "Second Option", "Description two"),
+ ),
+ default='OPT_A',
+ )
def execute(self, context):
return write_some_data(context, self.filepath, self.use_setting)
diff --git a/release/scripts/templates_py/operator_file_import.py b/release/scripts/templates_py/operator_file_import.py
index 0ec57544f3d..9856b6a9040 100644
--- a/release/scripts/templates_py/operator_file_import.py
+++ b/release/scripts/templates_py/operator_file_import.py
@@ -29,26 +29,28 @@ class ImportSomeData(Operator, ImportHelper):
filename_ext = ".txt"
filter_glob = StringProperty(
- default="*.txt",
- options={'HIDDEN'},
- maxlen=255, # Max internal buffer length, longer would be clamped.
- )
+ default="*.txt",
+ options={'HIDDEN'},
+ maxlen=255, # Max internal buffer length, longer would be clamped.
+ )
# List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling.
use_setting = BoolProperty(
- name="Example Boolean",
- description="Example Tooltip",
- default=True,
- )
+ name="Example Boolean",
+ description="Example Tooltip",
+ default=True,
+ )
type = EnumProperty(
- name="Example Enum",
- description="Choose between two items",
- items=(('OPT_A', "First Option", "Description one"),
- ('OPT_B', "Second Option", "Description two")),
- default='OPT_A',
- )
+ name="Example Enum",
+ description="Choose between two items",
+ items=(
+ ('OPT_A', "First Option", "Description one"),
+ ('OPT_B', "Second Option", "Description two"),
+ ),
+ default='OPT_A',
+ )
def execute(self, context):
return read_some_data(context, self.filepath, self.use_setting)
diff --git a/release/scripts/templates_py/operator_mesh_add.py b/release/scripts/templates_py/operator_mesh_add.py
index 3231214c773..407956a0fda 100644
--- a/release/scripts/templates_py/operator_mesh_add.py
+++ b/release/scripts/templates_py/operator_mesh_add.py
@@ -8,23 +8,25 @@ def add_box(width, height, depth):
no actual mesh data creation is done here.
"""
- verts = [(+1.0, +1.0, -1.0),
- (+1.0, -1.0, -1.0),
- (-1.0, -1.0, -1.0),
- (-1.0, +1.0, -1.0),
- (+1.0, +1.0, +1.0),
- (+1.0, -1.0, +1.0),
- (-1.0, -1.0, +1.0),
- (-1.0, +1.0, +1.0),
- ]
-
- faces = [(0, 1, 2, 3),
- (4, 7, 6, 5),
- (0, 4, 5, 1),
- (1, 5, 6, 2),
- (2, 6, 7, 3),
- (4, 0, 3, 7),
- ]
+ verts = [
+ (+1.0, +1.0, -1.0),
+ (+1.0, -1.0, -1.0),
+ (-1.0, -1.0, -1.0),
+ (-1.0, +1.0, -1.0),
+ (+1.0, +1.0, +1.0),
+ (+1.0, -1.0, +1.0),
+ (-1.0, -1.0, +1.0),
+ (-1.0, +1.0, +1.0),
+ ]
+
+ faces = [
+ (0, 1, 2, 3),
+ (4, 7, 6, 5),
+ (0, 4, 5, 1),
+ (1, 5, 6, 2),
+ (2, 6, 7, 3),
+ (4, 0, 3, 7),
+ ]
# apply size
for i, v in enumerate(verts):
@@ -48,50 +50,51 @@ class AddBox(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}
width = FloatProperty(
- name="Width",
- description="Box Width",
- min=0.01, max=100.0,
- default=1.0,
- )
+ name="Width",
+ description="Box Width",
+ min=0.01, max=100.0,
+ default=1.0,
+ )
height = FloatProperty(
- name="Height",
- description="Box Height",
- min=0.01, max=100.0,
- default=1.0,
- )
+ name="Height",
+ description="Box Height",
+ min=0.01, max=100.0,
+ default=1.0,
+ )
depth = FloatProperty(
- name="Depth",
- description="Box Depth",
- min=0.01, max=100.0,
- default=1.0,
- )
+ name="Depth",
+ description="Box Depth",
+ min=0.01, max=100.0,
+ default=1.0,
+ )
layers = BoolVectorProperty(
- name="Layers",
- description="Object Layers",
- size=20,
- options={'HIDDEN', 'SKIP_SAVE'},
- )
+ name="Layers",
+ description="Object Layers",
+ size=20,
+ options={'HIDDEN', 'SKIP_SAVE'},
+ )
# generic transform props
view_align = BoolProperty(
- name="Align to View",
- default=False,
- )
+ name="Align to View",
+ default=False,
+ )
location = FloatVectorProperty(
- name="Location",
- subtype='TRANSLATION',
- )
+ name="Location",
+ subtype='TRANSLATION',
+ )
rotation = FloatVectorProperty(
- name="Rotation",
- subtype='EULER',
- )
+ name="Rotation",
+ subtype='EULER',
+ )
def execute(self, context):
- verts_loc, faces = add_box(self.width,
- self.height,
- self.depth,
- )
+ verts_loc, faces = add_box(
+ self.width,
+ self.height,
+ self.depth,
+ )
mesh = bpy.data.meshes.new("Box")
@@ -127,6 +130,7 @@ def unregister():
bpy.utils.unregister_class(AddBox)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/operator_modal_draw.py b/release/scripts/templates_py/operator_modal_draw.py
index d11ddf0b467..6f75d6c632e 100644
--- a/release/scripts/templates_py/operator_modal_draw.py
+++ b/release/scripts/templates_py/operator_modal_draw.py
@@ -75,5 +75,6 @@ def register():
def unregister():
bpy.utils.unregister_class(ModalDrawOperator)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/operator_modal_view3d.py b/release/scripts/templates_py/operator_modal_view3d.py
index c870bbffdcf..65bab3489b4 100644
--- a/release/scripts/templates_py/operator_modal_view3d.py
+++ b/release/scripts/templates_py/operator_modal_view3d.py
@@ -9,9 +9,9 @@ class ViewOperator(bpy.types.Operator):
bl_label = "Simple View Operator"
offset = FloatVectorProperty(
- name="Offset",
- size=3,
- )
+ name="Offset",
+ size=3,
+ )
def execute(self, context):
v3d = context.space_data
diff --git a/release/scripts/templates_py/ui_menu.py b/release/scripts/templates_py/ui_menu.py
index a21e5ed86c8..36391a54f4e 100644
--- a/release/scripts/templates_py/ui_menu.py
+++ b/release/scripts/templates_py/ui_menu.py
@@ -42,6 +42,7 @@ def unregister():
bpy.types.INFO_HT_header.remove(draw_item)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/ui_menu_simple.py b/release/scripts/templates_py/ui_menu_simple.py
index 2129dfd81a4..aaad92d0e19 100644
--- a/release/scripts/templates_py/ui_menu_simple.py
+++ b/release/scripts/templates_py/ui_menu_simple.py
@@ -19,6 +19,7 @@ def register():
def unregister():
bpy.utils.unregister_class(SimpleCustomMenu)
+
if __name__ == "__main__":
register()
diff --git a/release/scripts/templates_py/ui_previews_dynamic_enum.py b/release/scripts/templates_py/ui_previews_dynamic_enum.py
index 0cfa232116d..39a3750bfee 100644
--- a/release/scripts/templates_py/ui_previews_dynamic_enum.py
+++ b/release/scripts/templates_py/ui_previews_dynamic_enum.py
@@ -89,19 +89,19 @@ preview_collections = {}
def register():
from bpy.types import WindowManager
from bpy.props import (
- StringProperty,
- EnumProperty,
- )
+ StringProperty,
+ EnumProperty,
+ )
WindowManager.my_previews_dir = StringProperty(
- name="Folder Path",
- subtype='DIR_PATH',
- default=""
- )
+ name="Folder Path",
+ subtype='DIR_PATH',
+ default=""
+ )
WindowManager.my_previews = EnumProperty(
- items=enum_previews_from_directory_items,
- )
+ items=enum_previews_from_directory_items,
+ )
# Note that preview collections returned by bpy.utils.previews
# are regular Python objects - you can use them to store custom data.
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index f9260ecebc5..acc354a9d0a 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -28,4 +28,3 @@ if(WITH_LEGACY_OPENGL)
endif()
add_subdirectory(blender)
-
diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc
index b98d82f0c7d..87545007870 100644
--- a/source/blender/alembic/intern/abc_customdata.cc
+++ b/source/blender/alembic/intern/abc_customdata.cc
@@ -27,6 +27,14 @@
#include <Alembic/AbcGeom/All.h>
#include <algorithm>
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900)
+#include <unordered_map>
+typedef std::unordered_map<uint64_t, int> uv_index_map;
+#else
+#include <map>
+typedef std::map<uint64_t, int> uv_index_map;
+#endif
+
extern "C" {
#include "DNA_customdata_types.h"
#include "DNA_meshdata_types.h"
@@ -51,6 +59,27 @@ using Alembic::Abc::V2fArraySample;
using Alembic::AbcGeom::OV2fGeomParam;
using Alembic::AbcGeom::OC4fGeomParam;
+
+static inline uint64_t uv_to_hash_key(Imath::V2f v)
+{
+ /* Convert -0.0f to 0.0f, so bitwise comparison works. */
+ if (v.x == 0.0f) {
+ v.x = 0.0f;
+ }
+ if (v.y == 0.0f) {
+ v.y = 0.0f;
+ }
+
+ /* Pack floats in 64bit. */
+ union {
+ float xy[2];
+ uint64_t key;
+ } tmp;
+ tmp.xy[0] = v.x;
+ tmp.xy[1] = v.y;
+ return tmp.key;
+}
+
static void get_uvs(const CDStreamConfig &config,
std::vector<Imath::V2f> &uvs,
std::vector<uint32_t> &uvidx,
@@ -84,6 +113,9 @@ static void get_uvs(const CDStreamConfig &config,
}
}
else {
+ uv_index_map idx_map;
+ int idx_count = 0;
+
for (int i = 0; i < num_poly; ++i) {
MPoly &current_poly = polygons[i];
MLoopUV *loopuvpoly = mloopuv_array + current_poly.loopstart + current_poly.totloop;
@@ -91,15 +123,15 @@ static void get_uvs(const CDStreamConfig &config,
for (int j = 0; j < current_poly.totloop; ++j) {
loopuvpoly--;
Imath::V2f uv(loopuvpoly->uv[0], loopuvpoly->uv[1]);
-
- std::vector<Imath::V2f>::iterator it = std::find(uvs.begin(), uvs.end(), uv);
-
- if (it == uvs.end()) {
- uvidx.push_back(uvs.size());
+ uint64_t k = uv_to_hash_key(uv);
+ uv_index_map::iterator it = idx_map.find(k);
+ if (it == idx_map.end()) {
+ idx_map[k] = idx_count;
uvs.push_back(uv);
+ uvidx.push_back(idx_count++);
}
else {
- uvidx.push_back(std::distance(uvs.begin(), it));
+ uvidx.push_back(it->second);
}
}
}
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc
index 45e2b68f94d..d050f3b78b1 100644
--- a/source/blender/alembic/intern/abc_exporter.cc
+++ b/source/blender/alembic/intern/abc_exporter.cc
@@ -158,7 +158,7 @@ static bool export_object(const ExportSettings * const settings, const Base * co
return false;
}
// FIXME Sybren: handle these cleanly (maybe just remove code), now using active scene layer instead.
- if (settings->visible_layers_only && (ob_base->flag & BASE_VISIBLED) == 0) {
+ if (settings->visible_layers_only && (ob_base->flag & BASE_VISIBLE) == 0) {
return false;
}
}
diff --git a/source/blender/alembic/intern/alembic_capi.cc b/source/blender/alembic/intern/alembic_capi.cc
index cc9923189c7..79dfb8c2b58 100644
--- a/source/blender/alembic/intern/alembic_capi.cc
+++ b/source/blender/alembic/intern/alembic_capi.cc
@@ -852,6 +852,7 @@ static void import_endjob(void *user_data)
base = BKE_view_layer_base_find(view_layer, ob);
BKE_view_layer_base_select(view_layer, base);
+ DEG_id_tag_update(&lc->collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_id_tag_update_ex(data->bmain, &ob->id,
OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME | DEG_TAG_BASE_FLAGS_UPDATE);
}
diff --git a/source/blender/avi/intern/avi_intern.h b/source/blender/avi/intern/avi_intern.h
index b2fec1edfc1..6261b8140be 100644
--- a/source/blender/avi/intern/avi_intern.h
+++ b/source/blender/avi/intern/avi_intern.h
@@ -67,4 +67,3 @@ int avi_get_format_fcc(AviFormat format);
int avi_get_format_compression(AviFormat format);
#endif
-
diff --git a/source/blender/avi/intern/avi_options.c b/source/blender/avi/intern/avi_options.c
index f6da824a9f7..d59a8a0118a 100644
--- a/source/blender/avi/intern/avi_options.c
+++ b/source/blender/avi/intern/avi_options.c
@@ -129,4 +129,3 @@ AviError AVI_set_compress_option(AviMovie *movie, int option_type, int stream, A
return AVI_ERROR_NONE;
}
-
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 1289dc6c5a6..b3ab36f7bcc 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -183,16 +183,13 @@ void blf_batch_draw(void)
if (g_batch.glyph_len == 0)
return;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* We need to flush widget base first to ensure correct ordering. */
UI_widgetbase_draw_cache_flush();
- BLI_assert(g_batch.tex_bind_state != 0); /* must still be valid */
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, g_batch.tex_bind_state);
-
+ GPU_texture_bind(g_batch.tex_bind_state, 0);
GWN_vertbuf_vertex_count_set(g_batch.verts, g_batch.glyph_len);
GWN_vertbuf_use(g_batch.verts); /* send data */
@@ -201,7 +198,7 @@ void blf_batch_draw(void)
GWN_batch_uniform_1i(g_batch.batch, "glyph", 0);
GWN_batch_draw(g_batch.batch);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* restart to 1st vertex data pointers */
GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.pos_loc, &g_batch.pos_step);
@@ -655,7 +652,7 @@ size_t blf_font_width_to_strlen(FontBLF *font, const char *str, size_t len, floa
int pen_x = 0;
size_t i = 0, i_prev;
GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
- const int width_i = (int)width + 1;
+ const int width_i = (int)width;
int width_new;
BLF_KERNING_VARS(font, has_kerning, kern_mode);
@@ -677,7 +674,7 @@ size_t blf_font_width_to_strlen(FontBLF *font, const char *str, size_t len, floa
pen_x += g->advance_i;
- if (width_i < pen_x) {
+ if (width_i <= pen_x) {
break;
}
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 5a87c726566..84388bedb7b 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -57,6 +57,7 @@
#ifndef BLF_STANDALONE
# include "GPU_immediate.h"
+# include "GPU_extensions.h"
#endif
#include "blf_internal_types.h"
@@ -146,7 +147,7 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
memset(gc->bucket, 0, sizeof(gc->bucket));
- gc->textures = (GLuint *)MEM_mallocN(sizeof(GLuint) * 256, __func__);
+ gc->textures = (GPUTexture **)MEM_callocN(sizeof(GPUTexture *) * 256, __func__);
gc->textures_len = 256;
gc->texture_current = BLF_TEXTURE_UNSET;
gc->offset_x = 3; /* enough padding for blur */
@@ -196,16 +197,17 @@ void blf_glyph_cache_clear(FontBLF *font)
void blf_glyph_cache_free(GlyphCacheBLF *gc)
{
GlyphBLF *g;
- int i;
+ unsigned int i;
for (i = 0; i < 257; i++) {
while ((g = BLI_pophead(&gc->bucket[i]))) {
blf_glyph_free(g);
}
}
-
- if (gc->texture_current != BLF_TEXTURE_UNSET) {
- glDeleteTextures((int)gc->texture_current + 1, gc->textures);
+ for (i = 0; i < gc->textures_len; i++) {
+ if (gc->textures[i]) {
+ GPU_texture_free(gc->textures[i]);
+ }
}
MEM_freeN(gc->textures);
MEM_freeN(gc);
@@ -214,13 +216,14 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc)
static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
{
int i;
+ char error[256];
/* move the index. */
gc->texture_current++;
if (UNLIKELY(gc->texture_current >= gc->textures_len)) {
gc->textures_len *= 2;
- gc->textures = MEM_reallocN((void *)gc->textures, sizeof(GLuint) * gc->textures_len);
+ gc->textures = MEM_recallocN((void *)gc->textures, sizeof(GPUTexture *) * gc->textures_len);
}
gc->p2_width = (int)blf_next_p2((unsigned int)((gc->glyphs_len_free * gc->glyph_width_max) + (gc->pad * 2)));
@@ -235,16 +238,14 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
gc->p2_height = font->tex_size_max;
}
- glGenTextures(1, &gc->textures[gc->texture_current]);
- glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = gc->textures[gc->texture_current]));
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-
unsigned char *pixels = MEM_callocN((size_t)gc->p2_width * (size_t)gc->p2_height, "BLF texture init");
- glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, gc->p2_width, gc->p2_height, 0, GL_RED, GL_UNSIGNED_BYTE, pixels);
+ GPUTexture *tex = GPU_texture_create_2D(gc->p2_width, gc->p2_height, GPU_R8, (const float *)pixels, error);
MEM_freeN(pixels);
+ gc->textures[gc->texture_current] = tex;
+ GPU_texture_bind(tex, 0);
+ GPU_texture_wrap_mode(tex, false);
+ GPU_texture_filters(tex, GPU_NEAREST, GPU_LINEAR);
+ GPU_texture_unbind(tex);
}
GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)
@@ -437,13 +438,11 @@ void blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
if ((!g->width) || (!g->height))
return;
- glActiveTexture(GL_TEXTURE0);
-
if (g->build_tex == 0) {
GlyphCacheBLF *gc = font->glyph_cache;
if (font->tex_size_max == -1)
- glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->tex_size_max);
+ font->tex_size_max = GPU_max_texture_size();
if (gc->texture_current == BLF_TEXTURE_UNSET) {
blf_glyph_cache_texture(font, gc);
@@ -477,22 +476,7 @@ void blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
BLI_assert(g->height > 0);
}
-
- GLint lsb_first, row_length, alignment;
- glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsb_first);
- glGetIntegerv(GL_UNPACK_ROW_LENGTH, &row_length);
- glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
-
- glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
- glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
- glBindTexture(GL_TEXTURE_2D, g->tex);
- glTexSubImage2D(GL_TEXTURE_2D, 0, g->offset_x, g->offset_y, g->width, g->height, GL_RED, GL_UNSIGNED_BYTE, g->bitmap);
-
- glPixelStorei(GL_UNPACK_LSB_FIRST, lsb_first);
- glPixelStorei(GL_UNPACK_ROW_LENGTH, row_length);
- glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
+ GPU_texture_update_sub(g->tex, g->bitmap, g->offset_x, g->offset_y, 0, g->width, g->height, 0);
g->uv[0][0] = ((float)g->offset_x) / ((float)gc->p2_width);
g->uv[0][1] = ((float)g->offset_y) / ((float)gc->p2_height);
@@ -520,7 +504,8 @@ void blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
if (font->tex_bind_state != g->tex) {
blf_batch_draw();
- glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = g->tex));
+ font->tex_bind_state = g->tex;
+ GPU_texture_bind(font->tex_bind_state, 0);
}
g_batch.tex_bind_state = g->tex;
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index d7b526735d1..999773d0212 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -32,6 +32,7 @@
#define __BLF_INTERNAL_TYPES_H__
#include "../../../intern/gawain/gawain/gwn_vertex_buffer.h"
+#include "GPU_texture.h"
#define BLF_BATCH_DRAW_LEN_MAX 2048 /* in glyph */
@@ -45,7 +46,7 @@ typedef struct BatchBLF {
float ofs[2]; /* copy of font->pos */
float mat[4][4]; /* previous call modelmatrix. */
bool enabled, active, simple_shader;
- unsigned int tex_bind_state;
+ GPUTexture *tex_bind_state;
} BatchBLF;
extern BatchBLF g_batch;
@@ -78,7 +79,7 @@ typedef struct GlyphCacheBLF {
struct GlyphBLF *glyph_ascii_table[256];
/* texture array, to draw the glyphs. */
- unsigned int *textures;
+ GPUTexture **textures;
/* size of the array. */
unsigned int textures_len;
@@ -133,7 +134,7 @@ typedef struct GlyphBLF {
int advance_i;
/* texture id where this glyph is store. */
- unsigned int tex;
+ GPUTexture *tex;
/* position inside the texture where this glyph is store. */
int offset_x;
@@ -244,7 +245,7 @@ typedef struct FontBLF {
int tex_size_max;
/* cache current OpenGL texture to save calls into the API */
- unsigned int tex_bind_state;
+ GPUTexture *tex_bind_state;
/* font options. */
int flags;
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 02410f624da..3099875c145 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -378,17 +378,6 @@ int DM_release(DerivedMesh *dm);
*/
void DM_to_mesh(DerivedMesh *dm, struct Mesh *me, struct Object *ob, CustomDataMask mask, bool take_ownership);
-struct BMEditMesh *DM_to_editbmesh(
- struct DerivedMesh *dm,
- struct BMEditMesh *existing, const bool do_tessellate);
-
-/* conversion to bmesh only */
-void DM_to_bmesh_ex(struct DerivedMesh *dm, struct BMesh *bm, const bool calc_face_normal);
-struct BMesh *DM_to_bmesh(struct DerivedMesh *dm, const bool calc_face_normal);
-
-
-/** Utility function to convert a DerivedMesh to a shape key block */
-void DM_to_meshkey(DerivedMesh *dm, struct Mesh *me, struct KeyBlock *kb);
void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask);
@@ -518,9 +507,6 @@ void DM_interp_poly_data(
int *src_indices,
float *weights, int count, int dest_index);
-/* Temporary? A function to give a colorband to derivedmesh for vertexcolor ranges */
-void vDM_ColorBand_store(const struct ColorBand *coba, const char alert_color[4]);
-
/* UNUSED */
#if 0
/** Simple function to get me->totvert amount of vertices/normals,
@@ -580,7 +566,6 @@ void makeDerivedMesh(
struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct BMEditMesh *em,
CustomDataMask dataMask, const bool build_shapekey_layers);
-void weight_to_rgb(float r_rgb[3], const float weight);
/** Update the weight MCOL preview layer.
* If weights are NULL, use object's active vgroup(s).
* Else, weights must be an array of weight float values.
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 7567adc50dc..106866aff0a 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -214,4 +214,3 @@ void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose);
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 23014accc3f..e1bfb05fb59 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -240,4 +240,3 @@ void BKE_pose_eval_proxy_copy(
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_blender_user_menu.h b/source/blender/blenkernel/BKE_blender_user_menu.h
new file mode 100644
index 00000000000..ff314314646
--- /dev/null
+++ b/source/blender/blenkernel/BKE_blender_user_menu.h
@@ -0,0 +1,49 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BKE_BLENDER_USER_MENU_H__
+#define __BKE_BLENDER_USER_MENU_H__
+
+/** \file BKE_blender_user_menu.h
+ * \ingroup bke
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ListBase;
+struct bUserMenu;
+struct bUserMenuItem;
+
+struct bUserMenu *BKE_blender_user_menu_find(
+ struct ListBase *lb, char space_type, const char *context);
+struct bUserMenu *BKE_blender_user_menu_ensure(
+ struct ListBase *lb, char space_type, const char *context);
+
+struct bUserMenuItem *BKE_blender_user_menu_item_add(struct ListBase *lb, int type);
+void BKE_blender_user_menu_item_free(struct bUserMenuItem *umi);
+void BKE_blender_user_menu_item_free_list(struct ListBase *lb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BKE_BLENDER_USER_MENU_H__ */
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index def7dfd753b..8707fe3e11b 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 19
+#define BLENDER_SUBVERSION 20
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_bmfont.h b/source/blender/blenkernel/BKE_bmfont.h
index 64daa311b9a..3be84c83892 100644
--- a/source/blender/blenkernel/BKE_bmfont.h
+++ b/source/blender/blenkernel/BKE_bmfont.h
@@ -59,4 +59,3 @@ void matrixGlyph(struct ImBuf *ibuf, unsigned short unicode,
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_bmfont_types.h b/source/blender/blenkernel/BKE_bmfont_types.h
index a5be0be6997..31513e4b8f1 100644
--- a/source/blender/blenkernel/BKE_bmfont_types.h
+++ b/source/blender/blenkernel/BKE_bmfont_types.h
@@ -56,4 +56,3 @@ typedef struct bmFont {
} bmFont;
#endif
-
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 9f326d97937..eda1c51bbc2 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -121,4 +121,3 @@ void BKE_brush_scale_size(
void BKE_brush_debug_print_state(struct Brush *br);
#endif
-
diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index eb05e66cf06..476ecb012d8 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -126,7 +126,7 @@ void BKE_camera_view_frame(
bool BKE_camera_view_frame_fit_to_scene(
struct Depsgraph *depsgraph,
- struct Scene *scene, struct ViewLayer *view_layer, struct Object *camera_ob,
+ struct Scene *scene, struct Object *camera_ob,
float r_co[3], float *r_scale);
bool BKE_camera_view_frame_fit_to_coords(
const struct Depsgraph *depsgraph,
@@ -155,4 +155,3 @@ void BKE_camera_background_image_clear(struct Camera *cam);
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 74a90cd20f7..6d96bd6ab7c 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -179,4 +179,3 @@ void CDDM_set_mloop(struct DerivedMesh *dm, struct MLoop *mloop);
void CDDM_set_mpoly(struct DerivedMesh *dm, struct MPoly *mpoly);
#endif
-
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index f0d8e1a1d84..82a8d7f4e43 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -210,10 +210,10 @@ typedef struct ColliderContacts {
} ColliderContacts;
// needed for implicit.c
-int cloth_bvh_objcollision (struct Object *ob, struct ClothModifierData *clmd, float step, float dt );
-int cloth_points_objcollision(struct Object *ob, struct ClothModifierData *clmd, float step, float dt);
+int cloth_bvh_objcollision (struct Depsgraph *depsgraph, struct Object *ob, struct ClothModifierData *clmd, float step, float dt );
+int cloth_points_objcollision(struct Depsgraph *depsgraph, struct Object *ob, struct ClothModifierData *clmd, float step, float dt);
-void cloth_find_point_contacts(struct Object *ob, struct ClothModifierData *clmd, float step, float dt,
+void cloth_find_point_contacts(struct Depsgraph *depsgraph, struct Object *ob, struct ClothModifierData *clmd, float step, float dt,
ColliderContacts **r_collider_contacts, int *r_totcolliders);
void cloth_free_contacts(ColliderContacts *collider_contacts, int totcolliders);
@@ -244,4 +244,3 @@ void cloth_parallel_transport_hair_frame(float mat[3][3], const float dir_old[3]
////////////////////////////////////////////////
#endif
-
diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h
index 7dce3b2c703..175ee61c690 100644
--- a/source/blender/blenkernel/BKE_collection.h
+++ b/source/blender/blenkernel/BKE_collection.h
@@ -96,10 +96,7 @@ bool BKE_collection_object_cyclic_check(struct Main *bmain, struct Object *objec
struct ListBase BKE_collection_object_cache_get(struct Collection *collection);
void BKE_collection_object_cache_free(struct Collection *collection);
-struct Base *BKE_collection_or_layer_objects(const struct Depsgraph *depsgraph,
- const struct Scene *scene,
- const struct ViewLayer *view_layer,
- struct Collection *collection);
+struct Base *BKE_collection_or_layer_objects(const struct ViewLayer *view_layer, struct Collection *collection);
/* Editing. */
@@ -141,7 +138,7 @@ void BKE_scene_objects_callback(struct Scene *scene, BKE_scene_objects_Cb callba
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(_collection, _object, _mode) \
{ \
int _base_flag = (_mode == DAG_EVAL_VIEWPORT) ? \
- BASE_VISIBLE_VIEWPORT : BASE_VISIBLE_RENDER; \
+ BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER; \
int _base_id = 0; \
for (Base *_base = (Base*)BKE_collection_object_cache_get(_collection).first; \
_base; \
diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h
index 2392c92bd84..a082b5be804 100644
--- a/source/blender/blenkernel/BKE_collision.h
+++ b/source/blender/blenkernel/BKE_collision.h
@@ -49,6 +49,7 @@ struct MFace;
struct MVert;
struct Object;
struct Scene;
+struct Depsgraph;
struct MVertTri;
////////////////////////////////////////
@@ -143,14 +144,29 @@ void collision_move_object(struct CollisionModifierData *collmd, float step, flo
void collision_get_collider_velocity(float vel_old[3], float vel_new[3], struct CollisionModifierData *collmd, struct CollPair *collpair);
-/////////////////////////////////////////////////
-// used in effect.c
-/////////////////////////////////////////////////
-/* explicit control over layer mask and dupli recursion */
-struct Object **get_collisionobjects_ext(struct Scene *scene, struct Object *self, struct Collection *collection, unsigned int *numcollobj, unsigned int modifier_type, bool dupli);
+/* Collision relations for dependency graph build. */
+
+typedef struct CollisionRelation {
+ struct CollisionRelation *next, *prev;
+ struct Object *ob;
+} CollisionRelation;
-struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Collection *collection, unsigned int *numcollobj, unsigned int modifier_type);
+struct ListBase *BKE_collision_relations_create(
+ struct Depsgraph *depsgraph,
+ struct Collection *collection,
+ unsigned int modifier_type);
+void BKE_collision_relations_free(struct ListBase *relations);
+
+/* Collision object lists for physics simulation evaluation. */
+
+struct Object **BKE_collision_objects_create(
+ struct Depsgraph *depsgraph,
+ struct Object *self,
+ struct Collection *collection,
+ unsigned int *numcollobj,
+ unsigned int modifier_type);
+void BKE_collision_objects_free(struct Object **objects);
typedef struct ColliderCache {
struct ColliderCache *next, *prev;
@@ -158,8 +174,11 @@ typedef struct ColliderCache {
struct CollisionModifierData *collmd;
} ColliderCache;
-struct ListBase *get_collider_cache(struct Scene *scene, struct Object *self, struct Collection *collection);
-void free_collider_cache(struct ListBase **colliders);
+struct ListBase *BKE_collider_cache_create(
+ struct Depsgraph *scene,
+ struct Object *self,
+ struct Collection *collection);
+void BKE_collider_cache_free(struct ListBase **colliders);
/////////////////////////////////////////////////
@@ -168,4 +187,3 @@ void free_collider_cache(struct ListBase **colliders);
/////////////////////////////////////////////////
#endif
-
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 2bc71c114b7..6f83dbcce59 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -161,4 +161,3 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph, struct ListBase *conlist
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 2ea940b8fee..9fa00e7f63f 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -332,4 +332,3 @@ struct Depsgraph *CTX_data_depsgraph_on_load(const bContext *C);
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 975cea7364d..4843ee9d9b8 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -99,7 +99,7 @@ void BKE_curve_transform(struct Curve *cu, float mat[4][4], const bool do_keys,
void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys);
void BKE_curve_material_index_remove(struct Curve *cu, int index);
void BKE_curve_material_index_clear(struct Curve *cu);
-int BKE_curve_material_index_validate(struct Curve *cu);
+bool BKE_curve_material_index_validate(struct Curve *cu);
void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsigned int remap_len);
ListBase *BKE_curve_nurbs_get(struct Curve *cu);
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index dc9bbf9336e..3941ce07451 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -492,4 +492,3 @@ void CustomData_data_transfer(const struct MeshPairRemap *me_remap, const Custom
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h
index 242897f968f..d7712c9d6d2 100644
--- a/source/blender/blenkernel/BKE_customdata_file.h
+++ b/source/blender/blenkernel/BKE_customdata_file.h
@@ -58,4 +58,3 @@ CDataFileLayer *cdf_layer_find(CDataFile *cdf, int type, const char *name);
CDataFileLayer *cdf_layer_add(CDataFile *cdf, int type, const char *name, size_t datasize);
#endif /* __BKE_CUSTOMDATA_FILE_H__ */
-
diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h
index 6559f9a954f..7d0bb67c54d 100644
--- a/source/blender/blenkernel/BKE_data_transfer.h
+++ b/source/blender/blenkernel/BKE_data_transfer.h
@@ -143,9 +143,9 @@ bool BKE_object_data_transfer_mesh(
const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX],
const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup,
struct ReportList *reports);
-bool BKE_object_data_transfer_dm(
+bool BKE_object_data_transfer_ex(
struct Depsgraph *depsgraph, struct Scene *scene,
- struct Object *ob_src, struct Object *ob_dst, struct DerivedMesh *dm_dst,
+ struct Object *ob_src, struct Object *ob_dst, struct Mesh *me_dst,
const int data_types, bool use_create,
const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode,
struct SpaceTransform *space_transform, const bool auto_transform,
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index a20c5a4240c..a29f4197299 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -116,4 +116,6 @@ void BKE_defvert_extract_vgroup_to_polyweights(
struct MDeformVert *dvert, const int defgroup, const int num_verts, struct MLoop *loops, const int num_loops,
struct MPoly *polys, const int num_polys, float *r_weights, const bool invert_vgroup);
+void BKE_defvert_weight_to_rgb(float r_rgb[3], const float weight);
+
#endif /* __BKE_DEFORM_H__ */
diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h
index acb5e63d32f..12f61116f5f 100644
--- a/source/blender/blenkernel/BKE_dynamicpaint.h
+++ b/source/blender/blenkernel/BKE_dynamicpaint.h
@@ -28,6 +28,8 @@
*/
struct Depsgraph;
+struct DynamicPaintCanvasSettings;
+struct DynamicPaintModifierData;
struct Main;
struct Scene;
struct ViewLayer;
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 379ab3e81b5..3d4154c572b 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -45,6 +45,7 @@ struct ParticleSimulationData;
struct ParticleData;
struct ParticleKey;
struct Depsgraph;
+struct ViewLayer;
struct EffectorWeights *BKE_add_effector_weights(struct Collection *collection);
struct PartDeflect *object_add_collision_fields(int type);
@@ -111,13 +112,35 @@ typedef struct EffectorCache {
int flag;
} EffectorCache;
-void free_partdeflect(struct PartDeflect *pd);
-struct ListBase *pdInitEffectors(
- struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src,
- struct EffectorWeights *weights, bool for_simulation);
-void pdEndEffectors(struct ListBase **effectors);
-void pdPrecalculateEffectors(struct Depsgraph *depsgraph, struct ListBase *effectors);
-void pdDoEffectors(struct ListBase *effectors, struct ListBase *colliders, struct EffectorWeights *weights, struct EffectedPoint *point, float *force, float *impulse);
+typedef struct EffectorRelation {
+ struct EffectorRelation *next, *prev;
+
+ struct Object *ob;
+ struct ParticleSystem *psys;
+ struct PartDeflect *pd;
+} EffectorRelation;
+
+void free_partdeflect(struct PartDeflect *pd);
+
+struct ListBase *BKE_effector_relations_create(
+ struct Depsgraph *depsgraph,
+ struct ViewLayer *view_layer,
+ struct Collection *collection);
+void BKE_effector_relations_free(struct ListBase *lb);
+
+struct ListBase *BKE_effectors_create(
+ struct Depsgraph *depsgraph,
+ struct Object *ob_src,
+ struct ParticleSystem *psys_src,
+ struct EffectorWeights *weights);
+void BKE_effectors_apply(
+ struct ListBase *effectors,
+ struct ListBase *colliders,
+ struct EffectorWeights *weights,
+ struct EffectedPoint *point,
+ float *force,
+ float *impulse);
+void BKE_effectors_free(struct ListBase *lb);
void pd_point_from_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, struct EffectedPoint *point);
void pd_point_from_loc(struct Scene *scene, float *loc, float *vel, int index, struct EffectedPoint *point);
@@ -230,4 +253,3 @@ void BKE_sim_debug_data_clear(void);
void BKE_sim_debug_data_clear_category(const char *category);
#endif
-
diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h
index 8e04fe2c23a..4883f2392b0 100644
--- a/source/blender/blenkernel/BKE_fluidsim.h
+++ b/source/blender/blenkernel/BKE_fluidsim.h
@@ -52,4 +52,3 @@ void fluid_get_bb(struct MVert *mvert, int totvert, float obmat[4][4],
void fluid_estimate_memory(struct Object *ob, struct FluidsimSettings *fss, char *value);
#endif
-
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index d13cd4adff9..3f6d67f5ded 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -108,4 +108,3 @@ void BKE_vfont_clipboard_get(
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_freestyle.h b/source/blender/blenkernel/BKE_freestyle.h
index 073a56e98fc..32bd1c1be7d 100644
--- a/source/blender/blenkernel/BKE_freestyle.h
+++ b/source/blender/blenkernel/BKE_freestyle.h
@@ -70,4 +70,3 @@ void BKE_freestyle_lineset_unique_name(FreestyleConfig *config, FreestyleLineSet
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index badcd5012de..060ed4536a4 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -307,4 +307,3 @@ bool BKE_image_clear_renderslot(struct Image *ima, struct ImageUser *iuser, int
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h
index ca86e90f192..2370908332d 100644
--- a/source/blender/blenkernel/BKE_ipo.h
+++ b/source/blender/blenkernel/BKE_ipo.h
@@ -52,4 +52,3 @@ void BKE_ipo_free(struct Ipo *ipo);
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index 2f953e57d71..0af608a926d 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -102,7 +102,7 @@ void BKE_keyblock_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, s
void BKE_keyblock_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
void BKE_keyblock_update_from_mesh(struct Mesh *me, struct KeyBlock *kb);
-void BKE_keyblock_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb);
+void BKE_keyblock_convert_from_mesh(struct Mesh *me, struct Key *key, struct KeyBlock *kb);
void BKE_keyblock_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me);
void BKE_keyblock_mesh_calc_normals(
struct KeyBlock *kb, struct Mesh *mesh, float (*r_vertnors)[3], float (*r_polynors)[3], float (*r_loopnors)[3]);
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 28bc254f25a..aaf53a2396b 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -208,6 +208,8 @@ void BKE_library_make_local(
void BKE_id_tag_set_atomic(struct ID *id, int tag);
void BKE_id_tag_clear_atomic(struct ID *id, int tag);
+bool BKE_id_is_in_gobal_main(struct ID *id);
+
/* use when "" is given to new_id() */
#define ID_FALLBACK_NAME N_("Untitled")
diff --git a/source/blender/blenkernel/BKE_library_override.h b/source/blender/blenkernel/BKE_library_override.h
index 6f32d565562..4792d203d23 100644
--- a/source/blender/blenkernel/BKE_library_override.h
+++ b/source/blender/blenkernel/BKE_library_override.h
@@ -62,10 +62,10 @@ struct IDOverrideStaticPropertyOperation *BKE_override_static_property_operation
void BKE_override_static_property_operation_delete(
struct IDOverrideStaticProperty *override_property, struct IDOverrideStaticPropertyOperation *override_property_operation);
-bool BKE_override_static_status_check_local(struct ID *local);
-bool BKE_override_static_status_check_reference(struct ID *local);
+bool BKE_override_static_status_check_local(struct Main *bmain, struct ID *local);
+bool BKE_override_static_status_check_reference(struct Main *bmain, struct ID *local);
-bool BKE_override_static_operations_create(struct ID *local, const bool force_auto);
+bool BKE_override_static_operations_create(struct Main *bmain, struct ID *local, const bool force_auto);
void BKE_main_override_static_operations_create(struct Main *bmain, const bool force_auto);
void BKE_override_static_update(struct Main *bmain, struct ID *local);
@@ -78,7 +78,8 @@ void BKE_main_override_static_update(struct Main *bmain);
typedef struct Main OverrideStaticStorage;
OverrideStaticStorage *BKE_override_static_operations_store_initialize(void);
-struct ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_storage, struct ID *local);
+struct ID *BKE_override_static_operations_store_start(
+ struct Main *bmain, OverrideStaticStorage *override_storage, struct ID *local);
void BKE_override_static_operations_store_end(OverrideStaticStorage *override_storage, struct ID *local);
void BKE_override_static_operations_store_finalize(OverrideStaticStorage *override_storage);
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 1fd6fe1adae..a577b5e4ae3 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -470,9 +470,9 @@ void BKE_mesh_calc_relative_deform(
/* *** mesh_validate.c *** */
-int BKE_mesh_validate(struct Mesh *me, const int do_verbose, const int cddata_check_mask);
+bool BKE_mesh_validate(struct Mesh *me, const bool do_verbose, const bool cddata_check_mask);
bool BKE_mesh_is_valid(struct Mesh *me);
-int BKE_mesh_validate_material_indices(struct Mesh *me);
+bool BKE_mesh_validate_material_indices(struct Mesh *me);
bool BKE_mesh_validate_arrays(
struct Mesh *me,
diff --git a/source/blender/blenkernel/BKE_mesh_iterators.h b/source/blender/blenkernel/BKE_mesh_iterators.h
index cbf156b8052..70c10806350 100644
--- a/source/blender/blenkernel/BKE_mesh_iterators.h
+++ b/source/blender/blenkernel/BKE_mesh_iterators.h
@@ -24,7 +24,7 @@
#ifndef __BKE_MESH_ITERATORS_H__
#define __BKE_MESH_ITERATORS_H__
-/** \file BKE_MESH_ITERATORS.h
+/** \file BKE_mesh_iterators.h
* \ingroup bke
*/
@@ -62,4 +62,6 @@ void BKE_mesh_foreach_mapped_face_center(
void *userData,
MeshForeachFlag flag);
+void BKE_mesh_foreach_mapped_vert_coords_get(struct Mesh *me_eval, float (*r_cos)[3], const int totcos);
+
#endif /* __BKE_MESH_ITERATORS_H__ */
diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h
index 5c77ab8a94e..7aea856ff34 100644
--- a/source/blender/blenkernel/BKE_mesh_remap.h
+++ b/source/blender/blenkernel/BKE_mesh_remap.h
@@ -26,7 +26,7 @@
*/
struct CustomData;
-struct DerivedMesh;
+struct Mesh;
struct MVert;
struct MemArena;
@@ -140,39 +140,37 @@ enum {
MREMAP_MODE_TOPOLOGY = MREMAP_MODE_VERT | MREMAP_MODE_EDGE | MREMAP_MODE_LOOP | MREMAP_MODE_POLY,
};
-float BKE_mesh_remap_calc_difference_from_dm(
+float BKE_mesh_remap_calc_difference_from_mesh(
const struct SpaceTransform *space_transform,
- const struct MVert *verts_dst, const int numverts_dst, struct DerivedMesh *dm_src);
+ const struct MVert *verts_dst, const int numverts_dst, struct Mesh *me_src);
-void BKE_mesh_remap_find_best_match_from_dm(
- const struct MVert *verts_dst, const int numverts_dst, struct DerivedMesh *dm_src,
+void BKE_mesh_remap_find_best_match_from_mesh(
+ const struct MVert *verts_dst, const int numverts_dst, struct Mesh *me_src,
struct SpaceTransform *r_space_transform);
-/* TODO add mesh2mesh versions (we'll need mesh versions of bvhtree funcs too, though!). */
-
-void BKE_mesh_remap_calc_verts_from_dm(
+void BKE_mesh_remap_calc_verts_from_mesh(
const int mode, const struct SpaceTransform *space_transform, const float max_dist, const float ray_radius,
const struct MVert *verts_dst, const int numverts_dst, const bool dirty_nors_dst,
- struct DerivedMesh *dm_src, MeshPairRemap *r_map);
+ struct Mesh *me_src, MeshPairRemap *r_map);
-void BKE_mesh_remap_calc_edges_from_dm(
+void BKE_mesh_remap_calc_edges_from_mesh(
const int mode, const struct SpaceTransform *space_transform, const float max_dist, const float ray_radius,
const struct MVert *verts_dst, const int numverts_dst, const struct MEdge *edges_dst, const int numedges_dst,
- const bool dirty_nors_dst, struct DerivedMesh *dm_src, MeshPairRemap *r_map);
+ const bool dirty_nors_dst, struct Mesh *me_src, MeshPairRemap *r_map);
-void BKE_mesh_remap_calc_loops_from_dm(
+void BKE_mesh_remap_calc_loops_from_mesh(
const int mode, const struct SpaceTransform *space_transform, const float max_dist, const float ray_radius,
struct MVert *verts_dst, const int numverts_dst, struct MEdge *edges_dst, const int numedges_dst,
struct MLoop *loops_dst, const int numloops_dst, struct MPoly *polys_dst, const int numpolys_dst,
struct CustomData *ldata_dst, struct CustomData *pdata_dst,
const bool use_split_nors_dst, const float split_angle_dst, const bool dirty_nors_dst,
- struct DerivedMesh *dm_src, const bool use_split_nors_src, const float split_angle_src,
+ struct Mesh *me_src,
MeshRemapIslandsCalc gen_islands_src, const float islands_precision_src, struct MeshPairRemap *r_map);
-void BKE_mesh_remap_calc_polys_from_dm(
+void BKE_mesh_remap_calc_polys_from_mesh(
const int mode, const struct SpaceTransform *space_transform, const float max_dist, const float ray_radius,
struct MVert *verts_dst, const int numverts_dst, struct MLoop *loops_dst, const int numloops_dst,
struct MPoly *polys_dst, const int numpolys_dst, struct CustomData *pdata_dst, const bool dirty_nors_dst,
- struct DerivedMesh *dm_src, struct MeshPairRemap *r_map);
+ struct Mesh *me_src, struct MeshPairRemap *r_map);
#endif /* __BKE_MESH_REMAP_H__ */
diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h b/source/blender/blenkernel/BKE_mesh_runtime.h
index 6904ad529de..f894f72e648 100644
--- a/source/blender/blenkernel/BKE_mesh_runtime.h
+++ b/source/blender/blenkernel/BKE_mesh_runtime.h
@@ -35,7 +35,10 @@
#include "BKE_customdata.h" /* for CustomDataMask */
+struct ColorBand;
+struct CustomData;
struct Depsgraph;
+struct KeyBlock;
struct Mesh;
struct MLoop;
struct MLoopTri;
@@ -82,4 +85,17 @@ struct Mesh *mesh_get_eval_deform(
struct Depsgraph *depsgraph, struct Scene *scene,
struct Object *ob, CustomDataMask dataMask);
+void BKE_mesh_runtime_eval_to_meshkey(struct Mesh *me_deformed, struct Mesh *me, struct KeyBlock *kb);
+
+/* Temporary? A function to give a colorband to derivedmesh for vertexcolor ranges */
+void BKE_mesh_runtime_color_band_store(const struct ColorBand *coba, const char alert_color[4]);
+
+
+#ifndef NDEBUG
+char *BKE_mesh_runtime_debug_info(struct Mesh *me_eval);
+void BKE_mesh_runtime_debug_print(struct Mesh *me_eval);
+void BKE_mesh_runtime_debug_print_cdlayers(struct CustomData *data);
+bool BKE_mesh_runtime_is_valid(struct Mesh *me_eval);
+#endif /* NDEBUG */
+
#endif /* __BKE_MESH_RUNTIME_H__ */
diff --git a/source/blender/blenkernel/BKE_mesh_tangent.h b/source/blender/blenkernel/BKE_mesh_tangent.h
index cb3100c1c2f..6d359a0653c 100644
--- a/source/blender/blenkernel/BKE_mesh_tangent.h
+++ b/source/blender/blenkernel/BKE_mesh_tangent.h
@@ -58,4 +58,3 @@ void BKE_mesh_calc_loop_tangent_step_0(
char *ract_uv_name, char *rren_uv_name, short *rtangent_mask);
#endif /* __BKE_MESH_TANGENT_H__ */
-
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index 8a9e2f44604..c9f724a9bc4 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -315,7 +315,7 @@ typedef struct ModifierTypeInfo {
*
* This function is optional (assumes never disabled if not present).
*/
- bool (*isDisabled)(struct ModifierData *md, int userRenderParams);
+ bool (*isDisabled)(const struct Scene *scene, struct ModifierData *md, int userRenderParams);
/* Add the appropriate relations to the dependency graph.
*
@@ -397,7 +397,7 @@ bool modifier_couldBeCage(struct Scene *scene, struct ModifierData *md)
bool modifier_isCorrectableDeformed(struct ModifierData *md);
bool modifier_isSameTopology(ModifierData *md);
bool modifier_isNonGeometrical(ModifierData *md);
-bool modifier_isEnabled(struct Scene *scene, struct ModifierData *md, int required_mode);
+bool modifier_isEnabled(const struct Scene *scene, struct ModifierData *md, int required_mode);
void modifier_setError(struct ModifierData *md, const char *format, ...) ATTR_PRINTF_FORMAT(2, 3);
bool modifier_isPreview(struct ModifierData *md);
@@ -561,4 +561,3 @@ struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(
struct Object *ob_eval, bool *r_free_mesh);
#endif
-
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index cecea927e8a..3a70e145744 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -61,7 +61,7 @@ void multires_force_render_update(struct Object *ob);
void multires_force_external_reload(struct Object *ob);
/* internal, only called in subsurf_ccg.c */
-void multires_modifier_update_mdisps(struct DerivedMesh *dm);
+void multires_modifier_update_mdisps(struct DerivedMesh *dm, struct Scene *scene);
void multires_modifier_update_hidden(struct DerivedMesh *dm);
void multiresModifier_set_levels_from_disps(struct MultiresModifierData *mmd, struct Object *ob);
@@ -75,6 +75,7 @@ typedef enum {
struct DerivedMesh *multires_make_derived_from_derived(struct DerivedMesh *dm,
struct MultiresModifierData *mmd,
+ struct Scene *scene,
struct Object *ob,
MultiresFlags flags);
@@ -83,11 +84,11 @@ struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene,
struct MultiresModifierData *get_multires_modifier(struct Scene *scene, struct Object *ob, bool use_first);
struct DerivedMesh *get_multires_dm(struct Depsgraph *depsgraph, struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *ob);
-void multiresModifier_del_levels(struct MultiresModifierData *, struct Object *, int direction);
-void multiresModifier_base_apply(struct MultiresModifierData *mmd, struct Object *ob);
-void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Object *ob, int updateblock, int simple);
+void multiresModifier_del_levels(struct MultiresModifierData *mmd, struct Scene *scene, struct Object *object, int direction);
+void multiresModifier_base_apply(struct MultiresModifierData *mmd, struct Scene *scene, struct Object *ob);
+void multiresModifier_subdivide(struct MultiresModifierData *mmd, struct Scene *scene, struct Object *ob, int updateblock, int simple);
void multiresModifier_sync_levels_ex(
- struct Object *ob_dst, struct MultiresModifierData *mmd_src, struct MultiresModifierData *mmd_dst);
+ struct Scene *scene, struct Object *ob_dst, struct MultiresModifierData *mmd_src, struct MultiresModifierData *mmd_dst);
int multiresModifier_reshape(struct Depsgraph *depsgraph, struct Scene *scene, struct MultiresModifierData *mmd,
struct Object *dst, struct Object *src);
int multiresModifier_reshapeFromDM(struct Depsgraph *depsgraph, struct Scene *scene, struct MultiresModifierData *mmd,
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index 6f0b6d59984..37929bae042 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -141,4 +141,3 @@ enum eNlaTime_ConvertModes {
float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short mode);
#endif
-
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 63398ec9f5e..1578176d465 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -203,9 +203,9 @@ typedef struct bNodeType {
void (*copyfunc_api)(struct PointerRNA *ptr, struct bNode *src_node);
/* can this node type be added to a node tree */
- int (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree);
+ bool (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree);
/* can this node be added to a node tree */
- int (*poll_instance)(struct bNode *node, struct bNodeTree *nodetree);
+ bool (*poll_instance)(struct bNode *node, struct bNodeTree *nodetree);
/* optional handling of link insertion */
void (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link);
@@ -285,7 +285,7 @@ typedef struct bNodeTreeType {
void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node);
void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func); /* iteration over all node classes */
/* Check visibility in the node editor */
- int (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype);
+ bool (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype);
/* Select a node tree from the context */
void (*get_from_context)(const struct bContext *C, struct bNodeTreeType *ntreetype,
struct bNodeTree **r_ntree, struct ID **r_id, struct ID **r_from);
@@ -298,7 +298,7 @@ typedef struct bNodeTreeType {
/* Tree update. Overrides nodetype->updatetreefunc! */
void (*update)(struct bNodeTree *ntree);
- int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
+ bool (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index ab8327d354a..a54b244f5fd 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -73,7 +73,7 @@ void BKE_object_modifier_hook_reset(struct Object *ob, struct HookModifierData *
bool BKE_object_support_modifier_type_check(const struct Object *ob, int modifier_type);
-void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_src);
+void BKE_object_link_modifiers(struct Scene *scene, struct Object *ob_dst, const struct Object *ob_src);
void BKE_object_free_modifiers(struct Object *ob, const int flag);
void BKE_object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
@@ -183,8 +183,6 @@ void BKE_object_foreach_display_point(
void (*func_cb)(const float[3], void *), void *user_data);
void BKE_scene_foreach_display_point(
struct Depsgraph *depsgraph,
- struct Scene *scene,
- struct ViewLayer *view_layer,
void (*func_cb)(const float[3], void *), void *user_data);
bool BKE_object_parent_loop_check(const struct Object *parent, const struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index ed6d66906d1..1056c5d2119 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -83,4 +83,3 @@ bool BKE_pack_check(struct ID *id);
void BKE_unpack_id(struct Main *bmain, struct ID *id, struct ReportList *reports, int how);
#endif
-
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 11aa67d7f25..3486027e628 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -50,7 +50,6 @@ struct Main;
struct Object;
struct Scene;
struct Depsgraph;
-struct DerivedMesh;
struct ModifierData;
struct MTFace;
struct MCol;
@@ -309,6 +308,7 @@ bool psys_in_edit_mode(struct Depsgraph *depsgraph, struct ParticleSystem *psys)
bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, const bool use_render_params);
bool psys_check_edited(struct ParticleSystem *psys);
+void psys_find_group_weights(struct ParticleSettings *part);
void psys_check_group_weights(struct ParticleSettings *part);
int psys_uses_gravity(struct ParticleSimulationData *sim);
void BKE_particlesettings_fluid_default_settings(struct ParticleSettings *part);
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index 2a79c7f5d58..2175b54a4a1 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -76,4 +76,3 @@ bool BKE_report_write_file(const char *filepath, ReportList *reports, const char
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h
index b7d27cc7101..1fa8106d63b 100644
--- a/source/blender/blenkernel/BKE_rigidbody.h
+++ b/source/blender/blenkernel/BKE_rigidbody.h
@@ -44,8 +44,8 @@ struct Object;
/* -------------- */
/* Memory Management */
-void BKE_rigidbody_free_world(struct RigidBodyWorld *rbw);
-void BKE_rigidbody_free_object(struct Object *ob);
+void BKE_rigidbody_free_world(struct Scene *scene);
+void BKE_rigidbody_free_object(struct Object *ob, struct RigidBodyWorld *rbw);
void BKE_rigidbody_free_constraint(struct Object *ob);
/* ...... */
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 1b42ce97940..861b47aebc6 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -121,9 +121,6 @@ typedef struct SpaceType {
/* region type definitions */
ListBase regiontypes;
- /* tool shelf definitions */
- ListBase toolshelf;
-
/* read and write... */
/* default keymaps to add */
@@ -213,7 +210,7 @@ typedef struct PanelType {
int flag;
/* verify if the panel should draw or not */
- int (*poll)(const struct bContext *C, struct PanelType *pt);
+ bool (*poll)(const struct bContext *C, struct PanelType *pt);
/* draw header (optional) */
void (*draw_header)(const struct bContext *C, struct Panel *pa);
/* draw header preset (optional) */
@@ -292,7 +289,7 @@ typedef struct MenuType {
const char *description;
/* verify if the menu should draw or not */
- int (*poll)(const struct bContext *C, struct MenuType *mt);
+ bool (*poll)(const struct bContext *C, struct MenuType *mt);
/* draw entirely, view changes should be handled here */
void (*draw)(const struct bContext *C, struct Menu *menu);
@@ -336,6 +333,7 @@ struct ARegion *BKE_area_find_region_active_win(struct ScrArea *sa);
struct ARegion *BKE_area_find_region_xy(struct ScrArea *sa, const int regiontype, int x, int y);
struct ScrArea *BKE_screen_find_area_from_space(struct bScreen *sc, struct SpaceLink *sl) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2);
struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype, const short min);
+struct ScrArea *BKE_screen_area_map_find_area_xy(const struct ScrAreaMap *areamap, const int spacetype, int x, int y);
struct ScrArea *BKE_screen_find_area_xy(struct bScreen *sc, const int spacetype, int x, int y);
unsigned int BKE_screen_view3d_layer_active_ex(
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index c92b0fd1272..d4df12783fa 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -76,7 +76,7 @@ typedef struct ShrinkwrapCalcData {
} ShrinkwrapCalcData;
-void shrinkwrapModifier_deform(struct ShrinkwrapModifierData *smd, struct Object *ob, struct Mesh *mesh,
+void shrinkwrapModifier_deform(struct ShrinkwrapModifierData *smd, struct Scene *scene, struct Object *ob, struct Mesh *mesh,
float (*vertexCos)[3], int numVerts);
/*
diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h
index c7bf876a414..ff9d079c8e1 100644
--- a/source/blender/blenkernel/BKE_softbody.h
+++ b/source/blender/blenkernel/BKE_softbody.h
@@ -74,4 +74,3 @@ extern void SB_estimate_transform(Object *ob, float lloc[3], float l
#endif
-
diff --git a/source/blender/blenkernel/BKE_studiolight.h b/source/blender/blenkernel/BKE_studiolight.h
index af7ef9a383e..f8a9498724e 100644
--- a/source/blender/blenkernel/BKE_studiolight.h
+++ b/source/blender/blenkernel/BKE_studiolight.h
@@ -62,21 +62,24 @@
#define STUDIOLIGHT_ICON_SIZE 96
#define STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL 2
-#define STUDIOLIGHT_SPHERICAL_HARMONICS_MAX_COMPONENTS 9
-
+#define STUDIOLIGHT_SPHERICAL_HARMONICS_MAX_COMPONENTS 18
#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL == 0
-#define STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS 1
+# define STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS 1
#endif
#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL == 1
-#define STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS 4
+# define STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS 4
#endif
#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL == 2
-#define STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS 9
+# define STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS 9
+# define STUDIOLIGHT_SPHERICAL_HARMONICS_WINDOWING_TARGET_LAMPLACIAN 10.0f
#endif
+#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL == 4
+# define STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS 18
+#endif
struct GPUTexture;
struct StudioLight;
@@ -128,12 +131,12 @@ typedef struct StudioLight {
float *gpu_matcap_3components; /* 3 channel buffer for GPU_R11F_G11F_B10F */
/*
- Free function to clean up the running icons previews (wmJob) the usage is in
- interface_icons. Please be aware that this was build to handle only one free function
- that cleans up all icons. just to keep the code simple.
- */
+ * Free function to clean up the running icons previews (wmJob) the usage is in
+ * interface_icons. Please be aware that this was build to handle only one free function
+ * that cleans up all icons. just to keep the code simple.
+ */
StudioLightFreeFunction *free_function;
- void* free_function_data;
+ void *free_function_data;
} StudioLight;
void BKE_studiolight_init(void);
@@ -141,10 +144,12 @@ void BKE_studiolight_free(void);
struct StudioLight *BKE_studiolight_find(const char *name, int flag);
struct StudioLight *BKE_studiolight_findindex(int index, int flag);
struct StudioLight *BKE_studiolight_find_first(int flag);
-void BKE_studiolight_preview(uint* icon_buffer, StudioLight *sl, int icon_id_type);
+void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type);
struct ListBase *BKE_studiolight_listbase(void);
void BKE_studiolight_ensure_flag(StudioLight *sl, int flag);
void BKE_studiolight_refresh(void);
+StudioLight *BKE_studiolight_new(const char *path, int orientation);
+void BKE_studiolight_remove(StudioLight *sl);
void BKE_studiolight_set_free_function(StudioLight *sl, StudioLightFreeFunction *free_function, void *data);
void BKE_studiolight_unset_icon_id(StudioLight *sl, int icon_id);
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index 96320415b16..6cb09ff8822 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -67,6 +67,7 @@ typedef enum {
struct DerivedMesh *subsurf_make_derived_from_derived(
struct DerivedMesh *dm,
struct SubsurfModifierData *smd,
+ struct Scene *scene,
float (*vertCos)[3],
SubsurfFlags flags);
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index ed6aa3f6af9..228e17cd2ef 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -118,4 +118,3 @@ void BKE_texture_fetch_images_for_pool(struct Tex *texture, struct ImagePool *po
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h
index fe8aa8694af..f703fefec97 100644
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@ -51,4 +51,3 @@ struct Depsgraph;
void BKE_world_eval(struct Depsgraph *depsgraph, struct World *world);
#endif
-
diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h
index 3bd0689a93a..31235047cbd 100644
--- a/source/blender/blenkernel/BKE_writeavi.h
+++ b/source/blender/blenkernel/BKE_writeavi.h
@@ -63,4 +63,3 @@ void BKE_context_create(bMovieHandle *mh);
#endif
#endif
-
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index a40c31022e3..0950935fbc8 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -92,4 +92,3 @@ void BKE_ffmpeg_context_free(void *context_v);
#endif
#endif
-
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 94d762214f2..d2654e32fa7 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -77,6 +77,7 @@ set(SRC
intern/blender.c
intern/blender_copybuffer.c
intern/blender_undo.c
+ intern/blender_user_menu.c
intern/blendfile.c
intern/bmfont.c
intern/boids.c
@@ -148,7 +149,6 @@ set(SRC
intern/mesh_tangent.c
intern/mesh_validate.c
intern/modifier.c
- intern/modifiers_bmesh.c
intern/movieclip.c
intern/multires.c
intern/nla.c
@@ -419,7 +419,7 @@ if(WITH_CODEC_FFMPEG)
)
add_definitions(-DWITH_FFMPEG)
- remove_strict_flags_file(
+ remove_strict_c_flags_file(
intern/writeffmpeg.c
)
endif()
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 5a4dc479c10..4aee616580e 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -856,26 +856,18 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool
}
}
-void DM_to_meshkey(DerivedMesh *dm, Mesh *me, KeyBlock *kb)
+/** Utility function to convert an (evaluated) Mesh to a shape key block. */
+/* Just a shallow wrapper around BKE_keyblock_convert_from_mesh,
+ * that ensures both evaluated mesh and original one has same number of vertices. */
+void BKE_mesh_runtime_eval_to_meshkey(Mesh *me_deformed, Mesh *me, KeyBlock *kb)
{
- int a, totvert = dm->getNumVerts(dm);
- float *fp;
- MVert *mvert;
+ const int totvert = me_deformed->totvert;
if (totvert == 0 || me->totvert == 0 || me->totvert != totvert) {
return;
}
- if (kb->data) MEM_freeN(kb->data);
- kb->data = MEM_malloc_arrayN(me->key->elemsize, me->totvert, "kb->data");
- kb->totelem = totvert;
-
- fp = kb->data;
- mvert = dm->getVertDataArray(dm, CD_MVERT);
-
- for (a = 0; a < kb->totelem; a++, fp += 3, mvert++) {
- copy_v3_v3(fp, mvert->co);
- }
+ BKE_keyblock_convert_from_mesh(me_deformed, me->key, kb);
}
/**
@@ -1402,39 +1394,6 @@ static void add_orco_mesh(
* happens on enter/exit wpaint.
*/
-void weight_to_rgb(float r_rgb[3], const float weight)
-{
- const float blend = ((weight / 2.0f) + 0.5f);
-
- if (weight <= 0.25f) { /* blue->cyan */
- r_rgb[0] = 0.0f;
- r_rgb[1] = blend * weight * 4.0f;
- r_rgb[2] = blend;
- }
- else if (weight <= 0.50f) { /* cyan->green */
- r_rgb[0] = 0.0f;
- r_rgb[1] = blend;
- r_rgb[2] = blend * (1.0f - ((weight - 0.25f) * 4.0f));
- }
- else if (weight <= 0.75f) { /* green->yellow */
- r_rgb[0] = blend * ((weight - 0.50f) * 4.0f);
- r_rgb[1] = blend;
- r_rgb[2] = 0.0f;
- }
- else if (weight <= 1.0f) { /* yellow->red */
- r_rgb[0] = blend;
- r_rgb[1] = blend * (1.0f - ((weight - 0.75f) * 4.0f));
- r_rgb[2] = 0.0f;
- }
- else {
- /* exceptional value, unclamped or nan,
- * avoid uninitialized memory use */
- r_rgb[0] = 1.0f;
- r_rgb[1] = 0.0f;
- r_rgb[2] = 1.0f;
- }
-}
-
/* draw_flag's for calc_weightpaint_vert_color */
enum {
/* only one of these should be set, keep first (for easy bit-shifting) */
@@ -1446,10 +1405,10 @@ enum {
CALC_WP_MIRROR_X = (1 << 5),
};
-typedef struct DMWeightColorInfo {
+typedef struct MERuntimeWeightColorInfo {
const ColorBand *coba;
const char *alert_color;
-} DMWeightColorInfo;
+} MERuntimeWeightColorInfo;
static int dm_drawflag_calc(const ToolSettings *ts, const Mesh *me)
@@ -1461,7 +1420,7 @@ static int dm_drawflag_calc(const ToolSettings *ts, const Mesh *me)
((me->editflag & ME_EDIT_MIRROR_X) ? CALC_WP_MIRROR_X : 0));
}
-static void weightpaint_color(unsigned char r_col[4], DMWeightColorInfo *dm_wcinfo, const float input)
+static void weightpaint_color(unsigned char r_col[4], MERuntimeWeightColorInfo *dm_wcinfo, const float input)
{
float colf[4];
@@ -1469,7 +1428,7 @@ static void weightpaint_color(unsigned char r_col[4], DMWeightColorInfo *dm_wcin
BKE_colorband_evaluate(dm_wcinfo->coba, input, colf);
}
else {
- weight_to_rgb(colf, input);
+ BKE_defvert_weight_to_rgb(colf, input);
}
/* don't use rgb_float_to_uchar() here because
@@ -1484,7 +1443,7 @@ static void weightpaint_color(unsigned char r_col[4], DMWeightColorInfo *dm_wcin
static void calc_weightpaint_vert_color(
unsigned char r_col[4],
const MDeformVert *dv,
- DMWeightColorInfo *dm_wcinfo,
+ MERuntimeWeightColorInfo *dm_wcinfo,
const int defbase_tot, const int defbase_act,
const bool *defbase_sel, const int defbase_sel_tot,
const int draw_flag)
@@ -1529,12 +1488,12 @@ static void calc_weightpaint_vert_color(
}
}
-static DMWeightColorInfo G_dm_wcinfo;
+static MERuntimeWeightColorInfo G_me_runtime_wcinfo;
-void vDM_ColorBand_store(const ColorBand *coba, const char alert_color[4])
+void BKE_mesh_runtime_color_band_store(const ColorBand *coba, const char alert_color[4])
{
- G_dm_wcinfo.coba = coba;
- G_dm_wcinfo.alert_color = alert_color;
+ G_me_runtime_wcinfo.coba = coba;
+ G_me_runtime_wcinfo.alert_color = alert_color;
}
/**
@@ -1545,7 +1504,7 @@ void vDM_ColorBand_store(const ColorBand *coba, const char alert_color[4])
* so leave this as is - campbell
*/
static void calc_weightpaint_vert_array(
- Object *ob, DerivedMesh *dm, int const draw_flag, DMWeightColorInfo *dm_wcinfo,
+ Object *ob, DerivedMesh *dm, int const draw_flag, MERuntimeWeightColorInfo *dm_wcinfo,
unsigned char (*r_wtcol_v)[4])
{
BMEditMesh *em = (dm->type == DM_TYPE_EDITBMESH) ? BKE_editmesh_from_object(ob) : NULL;
@@ -1620,7 +1579,7 @@ static void calc_weightpaint_vert_array(
}
static void calc_weightpaint_vert_array_mesh(
- Object *ob, Mesh *mesh, int const draw_flag, DMWeightColorInfo *dm_wcinfo,
+ Object *ob, Mesh *mesh, int const draw_flag, MERuntimeWeightColorInfo *dm_wcinfo,
unsigned char (*r_wtcol_v)[4])
{
BMEditMesh *em = BKE_editmesh_from_object(ob);
@@ -1749,7 +1708,7 @@ void DM_update_weight_mcol(
}
else {
/* No weights given, take them from active vgroup(s). */
- calc_weightpaint_vert_array(ob, dm, draw_flag, &G_dm_wcinfo, wtcol_v);
+ calc_weightpaint_vert_array(ob, dm, draw_flag, &G_me_runtime_wcinfo, wtcol_v);
}
if (dm->type == DM_TYPE_EDITBMESH) {
@@ -1823,7 +1782,7 @@ static void mesh_update_weight_mcol(
}
else {
/* No weights given, take them from active vgroup(s). */
- calc_weightpaint_vert_array_mesh(ob, mesh, draw_flag, &G_dm_wcinfo, wtcol_v);
+ calc_weightpaint_vert_array_mesh(ob, mesh, draw_flag, &G_me_runtime_wcinfo, wtcol_v);
}
if (em) {
@@ -2101,8 +2060,6 @@ static void mesh_calc_modifiers(
for (; md; md = md->next, curr = curr->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
if (!modifier_isEnabled(scene, md, required_mode)) {
continue;
}
@@ -2168,8 +2125,6 @@ static void mesh_calc_modifiers(
for (; md; md = md->next, curr = curr->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
if (!modifier_isEnabled(scene, md, required_mode)) {
continue;
}
@@ -2646,8 +2601,6 @@ static void editbmesh_calc_modifiers(
for (i = 0; md; i++, md = md->next, curr = curr->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
if (!editbmesh_modifier_is_enabled(scene, md, dm)) {
continue;
}
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 9f5b81a8915..cbdabe2c440 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -1459,4 +1459,3 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
BKE_animsys_evaluate_animdata(NULL, NULL, &workob->id, &adt, cframe, ADT_RECALC_ANIM);
}
}
-
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index ba45b5acb5d..bd9ee7c9e5f 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -60,7 +60,6 @@
#include "BKE_anim.h"
#include "BKE_constraint.h"
#include "BKE_curve.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_deform.h"
#include "BKE_displist.h"
#include "BKE_idprop.h"
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index c366d822648..23c2147ff7e 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -48,6 +48,7 @@
#include "BKE_addon.h"
#include "BKE_blender.h" /* own include */
#include "BKE_blender_version.h" /* own include */
+#include "BKE_blender_user_menu.h"
#include "BKE_blendfile.h"
#include "BKE_brush.h"
#include "BKE_cachefile.h"
@@ -206,6 +207,15 @@ static void userdef_free_keymaps(UserDef *userdef)
BLI_listbase_clear(&userdef->user_keymaps);
}
+static void userdef_free_user_menus(UserDef *userdef)
+{
+ for (bUserMenu *um = userdef->user_menus.first, *um_next; um; um = um_next) {
+ um_next = um->next;
+ BKE_blender_user_menu_item_free_list(&um->items);
+ MEM_freeN(um);
+ }
+}
+
static void userdef_free_addons(UserDef *userdef)
{
for (bAddon *addon = userdef->addons.first, *addon_next; addon; addon = addon_next) {
@@ -226,6 +236,7 @@ void BKE_blender_userdef_data_free(UserDef *userdef, bool clear_fonts)
#endif
userdef_free_keymaps(userdef);
+ userdef_free_user_menus(userdef);
userdef_free_addons(userdef);
if (clear_fonts) {
@@ -241,6 +252,7 @@ void BKE_blender_userdef_data_free(UserDef *userdef, bool clear_fonts)
BLI_freelistN(&userdef->uifonts);
BLI_freelistN(&userdef->themes);
+
#undef U
}
diff --git a/source/blender/blenkernel/intern/blender_user_menu.c b/source/blender/blenkernel/intern/blender_user_menu.c
new file mode 100644
index 00000000000..3ec46e23cd1
--- /dev/null
+++ b/source/blender/blenkernel/intern/blender_user_menu.c
@@ -0,0 +1,120 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/blender_user_menu.c
+ * \ingroup bke
+ *
+ * User defined menu API.
+ */
+
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+
+#include "DNA_userdef_types.h"
+
+#include "BKE_blender_user_menu.h"
+#include "BKE_idprop.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Menu Type
+ * \{ */
+
+bUserMenu *BKE_blender_user_menu_find(
+ ListBase *lb, char space_type, const char *context)
+{
+ for (bUserMenu *um = lb->first; um; um = um->next) {
+ if ((space_type == um->space_type) &&
+ (STREQ(context, um->context)))
+ {
+ return um;
+ }
+ }
+ return NULL;
+}
+
+bUserMenu *BKE_blender_user_menu_ensure(
+ ListBase *lb, char space_type, const char *context)
+{
+ bUserMenu *um = BKE_blender_user_menu_find(lb, space_type, context);
+ if (um == NULL) {
+ um = MEM_callocN(sizeof(bUserMenu), __func__);
+ um->space_type = space_type;
+ STRNCPY(um->context, context);
+ BLI_addhead(lb, um);
+ }
+ return um;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Menu Item
+ * \{ */
+
+bUserMenuItem *BKE_blender_user_menu_item_add(ListBase *lb, int type)
+{
+ uint size;
+
+ if (type == USER_MENU_TYPE_SEP) {
+ size = sizeof(bUserMenuItem);
+ }
+ else if (type == USER_MENU_TYPE_OPERATOR) {
+ size = sizeof(bUserMenuItem_Op);
+ }
+ else if (type == USER_MENU_TYPE_MENU) {
+ size = sizeof(bUserMenuItem_Menu);
+ }
+ else if (type == USER_MENU_TYPE_PROP) {
+ size = sizeof(bUserMenuItem_Prop);
+ }
+ else {
+ BLI_assert(0);
+ }
+
+ bUserMenuItem *umi = MEM_callocN(size, __func__);
+ umi->type = type;
+ BLI_addtail(lb, umi);
+ return umi;
+}
+
+void BKE_blender_user_menu_item_free(bUserMenuItem *umi)
+{
+ if (umi->type == USER_MENU_TYPE_OPERATOR) {
+ bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi;
+ if (umi_op->prop) {
+ IDP_FreeProperty(umi_op->prop);
+ MEM_freeN(umi_op->prop);
+ }
+ }
+ MEM_freeN(umi);
+}
+
+void BKE_blender_user_menu_item_free_list(ListBase *lb)
+{
+ for (bUserMenuItem *umi = lb->first, *umi_next; umi; umi = umi_next) {
+ umi_next = umi->next;
+ BKE_blender_user_menu_item_free(umi);
+ }
+ BLI_listbase_clear(lb);
+}
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 8fdaf183b06..1e4a99beec4 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -1265,7 +1265,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* account for effectors */
pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint);
- pdDoEffectors(bbd->sim->psys->effectors, bbd->sim->colliders, bbd->part->effector_weights, &epoint, force, NULL);
+ BKE_effectors_apply(bbd->sim->psys->effectors, bbd->sim->colliders, bbd->part->effector_weights, &epoint, force, NULL);
if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
float length = normalize_v3(force);
@@ -1618,4 +1618,3 @@ BoidState *boid_get_current_state(BoidSettings *boids)
return state;
}
-
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index d1ab559515b..778eb17f822 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -649,7 +649,7 @@ static bool camera_frame_fit_calc_from_data(
/* don't move the camera, just yield the fit location */
/* r_scale only valid/useful for ortho cameras */
bool BKE_camera_view_frame_fit_to_scene(
- Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, Object *camera_ob, float r_co[3], float *r_scale)
+ Depsgraph *depsgraph, Scene *scene, Object *camera_ob, float r_co[3], float *r_scale)
{
CameraParams params;
CameraViewFrameData data_cb;
@@ -660,7 +660,7 @@ bool BKE_camera_view_frame_fit_to_scene(
camera_frame_fit_data_init(scene, camera_ob, &params, &data_cb);
/* run callback on all visible points */
- BKE_scene_foreach_display_point(depsgraph, scene, view_layer, camera_to_frame_view_cb, &data_cb);
+ BKE_scene_foreach_display_point(depsgraph, camera_to_frame_view_cb, &data_cb);
return camera_frame_fit_calc_from_data(&params, &data_cb, r_co, r_scale);
}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index c5d9472ca4b..ccef747a31c 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -350,7 +350,7 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int
return 1;
}
-static int do_step_cloth(struct Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, Mesh *result, int framenr)
+static int do_step_cloth(Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, Mesh *result, int framenr)
{
ClothVertex *verts = NULL;
Cloth *cloth;
@@ -375,7 +375,7 @@ static int do_step_cloth(struct Depsgraph *depsgraph, Object *ob, ClothModifierD
mul_m4_v3(ob->obmat, verts->xconst);
}
- effectors = pdInitEffectors(depsgraph, clmd->scene, ob, NULL, clmd->sim_parms->effector_weights, true);
+ effectors = BKE_effectors_create(depsgraph, ob, NULL, clmd->sim_parms->effector_weights);
if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH )
cloth_update_verts ( ob, clmd, result );
@@ -391,11 +391,11 @@ static int do_step_cloth(struct Depsgraph *depsgraph, Object *ob, ClothModifierD
// TIMEIT_START(cloth_step)
/* call the solver. */
- ret = BPH_cloth_solve(ob, framenr, clmd, effectors);
+ ret = BPH_cloth_solve(depsgraph, ob, framenr, clmd, effectors);
// TIMEIT_END(cloth_step)
- pdEndEffectors(&effectors);
+ BKE_effectors_free(effectors);
// printf ( "%f\n", ( float ) tval() );
@@ -405,7 +405,7 @@ static int do_step_cloth(struct Depsgraph *depsgraph, Object *ob, ClothModifierD
/************************************************
* clothModifier_do - main simulation function
************************************************/
-void clothModifier_do(ClothModifierData *clmd, struct Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *mesh, float (*vertexCos)[3])
+void clothModifier_do(ClothModifierData *clmd, Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *mesh, float (*vertexCos)[3])
{
PointCache *cache;
PTCacheID pid;
@@ -413,7 +413,6 @@ void clothModifier_do(ClothModifierData *clmd, struct Depsgraph *depsgraph, Scen
int framenr, startframe, endframe;
int cache_result;
- clmd->scene= scene; /* nice to pass on later :) */
framenr = DEG_get_ctime(depsgraph);
cache= clmd->point_cache;
@@ -1509,4 +1508,3 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh )
/***************************************************************************************
* SPRING NETWORK GWN_BATCH_BUILDING IMPLEMENTATION END
***************************************************************************************/
-
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index eef4a6210c8..1d9cc9bb8d0 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -317,13 +317,13 @@ static void collection_object_cache_fill(ListBase *lb, Collection *collection, i
if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
((object_restrict & OB_RESTRICT_VIEW) == 0))
{
- base->flag |= BASE_VISIBLE_VIEWPORT;
+ base->flag |= BASE_ENABLED_VIEWPORT;
}
if (((child_restrict & COLLECTION_RESTRICT_RENDER) == 0) &&
((object_restrict & OB_RESTRICT_RENDER) == 0))
{
- base->flag |= BASE_VISIBLE_RENDER;
+ base->flag |= BASE_ENABLED_RENDER;
}
}
@@ -364,36 +364,13 @@ void BKE_collection_object_cache_free(Collection *collection)
collection_object_cache_free(collection);
}
-Base *BKE_collection_or_layer_objects(const Depsgraph *depsgraph,
- const Scene *scene,
- const ViewLayer *view_layer,
- Collection *collection)
+Base *BKE_collection_or_layer_objects(const ViewLayer *view_layer, Collection *collection)
{
- // TODO: this is used by physics to get objects from a collection, but the
- // the physics systems are not all using the depsgraph correctly which means
- // we try different things. Instead we should explicitly get evaluated or
- // non-evaluated data and always have the depsgraph available when needed
-
if (collection) {
return BKE_collection_object_cache_get(collection).first;
}
- else if (depsgraph) {
- view_layer = DEG_get_evaluated_view_layer(depsgraph);
-
- if (view_layer) {
- return FIRSTBASE(view_layer);
- }
- else {
- view_layer = DEG_get_input_view_layer(depsgraph);
- return FIRSTBASE(view_layer);
- }
- }
- else if (view_layer) {
- return FIRSTBASE(view_layer);
- }
else {
- /* depsgraph is NULL during deg build */
- return FIRSTBASE(BKE_view_layer_context_active_PLACEHOLDER(scene));
+ return FIRSTBASE(view_layer);
}
}
@@ -903,7 +880,7 @@ static bool collection_objects_select(ViewLayer *view_layer, Collection *collect
}
}
else {
- if ((base->flag & BASE_SELECTABLED) && !(base->flag & BASE_SELECTED)) {
+ if ((base->flag & BASE_SELECTABLE) && !(base->flag & BASE_SELECTED)) {
base->flag |= BASE_SELECTED;
changed = true;
}
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 38cb1a1de16..a734e140932 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -58,6 +58,10 @@
#include "BLI_kdopbvh.h"
#include "BKE_collision.h"
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_physics.h"
+#include "DEG_depsgraph_query.h"
+
#ifdef WITH_ELTOPO
#include "eltopo-capi.h"
#endif
@@ -479,147 +483,143 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2,
return collpair;
}
-static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned int *maxobj, Object *ob, Object *self, int level, unsigned int modifier_type)
+static void add_collision_object(ListBase *relations, Object *ob, int level, unsigned int modifier_type)
{
CollisionModifierData *cmd= NULL;
- if (ob == self)
- return;
-
/* only get objects with collision modifier */
if (((modifier_type == eModifierType_Collision) && ob->pd && ob->pd->deflect) || (modifier_type != eModifierType_Collision))
cmd= (CollisionModifierData *)modifiers_findByType(ob, modifier_type);
if (cmd) {
- /* extend array */
- if (*numobj >= *maxobj) {
- *maxobj *= 2;
- *objs= MEM_reallocN(*objs, sizeof(Object *)*(*maxobj));
- }
-
- (*objs)[*numobj] = ob;
- (*numobj)++;
+ CollisionRelation *relation = MEM_callocN(sizeof(CollisionRelation), "CollisionRelation");
+ relation->ob = ob;
+ BLI_addtail(relations, relation);
}
/* objects in dupli groups, one level only for now */
+ /* TODO: this doesn't really work, we are not taking into account the
+ * dupli transforms and can get objects in the list multiple times. */
if (ob->dup_group && level == 0) {
Collection *collection= ob->dup_group;
/* add objects */
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
{
- add_collision_object(objs, numobj, maxobj, object, self, level+1, modifier_type);
+ add_collision_object(relations, object, level+1, modifier_type);
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
}
-// return all collision objects in scene
-// collision object will exclude self
-Object **get_collisionobjects_ext(Scene *scene, Object *self, Collection *collection, unsigned int *numcollobj, unsigned int modifier_type, bool dupli)
+/* Create list of collision relations in the collection or entire scene.
+ * This is used by the depsgraph to build relations, as well as faster
+ * lookup of colliders during evaluation. */
+ListBase *BKE_collision_relations_create(Depsgraph *depsgraph, Collection *collection, unsigned int modifier_type)
{
- Object **objs;
- unsigned int numobj= 0, maxobj= 100;
- int level = dupli ? 0 : 1;
+ ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+ Base *base = BKE_collection_or_layer_objects(view_layer, collection);
+ const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
+ const int base_flag = (for_render) ? BASE_ENABLED_RENDER : BASE_ENABLED_VIEWPORT;
- objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray");
+ ListBase *relations = MEM_callocN(sizeof(ListBase), "CollisionRelation list");
- /* gather all collision objects */
- if (collection) {
- /* use specified collection */
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
- {
- add_collision_object(&objs, &numobj, &maxobj, object, self, level, modifier_type);
+ for (; base; base = base->next) {
+ if (base->flag & base_flag) {
+ add_collision_object(relations, base->object, 0, modifier_type);
}
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
- else {
- Scene *sce_iter;
- Base *base;
- /* add objects in same layer in scene */
- for (SETLOOPER(scene, sce_iter, base)) {
- if ((base->flag & BASE_VISIBLED) != 0) {
- add_collision_object(&objs, &numobj, &maxobj, base->object, self, level, modifier_type);
- }
- }
- }
-
- *numcollobj= numobj;
- return objs;
+ return relations;
}
-Object **get_collisionobjects(Scene *scene, Object *self, Collection *collection, unsigned int *numcollobj, unsigned int modifier_type)
+void BKE_collision_relations_free(ListBase *relations)
{
- /* Need to check for active layers, too.
- Otherwise this check fails if the objects are not on the same layer - DG */
- return get_collisionobjects_ext(scene, self, collection, numcollobj, modifier_type, true);
+ if (relations) {
+ BLI_freelistN(relations);
+ MEM_freeN(relations);
+ }
}
-static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self, int level)
+/* Create effective list of colliders from relations built beforehand.
+ * Self will be excluded. */
+Object **BKE_collision_objects_create(Depsgraph *depsgraph, Object *self, Collection *collection, unsigned int *numcollobj, unsigned int modifier_type)
{
- CollisionModifierData *cmd= NULL;
- ColliderCache *col;
+ ListBase *relations = DEG_get_collision_relations(depsgraph, collection, modifier_type);
- if (ob == self)
- return;
+ if (!relations) {
+ *numcollobj = 0;
+ return NULL;
+ }
- if (ob->pd && ob->pd->deflect)
- cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
+ int maxnum = BLI_listbase_count(relations);
+ int num = 0;
+ Object **objects = MEM_callocN(sizeof(Object*) * maxnum, __func__);
- if (cmd && cmd->bvhtree) {
- if (*objs == NULL)
- *objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
+ for (CollisionRelation *relation = relations->first; relation; relation = relation->next) {
+ /* Get evaluated object. */
+ Object *ob = (Object*)DEG_get_evaluated_id(depsgraph, &relation->ob->id);
- col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
- col->ob = ob;
- col->collmd = cmd;
- /* make sure collider is properly set up */
- collision_move_object(cmd, 1.0, 0.0);
- BLI_addtail(*objs, col);
+ if (ob != self) {
+ objects[num] = ob;
+ num++;
+ }
}
- /* objects in dupli collection, one level only for now */
- if (ob->dup_group && level == 0) {
- Collection *collection= ob->dup_group;
+ if (num == 0) {
+ MEM_freeN(objects);
+ objects = NULL;
+ }
- /* add objects */
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
- {
- add_collider_cache_object(objs, object, self, level+1);
- }
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+ *numcollobj = num;
+ return objects;
+}
+
+void BKE_collision_objects_free(Object **objects)
+{
+ if (objects) {
+ MEM_freeN(objects);
}
}
-ListBase *get_collider_cache(Scene *scene, Object *self, Collection *collection)
+/* Create effective list of colliders from relations built beforehand.
+ * Self will be excluded. */
+ListBase *BKE_collider_cache_create(Depsgraph *depsgraph, Object *self, Collection *collection)
{
- ListBase *objs= NULL;
+ ListBase *relations = DEG_get_collision_relations(depsgraph, collection, eModifierType_Collision);
+ ListBase *cache = NULL;
- /* add object in same layer in scene */
- if (collection) {
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
- {
- add_collider_cache_object(&objs, object, self, 0);
- }
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+ if (!relations) {
+ return NULL;
}
- else {
- Scene *sce_iter;
- Base *base;
- /* add objects in same layer in scene */
- for (SETLOOPER(scene, sce_iter, base)) {
- if (!self || ((base->flag & BASE_VISIBLED) != 0))
- add_collider_cache_object(&objs, base->object, self, 0);
+ for (CollisionRelation *relation = relations->first; relation; relation = relation->next) {
+ /* Get evaluated object. */
+ Object *ob = (Object*)DEG_get_evaluated_id(depsgraph, &relation->ob->id);
+
+ if (ob == self) {
+ continue;
+ }
+
+ CollisionModifierData *cmd = (CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
+ if (cmd && cmd->bvhtree) {
+ if (cache == NULL) {
+ cache = MEM_callocN(sizeof(ListBase), "ColliderCache array");
+ }
+ ColliderCache *col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
+ col->ob = ob;
+ col->collmd = cmd;
+ /* make sure collider is properly set up */
+ collision_move_object(cmd, 1.0, 0.0);
+ BLI_addtail(cache, col);
}
}
- return objs;
+ return cache;
}
-void free_collider_cache(ListBase **colliders)
+void BKE_collider_cache_free(ListBase **colliders)
{
if (*colliders) {
BLI_freelistN(*colliders);
@@ -686,7 +686,7 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
}
// cloth - object collisions
-int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, float dt )
+int cloth_bvh_objcollision(Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, float step, float dt )
{
Cloth *cloth= clmd->clothObject;
BVHTree *cloth_bvh= cloth->bvhtree;
@@ -712,7 +712,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
bvhtree_update_from_cloth ( clmd, 1 ); // 0 means STATIC, 1 means MOVING (see later in this function)
bvhselftree_update_from_cloth ( clmd, 0 ); // 0 means STATIC, 1 means MOVING (see later in this function)
- collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
+ collobjs = BKE_collision_objects_create(depsgraph, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
if (!collobjs)
return 0;
@@ -894,8 +894,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa
}
while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
- if (collobjs)
- MEM_freeN(collobjs);
+ BKE_collision_objects_free(collobjs);
return 1|MIN2 ( ret, 1 );
}
@@ -1207,7 +1206,7 @@ static int cloth_points_objcollisions_resolve(
}
// cloth - object collisions
-int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, float dt)
+int cloth_points_objcollision(Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, float step, float dt)
{
Cloth *cloth= clmd->clothObject;
BVHTree *cloth_bvh;
@@ -1240,7 +1239,7 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f
/* balance tree */
BLI_bvhtree_balance(cloth_bvh);
- collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
+ collobjs = BKE_collision_objects_create(depsgraph, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
if (!collobjs)
return 0;
@@ -1321,15 +1320,14 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f
}
while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
- if (collobjs)
- MEM_freeN(collobjs);
+ BKE_collision_objects_free(collobjs);
BLI_bvhtree_free(cloth_bvh);
return 1|MIN2 ( ret, 1 );
}
-void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step, float dt,
+void cloth_find_point_contacts(Depsgraph *depsgraph, Object *ob, ClothModifierData *clmd, float step, float dt,
ColliderContacts **r_collider_contacts, int *r_totcolliders)
{
Cloth *cloth= clmd->clothObject;
@@ -1363,7 +1361,7 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step,
/* balance tree */
BLI_bvhtree_balance(cloth_bvh);
- collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
+ collobjs = BKE_collision_objects_create(depsgraph, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
if (!collobjs) {
*r_collider_contacts = NULL;
*r_totcolliders = 0;
@@ -1421,8 +1419,7 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step,
MEM_freeN(overlap);
}
- if (collobjs)
- MEM_freeN(collobjs);
+ BKE_collision_objects_free(collobjs);
BLI_bvhtree_free(cloth_bvh);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index ac47a9e0756..0cbd77b67d2 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -52,6 +52,7 @@
#include "DNA_object_types.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
+#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_lattice_types.h"
@@ -68,19 +69,18 @@
#include "BKE_camera.h"
#include "BKE_constraint.h"
#include "BKE_curve.h"
-#include "BKE_displist.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h" /* for geometry targets */
-#include "BKE_cdderivedmesh.h" /* for geometry targets */
-#include "BKE_object.h"
+#include "BKE_displist.h"
+#include "BKE_editmesh.h"
#include "BKE_global.h"
-#include "BKE_library.h"
#include "BKE_idprop.h"
-#include "BKE_shrinkwrap.h"
-#include "BKE_editmesh.h"
+#include "BKE_library.h"
+#include "BKE_mesh_runtime.h"
+#include "BKE_movieclip.h"
+#include "BKE_object.h"
#include "BKE_scene.h"
+#include "BKE_shrinkwrap.h"
#include "BKE_tracking.h"
-#include "BKE_movieclip.h"
#include "BIK_api.h"
@@ -391,99 +391,104 @@ void BKE_constraint_mat_convertspace(
/* function that sets the given matrix based on given vertex group in mesh */
static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[4][4])
{
- DerivedMesh *dm = NULL;
+ /* when not in EditMode, use the 'final' evaluated mesh, depsgraph
+ * ensures we build with CD_MDEFORMVERT layer
+ */
+ Mesh *me_eval = ob->runtime.mesh_eval;
BMEditMesh *em = BKE_editmesh_from_object(ob);
- float vec[3] = {0.0f, 0.0f, 0.0f};
- float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3];
+ float plane[3];
float imat[3][3], tmat[3][3];
const int defgroup = defgroup_name_index(ob, substring);
- short freeDM = 0;
/* initialize target matrix using target matrix */
copy_m4_m4(mat, ob->obmat);
/* get index of vertex group */
- if (defgroup == -1) return;
-
- /* get DerivedMesh */
- if (em) {
- /* target is in editmode, so get a special derived mesh */
- dm = CDDM_from_editbmesh(em, false, false);
- freeDM = 1;
- }
- else {
- /* when not in EditMode, use the 'final' derived mesh, depsgraph
- * ensures we build with CD_MDEFORMVERT layer
- */
- dm = (DerivedMesh *)ob->derivedFinal;
+ if (defgroup == -1) {
+ return;
}
- /* only continue if there's a valid DerivedMesh */
- if (dm) {
- MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- int numVerts = dm->getNumVerts(dm);
- int i;
- float co[3], nor[3];
+ float vec[3] = {0.0f, 0.0f, 0.0f};
+ float normal[3] = {0.0f, 0.0f, 0.0f};
+ float weightsum = 0.0f;
+ if (me_eval) {
+ MDeformVert *dvert = CustomData_get_layer(&me_eval->vdata, CD_MDEFORMVERT);
+ int numVerts = me_eval->totvert;
/* check that dvert is a valid pointers (just in case) */
if (dvert) {
MDeformVert *dv = dvert;
- float weightsum = 0.0f;
+ MVert *mv = me_eval->mvert;
/* get the average of all verts with that are in the vertex-group */
- for (i = 0; i < numVerts; i++, dv++) {
+ for (int i = 0; i < numVerts; i++, dv++, mv++) {
MDeformWeight *dw = defvert_find_index(dv, defgroup);
if (dw && dw->weight > 0.0f) {
- dm->getVertCo(dm, i, co);
- dm->getVertNo(dm, i, nor);
- madd_v3_v3fl(vec, co, dw->weight);
+ float nor[3];
+ normal_short_to_float_v3(nor, mv->no);
+ madd_v3_v3fl(vec, mv->co, dw->weight);
madd_v3_v3fl(normal, nor, dw->weight);
weightsum += dw->weight;
}
}
+ }
+ }
+ else if (em) {
+ if (CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
+ BMVert *v;
+ BMIter iter;
- /* calculate averages of normal and coordinates */
- if (weightsum > 0) {
- mul_v3_fl(vec, 1.0f / weightsum);
- mul_v3_fl(normal, 1.0f / weightsum);
- }
-
+ BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+ MDeformVert *dv = CustomData_bmesh_get(&em->bm->vdata, v->head.data, CD_MDEFORMVERT);
+ MDeformWeight *dw = defvert_find_index(dv, defgroup);
- /* derive the rotation from the average normal:
- * - code taken from transform_manipulator.c,
- * calc_manipulator_stats, V3D_MANIP_NORMAL case
- */
- /* we need the transpose of the inverse for a normal... */
- copy_m3_m4(imat, ob->obmat);
+ if (dw && dw->weight > 0.0f) {
+ madd_v3_v3fl(vec, v->co, dw->weight);
+ madd_v3_v3fl(normal, v->no, dw->weight);
+ weightsum += dw->weight;
+ }
+ }
+ }
+ }
+ else {
+ /* No valid edit or evaluated mesh, just abort. */
+ return;
+ }
- invert_m3_m3(tmat, imat);
- transpose_m3(tmat);
- mul_m3_v3(tmat, normal);
+ /* calculate averages of normal and coordinates */
+ if (weightsum > 0) {
+ mul_v3_fl(vec, 1.0f / weightsum);
+ mul_v3_fl(normal, 1.0f / weightsum);
+ }
- normalize_v3(normal);
- copy_v3_v3(plane, tmat[1]);
+ /* derive the rotation from the average normal:
+ * - code taken from transform_manipulator.c,
+ * calc_manipulator_stats, V3D_MANIP_NORMAL case
+ */
+ /* we need the transpose of the inverse for a normal... */
+ copy_m3_m4(imat, ob->obmat);
- cross_v3_v3v3(mat[0], normal, plane);
- if (len_squared_v3(mat[0]) < SQUARE(1e-3f)) {
- copy_v3_v3(plane, tmat[0]);
- cross_v3_v3v3(mat[0], normal, plane);
- }
+ invert_m3_m3(tmat, imat);
+ transpose_m3(tmat);
+ mul_m3_v3(tmat, normal);
- copy_v3_v3(mat[2], normal);
- cross_v3_v3v3(mat[1], mat[2], mat[0]);
+ normalize_v3(normal);
+ copy_v3_v3(plane, tmat[1]);
- normalize_m4(mat);
+ cross_v3_v3v3(mat[0], normal, plane);
+ if (len_squared_v3(mat[0]) < SQUARE(1e-3f)) {
+ copy_v3_v3(plane, tmat[0]);
+ cross_v3_v3v3(mat[0], normal, plane);
+ }
+ copy_v3_v3(mat[2], normal);
+ cross_v3_v3v3(mat[1], mat[2], mat[0]);
- /* apply the average coordinate as the new location */
- mul_v3_m4v3(mat[3], ob->obmat, vec);
- }
- }
+ normalize_m4(mat);
- /* free temporary DerivedMesh created (in EditMode case) */
- if (dm && freeDM)
- dm->release(dm);
+ /* apply the average coordinate as the new location */
+ mul_v3_m4v3(mat[3], ob->obmat, vec);
}
/* function that sets the given matrix based on given vertex group in lattice */
@@ -3405,23 +3410,23 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy
}
-static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
+static void shrinkwrap_get_tarmat(struct Depsgraph *depsgraph, bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime))
{
bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) ) {
+
bool fail = false;
float co[3] = {0.0f, 0.0f, 0.0f};
SpaceTransform transform;
- /* TODO(sergey): use proper for_render flag here when known. */
- DerivedMesh *target = object_get_derived_final(ct->tar, false);
+ Mesh *target_eval = mesh_get_eval_final(depsgraph, DEG_get_input_scene(depsgraph), ct->tar, CD_MASK_BAREMESH);
BVHTreeFromMesh treeData = {NULL};
unit_m4(ct->matrix);
- if (target != NULL) {
+ if (target_eval != NULL) {
BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->obmat);
switch (scon->shrinkType) {
@@ -3435,9 +3440,9 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstrai
nearest.dist_sq = FLT_MAX;
if (scon->shrinkType == MOD_SHRINKWRAP_NEAREST_VERTEX)
- bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_VERTS, 2);
+ BKE_bvhtree_from_mesh_get(&treeData, target_eval, BVHTREE_FROM_VERTS, 2);
else
- bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_LOOPTRI, 2);
+ BKE_bvhtree_from_mesh_get(&treeData, target_eval, BVHTREE_FROM_LOOPTRI, 2);
if (treeData.tree == NULL) {
fail = true;
@@ -3489,7 +3494,7 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstrai
break;
}
- bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_LOOPTRI, 4);
+ BKE_bvhtree_from_mesh_get(&treeData, target_eval, BVHTREE_FROM_LOOPTRI, 4);
if (treeData.tree == NULL) {
fail = true;
break;
@@ -4087,9 +4092,9 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
if (data->depth_ob) {
Object *depth_ob = data->depth_ob;
- /* TODO(sergey): use proper for_render flag here when known. */
- DerivedMesh *target = object_get_derived_final(depth_ob, false);
- if (target) {
+ Mesh *target_eval = mesh_get_eval_final(
+ depsgraph, DEG_get_input_scene(depsgraph), depth_ob, CD_MASK_BAREMESH);
+ if (target_eval) {
BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
BVHTreeRayHit hit;
float ray_start[3], ray_end[3], ray_nor[3], imat[4][4];
@@ -4103,19 +4108,19 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase
sub_v3_v3v3(ray_nor, ray_end, ray_start);
normalize_v3(ray_nor);
- bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_LOOPTRI, 4);
+ BKE_bvhtree_from_mesh_get(&treeData, target_eval, BVHTREE_FROM_LOOPTRI, 4);
hit.dist = BVH_RAYCAST_DIST_MAX;
hit.index = -1;
- result = BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData);
+ result = BLI_bvhtree_ray_cast(
+ treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData);
if (result != -1) {
mul_v3_m4v3(cob->matrix[3], depth_ob->obmat, hit.co);
}
free_bvhtree_from_mesh(&treeData);
- target->release(target);
}
}
}
diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c
index 0a31411d638..2b4daae503d 100644
--- a/source/blender/blenkernel/intern/crazyspace.c
+++ b/source/blender/blenkernel/intern/crazyspace.c
@@ -404,7 +404,7 @@ void BKE_crazyspace_build_sculpt(struct Depsgraph *depsgraph, Scene *scene, Obje
if ((mti->deformMatrices || mti->deformMatrices_DM) && !deformed)
continue;
- modifier_deformVerts_DM_deprecated(md, &mectx, NULL, deformedVerts, me->totvert);
+ modifier_deformVerts(md, &mectx, NULL, deformedVerts, me->totvert);
deformed = 1;
}
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index f6dd630e077..33a24f77937 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -5160,7 +5160,7 @@ void BKE_curve_material_index_clear(Curve *cu)
}
}
-int BKE_curve_material_index_validate(Curve *cu)
+bool BKE_curve_material_index_validate(Curve *cu)
{
const int curvetype = BKE_curve_type_get(cu);
bool is_valid = true;
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index aa762865a2a..3fee2ef6021 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -449,4 +449,3 @@ CDataFileLayer *cdf_layer_add(CDataFile *cdf, int type, const char *name, size_t
return layer;
}
-
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 3639649eab5..7006e4ddaa6 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -42,12 +42,10 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_data_transfer.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
@@ -257,77 +255,76 @@ int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type)
/* Generic pre/post processing, only used by custom loop normals currently. */
static void data_transfer_dtdata_type_preprocess(
- Object *UNUSED(ob_src), Object *UNUSED(ob_dst), DerivedMesh *dm_src, DerivedMesh *dm_dst, Mesh *me_dst,
- const int dtdata_type, const bool dirty_nors_dst, const bool use_split_nors_src, const float split_angle_src)
+ Mesh *me_src, Mesh *me_dst,
+ const int dtdata_type, const bool dirty_nors_dst)
{
if (dtdata_type == DT_TYPE_LNOR) {
/* Compute custom normals into regular loop normals, which will be used for the transfer. */
- MVert *verts_dst = dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert;
- const int num_verts_dst = dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert;
- MEdge *edges_dst = dm_dst ? dm_dst->getEdgeArray(dm_dst) : me_dst->medge;
- const int num_edges_dst = dm_dst ? dm_dst->getNumEdges(dm_dst) : me_dst->totedge;
- MPoly *polys_dst = dm_dst ? dm_dst->getPolyArray(dm_dst) : me_dst->mpoly;
- const int num_polys_dst = dm_dst ? dm_dst->getNumPolys(dm_dst) : me_dst->totpoly;
- MLoop *loops_dst = dm_dst ? dm_dst->getLoopArray(dm_dst) : me_dst->mloop;
- const int num_loops_dst = dm_dst ? dm_dst->getNumLoops(dm_dst) : me_dst->totloop;
- CustomData *pdata_dst = dm_dst ? dm_dst->getPolyDataLayout(dm_dst) : &me_dst->pdata;
- CustomData *ldata_dst = dm_dst ? dm_dst->getLoopDataLayout(dm_dst) : &me_dst->ldata;
+ MVert *verts_dst = me_dst->mvert;
+ const int num_verts_dst = me_dst->totvert;
+ MEdge *edges_dst = me_dst->medge;
+ const int num_edges_dst = me_dst->totedge;
+ MPoly *polys_dst = me_dst->mpoly;
+ const int num_polys_dst = me_dst->totpoly;
+ MLoop *loops_dst = me_dst->mloop;
+ const int num_loops_dst = me_dst->totloop;
+ CustomData *pdata_dst = &me_dst->pdata;
+ CustomData *ldata_dst = &me_dst->ldata;
const bool use_split_nors_dst = (me_dst->flag & ME_AUTOSMOOTH) != 0;
const float split_angle_dst = me_dst->smoothresh;
- dm_src->calcLoopNormals(dm_src, use_split_nors_src, split_angle_src);
+ BKE_mesh_calc_normals_split(me_src);
- if (dm_dst) {
- dm_dst->calcLoopNormals(dm_dst, use_split_nors_dst, split_angle_dst);
- }
- else {
- float (*poly_nors_dst)[3];
- float (*loop_nors_dst)[3];
- short (*custom_nors_dst)[2] = CustomData_get_layer(ldata_dst, CD_CUSTOMLOOPNORMAL);
-
- /* Cache poly nors into a temp CDLayer. */
- poly_nors_dst = CustomData_get_layer(pdata_dst, CD_NORMAL);
- if (dirty_nors_dst || !poly_nors_dst) {
- if (!poly_nors_dst) {
- poly_nors_dst = CustomData_add_layer(pdata_dst, CD_NORMAL, CD_CALLOC, NULL, num_polys_dst);
- CustomData_set_layer_flag(pdata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
- }
- BKE_mesh_calc_normals_poly(verts_dst, NULL, num_verts_dst, loops_dst, polys_dst,
- num_loops_dst, num_polys_dst, poly_nors_dst, true);
- }
- /* Cache loop nors into a temp CDLayer. */
- loop_nors_dst = CustomData_get_layer(ldata_dst, CD_NORMAL);
- if (dirty_nors_dst || loop_nors_dst) {
- if (!loop_nors_dst) {
- loop_nors_dst = CustomData_add_layer(ldata_dst, CD_NORMAL, CD_CALLOC, NULL, num_loops_dst);
- CustomData_set_layer_flag(ldata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
- }
- BKE_mesh_normals_loop_split(verts_dst, num_verts_dst, edges_dst, num_edges_dst,
- loops_dst, loop_nors_dst, num_loops_dst,
- polys_dst, (const float (*)[3])poly_nors_dst, num_polys_dst,
- use_split_nors_dst, split_angle_dst, NULL, custom_nors_dst, NULL);
- }
+ float (*poly_nors_dst)[3];
+ float (*loop_nors_dst)[3];
+ short (*custom_nors_dst)[2] = CustomData_get_layer(ldata_dst, CD_CUSTOMLOOPNORMAL);
+
+ /* Cache poly nors into a temp CDLayer. */
+ poly_nors_dst = CustomData_get_layer(pdata_dst, CD_NORMAL);
+ const bool do_poly_nors_dst = (poly_nors_dst == NULL);
+ if (do_poly_nors_dst) {
+ poly_nors_dst = CustomData_add_layer(pdata_dst, CD_NORMAL, CD_CALLOC, NULL, num_polys_dst);
+ CustomData_set_layer_flag(pdata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
+ }
+ if (dirty_nors_dst || do_poly_nors_dst) {
+ BKE_mesh_calc_normals_poly(
+ verts_dst, NULL, num_verts_dst, loops_dst, polys_dst,
+ num_loops_dst, num_polys_dst, poly_nors_dst, true);
+ }
+ /* Cache loop nors into a temp CDLayer. */
+ loop_nors_dst = CustomData_get_layer(ldata_dst, CD_NORMAL);
+ const bool do_loop_nors_dst = (loop_nors_dst == NULL);
+ if (do_loop_nors_dst) {
+ loop_nors_dst = CustomData_add_layer(ldata_dst, CD_NORMAL, CD_CALLOC, NULL, num_loops_dst);
+ CustomData_set_layer_flag(ldata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
+ }
+ if (dirty_nors_dst || do_loop_nors_dst) {
+ BKE_mesh_normals_loop_split(
+ verts_dst, num_verts_dst, edges_dst, num_edges_dst,
+ loops_dst, loop_nors_dst, num_loops_dst,
+ polys_dst, (const float (*)[3])poly_nors_dst, num_polys_dst,
+ use_split_nors_dst, split_angle_dst, NULL, custom_nors_dst, NULL);
}
}
}
static void data_transfer_dtdata_type_postprocess(
- Object *UNUSED(ob_src), Object *UNUSED(ob_dst), DerivedMesh *UNUSED(dm_src), DerivedMesh *dm_dst, Mesh *me_dst,
+ Object *UNUSED(ob_src), Object *UNUSED(ob_dst), Mesh *UNUSED(me_src), Mesh *me_dst,
const int dtdata_type, const bool changed)
{
if (dtdata_type == DT_TYPE_LNOR) {
/* Bake edited destination loop normals into custom normals again. */
- MVert *verts_dst = dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert;
- const int num_verts_dst = dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert;
- MEdge *edges_dst = dm_dst ? dm_dst->getEdgeArray(dm_dst) : me_dst->medge;
- const int num_edges_dst = dm_dst ? dm_dst->getNumEdges(dm_dst) : me_dst->totedge;
- MPoly *polys_dst = dm_dst ? dm_dst->getPolyArray(dm_dst) : me_dst->mpoly;
- const int num_polys_dst = dm_dst ? dm_dst->getNumPolys(dm_dst) : me_dst->totpoly;
- MLoop *loops_dst = dm_dst ? dm_dst->getLoopArray(dm_dst) : me_dst->mloop;
- const int num_loops_dst = dm_dst ? dm_dst->getNumLoops(dm_dst) : me_dst->totloop;
- CustomData *pdata_dst = dm_dst ? dm_dst->getPolyDataLayout(dm_dst) : &me_dst->pdata;
- CustomData *ldata_dst = dm_dst ? dm_dst->getLoopDataLayout(dm_dst) : &me_dst->ldata;
+ MVert *verts_dst = me_dst->mvert;
+ const int num_verts_dst = me_dst->totvert;
+ MEdge *edges_dst = me_dst->medge;
+ const int num_edges_dst = me_dst->totedge;
+ MPoly *polys_dst = me_dst->mpoly;
+ const int num_polys_dst = me_dst->totpoly;
+ MLoop *loops_dst = me_dst->mloop;
+ const int num_loops_dst = me_dst->totloop;
+ CustomData *pdata_dst = &me_dst->pdata;
+ CustomData *ldata_dst = &me_dst->ldata;
const float (*poly_nors_dst)[3] = CustomData_get_layer(pdata_dst, CD_NORMAL);
float (*loop_nors_dst)[3] = CustomData_get_layer(ldata_dst, CD_NORMAL);
@@ -531,7 +528,7 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(
continue;
}
data_src = CustomData_get_layer_n(cd_src, cddata_type, idx_src);
- /* If dest is a derivedmesh, we do not want to overwrite cdlayers of org mesh! */
+ /* If dest is a evaluated mesh (fro; ;odifier), we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst) {
data_dst = CustomData_duplicate_referenced_layer_n(cd_dst, cddata_type, idx_src, num_elem_dst);
}
@@ -575,7 +572,7 @@ static bool data_transfer_layersmapping_cdlayers_multisrc_to_dst(
data_dst_to_delete[idx_dst] = false;
}
if (r_map) {
- /* If dest is a derivedmesh, we do not want to overwrite cdlayers of org mesh! */
+ /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst) {
data_dst = CustomData_duplicate_referenced_layer_n(cd_dst, cddata_type, idx_dst, num_elem_dst);
}
@@ -633,7 +630,7 @@ static bool data_transfer_layersmapping_cdlayers(
data_dst = CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
}
else if (use_dupref_dst && r_map) {
- /* If dest is a derivedmesh, we do not want to overwrite cdlayers of org mesh! */
+ /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
data_dst = CustomData_duplicate_referenced_layer(cd_dst, cddata_type, num_elem_dst);
}
@@ -660,7 +657,7 @@ static bool data_transfer_layersmapping_cdlayers(
if (tolayers >= 0) { /* Real-layer index */
idx_dst = tolayers;
- /* If dest is a derivedmesh, we do not want to overwrite cdlayers of org mesh! */
+ /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(cd_dst, cddata_type, idx_dst, num_elem_dst);
}
@@ -676,7 +673,7 @@ static bool data_transfer_layersmapping_cdlayers(
data_dst = CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
}
else {
- /* If dest is a derivedmesh, we do not want to overwrite cdlayers of org mesh! */
+ /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(cd_dst, cddata_type, idx_dst, num_elem_dst);
}
@@ -697,7 +694,7 @@ static bool data_transfer_layersmapping_cdlayers(
CustomData_add_layer(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst);
}
}
- /* If dest is a derivedmesh, we do not want to overwrite cdlayers of org mesh! */
+ /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(cd_dst, cddata_type, idx_dst, num_elem_dst);
}
@@ -714,7 +711,7 @@ static bool data_transfer_layersmapping_cdlayers(
CustomData_add_layer_named(cd_dst, cddata_type, CD_CALLOC, NULL, num_elem_dst, name);
idx_dst = CustomData_get_named_layer(cd_dst, cddata_type, name);
}
- /* If dest is a derivedmesh, we do not want to overwrite cdlayers of org mesh! */
+ /* If dest is a evaluated mesh (from modifier), we do not want to overwrite cdlayers of orig mesh! */
if (use_dupref_dst && r_map) {
data_dst = CustomData_duplicate_referenced_layer_n(cd_dst, cddata_type, idx_dst, num_elem_dst);
}
@@ -763,7 +760,7 @@ static bool data_transfer_layersmapping_cdlayers(
}
static bool data_transfer_layersmapping_generate(
- ListBase *r_map, Object *ob_src, Object *ob_dst, DerivedMesh *dm_src, DerivedMesh *dm_dst, Mesh *me_dst,
+ ListBase *r_map, Object *ob_src, Object *ob_dst, Mesh *me_src, Mesh *me_dst,
const int elem_type, int cddata_type, int mix_mode, float mix_factor, const float *mix_weights,
const int num_elem_dst, const bool use_create, const bool use_delete, const int fromlayers, const int tolayers,
SpaceTransform *space_transform)
@@ -775,12 +772,12 @@ static bool data_transfer_layersmapping_generate(
if (elem_type == ME_VERT) {
if (!(cddata_type & CD_FAKE)) {
- cd_src = dm_src->getVertDataLayout(dm_src);
- cd_dst = dm_dst ? dm_dst->getVertDataLayout(dm_dst) : &me_dst->vdata;
+ cd_src = &me_src->vdata;
+ cd_dst = &me_dst->vdata;
if (!data_transfer_layersmapping_cdlayers(r_map, cddata_type, mix_mode, mix_factor, mix_weights,
num_elem_dst, use_create, use_delete,
- cd_src, cd_dst, dm_dst != NULL,
+ cd_src, cd_dst, me_dst != ob_dst->data,
fromlayers, tolayers,
interp, interp_data))
{
@@ -795,24 +792,17 @@ static bool data_transfer_layersmapping_generate(
const size_t data_offset = offsetof(MVert, bweight);
const uint64_t data_flag = 0;
- if (!(dm_src->cd_flag & ME_CDFLAG_VERT_BWEIGHT)) {
- if (use_delete && !dm_dst) {
+ if (!(me_src->cd_flag & ME_CDFLAG_VERT_BWEIGHT)) {
+ if (use_delete) {
me_dst->cd_flag &= ~ME_CDFLAG_VERT_BWEIGHT;
}
return true;
}
- if (dm_dst) {
- dm_dst->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
- }
- else {
- me_dst->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
- }
+ me_dst->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
if (r_map) {
data_transfer_layersmapping_add_item(r_map, cddata_type, mix_mode, mix_factor, mix_weights,
- dm_src->getVertArray(dm_src),
- dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert,
- dm_src->getNumVerts(dm_src),
- dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert,
+ me_src->mvert, me_dst->mvert,
+ me_src->totvert, me_dst->totvert,
elem_size, data_size, data_offset, data_flag,
data_transfer_interp_char, interp_data);
}
@@ -821,12 +811,12 @@ static bool data_transfer_layersmapping_generate(
else if (cddata_type == CD_FAKE_MDEFORMVERT) {
bool ret;
- cd_src = dm_src->getVertDataLayout(dm_src);
- cd_dst = dm_dst ? dm_dst->getVertDataLayout(dm_dst) : &me_dst->vdata;
+ cd_src = &me_src->vdata;
+ cd_dst = &me_dst->vdata;
ret = data_transfer_layersmapping_vgroups(r_map, mix_mode, mix_factor, mix_weights,
num_elem_dst, use_create, use_delete,
- ob_src, ob_dst, cd_src, cd_dst, dm_dst != NULL,
+ ob_src, ob_dst, cd_src, cd_dst, me_dst != ob_dst->data,
fromlayers, tolayers);
/* Mesh stores its dvert in a specific pointer too. :( */
@@ -840,12 +830,12 @@ static bool data_transfer_layersmapping_generate(
}
else if (elem_type == ME_EDGE) {
if (!(cddata_type & CD_FAKE)) { /* Unused for edges, currently... */
- cd_src = dm_src->getEdgeDataLayout(dm_src);
- cd_dst = dm_dst ? dm_dst->getEdgeDataLayout(dm_dst) : &me_dst->edata;
+ cd_src = &me_src->edata;
+ cd_dst = &me_dst->edata;
if (!data_transfer_layersmapping_cdlayers(r_map, cddata_type, mix_mode, mix_factor, mix_weights,
num_elem_dst, use_create, use_delete,
- cd_src, cd_dst, dm_dst != NULL,
+ cd_src, cd_dst, me_dst != ob_dst->data,
fromlayers, tolayers,
interp, interp_data))
{
@@ -860,24 +850,17 @@ static bool data_transfer_layersmapping_generate(
const size_t data_offset = offsetof(MEdge, crease);
const uint64_t data_flag = 0;
- if (!(dm_src->cd_flag & ME_CDFLAG_EDGE_CREASE)) {
- if (use_delete && !dm_dst) {
+ if (!(me_src->cd_flag & ME_CDFLAG_EDGE_CREASE)) {
+ if (use_delete && !me_dst) {
me_dst->cd_flag &= ~ME_CDFLAG_EDGE_CREASE;
}
return true;
}
- if (dm_dst) {
- dm_dst->cd_flag |= ME_CDFLAG_EDGE_CREASE;
- }
- else {
- me_dst->cd_flag |= ME_CDFLAG_EDGE_CREASE;
- }
+ me_dst->cd_flag |= ME_CDFLAG_EDGE_CREASE;
if (r_map) {
data_transfer_layersmapping_add_item(r_map, cddata_type, mix_mode, mix_factor, mix_weights,
- dm_src->getEdgeArray(dm_src),
- dm_dst ? dm_dst->getEdgeArray(dm_dst) : me_dst->medge,
- dm_src->getNumEdges(dm_src),
- dm_dst ? dm_dst->getNumEdges(dm_dst) : me_dst->totedge,
+ me_src->medge, me_dst->medge,
+ me_src->totedge, me_dst->totedge,
elem_size, data_size, data_offset, data_flag,
data_transfer_interp_char, interp_data);
}
@@ -889,24 +872,17 @@ static bool data_transfer_layersmapping_generate(
const size_t data_offset = offsetof(MEdge, bweight);
const uint64_t data_flag = 0;
- if (!(dm_src->cd_flag & ME_CDFLAG_EDGE_BWEIGHT)) {
- if (use_delete && !dm_dst) {
+ if (!(me_src->cd_flag & ME_CDFLAG_EDGE_BWEIGHT)) {
+ if (use_delete && !me_dst) {
me_dst->cd_flag &= ~ME_CDFLAG_EDGE_BWEIGHT;
}
return true;
}
- if (dm_dst) {
- dm_dst->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
- }
- else {
- me_dst->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
- }
+ me_dst->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
if (r_map) {
data_transfer_layersmapping_add_item(r_map, cddata_type, mix_mode, mix_factor, mix_weights,
- dm_src->getEdgeArray(dm_src),
- dm_dst ? dm_dst->getEdgeArray(dm_dst) : me_dst->medge,
- dm_src->getNumEdges(dm_src),
- dm_dst ? dm_dst->getNumEdges(dm_dst) : me_dst->totedge,
+ me_src->medge, me_dst->medge,
+ me_src->totedge, me_dst->totedge,
elem_size, data_size, data_offset, data_flag,
data_transfer_interp_char, interp_data);
}
@@ -920,10 +896,8 @@ static bool data_transfer_layersmapping_generate(
data_transfer_layersmapping_add_item(
r_map, cddata_type, mix_mode, mix_factor, mix_weights,
- dm_src->getEdgeArray(dm_src),
- dm_dst ? dm_dst->getEdgeArray(dm_dst) : me_dst->medge,
- dm_src->getNumEdges(dm_src),
- dm_dst ? dm_dst->getNumEdges(dm_dst) : me_dst->totedge,
+ me_src->medge, me_dst->medge,
+ me_src->totedge, me_dst->totedge,
elem_size, data_size, data_offset, data_flag, NULL, interp_data);
return true;
}
@@ -943,12 +917,12 @@ static bool data_transfer_layersmapping_generate(
}
if (!(cddata_type & CD_FAKE)) {
- cd_src = dm_src->getLoopDataLayout(dm_src);
- cd_dst = dm_dst ? dm_dst->getLoopDataLayout(dm_dst) : &me_dst->ldata;
+ cd_src = &me_src->ldata;
+ cd_dst = &me_dst->ldata;
if (!data_transfer_layersmapping_cdlayers(
r_map, cddata_type, mix_mode, mix_factor, mix_weights,
- num_elem_dst, use_create, use_delete, cd_src, cd_dst, dm_dst != NULL,
+ num_elem_dst, use_create, use_delete, cd_src, cd_dst, me_dst != ob_dst->data,
fromlayers, tolayers,
interp, interp_data))
{
@@ -967,12 +941,12 @@ static bool data_transfer_layersmapping_generate(
}
if (!(cddata_type & CD_FAKE)) {
- cd_src = dm_src->getPolyDataLayout(dm_src);
- cd_dst = dm_dst ? dm_dst->getPolyDataLayout(dm_dst) : &me_dst->pdata;
+ cd_src = &me_src->pdata;
+ cd_dst = &me_dst->pdata;
if (!data_transfer_layersmapping_cdlayers(
r_map, cddata_type, mix_mode, mix_factor, mix_weights,
- num_elem_dst, use_create, use_delete, cd_src, cd_dst, dm_dst != NULL,
+ num_elem_dst, use_create, use_delete, cd_src, cd_dst, me_dst != ob_dst->data,
fromlayers, tolayers,
interp, interp_data))
{
@@ -989,10 +963,8 @@ static bool data_transfer_layersmapping_generate(
data_transfer_layersmapping_add_item(
r_map, cddata_type, mix_mode, mix_factor, mix_weights,
- dm_src->getPolyArray(dm_src),
- dm_dst ? dm_dst->getPolyArray(dm_dst) : me_dst->mpoly,
- dm_src->getNumPolys(dm_src),
- dm_dst ? dm_dst->getNumPolys(dm_dst) : me_dst->totpoly,
+ me_src->mpoly, me_dst->mpoly,
+ me_src->totpoly, me_dst->totpoly,
elem_size, data_size, data_offset, data_flag, NULL, interp_data);
return true;
}
@@ -1015,22 +987,22 @@ void BKE_object_data_transfer_layout(
Object *ob_src, Object *ob_dst, const int data_types, const bool use_delete,
const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX])
{
- DerivedMesh *dm_src;
+ Mesh *me_src;
Mesh *me_dst;
int i;
const bool use_create = true; /* We always create needed layers here. */
- CustomDataMask dm_src_mask = CD_MASK_BAREMESH;
+ CustomDataMask me_src_mask = CD_MASK_BAREMESH;
BLI_assert((ob_src != ob_dst) && (ob_src->type == OB_MESH) && (ob_dst->type == OB_MESH));
me_dst = ob_dst->data;
- /* Get source DM.*/
- dm_src_mask |= BKE_object_data_transfer_dttypes_to_cdmask(data_types);
- dm_src = mesh_get_derived_final(depsgraph, scene, ob_src, dm_src_mask);
- if (!dm_src) {
+ /* Get source evaluated mesh.*/
+ me_src_mask |= BKE_object_data_transfer_dttypes_to_cdmask(data_types);
+ me_src = mesh_get_eval_final(depsgraph, scene, ob_src, me_src_mask);
+ if (!me_src) {
return;
}
@@ -1059,35 +1031,35 @@ void BKE_object_data_transfer_layout(
const int num_elem_dst = me_dst->totvert;
data_transfer_layersmapping_generate(
- NULL, ob_src, ob_dst, dm_src, NULL, me_dst, ME_VERT, cddata_type, 0, 0.0f, NULL,
+ NULL, ob_src, ob_dst, me_src, me_dst, ME_VERT, cddata_type, 0, 0.0f, NULL,
num_elem_dst, use_create, use_delete, fromlayers, tolayers, NULL);
}
if (DT_DATATYPE_IS_EDGE(dtdata_type)) {
const int num_elem_dst = me_dst->totedge;
data_transfer_layersmapping_generate(
- NULL, ob_src, ob_dst, dm_src, NULL, me_dst, ME_EDGE, cddata_type, 0, 0.0f, NULL,
+ NULL, ob_src, ob_dst, me_src, me_dst, ME_EDGE, cddata_type, 0, 0.0f, NULL,
num_elem_dst, use_create, use_delete, fromlayers, tolayers, NULL);
}
if (DT_DATATYPE_IS_LOOP(dtdata_type)) {
const int num_elem_dst = me_dst->totloop;
data_transfer_layersmapping_generate(
- NULL, ob_src, ob_dst, dm_src, NULL, me_dst, ME_LOOP, cddata_type, 0, 0.0f, NULL,
+ NULL, ob_src, ob_dst, me_src, me_dst, ME_LOOP, cddata_type, 0, 0.0f, NULL,
num_elem_dst, use_create, use_delete, fromlayers, tolayers, NULL);
}
if (DT_DATATYPE_IS_POLY(dtdata_type)) {
const int num_elem_dst = me_dst->totpoly;
data_transfer_layersmapping_generate(
- NULL, ob_src, ob_dst, dm_src, NULL, me_dst, ME_POLY, cddata_type, 0, 0.0f, NULL,
+ NULL, ob_src, ob_dst, me_src, me_dst, ME_POLY, cddata_type, 0, 0.0f, NULL,
num_elem_dst, use_create, use_delete, fromlayers, tolayers, NULL);
}
}
}
-bool BKE_object_data_transfer_dm(
- struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, Object *ob_dst, DerivedMesh *dm_dst,
+bool BKE_object_data_transfer_ex(
+ struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, Object *ob_dst, Mesh *me_dst,
const int data_types, bool use_create, const int map_vert_mode, const int map_edge_mode,
const int map_loop_mode, const int map_poly_mode, SpaceTransform *space_transform, const bool auto_transform,
const float max_distance, const float ray_radius, const float islands_handling_precision,
@@ -1103,9 +1075,8 @@ bool BKE_object_data_transfer_dm(
SpaceTransform auto_space_transform;
- DerivedMesh *dm_src;
- Mesh *me_dst, *me_src;
- bool dirty_nors_dst = true; /* Assumed always true if not using a dm as destination. */
+ Mesh *me_src;
+ bool dirty_nors_dst = true; /* Assumed always true if not using an evaluated mesh as destination. */
int i;
MDeformVert *mdef = NULL;
@@ -1119,53 +1090,40 @@ bool BKE_object_data_transfer_dm(
const bool use_delete = false; /* We never delete data layers from destination here. */
- CustomDataMask dm_src_mask = CD_MASK_BAREMESH;
+ CustomDataMask me_src_mask = CD_MASK_BAREMESH;
BLI_assert((ob_src != ob_dst) && (ob_src->type == OB_MESH) && (ob_dst->type == OB_MESH));
- me_dst = ob_dst->data;
- me_src = ob_src->data;
- if (dm_dst) {
- dirty_nors_dst = (dm_dst->dirty & DM_DIRTY_NORMALS) != 0;
- use_create = false; /* Never create needed custom layers on DM (modifier case). */
+ if (me_dst) {
+ dirty_nors_dst = (me_dst->runtime.cd_dirty_vert & CD_NORMAL) != 0;
+ /* Never create needed custom layers on passed destination mesh
+ * (assumed to *not* be ob_dst->data, aka modifier case). */
+ use_create = false;
+ }
+ else {
+ me_dst = ob_dst->data;
}
if (vgroup_name) {
- if (dm_dst) {
- mdef = dm_dst->getVertDataArray(dm_dst, CD_MDEFORMVERT);
- }
- else {
- mdef = CustomData_get_layer(&me_dst->vdata, CD_MDEFORMVERT);
- }
+ mdef = CustomData_get_layer(&me_dst->vdata, CD_MDEFORMVERT);
if (mdef) {
vg_idx = defgroup_name_index(ob_dst, vgroup_name);
}
}
- /* Get source DM.*/
- dm_src_mask |= BKE_object_data_transfer_dttypes_to_cdmask(data_types);
- /* XXX Hack! In case this is being evaluated from dm stack, we cannot compute final dm,
- * can lead to infinite recursion in case of dependency cycles of DataTransfer modifiers...
- * Issue is, this means we cannot be sure to have requested cd layers in source.
- *
- * Also, we need to make a local copy of dm_src, otherwise we may end with concurrent creation
- * of data in it (multi-threaded evaluation of the modifier stack, see T46672).
- */
- dm_src = dm_dst ? ob_src->derivedFinal : mesh_get_derived_final(depsgraph, scene, ob_src, dm_src_mask);
- if (!dm_src) {
+ /* Get source evaluated mesh.*/
+ me_src_mask |= BKE_object_data_transfer_dttypes_to_cdmask(data_types);
+ me_src = mesh_get_eval_final(depsgraph, scene, ob_src, me_src_mask);
+ if (!me_src) {
return changed;
}
- dm_src = CDDM_copy(dm_src);
if (auto_transform) {
- MVert *verts_dst = dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert;
- const int num_verts_dst = dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert;
-
if (space_transform == NULL) {
space_transform = &auto_space_transform;
}
- BKE_mesh_remap_find_best_match_from_dm(verts_dst, num_verts_dst, dm_src, space_transform);
+ BKE_mesh_remap_find_best_match_from_mesh(me_dst->mvert, me_dst->totvert, me_src, space_transform);
}
/* Check all possible data types.
@@ -1179,9 +1137,7 @@ bool BKE_object_data_transfer_dm(
continue;
}
- data_transfer_dtdata_type_preprocess(ob_src, ob_dst, dm_src, dm_dst, me_dst,
- dtdata_type, dirty_nors_dst,
- (me_src->flag & ME_AUTOSMOOTH) != 0, me_src->smoothresh);
+ data_transfer_dtdata_type_preprocess(me_src, me_dst, dtdata_type, dirty_nors_dst);
cddata_type = BKE_object_data_transfer_dttype_to_cdtype(dtdata_type);
@@ -1195,11 +1151,11 @@ bool BKE_object_data_transfer_dm(
}
if (DT_DATATYPE_IS_VERT(dtdata_type)) {
- MVert *verts_dst = dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert;
- const int num_verts_dst = dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert;
+ MVert *verts_dst = me_dst->mvert;
+ const int num_verts_dst = me_dst->totvert;
if (!geom_map_init[VDATA]) {
- const int num_verts_src = dm_src->getNumVerts(dm_src);
+ const int num_verts_src = me_src->totvert;
if ((map_vert_mode == MREMAP_MODE_TOPOLOGY) && (num_verts_dst != num_verts_src)) {
BKE_report(reports, RPT_ERROR,
@@ -1207,13 +1163,13 @@ bool BKE_object_data_transfer_dm(
"'Topology' mapping cannot be used in this case");
continue;
}
- if ((map_vert_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) {
+ if ((map_vert_mode & MREMAP_USE_EDGE) && (me_src->totedge == 0)) {
BKE_report(reports, RPT_ERROR,
"Source mesh doesn't have any edges, "
"None of the 'Edge' mappings can be used in this case");
continue;
}
- if ((map_vert_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) {
+ if ((map_vert_mode & MREMAP_USE_POLY) && (me_src->totpoly == 0)) {
BKE_report(reports, RPT_ERROR,
"Source mesh doesn't have any faces, "
"None of the 'Face' mappings can be used in this case");
@@ -1225,9 +1181,9 @@ bool BKE_object_data_transfer_dm(
continue;
}
- BKE_mesh_remap_calc_verts_from_dm(
+ BKE_mesh_remap_calc_verts_from_mesh(
map_vert_mode, space_transform, max_distance, ray_radius,
- verts_dst, num_verts_dst, dirty_nors_dst, dm_src, &geom_map[VDATA]);
+ verts_dst, num_verts_dst, dirty_nors_dst, me_src, &geom_map[VDATA]);
geom_map_init[VDATA] = true;
}
@@ -1237,7 +1193,7 @@ bool BKE_object_data_transfer_dm(
}
if (data_transfer_layersmapping_generate(
- &lay_map, ob_src, ob_dst, dm_src, dm_dst, me_dst, ME_VERT,
+ &lay_map, ob_src, ob_dst, me_src, me_dst, ME_VERT,
cddata_type, mix_mode, mix_factor, weights[VDATA],
num_verts_dst, use_create, use_delete, fromlayers, tolayers, space_transform))
{
@@ -1253,13 +1209,13 @@ bool BKE_object_data_transfer_dm(
}
}
if (DT_DATATYPE_IS_EDGE(dtdata_type)) {
- MVert *verts_dst = dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert;
- const int num_verts_dst = dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert;
- MEdge *edges_dst = dm_dst ? dm_dst->getEdgeArray(dm_dst) : me_dst->medge;
- const int num_edges_dst = dm_dst ? dm_dst->getNumEdges(dm_dst) : me_dst->totedge;
+ MVert *verts_dst = me_dst->mvert;
+ const int num_verts_dst = me_dst->totvert;
+ MEdge *edges_dst = me_dst->medge;
+ const int num_edges_dst = me_dst->totedge;
if (!geom_map_init[EDATA]) {
- const int num_edges_src = dm_src->getNumEdges(dm_src);
+ const int num_edges_src = me_src->totedge;
if ((map_edge_mode == MREMAP_MODE_TOPOLOGY) && (num_edges_dst != num_edges_src)) {
BKE_report(reports, RPT_ERROR,
@@ -1267,7 +1223,7 @@ bool BKE_object_data_transfer_dm(
"'Topology' mapping cannot be used in this case");
continue;
}
- if ((map_edge_mode & MREMAP_USE_POLY) && (dm_src->getNumPolys(dm_src) == 0)) {
+ if ((map_edge_mode & MREMAP_USE_POLY) && (me_src->totpoly == 0)) {
BKE_report(reports, RPT_ERROR,
"Source mesh doesn't have any faces, "
"None of the 'Face' mappings can be used in this case");
@@ -1279,10 +1235,10 @@ bool BKE_object_data_transfer_dm(
continue;
}
- BKE_mesh_remap_calc_edges_from_dm(
+ BKE_mesh_remap_calc_edges_from_mesh(
map_edge_mode, space_transform, max_distance, ray_radius,
verts_dst, num_verts_dst, edges_dst, num_edges_dst, dirty_nors_dst,
- dm_src, &geom_map[EDATA]);
+ me_src, &geom_map[EDATA]);
geom_map_init[EDATA] = true;
}
@@ -1294,7 +1250,7 @@ bool BKE_object_data_transfer_dm(
}
if (data_transfer_layersmapping_generate(
- &lay_map, ob_src, ob_dst, dm_src, dm_dst, me_dst, ME_EDGE,
+ &lay_map, ob_src, ob_dst, me_src, me_dst, ME_EDGE,
cddata_type, mix_mode, mix_factor, weights[EDATA],
num_edges_dst, use_create, use_delete, fromlayers, tolayers, space_transform))
{
@@ -1310,21 +1266,21 @@ bool BKE_object_data_transfer_dm(
}
}
if (DT_DATATYPE_IS_LOOP(dtdata_type)) {
- MVert *verts_dst = dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert;
- const int num_verts_dst = dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert;
- MEdge *edges_dst = dm_dst ? dm_dst->getEdgeArray(dm_dst) : me_dst->medge;
- const int num_edges_dst = dm_dst ? dm_dst->getNumEdges(dm_dst) : me_dst->totedge;
- MPoly *polys_dst = dm_dst ? dm_dst->getPolyArray(dm_dst) : me_dst->mpoly;
- const int num_polys_dst = dm_dst ? dm_dst->getNumPolys(dm_dst) : me_dst->totpoly;
- MLoop *loops_dst = dm_dst ? dm_dst->getLoopArray(dm_dst) : me_dst->mloop;
- const int num_loops_dst = dm_dst ? dm_dst->getNumLoops(dm_dst) : me_dst->totloop;
- CustomData *pdata_dst = dm_dst ? dm_dst->getPolyDataLayout(dm_dst) : &me_dst->pdata;
- CustomData *ldata_dst = dm_dst ? dm_dst->getLoopDataLayout(dm_dst) : &me_dst->ldata;
+ MVert *verts_dst = me_dst->mvert;
+ const int num_verts_dst = me_dst->totvert;
+ MEdge *edges_dst = me_dst->medge;
+ const int num_edges_dst = me_dst->totedge;
+ MPoly *polys_dst = me_dst->mpoly;
+ const int num_polys_dst = me_dst->totpoly;
+ MLoop *loops_dst = me_dst->mloop;
+ const int num_loops_dst = me_dst->totloop;
+ CustomData *pdata_dst = &me_dst->pdata;
+ CustomData *ldata_dst = &me_dst->ldata;
MeshRemapIslandsCalc island_callback = data_transfer_get_loop_islands_generator(cddata_type);
if (!geom_map_init[LDATA]) {
- const int num_loops_src = dm_src->getNumLoops(dm_src);
+ const int num_loops_src = me_src->totloop;
if ((map_loop_mode == MREMAP_MODE_TOPOLOGY) && (num_loops_dst != num_loops_src)) {
BKE_report(reports, RPT_ERROR,
@@ -1332,7 +1288,7 @@ bool BKE_object_data_transfer_dm(
"'Topology' mapping cannot be used in this case");
continue;
}
- if ((map_loop_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) {
+ if ((map_loop_mode & MREMAP_USE_EDGE) && (me_src->totedge == 0)) {
BKE_report(reports, RPT_ERROR,
"Source mesh doesn't have any edges, "
"None of the 'Edge' mappings can be used in this case");
@@ -1344,13 +1300,13 @@ bool BKE_object_data_transfer_dm(
continue;
}
- BKE_mesh_remap_calc_loops_from_dm(
+ BKE_mesh_remap_calc_loops_from_mesh(
map_loop_mode, space_transform, max_distance, ray_radius,
verts_dst, num_verts_dst, edges_dst, num_edges_dst,
loops_dst, num_loops_dst, polys_dst, num_polys_dst,
ldata_dst, pdata_dst,
(me_dst->flag & ME_AUTOSMOOTH) != 0, me_dst->smoothresh, dirty_nors_dst,
- dm_src, (me_src->flag & ME_AUTOSMOOTH) != 0, me_src->smoothresh,
+ me_src,
island_callback, islands_handling_precision, &geom_map[LDATA]);
geom_map_init[LDATA] = true;
}
@@ -1363,7 +1319,7 @@ bool BKE_object_data_transfer_dm(
}
if (data_transfer_layersmapping_generate(
- &lay_map, ob_src, ob_dst, dm_src, dm_dst, me_dst, ME_LOOP,
+ &lay_map, ob_src, ob_dst, me_src, me_dst, ME_LOOP,
cddata_type, mix_mode, mix_factor, weights[LDATA],
num_loops_dst, use_create, use_delete, fromlayers, tolayers, space_transform))
{
@@ -1379,16 +1335,16 @@ bool BKE_object_data_transfer_dm(
}
}
if (DT_DATATYPE_IS_POLY(dtdata_type)) {
- MVert *verts_dst = dm_dst ? dm_dst->getVertArray(dm_dst) : me_dst->mvert;
- const int num_verts_dst = dm_dst ? dm_dst->getNumVerts(dm_dst) : me_dst->totvert;
- MPoly *polys_dst = dm_dst ? dm_dst->getPolyArray(dm_dst) : me_dst->mpoly;
- const int num_polys_dst = dm_dst ? dm_dst->getNumPolys(dm_dst) : me_dst->totpoly;
- MLoop *loops_dst = dm_dst ? dm_dst->getLoopArray(dm_dst) : me_dst->mloop;
- const int num_loops_dst = dm_dst ? dm_dst->getNumLoops(dm_dst) : me_dst->totloop;
- CustomData *pdata_dst = dm_dst ? dm_dst->getPolyDataLayout(dm_dst) : &me_dst->pdata;
+ MVert *verts_dst = me_dst->mvert;
+ const int num_verts_dst = me_dst->totvert;
+ MPoly *polys_dst = me_dst->mpoly;
+ const int num_polys_dst = me_dst->totpoly;
+ MLoop *loops_dst = me_dst->mloop;
+ const int num_loops_dst = me_dst->totloop;
+ CustomData *pdata_dst = &me_dst->pdata;
if (!geom_map_init[PDATA]) {
- const int num_polys_src = dm_src->getNumPolys(dm_src);
+ const int num_polys_src = me_src->totpoly;
if ((map_poly_mode == MREMAP_MODE_TOPOLOGY) && (num_polys_dst != num_polys_src)) {
BKE_report(reports, RPT_ERROR,
@@ -1396,7 +1352,7 @@ bool BKE_object_data_transfer_dm(
"'Topology' mapping cannot be used in this case");
continue;
}
- if ((map_poly_mode & MREMAP_USE_EDGE) && (dm_src->getNumEdges(dm_src) == 0)) {
+ if ((map_poly_mode & MREMAP_USE_EDGE) && (me_src->totedge == 0)) {
BKE_report(reports, RPT_ERROR,
"Source mesh doesn't have any edges, "
"None of the 'Edge' mappings can be used in this case");
@@ -1408,11 +1364,11 @@ bool BKE_object_data_transfer_dm(
continue;
}
- BKE_mesh_remap_calc_polys_from_dm(
+ BKE_mesh_remap_calc_polys_from_mesh(
map_poly_mode, space_transform, max_distance, ray_radius,
verts_dst, num_verts_dst, loops_dst, num_loops_dst,
polys_dst, num_polys_dst, pdata_dst, dirty_nors_dst,
- dm_src, &geom_map[PDATA]);
+ me_src, &geom_map[PDATA]);
geom_map_init[PDATA] = true;
}
@@ -1424,7 +1380,7 @@ bool BKE_object_data_transfer_dm(
}
if (data_transfer_layersmapping_generate(
- &lay_map, ob_src, ob_dst, dm_src, dm_dst, me_dst, ME_POLY,
+ &lay_map, ob_src, ob_dst, me_src, me_dst, ME_POLY,
cddata_type, mix_mode, mix_factor, weights[PDATA],
num_polys_dst, use_create, use_delete, fromlayers, tolayers, space_transform))
{
@@ -1440,14 +1396,13 @@ bool BKE_object_data_transfer_dm(
}
}
- data_transfer_dtdata_type_postprocess(ob_src, ob_dst, dm_src, dm_dst, me_dst, dtdata_type, changed);
+ data_transfer_dtdata_type_postprocess(ob_src, ob_dst, me_src, me_dst, dtdata_type, changed);
}
for (i = 0; i < DATAMAX; i++) {
BKE_mesh_remap_free(&geom_map[i]);
MEM_SAFE_FREE(weights[i]);
}
- dm_src->release(dm_src);
return changed;
@@ -1467,7 +1422,7 @@ bool BKE_object_data_transfer_mesh(
const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup,
ReportList *reports)
{
- return BKE_object_data_transfer_dm(
+ return BKE_object_data_transfer_ex(
depsgraph, scene, ob_src, ob_dst, NULL, data_types, use_create,
map_vert_mode, map_edge_mode, map_loop_mode, map_poly_mode,
space_transform, auto_transform,
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 2da157d5b88..d08e3643ca7 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -1293,3 +1293,43 @@ bool data_transfer_layersmapping_vgroups(
}
/** \} */
+
+/* -------------------------------------------------------------------- */
+
+/** \name Various utils & helpers.
+ * \{ */
+
+void BKE_defvert_weight_to_rgb(float r_rgb[3], const float weight)
+{
+ const float blend = ((weight / 2.0f) + 0.5f);
+
+ if (weight <= 0.25f) { /* blue->cyan */
+ r_rgb[0] = 0.0f;
+ r_rgb[1] = blend * weight * 4.0f;
+ r_rgb[2] = blend;
+ }
+ else if (weight <= 0.50f) { /* cyan->green */
+ r_rgb[0] = 0.0f;
+ r_rgb[1] = blend;
+ r_rgb[2] = blend * (1.0f - ((weight - 0.25f) * 4.0f));
+ }
+ else if (weight <= 0.75f) { /* green->yellow */
+ r_rgb[0] = blend * ((weight - 0.50f) * 4.0f);
+ r_rgb[1] = blend;
+ r_rgb[2] = 0.0f;
+ }
+ else if (weight <= 1.0f) { /* yellow->red */
+ r_rgb[0] = blend;
+ r_rgb[1] = blend * (1.0f - ((weight - 0.75f) * 4.0f));
+ r_rgb[2] = 0.0f;
+ }
+ else {
+ /* exceptional value, unclamped or nan,
+ * avoid uninitialized memory use */
+ r_rgb[0] = 1.0f;
+ r_rgb[1] = 0.0f;
+ r_rgb[2] = 1.0f;
+ }
+}
+
+/** \} */
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index ad055a727a9..34fd32b2908 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -855,8 +855,6 @@ static void curve_calc_modifiers_pre(
for (; md; md = md->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
if (!modifier_isEnabled(scene, md, required_mode))
continue;
if (mti->type != eModifierTypeType_OnlyDeform)
@@ -866,7 +864,7 @@ static void curve_calc_modifiers_pre(
deformedVerts = BKE_curve_nurbs_vertexCos_get(nurb, &numVerts);
}
- modifier_deformVerts_DM_deprecated(md, &mectx, NULL, deformedVerts, numVerts);
+ modifier_deformVerts(md, &mectx, NULL, deformedVerts, numVerts);
if (md == pretessellatePoint)
break;
@@ -961,7 +959,6 @@ static void curve_calc_modifiers_post(
for (; md; md = md->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
if (!modifier_isEnabled(scene, md, required_mode))
continue;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index ed2566c9bb5..c1bdfc42a05 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -56,6 +56,7 @@
#include "BKE_armature.h"
#include "BKE_bvhutils.h" /* bvh tree */
#include "BKE_collection.h"
+#include "BKE_collision.h"
#include "BKE_colorband.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_constraint.h"
@@ -490,28 +491,17 @@ static void scene_setSubframe(Scene *scene, float subframe)
scene->r.subframe = subframe;
}
-static int surface_getBrushFlags(DynamicPaintSurface *surface, const Depsgraph *depsgraph)
+static int surface_getBrushFlags(DynamicPaintSurface *surface, Depsgraph *depsgraph)
{
- Base *base = BKE_collection_or_layer_objects(depsgraph, NULL, NULL, surface->brush_group);
- Object *brushObj = NULL;
- ModifierData *md = NULL;
+ unsigned int numobjects;
+ Object **objects = BKE_collision_objects_create(depsgraph, NULL, surface->brush_group, &numobjects, eModifierType_DynamicPaint);
int flags = 0;
- while (base) {
- brushObj = NULL;
+ for (int i = 0; i < numobjects; i++) {
+ Object *brushObj = objects[i];
- /* select object */
- brushObj = base->object;
-
- /* next item */
- base = base->next;
-
- if (!brushObj) {
- continue;
- }
-
- md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
+ ModifierData *md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)md;
@@ -524,6 +514,8 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, const Depsgraph *
}
}
+ BKE_collision_objects_free(objects);
+
return flags;
}
@@ -4886,7 +4878,7 @@ static void dynamic_paint_prepare_effect_cb(
EffectedPoint epoint;
pd_point_from_loc(scene, realCoord[bData->s_pos[index]].v, vel, index, &epoint);
epoint.vel_to_sec = 1.0f;
- pdDoEffectors(effectors, NULL, surface->effector_weights, &epoint, forc, NULL);
+ BKE_effectors_apply(effectors, NULL, surface->effector_weights, &epoint, forc, NULL);
}
/* if global gravity is enabled, add it too */
@@ -4926,7 +4918,7 @@ static int dynamicPaint_prepareEffectStep(
/* Init force data if required */
if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) {
- ListBase *effectors = pdInitEffectors(depsgraph, scene, ob, NULL, surface->effector_weights, true);
+ ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, surface->effector_weights);
/* allocate memory for force data (dir vector + strength) */
*force = MEM_mallocN(sData->total_points * 4 * sizeof(float), "PaintEffectForces");
@@ -4950,7 +4942,7 @@ static int dynamicPaint_prepareEffectStep(
}
average_force /= sData->total_points;
}
- pdEndEffectors(&effectors);
+ BKE_effectors_free(effectors);
}
/* Get number of required steps using average point distance
@@ -5758,7 +5750,7 @@ static void dynamic_paint_generate_bake_data_cb(
}
}
-static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, const Depsgraph *depsgraph, Object *ob)
+static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Depsgraph *depsgraph, Object *ob)
{
PaintSurfaceData *sData = surface->data;
PaintBakeData *bData = sData->bData;
@@ -5890,6 +5882,7 @@ static int dynamicPaint_doStep(
PaintSurfaceData *sData = surface->data;
PaintBakeData *bData = sData->bData;
DynamicPaintCanvasSettings *canvas = surface->canvas;
+ const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
int ret = 1;
if (sData->total_points < 1)
@@ -5910,29 +5903,18 @@ static int dynamicPaint_doStep(
* Loop through surface's target paint objects and do painting
*/
{
- Object *brushObj = NULL;
- ModifierData *md = NULL;
- Base *base = BKE_collection_or_layer_objects(depsgraph, NULL, NULL, surface->brush_group);
+ unsigned int numobjects;
+ Object **objects = BKE_collision_objects_create(depsgraph, NULL, surface->brush_group, &numobjects, eModifierType_DynamicPaint);
/* backup current scene frame */
int scene_frame = scene->r.cfra;
float scene_subframe = scene->r.subframe;
- while (base) {
- brushObj = NULL;
- /* select object */
- brushObj = base->object;
-
- /* next item */
- base = base->next;
-
- if (!brushObj) {
- /* skip item */
- continue;
- }
+ for (int i = 0; i < numobjects; i++) {
+ Object *brushObj = objects[i];
/* check if target has an active dp modifier */
- md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
+ ModifierData *md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)) {
DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)md;
/* make sure we're dealing with a brush */
@@ -5960,7 +5942,7 @@ static int dynamicPaint_doStep(
/* Apply brush on the surface depending on it's collision type */
if (brush->psys && brush->psys->part &&
ELEM(brush->psys->part->type, PART_EMITTER, PART_FLUID) &&
- psys_check_enabled(brushObj, brush->psys, G.is_rendering))
+ psys_check_enabled(brushObj, brush->psys, for_render))
{
/* Paint a particle system */
BKE_animsys_evaluate_animdata(depsgraph, scene, &brush->psys->part->id, brush->psys->part->adt,
@@ -5994,6 +5976,8 @@ static int dynamicPaint_doStep(
}
}
}
+
+ BKE_collision_objects_free(objects);
}
/* surfaces operations that use adjacency data */
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 657461e3bf5..87d93db640d 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -49,6 +49,7 @@
#include "BLI_task.h"
#include "BKE_cdderivedmesh.h"
+#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_editmesh.h"
#include "BKE_editmesh_bvh.h"
@@ -1082,7 +1083,7 @@ static void statvis_calc_overhang(
/* fallback max */
{
float fcol[3];
- weight_to_rgb(fcol, 1.0f);
+ BKE_defvert_weight_to_rgb(fcol, 1.0f);
rgb_float_to_uchar(col_fallback_max, fcol);
}
@@ -1096,7 +1097,7 @@ static void statvis_calc_overhang(
fac = (fac - min) * minmax_irange;
fac = 1.0f - fac;
CLAMP(fac, 0.0f, 1.0f);
- weight_to_rgb(fcol, fac);
+ BKE_defvert_weight_to_rgb(fcol, fac);
rgb_float_to_uchar(r_face_colors[index], fcol);
}
else {
@@ -1231,7 +1232,7 @@ static void statvis_calc_thickness(
fac = (fac - min) * minmax_irange;
fac = 1.0f - fac;
CLAMP(fac, 0.0f, 1.0f);
- weight_to_rgb(fcol, fac);
+ BKE_defvert_weight_to_rgb(fcol, fac);
rgb_float_to_uchar(r_face_colors[i], fcol);
}
else {
@@ -1270,7 +1271,7 @@ static void statvis_calc_intersect(
overlap = BKE_bmbvh_overlap(bmtree, bmtree, &overlap_len);
/* same for all faces */
- weight_to_rgb(fcol, 1.0f);
+ BKE_defvert_weight_to_rgb(fcol, 1.0f);
rgb_float_to_uchar(col, fcol);
if (overlap) {
@@ -1357,7 +1358,7 @@ static void statvis_calc_distort(
float fcol[3];
fac = (fac - min) * minmax_irange;
CLAMP(fac, 0.0f, 1.0f);
- weight_to_rgb(fcol, fac);
+ BKE_defvert_weight_to_rgb(fcol, fac);
rgb_float_to_uchar(r_face_colors[index], fcol);
}
else {
@@ -1407,7 +1408,7 @@ static void statvis_calc_sharp(
float fcol[3];
fac = (fac - min) * minmax_irange;
CLAMP(fac, 0.0f, 1.0f);
- weight_to_rgb(fcol, fac);
+ BKE_defvert_weight_to_rgb(fcol, fac);
rgb_float_to_uchar(r_vert_colors[i], fcol);
}
else {
diff --git a/source/blender/blenkernel/intern/editmesh_tangent.c b/source/blender/blenkernel/intern/editmesh_tangent.c
index 9e8b4fa8782..4231ad54ea8 100644
--- a/source/blender/blenkernel/intern/editmesh_tangent.c
+++ b/source/blender/blenkernel/intern/editmesh_tangent.c
@@ -25,7 +25,9 @@
#include "BLI_math.h"
#include "BLI_task.h"
-#include "BKE_DerivedMesh.h"
+#include "DNA_defs.h"
+#include "DNA_customdata_types.h"
+#include "DNA_meshdata_types.h"
#include "BKE_mesh.h"
#include "BKE_mesh_tangent.h" /* for utility functions */
@@ -360,7 +362,7 @@ void BKE_editmesh_loop_tangent_calc(
mesh2tangent->face_as_quad_map = face_as_quad_map;
mesh2tangent->num_face_as_quad_map = num_face_as_quad_map;
#endif
- mesh2tangent->precomputedFaceNormals = poly_normals; /* dm->getPolyDataArray(dm, CD_NORMAL) */
+ mesh2tangent->precomputedFaceNormals = poly_normals;
/* Note, we assume we do have tessellated loop normals at this point (in case it is object-enabled),
* have to check this is valid...
*/
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index 7e506570b7e..b6eb26443ea 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -40,6 +40,7 @@
#include "DNA_curve_types.h"
#include "DNA_group_types.h"
#include "DNA_listBase.h"
+#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force_types.h"
@@ -57,12 +58,11 @@
#include "PIL_time.h"
#include "BKE_anim.h" /* needed for where_on_path */
+#include "BKE_bvhutils.h"
#include "BKE_collection.h"
#include "BKE_collision.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_layer.h"
@@ -74,6 +74,7 @@
#include "BKE_smoke.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_physics.h"
#include "DEG_depsgraph_query.h"
#include "RE_render_ext.h"
@@ -135,9 +136,8 @@ PartDeflect *object_add_collision_fields(int type)
return pd;
}
-/* ***************** PARTICLES ***************** */
+/************************ PARTICLES ***************************/
-/* -------------------------- Effectors ------------------ */
void free_partdeflect(PartDeflect *pd)
{
if (!pd)
@@ -149,111 +149,7 @@ void free_partdeflect(PartDeflect *pd)
MEM_freeN(pd);
}
-static EffectorCache *new_effector_cache(struct Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd)
-{
- EffectorCache *eff = MEM_callocN(sizeof(EffectorCache), "EffectorCache");
- eff->depsgraph = depsgraph;
- eff->scene = scene;
- eff->ob = ob;
- eff->psys = psys;
- eff->pd = pd;
- eff->frame = -1;
- return eff;
-}
-static void add_object_to_effectors(ListBase **effectors, struct Depsgraph *depsgraph, Scene *scene, EffectorWeights *weights, Object *ob, Object *ob_src, bool for_simulation)
-{
- EffectorCache *eff = NULL;
-
- if ( ob == ob_src )
- return;
-
- if (for_simulation) {
- if (weights->weight[ob->pd->forcefield] == 0.0f )
- return;
-
- if (ob->pd->shape == PFIELD_SHAPE_POINTS && !ob->derivedFinal )
- return;
- }
-
- if (*effectors == NULL)
- *effectors = MEM_callocN(sizeof(ListBase), "effectors list");
-
- eff = new_effector_cache(depsgraph, scene, ob, NULL, ob->pd);
-
- /* make sure imat is up to date */
- invert_m4_m4(ob->imat, ob->obmat);
-
- BLI_addtail(*effectors, eff);
-}
-static void add_particles_to_effectors(ListBase **effectors, struct Depsgraph *depsgraph, Scene *scene, EffectorWeights *weights, Object *ob, ParticleSystem *psys, ParticleSystem *psys_src, bool for_simulation)
-{
- ParticleSettings *part= psys->part;
-
- if ( !psys_check_enabled(ob, psys, G.is_rendering) )
- return;
-
- if ( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
- return;
-
- if ( part->pd && part->pd->forcefield && (!for_simulation || weights->weight[part->pd->forcefield] != 0.0f)) {
- if (*effectors == NULL)
- *effectors = MEM_callocN(sizeof(ListBase), "effectors list");
-
- BLI_addtail(*effectors, new_effector_cache(depsgraph, scene, ob, psys, part->pd));
- }
-
- if (part->pd2 && part->pd2->forcefield && (!for_simulation || weights->weight[part->pd2->forcefield] != 0.0f)) {
- if (*effectors == NULL)
- *effectors = MEM_callocN(sizeof(ListBase), "effectors list");
-
- BLI_addtail(*effectors, new_effector_cache(depsgraph, scene, ob, psys, part->pd2));
- }
-}
-
-/* returns ListBase handle with objects taking part in the effecting */
-ListBase *pdInitEffectors(
- struct Depsgraph *depsgraph, Scene *scene, Object *ob_src, ParticleSystem *psys_src,
- EffectorWeights *weights, bool for_simulation)
-{
- Base *base = BKE_collection_or_layer_objects(depsgraph, scene, NULL, weights->group);
- ListBase *effectors = NULL;
-
- for (; base; base = base->next) {
- if (base->object->pd && base->object->pd->forcefield) {
- add_object_to_effectors(&effectors, depsgraph, scene, weights, base->object, ob_src, for_simulation);
- }
-
- if (base->object->particlesystem.first) {
- ParticleSystem *psys= base->object->particlesystem.first;
-
- for (; psys; psys=psys->next) {
- add_particles_to_effectors(&effectors, depsgraph, scene, weights, base->object, psys, psys_src, for_simulation);
- }
- }
- }
-
- if (for_simulation) {
- pdPrecalculateEffectors(depsgraph, effectors);
- }
-
- return effectors;
-}
-
-void pdEndEffectors(ListBase **effectors)
-{
- if (*effectors) {
- EffectorCache *eff = (*effectors)->first;
-
- for (; eff; eff=eff->next) {
- if (eff->guide_data)
- MEM_freeN(eff->guide_data);
- }
-
- BLI_freelistN(*effectors);
- MEM_freeN(*effectors);
- *effectors = NULL;
- }
-}
+/******************** EFFECTOR RELATIONS ***********************/
static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *eff)
{
@@ -296,12 +192,150 @@ static void precalculate_effector(struct Depsgraph *depsgraph, EffectorCache *ef
}
}
-void pdPrecalculateEffectors(struct Depsgraph *depsgraph, ListBase *effectors)
+static void add_effector_relation(ListBase *relations, Object *ob, ParticleSystem *psys, PartDeflect *pd)
+{
+ EffectorRelation *relation = MEM_callocN(sizeof(EffectorRelation), "EffectorRelation");
+ relation->ob = ob;
+ relation->psys = psys;
+ relation->pd = pd;
+
+ BLI_addtail(relations, relation);
+}
+
+static void add_effector_evaluation(ListBase **effectors, Depsgraph *depsgraph, Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd)
{
- if (effectors) {
- EffectorCache *eff = effectors->first;
- for (; eff; eff=eff->next)
- precalculate_effector(depsgraph, eff);
+ if (*effectors == NULL) {
+ *effectors = MEM_callocN(sizeof(ListBase), "effector effectors");
+ }
+
+ EffectorCache *eff = MEM_callocN(sizeof(EffectorCache), "EffectorCache");
+ eff->depsgraph = depsgraph;
+ eff->scene = scene;
+ eff->ob = ob;
+ eff->psys = psys;
+ eff->pd = pd;
+ eff->frame = -1;
+ BLI_addtail(*effectors, eff);
+
+ precalculate_effector(depsgraph, eff);
+}
+
+/* Create list of effector relations in the collection or entire scene.
+ * This is used by the depsgraph to build relations, as well as faster
+ * lookup of effectors during evaluation. */
+ListBase *BKE_effector_relations_create(
+ Depsgraph *depsgraph,
+ ViewLayer *view_layer,
+ Collection *collection)
+{
+ Base *base = BKE_collection_or_layer_objects(view_layer, collection);
+ const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
+ const int base_flag = (for_render) ? BASE_ENABLED_RENDER : BASE_ENABLED_VIEWPORT;
+
+ ListBase *relations = MEM_callocN(sizeof(ListBase), "effector relations");
+
+ for (; base; base = base->next) {
+ if (!(base->flag & base_flag)) {
+ continue;
+ }
+
+ Object *ob = base->object;
+
+ if (ob->pd && ob->pd->forcefield) {
+ add_effector_relation(relations, ob, NULL, ob->pd);
+ }
+
+ for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
+ ParticleSettings *part = psys->part;
+
+ if (psys_check_enabled(ob, psys, for_render)) {
+ if (part->pd && part->pd->forcefield) {
+ add_effector_relation(relations, ob, psys, part->pd);
+ }
+ if (part->pd2 && part->pd2->forcefield) {
+ add_effector_relation(relations, ob, psys, part->pd2);
+ }
+ }
+ }
+ }
+
+ return relations;
+}
+
+void BKE_effector_relations_free(ListBase *lb)
+{
+ if (lb) {
+ BLI_freelistN(lb);
+ MEM_freeN(lb);
+ }
+}
+
+/* Create effective list of effectors from relations built beforehand. */
+ListBase *BKE_effectors_create(
+ Depsgraph *depsgraph,
+ Object *ob_src,
+ ParticleSystem *psys_src,
+ EffectorWeights *weights)
+{
+ Scene *scene = DEG_get_evaluated_scene(depsgraph);
+ ListBase *relations = DEG_get_effector_relations(depsgraph, weights->group);
+ ListBase *effectors = NULL;
+
+ if (!relations) {
+ return NULL;
+ }
+
+ for (EffectorRelation *relation = relations->first; relation; relation = relation->next) {
+ /* Get evaluated object. */
+ Object *ob = (Object*)DEG_get_evaluated_id(depsgraph, &relation->ob->id);
+
+ if (relation->psys) {
+ /* Get evaluated particle system. */
+ ParticleSystem *psys = BLI_findstring(&ob->particlesystem,
+ relation->psys->name, offsetof(ParticleSystem, name));
+ ParticleSettings *part = psys->part;
+
+ if (psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0) {
+ continue;
+ }
+
+ PartDeflect *pd = (relation->pd == relation->psys->part->pd) ? part->pd : part->pd2;
+ if (weights->weight[pd->forcefield] == 0.0f) {
+ continue;
+ }
+
+ add_effector_evaluation(&effectors, depsgraph, scene, ob, psys, pd);
+ }
+ else {
+ /* Object effector. */
+ if (ob == ob_src) {
+ continue;
+ }
+ else if (weights->weight[ob->pd->forcefield] == 0.0f) {
+ continue;
+ }
+ else if (ob->pd->shape == PFIELD_SHAPE_POINTS && ob->runtime.mesh_eval == NULL) {
+ continue;
+ }
+
+ add_effector_evaluation(&effectors, depsgraph, scene, ob, NULL, ob->pd);
+ }
+ }
+
+ return effectors;
+}
+
+void BKE_effectors_free(ListBase *lb)
+{
+ if (lb) {
+ for (EffectorCache *eff = lb->first; eff; eff = eff->next) {
+ if (eff->guide_data) {
+ MEM_freeN(eff->guide_data);
+ }
+ }
+
+ BLI_freelistN(lb);
+ MEM_freeN(lb);
}
}
@@ -392,7 +426,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
return visibility;
if (!colls)
- colls = get_collider_cache(eff->scene, eff->ob, NULL);
+ colls = BKE_collider_cache_create(eff->depsgraph, eff->ob, NULL);
if (!colls)
return visibility;
@@ -430,7 +464,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
}
if (!colliders)
- free_collider_cache(&colls);
+ BKE_collider_cache_free(&colls);
return visibility;
}
@@ -572,12 +606,10 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
efd->size = 0.0f;
}
else if (eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
-
- if (eff->ob->derivedFinal) {
- DerivedMesh *dm = eff->ob->derivedFinal;
-
- dm->getVertCo(dm, *efd->index, efd->loc);
- dm->getVertNo(dm, *efd->index, efd->nor);
+ Mesh *me_eval = eff->ob->runtime.mesh_eval;
+ if (me_eval != NULL) {
+ copy_v3_v3(efd->loc, me_eval->mvert[*efd->index].co);
+ normal_short_to_float_v3(efd->nor, me_eval->mvert[*efd->index].no);
mul_m4_v3(eff->ob->obmat, efd->loc);
mul_mat3_m4_v3(eff->ob->obmat, efd->nor);
@@ -685,7 +717,8 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin
efd->index = p;
if (eff->pd->shape == PFIELD_SHAPE_POINTS) {
- *tot = eff->ob->derivedFinal ? eff->ob->derivedFinal->numVertData : 1;
+ Mesh *me_eval = eff->ob->runtime.mesh_eval;
+ *tot = me_eval != NULL ? me_eval->totvert : 1;
if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
*p = point->index % *tot;
@@ -960,7 +993,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
}
}
-/* -------- pdDoEffectors() --------
+/* -------- BKE_effectors_apply() --------
* generic force/speed system, now used for particles and softbodies
* scene = scene where it runs in, for time and stuff
* lb = listbase with objects that take part in effecting
@@ -973,7 +1006,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
* flags = only used for softbody wind now
* guide = old speed of particle
*/
-void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *weights, EffectedPoint *point, float *force, float *impulse)
+void BKE_effectors_apply(ListBase *effectors, ListBase *colliders, EffectorWeights *weights, EffectedPoint *point, float *force, float *impulse)
{
/*
* Modifies the force on a particle according to its
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index e63d99a35ee..1e4c868a3db 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -2775,4 +2775,3 @@ float calculate_fcurve(PathResolvedRNA *anim_rna, FCurve *fcu, float evaltime)
return 0.0f;
}
}
-
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index c79b2bb4aee..87bc819c34f 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -104,4 +104,3 @@ void initElbeemMesh(struct Depsgraph *depsgraph, struct Scene *scene, struct Obj
dm->release(dm);
}
-
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 37f53e81236..1c2575dfa52 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -820,4 +820,3 @@ int BKE_icon_ensure_studio_light(struct StudioLight *sl, int id_type)
return icon_id;
}
/** \} */
-
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index ae9236e35fe..e164e1862d5 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -1106,4 +1106,3 @@ void IDP_Reset(IDProperty *prop, const IDProperty *reference)
}
/** \} */
-
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index eeb09931211..f8040f0cf24 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -2091,4 +2091,3 @@ void do_versions_ipos_to_animato(Main *bmain)
if (G.debug & G_DEBUG)
printf("INFO: Animato convert done\n");
}
-
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 4689575655e..13f7716cd80 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1767,16 +1767,16 @@ void BKE_keyblock_update_from_mesh(Mesh *me, KeyBlock *kb)
}
}
-void BKE_keyblock_convert_from_mesh(Mesh *me, KeyBlock *kb)
+void BKE_keyblock_convert_from_mesh(Mesh *me, Key *key, KeyBlock *kb)
{
- int tot = me->totvert;
+ const int len = me->totvert;
if (me->totvert == 0) return;
MEM_SAFE_FREE(kb->data);
- kb->data = MEM_mallocN(me->key->elemsize * tot, __func__);
- kb->totelem = tot;
+ kb->data = MEM_malloc_arrayN((size_t)len, (size_t)key->elemsize, __func__);
+ kb->totelem = len;
BKE_keyblock_update_from_mesh(me, kb);
}
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 0e81e6570e2..1d5b6de22f4 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -72,7 +72,7 @@ void BKE_lamp_init(Lamp *la)
la->samp = 3;
la->bias = 1.0f;
la->soft = 3.0f;
- la->area_size = la->area_sizey = la->area_sizez = 0.1f;
+ la->area_size = la->area_sizey = la->area_sizez = 0.25f;
la->buffers = 1;
la->preview = NULL;
la->falloff_type = LA_FALLOFF_INVSQUARE;
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index a885495f2bf..78ff43c2981 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -1045,16 +1045,14 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
for (; md; md = md->next) {
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
if (!(mti->flags & eModifierTypeFlag_AcceptsLattice)) continue;
if (!(md->mode & eModifierMode_Realtime)) continue;
if (editmode && !(md->mode & eModifierMode_Editmode)) continue;
- if (mti->isDisabled && mti->isDisabled(md, 0)) continue;
+ if (mti->isDisabled && mti->isDisabled(scene, md, 0)) continue;
if (mti->type != eModifierTypeType_OnlyDeform) continue;
if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob_orig, &numVerts);
- modifier_deformVerts_DM_deprecated(md, &mectx, NULL, vertexCos, numVerts);
+ modifier_deformVerts(md, &mectx, NULL, vertexCos, numVerts);
}
if (ob->id.tag & LIB_TAG_COPIED_ON_WRITE) {
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index db9ce76b30c..22188d25df5 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -335,7 +335,7 @@ void BKE_view_layer_base_deselect_all(ViewLayer *view_layer)
void BKE_view_layer_base_select(struct ViewLayer *view_layer, Base *selbase)
{
view_layer->basact = selbase;
- if ((selbase->flag & BASE_SELECTABLED) != 0) {
+ if ((selbase->flag & BASE_SELECTABLE) != 0) {
selbase->flag |= BASE_SELECTED;
}
}
@@ -657,14 +657,14 @@ static int layer_collection_sync(
int object_restrict = base->object->restrictflag;
if (((child_restrict & COLLECTION_RESTRICT_VIEW) == 0) &&
- ((object_restrict & OB_RESTRICT_VIEW) == 0))
+ ((object_restrict & OB_RESTRICT_VIEW) == 0))
{
- base->flag |= BASE_VISIBLED | BASE_VISIBLE_VIEWPORT;
+ base->flag |= BASE_VISIBLE | BASE_ENABLED | BASE_ENABLED_VIEWPORT;
if (((child_restrict & COLLECTION_RESTRICT_SELECT) == 0) &&
((object_restrict & OB_RESTRICT_SELECT) == 0))
{
- base->flag |= BASE_SELECTABLED;
+ base->flag |= BASE_SELECTABLE;
}
}
@@ -672,18 +672,18 @@ static int layer_collection_sync(
((object_restrict & OB_RESTRICT_RENDER) == 0))
{
- base->flag |= BASE_VISIBLE_RENDER;
+ base->flag |= BASE_ENABLED_RENDER;
}
/* Update runtime flags used for display and tools. */
- if (base->flag & BASE_VISIBLED) {
+ if (base->flag & BASE_VISIBLE) {
lc->runtime_flag |= LAYER_COLLECTION_HAS_ENABLED_OBJECTS;
}
- if (base->flag & BASE_HIDE) {
+ if (base->flag & BASE_HIDDEN) {
view_layer->runtime_flag |= VIEW_LAYER_HAS_HIDE;
}
- else if (base->flag & BASE_VISIBLED) {
+ else if (base->flag & BASE_VISIBLE) {
lc->runtime_flag |= LAYER_COLLECTION_HAS_VISIBLE_OBJECTS;
}
@@ -722,7 +722,7 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer)
/* Clear visible and selectable flags to be reset. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- base->flag &= ~(BASE_VISIBLED | BASE_SELECTABLED | BASE_VISIBLE_VIEWPORT | BASE_VISIBLE_RENDER);
+ base->flag &= ~(BASE_VISIBLE | BASE_ENABLED | BASE_SELECTABLE | BASE_ENABLED_VIEWPORT | BASE_ENABLED_RENDER);
}
view_layer->runtime_flag = 0;
@@ -832,7 +832,7 @@ bool BKE_layer_collection_objects_select(ViewLayer *view_layer, LayerCollection
}
}
else {
- if ((base->flag & BASE_SELECTABLED) && !(base->flag & BASE_SELECTED)) {
+ if ((base->flag & BASE_SELECTABLE) && !(base->flag & BASE_SELECTED)) {
base->flag |= BASE_SELECTED;
changed = true;
}
@@ -875,32 +875,20 @@ bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerColle
/* ---------------------------------------------------------------------- */
-/* Test base visibility when BASE_VISIBLED has not been set yet. */
-static bool base_is_visible(Base *base, eEvaluationMode mode)
-{
- if (mode == DAG_EVAL_VIEWPORT) {
- return ((base->flag & BASE_VISIBLE_VIEWPORT) != 0) &&
- ((base->flag & BASE_HIDE) == 0);
- }
- else {
- return ((base->flag & BASE_VISIBLE_RENDER) != 0);
- }
-}
-
/* Update after toggling visibility of an object base. */
void BKE_base_set_visible(Scene *scene, ViewLayer *view_layer, Base *base, bool extend)
{
if (!extend) {
/* Make only one base visible. */
for (Base *other = view_layer->object_bases.first; other; other = other->next) {
- other->flag |= BASE_HIDE;
+ other->flag |= BASE_HIDDEN;
}
- base->flag &= ~BASE_HIDE;
+ base->flag &= ~BASE_HIDDEN;
}
else {
/* Toggle visibility of one base. */
- base->flag ^= BASE_HIDE;
+ base->flag ^= BASE_HIDDEN;
}
BKE_layer_collection_sync(scene, view_layer);
@@ -911,7 +899,7 @@ void BKE_layer_collection_set_visible(Scene *scene, ViewLayer *view_layer, Layer
if (!extend) {
/* Make only objects from one collection visible. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- base->flag |= BASE_HIDE;
+ base->flag |= BASE_HIDDEN;
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(lc->collection, ob)
@@ -919,7 +907,7 @@ void BKE_layer_collection_set_visible(Scene *scene, ViewLayer *view_layer, Layer
Base *base = BLI_ghash_lookup(view_layer->object_bases_hash, ob);
if (base) {
- base->flag &= ~BASE_HIDE;
+ base->flag &= ~BASE_HIDDEN;
}
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
@@ -936,10 +924,10 @@ void BKE_layer_collection_set_visible(Scene *scene, ViewLayer *view_layer, Layer
if (base) {
if (hide) {
- base->flag |= BASE_HIDE;
+ base->flag |= BASE_HIDDEN;
}
else {
- base->flag &= ~BASE_HIDE;
+ base->flag &= ~BASE_HIDDEN;
}
}
}
@@ -1130,12 +1118,12 @@ void BKE_view_layer_selected_objects_iterator_end(BLI_Iterator *UNUSED(iter))
void BKE_view_layer_visible_objects_iterator_begin(BLI_Iterator *iter, void *data_in)
{
- objects_iterator_begin(iter, data_in, BASE_VISIBLED);
+ objects_iterator_begin(iter, data_in, BASE_VISIBLE);
}
void BKE_view_layer_visible_objects_iterator_next(BLI_Iterator *iter)
{
- objects_iterator_next(iter, BASE_VISIBLED);
+ objects_iterator_next(iter, BASE_VISIBLE);
}
void BKE_view_layer_visible_objects_iterator_end(BLI_Iterator *UNUSED(iter))
@@ -1206,12 +1194,12 @@ void BKE_view_layer_selected_bases_iterator_end(BLI_Iterator *UNUSED(iter))
void BKE_view_layer_visible_bases_iterator_begin(BLI_Iterator *iter, void *data_in)
{
- object_bases_iterator_begin(iter, data_in, BASE_VISIBLED);
+ object_bases_iterator_begin(iter, data_in, BASE_VISIBLE);
}
void BKE_view_layer_visible_bases_iterator_next(BLI_Iterator *iter)
{
- object_bases_iterator_next(iter, BASE_VISIBLED);
+ object_bases_iterator_next(iter, BASE_VISIBLE);
}
void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *UNUSED(iter))
@@ -1269,7 +1257,7 @@ void BKE_view_layer_renderable_objects_iterator_next(BLI_Iterator *iter)
if (ob->id.flag & LIB_TAG_DOIT) {
ob->id.flag &= ~LIB_TAG_DOIT;
- if ((base->flag & BASE_VISIBLED) != 0) {
+ if ((base->flag & BASE_VISIBLE) != 0) {
iter->skip = false;
iter->current = ob;
}
@@ -1377,6 +1365,7 @@ void BKE_layer_eval_view_layer(
/* Visibility based on depsgraph mode. */
const eEvaluationMode mode = DEG_get_mode(depsgraph);
+ const int base_flag = (mode == DAG_EVAL_VIEWPORT) ? BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
/* Create array of bases, for fast index-based lookup. */
const int num_object_bases = BLI_listbase_count(&view_layer->object_bases);
@@ -1385,26 +1374,29 @@ void BKE_layer_eval_view_layer(
num_object_bases, sizeof(Base *), "view_layer->object_bases_array");
int base_index = 0;
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- /* Set visibility. */
- if (base_is_visible(base, mode)) {
- base->flag |= BASE_VISIBLED;
+ /* Compute visibility for depsgraph evaluation mode. */
+ if (base->flag & base_flag) {
+ base->flag |= BASE_ENABLED | BASE_VISIBLE;
+
+ if (mode == DAG_EVAL_VIEWPORT && (base->flag & BASE_HIDDEN)) {
+ base->flag &= ~BASE_VISIBLE;
+ }
}
else {
- base->flag &= ~(BASE_VISIBLED | BASE_SELECTABLED);
+ base->flag &= ~(BASE_ENABLED | BASE_VISIBLE | BASE_SELECTABLE);
}
/* If base is not selectabled, clear select. */
- if ((base->flag & BASE_SELECTABLED) == 0) {
+ if ((base->flag & BASE_SELECTABLE) == 0) {
base->flag &= ~BASE_SELECTED;
}
view_layer->object_bases_array[base_index++] = base;
}
-
/* Flush back base flag to the original view layer for editing. */
- ViewLayer *view_layer_orig = DEG_get_input_view_layer(depsgraph);
if (view_layer == DEG_get_evaluated_view_layer(depsgraph)) {
+ ViewLayer *view_layer_orig = DEG_get_input_view_layer(depsgraph);
Base *base_orig = view_layer_orig->object_bases.first;
const Base *base_eval = view_layer->object_bases.first;
while (base_orig != NULL) {
@@ -1413,14 +1405,6 @@ void BKE_layer_eval_view_layer(
base_eval = base_eval->next;
}
}
-
- /* Hidden objects can't be active. */
- if (view_layer->basact && !(view_layer->basact->flag & BASE_VISIBLED)) {
- view_layer->basact = NULL;
- }
- if (view_layer_orig->basact && !(view_layer_orig->basact->flag & BASE_VISIBLED)) {
- view_layer_orig->basact = NULL;
- }
}
void BKE_layer_eval_view_layer_indexed(
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index c45903aa1fa..c2cdc8df1e6 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2558,3 +2558,11 @@ void BKE_id_tag_clear_atomic(ID *id, int tag)
{
atomic_fetch_and_and_int32(&id->tag, ~tag);
}
+
+/** Check that given ID pointer actually is in G_MAIN.
+ * Main intended use is for debug asserts in places we cannot easily get rid of G_Main... */
+bool BKE_id_is_in_gobal_main(ID *id)
+{
+ /* We do not want to fail when id is NULL here, even though this is a bit strange behavior... */
+ return (id == NULL || BLI_findindex(which_libbase(G_MAIN, GS(id->name)), id) != -1);
+}
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c
index 31e621b236f..150092392b4 100644
--- a/source/blender/blenkernel/intern/library_override.c
+++ b/source/blender/blenkernel/intern/library_override.c
@@ -439,7 +439,7 @@ void BKE_override_static_property_operation_delete(
* (of IDOverridePropertyOperation) has to be added.
*
* \return true if status is OK, false otherwise. */
-bool BKE_override_static_status_check_local(ID *local)
+bool BKE_override_static_status_check_local(Main *bmain, ID *local)
{
BLI_assert(local->override_static != NULL);
@@ -459,6 +459,7 @@ bool BKE_override_static_status_check_local(ID *local)
RNA_id_pointer_create(reference, &rnaptr_reference);
if (!RNA_struct_override_matches(
+ bmain,
&rnaptr_local, &rnaptr_reference, NULL, local->override_static,
RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE | RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL))
{
@@ -478,7 +479,7 @@ bool BKE_override_static_status_check_local(ID *local)
* This is typically used to detect whether some reference has changed and local needs to be updated against it.
*
* \return true if status is OK, false otherwise. */
-bool BKE_override_static_status_check_reference(ID *local)
+bool BKE_override_static_status_check_reference(Main *bmain, ID *local)
{
BLI_assert(local->override_static != NULL);
@@ -492,7 +493,7 @@ bool BKE_override_static_status_check_reference(ID *local)
BLI_assert(GS(local->name) == GS(reference->name));
if (reference->override_static && (reference->tag & LIB_TAG_OVERRIDESTATIC_REFOK) == 0) {
- if (!BKE_override_static_status_check_reference(reference)) {
+ if (!BKE_override_static_status_check_reference(bmain, reference)) {
/* If reference is also override of another data-block, and its status is not OK,
* then this override is not OK either.
* Note that this should only happen when reloading libraries... */
@@ -506,6 +507,7 @@ bool BKE_override_static_status_check_reference(ID *local)
RNA_id_pointer_create(reference, &rnaptr_reference);
if (!RNA_struct_override_matches(
+ bmain,
&rnaptr_local, &rnaptr_reference, NULL, local->override_static,
RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN, NULL))
{
@@ -528,7 +530,7 @@ bool BKE_override_static_status_check_reference(ID *local)
* are much cheaper.
*
* \return true if new overriding op was created, or some local data was reset. */
-bool BKE_override_static_operations_create(ID *local, const bool force_auto)
+bool BKE_override_static_operations_create(Main *bmain, ID *local, const bool force_auto)
{
BLI_assert(local->override_static != NULL);
const bool is_template = (local->override_static->reference == NULL);
@@ -541,6 +543,7 @@ bool BKE_override_static_operations_create(ID *local, const bool force_auto)
eRNAOverrideMatchResult report_flags = 0;
RNA_struct_override_matches(
+ bmain,
&rnaptr_local, &rnaptr_reference, NULL, local->override_static,
RNA_OVERRIDE_COMPARE_CREATE | RNA_OVERRIDE_COMPARE_RESTORE, &report_flags);
if (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) {
@@ -577,7 +580,7 @@ void BKE_main_override_static_operations_create(Main *bmain, const bool force_au
if (force_auto ||
(ID_IS_STATIC_OVERRIDE_AUTO(id) && (id->tag & LIB_TAG_OVERRIDESTATIC_AUTOREFRESH)))
{
- BKE_override_static_operations_create(id, force_auto);
+ BKE_override_static_operations_create(bmain, id, force_auto);
id->tag &= ~LIB_TAG_OVERRIDESTATIC_AUTOREFRESH;
}
}
@@ -625,7 +628,7 @@ void BKE_override_static_update(Main *bmain, ID *local)
RNA_id_pointer_create(local->override_static->storage, rnaptr_storage);
}
- RNA_struct_override_apply(&rnaptr_dst, &rnaptr_src, rnaptr_storage, local->override_static);
+ RNA_struct_override_apply(bmain, &rnaptr_dst, &rnaptr_src, rnaptr_storage, local->override_static);
/* This also transfers all pointers (memory) owned by local to tmp_id, and vice-versa. So when we'll free tmp_id,
* we'll actually free old, outdated data from local. */
@@ -693,7 +696,7 @@ OverrideStaticStorage *BKE_override_static_operations_store_initialize(void)
* Generate suitable 'write' data (this only affects differential override operations).
*
* Note that \a local ID is no more modified by this call, all extra data are stored in its temp \a storage_id copy. */
-ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_storage, ID *local)
+ID *BKE_override_static_operations_store_start(Main *bmain, OverrideStaticStorage *override_storage, ID *local)
{
BLI_assert(local->override_static != NULL);
BLI_assert(override_storage != NULL);
@@ -705,7 +708,7 @@ ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_s
}
/* Forcefully ensure we know about all needed override operations. */
- BKE_override_static_operations_create(local, false);
+ BKE_override_static_operations_create(bmain, local, false);
ID *storage_id;
#ifdef DEBUG_OVERRIDE_TIMEIT
@@ -725,7 +728,9 @@ ID *BKE_override_static_operations_store_start(OverrideStaticStorage *override_s
RNA_id_pointer_create(local, &rnaptr_final);
RNA_id_pointer_create(storage_id, &rnaptr_storage);
- if (!RNA_struct_override_store(&rnaptr_final, &rnaptr_reference, &rnaptr_storage, local->override_static)) {
+ if (!RNA_struct_override_store(
+ bmain, &rnaptr_final, &rnaptr_reference, &rnaptr_storage, local->override_static))
+ {
BKE_libblock_free_ex(override_storage, storage_id, true, false);
storage_id = NULL;
}
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index f23d8720a65..54b73dad982 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -807,6 +807,10 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
}
}
}
+
+ for (ParticleDupliWeight *dw = psett->dupliweights.first; dw; dw = dw->next) {
+ CALLBACK_INVOKE(dw->ob, IDWALK_CB_NOP);
+ }
break;
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 21b2ab6b454..ab8c8695495 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -359,6 +359,7 @@ void BKE_material_resize_id(Main *bmain, ID *id, short totcol, bool do_id_user)
}
*totcolp = totcol;
+ DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
@@ -376,6 +377,8 @@ void BKE_material_append_id(Main *bmain, ID *id, Material *ma)
id_us_plus((ID *)ma);
test_all_objects_materials(bmain, id);
+
+ DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
}
@@ -410,6 +413,7 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int index_i, bool update_data
material_data_index_remove_id(id, index);
}
+ DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
}
@@ -437,6 +441,7 @@ void BKE_material_clear_id(Main *bmain, ID *id, bool update_data)
material_data_index_clear_id(id);
}
+ DEG_id_tag_update(id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
}
@@ -532,6 +537,7 @@ void BKE_material_resize_object(Main *bmain, Object *ob, const short totcol, boo
if (ob->totcol && ob->actcol == 0) ob->actcol = 1;
if (ob->actcol > ob->totcol) ob->actcol = ob->totcol;
+ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE | DEG_TAG_GEOMETRY);
DEG_relations_tag_update(bmain);
}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index f502d7e394f..b13f45499f1 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -32,8 +32,10 @@
#include "DNA_object_types.h"
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "BLI_utildefines.h"
+#include "BLI_bitmap.h"
#include "BLI_math.h"
#include "BLI_linklist.h"
#include "BLI_memarena.h"
@@ -43,7 +45,6 @@
#include "BKE_animsys.h"
#include "BKE_idcode.h"
#include "BKE_main.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c
index 33b38d60183..3fc5d1ca51c 100644
--- a/source/blender/blenkernel/intern/mesh_convert.c
+++ b/source/blender/blenkernel/intern/mesh_convert.c
@@ -817,7 +817,6 @@ void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *
/* make new mesh data from the original copy */
Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_MESH);
ListBase nurblist = {NULL, NULL};
- bool needsFree = false;
BKE_mesh_to_curve_nurblist(me_eval, &nurblist, 0);
BKE_mesh_to_curve_nurblist(me_eval, &nurblist, 1);
@@ -832,30 +831,7 @@ void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *
ob->data = cu;
ob->type = OB_CURVE;
- /* curve objects can't contain DM in usual cases, we could free memory */
- needsFree = true;
- }
-
- /* Just to avoid dangling pointer, dm will be removed. */
- {
- DerivedMesh *dm = ob->derivedFinal;
- if (dm != NULL) {
- dm->needsFree = needsFree;
- dm->release(dm);
- }
- }
-
- if (needsFree) {
- BKE_mesh_free(me_eval);
-
- ob->derivedFinal = NULL;
- ob->runtime.mesh_eval = NULL;
-
- /* curve object could have got bounding box only in special cases */
- if (ob->bb) {
- MEM_freeN(ob->bb);
- ob->bb = NULL;
- }
+ BKE_object_free_derived_caches(ob);
}
}
@@ -1150,13 +1126,11 @@ Mesh *BKE_mesh_create_derived_for_modifier(
KeyBlock *kb;
ModifierEvalContext mectx = {depsgraph, ob, 0};
- md->scene = scene;
-
if (!(md->mode & eModifierMode_Realtime)) {
return NULL;
}
- if (mti->isDisabled && mti->isDisabled(md, 0)) {
+ if (mti->isDisabled && mti->isDisabled(scene, md, 0)) {
return NULL;
}
@@ -1235,7 +1209,7 @@ static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int act
cos = CustomData_get_layer_n(&mesh_src->vdata, CD_SHAPEKEY, i);
kb->totelem = mesh_src->totvert;
- kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, 3 * sizeof(float), "kbcos DerivedMesh.c");
+ kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, 3 * sizeof(float), __func__);
if (kb->uid == actshape_uid) {
MVert *mvert = mesh_src->mvert;
@@ -1256,7 +1230,7 @@ static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int act
MEM_freeN(kb->data);
kb->totelem = mesh_src->totvert;
- kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), "kb->data derivedmesh.c");
+ kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), __func__);
fprintf(stderr, "%s: lost a shapekey layer: '%s'! (bmesh internal error)\n", __func__, kb->name);
}
}
diff --git a/source/blender/blenkernel/intern/mesh_iterators.c b/source/blender/blenkernel/intern/mesh_iterators.c
index 48f6b1820f8..f96a91c6e4d 100644
--- a/source/blender/blenkernel/intern/mesh_iterators.c
+++ b/source/blender/blenkernel/intern/mesh_iterators.c
@@ -33,6 +33,10 @@
#include "BKE_mesh.h"
#include "BKE_mesh_iterators.h"
+#include "BLI_bitmap.h"
+#include "BLI_math.h"
+
+#include "MEM_guardedalloc.h"
/* Copied from cdDM_foreachMappedVert */
void BKE_mesh_foreach_mapped_vert(
@@ -152,3 +156,36 @@ void BKE_mesh_foreach_mapped_face_center(
}
}
+
+
+/* Helpers based on above foreach loopers> */
+
+typedef struct MappedVCosData {
+ float (*vertexcos)[3];
+ BLI_bitmap *vertex_visit;
+} MappedVCosData;
+
+static void get_vertexcos__mapFunc(
+ void *user_data, int index, const float co[3],
+ const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
+{
+ MappedVCosData *mapped_vcos_data = (MappedVCosData *)user_data;
+
+ if (BLI_BITMAP_TEST(mapped_vcos_data->vertex_visit, index) == 0) {
+ /* We need coord from prototype vertex, not from copies,
+ * we assume they stored in the beginning of vertex array stored in evaluated mesh
+ * (mirror modifier for eg does this). */
+ copy_v3_v3(mapped_vcos_data->vertexcos[index], co);
+ BLI_BITMAP_ENABLE(mapped_vcos_data->vertex_visit, index);
+ }
+}
+
+void BKE_mesh_foreach_mapped_vert_coords_get(Mesh *me_eval, float (*r_cos)[3], const int totcos)
+{
+ MappedVCosData user_data;
+ memset(r_cos, 0, sizeof(*r_cos) * totcos);
+ user_data.vertexcos = r_cos;
+ user_data.vertex_visit = BLI_BITMAP_NEW(totcos, __func__);
+ BKE_mesh_foreach_mapped_vert(me_eval, get_vertexcos__mapFunc, &user_data, MESH_FOREACH_NOP);
+ MEM_freeN(user_data.vertex_visit);
+}
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index eef8657482f..c882cc0a7fa 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -28,6 +28,7 @@
#include "MEM_guardedalloc.h"
+#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "BLI_utildefines.h"
@@ -41,10 +42,10 @@
#include "BKE_bvhutils.h"
#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_remap.h" /* own include */
+#include "BKE_mesh_runtime.h"
#include "BLI_strict_flags.h"
@@ -121,8 +122,8 @@ static bool mesh_remap_bvhtree_query_raycast(
* In other words, beyond a certain (relatively small) distance, all differences have more or less the same weight
* in final result, which allows to reduce influence of a few high differences, in favor of a global good matching.
*/
-float BKE_mesh_remap_calc_difference_from_dm(
- const SpaceTransform *space_transform, const MVert *verts_dst, const int numverts_dst, DerivedMesh *dm_src)
+float BKE_mesh_remap_calc_difference_from_mesh(
+ const SpaceTransform *space_transform, const MVert *verts_dst, const int numverts_dst, Mesh *me_src)
{
BVHTreeFromMesh treedata = {NULL};
BVHTreeNearest nearest = {0};
@@ -131,7 +132,7 @@ float BKE_mesh_remap_calc_difference_from_dm(
float result = 0.0f;
int i;
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_VERTS, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_VERTS, 2);
nearest.index = -1;
for (i = 0; i < numverts_dst; i++) {
@@ -250,8 +251,8 @@ static void mesh_calc_eigen_matrix(
/**
* Set r_space_transform so that best bbox of dst matches best bbox of src.
*/
-void BKE_mesh_remap_find_best_match_from_dm(
- const MVert *verts_dst, const int numverts_dst, DerivedMesh *dm_src, SpaceTransform *r_space_transform)
+void BKE_mesh_remap_find_best_match_from_mesh(
+ const MVert *verts_dst, const int numverts_dst, Mesh *me_src, SpaceTransform *r_space_transform)
{
/* Note that those are done so that we successively get actual mirror matrix (by multiplication of columns)... */
const float mirrors[][3] = {
@@ -269,15 +270,14 @@ void BKE_mesh_remap_find_best_match_from_dm(
float mat_src[4][4], mat_dst[4][4], best_mat_dst[4][4];
float best_match = FLT_MAX, match;
- const int numverts_src = dm_src->getNumVerts(dm_src);
- float (*vcos_src)[3] = MEM_mallocN(sizeof(*vcos_src) * (size_t)numverts_src, __func__);
- dm_src->getVertCos(dm_src, vcos_src);
+ const int numverts_src = me_src->totvert;
+ float (*vcos_src)[3] = BKE_mesh_vertexCos_get(me_src, NULL);
mesh_calc_eigen_matrix(NULL, (const float (*)[3])vcos_src, numverts_src, mat_src);
mesh_calc_eigen_matrix(verts_dst, NULL, numverts_dst, mat_dst);
BLI_space_transform_global_from_matrices(r_space_transform, mat_dst, mat_src);
- match = BKE_mesh_remap_calc_difference_from_dm(r_space_transform, verts_dst, numverts_dst, dm_src);
+ match = BKE_mesh_remap_calc_difference_from_mesh(r_space_transform, verts_dst, numverts_dst, me_src);
best_match = match;
copy_m4_m4(best_mat_dst, mat_dst);
@@ -288,7 +288,7 @@ void BKE_mesh_remap_find_best_match_from_dm(
mul_v3_fl(mat_dst[2], (*mirr)[2]);
BLI_space_transform_global_from_matrices(r_space_transform, mat_dst, mat_src);
- match = BKE_mesh_remap_calc_difference_from_dm(r_space_transform, verts_dst, numverts_dst, dm_src);
+ match = BKE_mesh_remap_calc_difference_from_mesh(r_space_transform, verts_dst, numverts_dst, me_src);
if (match < best_match) {
best_match = match;
copy_m4_m4(best_mat_dst, mat_dst);
@@ -430,9 +430,9 @@ typedef struct IslandResult {
/* Will be enough in 99% of cases. */
#define MREMAP_DEFAULT_BUFSIZE 32
-void BKE_mesh_remap_calc_verts_from_dm(
+void BKE_mesh_remap_calc_verts_from_mesh(
const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius,
- const MVert *verts_dst, const int numverts_dst, const bool UNUSED(dirty_nors_dst), DerivedMesh *dm_src,
+ const MVert *verts_dst, const int numverts_dst, const bool UNUSED(dirty_nors_dst), Mesh *me_src,
MeshPairRemap *r_map)
{
const float full_weight = 1.0f;
@@ -444,7 +444,7 @@ void BKE_mesh_remap_calc_verts_from_dm(
BKE_mesh_remap_init(r_map, numverts_dst);
if (mode == MREMAP_MODE_TOPOLOGY) {
- BLI_assert(numverts_dst == dm_src->getNumVerts(dm_src));
+ BLI_assert(numverts_dst == me_src->totvert);
for (i = 0; i < numverts_dst; i++) {
mesh_remap_item_define(r_map, i, FLT_MAX, 0, 1, &i, &full_weight);
}
@@ -457,7 +457,7 @@ void BKE_mesh_remap_calc_verts_from_dm(
float tmp_co[3], tmp_no[3];
if (mode == MREMAP_MODE_VERT_NEAREST) {
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_VERTS, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_VERTS, 2);
nearest.index = -1;
for (i = 0; i < numverts_dst; i++) {
@@ -478,11 +478,10 @@ void BKE_mesh_remap_calc_verts_from_dm(
}
}
else if (ELEM(mode, MREMAP_MODE_VERT_EDGE_NEAREST, MREMAP_MODE_VERT_EDGEINTERP_NEAREST)) {
- MEdge *edges_src = dm_src->getEdgeArray(dm_src);
- float (*vcos_src)[3] = MEM_mallocN(sizeof(*vcos_src) * (size_t)dm_src->getNumVerts(dm_src), __func__);
- dm_src->getVertCos(dm_src, vcos_src);
+ MEdge *edges_src = me_src->medge;
+ float (*vcos_src)[3] = BKE_mesh_vertexCos_get(me_src, NULL);
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_EDGES, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_EDGES, 2);
nearest.index = -1;
for (i = 0; i < numverts_dst; i++) {
@@ -530,18 +529,16 @@ void BKE_mesh_remap_calc_verts_from_dm(
else if (ELEM(mode, MREMAP_MODE_VERT_POLY_NEAREST, MREMAP_MODE_VERT_POLYINTERP_NEAREST,
MREMAP_MODE_VERT_POLYINTERP_VNORPROJ))
{
- MPoly *polys_src = dm_src->getPolyArray(dm_src);
- MLoop *loops_src = dm_src->getLoopArray(dm_src);
- float (*vcos_src)[3] = MEM_mallocN(sizeof(*vcos_src) * (size_t)dm_src->getNumVerts(dm_src), __func__);
+ MPoly *polys_src = me_src->mpoly;
+ MLoop *loops_src = me_src->mloop;
+ float (*vcos_src)[3] = BKE_mesh_vertexCos_get(me_src, NULL);
size_t tmp_buff_size = MREMAP_DEFAULT_BUFSIZE;
float (*vcos)[3] = MEM_mallocN(sizeof(*vcos) * tmp_buff_size, __func__);
int *indices = MEM_mallocN(sizeof(*indices) * tmp_buff_size, __func__);
float *weights = MEM_mallocN(sizeof(*weights) * tmp_buff_size, __func__);
- dm_src->getVertCos(dm_src, vcos_src);
-
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_LOOPTRI, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_LOOPTRI, 2);
if (mode == MREMAP_MODE_VERT_POLYINTERP_VNORPROJ) {
for (i = 0; i < numverts_dst; i++) {
@@ -625,10 +622,10 @@ void BKE_mesh_remap_calc_verts_from_dm(
}
}
-void BKE_mesh_remap_calc_edges_from_dm(
+void BKE_mesh_remap_calc_edges_from_mesh(
const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius,
const MVert *verts_dst, const int numverts_dst, const MEdge *edges_dst, const int numedges_dst,
- const bool UNUSED(dirty_nors_dst), DerivedMesh *dm_src, MeshPairRemap *r_map)
+ const bool UNUSED(dirty_nors_dst), Mesh *me_src, MeshPairRemap *r_map)
{
const float full_weight = 1.0f;
const float max_dist_sq = max_dist * max_dist;
@@ -639,7 +636,7 @@ void BKE_mesh_remap_calc_edges_from_dm(
BKE_mesh_remap_init(r_map, numedges_dst);
if (mode == MREMAP_MODE_TOPOLOGY) {
- BLI_assert(numedges_dst == dm_src->getNumEdges(dm_src));
+ BLI_assert(numedges_dst == me_src->totedge);
for (i = 0; i < numedges_dst; i++) {
mesh_remap_item_define(r_map, i, FLT_MAX, 0, 1, &i, &full_weight);
}
@@ -652,10 +649,10 @@ void BKE_mesh_remap_calc_edges_from_dm(
float tmp_co[3], tmp_no[3];
if (mode == MREMAP_MODE_EDGE_VERT_NEAREST) {
- const int num_verts_src = dm_src->getNumVerts(dm_src);
- const int num_edges_src = dm_src->getNumEdges(dm_src);
- MEdge *edges_src = dm_src->getEdgeArray(dm_src);
- float (*vcos_src)[3] = MEM_mallocN(sizeof(*vcos_src) * (size_t)dm_src->getNumVerts(dm_src), __func__);
+ const int num_verts_src = me_src->totvert;
+ const int num_edges_src = me_src->totedge;
+ MEdge *edges_src = me_src->medge;
+ float (*vcos_src)[3] = BKE_mesh_vertexCos_get(me_src, NULL);
MeshElemMap *vert_to_edge_src_map;
int *vert_to_edge_src_map_mem;
@@ -672,9 +669,7 @@ void BKE_mesh_remap_calc_edges_from_dm(
BKE_mesh_vert_edge_map_create(&vert_to_edge_src_map, &vert_to_edge_src_map_mem,
edges_src, num_verts_src, num_edges_src);
- dm_src->getVertCos(dm_src, vcos_src);
-
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_VERTS, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_VERTS, 2);
nearest.index = -1;
for (i = 0; i < numedges_dst; i++) {
@@ -774,7 +769,7 @@ void BKE_mesh_remap_calc_edges_from_dm(
MEM_freeN(vert_to_edge_src_map_mem);
}
else if (mode == MREMAP_MODE_EDGE_NEAREST) {
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_EDGES, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_EDGES, 2);
nearest.index = -1;
for (i = 0; i < numedges_dst; i++) {
@@ -795,13 +790,12 @@ void BKE_mesh_remap_calc_edges_from_dm(
}
}
else if (mode == MREMAP_MODE_EDGE_POLY_NEAREST) {
- MEdge *edges_src = dm_src->getEdgeArray(dm_src);
- MPoly *polys_src = dm_src->getPolyArray(dm_src);
- MLoop *loops_src = dm_src->getLoopArray(dm_src);
- float (*vcos_src)[3] = MEM_mallocN(sizeof(*vcos_src) * (size_t)dm_src->getNumVerts(dm_src), __func__);
+ MEdge *edges_src = me_src->medge;
+ MPoly *polys_src = me_src->mpoly;
+ MLoop *loops_src = me_src->mloop;
+ float (*vcos_src)[3] = BKE_mesh_vertexCos_get(me_src, NULL);
- dm_src->getVertCos(dm_src, vcos_src);
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_LOOPTRI, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_LOOPTRI, 2);
for (i = 0; i < numedges_dst; i++) {
interp_v3_v3v3(tmp_co, verts_dst[edges_dst[i].v1].co, verts_dst[edges_dst[i].v2].co, 0.5f);
@@ -820,9 +814,9 @@ void BKE_mesh_remap_calc_edges_from_dm(
int best_eidx_src = -1;
for (; nloops--; ml_src++) {
- MEdge *me_src = &edges_src[ml_src->e];
- float *co1_src = vcos_src[me_src->v1];
- float *co2_src = vcos_src[me_src->v2];
+ MEdge *med_src = &edges_src[ml_src->e];
+ float *co1_src = vcos_src[med_src->v1];
+ float *co2_src = vcos_src[med_src->v2];
float co_src[3];
float dist_sq;
@@ -847,14 +841,14 @@ void BKE_mesh_remap_calc_edges_from_dm(
}
else if (mode == MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ) {
const int num_rays_min = 5, num_rays_max = 100;
- const int numedges_src = dm_src->getNumEdges(dm_src);
+ const int numedges_src = me_src->totedge;
/* Subtleness - this one we can allocate only max number of cast rays per edges! */
int *indices = MEM_mallocN(sizeof(*indices) * (size_t)min_ii(numedges_src, num_rays_max), __func__);
/* Here it's simpler to just allocate for all edges :/ */
float *weights = MEM_mallocN(sizeof(*weights) * (size_t)numedges_src, __func__);
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_EDGES, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_EDGES, 2);
for (i = 0; i < numedges_dst; i++) {
/* For each dst edge, we sample some rays from it (interpolated from its vertices)
@@ -1106,13 +1100,13 @@ static float mesh_remap_calc_loops_astar_f_cost(
#define ASTAR_STEPS_MAX 64
-void BKE_mesh_remap_calc_loops_from_dm(
+void BKE_mesh_remap_calc_loops_from_mesh(
const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius,
MVert *verts_dst, const int numverts_dst, MEdge *edges_dst, const int numedges_dst,
MLoop *loops_dst, const int numloops_dst, MPoly *polys_dst, const int numpolys_dst,
CustomData *ldata_dst, CustomData *pdata_dst,
const bool use_split_nors_dst, const float split_angle_dst, const bool dirty_nors_dst,
- DerivedMesh *dm_src, const bool use_split_nors_src, const float split_angle_src,
+ Mesh *me_src,
MeshRemapIslandsCalc gen_islands_src, const float islands_precision_src, MeshPairRemap *r_map)
{
const float full_weight = 1.0f;
@@ -1127,7 +1121,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
if (mode == MREMAP_MODE_TOPOLOGY) {
/* In topology mapping, we assume meshes are identical, islands included! */
- BLI_assert(numloops_dst == dm_src->getNumLoops(dm_src));
+ BLI_assert(numloops_dst == me_src->totloop);
for (i = 0; i < numloops_dst; i++) {
mesh_remap_item_define(r_map, i, FLT_MAX, 0, 1, &i, &full_weight);
}
@@ -1169,19 +1163,15 @@ void BKE_mesh_remap_calc_loops_from_dm(
/* Unlike above, those are one-to-one mappings, simpler! */
int *loop_to_poly_map_src = NULL;
- bool verts_allocated_src;
- MVert *verts_src = DM_get_vert_array(dm_src, &verts_allocated_src);
- const int num_verts_src = dm_src->getNumVerts(dm_src);
+ MVert *verts_src = me_src->mvert;
+ const int num_verts_src = me_src->totvert;
float (*vcos_src)[3] = NULL;
- bool edges_allocated_src;
- MEdge *edges_src = DM_get_edge_array(dm_src, &edges_allocated_src);
- const int num_edges_src = dm_src->getNumEdges(dm_src);
- bool loops_allocated_src;
- MLoop *loops_src = DM_get_loop_array(dm_src, &loops_allocated_src);
- const int num_loops_src = dm_src->getNumLoops(dm_src);
- bool polys_allocated_src;
- MPoly *polys_src = DM_get_poly_array(dm_src, &polys_allocated_src);
- const int num_polys_src = dm_src->getNumPolys(dm_src);
+ MEdge *edges_src = me_src->medge;
+ const int num_edges_src = me_src->totedge;
+ MLoop *loops_src = me_src->mloop;
+ const int num_loops_src = me_src->totloop;
+ MPoly *polys_src = me_src->mpoly;
+ const int num_polys_src = me_src->totpoly;
const MLoopTri *looptri_src = NULL;
int num_looptri_src = 0;
@@ -1198,8 +1188,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
size_t islands_res_buff_size = MREMAP_DEFAULT_BUFSIZE;
if (!use_from_vert) {
- vcos_src = MEM_mallocN(sizeof(*vcos_src) * (size_t)num_verts_src, __func__);
- dm_src->getVertCos(dm_src, vcos_src);
+ vcos_src = BKE_mesh_vertexCos_get(me_src, NULL);
vcos_interp = MEM_mallocN(sizeof(*vcos_interp) * buff_size_interp, __func__);
indices_interp = MEM_mallocN(sizeof(*indices_interp) * buff_size_interp, __func__);
@@ -1215,11 +1204,12 @@ void BKE_mesh_remap_calc_loops_from_dm(
if (need_pnors_dst) {
/* Cache poly nors into a temp CDLayer. */
poly_nors_dst = CustomData_get_layer(pdata_dst, CD_NORMAL);
+ const bool do_poly_nors_dst = (poly_nors_dst == NULL);
if (!poly_nors_dst) {
poly_nors_dst = CustomData_add_layer(pdata_dst, CD_NORMAL, CD_CALLOC, NULL, numpolys_dst);
CustomData_set_layer_flag(pdata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
}
- if (dirty_nors_dst) {
+ if (dirty_nors_dst || do_poly_nors_dst) {
BKE_mesh_calc_normals_poly(verts_dst, NULL, numverts_dst, loops_dst, polys_dst,
numloops_dst, numpolys_dst, poly_nors_dst, true);
}
@@ -1229,11 +1219,12 @@ void BKE_mesh_remap_calc_loops_from_dm(
/* Cache poly nors into a temp CDLayer. */
loop_nors_dst = CustomData_get_layer(ldata_dst, CD_NORMAL);
- if (dirty_nors_dst || !loop_nors_dst) {
- if (!loop_nors_dst) {
- loop_nors_dst = CustomData_add_layer(ldata_dst, CD_NORMAL, CD_CALLOC, NULL, numloops_dst);
- CustomData_set_layer_flag(ldata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
- }
+ const bool do_loop_nors_dst = (loop_nors_dst == NULL);
+ if (!loop_nors_dst) {
+ loop_nors_dst = CustomData_add_layer(ldata_dst, CD_NORMAL, CD_CALLOC, NULL, numloops_dst);
+ CustomData_set_layer_flag(ldata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
+ }
+ if (dirty_nors_dst || do_loop_nors_dst) {
BKE_mesh_normals_loop_split(verts_dst, numverts_dst, edges_dst, numedges_dst,
loops_dst, loop_nors_dst, numloops_dst,
polys_dst, (const float (*)[3])poly_nors_dst, numpolys_dst,
@@ -1242,13 +1233,17 @@ void BKE_mesh_remap_calc_loops_from_dm(
}
if (need_pnors_src || need_lnors_src) {
/* Simpler for now, calcNormals never stores pnors :( */
- dm_src->calcLoopNormals(dm_src, use_split_nors_src, split_angle_src);
+ if (!CustomData_has_layer(&me_src->pdata, CD_NORMAL)) {
+ CustomData_add_layer(&me_src->pdata, CD_NORMAL, CD_CALLOC, NULL, me_src->totpoly);
+ CustomData_set_layer_flag(&me_src->pdata, CD_NORMAL, CD_FLAG_TEMPORARY);
+ }
+ BKE_mesh_calc_normals_split(me_src);
if (need_pnors_src) {
- poly_nors_src = dm_src->getPolyDataArray(dm_src, CD_NORMAL);
+ poly_nors_src = CustomData_get_layer(&me_src->pdata, CD_NORMAL);
}
if (need_lnors_src) {
- loop_nors_src = dm_src->getLoopDataArray(dm_src, CD_NORMAL);
+ loop_nors_src = CustomData_get_layer(&me_src->ldata, CD_NORMAL);
}
}
}
@@ -1344,37 +1339,24 @@ void BKE_mesh_remap_calc_loops_from_dm(
}
}
}
- /* verts 'ownership' is transfered to treedata here, which will handle its freeing. */
- bvhtree_from_mesh_verts_ex(&treedata[tindex], verts_src, num_verts_src, verts_allocated_src,
+ bvhtree_from_mesh_verts_ex(&treedata[tindex], verts_src, num_verts_src, false,
verts_active, num_verts_active, 0.0, 2, 6);
- if (verts_allocated_src) {
- verts_allocated_src = false; /* Only 'give' our verts once, to first tree! */
- }
}
MEM_freeN(verts_active);
}
else {
BLI_assert(num_trees == 1);
- bvhtree_from_mesh_get(&treedata[0], dm_src, BVHTREE_FROM_VERTS, 2);
+ BKE_bvhtree_from_mesh_get(&treedata[0], me_src, BVHTREE_FROM_VERTS, 2);
}
}
else { /* We use polygons. */
if (use_islands) {
/* bvhtree here uses looptri faces... */
- const unsigned int dirty_tess_flag = dm_src->dirty & DM_DIRTY_TESS_CDLAYERS;
BLI_bitmap *looptri_active;
- /* We do not care about tessellated data here, only geometry itself is important. */
- if (dirty_tess_flag) {
- dm_src->dirty &= ~dirty_tess_flag;
- }
- if (dirty_tess_flag) {
- dm_src->dirty |= dirty_tess_flag;
- }
-
- looptri_src = dm_src->getLoopTriArray(dm_src);
- num_looptri_src = dm_src->getNumLoopTri(dm_src);
+ looptri_src = BKE_mesh_runtime_looptri_ensure(me_src);
+ num_looptri_src = me_src->runtime.looptris.len;
looptri_active = BLI_BITMAP_NEW((size_t)num_looptri_src, __func__);
for (tindex = 0; tindex < num_trees; tindex++) {
@@ -1387,26 +1369,19 @@ void BKE_mesh_remap_calc_loops_from_dm(
num_looptri_active++;
}
}
- /* verts and faces 'ownership' is transfered to treedata here, which will handle its freeing. */
bvhtree_from_mesh_looptri_ex(
&treedata[tindex],
- verts_src, verts_allocated_src,
- loops_src, loops_allocated_src,
+ verts_src, false,
+ loops_src, false,
looptri_src, num_looptri_src, false,
looptri_active, num_looptri_active, 0.0, 2, 6);
- if (verts_allocated_src) {
- verts_allocated_src = false; /* Only 'give' our verts once, to first tree! */
- }
- if (loops_allocated_src) {
- loops_allocated_src = false; /* Only 'give' our loops once, to first tree! */
- }
}
MEM_freeN(looptri_active);
}
else {
BLI_assert(num_trees == 1);
- bvhtree_from_mesh_get(&treedata[0], dm_src, BVHTREE_FROM_LOOPTRI, 2);
+ BKE_bvhtree_from_mesh_get(&treedata[0], me_src, BVHTREE_FROM_LOOPTRI, 2);
}
}
@@ -1905,21 +1880,9 @@ void BKE_mesh_remap_calc_loops_from_dm(
BLI_astar_solution_free(&as_solution);
}
- if (verts_allocated_src) {
- MEM_freeN(verts_src);
- }
if (vcos_src) {
MEM_freeN(vcos_src);
}
- if (edges_allocated_src) {
- MEM_freeN(edges_src);
- }
- if (loops_allocated_src) {
- MEM_freeN(loops_src);
- }
- if (polys_allocated_src) {
- MEM_freeN(polys_src);
- }
if (vert_to_loop_map_src) {
MEM_freeN(vert_to_loop_map_src);
}
@@ -1962,11 +1925,11 @@ void BKE_mesh_remap_calc_loops_from_dm(
}
}
-void BKE_mesh_remap_calc_polys_from_dm(
+void BKE_mesh_remap_calc_polys_from_mesh(
const int mode, const SpaceTransform *space_transform, const float max_dist, const float ray_radius,
MVert *verts_dst, const int numverts_dst, MLoop *loops_dst, const int numloops_dst,
MPoly *polys_dst, const int numpolys_dst, CustomData *pdata_dst, const bool dirty_nors_dst,
- DerivedMesh *dm_src, MeshPairRemap *r_map)
+ Mesh *me_src, MeshPairRemap *r_map)
{
const float full_weight = 1.0f;
const float max_dist_sq = max_dist * max_dist;
@@ -1992,7 +1955,7 @@ void BKE_mesh_remap_calc_polys_from_dm(
BKE_mesh_remap_init(r_map, numpolys_dst);
if (mode == MREMAP_MODE_TOPOLOGY) {
- BLI_assert(numpolys_dst == dm_src->getNumPolys(dm_src));
+ BLI_assert(numpolys_dst == me_src->totpoly);
for (i = 0; i < numpolys_dst; i++) {
mesh_remap_item_define(r_map, i, FLT_MAX, 0, 1, &i, &full_weight);
}
@@ -2003,7 +1966,7 @@ void BKE_mesh_remap_calc_polys_from_dm(
BVHTreeRayHit rayhit = {0};
float hit_dist;
- bvhtree_from_mesh_get(&treedata, dm_src, BVHTREE_FROM_LOOPTRI, 2);
+ BKE_bvhtree_from_mesh_get(&treedata, me_src, BVHTREE_FROM_LOOPTRI, 2);
if (mode == MREMAP_MODE_POLY_NEAREST) {
nearest.index = -1;
@@ -2068,7 +2031,7 @@ void BKE_mesh_remap_calc_polys_from_dm(
*/
RNG *rng = BLI_rng_new(0);
- const size_t numpolys_src = (size_t)dm_src->getNumPolys(dm_src);
+ const size_t numpolys_src = (size_t)me_src->totpoly;
/* Here it's simpler to just allocate for all polys :/ */
int *indices = MEM_mallocN(sizeof(*indices) * numpolys_src, __func__);
diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c
index cd9db408d19..07c354559b8 100644
--- a/source/blender/blenkernel/intern/mesh_runtime.c
+++ b/source/blender/blenkernel/intern/mesh_runtime.c
@@ -44,10 +44,6 @@
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
-#ifdef USE_DERIVEDMESH
-#include "BKE_DerivedMesh.h"
-#endif
-
/* -------------------------------------------------------------------- */
/** \name Mesh Runtime Struct Utils
* \{ */
@@ -226,3 +222,151 @@ void BKE_mesh_batch_cache_free(Mesh *me)
}
/** \} */
+
+/** \name Mesh runtime debug helpers.
+ * \{ */
+/* evaluated mesh info printing function,
+ * to help track down differences output */
+
+#ifndef NDEBUG
+#include "BLI_dynstr.h"
+
+static void mesh_runtime_debug_info_layers(
+ DynStr *dynstr, CustomData *cd)
+{
+ int type;
+
+ for (type = 0; type < CD_NUMTYPES; type++) {
+ if (CustomData_has_layer(cd, type)) {
+ /* note: doesnt account for multiple layers */
+ const char *name = CustomData_layertype_name(type);
+ const int size = CustomData_sizeof(type);
+ const void *pt = CustomData_get_layer(cd, type);
+ const int pt_size = pt ? (int)(MEM_allocN_len(pt) / size) : 0;
+ const char *structname;
+ int structnum;
+ CustomData_file_write_info(type, &structname, &structnum);
+ BLI_dynstr_appendf(dynstr,
+ " dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n",
+ name, structname, type, (const void *)pt, size, pt_size);
+ }
+ }
+}
+
+char *BKE_mesh_runtime_debug_info(Mesh *me_eval)
+{
+ DynStr *dynstr = BLI_dynstr_new();
+ char *ret;
+
+ BLI_dynstr_appendf(dynstr, "{\n");
+ BLI_dynstr_appendf(dynstr, " 'ptr': '%p',\n", (void *)me_eval);
+#if 0
+ const char *tstr;
+ switch (me_eval->type) {
+ case DM_TYPE_CDDM: tstr = "DM_TYPE_CDDM"; break;
+ case DM_TYPE_EDITBMESH: tstr = "DM_TYPE_EDITMESH"; break;
+ case DM_TYPE_CCGDM: tstr = "DM_TYPE_CCGDM"; break;
+ default: tstr = "UNKNOWN"; break;
+ }
+ BLI_dynstr_appendf(dynstr, " 'type': '%s',\n", tstr);
+#endif
+ BLI_dynstr_appendf(dynstr, " 'totvert': %d,\n", me_eval->totvert);
+ BLI_dynstr_appendf(dynstr, " 'totedge': %d,\n", me_eval->totedge);
+ BLI_dynstr_appendf(dynstr, " 'totface': %d,\n", me_eval->totface);
+ BLI_dynstr_appendf(dynstr, " 'totpoly': %d,\n", me_eval->totpoly);
+ BLI_dynstr_appendf(dynstr, " 'deformed_only': %d,\n", me_eval->runtime.deformed_only);
+
+ BLI_dynstr_appendf(dynstr, " 'vertexLayers': (\n");
+ mesh_runtime_debug_info_layers(dynstr, &me_eval->vdata);
+ BLI_dynstr_appendf(dynstr, " ),\n");
+
+ BLI_dynstr_appendf(dynstr, " 'edgeLayers': (\n");
+ mesh_runtime_debug_info_layers(dynstr, &me_eval->edata);
+ BLI_dynstr_appendf(dynstr, " ),\n");
+
+ BLI_dynstr_appendf(dynstr, " 'loopLayers': (\n");
+ mesh_runtime_debug_info_layers(dynstr, &me_eval->ldata);
+ BLI_dynstr_appendf(dynstr, " ),\n");
+
+ BLI_dynstr_appendf(dynstr, " 'polyLayers': (\n");
+ mesh_runtime_debug_info_layers(dynstr, &me_eval->pdata);
+ BLI_dynstr_appendf(dynstr, " ),\n");
+
+ BLI_dynstr_appendf(dynstr, " 'tessFaceLayers': (\n");
+ mesh_runtime_debug_info_layers(dynstr, &me_eval->fdata);
+ BLI_dynstr_appendf(dynstr, " ),\n");
+
+ BLI_dynstr_appendf(dynstr, "}\n");
+
+ ret = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+ return ret;
+}
+
+void BKE_mesh_runtime_debug_print(Mesh *me_eval)
+{
+ char *str = BKE_mesh_runtime_debug_info(me_eval);
+ puts(str);
+ fflush(stdout);
+ MEM_freeN(str);
+}
+
+/* XXX Should go in customdata file? */
+void BKE_mesh_runtime_debug_print_cdlayers(CustomData *data)
+{
+ int i;
+ const CustomDataLayer *layer;
+
+ printf("{\n");
+
+ for (i = 0, layer = data->layers; i < data->totlayer; i++, layer++) {
+
+ const char *name = CustomData_layertype_name(layer->type);
+ const int size = CustomData_sizeof(layer->type);
+ const char *structname;
+ int structnum;
+ CustomData_file_write_info(layer->type, &structname, &structnum);
+ printf(" dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n",
+ name, structname, layer->type, (const void *)layer->data, size, (int)(MEM_allocN_len(layer->data) / size));
+ }
+
+ printf("}\n");
+}
+
+bool BKE_mesh_runtime_is_valid(Mesh *me_eval)
+{
+ const bool do_verbose = true;
+ const bool do_fixes = false;
+
+ bool is_valid = true;
+ bool changed = true;
+
+ if (do_verbose) {
+ printf("MESH: %s\n", me_eval->id.name + 2);
+ }
+
+ is_valid &= BKE_mesh_validate_all_customdata(
+ &me_eval->vdata, &me_eval->edata, &me_eval->ldata, &me_eval->pdata,
+ false, /* setting mask here isn't useful, gives false positives */
+ do_verbose, do_fixes,
+ &changed);
+
+ is_valid &= BKE_mesh_validate_arrays(
+ me_eval,
+ me_eval->mvert, me_eval->totvert,
+ me_eval->medge, me_eval->totedge,
+ me_eval->mface, me_eval->totface,
+ me_eval->mloop, me_eval->totloop,
+ me_eval->mpoly, me_eval->totpoly,
+ me_eval->dvert,
+ do_verbose, do_fixes,
+ &changed);
+
+ BLI_assert(changed == false);
+
+ return is_valid;
+}
+
+#endif /* NDEBUG */
+
+/** \} */
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index 2b43d49a10f..0dca41e60e6 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -43,7 +43,6 @@
#include "BLI_math_vector.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
#include "DEG_depsgraph.h"
@@ -976,7 +975,7 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
*
* \returns true if a change is made.
*/
-int BKE_mesh_validate(Mesh *me, const int do_verbose, const int cddata_check_mask)
+bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_mask)
{
bool is_valid = true;
bool changed;
@@ -1051,7 +1050,7 @@ bool BKE_mesh_is_valid(Mesh *me)
* Check all material indices of polygons are valid, invalid ones are set to 0.
* \returns is_valid.
*/
-int BKE_mesh_validate_material_indices(Mesh *me)
+bool BKE_mesh_validate_material_indices(Mesh *me)
{
MPoly *mp;
const int max_idx = max_ii(0, me->totcol - 1);
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 835b78e2a78..4c2a58e7126 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -349,9 +349,7 @@ bool modifier_supportsCage(struct Scene *scene, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
- return ((!mti->isDisabled || !mti->isDisabled(md, 0)) &&
+ return ((!mti->isDisabled || !mti->isDisabled(scene, md, 0)) &&
(mti->flags & eModifierTypeFlag_SupportsEditmode) &&
modifier_supportsMapping(md));
}
@@ -360,11 +358,9 @@ bool modifier_couldBeCage(struct Scene *scene, ModifierData *md)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
return ((md->mode & eModifierMode_Realtime) &&
(md->mode & eModifierMode_Editmode) &&
- (!mti->isDisabled || !mti->isDisabled(md, 0)) &&
+ (!mti->isDisabled || !mti->isDisabled(scene, md, 0)) &&
modifier_supportsMapping(md));
}
@@ -421,9 +417,7 @@ int modifiers_getCageIndex(struct Scene *scene, Object *ob, int *r_lastPossibleC
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
bool supports_mapping;
- md->scene = scene;
-
- if (mti->isDisabled && mti->isDisabled(md, 0)) continue;
+ if (mti->isDisabled && mti->isDisabled(scene, md, 0)) continue;
if (!(mti->flags & eModifierTypeFlag_SupportsEditmode)) continue;
if (md->mode & eModifierMode_DisableTemporary) continue;
@@ -479,14 +473,12 @@ bool modifiers_isParticleEnabled(Object *ob)
*
* \param scene Current scene, may be NULL, in which case isDisabled callback of the modifier is never called.
*/
-bool modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode)
+bool modifier_isEnabled(const struct Scene *scene, ModifierData *md, int required_mode)
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
if ((md->mode & required_mode) != required_mode) return false;
- if (scene != NULL && mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return false;
+ if (scene != NULL && mti->isDisabled && mti->isDisabled(scene, md, required_mode == eModifierMode_Render)) return false;
if (md->mode & eModifierMode_DisableTemporary) return false;
if ((required_mode & eModifierMode_Editmode) && !(mti->flags & eModifierTypeFlag_SupportsEditmode)) return false;
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
deleted file mode 100644
index a1172d3f110..00000000000
--- a/source/blender/blenkernel/intern/modifiers_bmesh.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * ***** 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) 2005 by the Blender Foundation.
- * All rights reserved.
- *
- * Contributor(s): Joseph Eagar
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- */
-
-/** \file blender/blenkernel/intern/modifiers_bmesh.c
- * \ingroup bke
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_math.h"
-#include "BLI_alloca.h"
-
-#include "BKE_DerivedMesh.h"
-#include "BKE_editmesh.h"
-
-/* Static function for alloc */
-static BMFace *bm_face_create_from_mpoly(
- MPoly *mp, MLoop *ml,
- BMesh *bm, BMVert **vtable, BMEdge **etable)
-{
- BMVert **verts = BLI_array_alloca(verts, mp->totloop);
- BMEdge **edges = BLI_array_alloca(edges, mp->totloop);
- int j;
-
- for (j = 0; j < mp->totloop; j++, ml++) {
- verts[j] = vtable[ml->v];
- edges[j] = etable[ml->e];
- }
-
- return BM_face_create(bm, verts, edges, mp->totloop, NULL, BM_CREATE_SKIP_CD);
-}
-
-/**
- * The main function for copying DerivedMesh data into BMesh.
- *
- * \note The mesh may already have geometry. see 'is_init'
- */
-void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm, const bool calc_face_normal)
-{
- MVert *mv, *mvert;
- MEdge *me, *medge;
- MPoly *mpoly, *mp;
- MLoop *mloop;
- BMVert *v, **vtable;
- BMEdge *e, **etable;
- float (*face_normals)[3];
- BMFace *f;
- int i, j, totvert, totedge /* , totface */ /* UNUSED */ ;
- bool is_init = (bm->totvert == 0) && (bm->totedge == 0) && (bm->totface == 0);
- char has_orig_htype = 0;
-
- int cd_vert_bweight_offset;
- int cd_edge_bweight_offset;
- int cd_edge_crease_offset;
-
- if (is_init == false) {
- /* check if we have an origflag */
- has_orig_htype |= CustomData_has_layer(&bm->vdata, CD_ORIGINDEX) ? BM_VERT : 0;
- has_orig_htype |= CustomData_has_layer(&bm->edata, CD_ORIGINDEX) ? BM_EDGE : 0;
- has_orig_htype |= CustomData_has_layer(&bm->pdata, CD_ORIGINDEX) ? BM_FACE : 0;
- }
-
- /*merge custom data layout*/
- CustomData_bmesh_merge(&dm->vertData, &bm->vdata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_VERT);
- CustomData_bmesh_merge(&dm->edgeData, &bm->edata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_EDGE);
- CustomData_bmesh_merge(&dm->loopData, &bm->ldata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_LOOP);
- CustomData_bmesh_merge(&dm->polyData, &bm->pdata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_FACE);
-
- if (is_init) {
- BM_mesh_cd_flag_apply(bm, dm->cd_flag);
- }
-
- cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT);
- cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT);
- cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE);
-
- totvert = dm->getNumVerts(dm);
- totedge = dm->getNumEdges(dm);
- /* totface = dm->getNumPolys(dm); */ /* UNUSED */
-
- vtable = MEM_mallocN(sizeof(*vtable) * totvert, __func__);
- etable = MEM_mallocN(sizeof(*etable) * totedge, __func__);
-
- /*do verts*/
- bool vert_allocated;
- mv = mvert = DM_get_vert_array(dm, &vert_allocated);;
- for (i = 0; i < totvert; i++, mv++) {
- v = BM_vert_create(bm, mv->co, NULL, BM_CREATE_SKIP_CD);
- normal_short_to_float_v3(v->no, mv->no);
- v->head.hflag = BM_vert_flag_from_mflag(mv->flag);
- BM_elem_index_set(v, i); /* set_inline */
-
- CustomData_to_bmesh_block(&dm->vertData, &bm->vdata, i, &v->head.data, true);
- vtable[i] = v;
-
- /* add bevel weight */
- if (cd_vert_bweight_offset != -1) BM_ELEM_CD_SET_FLOAT(v, cd_vert_bweight_offset, (float)mv->bweight / 255.0f);
-
- if (UNLIKELY(has_orig_htype & BM_VERT)) {
- int *orig_index = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_ORIGINDEX);
- *orig_index = ORIGINDEX_NONE;
- }
- }
- if (vert_allocated) MEM_freeN(mvert);
- if (is_init) bm->elem_index_dirty &= ~BM_VERT;
-
- /*do edges*/
- bool edge_allocated;
- me = medge = DM_get_edge_array(dm, &edge_allocated);
- for (i = 0; i < totedge; i++, me++) {
- //BLI_assert(BM_edge_exists(vtable[me->v1], vtable[me->v2]) == NULL);
- e = BM_edge_create(bm, vtable[me->v1], vtable[me->v2], NULL, BM_CREATE_SKIP_CD);
-
- e->head.hflag = BM_edge_flag_from_mflag(me->flag);
- BM_elem_index_set(e, i); /* set_inline */
-
- CustomData_to_bmesh_block(&dm->edgeData, &bm->edata, i, &e->head.data, true);
- etable[i] = e;
-
- if (cd_edge_bweight_offset != -1) BM_ELEM_CD_SET_FLOAT(e, cd_edge_bweight_offset, (float)me->bweight / 255.0f);
- if (cd_edge_crease_offset != -1) BM_ELEM_CD_SET_FLOAT(e, cd_edge_crease_offset, (float)me->crease / 255.0f);
-
- if (UNLIKELY(has_orig_htype & BM_EDGE)) {
- int *orig_index = CustomData_bmesh_get(&bm->edata, e->head.data, CD_ORIGINDEX);
- *orig_index = ORIGINDEX_NONE;
- }
- }
- if (edge_allocated) MEM_freeN(medge);
- if (is_init) bm->elem_index_dirty &= ~BM_EDGE;
-
- /* do faces */
- /* note: i_alt is aligned with bmesh faces which may not always align with mpolys */
- bool poly_allocated, loop_allocated;
- mpoly = mp = DM_get_poly_array(dm, &poly_allocated);
- mloop = DM_get_loop_array(dm, &loop_allocated);
- face_normals = (dm->dirty & DM_DIRTY_NORMALS) ? NULL : CustomData_get_layer(&dm->polyData, CD_NORMAL);
- for (i = 0; i < dm->numPolyData; i++, mp++) {
- BMLoop *l_iter;
- BMLoop *l_first;
-
- f = bm_face_create_from_mpoly(mp, mloop + mp->loopstart,
- bm, vtable, etable);
-
- if (UNLIKELY(f == NULL)) {
- continue;
- }
-
- f->head.hflag = BM_face_flag_from_mflag(mp->flag);
- BM_elem_index_set(f, bm->totface - 1); /* set_inline */
- f->mat_nr = mp->mat_nr;
-
- j = mp->loopstart;
- l_iter = l_first = BM_FACE_FIRST_LOOP(f);
- do {
- /* Save index of correspsonding MLoop */
- CustomData_to_bmesh_block(&dm->loopData, &bm->ldata, j, &l_iter->head.data, true);
- BM_elem_index_set(l_iter, j++); /* set_inline */
- } while ((l_iter = l_iter->next) != l_first);
-
- CustomData_to_bmesh_block(&dm->polyData, &bm->pdata, i, &f->head.data, true);
-
- if (calc_face_normal) {
- if (face_normals) {
- copy_v3_v3(f->no, face_normals[i]);
- }
- else {
- BM_face_normal_update(f);
- }
- }
-
- if (UNLIKELY(has_orig_htype & BM_FACE)) {
- int *orig_index = CustomData_bmesh_get(&bm->pdata, f->head.data, CD_ORIGINDEX);
- *orig_index = ORIGINDEX_NONE;
- }
- }
- if (poly_allocated) MEM_freeN(mpoly);
- if (loop_allocated) MEM_freeN(mloop);
- if (is_init) bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP);
-
- MEM_freeN(vtable);
- MEM_freeN(etable);
-}
-
-/* converts a cddm to a BMEditMesh. if existing is non-NULL, the
- * new geometry will be put in there.*/
-BMEditMesh *DM_to_editbmesh(DerivedMesh *dm, BMEditMesh *existing, const bool do_tessellate)
-{
- BMEditMesh *em = existing;
- BMesh *bm;
-
- if (em) {
- bm = em->bm;
- }
- else {
- bm = BM_mesh_create(
- &bm_mesh_allocsize_default,
- &((struct BMeshCreateParams){.use_toolflags = false,}));
- }
-
- DM_to_bmesh_ex(dm, bm, do_tessellate);
-
- if (!em) {
- em = BKE_editmesh_create(bm, do_tessellate);
- }
- else {
- if (do_tessellate) {
- BKE_editmesh_tessface_calc(em);
- }
- }
-
- return em;
-}
-
-BMesh *DM_to_bmesh(DerivedMesh *dm, const bool calc_face_normal)
-{
- BMesh *bm;
- const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_DM(dm);
-
- bm = BM_mesh_create(
- &allocsize,
- &((struct BMeshCreateParams){.use_toolflags = false,}));
-
- DM_to_bmesh_ex(dm, bm, calc_face_normal);
-
- return bm;
-}
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 5bd4a1a0475..331b3797739 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -337,17 +337,17 @@ MultiresModifierData *get_multires_modifier(Scene *scene, Object *ob, bool use_f
return mmd;
}
-static int multires_get_level(Object *ob, MultiresModifierData *mmd,
+static int multires_get_level(Scene *scene, Object *ob, MultiresModifierData *mmd,
bool render, bool ignore_simplify)
{
if (render)
- return (mmd->modifier.scene) ? get_render_subsurf_level(&mmd->modifier.scene->r, mmd->renderlvl, true) : mmd->renderlvl;
+ return (scene != NULL) ? get_render_subsurf_level(&scene->r, mmd->renderlvl, true) : mmd->renderlvl;
else if (ob->mode == OB_MODE_SCULPT)
return mmd->sculptlvl;
else if (ignore_simplify)
return mmd->lvl;
else
- return (mmd->modifier.scene) ? get_render_subsurf_level(&mmd->modifier.scene->r, mmd->lvl, false) : mmd->lvl;
+ return (scene != NULL) ? get_render_subsurf_level(&scene->r, mmd->lvl, false) : mmd->lvl;
}
void multires_set_tot_level(Object *ob, MultiresModifierData *mmd, int lvl)
@@ -435,7 +435,7 @@ int multiresModifier_reshapeFromDeformMod(struct Depsgraph *depsgraph, Scene *sc
float (*deformedVerts)[3];
const ModifierEvalContext mectx = {depsgraph, ob, 0};
- if (multires_get_level(ob, mmd, false, true) == 0)
+ if (multires_get_level(scene, ob, mmd, false, true) == 0)
return 0;
/* Create DerivedMesh for deformation modifier */
@@ -681,10 +681,10 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
}
/* (direction = 1) for delete higher, (direction = 0) for lower (not implemented yet) */
-void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int direction)
+void multiresModifier_del_levels(MultiresModifierData *mmd, Scene *scene, Object *ob, int direction)
{
Mesh *me = BKE_mesh_from_object(ob);
- int lvl = multires_get_level(ob, mmd, false, true);
+ int lvl = multires_get_level(scene, ob, mmd, false, true);
int levels = mmd->totlvl - lvl;
MDisps *mdisps;
@@ -701,7 +701,7 @@ void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int dire
multires_set_tot_level(ob, mmd, lvl);
}
-static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int totlvl, int simple, bool alloc_paint_mask)
+static DerivedMesh *multires_dm_create_local(Scene *scene, Object *ob, DerivedMesh *dm, int lvl, int totlvl, int simple, bool alloc_paint_mask)
{
MultiresModifierData mmd = {{NULL}};
MultiresFlags flags = MULTIRES_USE_LOCAL_MMD;
@@ -715,29 +715,40 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv
if (alloc_paint_mask)
flags |= MULTIRES_ALLOC_PAINT_MASK;
- return multires_make_derived_from_derived(dm, &mmd, ob, flags);
+ return multires_make_derived_from_derived(dm, &mmd, scene, ob, flags);
}
-static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal, int plain_uv, int alloc_paint_mask)
+static DerivedMesh *subsurf_dm_create_local(
+ Scene *scene, Object *ob, DerivedMesh *dm,
+ int lvl,
+ bool is_simple, bool is_optimal, bool is_plain_uv, bool alloc_paint_mask,
+ bool for_render)
{
SubsurfModifierData smd = {{NULL}};
SubsurfFlags flags = 0;
smd.levels = smd.renderLevels = lvl;
- if (!plain_uv)
+ if (!is_plain_uv) {
smd.flags |= eSubsurfModifierFlag_SubsurfUv;
- if (simple)
+ }
+ if (is_simple) {
smd.subdivType = ME_SIMPLE_SUBSURF;
- if (optimal)
+ }
+ if (is_optimal) {
smd.flags |= eSubsurfModifierFlag_ControlEdges;
+ }
- if (ob->mode & OB_MODE_EDIT)
+ if (ob->mode & OB_MODE_EDIT) {
flags |= SUBSURF_IN_EDIT_MODE;
-
- if (alloc_paint_mask)
+ }
+ if (alloc_paint_mask) {
flags |= SUBSURF_ALLOC_PAINT_MASK;
+ }
+ if (for_render) {
+ flags |= SUBSURF_USE_RENDER_PARAMS;
+ }
- return subsurf_make_derived_from_derived(dm, &smd, NULL, flags);
+ return subsurf_make_derived_from_derived(dm, &smd, scene, NULL, flags);
}
@@ -751,7 +762,7 @@ static float v3_dist_from_plane(float v[3], float center[3], float no[3])
return dot_v3v3(s, no);
}
-void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
+void multiresModifier_base_apply(MultiresModifierData *mmd, Scene *scene, Object *ob)
{
DerivedMesh *cddm, *dispdm, *origdm;
Mesh *me;
@@ -773,7 +784,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
/* generate highest level with displacements */
cddm = CDDM_from_mesh(me);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- dispdm = multires_dm_create_local(ob, cddm, totlvl, totlvl, 0, 0);
+ dispdm = multires_dm_create_local(scene, ob, cddm, totlvl, totlvl, 0, 0);
cddm->release(cddm);
/* copy the new locations of the base verts into the mesh */
@@ -869,7 +880,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
/* subdivide the mesh to highest level without displacements */
cddm = CDDM_from_mesh(me);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- origdm = subsurf_dm_create_local(ob, cddm, totlvl, 0, 0, mmd->flags & eMultiresModifierFlag_PlainUv, 0);
+ origdm = subsurf_dm_create_local(scene, ob, cddm, totlvl, 0, 0, mmd->flags & eMultiresModifierFlag_PlainUv, 0, false);
cddm->release(cddm);
/* calc disps */
@@ -879,7 +890,9 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
dispdm->release(dispdm);
}
-static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl, int updateblock, int simple)
+static void multires_subdivide(
+ MultiresModifierData *mmd, Scene *scene, Object *ob,
+ int totlvl, int updateblock, int simple)
{
Mesh *me = ob->data;
MDisps *mdisps;
@@ -908,11 +921,11 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
/* create subsurf DM from original mesh at high level */
cddm = CDDM_from_mesh(me);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- highdm = subsurf_dm_create_local(ob, cddm, totlvl, simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
+ highdm = subsurf_dm_create_local(scene, ob, cddm, totlvl, simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask, false);
ss = ((CCGDerivedMesh *)highdm)->ss;
/* create multires DM from original mesh at low level */
- lowdm = multires_dm_create_local(ob, cddm, lvl, lvl, simple, has_mask);
+ lowdm = multires_dm_create_local(scene, ob, cddm, lvl, lvl, simple, has_mask);
BLI_assert(lowdm != cddm);
cddm->release(cddm);
@@ -962,9 +975,9 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
multires_set_tot_level(ob, mmd, totlvl);
}
-void multiresModifier_subdivide(MultiresModifierData *mmd, Object *ob, int updateblock, int simple)
+void multiresModifier_subdivide(MultiresModifierData *mmd, Scene *scene, Object *ob, int updateblock, int simple)
{
- multires_subdivide(mmd, ob, mmd->totlvl + 1, updateblock, simple);
+ multires_subdivide(mmd, scene, ob, mmd->totlvl + 1, updateblock, simple);
}
static void grid_tangent(const CCGKey *key, int x, int y, int axis, CCGElem *grid, float t[3])
@@ -1197,7 +1210,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm
}
}
-void multires_modifier_update_mdisps(struct DerivedMesh *dm)
+void multires_modifier_update_mdisps(struct DerivedMesh *dm, Scene *scene)
{
CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
Object *ob;
@@ -1229,11 +1242,11 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
else cddm = CDDM_from_mesh(me);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- highdm = subsurf_dm_create_local(ob, cddm, totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
+ highdm = subsurf_dm_create_local(scene, ob, cddm, totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask, false);
ss = ((CCGDerivedMesh *)highdm)->ss;
/* create multires DM from original mesh and displacements */
- lowdm = multires_dm_create_local(ob, cddm, lvl, totlvl, mmd->simple, has_mask);
+ lowdm = multires_dm_create_local(scene, ob, cddm, lvl, totlvl, mmd->simple, has_mask);
cddm->release(cddm);
/* gather grid data */
@@ -1291,7 +1304,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
else cddm = CDDM_from_mesh(me);
DM_set_only_copy(cddm, CD_MASK_BAREMESH);
- subdm = subsurf_dm_create_local(ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
+ subdm = subsurf_dm_create_local(scene, ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask, false);
cddm->release(cddm);
multiresModifier_disp_run(dm, me, NULL, CALC_DISPLACEMENTS, subdm->getGridData(subdm), mmd->totlvl);
@@ -1354,6 +1367,7 @@ void multires_stitch_grids(Object *ob)
DerivedMesh *multires_make_derived_from_derived(DerivedMesh *dm,
MultiresModifierData *mmd,
+ Scene *scene,
Object *ob,
MultiresFlags flags)
{
@@ -1364,16 +1378,17 @@ DerivedMesh *multires_make_derived_from_derived(DerivedMesh *dm,
CCGKey key;
const bool render = (flags & MULTIRES_USE_RENDER_PARAMS) != 0;
const bool ignore_simplify = (flags & MULTIRES_IGNORE_SIMPLIFY) != 0;
- int lvl = multires_get_level(ob, mmd, render, ignore_simplify);
+ int lvl = multires_get_level(scene, ob, mmd, render, ignore_simplify);
int i, gridSize, numGrids;
if (lvl == 0)
return dm;
- result = subsurf_dm_create_local(ob, dm, lvl,
+ result = subsurf_dm_create_local(scene, ob, dm, lvl,
mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges,
mmd->flags & eMultiresModifierFlag_PlainUv,
- flags & MULTIRES_ALLOC_PAINT_MASK);
+ flags & MULTIRES_ALLOC_PAINT_MASK,
+ render);
if (!(flags & MULTIRES_USE_LOCAL_MMD)) {
ccgdm = (CCGDerivedMesh *)result;
@@ -2049,7 +2064,7 @@ void multires_load_old(Object *ob, Mesh *me)
BLI_insertlinkbefore(&ob->modifiers, md, mmd);
for (i = 0; i < me->mr->level_count - 1; ++i)
- multiresModifier_subdivide(mmd, ob, 1, 0);
+ multiresModifier_subdivide(mmd, NULL, ob, 1, 0);
mmd->lvl = mmd->totlvl;
orig = CDDM_from_mesh(me);
@@ -2058,7 +2073,7 @@ void multires_load_old(Object *ob, Mesh *me)
* reference subsurfed dm with this option, before calling multiresModifier_disp_run(),
* which implicitly expects both subsurfs from its first dm and oldGridData parameters to
* be of the same "format"! */
- dm = multires_make_derived_from_derived(orig, mmd, ob, 0);
+ dm = multires_make_derived_from_derived(orig, mmd, NULL, ob, 0);
multires_load_old_dm(dm, me, mmd->totlvl + 1);
@@ -2073,14 +2088,14 @@ void multires_load_old(Object *ob, Mesh *me)
/* If 'ob_src' and 'ob_dst' both have multires modifiers, synchronize them
* such that 'ob_dst' has the same total number of levels as 'ob_src'. */
-void multiresModifier_sync_levels_ex(Object *ob_dst, MultiresModifierData *mmd_src, MultiresModifierData *mmd_dst)
+void multiresModifier_sync_levels_ex(Scene *scene, Object *ob_dst, MultiresModifierData *mmd_src, MultiresModifierData *mmd_dst)
{
if (mmd_src->totlvl == mmd_dst->totlvl) {
return;
}
if (mmd_src->totlvl > mmd_dst->totlvl) {
- multires_subdivide(mmd_dst, ob_dst, mmd_src->totlvl, false, mmd_dst->simple);
+ multires_subdivide(mmd_dst, scene, ob_dst, mmd_src->totlvl, false, mmd_dst->simple);
}
else {
multires_del_higher(mmd_dst, ob_dst, mmd_src->totlvl);
@@ -2102,7 +2117,7 @@ static void multires_sync_levels(Scene *scene, Object *ob_src, Object *ob_dst)
}
if (mmd_src && mmd_dst) {
- multiresModifier_sync_levels_ex(ob_dst, mmd_src, mmd_dst);
+ multiresModifier_sync_levels_ex(scene, ob_dst, mmd_src, mmd_dst);
}
}
@@ -2195,7 +2210,7 @@ static void multires_apply_smat(struct Depsgraph *depsgraph, Scene *scene, Objec
MEM_freeN(vertCos);
/* scaled ccgDM for tangent space of object with applied scale */
- dm = subsurf_dm_create_local(ob, cddm, high_mmd.totlvl, high_mmd.simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, 0);
+ dm = subsurf_dm_create_local(scene, ob, cddm, high_mmd.totlvl, high_mmd.simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, 0, false);
cddm->release(cddm);
gridSize = dm->getGridSize(dm);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 9de31205504..f7cd2bd52dc 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -3141,13 +3141,13 @@ static void node_type_base_defaults(bNodeType *ntype)
}
/* allow this node for any tree type */
-static int node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(ntree))
+static bool node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(ntree))
{
return true;
}
/* use the basic poll function */
-static int node_poll_instance_default(bNode *node, bNodeTree *ntree)
+static bool node_poll_instance_default(bNode *node, bNodeTree *ntree)
{
return node->typeinfo->poll(node->typeinfo, ntree);
}
@@ -3340,7 +3340,7 @@ void node_type_compatibility(struct bNodeType *ntype, short compatibility)
/* callbacks for undefined types */
-static int node_undefined_poll(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(nodetree))
+static bool node_undefined_poll(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(nodetree))
{
/* this type can not be added deliberately, it's just a placeholder */
return false;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 5ca9b9d2203..8295fccc810 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -249,7 +249,7 @@ bool BKE_object_support_modifier_type_check(const Object *ob, int modifier_type)
return true;
}
-void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_src)
+void BKE_object_link_modifiers(Scene *scene, struct Object *ob_dst, const struct Object *ob_src)
{
ModifierData *md;
BKE_object_free_modifiers(ob_dst, 0);
@@ -288,7 +288,7 @@ void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_sr
if (md->type == eModifierType_Multires) {
/* Has to be done after mod creation, but *before* we actually copy its settings! */
- multiresModifier_sync_levels_ex(ob_dst, (MultiresModifierData *)md, (MultiresModifierData *)nmd);
+ multiresModifier_sync_levels_ex(scene, ob_dst, (MultiresModifierData *)md, (MultiresModifierData *)nmd);
}
modifier_copyData(md, nmd);
@@ -404,6 +404,15 @@ void BKE_object_free_caches(Object *object)
}
}
+ /* NOTE: If object is coming from a duplicator, it might be a temporary
+ * object created by dependency graph, which shares pointers with original
+ * object. In this case we can not free anything.
+ */
+ if ((object->base_flag & BASE_FROMDUPLI) == 0) {
+ BKE_object_free_derived_caches(object);
+ update_flag |= OB_RECALC_DATA;
+ }
+
/* Tag object for update, so once memory critical operation is over and
* scene update routines are back to it's business the object will be
* guaranteed to be in a known state.
@@ -440,7 +449,7 @@ void BKE_object_free(Object *ob)
BKE_constraints_free_ex(&ob->constraints, false);
free_partdeflect(ob->pd);
- BKE_rigidbody_free_object(ob);
+ BKE_rigidbody_free_object(ob, NULL);
BKE_rigidbody_free_constraint(ob);
if (ob->soft) {
@@ -600,7 +609,7 @@ bool BKE_object_is_mode_compat(const struct Object *ob, eObjectMode object_mode)
*/
bool BKE_object_is_visible(Object *ob, const eObjectVisibilityCheck mode)
{
- if ((ob->base_flag & BASE_VISIBLED) == 0) {
+ if ((ob->base_flag & BASE_VISIBLE) == 0) {
return false;
}
@@ -2530,13 +2539,11 @@ void BKE_object_foreach_display_point(
{
float co[3];
- if (ob->derivedFinal) {
- DerivedMesh *dm = ob->derivedFinal;
- MVert *mv = dm->getVertArray(dm);
- int totvert = dm->getNumVerts(dm);
- int i;
-
- for (i = 0; i < totvert; i++, mv++) {
+ if (ob->runtime.mesh_eval) {
+ const Mesh *me = ob->runtime.mesh_eval;
+ const MVert *mv = me->mvert;
+ const int totvert = me->totvert;
+ for (int i = 0; i < totvert; i++, mv++) {
mul_v3_m4v3(co, obmat, mv->co);
func_cb(co, user_data);
}
@@ -2558,33 +2565,20 @@ void BKE_object_foreach_display_point(
}
void BKE_scene_foreach_display_point(
- Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer,
+ Depsgraph *depsgraph,
void (*func_cb)(const float[3], void *), void *user_data)
{
- Base *base;
- Object *ob;
-
- for (base = FIRSTBASE(view_layer); base; base = base->next) {
- if (((base->flag & BASE_VISIBLED) != 0) && ((base->flag & BASE_SELECTED) != 0)) {
- ob = base->object;
-
- if ((ob->transflag & OB_DUPLI) == 0) {
- BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data);
- }
- else {
- ListBase *lb;
- DupliObject *dob;
-
- lb = object_duplilist(depsgraph, scene, ob);
- for (dob = lb->first; dob; dob = dob->next) {
- if (dob->no_draw == 0) {
- BKE_object_foreach_display_point(dob->ob, dob->mat, func_cb, user_data);
- }
- }
- free_object_duplilist(lb); /* does restore */
- }
+ DEG_OBJECT_ITER_BEGIN(
+ depsgraph, ob,
+ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
+ DEG_ITER_OBJECT_FLAG_VISIBLE |
+ DEG_ITER_OBJECT_FLAG_DUPLI)
+ {
+ if ((ob->base_flag & BASE_SELECTED) != 0) {
+ BKE_object_foreach_display_point(ob, ob->obmat, func_cb, user_data);
}
}
+ DEG_OBJECT_ITER_END;
}
/* copied from DNA_object_types.h */
@@ -2956,7 +2950,7 @@ static KeyBlock *insert_meshkey(Main *bmain, Object *ob, const char *name, const
if (newkey || from_mix == false) {
/* create from mesh */
kb = BKE_keyblock_add_ctime(key, name, false);
- BKE_keyblock_convert_from_mesh(me, kb);
+ BKE_keyblock_convert_from_mesh(me, key, kb);
}
else {
/* copy from current values */
@@ -3528,6 +3522,7 @@ void BKE_object_groups_clear(Main *bmain, Object *ob)
Collection *collection = NULL;
while ((collection = BKE_collection_object_find(bmain, collection, ob))) {
BKE_collection_object_remove(bmain, collection, ob, false);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
}
}
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index 2de81864512..5c9e53aaa56 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -784,4 +784,3 @@ void BKE_object_defgroup_subset_to_index_array(
}
}
}
-
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index b7748039f62..e288adaf9ad 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -836,8 +836,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
float tmat[4][4], mat[4][4], pamat[4][4], vec[3], size = 0.0;
float (*obmat)[4];
int a, b, hair = 0;
- int totpart, totchild, totcollection = 0 /*, pa_num */;
- RNG *rng;
+ int totpart, totchild;
int no_draw_flag = PARS_UNEXIST;
@@ -859,8 +858,6 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
totpart = psys->totpart;
totchild = psys->totchild;
- rng = BLI_rng_new_srandom(31415926u + (unsigned int)psys->seed);
-
if ((for_render || part->draw_as == PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
ParticleSimulationData sim = {NULL};
sim.depsgraph = ctx->depsgraph;
@@ -901,15 +898,27 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
totpart = psys->totcached;
}
- psys_check_group_weights(part);
+ RNG *rng = BLI_rng_new_srandom(31415926u + (unsigned int)psys->seed);
psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
/* gather list of objects or single object */
+ int totcollection = 0;
+
if (part->ren_as == PART_DRAW_GR) {
if (part->draw & PART_DRAW_COUNT_GR) {
- for (dw = part->dupliweights.first; dw; dw = dw->next)
- totcollection += dw->count;
+ psys_find_group_weights(part);
+
+ for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
+ {
+ if (dw->ob == object) {
+ totcollection += dw->count;
+ break;
+ }
+ }
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
+ }
}
else {
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
@@ -925,14 +934,20 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
oblist = MEM_callocN((size_t)totcollection * sizeof(Object *), "dupcollection object list");
obcopylist = MEM_callocN((size_t)totcollection * sizeof(Object), "dupcollection copy list");
- if (part->draw & PART_DRAW_COUNT_GR && totcollection) {
- dw = part->dupliweights.first;
-
- for (a = 0; a < totcollection; dw = dw->next) {
- for (b = 0; b < dw->count; b++, a++) {
- oblist[a] = dw->ob;
- obcopylist[a] = *dw->ob;
+ if (part->draw & PART_DRAW_COUNT_GR) {
+ a = 0;
+ for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(part->dup_group, object, mode)
+ {
+ if (dw->ob == object) {
+ for (b = 0; b < dw->count; b++, a++) {
+ oblist[a] = dw->ob;
+ obcopylist[a] = *dw->ob;
+ }
+ break;
+ }
}
+ FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
}
}
else {
@@ -942,10 +957,6 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
oblist[a] = object;
obcopylist[a] = *object;
a++;
-
- if (a >= totcollection) {
- continue;
- }
}
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
}
@@ -1121,6 +1132,8 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
}
else
*ob = obcopy;
+
+ BLI_rng_free(rng);
}
/* clean up */
@@ -1133,8 +1146,6 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
end_latt_deform(psys->lattice_deform_data);
psys->lattice_deform_data = NULL;
}
-
- BLI_rng_free(rng);
}
static void make_duplis_particles(const DupliContext *ctx)
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index 4c38940b11d..3e72de3909f 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -166,7 +166,7 @@ void BKE_object_handle_data_update(
/* TODO(sergey): Only used by legacy depsgraph. */
if (adt) {
/* evaluate drivers - datalevel */
- /* XXX: for mesh types, should we push this to derivedmesh instead? */
+ /* XXX: for mesh types, should we push this to evaluated mesh instead? */
BKE_animsys_evaluate_animdata(depsgraph, scene, data_id, adt, ctime, ADT_RECALC_DRIVERS);
}
@@ -401,7 +401,7 @@ void BKE_object_eval_flush_base_flags(Depsgraph *depsgraph,
object->base_flag = base->flag;
if (is_from_set) {
object->base_flag |= BASE_FROM_SET;
- object->base_flag &= ~(BASE_SELECTED | BASE_SELECTABLED);
+ object->base_flag &= ~(BASE_SELECTED | BASE_SELECTABLE);
}
/* Copy to original object datablock if needed. */
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index c1c3cbf1ca3..404a1a656d9 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -719,7 +719,7 @@ void BKE_sculptsession_bm_to_me(Object *ob, bool reorder)
if (ob && ob->sculpt) {
sculptsession_bm_to_me_update_data_only(ob, reorder);
- /* ensure the objects DerivedMesh mesh doesn't hold onto arrays now realloc'd in the mesh [#34473] */
+ /* ensure the objects evaluated mesh doesn't hold onto arrays now realloc'd in the mesh [#34473] */
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
}
@@ -857,7 +857,7 @@ static bool sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
}
/**
- * \param need_mask So the DerivedMesh thats returned has mask data
+ * \param need_mask So taht the evaluated mesh that is returned has mask data.
*/
void BKE_sculpt_update_mesh_elements(
Depsgraph *depsgraph, Scene *scene, Sculpt *sd, Object *ob,
@@ -1107,7 +1107,7 @@ static bool check_sculpt_object_deformed(Object *object, const bool for_construc
/* Active modifiers means extra deformation, which can't be handled correct
* on birth of PBVH and sculpt "layer" levels, so use PBVH only for internal brush
- * stuff and show final DerivedMesh so user would see actual object shape.
+ * stuff and show final evaluated mesh so user would see actual object shape.
*/
deformed |= object->sculpt->modifiers_active;
@@ -1151,7 +1151,7 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Object *ob, Mesh *me_eval_deform)
}
/* always build pbvh from original mesh, and only use it for drawing if
- * this derivedmesh is just original mesh. it's the multires subsurf dm
+ * this evaluated mesh is just original mesh. it's the multires subsurf dm
* that this is actually for, to support a pbvh on a modified mesh */
if (!pbvh && ob->type == OB_MESH) {
Mesh *me = BKE_object_get_original_mesh(ob);
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 693d6ac587e..82514f0c92d 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -256,7 +256,8 @@ struct LatticeDeformData *psys_create_lattice_deform_data(ParticleSimulationData
if (psys_in_edit_mode(sim->depsgraph, sim->psys) == 0) {
Object *lattice = NULL;
ModifierData *md = (ModifierData *)psys_get_modifier(sim->ob, sim->psys);
- int mode = G.is_rendering ? eModifierMode_Render : eModifierMode_Realtime;
+ bool for_render = DEG_get_mode(sim->depsgraph) == DAG_EVAL_RENDER;
+ int mode = for_render ? eModifierMode_Render : eModifierMode_Realtime;
for (; md; md = md->next) {
if (md->type == eModifierType_Lattice) {
@@ -349,73 +350,84 @@ bool psys_check_edited(ParticleSystem *psys)
return (psys->pointcache->edit && psys->pointcache->edit->edited);
}
+void psys_find_group_weights(ParticleSettings *part)
+{
+ /* Find object pointers based on index. If the collection is linked from
+ * another library linking may not have the object pointers available on
+ * file load, so we have to retrieve them later. See T49273. */
+ const ListBase dup_group_objects = BKE_collection_object_cache_get(part->dup_group);
+
+ for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
+ if (dw->ob == NULL) {
+ Base *base = BLI_findlink(&dup_group_objects, dw->index);
+ if (base != NULL) {
+ dw->ob = base->object;
+ }
+ }
+ }
+}
+
void psys_check_group_weights(ParticleSettings *part)
{
ParticleDupliWeight *dw, *tdw;
- int current = 0;
if (part->ren_as != PART_DRAW_GR || !part->dup_group) {
BLI_freelistN(&part->dupliweights);
return;
}
- const ListBase dup_group_objects = BKE_collection_object_cache_get(part->dup_group);
- if (dup_group_objects.first) {
- /* First try to find NULL objects from their index,
- * and remove all weights that don't have an object in the group. */
- dw = part->dupliweights.first;
- while (dw) {
- if (dw->ob == NULL || !BKE_collection_has_object_recursive(part->dup_group, dw->ob)) {
- Base *base = BLI_findlink(&dup_group_objects, dw->index);
- if (base != NULL) {
- dw->ob = base->object;
- }
- else {
- tdw = dw->next;
- BLI_freelinkN(&part->dupliweights, dw);
- dw = tdw;
- }
- }
- else {
- dw = dw->next;
- }
- }
+ /* Find object pointers. */
+ psys_find_group_weights(part);
- /* then add objects in the group to new list */
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->dup_group, object)
- {
- dw = part->dupliweights.first;
- while (dw && dw->ob != object) {
- dw = dw->next;
- }
-
- if (!dw) {
- dw = MEM_callocN(sizeof(ParticleDupliWeight), "ParticleDupliWeight");
- dw->ob = object;
- dw->count = 1;
- BLI_addtail(&part->dupliweights, dw);
- }
+ /* Remove NULL objects, that were removed from the collection. */
+ dw = part->dupliweights.first;
+ while (dw) {
+ if (dw->ob == NULL || !BKE_collection_has_object_recursive(part->dup_group, dw->ob)) {
+ tdw = dw->next;
+ BLI_freelinkN(&part->dupliweights, dw);
+ dw = tdw;
}
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+ else {
+ dw = dw->next;
+ }
+ }
+ /* Add new objects in the collection. */
+ int index = 0;
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(part->dup_group, object)
+ {
dw = part->dupliweights.first;
- for (; dw; dw = dw->next) {
- if (dw->flag & PART_DUPLIW_CURRENT) {
- current = 1;
- break;
- }
+ while (dw && dw->ob != object) {
+ dw = dw->next;
}
- if (!current) {
- dw = part->dupliweights.first;
- if (dw)
- dw->flag |= PART_DUPLIW_CURRENT;
+ if (!dw) {
+ dw = MEM_callocN(sizeof(ParticleDupliWeight), "ParticleDupliWeight");
+ dw->ob = object;
+ dw->count = 1;
+ BLI_addtail(&part->dupliweights, dw);
}
+
+ dw->index = index++;
}
- else {
- BLI_freelistN(&part->dupliweights);
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+
+ /* Ensure there is an element marked as current. */
+ int current = 0;
+ for (dw = part->dupliweights.first; dw; dw = dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT) {
+ current = 1;
+ break;
+ }
+ }
+
+ if (!current) {
+ dw = part->dupliweights.first;
+ if (dw)
+ dw->flag |= PART_DUPLIW_CURRENT;
}
}
+
int psys_uses_gravity(ParticleSimulationData *sim)
{
return sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY && sim->psys->part && sim->psys->part->effector_weights->global_gravity != 0.0f;
@@ -640,7 +652,7 @@ void psys_free(Object *ob, ParticleSystem *psys)
if (psys->fluid_springs)
MEM_freeN(psys->fluid_springs);
- pdEndEffectors(&psys->effectors);
+ BKE_effectors_free(psys->effectors);
if (psys->pdd) {
psys_free_pdd(psys);
@@ -1841,7 +1853,7 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
copy_qt_qt(eff_key.rot, (ca - 1)->rot);
pd_point_from_particle(sim, sim->psys->particles + i, &eff_key, &epoint);
- pdDoEffectors(sim->psys->effectors, sim->colliders, sim->psys->part->effector_weights, &epoint, force, NULL);
+ BKE_effectors_apply(sim->psys->effectors, sim->colliders, sim->psys->part->effector_weights, &epoint, force, NULL);
mul_v3_fl(force, effector * powf((float)k / (float)steps, 100.0f * sim->psys->part->eff_hair) / (float)steps);
@@ -2755,7 +2767,7 @@ static void psys_cache_edit_paths_iter(
/* selection coloring in edit mode */
if (use_weight) {
if (k == 0) {
- weight_to_rgb(ca->col, pind.hkey[1]->weight);
+ BKE_defvert_weight_to_rgb(ca->col, pind.hkey[1]->weight);
}
else {
/* warning: copied from 'do_particle_interpolation' (without 'mvert' array stepping) */
@@ -2777,8 +2789,8 @@ static void psys_cache_edit_paths_iter(
float w1[3], w2[3];
keytime = (t - (*pind.ekey[0]->time)) / ((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
- weight_to_rgb(w1, pind.hkey[0]->weight);
- weight_to_rgb(w2, pind.hkey[1]->weight);
+ BKE_defvert_weight_to_rgb(w1, pind.hkey[0]->weight);
+ BKE_defvert_weight_to_rgb(w2, pind.hkey[1]->weight);
interp_v3_v3v3(ca->col, w1, w2, keytime);
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 1c50e85668d..35c8761f671 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -70,7 +70,6 @@
#include "BKE_animsys.h"
#include "BKE_boids.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_collision.h"
#include "BKE_colortools.h"
#include "BKE_effect.h"
@@ -81,7 +80,6 @@
#include "BKE_particle.h"
#include "BKE_collection.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_object.h"
#include "BKE_material.h"
#include "BKE_cloth.h"
@@ -93,6 +91,7 @@
#include "BKE_bvhutils.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_physics.h"
#include "DEG_depsgraph_query.h"
#include "PIL_time.h"
@@ -327,7 +326,7 @@ void psys_calc_dmcache(Object *ob, Mesh *mesh_final, Mesh *mesh_original, Partic
/* CACHE LOCATIONS */
if (!mesh_final->runtime.deformed_only) {
- /* Will use later to speed up subsurf/derivedmesh */
+ /* Will use later to speed up subsurf/evaluated mesh. */
LinkNode *node, *nodedmelem, **nodearray;
int totdmelem, totelem, i, *origindex, *origindex_poly = NULL;
@@ -1307,9 +1306,10 @@ void psys_update_particle_tree(ParticleSystem *psys, float cfra)
static void psys_update_effectors(ParticleSimulationData *sim)
{
- pdEndEffectors(&sim->psys->effectors);
- sim->psys->effectors = pdInitEffectors(sim->depsgraph, sim->scene, sim->ob, sim->psys,
- sim->psys->part->effector_weights, true);
+ BKE_effectors_free(sim->psys->effectors);
+ sim->psys->effectors = BKE_effectors_create(sim->depsgraph,
+ sim->ob, sim->psys,
+ sim->psys->part->effector_weights);
precalc_guides(sim, sim->psys->effectors);
}
@@ -2066,7 +2066,7 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo
/* add effectors */
pd_point_from_particle(efdata->sim, efdata->pa, state, &epoint);
if (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)
- pdDoEffectors(sim->psys->effectors, sim->colliders, part->effector_weights, &epoint, force, impulse);
+ BKE_effectors_apply(sim->psys->effectors, sim->colliders, part->effector_weights, &epoint, force, impulse);
mul_v3_fl(force, efdata->ptex.field);
mul_v3_fl(impulse, efdata->ptex.field);
@@ -2957,18 +2957,20 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra, cons
/* particle instance modifier with "path" option need cached paths even if particle system doesn't */
- FOREACH_SCENE_OBJECT_BEGIN(sim->scene, ob)
- {
- ModifierData *md = modifiers_findByType(ob, eModifierType_ParticleInstance);
- if (md) {
- ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
- if (pimd->flag & eParticleInstanceFlag_Path && pimd->ob == sim->ob && pimd->psys == (psys - (ParticleSystem*)sim->ob->particlesystem.first)) {
- skip = 0;
- break;
+ if (skip) {
+ FOREACH_SCENE_OBJECT_BEGIN(sim->scene, ob)
+ {
+ ModifierData *md = modifiers_findByType(ob, eModifierType_ParticleInstance);
+ if (md) {
+ ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
+ if (pimd->flag & eParticleInstanceFlag_Path && pimd->ob == sim->ob && pimd->psys == (psys - (ParticleSystem*)sim->ob->particlesystem.first)) {
+ skip = 0;
+ break;
+ }
}
}
+ FOREACH_SCENE_OBJECT_END;
}
- FOREACH_SCENE_OBJECT_END;
if (!skip) {
psys_cache_paths(sim, cfra, use_render_params);
@@ -3536,7 +3538,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
psys_update_effectors(sim);
if (part->type != PART_HAIR)
- sim->colliders = get_collider_cache(sim->scene, sim->ob, part->collision_group);
+ sim->colliders = BKE_collider_cache_create(sim->depsgraph, sim->ob, part->collision_group);
/* initialize physics type specific stuff */
switch (part->phystype) {
@@ -3743,7 +3745,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
pa->state.time=cfra;
}
- free_collider_cache(&sim->colliders);
+ BKE_collider_cache_free(&sim->colliders);
BLI_rng_free(sim->rng);
sim->rng = NULL;
}
@@ -3810,7 +3812,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra, const bool use_
}
static void particles_fluid_step(
- Main *bmain, ParticleSimulationData *sim, int UNUSED(cfra), const bool use_render_params)
+ ParticleSimulationData *sim, int UNUSED(cfra), const bool use_render_params)
{
ParticleSystem *psys = sim->psys;
if (psys->particles) {
@@ -3841,7 +3843,7 @@ static void particles_fluid_step(
// ok, start loading
BLI_join_dirfile(filename, sizeof(filename), fss->surfdataPath, OB_FLUIDSIM_SURF_PARTICLES_FNAME);
- BLI_path_abs(filename, modifier_path_relbase(bmain, sim->ob));
+ BLI_path_abs(filename, modifier_path_relbase_from_global(sim->ob));
BLI_path_frame(filename, curFrame, 0); // fixed #frame-no
@@ -3915,7 +3917,7 @@ static void particles_fluid_step(
} // fluid sim particles done
}
#else
- UNUSED_VARS(bmain, use_render_params);
+ UNUSED_VARS(use_render_params);
#endif // WITH_MOD_FLUID
}
@@ -4303,7 +4305,7 @@ void particle_system_update(struct Depsgraph *depsgraph, Scene *scene, Object *o
}
case PART_FLUID:
{
- particles_fluid_step(G.main /* Yuck :/ */, &sim, (int)cfra, use_render_params);
+ particles_fluid_step(&sim, (int)cfra, use_render_params);
break;
}
default:
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 3e8e6a69dd8..a8c6091124a 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1295,8 +1295,8 @@ static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int UNUS
if (rbo->type == RBO_TYPE_ACTIVE) {
#ifdef WITH_BULLET
- RB_body_get_position(rbo->physics_object, rbo->pos);
- RB_body_get_orientation(rbo->physics_object, rbo->orn);
+ RB_body_get_position(rbo->shared->physics_object, rbo->pos);
+ RB_body_get_orientation(rbo->shared->physics_object, rbo->orn);
#endif
PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, rbo->pos);
PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, rbo->orn);
@@ -1619,9 +1619,9 @@ void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *r
pid->ob= ob;
pid->calldata= rbw;
pid->type= PTCACHE_TYPE_RIGIDBODY;
- pid->cache= rbw->pointcache;
- pid->cache_ptr= &rbw->pointcache;
- pid->ptcaches= &rbw->ptcaches;
+ pid->cache= rbw->shared->pointcache;
+ pid->cache_ptr= &rbw->shared->pointcache;
+ pid->ptcaches= &rbw->shared->ptcaches;
pid->totpoint= pid->totwrite= ptcache_rigidbody_totpoint;
pid->error = ptcache_rigidbody_error;
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 2374670b212..59847b28785 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -76,8 +76,10 @@
/* Freeing Methods --------------------- */
-#ifndef WITH_BULLET
+#ifdef WITH_BULLET
+static void rigidbody_update_ob_array(RigidBodyWorld *rbw);
+#else
static void RB_dworld_remove_constraint(void *UNUSED(world), void *UNUSED(con)) {}
static void RB_dworld_remove_body(void *UNUSED(world), void *UNUSED(body)) {}
static void RB_dworld_delete(void *UNUSED(world)) {}
@@ -88,13 +90,17 @@ static void RB_constraint_delete(void *UNUSED(con)) {}
#endif
/* Free rigidbody world */
-void BKE_rigidbody_free_world(RigidBodyWorld *rbw)
+void BKE_rigidbody_free_world(Scene *scene)
{
+ bool is_orig = (scene->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0;
+ RigidBodyWorld *rbw = scene->rigidbody_world;
+ scene->rigidbody_world = NULL;
+
/* sanity check */
if (!rbw)
return;
- if (rbw->physics_world) {
+ if (is_orig && rbw->shared->physics_world) {
/* free physics references, we assume that all physics objects in will have been added to the world */
if (rbw->constraints) {
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->constraints, object)
@@ -102,7 +108,7 @@ void BKE_rigidbody_free_world(RigidBodyWorld *rbw)
if (object->rigidbody_constraint) {
RigidBodyCon *rbc = object->rigidbody_constraint;
if (rbc->physics_constraint) {
- RB_dworld_remove_constraint(rbw->physics_world, rbc->physics_constraint);
+ RB_dworld_remove_constraint(rbw->shared->physics_world, rbc->physics_constraint);
}
}
}
@@ -112,24 +118,23 @@ void BKE_rigidbody_free_world(RigidBodyWorld *rbw)
if (rbw->group) {
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->group, object)
{
- if (object->rigidbody_object) {
- RigidBodyOb *rbo = object->rigidbody_object;
- if (rbo->physics_object) {
- RB_dworld_remove_body(rbw->physics_world, rbo->physics_object);
- }
- }
+ BKE_rigidbody_free_object(object, rbw);
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
}
/* free dynamics world */
- RB_dworld_delete(rbw->physics_world);
+ RB_dworld_delete(rbw->shared->physics_world);
}
if (rbw->objects)
free(rbw->objects);
- /* free cache */
- BKE_ptcache_free_list(&(rbw->ptcaches));
- rbw->pointcache = NULL;
+ if (is_orig) {
+ /* free cache */
+ BKE_ptcache_free_list(&(rbw->shared->ptcaches));
+ rbw->shared->pointcache = NULL;
+
+ MEM_freeN(rbw->shared);
+ }
/* free effector weights */
if (rbw->effector_weights)
@@ -140,8 +145,9 @@ void BKE_rigidbody_free_world(RigidBodyWorld *rbw)
}
/* Free RigidBody settings and sim instances */
-void BKE_rigidbody_free_object(Object *ob)
+void BKE_rigidbody_free_object(Object *ob, RigidBodyWorld *rbw)
{
+ bool is_orig = (ob->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0;
RigidBodyOb *rbo = (ob) ? ob->rigidbody_object : NULL;
/* sanity check */
@@ -149,14 +155,26 @@ void BKE_rigidbody_free_object(Object *ob)
return;
/* free physics references */
- if (rbo->physics_object) {
- RB_body_delete(rbo->physics_object);
- rbo->physics_object = NULL;
- }
+ if (is_orig) {
+ if (rbo->shared->physics_object) {
+ BLI_assert(rbw);
+ if (rbw) {
+ /* We can only remove the body from the world if the world is known.
+ * The world is generally only unknown if it's an evaluated copy of
+ * an object that's being freed, in which case this code isn't run anyway. */
+ RB_dworld_remove_body(rbw->shared->physics_world, rbo->shared->physics_object);
+ }
+
+ RB_body_delete(rbo->shared->physics_object);
+ rbo->shared->physics_object = NULL;
+ }
- if (rbo->physics_shape) {
- RB_shape_delete(rbo->physics_shape);
- rbo->physics_shape = NULL;
+ if (rbo->shared->physics_shape) {
+ RB_shape_delete(rbo->shared->physics_shape);
+ rbo->shared->physics_shape = NULL;
+ }
+
+ MEM_freeN(rbo->shared);
}
/* free data itself */
@@ -193,7 +211,7 @@ void BKE_rigidbody_free_constraint(Object *ob)
* be added to relevant groups later...
*/
-RigidBodyOb *BKE_rigidbody_copy_object(const Object *ob, const int UNUSED(flag))
+RigidBodyOb *BKE_rigidbody_copy_object(const Object *ob, const int flag)
{
RigidBodyOb *rboN = NULL;
@@ -201,12 +219,13 @@ RigidBodyOb *BKE_rigidbody_copy_object(const Object *ob, const int UNUSED(flag))
/* just duplicate the whole struct first (to catch all the settings) */
rboN = MEM_dupallocN(ob->rigidbody_object);
+ if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) {
+ /* This is a regular copy, and not a CoW copy for depsgraph evaluation */
+ rboN->shared = MEM_callocN(sizeof(*rboN->shared), "RigidBodyOb_Shared");
+ }
+
/* tag object as needing to be verified */
rboN->flag |= RBO_FLAG_NEEDS_VALIDATE;
-
- /* clear out all the fields which need to be revalidated later */
- rboN->physics_object = NULL;
- rboN->physics_shape = NULL;
}
/* return new copy of settings */
@@ -235,20 +254,25 @@ RigidBodyCon *BKE_rigidbody_copy_constraint(const Object *ob, const int UNUSED(f
/* ************************************** */
/* Setup Utilities - Validate Sim Instances */
-/* get the appropriate DerivedMesh based on rigid body mesh source */
+/* get the appropriate evaluated mesh based on rigid body mesh source */
static Mesh *rigidbody_get_mesh(Object *ob)
{
- /* TODO(Sybren): turn this into a switch statement */
- if (ob->rigidbody_object->mesh_source == RBO_MESH_DEFORM) {
- return ob->runtime.mesh_deform_eval;
- }
- else if (ob->rigidbody_object->mesh_source == RBO_MESH_FINAL) {
- return ob->runtime.mesh_eval;
- }
- else {
- BLI_assert(ob->rigidbody_object->mesh_source == RBO_MESH_BASE);
- return ob->data;
- }
+ switch (ob->rigidbody_object->mesh_source) {
+ case RBO_MESH_DEFORM:
+ return ob->runtime.mesh_deform_eval;
+ case RBO_MESH_FINAL:
+ return ob->runtime.mesh_eval;
+ case RBO_MESH_BASE:
+ /* This mesh may be used for computing looptris, which should be done
+ * on the original; otherwise every time the CoW is recreated it will
+ * have to be recomputed. */
+ BLI_assert(ob->rigidbody_object->mesh_source == RBO_MESH_BASE);
+ return ob->runtime.mesh_orig;
+ }
+
+ /* Just return something sensible so that at least Blender won't crash. */
+ BLI_assert(!"Unknown mesh source");
+ return ob->runtime.mesh_eval;
}
/* create collision shape of mesh - convex hull */
@@ -382,7 +406,7 @@ static void rigidbody_validate_sim_shape(Object *ob, bool rebuild)
return;
/* don't create a new shape if we already have one and don't want to rebuild it */
- if (rbo->physics_shape && !rebuild)
+ if (rbo->shared->physics_shape && !rebuild)
return;
/* if automatically determining dimensions, use the Object's boundbox
@@ -446,15 +470,16 @@ static void rigidbody_validate_sim_shape(Object *ob, bool rebuild)
break;
}
/* use box shape if we can't fall back to old shape */
- if (new_shape == NULL && rbo->physics_shape == NULL) {
+ if (new_shape == NULL && rbo->shared->physics_shape == NULL) {
new_shape = RB_shape_new_box(size[0], size[1], size[2]);
}
/* assign new collision shape if creation was successful */
if (new_shape) {
- if (rbo->physics_shape)
- RB_shape_delete(rbo->physics_shape);
- rbo->physics_shape = new_shape;
- RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo));
+ if (rbo->shared->physics_shape) {
+ RB_shape_delete(rbo->shared->physics_shape);
+ }
+ rbo->shared->physics_shape = new_shape;
+ RB_shape_set_margin(rbo->shared->physics_shape, RBO_GET_MARGIN(rbo));
}
}
@@ -645,48 +670,48 @@ static void rigidbody_validate_sim_object(RigidBodyWorld *rbw, Object *ob, bool
/* make sure collision shape exists */
/* FIXME we shouldn't always have to rebuild collision shapes when rebuilding objects, but it's needed for constraints to update correctly */
- if (rbo->physics_shape == NULL || rebuild)
+ if (rbo->shared->physics_shape == NULL || rebuild)
rigidbody_validate_sim_shape(ob, true);
- if (rbo->physics_object && rebuild == false) {
- RB_dworld_remove_body(rbw->physics_world, rbo->physics_object);
+ if (rbo->shared->physics_object) {
+ RB_dworld_remove_body(rbw->shared->physics_world, rbo->shared->physics_object);
}
- if (!rbo->physics_object || rebuild) {
+ if (!rbo->shared->physics_object || rebuild) {
/* remove rigid body if it already exists before creating a new one */
- if (rbo->physics_object) {
- RB_body_delete(rbo->physics_object);
+ if (rbo->shared->physics_object) {
+ RB_body_delete(rbo->shared->physics_object);
}
mat4_to_loc_quat(loc, rot, ob->obmat);
- rbo->physics_object = RB_body_new(rbo->physics_shape, loc, rot);
+ rbo->shared->physics_object = RB_body_new(rbo->shared->physics_shape, loc, rot);
- RB_body_set_friction(rbo->physics_object, rbo->friction);
- RB_body_set_restitution(rbo->physics_object, rbo->restitution);
+ RB_body_set_friction(rbo->shared->physics_object, rbo->friction);
+ RB_body_set_restitution(rbo->shared->physics_object, rbo->restitution);
- RB_body_set_damping(rbo->physics_object, rbo->lin_damping, rbo->ang_damping);
- RB_body_set_sleep_thresh(rbo->physics_object, rbo->lin_sleep_thresh, rbo->ang_sleep_thresh);
- RB_body_set_activation_state(rbo->physics_object, rbo->flag & RBO_FLAG_USE_DEACTIVATION);
+ RB_body_set_damping(rbo->shared->physics_object, rbo->lin_damping, rbo->ang_damping);
+ RB_body_set_sleep_thresh(rbo->shared->physics_object, rbo->lin_sleep_thresh, rbo->ang_sleep_thresh);
+ RB_body_set_activation_state(rbo->shared->physics_object, rbo->flag & RBO_FLAG_USE_DEACTIVATION);
if (rbo->type == RBO_TYPE_PASSIVE || rbo->flag & RBO_FLAG_START_DEACTIVATED)
- RB_body_deactivate(rbo->physics_object);
+ RB_body_deactivate(rbo->shared->physics_object);
- RB_body_set_linear_factor(rbo->physics_object,
+ RB_body_set_linear_factor(rbo->shared->physics_object,
(ob->protectflag & OB_LOCK_LOCX) == 0,
(ob->protectflag & OB_LOCK_LOCY) == 0,
(ob->protectflag & OB_LOCK_LOCZ) == 0);
- RB_body_set_angular_factor(rbo->physics_object,
+ RB_body_set_angular_factor(rbo->shared->physics_object,
(ob->protectflag & OB_LOCK_ROTX) == 0,
(ob->protectflag & OB_LOCK_ROTY) == 0,
(ob->protectflag & OB_LOCK_ROTZ) == 0);
- RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
- RB_body_set_kinematic_state(rbo->physics_object, rbo->flag & RBO_FLAG_KINEMATIC || rbo->flag & RBO_FLAG_DISABLED);
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->shared->physics_object, rbo->flag & RBO_FLAG_KINEMATIC || rbo->flag & RBO_FLAG_DISABLED);
}
- if (rbw && rbw->physics_world)
- RB_dworld_add_body(rbw->physics_world, rbo->physics_object, rbo->col_groups);
+ if (rbw && rbw->shared->physics_world)
+ RB_dworld_add_body(rbw->shared->physics_world, rbo->shared->physics_object, rbo->col_groups);
}
/* --------------------- */
@@ -750,7 +775,7 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
if (ELEM(NULL, rbc->ob1, rbc->ob1->rigidbody_object, rbc->ob2, rbc->ob2->rigidbody_object)) {
if (rbc->physics_constraint) {
- RB_dworld_remove_constraint(rbw->physics_world, rbc->physics_constraint);
+ RB_dworld_remove_constraint(rbw->shared->physics_world, rbc->physics_constraint);
RB_constraint_delete(rbc->physics_constraint);
rbc->physics_constraint = NULL;
}
@@ -758,11 +783,11 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
}
if (rbc->physics_constraint && rebuild == false) {
- RB_dworld_remove_constraint(rbw->physics_world, rbc->physics_constraint);
+ RB_dworld_remove_constraint(rbw->shared->physics_world, rbc->physics_constraint);
}
if (rbc->physics_constraint == NULL || rebuild) {
- rbRigidBody *rb1 = rbc->ob1->rigidbody_object->physics_object;
- rbRigidBody *rb2 = rbc->ob2->rigidbody_object->physics_object;
+ rbRigidBody *rb1 = rbc->ob1->rigidbody_object->shared->physics_object;
+ rbRigidBody *rb2 = rbc->ob2->rigidbody_object->shared->physics_object;
/* remove constraint if it already exists before creating a new one */
if (rbc->physics_constraint) {
@@ -877,8 +902,8 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
RB_constraint_set_solver_iterations(rbc->physics_constraint, -1);
}
- if (rbw && rbw->physics_world && rbc->physics_constraint) {
- RB_dworld_add_constraint(rbw->physics_world, rbc->physics_constraint, rbc->flag & RBC_FLAG_DISABLE_COLLISIONS);
+ if (rbw && rbw->shared->physics_world && rbc->physics_constraint) {
+ RB_dworld_add_constraint(rbw->shared->physics_world, rbc->physics_constraint, rbc->flag & RBC_FLAG_DISABLE_COLLISIONS);
}
}
@@ -893,14 +918,14 @@ void BKE_rigidbody_validate_sim_world(Scene *scene, RigidBodyWorld *rbw, bool re
return;
/* create new sim world */
- if (rebuild || rbw->physics_world == NULL) {
- if (rbw->physics_world)
- RB_dworld_delete(rbw->physics_world);
- rbw->physics_world = RB_dworld_new(scene->physics_settings.gravity);
+ if (rebuild || rbw->shared->physics_world == NULL) {
+ if (rbw->shared->physics_world)
+ RB_dworld_delete(rbw->shared->physics_world);
+ rbw->shared->physics_world = RB_dworld_new(scene->physics_settings.gravity);
}
- RB_dworld_set_solver_iterations(rbw->physics_world, rbw->num_solver_iterations);
- RB_dworld_set_split_impulse(rbw->physics_world, rbw->flag & RBW_FLAG_USE_SPLIT_IMPULSE);
+ RB_dworld_set_solver_iterations(rbw->shared->physics_world, rbw->num_solver_iterations);
+ RB_dworld_set_split_impulse(rbw->shared->physics_world, rbw->flag & RBW_FLAG_USE_SPLIT_IMPULSE);
}
/* ************************************** */
@@ -921,6 +946,7 @@ RigidBodyWorld *BKE_rigidbody_create_world(Scene *scene)
/* create a new sim world */
rbw = MEM_callocN(sizeof(RigidBodyWorld), "RigidBodyWorld");
+ rbw->shared = MEM_callocN(sizeof(*rbw->shared), "RigidBodyWorld_Shared");
/* set default settings */
rbw->effector_weights = BKE_add_effector_weights(NULL);
@@ -932,8 +958,8 @@ RigidBodyWorld *BKE_rigidbody_create_world(Scene *scene)
rbw->steps_per_second = 60; /* Bullet default (60 Hz) */
rbw->num_solver_iterations = 10; /* 10 is bullet default */
- rbw->pointcache = BKE_ptcache_add(&(rbw->ptcaches));
- rbw->pointcache->step = 1;
+ rbw->shared->pointcache = BKE_ptcache_add(&(rbw->shared->ptcaches));
+ rbw->shared->pointcache->step = 1;
/* return this sim world */
return rbw;
@@ -951,12 +977,16 @@ RigidBodyWorld *BKE_rigidbody_world_copy(RigidBodyWorld *rbw, const int flag)
id_us_plus((ID *)rbw_copy->constraints);
}
- /* XXX Never copy caches here? */
- rbw_copy->pointcache = BKE_ptcache_copy_list(&rbw_copy->ptcaches, &rbw->ptcaches, flag & ~LIB_ID_COPY_CACHES);
+ if ((flag & LIB_ID_CREATE_NO_MAIN) == 0) {
+ /* This is a regular copy, and not a CoW copy for depsgraph evaluation */
+ rbw_copy->shared = MEM_callocN(sizeof(*rbw_copy->shared), "RigidBodyWorld_Shared");
+ BKE_ptcache_copy_list(&rbw_copy->shared->ptcaches, &rbw->shared->ptcaches, LIB_ID_COPY_CACHES);
+ rbw_copy->shared->pointcache = rbw_copy->shared->ptcaches.first;
+ }
rbw_copy->objects = NULL;
- rbw_copy->physics_world = NULL;
rbw_copy->numbodies = 0;
+ rigidbody_update_ob_array(rbw_copy);
return rbw_copy;
}
@@ -998,6 +1028,7 @@ RigidBodyOb *BKE_rigidbody_create_object(Scene *scene, Object *ob, short type)
/* create new settings data, and link it up */
rbo = MEM_callocN(sizeof(RigidBodyOb), "RigidBodyOb");
+ rbo->shared = MEM_callocN(sizeof(*rbo->shared), "RigidBodyOb_Shared");
/* set default settings */
rbo->type = type;
@@ -1123,14 +1154,10 @@ RigidBodyWorld *BKE_rigidbody_get_world(Scene *scene)
void BKE_rigidbody_remove_object(struct Main *bmain, Scene *scene, Object *ob)
{
RigidBodyWorld *rbw = scene->rigidbody_world;
- RigidBodyOb *rbo = ob->rigidbody_object;
RigidBodyCon *rbc;
int i;
if (rbw) {
- /* remove from rigidbody world, free object won't do this */
- if (rbw->physics_world && rbo->physics_object)
- RB_dworld_remove_body(rbw->physics_world, rbo->physics_object);
/* remove object from array */
if (rbw && rbw->objects) {
@@ -1159,7 +1186,7 @@ void BKE_rigidbody_remove_object(struct Main *bmain, Scene *scene, Object *ob)
}
/* remove object's settings */
- BKE_rigidbody_free_object(ob);
+ BKE_rigidbody_free_object(ob, rbw);
/* flag cache as outdated */
BKE_rigidbody_cache_reset(rbw);
@@ -1171,8 +1198,8 @@ void BKE_rigidbody_remove_constraint(Scene *scene, Object *ob)
RigidBodyCon *rbc = ob->rigidbody_constraint;
/* remove from rigidbody world, free object won't do this */
- if (rbw && rbw->physics_world && rbc->physics_constraint) {
- RB_dworld_remove_constraint(rbw->physics_world, rbc->physics_constraint);
+ if (rbw && rbw->shared->physics_world && rbc->physics_constraint) {
+ RB_dworld_remove_constraint(rbw->shared->physics_world, rbc->physics_constraint);
}
/* remove object's settings */
BKE_rigidbody_free_constraint(ob);
@@ -1188,6 +1215,12 @@ void BKE_rigidbody_remove_constraint(Scene *scene, Object *ob)
/* Update object array and rigid body count so they're in sync with the rigid body group */
static void rigidbody_update_ob_array(RigidBodyWorld *rbw)
{
+ if (rbw->group == NULL) {
+ rbw->numbodies = 0;
+ rbw->objects = realloc(rbw->objects, 0);
+ return;
+ }
+
int n = 0;
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->group, object)
{
@@ -1224,7 +1257,7 @@ static void rigidbody_update_sim_world(Scene *scene, RigidBodyWorld *rbw)
}
/* update gravity, since this RNA setting is not part of RigidBody settings */
- RB_dworld_set_gravity(rbw->physics_world, adj_gravity);
+ RB_dworld_set_gravity(rbw->shared->physics_world, adj_gravity);
/* update object array in case there are changes */
rigidbody_update_ob_array(rbw);
@@ -1237,7 +1270,7 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Scene *scene, RigidBod
float scale[3];
/* only update if rigid body exists */
- if (rbo->physics_object == NULL)
+ if (rbo->shared->physics_object == NULL)
return;
if (rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) {
@@ -1247,28 +1280,28 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Scene *scene, RigidBod
int totvert = mesh->totvert;
BoundBox *bb = BKE_object_boundbox_get(ob);
- RB_shape_trimesh_update(rbo->physics_shape, (float *)mvert, totvert, sizeof(MVert), bb->vec[0], bb->vec[6]);
+ RB_shape_trimesh_update(rbo->shared->physics_shape, (float *)mvert, totvert, sizeof(MVert), bb->vec[0], bb->vec[6]);
}
}
mat4_decompose(loc, rot, scale, ob->obmat);
/* update scale for all objects */
- RB_body_set_scale(rbo->physics_object, scale);
+ RB_body_set_scale(rbo->shared->physics_object, scale);
/* compensate for embedded convex hull collision margin */
if (!(rbo->flag & RBO_FLAG_USE_MARGIN) && rbo->shape == RB_SHAPE_CONVEXH)
- RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo) * MIN3(scale[0], scale[1], scale[2]));
+ RB_shape_set_margin(rbo->shared->physics_shape, RBO_GET_MARGIN(rbo) * MIN3(scale[0], scale[1], scale[2]));
/* make transformed objects temporarily kinmatic so that they can be moved by the user during simulation */
if (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ) {
- RB_body_set_kinematic_state(rbo->physics_object, true);
- RB_body_set_mass(rbo->physics_object, 0.0f);
+ RB_body_set_kinematic_state(rbo->shared->physics_object, true);
+ RB_body_set_mass(rbo->shared->physics_object, 0.0f);
}
/* update rigid body location and rotation for kinematic bodies */
if (rbo->flag & RBO_FLAG_KINEMATIC || (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ)) {
- RB_body_activate(rbo->physics_object);
- RB_body_set_loc_rot(rbo->physics_object, loc, rot);
+ RB_body_activate(rbo->shared->physics_object);
+ RB_body_set_loc_rot(rbo->shared->physics_object, loc, rot);
}
/* update influence of effectors - but don't do it on an effector */
/* only dynamic bodies need effector update */
@@ -1278,34 +1311,34 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Scene *scene, RigidBod
ListBase *effectors;
/* get effectors present in the group specified by effector_weights */
- effectors = pdInitEffectors(depsgraph, scene, ob, NULL, effector_weights, true);
+ effectors = BKE_effectors_create(depsgraph, ob, NULL, effector_weights);
if (effectors) {
float eff_force[3] = {0.0f, 0.0f, 0.0f};
float eff_loc[3], eff_vel[3];
/* create dummy 'point' which represents last known position of object as result of sim */
// XXX: this can create some inaccuracies with sim position, but is probably better than using unsimulated vals?
- RB_body_get_position(rbo->physics_object, eff_loc);
- RB_body_get_linear_velocity(rbo->physics_object, eff_vel);
+ RB_body_get_position(rbo->shared->physics_object, eff_loc);
+ RB_body_get_linear_velocity(rbo->shared->physics_object, eff_vel);
pd_point_from_loc(scene, eff_loc, eff_vel, 0, &epoint);
/* calculate net force of effectors, and apply to sim object
* - we use 'central force' since apply force requires a "relative position" which we don't have...
*/
- pdDoEffectors(effectors, NULL, effector_weights, &epoint, eff_force, NULL);
+ BKE_effectors_apply(effectors, NULL, effector_weights, &epoint, eff_force, NULL);
if (G.f & G_DEBUG)
printf("\tapplying force (%f,%f,%f) to '%s'\n", eff_force[0], eff_force[1], eff_force[2], ob->id.name + 2);
/* activate object in case it is deactivated */
if (!is_zero_v3(eff_force))
- RB_body_activate(rbo->physics_object);
- RB_body_apply_central_force(rbo->physics_object, eff_force);
+ RB_body_activate(rbo->shared->physics_object);
+ RB_body_apply_central_force(rbo->shared->physics_object, eff_force);
}
else if (G.f & G_DEBUG)
printf("\tno forces to apply to '%s'\n", ob->id.name + 2);
/* cleanup */
- pdEndEffectors(&effectors);
+ BKE_effectors_free(effectors);
}
/* NOTE: passive objects don't need to be updated since they don't move */
@@ -1337,7 +1370,7 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, Rigi
{
RigidBodyCon *rbc = ob->rigidbody_constraint;
if (rbc && rbc->physics_constraint) {
- RB_dworld_remove_constraint(rbw->physics_world, rbc->physics_constraint);
+ RB_dworld_remove_constraint(rbw->shared->physics_world, rbc->physics_constraint);
RB_constraint_delete(rbc->physics_constraint);
rbc->physics_constraint = NULL;
}
@@ -1369,6 +1402,9 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, Rigi
/* refresh object... */
if (rebuild) {
/* World has been rebuilt so rebuild object */
+ /* TODO(Sybren): rigidbody_validate_sim_object() can call rigidbody_validate_sim_shape(),
+ * but neither resets the RBO_FLAG_NEEDS_RESHAPE flag nor calls RB_body_set_collision_shape().
+ * This results in the collision shape being created twice, which is unnecessary. */
rigidbody_validate_sim_object(rbw, ob, true);
}
else if (rbo->flag & RBO_FLAG_NEEDS_VALIDATE) {
@@ -1380,7 +1416,7 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, Rigi
rigidbody_validate_sim_shape(ob, true);
/* now tell RB sim about it */
// XXX: we assume that this can only get applied for active/passive shapes that will be included as rigidbodies
- RB_body_set_collision_shape(rbo->physics_object, rbo->physics_shape);
+ RB_body_set_collision_shape(rbo->shared->physics_object, rbo->shared->physics_shape);
}
rbo->flag &= ~(RBO_FLAG_NEEDS_VALIDATE | RBO_FLAG_NEEDS_RESHAPE);
}
@@ -1436,11 +1472,11 @@ static void rigidbody_update_simulation_post_step(Depsgraph *depsgraph, RigidBod
RigidBodyOb *rbo = ob->rigidbody_object;
/* Reset kinematic state for transformed objects. */
if (rbo && base && (base->flag & BASE_SELECTED) && (G.moving & G_TRANSFORM_OBJ)) {
- RB_body_set_kinematic_state(rbo->physics_object, rbo->flag & RBO_FLAG_KINEMATIC || rbo->flag & RBO_FLAG_DISABLED);
- RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->shared->physics_object, rbo->flag & RBO_FLAG_KINEMATIC || rbo->flag & RBO_FLAG_DISABLED);
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
/* Deactivate passive objects so they don't interfere with deactivation of active objects. */
if (rbo->type == RBO_TYPE_PASSIVE)
- RB_body_deactivate(rbo->physics_object);
+ RB_body_deactivate(rbo->shared->physics_object);
}
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
@@ -1448,7 +1484,7 @@ static void rigidbody_update_simulation_post_step(Depsgraph *depsgraph, RigidBod
bool BKE_rigidbody_check_sim_running(RigidBodyWorld *rbw, float ctime)
{
- return (rbw && (rbw->flag & RBW_FLAG_MUTED) == 0 && ctime > rbw->pointcache->startframe);
+ return (rbw && (rbw->flag & RBW_FLAG_MUTED) == 0 && ctime > rbw->shared->pointcache->startframe);
}
/* Sync rigid body and object transformations */
@@ -1538,11 +1574,11 @@ void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], flo
copy_qt_qt(ob->quat, quat);
}
- if (rbo->physics_object) {
+ if (rbo->shared->physics_object) {
/* allow passive objects to return to original transform */
if (rbo->type == RBO_TYPE_PASSIVE)
- RB_body_set_kinematic_state(rbo->physics_object, true);
- RB_body_set_loc_rot(rbo->physics_object, rbo->pos, rbo->orn);
+ RB_body_set_kinematic_state(rbo->shared->physics_object, true);
+ RB_body_set_loc_rot(rbo->shared->physics_object, rbo->pos, rbo->orn);
}
// RB_TODO update rigid body physics object's loc/rot for dynamic objects here as well (needs to be done outside bullet's update loop)
}
@@ -1550,7 +1586,7 @@ void BKE_rigidbody_aftertrans_update(Object *ob, float loc[3], float rot[3], flo
void BKE_rigidbody_cache_reset(RigidBodyWorld *rbw)
{
if (rbw) {
- rbw->pointcache->flag |= PTCACHE_OUTDATED;
+ rbw->shared->pointcache->flag |= PTCACHE_OUTDATED;
}
}
@@ -1567,7 +1603,7 @@ void BKE_rigidbody_rebuild_world(Depsgraph *depsgraph, Scene *scene, float ctime
BKE_ptcache_id_from_rigidbody(&pid, NULL, rbw);
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
- cache = rbw->pointcache;
+ cache = rbw->shared->pointcache;
/* flag cache as outdated if we don't have a world or number of objects in the simulation has changed */
int n = 0;
@@ -1578,7 +1614,7 @@ void BKE_rigidbody_rebuild_world(Depsgraph *depsgraph, Scene *scene, float ctime
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
- if (rbw->physics_world == NULL || rbw->numbodies != n) {
+ if (rbw->shared->physics_world == NULL || rbw->numbodies != n) {
cache->flag |= PTCACHE_OUTDATED;
}
@@ -1604,7 +1640,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
BKE_ptcache_id_from_rigidbody(&pid, NULL, rbw);
BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
- cache = rbw->pointcache;
+ cache = rbw->shared->pointcache;
if (ctime <= startframe) {
rbw->ltime = startframe;
@@ -1616,7 +1652,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
}
/* don't try to run the simulation if we don't have a world yet but allow reading baked cache */
- if (rbw->physics_world == NULL && !(cache->flag & PTCACHE_BAKED))
+ if (rbw->shared->physics_world == NULL && !(cache->flag & PTCACHE_BAKED))
return;
else if (rbw->objects == NULL)
rigidbody_update_ob_array(rbw);
@@ -1631,6 +1667,12 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
return;
}
+ if (!DEG_is_active(depsgraph)) {
+ /* When the depsgraph is inactive we should neither write to the cache
+ * nor run the simulation. */
+ return;
+ }
+
/* advance simulation, we can only step one frame forward */
if (compare_ff_relative(ctime, rbw->ltime + 1, FLT_EPSILON, 64)) {
/* write cache for first frame when on second frame */
@@ -1644,7 +1686,7 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
/* calculate how much time elapsed since last step in seconds */
timestep = 1.0f / (float)FPS * (ctime - rbw->ltime) * rbw->time_scale;
/* step simulation by the requested timestep, steps per second are adjusted to take time scale into account */
- RB_dworld_step_simulation(rbw->physics_world, timestep, INT_MAX, 1.0f / (float)rbw->steps_per_second * min_ff(rbw->time_scale, 1.0f));
+ RB_dworld_step_simulation(rbw->shared->physics_world, timestep, INT_MAX, 1.0f / (float)rbw->steps_per_second * min_ff(rbw->time_scale, 1.0f));
rigidbody_update_simulation_post_step(depsgraph, rbw);
@@ -1693,25 +1735,6 @@ void BKE_rigidbody_do_simulation(Depsgraph *depsgraph, Scene *scene, float ctime
#endif /* WITH_BULLET */
-/* Copy the pointcache from the evaluated to the original scene.
- * This allows the re-evaluation of the original scene to use the
- * physics cache.
- */
-static void rigidbody_copy_cache_to_orig(Scene *scene_eval)
-{
- if ((scene_eval->id.tag & LIB_TAG_COPIED_ON_WRITE) == 0) {
- /* Scene is already an original, this function is a no-op. */
- return;
- }
-
- Scene *scene_orig = (Scene *)DEG_get_original_id(&scene_eval->id);
- RigidBodyWorld *rbw_orig = scene_orig->rigidbody_world;
- RigidBodyWorld *rbw_eval = scene_eval->rigidbody_world;
-
- BKE_ptcache_free_list(&rbw_orig->ptcaches);
- rbw_orig->pointcache = BKE_ptcache_copy_list(&rbw_orig->ptcaches, &rbw_eval->ptcaches, LIB_ID_COPY_CACHES);
-}
-
/* -------------------- */
/* Depsgraph evaluation */
@@ -1738,12 +1761,6 @@ void BKE_rigidbody_eval_simulation(Depsgraph *depsgraph,
return;
}
BKE_rigidbody_do_simulation(depsgraph, scene, ctime);
-
- /* Make sure re-evaluation can use the cache from this simulation */
- if (!DEG_is_active(depsgraph)) {
- return;
- }
- rigidbody_copy_cache_to_orig(scene);
}
void BKE_rigidbody_object_sync_transforms(Depsgraph *depsgraph,
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 4c81cb057f0..a38384f8f2b 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -461,8 +461,7 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
}
if (sce->rigidbody_world) {
- BKE_rigidbody_free_world(sce->rigidbody_world);
- sce->rigidbody_world = NULL;
+ BKE_rigidbody_free_world(sce);
}
if (sce->r.avicodecdata) {
@@ -636,6 +635,7 @@ void BKE_scene_init(Scene *sce)
sce->toolsettings->uvcalc_flag = UVCALC_TRANSFORM_CORRECT;
sce->toolsettings->unwrapper = 1;
sce->toolsettings->select_thresh = 0.01f;
+ sce->toolsettings->manipulator_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE;
sce->toolsettings->selectmode = SCE_SELECT_VERTEX;
sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX;
@@ -1139,6 +1139,7 @@ int BKE_scene_camera_switch_update(Scene *scene)
Object *camera = BKE_scene_camera_switch_find(scene);
if (camera) {
scene->camera = camera;
+ DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
return 1;
}
#else
@@ -1562,7 +1563,7 @@ void BKE_scene_object_base_flag_sync_from_object(Base *base)
if ((ob->flag & SELECT) != 0) {
base->flag |= BASE_SELECTED;
- BLI_assert((base->flag & BASE_SELECTABLED) != 0);
+ BLI_assert((base->flag & BASE_SELECTABLE) != 0);
}
else {
base->flag &= ~BASE_SELECTED;
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 5a6c55a9fcc..1c8a93981c7 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -88,8 +88,6 @@ static void spacetype_free(SpaceType *st)
}
BLI_freelistN(&st->regiontypes);
- BLI_freelistN(&st->toolshelf);
-
}
void BKE_spacetypes_free(void)
@@ -750,19 +748,21 @@ ScrArea *BKE_screen_find_big_area(bScreen *sc, const int spacetype, const short
return big;
}
-ScrArea *BKE_screen_find_area_xy(bScreen *sc, const int spacetype, int x, int y)
+ScrArea *BKE_screen_area_map_find_area_xy(const ScrAreaMap *areamap, const int spacetype, int x, int y)
{
- ScrArea *sa, *sa_found = NULL;
-
- for (sa = sc->areabase.first; sa; sa = sa->next) {
+ for (ScrArea *sa = areamap->areabase.first; sa; sa = sa->next) {
if (BLI_rcti_isect_pt(&sa->totrct, x, y)) {
if ((spacetype == SPACE_TYPE_ANY) || (sa->spacetype == spacetype)) {
- sa_found = sa;
+ return sa;
}
break;
}
}
- return sa_found;
+ return NULL;
+}
+ScrArea *BKE_screen_find_area_xy(bScreen *sc, const int spacetype, int x, int y)
+{
+ return BKE_screen_area_map_find_area_xy(AREAMAP_FROM_SCREEN(sc), spacetype, x, y);
}
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index f8615671384..9fa104dc04d 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -300,7 +300,7 @@ static void shrinkwrap_calc_normal_projection_cb_ex(
}
if (calc->vert) {
- /* calc->vert contains verts from derivedMesh */
+ /* calc->vert contains verts from evaluated mesh. */
/* this coordinated are deformed by vertexCos only for normal projection (to get correct normals) */
/* for other cases calc->varts contains undeformed coordinates and vertexCos should be used */
if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
@@ -357,7 +357,7 @@ static void shrinkwrap_calc_normal_projection_cb_ex(
/* don't set the initial dist (which is more efficient),
* because its calculated in the targets space, we want the dist in our own space */
if (proj_limit_squared != 0.0f) {
- if (len_squared_v3v3(hit->co, co) > proj_limit_squared) {
+ if (hit->index != -1 && len_squared_v3v3(hit->co, co) > proj_limit_squared) {
hit->index = -1;
}
}
@@ -448,7 +448,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
auxData = &auxdata_stack.dmtreedata;
}
}
- /* After sucessufuly build the trees, start projection vertexs */
+ /* After successfully build the trees, start projection vertices. */
ShrinkwrapCalcCBData data = {
.calc = calc,
.treeData = treeData, .targ_tree = targ_tree, .targ_callback = targ_callback,
@@ -600,7 +600,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
}
/* Main shrinkwrap function */
-void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, Mesh *mesh,
+void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, struct Scene *scene, Object *ob, Mesh *mesh,
float (*vertexCos)[3], int numVerts)
{
@@ -660,7 +660,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, Mesh *me
/* TODO to be moved to Mesh once we are done with changes in subsurf code. */
DerivedMesh *dm = CDDM_from_mesh(mesh);
- ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, NULL, (ob->mode & OB_MODE_EDIT) ? SUBSURF_IN_EDIT_MODE : 0);
+ ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, scene, NULL, (ob->mode & OB_MODE_EDIT) ? SUBSURF_IN_EDIT_MODE : 0);
if (ss_mesh) {
calc.vert = ss_mesh->getVertDataArray(ss_mesh, CD_MVERT);
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 6bdce647bd9..c9b10e36ed1 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -893,7 +893,7 @@ static void obstacles_from_derivedmesh(
}
/* Animated obstacles: dx_step = ((x_new - x_old) / totalsteps) * substep */
-static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds, float dt,
+static void update_obstacles(Depsgraph *depsgraph, Object *ob, SmokeDomainSettings *sds, float dt,
int UNUSED(substep), int UNUSED(totalsteps))
{
Object **collobjs = NULL;
@@ -933,7 +933,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
}
- collobjs = get_collisionobjects(scene, ob, sds->coll_group, &numcollobj, eModifierType_Smoke);
+ collobjs = BKE_collision_objects_create(depsgraph, ob, sds->coll_group, &numcollobj, eModifierType_Smoke);
// update obstacle tags in cells
for (collIndex = 0; collIndex < numcollobj; collIndex++)
@@ -950,8 +950,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
}
}
- if (collobjs)
- MEM_freeN(collobjs);
+ BKE_collision_objects_free(collobjs);
/* obstacle cells should not contain any velocity from the smoke simulation */
for (z = 0; z < sds->res[0] * sds->res[1] * sds->res[2]; z++)
@@ -2151,7 +2150,7 @@ static void update_flowsfluids(
sds->p1[2] = sds->p0[2] + sds->cell_size[2] * sds->base_res[2];
}
- flowobjs = get_collisionobjects(scene, ob, sds->fluid_group, &numflowobj, eModifierType_Smoke);
+ flowobjs = BKE_collision_objects_create(depsgraph, ob, sds->fluid_group, &numflowobj, eModifierType_Smoke);
/* init emission maps for each flow */
emaps = MEM_callocN(sizeof(struct EmissionMap) * numflowobj, "smoke_flow_maps");
@@ -2452,8 +2451,7 @@ static void update_flowsfluids(
}
}
- if (flowobjs)
- MEM_freeN(flowobjs);
+ BKE_collision_objects_free(flowobjs);
if (emaps)
MEM_freeN(emaps);
}
@@ -2512,7 +2510,7 @@ static void update_effectors_task_cb(
mul_m4_v3(sds->obmat, voxelCenter);
pd_point_from_loc(data->scene, voxelCenter, vel, index, &epoint);
- pdDoEffectors(data->effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
+ BKE_effectors_apply(data->effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
/* convert retvel to local space */
mag = len_v3(retvel);
@@ -2533,7 +2531,7 @@ static void update_effectors(struct Depsgraph *depsgraph, Scene *scene, Object *
ListBase *effectors;
/* make sure smoke flow influence is 0.0f */
sds->effector_weights->weight[PFIELD_SMOKEFLOW] = 0.0f;
- effectors = pdInitEffectors(depsgraph, scene, ob, NULL, sds->effector_weights, true);
+ effectors = BKE_effectors_create(depsgraph, ob, NULL, sds->effector_weights);
if (effectors) {
// precalculate wind forces
@@ -2560,7 +2558,7 @@ static void update_effectors(struct Depsgraph *depsgraph, Scene *scene, Object *
&settings);
}
- pdEndEffectors(&effectors);
+ BKE_effectors_free(effectors);
}
static void step(
@@ -2636,7 +2634,7 @@ static void step(
{
// calc animated obstacle velocities
update_flowsfluids(depsgraph, scene, ob, sds, dtSubdiv);
- update_obstacles(scene, ob, sds, dtSubdiv, substep, totalSubsteps);
+ update_obstacles(depsgraph, ob, sds, dtSubdiv, substep, totalSubsteps);
if (sds->total_cells > 1) {
update_effectors(depsgraph, scene, ob, sds, dtSubdiv); // DG TODO? problem --> uses forces instead of velocity, need to check how they need to be changed with variable dt
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 31644cc2392..a61b71f50eb 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -72,6 +72,7 @@ variables on the UI for now
#include "BLI_threads.h"
#include "BKE_collection.h"
+#include "BKE_collision.h"
#include "BKE_curve.h"
#include "BKE_effect.h"
#include "BKE_global.h"
@@ -139,7 +140,7 @@ typedef struct SB_thread_context {
float timenow;
int ifirst;
int ilast;
- ListBase *do_effector;
+ ListBase *effectors;
int do_deflector;
float fieldfactor;
float windfactor;
@@ -521,20 +522,18 @@ static void ccd_build_deflector_hash(Depsgraph *depsgraph, Collection *collectio
{
if (!hash) return;
- /* Explicit collision collection. */
- Base *base = BKE_collection_or_layer_objects(depsgraph, NULL, NULL, collection);
+ unsigned int numobjects;
+ Object **objects = BKE_collision_objects_create(depsgraph, vertexowner, collection, &numobjects, eModifierType_Collision);
- for (; base; base = base->next) {
- /* Only proceed for mesh object in same layer. */
- if (base->object->type == OB_MESH) {
- Object *ob = base->object;
- if (ob == vertexowner) {
- /* If vertexowner is given we don't want to check collision with owner object. */
- continue;
- }
+ for (int i = 0; i < numobjects; i++) {
+ Object *ob = objects[i];
+
+ if (ob->type == OB_MESH) {
ccd_build_deflector_hash_single(hash, ob);
}
}
+
+ BKE_collision_objects_free(objects);
}
static void ccd_update_deflector_hash_single(GHash *hash, Object *ob)
@@ -554,23 +553,19 @@ static void ccd_update_deflector_hash(Depsgraph *depsgraph, Collection *collecti
{
if ((!hash) || (!vertexowner)) return;
- /* Explicit collision collection. */
- Base *base = BKE_collection_or_layer_objects(depsgraph, NULL, NULL, collection);
+ unsigned int numobjects;
+ Object **objects = BKE_collision_objects_create(depsgraph, vertexowner, collection, &numobjects, eModifierType_Collision);
- for (; base; base = base->next) {
- /* Only proceed for mesh object in same layer. */
- if (base->object->type == OB_MESH) {
- Object *ob = base->object;
- if (ob == vertexowner) {
- /* If vertexowner is given we don't want to check collision with owner object. */
- continue;
- }
+ for (int i = 0; i < numobjects; i++) {
+ Object *ob = objects[i];
+ if (ob->type == OB_MESH) {
ccd_update_deflector_hash_single(hash, ob);
}
}
-}
+ BKE_collision_objects_free(objects);
+}
/*--- collider caching and dicing ---*/
@@ -959,21 +954,13 @@ static void free_softbody_intern(SoftBody *sb)
/**
* \note collection overrides scene when not NULL.
*/
-static bool are_there_deflectors(Base *first_base)
-{
- for (Base *base = first_base; base; base = base->next) {
- if (base->object->pd) {
- if (base->object->pd->deflect)
- return 1;
- }
- }
-
- return 0;
-}
-
static int query_external_colliders(Depsgraph *depsgraph, Collection *collection)
{
- return(are_there_deflectors(BKE_collection_or_layer_objects(depsgraph, NULL, NULL, collection)));
+ unsigned int numobjects;
+ Object **objects = BKE_collision_objects_create(depsgraph, NULL, collection, &numobjects, eModifierType_Collision);
+ BKE_collision_objects_free(objects);
+
+ return (numobjects != 0);
}
/* --- dependency information functions*/
@@ -1444,7 +1431,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3], float edge_v2[3], fl
return deflected;
}
-static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow, int ifirst, int ilast, struct ListBase *do_effector)
+static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow, int ifirst, int ilast, struct ListBase *effectors)
{
SoftBody *sb = ob->soft;
int a;
@@ -1478,14 +1465,14 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
float vel[3], sp[3], pr[3], force[3];
float f, windfactor = 0.25f;
/*see if we have wind*/
- if (do_effector) {
+ if (effectors) {
EffectedPoint epoint;
float speed[3] = {0.0f, 0.0f, 0.0f};
float pos[3];
mid_v3_v3v3(pos, sb->bpoint[bs->v1].pos, sb->bpoint[bs->v2].pos);
mid_v3_v3v3(vel, sb->bpoint[bs->v1].vec, sb->bpoint[bs->v2].vec);
pd_point_from_soft(scene, pos, vel, -1, &epoint);
- pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
+ BKE_effectors_apply(effectors, NULL, sb->effector_weights, &epoint, force, speed);
mul_v3_fl(speed, windfactor);
add_v3_v3(vel, speed);
@@ -1521,29 +1508,27 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
static void scan_for_ext_spring_forces(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float timenow)
{
SoftBody *sb = ob->soft;
- ListBase *do_effector = NULL;
- do_effector = pdInitEffectors(depsgraph, scene, ob, NULL, sb->effector_weights, true);
- _scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, do_effector);
- pdEndEffectors(&do_effector);
+ ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, sb->effector_weights);
+ _scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, effectors);
+ BKE_effectors_free(effectors);
}
static void *exec_scan_for_ext_spring_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
- _scan_for_ext_spring_forces(pctx->scene, pctx->ob, pctx->timenow, pctx->ifirst, pctx->ilast, pctx->do_effector);
+ _scan_for_ext_spring_forces(pctx->scene, pctx->ob, pctx->timenow, pctx->ifirst, pctx->ilast, pctx->effectors);
return NULL;
}
static void sb_sfesf_threads_run(struct Depsgraph *depsgraph, Scene *scene, struct Object *ob, float timenow, int totsprings, int *UNUSED(ptr_to_break_func(void)))
{
- ListBase *do_effector = NULL;
ListBase threads;
SB_thread_context *sb_threads;
int i, totthread, left, dec;
int lowsprings =100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */
- do_effector= pdInitEffectors(depsgraph, scene, ob, NULL, ob->soft->effector_weights, true);
+ ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, ob->soft->effector_weights);
/* figure the number of threads while preventing pretty pointless threading overhead */
totthread= BKE_scene_num_threads(scene);
@@ -1568,7 +1553,7 @@ static void sb_sfesf_threads_run(struct Depsgraph *depsgraph, Scene *scene, stru
}
else
sb_threads[i].ifirst = 0;
- sb_threads[i].do_effector = do_effector;
+ sb_threads[i].effectors = effectors;
sb_threads[i].do_deflector = false;// not used here
sb_threads[i].fieldfactor = 0.0f;// not used here
sb_threads[i].windfactor = 0.0f;// not used here
@@ -1588,7 +1573,7 @@ static void sb_sfesf_threads_run(struct Depsgraph *depsgraph, Scene *scene, stru
/* clean up */
MEM_freeN(sb_threads);
- pdEndEffectors(&do_effector);
+ BKE_effectors_free(effectors);
}
@@ -1941,7 +1926,7 @@ static void sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, floa
/* since this is definitely the most CPU consuming task here .. try to spread it */
/* core function _softbody_calc_forces_slice_in_a_thread */
/* result is int to be able to flag user break */
-static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow, int ifirst, int ilast, int *UNUSED(ptr_to_break_func(void)), ListBase *do_effector, int do_deflector, float fieldfactor, float windfactor)
+static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, float forcetime, float timenow, int ifirst, int ilast, int *UNUSED(ptr_to_break_func(void)), ListBase *effectors, int do_deflector, float fieldfactor, float windfactor)
{
float iks;
int bb, do_selfcollision, do_springcollision, do_aero;
@@ -2060,14 +2045,14 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
}
/* particle field & vortex */
- if (do_effector) {
+ if (effectors) {
EffectedPoint epoint;
float kd;
float force[3] = {0.0f, 0.0f, 0.0f};
float speed[3] = {0.0f, 0.0f, 0.0f};
float eval_sb_fric_force_scale = sb_fric_force_scale(ob); /* just for calling function once */
pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint-bp, &epoint);
- pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
+ BKE_effectors_apply(effectors, NULL, sb->effector_weights, &epoint, force, speed);
/* apply forcefield*/
mul_v3_fl(force, fieldfactor* eval_sb_fric_force_scale);
@@ -2142,11 +2127,11 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
static void *exec_softbody_calc_forces(void *data)
{
SB_thread_context *pctx = (SB_thread_context*)data;
- _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->do_effector, pctx->do_deflector, pctx->fieldfactor, pctx->windfactor);
+ _softbody_calc_forces_slice_in_a_thread(pctx->scene, pctx->ob, pctx->forcetime, pctx->timenow, pctx->ifirst, pctx->ilast, NULL, pctx->effectors, pctx->do_deflector, pctx->fieldfactor, pctx->windfactor);
return NULL;
}
-static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow, int totpoint, int *UNUSED(ptr_to_break_func(void)), struct ListBase *do_effector, int do_deflector, float fieldfactor, float windfactor)
+static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float timenow, int totpoint, int *UNUSED(ptr_to_break_func(void)), struct ListBase *effectors, int do_deflector, float fieldfactor, float windfactor)
{
ListBase threads;
SB_thread_context *sb_threads;
@@ -2178,7 +2163,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
}
else
sb_threads[i].ifirst = 0;
- sb_threads[i].do_effector = do_effector;
+ sb_threads[i].effectors = effectors;
sb_threads[i].do_deflector = do_deflector;
sb_threads[i].fieldfactor = fieldfactor;
sb_threads[i].windfactor = windfactor;
@@ -2208,7 +2193,6 @@ static void softbody_calc_forcesEx(struct Depsgraph *depsgraph, Scene *scene, Ob
*/
SoftBody *sb= ob->soft; /* is supposed to be there */
/*BodyPoint *bproot;*/ /* UNUSED */
- ListBase *do_effector = NULL;
/* float gravity; */ /* UNUSED */
/* float iks; */
float fieldfactor = -1.0f, windfactor = 0.25;
@@ -2229,20 +2213,20 @@ static void softbody_calc_forcesEx(struct Depsgraph *depsgraph, Scene *scene, Ob
sb_sfesf_threads_run(depsgraph, scene, ob, timenow, sb->totspring, NULL);
/* after spring scan because it uses Effoctors too */
- do_effector= pdInitEffectors(depsgraph, scene, ob, NULL, sb->effector_weights, true);
+ ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, sb->effector_weights);
if (do_deflector) {
float defforce[3];
do_deflector = sb_detect_aabb_collisionCached(defforce, ob->lay, ob, timenow);
}
- sb_cf_threads_run(scene, ob, forcetime, timenow, sb->totpoint, NULL, do_effector, do_deflector, fieldfactor, windfactor);
+ sb_cf_threads_run(scene, ob, forcetime, timenow, sb->totpoint, NULL, effectors, do_deflector, fieldfactor, windfactor);
/* finally add forces caused by face collision */
if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob, timenow);
/* finish matrix and solve */
- pdEndEffectors(&do_effector);
+ BKE_effectors_free(effectors);
}
@@ -2269,7 +2253,6 @@ static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Obje
BodyPoint *bp;
/* BodyPoint *bproot; */ /* UNUSED */
BodySpring *bs;
- ListBase *do_effector = NULL;
float iks, ks, kd, gravity[3] = {0.0f, 0.0f, 0.0f};
float fieldfactor = -1.0f, windfactor = 0.25f;
float tune = sb->ballstiff;
@@ -2291,7 +2274,7 @@ static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Obje
if (do_springcollision || do_aero) scan_for_ext_spring_forces(depsgraph, scene, ob, timenow);
/* after spring scan because it uses Effoctors too */
- do_effector= pdInitEffectors(depsgraph, scene, ob, NULL, ob->soft->effector_weights, true);
+ ListBase *effectors = BKE_effectors_create(depsgraph, ob, NULL, ob->soft->effector_weights);
if (do_deflector) {
float defforce[3];
@@ -2394,13 +2377,13 @@ static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Obje
/* particle field & vortex */
- if (do_effector) {
+ if (effectors) {
EffectedPoint epoint;
float force[3] = {0.0f, 0.0f, 0.0f};
float speed[3] = {0.0f, 0.0f, 0.0f};
float eval_sb_fric_force_scale = sb_fric_force_scale(ob); /* just for calling function once */
pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint-bp, &epoint);
- pdDoEffectors(do_effector, NULL, sb->effector_weights, &epoint, force, speed);
+ BKE_effectors_apply(effectors, NULL, sb->effector_weights, &epoint, force, speed);
/* apply forcefield*/
mul_v3_fl(force, fieldfactor* eval_sb_fric_force_scale);
@@ -2492,7 +2475,7 @@ static void softbody_calc_forces(struct Depsgraph *depsgraph, Scene *scene, Obje
/* finally add forces caused by face collision */
if (ob->softflag & OB_SB_FACECOLL) scan_for_ext_face_forces(ob, timenow);
- pdEndEffectors(&do_effector);
+ BKE_effectors_free(effectors);
}
}
@@ -3495,9 +3478,7 @@ static void softbody_step(struct Depsgraph *depsgraph, Scene *scene, Object *ob,
ccd_update_deflector_hash(depsgraph, sb->collision_group, ob, sb->scratch->colliderhash);
if (sb->scratch->needstobuildcollider) {
- if (query_external_colliders(depsgraph, sb->collision_group)) {
- ccd_build_deflector_hash(depsgraph, sb->collision_group, ob, sb->scratch->colliderhash);
- }
+ ccd_build_deflector_hash(depsgraph, sb->collision_group, ob, sb->scratch->colliderhash);
sb->scratch->needstobuildcollider=0;
}
@@ -3737,4 +3718,3 @@ void sbObjectStep(struct Depsgraph *depsgraph, Scene *scene, Object *ob, float c
sb->last_frame = framenr;
}
-
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index 62361917f2f..468a961627e 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -39,6 +39,7 @@
#include "BLI_fileops_types.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
+#include "BLI_math_color.h"
#include "BLI_path_util.h"
#include "BLI_rand.h"
#include "BLI_string.h"
@@ -56,14 +57,31 @@
/* Statics */
static ListBase studiolights;
+static int last_studiolight_id = 0;
#define STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE 128
#define STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT 32
#define STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH (STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT * 2)
+#define STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE 0
+#define STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS 1
/*
- Disable this option so caches are not loaded from disk
- Do not checkin with this commented out
-*/
+ * The method to calculate the irradiance buffers
+ * The irradiance buffer is only shown in the background when in LookDev.
+ *
+ * STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE is very slow, but very accurate
+ * STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS is faster but has artifacts
+ */
+// #define STUDIOLIGHT_IRRADIANCE_METHOD STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
+#define STUDIOLIGHT_IRRADIANCE_METHOD STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS
+
+#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL == 2
+# define STUDIOLIGHT_SPHERICAL_HARMONICS_WINDOWING
+#endif
+
+/*
+ * Disable this option so caches are not loaded from disk
+ * Do not checkin with this commented out
+ */
#define STUDIOLIGHT_LOAD_CACHED_FILES
static const char *STUDIOLIGHT_CAMERA_FOLDER = "studiolights/camera/";
@@ -124,7 +142,7 @@ static struct StudioLight *studiolight_create(int flag)
sl->path_sh_cache = NULL;
sl->free_function = NULL;
sl->flag = flag;
- sl->index = BLI_listbase_count(&studiolights);
+ sl->index = ++last_studiolight_id;
if (flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL) {
sl->icon_id_matcap = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_MATCAP);
sl->icon_id_matcap_flipped = BKE_icon_ensure_studio_light(sl, STUDIOLIGHT_ICON_ID_TYPE_MATCAP_FLIPPED);
@@ -193,10 +211,13 @@ static void studiolight_load_equirectangular_image(StudioLight *sl)
if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
ImBuf *ibuf = NULL;
ibuf = IMB_loadiffname(sl->path, 0, NULL);
- if (ibuf) {
- IMB_float_from_rect(ibuf);
- sl->equirectangular_radiance_buffer = ibuf;
+ if (ibuf == NULL) {
+ float *colbuf = MEM_mallocN(sizeof(float[4]), __func__);
+ copy_v4_fl4(colbuf, 1.0f, 0.0f, 1.0f, 1.0f);
+ ibuf = IMB_allocFromBuffer(NULL, colbuf, 1, 1);
}
+ IMB_float_from_rect(ibuf);
+ sl->equirectangular_radiance_buffer = ibuf;
}
sl->flag |= STUDIOLIGHT_EXTERNAL_IMAGE_LOADED;
}
@@ -331,6 +352,9 @@ BLI_INLINE void studiolight_evaluate_radiance_buffer(
}
+/*
+ * Spherical Harmonics
+ */
BLI_INLINE float studiolight_area_element(float x, float y)
{
return atan2(x * y, sqrtf(x * x + y * y + 1));
@@ -405,52 +429,112 @@ static void studiolight_calculate_spherical_harmonics_coefficient(StudioLight *s
float cubevec[3];
studiolight_calculate_cubemap_vector_weight(cubevec, &weight, face, xf, yf);
+ const float nx = cubevec[0];
+ const float ny = cubevec[1];
+ const float nz = cubevec[2];
+ const float nx2 = SQUARE(nx);
+ const float ny2 = SQUARE(ny);
+ const float nz2 = SQUARE(nz);
+ const float nx4 = SQUARE(nx2);
+ const float ny4 = SQUARE(ny2);
+ const float nz4 = SQUARE(nz2);
+
switch (sh_component) {
+ /* L0 */
case 0:
{
coef = 0.2822095f;
break;
}
+ /* L1 */
case 1:
{
- coef = -0.488603f * cubevec[2] * 2.0f / 3.0f;
+ coef = -0.488603f * nz * 2.0f / 3.0f;
break;
}
case 2:
{
- coef = 0.488603f * cubevec[1] * 2.0f / 3.0f;
+ coef = 0.488603f * ny * 2.0f / 3.0f;
break;
}
case 3:
{
- coef = -0.488603f * cubevec[0] * 2.0f / 3.0f;
+ coef = -0.488603f * nx * 2.0f / 3.0f;
break;
}
+ /* L2 */
case 4:
{
- coef = 1.092548f * cubevec[0] * cubevec[2] * 1.0f / 4.0f;
+ coef = 1.092548f * nx * nz * 1.0f / 4.0f;
break;
}
case 5:
{
- coef = -1.092548f * cubevec[2] * cubevec[1] * 1.0f / 4.0f;
+ coef = -1.092548f * nz * ny * 1.0f / 4.0f;
break;
}
case 6:
{
- coef = 0.315392f * (3.0f * cubevec[2] * cubevec[2] - 1.0f) * 1.0f / 4.0f;
+ coef = 0.315392f * (3.0f * ny2 - 1.0f) * 1.0f / 4.0f;
break;
}
case 7:
{
- coef = 1.092548f * cubevec[0] * cubevec[1] * 1.0f / 4.0f;
+ coef = 1.092548f * nx * ny * 1.0f / 4.0f;
break;
}
case 8:
{
- coef = 0.546274f * (cubevec[0] * cubevec[0] - cubevec[2] * cubevec[2]) * 1.0f / 4.0f;
+ coef = 0.546274f * (nx2 - nz2) * 1.0f / 4.0f;
+ break;
+ }
+
+ /* L4 */
+ case 9:
+ {
+ coef = (2.5033429417967046f * nx * nz * (nx2 - nz2)) / -24.0f;
+ break;
+ }
+ case 10:
+ {
+ coef = (-1.7701307697799304f * nz * ny * (3.0f * nx2 - nz2)) / -24.0f;
+ break;
+ }
+ case 11:
+ {
+ coef = (0.9461746957575601f * nz * nx * (-1.0f +7.0f*ny2)) / -24.0f;
+ break;
+ }
+ case 12:
+ {
+ coef = (-0.6690465435572892f * nz * ny * (-3.0f + 7.0f * ny2)) / -24.0f;
+ break;
+ }
+ case 13:
+ {
+ coef = ((105.0f*ny4-90.0f*ny2+9.0f)/28.359261614f) / -24.0f;
+ break;
+ }
+ case 14:
+ {
+ coef = (-0.6690465435572892f * nx * ny * (-3.0f + 7.0f * ny2)) / -24.0f;
+ break;
+ }
+ case 15:
+ {
+ coef = (0.9461746957575601f * (nx2 - nz2) * (-1.0f + 7.0f * ny2)) / -24.0f;
+ break;
+ }
+ case 16:
+ {
+ coef = (-1.7701307697799304f * nx * ny * (nx2 - 3.0f * nz2)) / -24.0f;
+ break;
+ }
+ case 17:
+ {
+ coef = (0.6258357354491761f * (nx4 - 6.0f * nz2 * nx2 + nz4)) / -24.0f;
break;
}
@@ -471,6 +555,127 @@ static void studiolight_calculate_spherical_harmonics_coefficient(StudioLight *s
copy_v3_v3(sl->spherical_harmonics_coefs[sh_component], sh);
}
+#ifdef STUDIOLIGHT_SPHERICAL_HARMONICS_WINDOWING
+static void studiolight_calculate_spherical_harmonics_luminance(StudioLight *sl, float luminance[STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS])
+{
+ for (int index = 0; index < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; index++) {
+ luminance[index] = rgb_to_grayscale(sl->spherical_harmonics_coefs[index]);
+ }
+}
+
+static void studiolight_apply_spherical_harmonics_windowing(StudioLight *sl, float max_lamplacian)
+{
+ /* From Peter-Pike Sloan's Stupid SH Tricks http://www.ppsloan.org/publications/StupidSH36.pdf */
+ float table_l[STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL + 1];
+ float table_b[STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL + 1];
+
+ table_l[0] = 0.0f;
+ table_b[0] = 0.0f;
+
+ /* convert to luminance */
+ float luminance[STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS];
+ studiolight_calculate_spherical_harmonics_luminance(sl, luminance);
+
+ int index = 1;
+ for (int level = 1; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level++) {
+ table_l[level] = (float)(SQUARE(level) * SQUARE(level + 1));
+
+ float b = 0.0f;
+ for (int m = -1; m <= level; m++) {
+ b += SQUARE(luminance[index++]);
+ }
+ table_b[level] = b;
+ }
+
+ float squared_lamplacian = 0.0f;
+ for (int level = 1; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level++) {
+ squared_lamplacian += table_l[level] * table_b[level];
+ }
+
+ const float target_squared_laplacian = max_lamplacian * max_lamplacian;
+ if (squared_lamplacian <= target_squared_laplacian) {
+ return;
+ }
+
+ float lambda = 0.0f;
+
+ const int no_iterations = 10000000;
+ for (int i = 0; i < no_iterations; ++i) {
+ float f = 0.0f;
+ float fd = 0.0f;
+
+ for (int level = 1; level <= (int)STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; ++level) {
+ f += table_l[level] * table_b[level] / SQUARE(1.0f + lambda * table_l[level]);
+ fd += (2.0f * SQUARE(table_l[level]) * table_b[level]) / CUBE(1.0f + lambda * table_l[level]);
+ }
+
+ f = target_squared_laplacian - f;
+
+ float delta = -f / fd;
+ lambda += delta;
+
+ if (ABS(delta) < 1e-6f) {
+ break;
+ }
+ }
+
+ /* Apply windowing lambda */
+ index = 0;
+ for (int level = 0; level <= STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL; level ++) {
+ float s = 1.0f / (1.0f + lambda * SQUARE(level) * SQUARE(level + 1.0f));
+
+ for (int m = -1; m <= level; m++) {
+ mul_v3_fl(sl->spherical_harmonics_coefs[index++], s);
+ }
+ }
+}
+#endif
+
+BLI_INLINE void studiolight_sample_spherical_harmonics(StudioLight *sl, float color[3], float normal[3])
+{
+ const float nx = normal[0];
+ const float ny = normal[1];
+ const float nz = normal[2];
+
+ copy_v3_fl(color, 0.0f);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[0], 0.282095f);
+
+#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 0
+ /* Spherical Harmonics L1 */
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[1], -0.488603f * nz);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[2], 0.488603f * ny);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[3], -0.488603f * nx);
+#endif
+
+#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 1
+ /* Spherical Harmonics L2 */
+ const float nx2 = SQUARE(nx);
+ const float ny2 = SQUARE(ny);
+ const float nz2 = SQUARE(nz);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[4], 1.092548f * nx * nz);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[5], -1.092548f * nz * ny);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[6], 0.315392f * (3.0f * ny2 - 1.0f));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[7], -1.092548 * nx * ny);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[8], 0.546274 * (nx2 - nz2));
+#endif
+
+#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 3
+ /* Spherical Harmonics L4 */
+ const float nx4 = SQUARE(nx2);
+ const float ny4 = SQUARE(ny2);
+ const float nz4 = SQUARE(nz2);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[9], 2.5033429417967046f * nx * nz * (nx2 - nz2));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[10], -1.7701307697799304f * nz * ny * (3.0f * nx2 - nz2));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[11], 0.9461746957575601f * nz * nx * (-1.0f + 7.0f*ny2));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[12], -0.6690465435572892f * nz * ny * (-3.0f + 7.0f * ny2));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[13], (105.0f*ny4-90.0f*ny2+9.0f)/28.359261614f);
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[14], -0.6690465435572892f * nx * ny * (-3.0f + 7.0f * ny2));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[15], 0.9461746957575601f * (nx2 - nz2) * (-1.0f + 7.0f * ny2));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[16], -1.7701307697799304f * nx * ny * (nx2 - 3.0f * nz2));
+ madd_v3_v3fl(color, sl->spherical_harmonics_coefs[17], 0.6258357354491761f * (nx4 - 6.0f * nz2 * nx2 + nz4));
+#endif
+
+}
static void studiolight_calculate_diffuse_light(StudioLight *sl)
{
@@ -481,6 +686,11 @@ static void studiolight_calculate_diffuse_light(StudioLight *sl)
for (int comp = 0; comp < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; comp ++) {
studiolight_calculate_spherical_harmonics_coefficient(sl, comp);
}
+
+#ifdef STUDIOLIGHT_SPHERICAL_HARMONICS_WINDOWING
+ studiolight_apply_spherical_harmonics_windowing(sl, STUDIOLIGHT_SPHERICAL_HARMONICS_WINDOWING_TARGET_LAMPLACIAN);
+#endif
+
if (sl->flag & STUDIOLIGHT_USER_DEFINED) {
FILE *fp = BLI_fopen(sl->path_sh_cache, "wb");
if (fp) {
@@ -492,11 +702,6 @@ static void studiolight_calculate_diffuse_light(StudioLight *sl)
sl->flag |= STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED;
}
-static float area_element(float x, float y )
-{
- return atan2f(x * y, sqrt(x * x + y * y + 1));
-}
-
static float texel_coord_solid_angle(float a_U, float a_V, int a_Size)
{
//scale up to [-1, 1] range (inclusive), offset by 0.5 to point to texel center.
@@ -511,7 +716,7 @@ static float texel_coord_solid_angle(float a_U, float a_V, int a_Size)
float y0 = v - resolution_inv;
float x1 = u + resolution_inv;
float y1 = v + resolution_inv;
- return area_element(x0, y0) - area_element(x0, y1) - area_element(x1, y0) + area_element(x1, y1);
+ return studiolight_area_element(x0, y0) - studiolight_area_element(x0, y1) - studiolight_area_element(x1, y0) + studiolight_area_element(x1, y1);
}
BLI_INLINE void studiolight_evaluate_specular_radiance_buffer(
@@ -541,6 +746,7 @@ BLI_INLINE void studiolight_evaluate_specular_radiance_buffer(
}
+#if STUDIOLIGHT_IRRADIANCE_METHOD == STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
static void studiolight_calculate_specular_irradiance(StudioLight *sl, float color[3], const float normal[3])
{
copy_v3_fl(color, 0.0f);
@@ -568,6 +774,7 @@ static void studiolight_calculate_specular_irradiance(StudioLight *sl, float col
mul_v3_fl(color, 1.0 / M_PI);
}
+#endif
static bool studiolight_load_irradiance_equirectangular_image(StudioLight *sl)
{
@@ -592,8 +799,7 @@ static bool studiolight_load_spherical_harmonics_coefficients(StudioLight *sl)
if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
FILE *fp = BLI_fopen(sl->path_sh_cache, "rb");
if (fp) {
- if (fread((void*)(sl->spherical_harmonics_coefs), sizeof(sl->spherical_harmonics_coefs), 1, fp))
- {
+ if (fread((void *)(sl->spherical_harmonics_coefs), sizeof(sl->spherical_harmonics_coefs), 1, fp)) {
sl->flag |= STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED;
fclose(fp);
return true;
@@ -608,9 +814,12 @@ static bool studiolight_load_spherical_harmonics_coefficients(StudioLight *sl)
static void studiolight_calculate_irradiance_equirectangular_image(StudioLight *sl)
{
if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) {
- /* check for cached irr file */
-
+#if STUDIOLIGHT_IRRADIANCE_METHOD == STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED);
+#endif
+#if STUDIOLIGHT_IRRADIANCE_METHOD == STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS
+ BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED);
+#endif
float *colbuf = MEM_mallocN(STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH * STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT * sizeof(float[4]), __func__);
float *color = colbuf;
@@ -621,20 +830,33 @@ static void studiolight_calculate_irradiance_equirectangular_image(StudioLight *
float xf = x / (float)STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH;
float dir[3];
equirectangular_to_direction(dir, xf, yf);
+
+#if STUDIOLIGHT_IRRADIANCE_METHOD == STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
studiolight_calculate_specular_irradiance(sl, color, dir);
+#endif
+#if STUDIOLIGHT_IRRADIANCE_METHOD == STUDIOLIGHT_IRRADIANCE_METHOD_SPHERICAL_HARMONICS
+ studiolight_sample_spherical_harmonics(sl, color, dir);
+#endif
+
color[3] = 1.0f;
color += 4;
}
}
+
sl->equirectangular_irradiance_buffer = IMB_allocFromBuffer(
NULL, colbuf,
STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH,
STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT);
MEM_freeN(colbuf);
+#if STUDIOLIGHT_IRRADIANCE_METHOD == STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
+ /*
+ * Only store cached files when using STUDIOLIGHT_IRRADIANCE_METHOD_RADIANCE
+ */
if (sl->flag & STUDIOLIGHT_USER_DEFINED) {
IMB_saveiff(sl->equirectangular_irradiance_buffer, sl->path_irr_cache, IB_rectfloat);
}
+#endif
}
sl->flag |= STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_IMAGE_CALCULATED;
}
@@ -673,9 +895,24 @@ static void studiolight_calculate_light_direction(StudioLight *sl)
sl->flag |= STUDIOLIGHT_LIGHT_DIRECTION_CALCULATED;
}
+static StudioLight *studiolight_add_file(const char *path, int flag)
+{
+ char filename[FILE_MAXFILE];
+ BLI_split_file_part(path, filename, FILE_MAXFILE);
+ if (BLI_path_extension_check_array(filename, imb_ext_image)) {
+ StudioLight *sl = studiolight_create(STUDIOLIGHT_EXTERNAL_FILE | flag);
+ BLI_strncpy(sl->name, filename, FILE_MAXFILE);
+ BLI_strncpy(sl->path, path, FILE_MAXFILE);
+ sl->path_irr_cache = BLI_string_joinN(path, ".irr");
+ sl->path_sh_cache = BLI_string_joinN(path, ".sh2");
+ BLI_addtail(&studiolights, sl);
+ return sl;
+ }
+ return NULL;
+}
+
static void studiolight_add_files_from_datafolder(const int folder_id, const char *subfolder, int flag)
{
- StudioLight *sl;
struct direntry *dir;
const char *folder = BKE_appdir_folder_id(folder_id, subfolder);
if (folder) {
@@ -683,16 +920,7 @@ static void studiolight_add_files_from_datafolder(const int folder_id, const cha
int i;
for (i = 0; i < totfile; i++) {
if ((dir[i].type & S_IFREG)) {
- const char *filename = dir[i].relname;
- const char *path = dir[i].path;
- if (BLI_path_extension_check_array(filename, imb_ext_image)) {
- sl = studiolight_create(STUDIOLIGHT_EXTERNAL_FILE | flag);
- BLI_strncpy(sl->name, filename, FILE_MAXFILE);
- BLI_strncpy(sl->path, path, FILE_MAXFILE);
- sl->path_irr_cache = BLI_string_joinN(path, ".irr");
- sl->path_sh_cache = BLI_string_joinN(path, ".sh2");
- BLI_addtail(&studiolights, sl);
- }
+ studiolight_add_file(dir[i].path, flag);
}
}
BLI_filelist_free(dir, totfile);
@@ -745,7 +973,7 @@ static uint alpha_circle_mask(float u, float v, float inner_edge, float outer_ed
#define STUDIOLIGHT_DIAMETER 0.95f
-static void studiolight_radiance_preview(uint* icon_buffer, StudioLight *sl)
+static void studiolight_radiance_preview(uint *icon_buffer, StudioLight *sl)
{
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERNAL_IMAGE_LOADED);
@@ -790,7 +1018,7 @@ static void studiolight_radiance_preview(uint* icon_buffer, StudioLight *sl)
}
}
-static void studiolight_matcap_preview(uint* icon_buffer, StudioLight *sl, bool flipped)
+static void studiolight_matcap_preview(uint *icon_buffer, StudioLight *sl, bool flipped)
{
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERNAL_IMAGE_LOADED);
@@ -821,7 +1049,7 @@ static void studiolight_matcap_preview(uint* icon_buffer, StudioLight *sl, bool
}
}
-static void studiolight_irradiance_preview(uint* icon_buffer, StudioLight *sl)
+static void studiolight_irradiance_preview(uint *icon_buffer, StudioLight *sl)
{
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED);
@@ -846,25 +1074,8 @@ static void studiolight_irradiance_preview(uint* icon_buffer, StudioLight *sl)
normal[2] = -sqrtf(1.0f - SQUARE(dist));
SWAP(float, normal[1], normal[2]);
- float color[3] = {0.0f, 0.0f, 0.0f};
- /* Spherical Harmonics L0 */
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[0], 0.282095f);
-
-#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 0
- /* Spherical Harmonics L1 */
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[1], -0.488603f * normal[2]);
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[2], 0.488603f * normal[1]);
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[3], -0.488603f * normal[0]);
-#endif
-
-#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 1
- /* Spherical Harmonics L1 */
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[4], 1.092548f * normal[0] * normal[2]);
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[5], -1.092548f * normal[2] * normal[1]);
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[6], 0.315392f * (3.0f * normal[1] * normal[1] - 1.0f));
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[7], -1.092548 * normal[0] * normal[1]);
- madd_v3_v3fl(color, sl->spherical_harmonics_coefs[8], 0.546274 * (normal[0] * normal[0] - normal[2] * normal[2]));
-#endif
+ float color[3];
+ studiolight_sample_spherical_harmonics(sl, color, normal);
pixelresult = rgb_to_cpack(
linearrgb_to_srgb(color[0]),
linearrgb_to_srgb(color[1]),
@@ -965,7 +1176,7 @@ struct ListBase *BKE_studiolight_listbase(void)
return &studiolights;
}
-void BKE_studiolight_preview(uint* icon_buffer, StudioLight *sl, int icon_id_type)
+void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type)
{
switch (icon_id_type) {
case STUDIOLIGHT_ICON_ID_TYPE_RADIANCE:
@@ -1026,6 +1237,23 @@ void BKE_studiolight_ensure_flag(StudioLight *sl, int flag)
}
}
+/*
+ * Python API Functions
+ */
+void BKE_studiolight_remove(StudioLight *sl)
+{
+ if (sl->flag & STUDIOLIGHT_USER_DEFINED) {
+ BLI_remlink(&studiolights, sl);
+ studiolight_free(sl);
+ }
+}
+
+StudioLight *BKE_studiolight_new(const char *path, int orientation)
+{
+ StudioLight *sl = studiolight_add_file(path, orientation | STUDIOLIGHT_USER_DEFINED);
+ return sl;
+}
+
void BKE_studiolight_refresh(void)
{
BKE_studiolight_free();
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index e4f08703dfc..9ea6ef62e4e 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -1827,7 +1827,7 @@ static void ccgDM_release(DerivedMesh *dm)
if (ccgdm->multires.mmd) {
if (ccgdm->multires.modified_flags & MULTIRES_COORDS_MODIFIED)
- multires_modifier_update_mdisps(dm);
+ multires_modifier_update_mdisps(dm, NULL);
if (ccgdm->multires.modified_flags & MULTIRES_HIDDEN_MODIFIED)
multires_modifier_update_hidden(dm);
}
@@ -2930,6 +2930,7 @@ static bool subsurf_use_gpu_backend(SubsurfFlags flags)
struct DerivedMesh *subsurf_make_derived_from_derived(
struct DerivedMesh *dm,
struct SubsurfModifierData *smd,
+ struct Scene *scene,
float (*vertCos)[3],
SubsurfFlags flags)
{
@@ -2943,7 +2944,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
/* note: editmode calculation can only run once per
* modifier stack evaluation (uses freed cache) [#36299] */
if (flags & SUBSURF_FOR_EDIT_MODE) {
- int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels, false) : smd->levels;
+ int levels = (scene != NULL) ? get_render_subsurf_level(&scene->r, smd->levels, false) : smd->levels;
/* TODO(sergey): Same as emCache below. */
if ((flags & SUBSURF_IN_EDIT_MODE) && smd->mCache) {
@@ -2964,7 +2965,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
else if (flags & SUBSURF_USE_RENDER_PARAMS) {
/* Do not use cache in render mode. */
CCGSubSurf *ss;
- int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->renderLevels, true) : smd->renderLevels;
+ int levels = (scene != NULL) ? get_render_subsurf_level(&scene->r, smd->renderLevels, true) : smd->renderLevels;
if (levels == 0)
return dm;
@@ -2980,7 +2981,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
}
else {
int useIncremental = (smd->flags & eSubsurfModifierFlag_Incremental);
- int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels, false) : smd->levels;
+ int levels = (scene != NULL) ? get_render_subsurf_level(&scene->r, smd->levels, false) : smd->levels;
CCGSubSurf *ss;
/* It is quite possible there is a much better place to do this. It
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 99fb6b14a35..f0f57e8e56c 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -173,6 +173,11 @@ void BKE_workspace_free(WorkSpace *workspace)
}
}
BLI_freelistN(&workspace->tools);
+
+ if (workspace->status_text) {
+ MEM_freeN(workspace->status_text);
+ workspace->status_text = NULL;
+ }
}
/**
@@ -235,6 +240,9 @@ WorkSpaceLayout *BKE_workspace_layout_add(
WorkSpaceLayout *layout = MEM_callocN(sizeof(*layout), __func__);
BLI_assert(!workspaces_is_screen_used(bmain, screen));
+#ifndef DEBUG
+ UNUSED_VARS(bmain);
+#endif
layout->screen = screen;
workspace_layout_name_set(workspace, layout, name);
BLI_addtail(&workspace->layouts, layout);
@@ -530,4 +538,3 @@ bool BKE_workspace_owner_id_check(
return BLI_findstring(&workspace->owner_ids, owner_id, offsetof(wmOwnerID, name)) != NULL;
}
}
-
diff --git a/source/blender/blenlib/BLI_boxpack_2d.h b/source/blender/blenlib/BLI_boxpack_2d.h
index 80e89bdb04f..d3f1109e18b 100644
--- a/source/blender/blenlib/BLI_boxpack_2d.h
+++ b/source/blender/blenlib/BLI_boxpack_2d.h
@@ -50,4 +50,3 @@ typedef struct BoxPack {
void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *tot_width, float *tot_height);
#endif /* __BLI_BOXPACK_2D_H__ */
-
diff --git a/source/blender/blenlib/BLI_dynlib.h b/source/blender/blenlib/BLI_dynlib.h
index 310db9ea051..747ce75dd72 100644
--- a/source/blender/blenlib/BLI_dynlib.h
+++ b/source/blender/blenlib/BLI_dynlib.h
@@ -40,4 +40,3 @@ char *BLI_dynlib_get_error_as_string(DynamicLibrary *lib);
void BLI_dynlib_close(DynamicLibrary *lib);
#endif /* __BLI_DYNLIB_H__ */
-
diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h
index 0ffa3276f1f..06ffc8e5e79 100644
--- a/source/blender/blenlib/BLI_fileops_types.h
+++ b/source/blender/blenlib/BLI_fileops_types.h
@@ -66,4 +66,3 @@ struct dirlink {
};
#endif /* __BLI_FILEOPS_TYPES_H__ */
-
diff --git a/source/blender/blenlib/BLI_jitter_2d.h b/source/blender/blenlib/BLI_jitter_2d.h
index e2b1f21800c..e79251fba9f 100644
--- a/source/blender/blenlib/BLI_jitter_2d.h
+++ b/source/blender/blenlib/BLI_jitter_2d.h
@@ -37,4 +37,3 @@ void BLI_jitterate1(float (*jit1)[2], float (*jit2)[2], int num, float radius1);
void BLI_jitterate2(float (*jit1)[2], float (*jit2)[2], int num, float radius2);
#endif /* __BLI_JITTER_2D_H__ */
-
diff --git a/source/blender/blenlib/BLI_linklist_stack.h b/source/blender/blenlib/BLI_linklist_stack.h
index fad0b4e7552..b4c6751db52 100644
--- a/source/blender/blenlib/BLI_linklist_stack.h
+++ b/source/blender/blenlib/BLI_linklist_stack.h
@@ -199,4 +199,3 @@
/** \} */
#endif /* __BLI_LINKLIST_STACK_H__ */
-
diff --git a/source/blender/blenlib/BLI_math_color_blend.h b/source/blender/blenlib/BLI_math_color_blend.h
index d966676e19e..6ca8cecadbb 100644
--- a/source/blender/blenlib/BLI_math_color_blend.h
+++ b/source/blender/blenlib/BLI_math_color_blend.h
@@ -106,4 +106,3 @@ MINLINE void blend_color_interpolate_float(float dst[4], const float src1[4], co
#endif
#endif /* __BLI_MATH_COLOR_BLEND_H__ */
-
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 630a508727c..640f3143009 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -545,4 +545,3 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3])
#endif
#endif /* __BLI_MATH_GEOM_H__ */
-
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index b38e26ecb2f..d4d498590b5 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -314,4 +314,3 @@ void print_m4(const char *str, const float M[4][4]);
#endif
#endif /* __BLI_MATH_MATRIX_H__ */
-
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index 1f206e5e234..5b1568ab902 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -235,4 +235,3 @@ bool mat3_from_axis_conversion_single(
#endif
#endif /* __BLI_MATH_ROTATION_H__ */
-
diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h
index b0193022837..3c1cb90937d 100644
--- a/source/blender/blenlib/BLI_math_solvers.h
+++ b/source/blender/blenlib/BLI_math_solvers.h
@@ -69,4 +69,3 @@ bool BLI_tridiagonal_solve_cyclic(const float *a, const float *b, const float *c
#endif
#endif /* __BLI_MATH_SOLVERS_H__ */
-
diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h
index 484cc30cc46..210d41bcf59 100644
--- a/source/blender/blenlib/BLI_math_statistics.h
+++ b/source/blender/blenlib/BLI_math_statistics.h
@@ -67,4 +67,3 @@ void BLI_covariance_m3_v3n(
#endif
#endif /* __BLI_MATH_STATISTICS_H__ */
-
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index 4fca3fbc3ad..f6b37fa2ec3 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -139,4 +139,3 @@ bool BLI_scanfill_calc_self_isect(
#endif
#endif
-
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h
index ad325493309..9194caca007 100644
--- a/source/blender/blenlib/BLI_task.h
+++ b/source/blender/blenlib/BLI_task.h
@@ -227,4 +227,3 @@ BLI_INLINE void BLI_parallel_range_settings_defaults(
#endif
#endif
-
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 87a1467e573..81f8445783b 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -209,4 +209,3 @@ void BLI_thread_queue_nowait(ThreadQueue *queue);
#endif
#endif
-
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 36281ee0fcc..286e1cc6dd5 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -274,11 +274,15 @@ extern "C" {
#define SQUARE(a) ({ \
typeof(a) a_ = (a); \
((a_) * (a_)); })
+#define CUBE(a) ({ \
+ typeof(a) a_ = (a); \
+ ((a_) * (a_) * (a_)); })
#else
#define ABS(a) ((a) < 0 ? (-(a)) : (a))
#define SQUARE(a) ((a) * (a))
+#define CUBE(a) ((a) * (a) * (a))
#endif
diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h
index 16fdfa8a468..1cc1ef17486 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenlib/BLI_vfontdata.h
@@ -58,4 +58,3 @@ VChar *BLI_vfontchar_from_freetypefont(struct VFont *vfont, unsigned long charac
VChar *BLI_vfontchar_copy(const VChar *vchar_src, const int flag);
#endif
-
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index 8cca19ea0bb..cf29a8652df 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -138,4 +138,3 @@ int BLI_getInstallationDir(char *str);
#endif
#endif /* __BLI_WINSTUFF_H__ */
-
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index 0c71e75e40f..5658c1fd103 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -418,4 +418,3 @@ bool BLI_heap_is_valid(const Heap *heap)
}
/** \} */
-
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c
index 36e849cda40..33ba18ec409 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -138,4 +138,3 @@ void BLI_dynlib_close(DynamicLibrary *lib)
}
#endif
-
diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c
index 60e898a3f19..36c1ef394a2 100644
--- a/source/blender/blenlib/intern/fnmatch.c
+++ b/source/blender/blenlib/intern/fnmatch.c
@@ -242,5 +242,3 @@ fnmatch (const char *pattern, const char *string, int flags)
/* intentionally empty for UNIX */
#endif /* WIN32 */
-
-
diff --git a/source/blender/blenlib/intern/hash_mm2a.c b/source/blender/blenlib/intern/hash_mm2a.c
index e8ca9244f25..6fd227232ed 100644
--- a/source/blender/blenlib/intern/hash_mm2a.c
+++ b/source/blender/blenlib/intern/hash_mm2a.c
@@ -144,4 +144,3 @@ uint32_t BLI_hash_mm2(const unsigned char *data, size_t len, uint32_t seed)
return h;
}
-
diff --git a/source/blender/blenlib/intern/math_solvers.c b/source/blender/blenlib/intern/math_solvers.c
index b8a22900ba1..e3174d8340a 100644
--- a/source/blender/blenlib/intern/math_solvers.c
+++ b/source/blender/blenlib/intern/math_solvers.c
@@ -179,4 +179,3 @@ bool BLI_tridiagonal_solve_cyclic(const float *a, const float *b, const float *c
return success;
}
-
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index d1af0551062..862ce391109 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -840,4 +840,3 @@ void BLI_threaded_malloc_end(void)
MEM_set_lock_callback(NULL, NULL);
}
}
-
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index 327812f78d5..1251424719a 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -163,6 +163,9 @@ struct BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
struct Main *BLO_main_from_memfile(struct MemFile *memfile, struct Main *bmain, struct Scene **r_scene);
+/* datafiles (generated theme) */
+extern const struct bTheme U_theme_default;
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenloader/BLO_runtime.h b/source/blender/blenloader/BLO_runtime.h
index 2c3947c9dda..09f25bdca53 100644
--- a/source/blender/blenloader/BLO_runtime.h
+++ b/source/blender/blenloader/BLO_runtime.h
@@ -51,4 +51,3 @@ bool BLO_main_validate_libraries(struct Main *bmain, struct ReportList *reports)
#endif
#endif /* __BLO_RUNTIME_H__ */
-
diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h
index c407ea31b9b..59df361c7c1 100644
--- a/source/blender/blenloader/BLO_undofile.h
+++ b/source/blender/blenloader/BLO_undofile.h
@@ -69,4 +69,3 @@ extern struct Main *BLO_memfile_main_get(struct MemFile *memfile, struct Main *b
extern bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename);
#endif /* __BLO_UNDOFILE_H__ */
-
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h
index af3bc2dbdcd..f6d0be6f5f0 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -45,4 +45,3 @@ extern bool BLO_write_file_mem(
struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags);
#endif
-
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index 2c6f6f3edfb..b340aa28324 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -47,6 +47,7 @@ set(INC_SYS
)
set(SRC
+ ${CMAKE_SOURCE_DIR}/release/datafiles/userdef/userdef_default_theme.c
intern/blend_validate.c
intern/readblenentry.c
intern/readfile.c
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 4ccdbd9e8e1..7488d62bb3c 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -474,4 +474,3 @@ void BLO_blendfiledata_free(BlendFileData *bfd)
MEM_freeN(bfd);
}
-
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 3de14260ed9..79a552a5b86 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2944,7 +2944,10 @@ static void direct_link_workspace(FileData *fd, WorkSpace *workspace, const Main
for (bToolRef *tref = workspace->tools.first; tref; tref = tref->next) {
tref->runtime = NULL;
tref->properties = newdataadr(fd, tref->properties);
+ IDP_DirectLinkGroup_OrFree(&tref->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
}
+
+ workspace->status_text = NULL;
}
static void lib_link_workspace_instance_hook(FileData *fd, WorkSpaceInstanceHook *hook, ID *id)
@@ -4243,40 +4246,8 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
}
if (part->dupliweights.first && part->dup_group) {
- ParticleDupliWeight *dw;
- int index_ok = 0;
- /* check for old files without indices (all indexes 0) */
- if (BLI_listbase_is_single(&part->dupliweights)) {
- /* special case for only one object in the group */
- index_ok = 1;
- }
- else {
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
- if (dw->index > 0) {
- index_ok = 1;
- break;
- }
- }
- }
-
- if (index_ok) {
- /* if we have indexes, let's use them */
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
- /* Do not try to restore pointer here, we have to search for group objects in another
- * separated step.
- * Reason is, the used group may be linked from another library, which has not yet
- * been 'lib_linked'.
- * Since dw->ob is not considered as an object user (it does not make objet directly linked),
- * we may have no valid way to retrieve it yet.
- * See T49273. */
- dw->ob = NULL;
- }
- }
- else {
- /* otherwise try to get objects from own library (won't work on library linked groups) */
- for (dw = part->dupliweights.first; dw; dw = dw->next) {
- dw->ob = newlibadr(fd, part->id.lib, dw->ob);
- }
+ for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
+ dw->ob = newlibadr(fd, part->id.lib, dw->ob);
}
}
else {
@@ -5031,7 +5002,6 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
for (md=lb->first; md; md=md->next) {
md->error = NULL;
- md->scene = NULL;
/* if modifiers disappear, or for upward compatibility */
if (NULL == modifierType_getInfo(md->type))
@@ -5474,12 +5444,8 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->rigidbody_object = newdataadr(fd, ob->rigidbody_object);
if (ob->rigidbody_object) {
RigidBodyOb *rbo = ob->rigidbody_object;
-
- /* must nullify the references to physics sim objects, since they no-longer exist
- * (and will need to be recalculated)
- */
- rbo->physics_object = NULL;
- rbo->physics_shape = NULL;
+ /* Allocate runtime-only struct */
+ rbo->shared = MEM_callocN(sizeof(*rbo->shared), "RigidBodyObShared");
}
ob->rigidbody_constraint = newdataadr(fd, ob->rigidbody_constraint);
if (ob->rigidbody_constraint)
@@ -5573,8 +5539,6 @@ static void direct_link_layer_collections(FileData *fd, ListBase *lb, bool maste
lc->collection = newdataadr(fd, lc->collection);
}
- lc->runtime_flag = 0;
-
direct_link_layer_collections(fd, &lc->layer_collections, false);
}
}
@@ -5597,7 +5561,6 @@ static void direct_link_view_layer(FileData *fd, ViewLayer *view_layer)
BLI_listbase_clear(&view_layer->drawdata);
view_layer->object_bases_array = NULL;
view_layer->object_bases_hash = NULL;
- view_layer->runtime_flag = 0;
}
static void lib_link_layer_collection(FileData *fd, Library *lib, LayerCollection *layer_collection, bool master)
@@ -6281,10 +6244,34 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->rigidbody_world = newdataadr(fd, sce->rigidbody_world);
rbw = sce->rigidbody_world;
if (rbw) {
- /* must nullify the reference to physics sim object, since it no-longer exist
- * (and will need to be recalculated)
- */
- rbw->physics_world = NULL;
+ rbw->shared = newdataadr(fd, rbw->shared);
+
+ if (rbw->shared == NULL) {
+ /* Link deprecated caches if they exist, so we can use them for versioning.
+ * We should only do this when rbw->shared == NULL, because those pointers
+ * are always set (for compatibility with older Blenders). We mustn't link
+ * the same pointcache twice. */
+ direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, false);
+
+ /* make sure simulation starts from the beginning after loading file */
+ if (rbw->pointcache) {
+ rbw->ltime = (float)rbw->pointcache->startframe;
+ }
+ }
+ else {
+ /* must nullify the reference to physics sim object, since it no-longer exist
+ * (and will need to be recalculated)
+ */
+ rbw->shared->physics_world = NULL;
+
+ /* link caches */
+ direct_link_pointcache_list(fd, &rbw->shared->ptcaches, &rbw->shared->pointcache, false);
+
+ /* make sure simulation starts from the beginning after loading file */
+ if (rbw->shared->pointcache) {
+ rbw->ltime = (float)rbw->shared->pointcache->startframe;
+ }
+ }
rbw->objects = NULL;
rbw->numbodies = 0;
@@ -6292,13 +6279,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
rbw->effector_weights = newdataadr(fd, rbw->effector_weights);
if (!rbw->effector_weights)
rbw->effector_weights = BKE_add_effector_weights(NULL);
-
- /* link cache */
- direct_link_pointcache_list(fd, &rbw->ptcaches, &rbw->pointcache, false);
- /* make sure simulation starts from the beginning after loading file */
- if (rbw->pointcache) {
- rbw->ltime = (float)rbw->pointcache->startframe;
- }
}
sce->preview = direct_link_preview_image(fd, sce->preview);
@@ -6946,6 +6926,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
win->ghostwin = NULL;
win->gwnctx = NULL;
win->eventstate = NULL;
+ win->cursor_keymap_status = NULL;
win->tweak = NULL;
#ifdef WIN32
win->ime_data = NULL;
@@ -8679,6 +8660,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
link_list(fd, &user->themes);
link_list(fd, &user->user_keymaps);
+ link_list(fd, &user->user_menus);
link_list(fd, &user->addons);
link_list(fd, &user->autoexec_paths);
@@ -8704,6 +8686,17 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
direct_link_keymapitem(fd, kmi);
}
+ for (bUserMenu *um = user->user_menus.first; um; um = um->next) {
+ link_list(fd, &um->items);
+ for (bUserMenuItem *umi = um->items.first; umi; umi = umi->next) {
+ if (umi->type == USER_MENU_TYPE_OPERATOR) {
+ bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi;
+ umi_op->prop = newdataadr(fd, umi_op->prop);
+ IDP_DirectLinkGroup_OrFree(&umi_op->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+ }
+ }
+ }
+
for (addon = user->addons.first; addon; addon = addon->next) {
addon->prop = newdataadr(fd, addon->prop);
IDP_DirectLinkGroup_OrFree(&addon->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
@@ -9279,6 +9272,10 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
}
}
}
+
+ for (ParticleDupliWeight *dw = part->dupliweights.first; dw; dw = dw->next) {
+ expand_doit(fd, mainvar, dw->ob);
+ }
}
static void expand_collection(FileData *fd, Main *mainvar, Collection *collection)
@@ -10028,7 +10025,7 @@ static void add_loose_objects_to_scene(
if (flag & FILE_AUTOSELECT) {
/* Note that link_object_postprocess() already checks for FILE_AUTOSELECT flag,
* but it will miss objects from non-instantiated collections... */
- if (base->flag & BASE_SELECTABLED) {
+ if (base->flag & BASE_SELECTABLE) {
base->flag |= BASE_SELECTED;
BKE_scene_object_base_flag_sync_from_base(base);
}
@@ -10061,7 +10058,7 @@ static void add_collections_to_scene(
BKE_collection_object_add(bmain, active_collection, ob);
Base *base = BKE_view_layer_base_find(view_layer, ob);
- if (base->flag & BASE_SELECTABLED) {
+ if (base->flag & BASE_SELECTABLE) {
base->flag |= BASE_SELECTED;
}
@@ -10172,7 +10169,7 @@ static void link_object_postprocess(ID *id, Main *bmain, Scene *scene, ViewLayer
BKE_scene_object_base_flag_sync_from_base(base);
if (flag & FILE_AUTOSELECT) {
- if (base->flag & BASE_SELECTABLED) {
+ if (base->flag & BASE_SELECTABLE) {
base->flag |= BASE_SELECTED;
BKE_scene_object_base_flag_sync_from_base(base);
}
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index 65938c88192..9c699db5583 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -179,4 +179,3 @@ void do_versions_after_linking_270(struct Main *bmain);
void do_versions_after_linking_280(struct Main *bmain);
#endif
-
diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c
index ec0e8ba4738..985e8169819 100644
--- a/source/blender/blenloader/intern/runtime.c
+++ b/source/blender/blenloader/intern/runtime.c
@@ -139,4 +139,3 @@ cleanup:
return bfd;
}
-
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 190b9d86d59..3fa059989a3 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -49,6 +49,7 @@
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_particle_types.h"
+#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
@@ -65,6 +66,7 @@
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_node.h"
+#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
@@ -144,6 +146,7 @@ static void do_version_area_change_space_to_space_action(ScrArea *area, const Sc
saction->mode = SACTCONT_TIMELINE;
saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
+ saction->ads.filterflag |= ADS_FILTER_SUMMARY;
}
/**
@@ -501,7 +504,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
}
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if ((base->flag & BASE_SELECTABLED) && (base->object->flag & SELECT)) {
+ if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) {
base->flag |= BASE_SELECTED;
}
}
@@ -530,7 +533,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
/* convert selected bases */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if ((base->flag & BASE_SELECTABLED) && (base->object->flag & SELECT)) {
+ if ((base->flag & BASE_SELECTABLE) && (base->object->flag & SELECT)) {
base->flag |= BASE_SELECTED;
}
@@ -1474,5 +1477,87 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+ if (!DNA_struct_elem_find(fd->filesdna, "SpaceAction", "char", "mode_prev")) {
+ for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_ACTION) {
+ SpaceAction *saction = (SpaceAction *)sl;
+ /* "Dopesheet" should be default here, unless it looks like the Action Editor was active instead */
+ if ((saction->mode_prev == 0) && (saction->action == NULL)) {
+ saction->mode_prev = SACTCONT_DOPESHEET;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ if (v3d->drawtype == OB_TEXTURE) {
+ v3d->drawtype = OB_SOLID;
+ v3d->shading.light = V3D_LIGHTING_STUDIO;
+ v3d->shading.color_type = V3D_SHADING_TEXTURE_COLOR;
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ {
+ if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "texture_paint_mode_opacity")) {
+ for (bScreen *screen = bmain->screen.first; screen; screen = screen->id.next) {
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ float alpha = v3d->flag2 & V3D_SHOW_MODE_SHADE_OVERRIDE ? 0.0f : 0.8f;
+ v3d->overlay.texture_paint_mode_opacity = alpha;
+ v3d->overlay.vertex_paint_mode_opacity = alpha;
+ v3d->overlay.weight_paint_mode_opacity = alpha;
+ }
+ }
+ }
+ }
+ }
+
+ for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ if (scene->toolsettings->manipulator_flag == 0) {
+ scene->toolsettings->manipulator_flag = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE;
+ }
+ }
+
+ if (!DNA_struct_elem_find(fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared")) {
+ for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) {
+ RigidBodyWorld *rbw = scene->rigidbody_world;
+
+ if (rbw == NULL) {
+ continue;
+ }
+
+ if (rbw->shared == NULL) {
+ rbw->shared = MEM_callocN(sizeof(*rbw->shared), "RigidBodyWorld_Shared");
+ }
+
+ /* Move shared pointers from deprecated location to current location */
+ rbw->shared->pointcache = rbw->pointcache;
+ rbw->shared->ptcaches = rbw->ptcaches;
+
+ rbw->pointcache = NULL;
+ BLI_listbase_clear(&rbw->ptcaches);
+
+ if (rbw->shared->pointcache == NULL) {
+ rbw->shared->pointcache = BKE_ptcache_add(&(rbw->shared->ptcaches));
+ }
+
+ }
+ }
+
}
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 210dc07d7f2..860d1432370 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -94,6 +94,13 @@ void BLO_update_defaults_userpref_blend(void)
#else
U.flag &= ~USER_SCRIPT_AUTOEXEC_DISABLE;
#endif
+
+ /* Ignore the theme saved in the blend file,
+ * instead use the theme from 'userdef_default_theme.c' */
+ {
+ bTheme *theme = U.themes.first;
+ memcpy(theme, &U_theme_default, sizeof(bTheme));
+ }
}
/**
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 9c55c949fcf..e7bca4c7e5b 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1244,6 +1244,30 @@ static void write_userdef(WriteData *wd, const UserDef *userdef)
}
}
+ for (const bUserMenu *um = userdef->user_menus.first; um; um = um->next) {
+ writestruct(wd, DATA, bUserMenu, 1, um);
+ for (const bUserMenuItem *umi = um->items.first; umi; umi = umi->next) {
+ if (umi->type == USER_MENU_TYPE_OPERATOR) {
+ const bUserMenuItem_Op *umi_op = (const bUserMenuItem_Op *)umi;
+ writestruct(wd, DATA, bUserMenuItem_Op, 1, umi_op);
+ if (umi_op->prop) {
+ IDP_WriteProperty(umi_op->prop, wd);
+ }
+ }
+ else if (umi->type == USER_MENU_TYPE_MENU) {
+ const bUserMenuItem_Menu *umi_mt = (const bUserMenuItem_Menu *)umi;
+ writestruct(wd, DATA, bUserMenuItem_Menu, 1, umi_mt);
+ }
+ else if (umi->type == USER_MENU_TYPE_PROP) {
+ const bUserMenuItem_Prop *umi_pr = (const bUserMenuItem_Prop *)umi;
+ writestruct(wd, DATA, bUserMenuItem_Prop, 1, umi_pr);
+ }
+ else {
+ writestruct(wd, DATA, bUserMenuItem, 1, umi);
+ }
+ }
+ }
+
for (const bAddon *bext = userdef->addons.first; bext; bext = bext->next) {
writestruct(wd, DATA, bAddon, 1, bext);
if (bext->prop) {
@@ -2630,9 +2654,14 @@ static void write_scene(WriteData *wd, Scene *sce)
/* writing RigidBodyWorld data to the blend file */
if (sce->rigidbody_world) {
+ /* Set deprecated pointers to prevent crashes of older Blenders */
+ sce->rigidbody_world->pointcache = sce->rigidbody_world->shared->pointcache;
+ sce->rigidbody_world->ptcaches = sce->rigidbody_world->shared->ptcaches;
writestruct(wd, DATA, RigidBodyWorld, 1, sce->rigidbody_world);
+
+ writestruct(wd, DATA, RigidBodyWorld_Shared, 1, sce->rigidbody_world->shared);
writestruct(wd, DATA, EffectorWeights, 1, sce->rigidbody_world->effector_weights);
- write_pointcaches(wd, &(sce->rigidbody_world->ptcaches));
+ write_pointcaches(wd, &(sce->rigidbody_world->shared->ptcaches));
}
write_previews(wd, sce->preview);
@@ -3819,7 +3848,7 @@ static bool write_file_handle(
const bool do_override = !ELEM(override_storage, NULL, bmain) && id->override_static;
if (do_override) {
- BKE_override_static_operations_store_start(override_storage, id);
+ BKE_override_static_operations_store_start(bmain, override_storage, id);
}
switch ((ID_Type)GS(id->name)) {
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
index 320bebc9958..bd3eb4cc1ac 100644
--- a/source/blender/bmesh/CMakeLists.txt
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -119,9 +119,9 @@ set(SRC
intern/bmesh_polygon_edgenet.c
intern/bmesh_polygon_edgenet.h
intern/bmesh_private.h
- intern/bmesh_queries.c
- intern/bmesh_queries.h
- intern/bmesh_queries_inline.h
+ intern/bmesh_query.c
+ intern/bmesh_query.h
+ intern/bmesh_query_inline.h
intern/bmesh_structure.c
intern/bmesh_structure.h
intern/bmesh_structure_inline.h
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h
index b84a3d5e559..138b8b7c51f 100644
--- a/source/blender/bmesh/bmesh.h
+++ b/source/blender/bmesh/bmesh.h
@@ -84,7 +84,7 @@
* Edges and Vertices in BMesh are primitive structures.
*
* \note There can be more than one edge between two vertices in BMesh,
- * though the rest of Blender (e.g. DerivedMesh, CDDM, CCGSubSurf, etc) does not support this.
+ * though the rest of Blender (i.e. DNA and evaluated Mesh) does not support this.
* So it should only occur temporarily during editing operations.
*
*
@@ -98,7 +98,7 @@
*
* These are accessible through the iterator api, which is covered later in this document
*
- * See source/blender/bmesh/bmesh_queries.h for more misc. queries.
+ * See source/blender/bmesh/bmesh_query.h for more misc. queries.
*
*
* \section bm_api The BMesh API
@@ -246,7 +246,7 @@ extern "C" {
#include "intern/bmesh_operators.h"
#include "intern/bmesh_polygon.h"
#include "intern/bmesh_polygon_edgenet.h"
-#include "intern/bmesh_queries.h"
+#include "intern/bmesh_query.h"
#include "intern/bmesh_walkers.h"
#include "intern/bmesh_inline.h"
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 97f1bad08b7..bb5199fa0c8 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -36,7 +36,8 @@
#include "BLT_translation.h"
-#include "BKE_DerivedMesh.h"
+#include "DNA_meshdata_types.h"
+
#include "BKE_mesh.h"
#include "bmesh.h"
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 43029e370c6..89077d84447 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -144,22 +144,4 @@ extern const BMAllocTemplate bm_mesh_chunksize_default;
}
#define BMALLOC_TEMPLATE_FROM_ME(...) VA_NARGS_CALL_OVERLOAD(_VA_BMALLOC_TEMPLATE_FROM_ME_, __VA_ARGS__)
-#define _VA_BMALLOC_TEMPLATE_FROM_DM_1(dm) { \
- (CHECK_TYPE_INLINE(dm, DerivedMesh *), \
- (dm)->getNumVerts(dm)), \
- (dm)->getNumEdges(dm), \
- (dm)->getNumLoops(dm), \
- (dm)->getNumPolys(dm), \
-}
-#define _VA_BMALLOC_TEMPLATE_FROM_DM_2(dm_a, dm_b) { \
- (CHECK_TYPE_INLINE(dm_a, DerivedMesh *), \
- CHECK_TYPE_INLINE(dm_b, DerivedMesh *), \
- (dm_a)->getNumVerts(dm_a)) + (dm_b)->getNumVerts(dm_b), \
- (dm_a)->getNumEdges(dm_a) + (dm_b)->getNumEdges(dm_b), \
- (dm_a)->getNumLoops(dm_a) + (dm_b)->getNumLoops(dm_b), \
- (dm_a)->getNumPolys(dm_a) + (dm_b)->getNumPolys(dm_b), \
-}
-
-#define BMALLOC_TEMPLATE_FROM_DM(...) VA_NARGS_CALL_OVERLOAD(_VA_BMALLOC_TEMPLATE_FROM_DM_, __VA_ARGS__)
-
#endif /* __BMESH_MESH_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 00bb0110e74..7e1e1c53a8f 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -550,7 +550,7 @@ BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
/**
*
- * \param bmain May be NULL in case \a calc_object_remap parameter option is set.
+ * \param bmain May be NULL in case \a calc_object_remap parameter option is not set.
*/
void BM_mesh_bm_to_me(
Main *bmain, BMesh *bm, Mesh *me,
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index a10f2e2bb3f..dfa3486227f 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -1104,4 +1104,3 @@ BMVert *BM_face_loop_separate_multi(BMesh *bm, BMLoop **larr, int larr_len)
{
return bmesh_kernel_unglue_region_make_vert_multi(bm, larr, larr_len);
}
-
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_query.c
index 5ce4b236d03..33ad7836893 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -20,7 +20,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_queries.c
+/** \file blender/bmesh/intern/bmesh_query.c
* \ingroup bmesh
*
* This file contains functions for answering common
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_query.h
index e602c63da94..cb3af88c316 100644
--- a/source/blender/bmesh/intern/bmesh_queries.h
+++ b/source/blender/bmesh/intern/bmesh_query.h
@@ -23,7 +23,7 @@
#ifndef __BMESH_QUERIES_H__
#define __BMESH_QUERIES_H__
-/** \file blender/bmesh/intern/bmesh_queries.h
+/** \file blender/bmesh/intern/bmesh_query.h
* \ingroup bmesh
*/
@@ -196,6 +196,6 @@ int BM_mesh_calc_edge_groups(
/* not really any good place to put this */
float bmesh_subd_falloff_calc(const int falloff, float val) ATTR_WARN_UNUSED_RESULT;
-#include "bmesh_queries_inline.h"
+#include "bmesh_query_inline.h"
#endif /* __BMESH_QUERIES_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_queries_inline.h b/source/blender/bmesh/intern/bmesh_query_inline.h
index 09cf39b526d..1bd77d23ded 100644
--- a/source/blender/bmesh/intern/bmesh_queries_inline.h
+++ b/source/blender/bmesh/intern/bmesh_query_inline.h
@@ -18,7 +18,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/bmesh/intern/bmesh_queries_inline.h
+/** \file blender/bmesh/intern/bmesh_query_inline.h
* \ingroup bmesh
*/
diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c
index c68d92ea5e0..00b2b8a5d1b 100644
--- a/source/blender/bmesh/operators/bmo_beautify.c
+++ b/source/blender/bmesh/operators/bmo_beautify.c
@@ -82,4 +82,3 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
}
-
diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
index 2a7b85ac8fd..317045b303c 100644
--- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c
+++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c
@@ -543,4 +543,3 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
delete_laplacian_system(sys);
}
-
diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c
index d3972363bb4..5d535cc7503 100644
--- a/source/blender/bmesh/tools/bmesh_beautify.c
+++ b/source/blender/bmesh/tools/bmesh_beautify.c
@@ -456,4 +456,3 @@ void BM_mesh_beautify_fill(
TIMEIT_END(beautify_fill);
#endif
}
-
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 67468458f81..04cd78af830 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -42,7 +42,6 @@ extern "C"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_fcurve.h"
#include "BKE_animsys.h"
#include "BKE_scene.h"
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 2f5c3237bf6..d3370172f60 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -882,7 +882,7 @@ void ArmatureImporter::make_shape_keys(bContext *C)
//insert basis key
kb = BKE_keyblock_add_ctime(key, "Basis", false);
- BKE_keyblock_convert_from_mesh(source_me, kb);
+ BKE_keyblock_convert_from_mesh(source_me, key, kb);
//insert other shape keys
for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
@@ -896,7 +896,7 @@ void ArmatureImporter::make_shape_keys(bContext *C)
std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), false);
- BKE_keyblock_convert_from_mesh(me, kb);
+ BKE_keyblock_convert_from_mesh(me, key, kb);
//apply weights
weight = morphWeights.getFloatValues()->getData()[i];
diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp
index 6cb1e58db6e..1a58bc9d1b8 100644
--- a/source/blender/collada/ControllerExporter.cpp
+++ b/source/blender/collada/ControllerExporter.cpp
@@ -199,8 +199,11 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me;
+ if (((Mesh *)ob->data)->dvert == NULL) {
+ return;
+ }
+
me = bc_get_mesh_copy(
- m_bmain,
depsgraph,
scene,
ob,
@@ -208,8 +211,6 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
this->export_settings->apply_modifiers,
this->export_settings->triangulate);
- if (!me->dvert) return;
-
std::string controller_name = id_name(ob_arm);
std::string controller_id = get_controller_id(ob_arm, ob);
@@ -293,7 +294,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm)
add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id);
add_vertex_weights_element(weights_source_id, joints_source_id, vcounts, joints);
- BKE_libblock_free_us(m_bmain, me);
+ BKE_id_free(NULL, me);
closeSkin();
closeController();
@@ -305,7 +306,6 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
Mesh *me;
me = bc_get_mesh_copy(
- m_bmain,
depsgraph,
scene,
ob,
@@ -332,8 +332,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key)
COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, morph_weights_id)));
targets.add();
- BKE_libblock_free_us(m_bmain, me);
-
+ BKE_id_free(NULL, me);
//support for animations
//can also try the base element and param alternative
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 541f84f96f5..cc4ecd5649b 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -85,11 +85,11 @@ extern "C"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_action.h" // pose functions
#include "BKE_animsys.h"
#include "BKE_armature.h"
#include "BKE_blender_version.h"
+#include "BKE_customdata.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_image.h"
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index c6ba3b8f4ac..a382b7cca9c 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -232,11 +232,6 @@ void DocumentImporter::finish()
objects_to_scale->insert(objects_to_scale->end(), objects_done->begin(), objects_done->end());
delete objects_done;
}
-
- // update scene
- DEG_relations_tag_update(bmain);
- WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
-
}
@@ -245,7 +240,6 @@ void DocumentImporter::finish()
armature_importer.set_tags_map(this->uid_tags_map);
armature_importer.make_armatures(mContext, *objects_to_scale);
armature_importer.make_shape_keys(mContext);
- DEG_relations_tag_update(bmain);
#if 0
armature_importer.fix_animation();
@@ -269,13 +263,16 @@ void DocumentImporter::finish()
BKE_scene_collections_object_remove(bmain, sce, ob, true);
}
libnode_ob.clear();
-
- DEG_relations_tag_update(bmain);
}
bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units);
delete objects_to_scale;
+
+ // update scene
+ DEG_id_tag_update(&sce->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
}
diff --git a/source/blender/collada/ErrorHandler.h b/source/blender/collada/ErrorHandler.h
index 3b3797e935a..2e648f54c4e 100644
--- a/source/blender/collada/ErrorHandler.h
+++ b/source/blender/collada/ErrorHandler.h
@@ -53,4 +53,3 @@ private:
/** Hold error status. */
bool mError;
};
-
diff --git a/source/blender/collada/ExtraHandler.h b/source/blender/collada/ExtraHandler.h
index 4dda862b3cc..826557ebaab 100644
--- a/source/blender/collada/ExtraHandler.h
+++ b/source/blender/collada/ExtraHandler.h
@@ -83,4 +83,3 @@ private:
ExtraTags* currentExtraTags;
std::string currentElement;
};
-
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index f59be97b545..0beded56b3b 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -40,7 +40,6 @@
extern "C" {
#include "BLI_utildefines.h"
- #include "BKE_DerivedMesh.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
@@ -72,14 +71,8 @@ void GeometryExporter::exportGeom(Main *bmain, struct Depsgraph *depsgraph, Scen
void GeometryExporter::operator()(Object *ob)
{
- // XXX don't use DerivedMesh, Mesh instead?
-#if 0
- DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH);
-#endif
-
bool use_instantiation = this->export_settings->use_object_instantiation;
Mesh *me = bc_get_mesh_copy(
- m_bmain,
mDepsgraph,
mScene,
ob,
@@ -170,8 +163,7 @@ void GeometryExporter::operator()(Object *ob)
}
}
- BKE_libblock_free_us(m_bmain, me);
-
+ BKE_id_free(NULL, me);
}
void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb)
@@ -688,5 +680,3 @@ COLLADASW::URI GeometryExporter::makeUrl(std::string id)
{
return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
}
-
-
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index d909203488e..47d8f4f52bb 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -241,4 +241,3 @@ void SceneExporter::writeNodes(bContext *C, Depsgraph *depsgraph, Object *ob, Sc
if (ob->type != OB_ARMATURE)
colladaNode.end();
}
-
diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h
index 91f98063020..f7d56701961 100644
--- a/source/blender/collada/SceneExporter.h
+++ b/source/blender/collada/SceneExporter.h
@@ -48,7 +48,6 @@ extern "C" {
#include "DNA_modifier_types.h"
#include "DNA_userdef_types.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_fcurve.h"
#include "BKE_animsys.h"
#include "BLI_path_util.h"
diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index b07c6518050..8046efd2335 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -242,9 +242,6 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique
invert_m4_m4(ob->parentinv, workob.obmat);
DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA);
-
- DEG_relations_tag_update(bmain);
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
#endif
copy_m4_m4(ob->obmat, bind_shape_matrix);
BKE_object_apply_mat4(ob, ob->obmat, 0, 0);
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index cf4dcb5eb42..a0b9f8d4e38 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -351,4 +351,3 @@ std::string get_morph_id(Object *ob)
{
return translate_id(id_name(ob)) + "-morph";
}
-
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 4ded9bd2d86..86824800378 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -51,8 +51,8 @@ extern "C" {
#include "BKE_global.h"
#include "BKE_layer.h"
#include "BKE_mesh.h"
+#include "BKE_mesh_runtime.h"
#include "BKE_scene.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_main.h"
#include "ED_armature.h"
@@ -128,12 +128,6 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space)
DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
DEG_id_tag_update(&par->id, OB_RECALC_OB);
- /** done once after import */
-#if 0
- DEG_relations_tag_update(bmain);
- WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
-#endif
-
return true;
}
@@ -166,13 +160,13 @@ Object *bc_add_object(Main *bmain, Scene *scene, ViewLayer *view_layer, int type
}
Mesh *bc_get_mesh_copy(
- Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate)
+ Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate)
{
- Mesh *tmpmesh;
CustomDataMask mask = CD_MASK_MESH;
Mesh *mesh = (Mesh *)ob->data;
- DerivedMesh *dm = NULL;
+ Mesh *tmpmesh = NULL;
if (apply_modifiers) {
+#if 0 /* Not supported by new system currently... */
switch (export_mesh_type) {
case BC_MESH_TYPE_VIEW:
{
@@ -185,14 +179,20 @@ Mesh *bc_get_mesh_copy(
break;
}
}
+#else
+ tmpmesh = mesh_get_eval_final(depsgraph, scene, ob, mask);
+#endif
}
else {
- dm = mesh_create_derived((Mesh *)ob->data, NULL);
+ tmpmesh = mesh;
}
- tmpmesh = BKE_mesh_add(bmain, "ColladaMesh"); // name is not important here
- DM_to_mesh(dm, tmpmesh, ob, CD_MASK_MESH, true);
- tmpmesh->flag = mesh->flag;
+ BKE_id_copy_ex(NULL, &tmpmesh->id, (ID **)&tmpmesh,
+ LIB_ID_CREATE_NO_MAIN |
+ LIB_ID_CREATE_NO_USER_REFCOUNT |
+ LIB_ID_CREATE_NO_DEG_TAG |
+ LIB_ID_COPY_NO_PREVIEW,
+ false);
if (triangulate) {
bc_triangulate_mesh(tmpmesh);
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index de9167efb07..89a5379d3c7 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -51,7 +51,6 @@ extern "C" {
#include "BKE_context.h"
#include "BKE_object.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_scene.h"
#include "BKE_idprop.h"
}
@@ -73,7 +72,7 @@ extern int bc_test_parent_loop(Object *par, Object *ob);
extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space = true);
extern Object *bc_add_object(Main *bmain, Scene *scene, ViewLayer *view_layer, int type, const char *name);
extern Mesh *bc_get_mesh_copy(
- Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate);
+ Depsgraph *depsgraph, Scene *scene, Object *ob, BC_export_mesh_type export_mesh_type, bool apply_modifiers, bool triangulate);
extern Object *bc_get_assigned_armature(Object *ob);
extern Object *bc_get_highest_selected_ancestor_or_self(LinkNode *export_set, Object *ob);
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp
index 970338d41cc..d3991245c22 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.cpp
+++ b/source/blender/compositor/intern/COM_CPUDevice.cpp
@@ -40,4 +40,3 @@ void CPUDevice::execute(WorkPackage *work)
executionGroup->finalizeChunkExecution(chunkNumber, NULL);
}
-
diff --git a/source/blender/compositor/intern/COM_Device.cpp b/source/blender/compositor/intern/COM_Device.cpp
index ee59976f45d..7d2045e3c7b 100644
--- a/source/blender/compositor/intern/COM_Device.cpp
+++ b/source/blender/compositor/intern/COM_Device.cpp
@@ -21,4 +21,3 @@
*/
#include "COM_Device.h"
-
diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cpp b/source/blender/compositor/intern/COM_MemoryProxy.cpp
index 138b508c45b..b995f556db2 100644
--- a/source/blender/compositor/intern/COM_MemoryProxy.cpp
+++ b/source/blender/compositor/intern/COM_MemoryProxy.cpp
@@ -48,4 +48,3 @@ void MemoryProxy::free()
this->m_buffer = NULL;
}
}
-
diff --git a/source/blender/compositor/intern/COM_SocketReader.cpp b/source/blender/compositor/intern/COM_SocketReader.cpp
index 7517abc1430..e28bd4c7d3d 100644
--- a/source/blender/compositor/intern/COM_SocketReader.cpp
+++ b/source/blender/compositor/intern/COM_SocketReader.cpp
@@ -21,5 +21,3 @@
*/
#include "COM_SocketReader.h"
-
-
diff --git a/source/blender/compositor/nodes/COM_CropNode.h b/source/blender/compositor/nodes/COM_CropNode.h
index cdec70a4a5c..d33243b915a 100644
--- a/source/blender/compositor/nodes/COM_CropNode.h
+++ b/source/blender/compositor/nodes/COM_CropNode.h
@@ -36,5 +36,3 @@ public:
};
#endif
-
-
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index 36e71aa1203..b82de5962e9 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -271,4 +271,3 @@ void ImageNode::convertToOperations(NodeConverter &converter, const CompositorCo
}
}
}
-
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp
index ac09b38951b..78d1bfc3b28 100644
--- a/source/blender/compositor/nodes/COM_TranslateNode.cpp
+++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp
@@ -71,4 +71,3 @@ void TranslateNode::convertToOperations(NodeConverter &converter, const Composit
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
}
}
-
diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
index 748b5c63409..119ff3f98e9 100644
--- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp
@@ -54,4 +54,3 @@ void AlphaOverMixedOperation::executePixelSampled(float output[4], float x, floa
output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}
-
diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
index b6a1ab57b14..22a92c8e65b 100644
--- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
+++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
@@ -53,4 +53,3 @@ void AlphaOverPremultiplyOperation::executePixelSampled(float output[4], float x
output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3];
}
}
-
diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
index 099113dbf47..a959bd0a5aa 100644
--- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp
+++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp
@@ -89,4 +89,3 @@ void BrightnessOperation::deinitExecution()
this->m_inputBrightnessProgram = NULL;
this->m_inputContrastProgram = NULL;
}
-
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
index f90e9b70053..cbd87113276 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
@@ -65,4 +65,3 @@ void ChangeHSVOperation::executePixelSampled(float output[4], float x, float y,
output[2] = inputColor1[2] * value[0];
output[3] = inputColor1[3];
}
-
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
index 688cbe91cf7..ec59a27e724 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
@@ -123,4 +123,3 @@ void ChannelMatteOperation::executePixelSampled(float output[4], float x, float
/* don't make something that was more transparent less transparent */
output[0] = min(alpha, inColor[3]);
}
-
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
index bc6389c5bbd..6696a6add6d 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
@@ -108,4 +108,3 @@ void ChromaMatteOperation::executePixelSampled(float output[4], float x, float y
output[0] = inImage[3]; /* make pixel just as transparent as it was before */
}
}
-
diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
index 5e08dadd635..a67540f846d 100644
--- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
@@ -144,4 +144,3 @@ void ColorCorrectionOperation::deinitExecution()
this->m_inputImage = NULL;
this->m_inputMask = NULL;
}
-
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
index c95811e5e11..22aa4a5b2d7 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
@@ -82,4 +82,3 @@ void ColorMatteOperation::executePixelSampled(float output[4], float x, float y,
output[0] = inColor[3]; /* make pixel just as transparent as it was before */
}
}
-
diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h
index 269a065a793..e7f2bc7d2c6 100644
--- a/source/blender/compositor/operations/COM_CompositorOperation.h
+++ b/source/blender/compositor/operations/COM_CompositorOperation.h
@@ -100,4 +100,3 @@ public:
void setActive(bool active) { this->m_active = active; }
};
#endif
-
diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
index 770a5bd205b..f6417bb78a0 100644
--- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp
@@ -85,4 +85,3 @@ void DifferenceMatteOperation::executePixelSampled(float output[4], float x, flo
output[0] = inColor1[3];
}
}
-
diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
index 0d959996be1..0273a1de133 100644
--- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp
@@ -190,4 +190,3 @@ bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffer
return false;
}
-
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
index 0d7cd129a2f..98083add1f7 100644
--- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
+++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp
@@ -128,4 +128,3 @@ bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, Read
return false;
}
-
diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
index 0a6f1fdfd31..69d77c43245 100644
--- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cpp
@@ -32,4 +32,3 @@ float DistanceYCCMatteOperation::calculateDistance(float key[4], float image[4])
/* only measure the second 2 values */
return len_v2v2(key + 1, image + 1);
}
-
diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
index ffa2f812ed7..3566eafa2db 100644
--- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp
@@ -1298,4 +1298,3 @@ void DoubleEdgeMaskOperation::deinitExecution()
this->m_cachedInstance = NULL;
}
}
-
diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
index fac0e028c6d..f0293a02724 100644
--- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
@@ -118,4 +118,3 @@ void EllipseMaskOperation::deinitExecution()
this->m_inputMask = NULL;
this->m_inputValue = NULL;
}
-
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index 11843da3634..d570424cb69 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -322,4 +322,3 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect)
unlockMutex();
return this->m_iirgaus;
}
-
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
index 2b02cf322ef..ae92b1ee095 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h
@@ -74,4 +74,3 @@ public:
};
#endif
-
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index 483ddb53344..bbcec45ea1f 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -354,4 +354,3 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(rcti *inpu
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
}
-
diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp
index da31638ff07..f22270108ae 100644
--- a/source/blender/compositor/operations/COM_InpaintOperation.cpp
+++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp
@@ -284,4 +284,3 @@ bool InpaintSimpleOperation::determineDependingAreaOfInterest(rcti * /*input*/,
return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}
}
-
diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp
index 53f181cf008..ac0c91394e8 100644
--- a/source/blender/compositor/operations/COM_InvertOperation.cpp
+++ b/source/blender/compositor/operations/COM_InvertOperation.cpp
@@ -70,4 +70,3 @@ void InvertOperation::deinitExecution()
this->m_inputValueProgram = NULL;
this->m_inputColorProgram = NULL;
}
-
diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
index e07da3bd17f..391d6f8d9e9 100644
--- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
@@ -77,4 +77,3 @@ void LuminanceMatteOperation::executePixelSampled(float output[4], float x, floa
/* don't make something that was more transparent less transparent */
output[0] = min_ff(alpha, inColor[3]);
}
-
diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp
index 54d63b6a12c..9e8b28e871e 100644
--- a/source/blender/compositor/operations/COM_MapUVOperation.cpp
+++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp
@@ -174,4 +174,3 @@ bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOpe
return false;
}
-
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
index 5f8c3ef435c..c1c159f80a0 100644
--- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
+++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp
@@ -87,4 +87,3 @@ void MovieClipAttributeOperation::determineResolution(
resolution[0] = preferredResolution[0];
resolution[1] = preferredResolution[1];
}
-
diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
index db2598ad6dc..de1a807f137 100644
--- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp
+++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp
@@ -311,4 +311,3 @@ void OutputOpenExrMultiLayerOperation::deinitExecution()
}
}
}
-
diff --git a/source/blender/compositor/operations/COM_PixelateOperation.cpp b/source/blender/compositor/operations/COM_PixelateOperation.cpp
index eed6d1d01b9..4373c3511ea 100644
--- a/source/blender/compositor/operations/COM_PixelateOperation.cpp
+++ b/source/blender/compositor/operations/COM_PixelateOperation.cpp
@@ -46,4 +46,3 @@ void PixelateOperation::executePixelSampled(float output[4], float x, float y, P
float ny = round(y);
this->m_inputOperation->readSampled(output, nx, ny, sampler);
}
-
diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.cpp b/source/blender/compositor/operations/COM_QualityStepHelper.cpp
index a1d84e7d569..9a9db86f720 100644
--- a/source/blender/compositor/operations/COM_QualityStepHelper.cpp
+++ b/source/blender/compositor/operations/COM_QualityStepHelper.cpp
@@ -68,4 +68,3 @@ void QualityStepHelper::initExecution(QualityHelper helper)
break;
}
}
-
diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
index 964ba36d08c..40f2ee226ae 100644
--- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
+++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp
@@ -335,4 +335,3 @@ bool SunBeamsOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffer
return NodeOperation::determineDependingAreaOfInterest(&rect, readOperation, output);
}
-
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp
index fcf99a10a73..89092cf8566 100644
--- a/source/blender/compositor/operations/COM_TranslateOperation.cpp
+++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp
@@ -81,4 +81,3 @@ void TranslateOperation::setFactorXY(float factorX, float factorY)
m_factorX = factorX;
m_factorY = factorY;
}
-
diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt
index 8f6eee244f7..0673a3177b7 100644
--- a/source/blender/depsgraph/CMakeLists.txt
+++ b/source/blender/depsgraph/CMakeLists.txt
@@ -67,6 +67,7 @@ set(SRC
intern/depsgraph_build.cc
intern/depsgraph_debug.cc
intern/depsgraph_eval.cc
+ intern/depsgraph_physics.cc
intern/depsgraph_query.cc
intern/depsgraph_query_foreach.cc
intern/depsgraph_query_iter.cc
@@ -76,6 +77,7 @@ set(SRC
DEG_depsgraph.h
DEG_depsgraph_build.h
DEG_depsgraph_debug.h
+ DEG_depsgraph_physics.h
DEG_depsgraph_query.h
intern/builder/deg_builder.h
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index 202e8ef3cf0..30fefb7d4e4 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -153,25 +153,6 @@ void DEG_add_object_cache_relation(struct DepsNodeHandle *handle,
struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *handle);
void DEG_add_special_eval_flag(struct Depsgraph *graph, struct ID *id, short flag);
-/* Utility functions for physics modifiers */
-typedef bool (*DEG_CollobjFilterFunction)(struct Object *obj, struct ModifierData *md);
-
-void DEG_add_collision_relations(struct DepsNodeHandle *handle,
- struct Scene *scene,
- struct Object *object,
- struct Collection *collection,
- unsigned int modifier_type,
- DEG_CollobjFilterFunction fn,
- bool dupli,
- const char *name);
-void DEG_add_forcefield_relations(struct DepsNodeHandle *handle,
- struct Scene *scene,
- struct Object *object,
- struct EffectorWeights *eff,
- bool add_absorption,
- int skip_forcefield,
- const char *name);
-
/* ************************************************ */
#ifdef __cplusplus
diff --git a/source/blender/depsgraph/DEG_depsgraph_physics.h b/source/blender/depsgraph/DEG_depsgraph_physics.h
new file mode 100644
index 00000000000..fd35a7fb2c0
--- /dev/null
+++ b/source/blender/depsgraph/DEG_depsgraph_physics.h
@@ -0,0 +1,85 @@
+/*
+ * ***** 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) 2018 Blender Foundation.
+ * All rights reserved.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/DEG_depsgraph_physics.h
+ * \ingroup depsgraph
+ *
+ * Physics utilities for effectors and collision.
+ */
+
+#ifndef __DEG_DEPSGRAPH_PHYSICS_H__
+#define __DEG_DEPSGRAPH_PHYSICS_H__
+
+#include "DEG_depsgraph.h"
+
+struct Colllection;
+struct Depsgraph;
+struct DepsNodeHandle;
+struct EffectorWeights;
+struct ListBase;
+struct Object;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum ePhysicsRelationType {
+ DEG_PHYSICS_EFFECTOR = 0,
+ DEG_PHYSICS_COLLISION = 1,
+ DEG_PHYSICS_SMOKE_COLLISION = 2,
+ DEG_PHYSICS_DYNAMIC_BRUSH = 3,
+ DEG_PHYSICS_RELATIONS_NUM = 4
+} ePhysicsRelationType;
+
+/* Get collision/effector relations from collection or entire scene. These
+ * created during depsgraph relations building and should only be accessed
+ * during evaluation. */
+struct ListBase *DEG_get_effector_relations(const struct Depsgraph *depsgraph,
+ struct Collection *collection);
+struct ListBase *DEG_get_collision_relations(const struct Depsgraph *depsgraph,
+ struct Collection *collection,
+ unsigned int modifier_type);
+
+
+/* Build collision/effector relations for depsgraph. */
+typedef bool (*DEG_CollobjFilterFunction)(struct Object *obj,
+ struct ModifierData *md);
+
+void DEG_add_collision_relations(struct DepsNodeHandle *handle,
+ struct Object *object,
+ struct Collection *collection,
+ unsigned int modifier_type,
+ DEG_CollobjFilterFunction fn,
+ const char *name);
+void DEG_add_forcefield_relations(struct DepsNodeHandle *handle,
+ struct Object *object,
+ struct EffectorWeights *eff,
+ bool add_absorption,
+ int skip_forcefield,
+ const char *name);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* __DEG_DEPSGRAPH_PHYSICS_H__ */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc
index 1b2dcd8fcf8..b6256e9ceb0 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder.cc
@@ -58,7 +58,7 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
foreach (IDDepsNode *id_node, graph->id_nodes) {
ID *id = id_node->id_orig;
id_node->finalize_build(graph);
- int flag = DEG_TAG_TRANSFORM | DEG_TAG_GEOMETRY;
+ int flag = 0;
if ((id->recalc & ID_RECALC_ALL)) {
AnimData *adt = BKE_animdata_from_id(id);
if (adt != NULL && (adt->recalc & ADT_RECALC_ANIM) != 0) {
@@ -68,7 +68,9 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
flag |= DEG_TAG_COPY_ON_WRITE;
}
- DEG_id_tag_update_ex(bmain, id_node->id_orig, flag);
+ if (flag != 0) {
+ DEG_id_tag_update_ex(bmain, id_node->id_orig, flag);
+ }
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 9b0c3354c47..cb455130d4c 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -65,6 +65,7 @@ extern "C" {
#include "DNA_lightprobe_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
+#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
@@ -431,6 +432,9 @@ void DepsgraphNodeBuilder::build_id(ID *id) {
case ID_LT:
build_object_data_geometry_datablock(id);
break;
+ case ID_SPK:
+ build_speaker((Speaker *)id);
+ break;
default:
fprintf(stderr, "Unhandled ID %s\n", id->name);
BLI_assert(!"Should never happen");
@@ -459,9 +463,10 @@ void DepsgraphNodeBuilder::build_collection(
/* Build collection objects. */
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
if (allow_restrict_flags) {
- const int restrict_flag = (graph_->mode == DAG_EVAL_VIEWPORT)
- ? OB_RESTRICT_VIEW
- : OB_RESTRICT_RENDER;
+ const int restrict_flag = (
+ (graph_->mode == DAG_EVAL_VIEWPORT) ?
+ OB_RESTRICT_VIEW :
+ OB_RESTRICT_RENDER);
if (cob->ob->restrictflag & restrict_flag) {
continue;
}
@@ -538,9 +543,12 @@ void DepsgraphNodeBuilder::build_object(int base_index,
build_gpencil(object->gpd);
}
/* Proxy object to copy from. */
- if (object->proxy_from) {
+ if (object->proxy_from != NULL) {
build_object(-1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY);
}
+ if (object->proxy_group != NULL) {
+ build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY);
+ }
/* Object dupligroup. */
if (object->dup_group != NULL) {
build_collection(DEG_COLLECTION_OWNER_OBJECT, object->dup_group);
@@ -612,6 +620,9 @@ void DepsgraphNodeBuilder::build_object_data(Object *object)
case OB_LIGHTPROBE:
build_object_data_lightprobe(object);
break;
+ case OB_SPEAKER:
+ build_object_data_speaker(object);
+ break;
default:
{
ID *obdata = (ID *)object->data;
@@ -645,6 +656,16 @@ void DepsgraphNodeBuilder::build_object_data_lightprobe(Object *object)
DEG_OPCODE_LIGHT_PROBE_EVAL);
}
+void DepsgraphNodeBuilder::build_object_data_speaker(Object *object)
+{
+ Speaker *speaker = (Speaker *)object->data;
+ build_speaker(speaker);
+ add_operation_node(&object->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ NULL,
+ DEG_OPCODE_SPEAKER_EVAL);
+}
+
void DepsgraphNodeBuilder::build_object_transform(Object *object)
{
OperationDepsNode *op_node;
@@ -728,19 +749,14 @@ void DepsgraphNodeBuilder::build_animdata(ID *id)
if (adt == NULL) {
return;
}
+ if (adt->action != NULL) {
+ build_action(adt->action);
+ }
/* animation */
if (adt->action || adt->nla_tracks.first || adt->drivers.first) {
(void) add_id_node(id);
ID *id_cow = get_cow_id(id);
- if (adt->action != NULL &&
- !built_map_.checkIsBuiltAndTag(&adt->action->id))
- {
- add_operation_node(&adt->action->id, DEG_NODE_TYPE_ANIMATION,
- NULL,
- DEG_OPCODE_ANIMATION);
- }
-
// XXX: Hook up specific update callbacks for special properties which
// may need it...
@@ -771,6 +787,17 @@ void DepsgraphNodeBuilder::build_animdata(ID *id)
}
}
+void DepsgraphNodeBuilder::build_action(bAction *action)
+{
+ if (built_map_.checkIsBuiltAndTag(action)) {
+ return;
+ }
+ add_operation_node(&action->id,
+ DEG_NODE_TYPE_ANIMATION,
+ NULL,
+ DEG_OPCODE_ANIMATION);
+}
+
/**
* Build graph node(s) for Driver
* \param id: ID-Block that driver is attached to
@@ -1461,6 +1488,19 @@ void DepsgraphNodeBuilder::build_lightprobe(LightProbe *probe)
build_animdata(&probe->id);
}
+void DepsgraphNodeBuilder::build_speaker(Speaker *speaker)
+{
+ if (built_map_.checkIsBuiltAndTag(speaker)) {
+ return;
+ }
+ /* Placeholder so we can add relations and tag ID node for update. */
+ add_operation_node(&speaker->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ NULL,
+ DEG_OPCODE_SPEAKER_EVAL);
+ build_animdata(&speaker->id);
+}
+
/* **** ID traversal callbacks functions **** */
void DepsgraphNodeBuilder::modifier_walk(void *user_data,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 72aa5dbe003..6899a86b3e9 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -37,6 +37,7 @@
struct Base;
struct bArmature;
+struct bAction;
struct CacheFile;
struct Camera;
struct bGPdata;
@@ -62,6 +63,7 @@ struct Probe;
struct bPoseChannel;
struct bConstraint;
struct Scene;
+struct Speaker;
struct Tex;
struct World;
@@ -175,6 +177,7 @@ struct DepsgraphNodeBuilder {
void build_object_data_geometry_datablock(ID *obdata);
void build_object_data_lamp(Object *object);
void build_object_data_lightprobe(Object *object);
+ void build_object_data_speaker(Object *object);
void build_object_transform(Object *object);
void build_object_constraints(Object *object);
void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index);
@@ -183,6 +186,7 @@ struct DepsgraphNodeBuilder {
void build_particle_settings(ParticleSettings *part);
void build_cloth(Object *object);
void build_animdata(ID *id);
+ void build_action(bAction *action);
void build_driver(ID *id, FCurve *fcurve, int driver_index);
void build_driver_variables(ID *id, FCurve *fcurve);
void build_driver_id_property(ID *id, const char *rna_path);
@@ -209,6 +213,7 @@ struct DepsgraphNodeBuilder {
void build_mask(Mask *mask);
void build_movieclip(MovieClip *clip);
void build_lightprobe(LightProbe *probe);
+ void build_speaker(Speaker *speaker);
protected:
struct SavedEntryTag {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
index e2526272570..f1db05b7220 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc
@@ -105,7 +105,7 @@ void DepsgraphNodeBuilder::build_view_layer(
*/
int base_index = 0;
const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
- BASE_VISIBLE_VIEWPORT : BASE_VISIBLE_RENDER;
+ BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
LISTBASE_FOREACH(Base *, base, &view_layer->object_bases) {
/* object itself */
if (base->flag & base_flag) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index d0b699d34e4..f64c4f5aff0 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -65,6 +65,7 @@ extern "C" {
#include "DNA_object_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
+#include "DNA_speaker_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "DNA_object_force_types.h"
@@ -297,87 +298,72 @@ DepsRelation *DepsgraphRelationBuilder::add_operation_relation(
void DepsgraphRelationBuilder::add_collision_relations(
const OperationKey &key,
- Scene *scene,
Object *object,
Collection *collection,
- bool dupli,
const char *name)
{
- unsigned int numcollobj;
- Object **collobjs = get_collisionobjects_ext(scene,
- object,
- collection,
- &numcollobj,
- eModifierType_Collision,
- dupli);
- for (unsigned int i = 0; i < numcollobj; i++) {
- Object *ob1 = collobjs[i];
+ ListBase *relations = deg_build_collision_relations(graph_, collection, eModifierType_Collision);
- ComponentKey trf_key(&ob1->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(trf_key, key, name);
+ LISTBASE_FOREACH (CollisionRelation *, relation, relations) {
+ if (relation->ob != object) {
+ ComponentKey trf_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM);
+ add_relation(trf_key, key, name);
- ComponentKey coll_key(&ob1->id, DEG_NODE_TYPE_GEOMETRY);
- add_relation(coll_key, key, name);
- }
- if (collobjs != NULL) {
- MEM_freeN(collobjs);
+ ComponentKey coll_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY);
+ add_relation(coll_key, key, name);
+ }
}
}
void DepsgraphRelationBuilder::add_forcefield_relations(
const OperationKey &key,
- Scene *scene,
Object *object,
ParticleSystem *psys,
EffectorWeights *eff,
bool add_absorption,
const char *name)
{
- ListBase *effectors = pdInitEffectors(NULL, scene, object, psys, eff, false);
- if (effectors == NULL) {
- return;
- }
- LISTBASE_FOREACH (EffectorCache *, eff, effectors) {
- if (eff->ob != object) {
- ComponentKey eff_key(&eff->ob->id, DEG_NODE_TYPE_TRANSFORM);
+ ListBase *relations = deg_build_effector_relations(graph_, eff->group);
+
+ LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
+ if (relation->ob != object) {
+ ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_TRANSFORM);
add_relation(eff_key, key, name);
+
+ if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source) {
+ ComponentKey trf_key(&relation->pd->f_source->id,
+ DEG_NODE_TYPE_TRANSFORM);
+ add_relation(trf_key, key, "Smoke Force Domain");
+ ComponentKey eff_key(&relation->pd->f_source->id,
+ DEG_NODE_TYPE_GEOMETRY);
+ add_relation(eff_key, key, "Smoke Force Domain");
+ }
+ if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) {
+ add_collision_relations(key,
+ object,
+ NULL,
+ "Force Absorption");
+ }
}
- if (eff->psys != NULL) {
- if (eff->ob != object) {
- ComponentKey eff_key(&eff->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES);
+ if (relation->psys) {
+ if (relation->ob != object) {
+ ComponentKey eff_key(&relation->ob->id, DEG_NODE_TYPE_EVAL_PARTICLES);
add_relation(eff_key, key, name);
/* TODO: remove this when/if EVAL_PARTICLES is sufficient
* for up to date particles.
*/
- ComponentKey mod_key(&eff->ob->id, DEG_NODE_TYPE_GEOMETRY);
+ ComponentKey mod_key(&relation->ob->id, DEG_NODE_TYPE_GEOMETRY);
add_relation(mod_key, key, name);
}
- else if (eff->psys != psys) {
- OperationKey eff_key(&eff->ob->id,
+ else if (relation->psys != psys) {
+ OperationKey eff_key(&relation->ob->id,
DEG_NODE_TYPE_EVAL_PARTICLES,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
- eff->psys->name);
+ relation->psys->name);
add_relation(eff_key, key, name);
}
}
- if (eff->pd->forcefield == PFIELD_SMOKEFLOW && eff->pd->f_source) {
- ComponentKey trf_key(&eff->pd->f_source->id,
- DEG_NODE_TYPE_TRANSFORM);
- add_relation(trf_key, key, "Smoke Force Domain");
- ComponentKey eff_key(&eff->pd->f_source->id,
- DEG_NODE_TYPE_GEOMETRY);
- add_relation(eff_key, key, "Smoke Force Domain");
- }
- if (add_absorption && (eff->pd->flag & PFIELD_VISIBILITY)) {
- add_collision_relations(key,
- scene,
- object,
- NULL,
- true,
- "Force Absorption");
- }
}
- pdEndEffectors(&effectors);
}
Depsgraph *DepsgraphRelationBuilder::getGraph()
@@ -442,6 +428,9 @@ void DepsgraphRelationBuilder::build_id(ID *id)
case ID_LT:
build_object_data_geometry_datablock(id);
break;
+ case ID_SPK:
+ build_speaker((Speaker *)id);
+ break;
default:
fprintf(stderr, "Unhandled ID %s\n", id->name);
BLI_assert(!"Should never happen");
@@ -464,9 +453,9 @@ void DepsgraphRelationBuilder::build_collection(
}
}
const bool group_done = built_map_.checkIsBuiltAndTag(collection);
- OperationKey object_local_transform_key(object != NULL ? &object->id : NULL,
+ OperationKey object_transform_final_key(object != NULL ? &object->id : NULL,
DEG_NODE_TYPE_TRANSFORM,
- DEG_OPCODE_TRANSFORM_LOCAL);
+ DEG_OPCODE_TRANSFORM_FINAL);
if (!group_done) {
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
if (allow_restrict_flags) {
@@ -487,7 +476,7 @@ void DepsgraphRelationBuilder::build_collection(
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(collection, ob, graph_->mode)
{
ComponentKey dupli_transform_key(&ob->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(dupli_transform_key, object_local_transform_key, "Dupligroup");
+ add_relation(dupli_transform_key, object_transform_final_key, "Dupligroup");
}
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
}
@@ -596,7 +585,13 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
ComponentKey proxy_transform_key(&object->id, DEG_NODE_TYPE_TRANSFORM);
add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform");
}
-
+ if (object->proxy_group != NULL) {
+ build_object(NULL, object->proxy_group);
+ OperationKey proxy_group_ubereval_key(&object->proxy_group->id,
+ DEG_NODE_TYPE_TRANSFORM,
+ DEG_OPCODE_TRANSFORM_OBJECT_UBEREVAL);
+ add_relation(proxy_group_ubereval_key, final_transform_key, "Proxy Group Transform");
+ }
/* Object dupligroup. */
if (object->dup_group != NULL) {
build_collection(DEG_COLLECTION_OWNER_OBJECT, object, object->dup_group);
@@ -656,6 +651,9 @@ void DepsgraphRelationBuilder::build_object_data(Object *object)
case OB_LIGHTPROBE:
build_object_data_lightprobe(object);
break;
+ case OB_SPEAKER:
+ build_object_data_speaker(object);
+ break;
}
Key *key = BKE_key_from_object(object);
if (key != NULL) {
@@ -697,6 +695,19 @@ void DepsgraphRelationBuilder::build_object_data_lightprobe(Object *object)
add_relation(probe_key, object_key, "LightProbe Update");
}
+void DepsgraphRelationBuilder::build_object_data_speaker(Object *object)
+{
+ Speaker *speaker = (Speaker *)object->data;
+ build_speaker(speaker);
+ OperationKey probe_key(&speaker->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ DEG_OPCODE_SPEAKER_EVAL);
+ OperationKey object_key(&object->id,
+ DEG_NODE_TYPE_PARAMETERS,
+ DEG_OPCODE_SPEAKER_EVAL);
+ add_relation(probe_key, object_key, "Speaker Update");
+}
+
void DepsgraphRelationBuilder::build_object_parent(Object *object)
{
/* XXX: for now, need to use the component key (not just direct to the parent op),
@@ -1021,17 +1032,16 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id)
if (adt == NULL) {
return;
}
+ if (adt->action != NULL) {
+ build_action(adt->action);
+ }
if (adt->action == NULL && adt->nla_tracks.first == NULL) {
return;
}
/* Wire up dependency to time source. */
ComponentKey adt_key(id, DEG_NODE_TYPE_ANIMATION);
- TimeSourceKey time_src_key;
- add_relation(time_src_key, adt_key, "TimeSrc -> Animation");
/* Relation from action itself. */
- if (adt->action != NULL &&
- !built_map_.checkIsBuiltAndTag(&adt->action->id))
- {
+ if (adt->action != NULL) {
ComponentKey action_key(&adt->action->id, DEG_NODE_TYPE_ANIMATION);
add_relation(action_key, adt_key, "Action -> Animation");
}
@@ -1193,6 +1203,16 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id)
}
}
+void DepsgraphRelationBuilder::build_action(bAction *action)
+{
+ if (built_map_.checkIsBuiltAndTag(action)) {
+ return;
+ }
+ TimeSourceKey time_src_key;
+ ComponentKey animation_key(&action->id, DEG_NODE_TYPE_ANIMATION);
+ add_relation(time_src_key, animation_key, "TimeSrc -> Animation");
+}
+
void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
{
ChannelDriver *driver = fcu->driver;
@@ -1498,12 +1518,12 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
if (rbw->constraints) {
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(rbw->constraints, object)
{
- if (!object->rigidbody_constraint) {
+ RigidBodyCon *rbc = object->rigidbody_constraint;
+ if (rbc == NULL || rbc->ob1 == NULL || rbc->ob2 == NULL) {
+ /* When either ob1 or ob2 is NULL, the constraint doesn't work. */
continue;
}
- RigidBodyCon *rbc = object->rigidbody_constraint;
-
/* final result of the constraint object's transform controls how the
* constraint affects the physics sim for these objects
*/
@@ -1562,10 +1582,8 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
/* Collisions */
if (part->type != PART_HAIR) {
add_collision_relations(psys_key,
- scene_,
object,
part->collision_group,
- true,
"Particle Collision");
}
else if ((psys->flag & PSYS_HAIR_DYNAMICS) &&
@@ -1573,15 +1591,12 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
psys->clmd->coll_parms != NULL)
{
add_collision_relations(psys_key,
- scene_,
object,
psys->clmd->coll_parms->group,
- true,
"Hair Collision");
}
/* Effectors. */
add_forcefield_relations(psys_key,
- scene_,
object,
psys,
part->effector_weights,
@@ -2118,6 +2133,14 @@ void DepsgraphRelationBuilder::build_lightprobe(LightProbe *probe)
build_animdata(&probe->id);
}
+void DepsgraphRelationBuilder::build_speaker(Speaker *speaker)
+{
+ if (built_map_.checkIsBuiltAndTag(speaker)) {
+ return;
+ }
+ build_animdata(&speaker->id);
+}
+
void DepsgraphRelationBuilder::build_copy_on_write_relations()
{
foreach (IDDepsNode *id_node, graph_->id_nodes) {
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 3d3a73b6551..d4f1271b217 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -50,6 +50,7 @@
struct Base;
struct bArmature;
+struct bAction;
struct bGPdata;
struct CacheFile;
struct Camera;
@@ -75,6 +76,7 @@ struct bConstraint;
struct ParticleSystem;
struct ParticleSettings;
struct Scene;
+struct Speaker;
struct ViewLayer;
struct Tex;
struct World;
@@ -212,6 +214,7 @@ struct DepsgraphRelationBuilder
void build_object_data_geometry_datablock(ID *obdata);
void build_object_data_lamp(Object *object);
void build_object_data_lightprobe(Object *object);
+ void build_object_data_speaker(Object *object);
void build_object_parent(Object *object);
void build_constraints(ID *id,
eDepsNode_Type component_type,
@@ -229,6 +232,7 @@ struct DepsgraphRelationBuilder
OperationDepsNode *operation_from,
ListBase *strips);
void build_animdata_drivers(ID *id);
+ void build_action(bAction *action);
void build_driver(ID *id, FCurve *fcurve);
void build_driver_data(ID *id, FCurve *fcurve);
void build_driver_variables(ID *id, FCurve *fcurve);
@@ -263,19 +267,17 @@ struct DepsgraphRelationBuilder
void build_mask(Mask *mask);
void build_movieclip(MovieClip *clip);
void build_lightprobe(LightProbe *probe);
+ void build_speaker(Speaker *speaker);
void build_nested_datablock(ID *owner, ID *id);
void build_nested_nodetree(ID *owner, bNodeTree *ntree);
void build_nested_shapekey(ID *owner, Key *key);
void add_collision_relations(const OperationKey &key,
- Scene *scene,
Object *object,
Collection *collection,
- bool dupli,
const char *name);
void add_forcefield_relations(const OperationKey &key,
- Scene *scene,
Object *object,
ParticleSystem *psys,
EffectorWeights *eff,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index 49c107c988f..eaa17d27ffc 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -307,9 +307,11 @@ void DepsgraphRelationBuilder::build_rig(Object *object)
bArmature *armature = (bArmature *)object->data;
// TODO: selection status?
/* Attach links between pose operations. */
+ ComponentKey local_transform(&object->id, DEG_NODE_TYPE_TRANSFORM);
OperationKey init_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT);
OperationKey init_ik_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_INIT_IK);
OperationKey flush_key(&object->id, DEG_NODE_TYPE_EVAL_POSE, DEG_OPCODE_POSE_DONE);
+ add_relation(local_transform, init_key, "Local Transform -> Pose Init");
add_relation(init_key, init_ik_key, "Pose Init -> Pose Init IK");
add_relation(init_ik_key, flush_key, "Pose Init IK -> Pose Cleanup");
/* Make sure pose is up-to-date with armature updates. */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
index b940fc3035e..f069c63f138 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc
@@ -95,7 +95,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
* do NULL-pointer check of the base, so it's fine to pass original one.
*/
const int base_flag = (graph_->mode == DAG_EVAL_VIEWPORT) ?
- BASE_VISIBLE_VIEWPORT : BASE_VISIBLE_RENDER;
+ BASE_ENABLED_VIEWPORT : BASE_ENABLED_RENDER;
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
if (base->flag & base_flag) {
build_object(base, base->object);
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 16427d3eb59..ddc6e44ee1b 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -100,6 +100,7 @@ Depsgraph::Depsgraph(Scene *scene,
entry_tags = BLI_gset_ptr_new("Depsgraph entry_tags");
debug_flags = G.debug;
memset(id_type_updated, 0, sizeof(id_type_updated));
+ memset(physics_relations, 0, sizeof(physics_relations));
}
Depsgraph::~Depsgraph()
@@ -360,6 +361,8 @@ void Depsgraph::clear_id_nodes()
/* Clear containers. */
BLI_ghash_clear(id_hash, NULL, NULL);
id_nodes.clear();
+ /* Clear physics relation caches. */
+ deg_clear_physics_relations(this);
}
/* Add new relationship between two nodes. */
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index a69be39c50b..804fd1b36c2 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -45,6 +45,7 @@
#include "BLI_threads.h" /* for SpinLock */
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_physics.h"
#include "intern/depsgraph_types.h"
@@ -226,6 +227,10 @@ struct Depsgraph {
/* NITE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
int debug_flags;
string debug_name;
+
+ /* Cached list of colliders/effectors for collections and the scene
+ * created along with relations, for fast lookup during evaluation. */
+ GHash *physics_relations[DEG_PHYSICS_RELATIONS_NUM];
};
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index c39f6222a13..fccb5808711 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -43,12 +43,8 @@ extern "C" {
#include "DNA_cachefile_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "DNA_object_force_types.h"
#include "BKE_main.h"
-#include "BKE_collision.h"
-#include "BKE_effect.h"
-#include "BKE_modifier.h"
#include "BKE_scene.h"
} /* extern "C" */
@@ -322,75 +318,3 @@ void DEG_relations_tag_update(Main *bmain)
}
}
}
-
-void DEG_add_collision_relations(DepsNodeHandle *handle,
- Scene *scene,
- Object *object,
- Collection *collection,
- unsigned int modifier_type,
- DEG_CollobjFilterFunction fn,
- bool dupli,
- const char *name)
-{
- unsigned int numcollobj;
- Object **collobjs = get_collisionobjects_ext(scene, object, collection, &numcollobj, modifier_type, dupli);
-
- for (unsigned int i = 0; i < numcollobj; i++) {
- Object *ob1 = collobjs[i];
-
- if (!fn || fn(ob1, modifiers_findByType(ob1, (ModifierType)modifier_type))) {
- DEG_add_object_relation(handle, ob1, DEG_OB_COMP_TRANSFORM, name);
- DEG_add_object_relation(handle, ob1, DEG_OB_COMP_GEOMETRY, name);
- }
- }
-
- if (collobjs)
- MEM_freeN(collobjs);
-}
-
-void DEG_add_forcefield_relations(DepsNodeHandle *handle,
- Scene *scene,
- Object *object,
- EffectorWeights *effector_weights,
- bool add_absorption,
- int skip_forcefield,
- const char *name)
-{
- ListBase *effectors = pdInitEffectors(NULL, scene, object, NULL, effector_weights, false);
- if (effectors == NULL) {
- return;
- }
- for (EffectorCache *eff = (EffectorCache*)effectors->first; eff; eff = eff->next) {
- if (eff->ob != object && eff->pd->forcefield != skip_forcefield) {
- DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_TRANSFORM, name);
- if (eff->psys) {
- DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_EVAL_PARTICLES, name);
- /* TODO: remove this when/if EVAL_PARTICLES is sufficient
- * for up to date particles.
- */
- DEG_add_object_relation(handle, eff->ob, DEG_OB_COMP_GEOMETRY, name);
- }
- if (eff->pd->forcefield == PFIELD_SMOKEFLOW && eff->pd->f_source) {
- DEG_add_object_relation(handle,
- eff->pd->f_source,
- DEG_OB_COMP_TRANSFORM,
- "Smoke Force Domain");
- DEG_add_object_relation(handle,
- eff->pd->f_source,
- DEG_OB_COMP_GEOMETRY,
- "Smoke Force Domain");
- }
- if (add_absorption && (eff->pd->flag & PFIELD_VISIBILITY)) {
- DEG_add_collision_relations(handle,
- scene,
- object,
- NULL,
- eModifierType_Collision,
- NULL,
- true,
- "Force Absorption");
- }
- }
- }
- pdEndEffectors(&effectors);
-}
diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
index 526cecde457..aa67226c47e 100644
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ b/source/blender/depsgraph/intern/depsgraph_intern.h
@@ -50,6 +50,7 @@ extern "C" {
struct DEGEditorUpdateContext;
struct Collection;
+struct ListBase;
struct Main;
struct Scene;
@@ -139,4 +140,10 @@ bool deg_terminal_do_color(void);
string deg_color_for_pointer(const void *pointer);
string deg_color_end(void);
+/* Physics Utilities -------------------------------------------------- */
+
+struct ListBase *deg_build_effector_relations(Depsgraph *graph, struct Collection *collection);
+struct ListBase *deg_build_collision_relations(Depsgraph *graph, struct Collection *collection, unsigned int modifier_type);
+void deg_clear_physics_relations(Depsgraph *graph);
+
} // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc
new file mode 100644
index 00000000000..e542e0c48ae
--- /dev/null
+++ b/source/blender/depsgraph/intern/depsgraph_physics.cc
@@ -0,0 +1,242 @@
+/*
+ * ***** 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) 2018 Blender Foundation.
+ * All rights reserved.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/depsgraph_physics.cc
+ * \ingroup depsgraph
+ *
+ * Physics utilities for effectors and collision.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_compiler_compat.h"
+#include "BLI_ghash.h"
+#include "BLI_listbase.h"
+
+extern "C" {
+#include "BKE_collision.h"
+#include "BKE_effect.h"
+#include "BKE_modifier.h"
+} /* extern "C" */
+
+#include "DNA_group_types.h"
+#include "DNA_object_types.h"
+#include "DNA_object_force_types.h"
+
+#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_physics.h"
+#include "DEG_depsgraph_query.h"
+
+#include "depsgraph.h"
+#include "depsgraph_intern.h"
+
+/*********************** Evaluation Query API *************************/
+
+static ePhysicsRelationType modifier_to_relation_type(unsigned int modifier_type)
+{
+ switch (modifier_type) {
+ case eModifierType_Collision:
+ return DEG_PHYSICS_COLLISION;
+ case eModifierType_Smoke:
+ return DEG_PHYSICS_SMOKE_COLLISION;
+ case eModifierType_DynamicPaint:
+ return DEG_PHYSICS_DYNAMIC_BRUSH;
+ }
+
+ BLI_assert(!"Unknown collision modifier type");
+ return DEG_PHYSICS_RELATIONS_NUM;
+}
+
+ListBase *DEG_get_effector_relations(const Depsgraph *graph,
+ Collection *collection)
+{
+ const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
+ if (deg_graph->physics_relations[DEG_PHYSICS_EFFECTOR] == NULL) {
+ return NULL;
+ }
+
+ ID *collection_orig = DEG_get_original_id(&collection->id);
+ return (ListBase *)BLI_ghash_lookup(deg_graph->physics_relations[DEG_PHYSICS_EFFECTOR], collection_orig);
+}
+
+ListBase *DEG_get_collision_relations(const Depsgraph *graph,
+ Collection *collection,
+ unsigned int modifier_type)
+{
+ const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
+ const ePhysicsRelationType type = modifier_to_relation_type(modifier_type);
+ if (deg_graph->physics_relations[type] == NULL) {
+ return NULL;
+ }
+
+ ID *collection_orig = DEG_get_original_id(&collection->id);
+ return (ListBase *)BLI_ghash_lookup(deg_graph->physics_relations[type], collection_orig);
+}
+
+/********************** Depsgraph Building API ************************/
+
+void DEG_add_collision_relations(DepsNodeHandle *handle,
+ Object *object,
+ Collection *collection,
+ unsigned int modifier_type,
+ DEG_CollobjFilterFunction fn,
+ const char *name)
+{
+ Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
+ DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
+ ListBase *relations = deg_build_collision_relations(deg_graph, collection, modifier_type);
+
+ LISTBASE_FOREACH (CollisionRelation *, relation, relations) {
+ Object *ob1 = relation->ob;
+ if (ob1 != object) {
+ if (!fn || fn(ob1, modifiers_findByType(ob1, (ModifierType)modifier_type))) {
+ DEG_add_object_relation(handle, ob1, DEG_OB_COMP_TRANSFORM, name);
+ DEG_add_object_relation(handle, ob1, DEG_OB_COMP_GEOMETRY, name);
+ }
+ }
+ }
+}
+
+void DEG_add_forcefield_relations(DepsNodeHandle *handle,
+ Object *object,
+ EffectorWeights *effector_weights,
+ bool add_absorption,
+ int skip_forcefield,
+ const char *name)
+{
+ Depsgraph *depsgraph = DEG_get_graph_from_handle(handle);
+ DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
+ ListBase *relations = deg_build_effector_relations(deg_graph, effector_weights->group);
+
+ LISTBASE_FOREACH (EffectorRelation *, relation, relations) {
+ if (relation->ob != object && relation->pd->forcefield != skip_forcefield) {
+ DEG_add_object_relation(handle, relation->ob, DEG_OB_COMP_TRANSFORM, name);
+ if (relation->psys) {
+ DEG_add_object_relation(handle, relation->ob, DEG_OB_COMP_EVAL_PARTICLES, name);
+ /* TODO: remove this when/if EVAL_PARTICLES is sufficient
+ * for up to date particles.
+ */
+ DEG_add_object_relation(handle, relation->ob, DEG_OB_COMP_GEOMETRY, name);
+ }
+ if (relation->pd->forcefield == PFIELD_SMOKEFLOW && relation->pd->f_source) {
+ DEG_add_object_relation(handle,
+ relation->pd->f_source,
+ DEG_OB_COMP_TRANSFORM,
+ "Smoke Force Domain");
+ DEG_add_object_relation(handle,
+ relation->pd->f_source,
+ DEG_OB_COMP_GEOMETRY,
+ "Smoke Force Domain");
+ }
+ if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) {
+ DEG_add_collision_relations(handle,
+ object,
+ NULL,
+ eModifierType_Collision,
+ NULL,
+ "Force Absorption");
+ }
+ }
+ }
+}
+
+/**************************** Internal API ****************************/
+
+namespace DEG
+{
+
+ListBase *deg_build_effector_relations(Depsgraph *graph,
+ Collection *collection)
+{
+ GHash *hash = graph->physics_relations[DEG_PHYSICS_EFFECTOR];
+ if (hash == NULL) {
+ graph->physics_relations[DEG_PHYSICS_EFFECTOR] = BLI_ghash_ptr_new("Depsgraph physics relations hash");
+ hash = graph->physics_relations[DEG_PHYSICS_EFFECTOR];
+ }
+
+ ListBase *relations = reinterpret_cast<ListBase*>(BLI_ghash_lookup(hash, collection));
+ if (relations == NULL) {
+ ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph*>(graph);
+ relations = BKE_effector_relations_create(depsgraph, graph->view_layer, collection);
+ BLI_ghash_insert(hash, &collection->id, relations);
+ }
+
+ return relations;
+}
+
+ListBase *deg_build_collision_relations(Depsgraph *graph,
+ Collection *collection,
+ unsigned int modifier_type)
+{
+ const ePhysicsRelationType type = modifier_to_relation_type(modifier_type);
+ GHash *hash = graph->physics_relations[type];
+ if (hash == NULL) {
+ graph->physics_relations[type] = BLI_ghash_ptr_new("Depsgraph physics relations hash");
+ hash = graph->physics_relations[type];
+ }
+
+ ListBase *relations = reinterpret_cast<ListBase*>(BLI_ghash_lookup(hash, collection));
+ if (relations == NULL) {
+ ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph*>(graph);
+ relations = BKE_collision_relations_create(depsgraph, collection, modifier_type);
+ BLI_ghash_insert(hash, &collection->id, relations);
+ }
+
+ return relations;
+}
+
+static void free_effector_relations(void *value)
+{
+ BKE_effector_relations_free(reinterpret_cast<ListBase*>(value));
+}
+
+static void free_collision_relations(void *value)
+{
+ BKE_collision_relations_free(reinterpret_cast<ListBase*>(value));
+}
+
+void deg_clear_physics_relations(Depsgraph *graph)
+{
+ for (int i = 0; i < DEG_PHYSICS_RELATIONS_NUM; i++) {
+ if (graph->physics_relations[i]) {
+ ePhysicsRelationType type = (ePhysicsRelationType)i;
+
+ switch (type) {
+ case DEG_PHYSICS_EFFECTOR:
+ BLI_ghash_free(graph->physics_relations[i], NULL, free_effector_relations);
+ break;
+ case DEG_PHYSICS_COLLISION:
+ case DEG_PHYSICS_SMOKE_COLLISION:
+ case DEG_PHYSICS_DYNAMIC_BRUSH:
+ BLI_ghash_free(graph->physics_relations[i], NULL, free_collision_relations);
+ break;
+ case DEG_PHYSICS_RELATIONS_NUM:
+ break;
+ }
+
+ graph->physics_relations[i] = NULL;
+ }
+ }
+}
+
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index 1dd6f8b6a0b..a9492b48a1b 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -139,7 +139,7 @@ bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
temp_dupli_object->base_flag = dupli_parent->base_flag | BASE_FROMDUPLI;
/* Duplicated elements shouldn't care whether their original collection is visible or not. */
- temp_dupli_object->base_flag |= BASE_VISIBLED;
+ temp_dupli_object->base_flag |= BASE_VISIBLE;
if (BKE_object_is_visible(temp_dupli_object, OB_VISIBILITY_CHECK_UNKNOWN_RENDER_MODE) == false) {
continue;
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 9b1733bae8e..6d7f86581d9 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -141,6 +141,7 @@ const char *operationCodeAsString(eDepsOperation_Code opcode)
STRINGIFY_OPCODE(GEOMETRY_SHAPEKEY);
/* Object data. */
STRINGIFY_OPCODE(LIGHT_PROBE_EVAL);
+ STRINGIFY_OPCODE(SPEAKER_EVAL);
/* Pose. */
STRINGIFY_OPCODE(POSE_INIT);
STRINGIFY_OPCODE(POSE_INIT_IK);
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index c6eb0d57bac..6577e742266 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -211,6 +211,7 @@ typedef enum eDepsOperation_Code {
/* Object data. ------------------------------------- */
DEG_OPCODE_LIGHT_PROBE_EVAL,
+ DEG_OPCODE_SPEAKER_EVAL,
/* Pose. -------------------------------------------- */
/* Init pose, clear flags, etc. */
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 2f268663186..d7b7129114e 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -111,6 +111,9 @@ set(SRC
engines/workbench/workbench_data.c
engines/workbench/workbench_engine.c
engines/workbench/workbench_deferred.c
+ engines/workbench/workbench_effect_aa.c
+ engines/workbench/workbench_effect_fxaa.c
+ engines/workbench/workbench_effect_taa.c
engines/workbench/workbench_forward.c
engines/workbench/workbench_materials.c
engines/workbench/workbench_studiolight.c
@@ -209,6 +212,7 @@ data_to_c_simple(engines/workbench/shaders/workbench_common_lib.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_data_lib.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_deferred_composite_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_effect_fxaa_frag.glsl SRC)
+data_to_c_simple(engines/workbench/shaders/workbench_effect_taa_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_forward_composite_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_forward_depth_frag.glsl SRC)
data_to_c_simple(engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl SRC)
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index d7c6684f086..d2400b8b651 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -128,16 +128,9 @@ static void eevee_cache_populate(void *vedata, Object *ob)
EEVEE_ViewLayerData *sldata = EEVEE_view_layer_data_ensure();
const DRWContextState *draw_ctx = DRW_context_state_get();
- const bool is_active = (ob == draw_ctx->obact);
bool cast_shadow = false;
- if (is_active) {
- if (DRW_object_is_mode_shade(ob) == true) {
- return;
- }
- }
-
- if (ob->base_flag & BASE_VISIBLED) {
+ if (ob->base_flag & BASE_VISIBLE) {
EEVEE_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
}
diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c
index 806fb65b8e8..e083c9b5eb5 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -45,7 +45,7 @@ void EEVEE_lookdev_cache_init(
StudioLight *sl = BKE_studiolight_find(v3d->shading.studio_light, STUDIOLIGHT_INTERNAL | STUDIOLIGHT_ORIENTATION_WORLD);
if ((sl->flag & STUDIOLIGHT_ORIENTATION_WORLD)) {
struct Gwn_Batch *geom = DRW_cache_fullscreen_quad_get();
- GPUTexture *tex;
+ GPUTexture *tex = NULL;
*grp = DRW_shgroup_create(shader, pass);
axis_angle_to_mat3_single(stl->g_data->studiolight_matrix, 'Z', v3d->shading.studiolight_rot_z);
@@ -59,15 +59,18 @@ void EEVEE_lookdev_cache_init(
if (!pinfo) {
/* Do not fadeout when doing probe rendering, only when drawing the background */
DRW_shgroup_uniform_float(*grp, "studioLightBackground", &v3d->shading.studiolight_background, 1);
-
- BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE);
- tex = sl->equirectangular_irradiance_gputexture;
+ if (v3d->shading.studiolight_background > 0.0f) {
+ BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE);
+ tex = sl->equirectangular_irradiance_gputexture;
+ }
}
else {
BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE);
tex = sl->equirectangular_radiance_gputexture;
}
- DRW_shgroup_uniform_texture(*grp, "image", tex);
+ if (tex != NULL) {
+ DRW_shgroup_uniform_texture(*grp, "image", tex);
+ }
/* Do we need to recalc the lightprobes? */
if (pinfo &&
diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c
index 1a5c26f1c31..5cc20adf961 100644
--- a/source/blender/draw/engines/eevee/eevee_materials.c
+++ b/source/blender/draw/engines/eevee/eevee_materials.c
@@ -1014,7 +1014,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
}
{
- DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_CLIP_PLANES | DRW_STATE_WIRE;
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_CLIP_PLANES | DRW_STATE_WIRE;
psl->material_pass = DRW_pass_create("Material Shader Pass", state);
}
diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c
index d24551976f9..c650a6945ac 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -145,7 +145,7 @@ void EEVEE_render_cache(
RE_engine_update_stats(engine, NULL, info);
bool cast_shadow = false;
- if (ob->base_flag & BASE_VISIBLED) {
+ if (ob->base_flag & BASE_VISIBLE) {
EEVEE_hair_cache_populate(vedata, sldata, ob, &cast_shadow);
}
diff --git a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
index 5c62cb19152..11c223a45d6 100644
--- a/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/ltc_lib.glsl
@@ -319,4 +319,3 @@ float ltc_evaluate_disk(vec3 N, vec3 V, mat3 Minv, vec3 disk_points[3])
return form_factor * diffuse_sphere_integral_cheap(avg_dir.z, form_factor);
#endif
}
-
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl
index 38f55015877..fafb164a694 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_cavity_frag.glsl
@@ -3,7 +3,6 @@ out vec4 fragColor;
uniform sampler2D depthBuffer;
uniform sampler2D colorBuffer;
uniform sampler2D normalBuffer;
-uniform sampler2D positionBuffer;
uniform vec2 invertedViewportSize;
uniform mat4 WinMatrix; /* inverse WinMatrix */
@@ -17,14 +16,14 @@ layout(std140) uniform samples_block {
vec4 ssao_samples[500];
};
-#define ssao_samples_num ssao_params.x
-#define jitter_tilling ssao_params.yz
-#define dfdy_sign ssao_params.w
+#define ssao_samples_num ssao_params.x
+#define jitter_tilling ssao_params.yz
+#define ssao_iteration ssao_params.w
-#define ssao_distance ssao_settings.x
-#define ssao_factor_cavity ssao_settings.y
-#define ssao_factor_edge ssao_settings.z
-#define ssao_attenuation ssao_settings.a
+#define ssao_distance ssao_settings.x
+#define ssao_factor_cavity ssao_settings.y
+#define ssao_factor_edge ssao_settings.z
+#define ssao_attenuation ssao_settings.a
vec3 get_view_space_from_depth(in vec2 uvcoords, in float depth)
{
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl
index da0198ab2e7..7b77139fb6c 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_cavity_lib.glsl
@@ -24,19 +24,24 @@ void ssao_factors(
/* convert from -1.0...1.0 range to 0.0..1.0 for easy use with texture coordinates */
offset *= 0.5;
+
int num_samples = int(ssao_samples_num);
/* Note. Putting noise usage here to put some ALU after texture fetch. */
vec2 rotX = noise.rg;
vec2 rotY = vec2(-rotX.y, rotX.x);
- for (int x = 0; x < num_samples && x < 500; x++) {
+ for (int x = 0; x < num_samples; x++) {
+ int sample_index = x + (int(ssao_iteration) * num_samples);
+ if (sample_index > 500) {
+ continue;
+ }
/* ssao_samples[x].xy is sample direction (normalized).
* ssao_samples[x].z is sample distance from disk center. */
/* Rotate with random direction to get jittered result. */
- vec2 dir_jittered = vec2(dot(ssao_samples[x].xy, rotX), dot(ssao_samples[x].xy, rotY));
- dir_jittered.xy *= ssao_samples[x].z + noise.b;
+ vec2 dir_jittered = vec2(dot(ssao_samples[sample_index].xy, rotX), dot(ssao_samples[sample_index].xy, rotY));
+ dir_jittered.xy *= ssao_samples[sample_index].z + noise.b;
vec2 uvcoords = screenco.xy + dir_jittered * offset;
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl
index 2d913c63b00..99bacea4b27 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl
@@ -15,9 +15,3 @@ struct WorldData {
float background_alpha;
int pad[1];
};
-
-struct MaterialData {
- vec4 diffuse_color;
- vec4 specular_color;
- float roughness;
-};
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl
new file mode 100644
index 00000000000..1da1b2ad13c
--- /dev/null
+++ b/source/blender/draw/engines/workbench/shaders/workbench_effect_taa_frag.glsl
@@ -0,0 +1,14 @@
+uniform sampler2D historyBuffer;
+uniform sampler2D colorBuffer;
+
+out vec4 colorOutput;
+
+uniform float mixFactor;
+
+void main()
+{
+ ivec2 texel = ivec2(gl_FragCoord.xy);
+ vec4 color_buffer = texelFetch(colorBuffer, texel, 0);
+ vec4 history_buffer = texelFetch(historyBuffer, texel, 0);
+ colorOutput = mix(history_buffer, color_buffer, mixFactor);
+}
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_forward_depth_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_forward_depth_frag.glsl
index 450cb3e680b..9380044f2b9 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_forward_depth_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_forward_depth_frag.glsl
@@ -1,8 +1,20 @@
uniform int object_id = 0;
layout(location=0) out uint objectId;
+uniform float ImageTransparencyCutoff = 0.1;
+#ifdef V3D_SHADING_TEXTURE_COLOR
+uniform sampler2D image;
+
+in vec2 uv_interp;
+#endif
void main()
{
+#ifdef V3D_SHADING_TEXTURE_COLOR
+ vec4 diffuse_color = texture(image, uv_interp);
+ if (diffuse_color.a < ImageTransparencyCutoff) {
+ discard;
+ }
+#endif
+
objectId = uint(object_id);
}
-
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl
index 4a7d195a56a..81b6b2567a9 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_forward_transparent_accum_frag.glsl
@@ -1,5 +1,7 @@
-#ifdef OB_TEXTURE
+#ifdef V3D_SHADING_TEXTURE_COLOR
uniform sampler2D image;
+uniform float ImageTransparencyCutoff = 0.1;
+
#endif
uniform mat4 ProjectionMatrix;
uniform mat3 normalWorldMatrix;
@@ -7,10 +9,14 @@ uniform float alpha = 0.5;
uniform vec2 invertedViewportSize;
uniform vec4 viewvecs[3];
+uniform vec4 materialDiffuseColor;
+uniform vec4 materialSpecularColor;
+uniform float materialRoughness;
+
#ifdef NORMAL_VIEWPORT_PASS_ENABLED
in vec3 normal_viewport;
#endif /* NORMAL_VIEWPORT_PASS_ENABLED */
-#ifdef OB_TEXTURE
+#ifdef V3D_SHADING_TEXTURE_COLOR
in vec2 uv_interp;
#endif
#ifdef STUDIOLIGHT_ORIENTATION_VIEWNORMAL
@@ -21,10 +27,6 @@ layout(std140) uniform world_block {
WorldData world_data;
};
-layout(std140) uniform material_block {
- MaterialData material_data;
-};
-
layout(location=0) out vec4 transparentAccum;
layout(location=1) out float revealageAccum; /* revealage actually stored in transparentAccum.a */
@@ -32,12 +34,15 @@ void main()
{
vec4 diffuse_color;
vec3 diffuse_light = vec3(1.0);
-#ifdef OB_SOLID
- diffuse_color = material_data.diffuse_color;
-#endif /* OB_SOLID */
-#ifdef OB_TEXTURE
+
+#ifdef V3D_SHADING_TEXTURE_COLOR
diffuse_color = texture(image, uv_interp);
-#endif /* OB_TEXTURE */
+ if (diffuse_color.a < ImageTransparencyCutoff) {
+ discard;
+ }
+#else
+ diffuse_color = materialDiffuseColor;
+#endif /* V3D_SHADING_TEXTURE_COLOR */
vec2 uv_viewport = gl_FragCoord.xy * invertedViewportSize;
vec3 I_vs = view_vector_from_screen_uv(uv_viewport, viewvecs, ProjectionMatrix);
@@ -53,7 +58,7 @@ void main()
#endif
#ifdef V3D_SHADING_SPECULAR_HIGHLIGHT
- vec3 specular_color = get_world_specular_lights(world_data, vec4(material_data.specular_color.rgb, material_data.roughness), nor, I_vs);
+ vec3 specular_color = get_world_specular_lights(world_data, vec4(materialSpecularColor.rgb, materialRoughness), nor, I_vs);
#else
vec3 specular_color = vec3(0.0);
#endif
@@ -80,4 +85,3 @@ void main()
transparentAccum = vec4(shaded_color * weight, alpha);
revealageAccum = weight;
}
-
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
index 200850e3036..62c7e4515cd 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_frag.glsl
@@ -1,20 +1,22 @@
uniform int object_id = 0;
-layout(std140) uniform material_block {
- MaterialData material_data;
-};
+uniform vec4 materialDiffuseColor;
+uniform vec4 materialSpecularColor;
+uniform float materialRoughness;
-#ifdef OB_TEXTURE
+#ifdef V3D_SHADING_TEXTURE_COLOR
uniform sampler2D image;
+uniform float ImageTransparencyCutoff = 0.1;
+
#endif
#ifdef NORMAL_VIEWPORT_PASS_ENABLED
in vec3 normal_viewport;
#endif /* NORMAL_VIEWPORT_PASS_ENABLED */
-#ifdef OB_TEXTURE
+#ifdef V3D_SHADING_TEXTURE_COLOR
in vec2 uv_interp;
-#endif /* OB_TEXTURE */
+#endif /* V3D_SHADING_TEXTURE_COLOR */
#ifdef HAIR_SHADER
flat in float hair_rand;
@@ -40,24 +42,26 @@ void main()
n = normalize(n);
#endif
-#ifdef OB_SOLID
- diffuseColor = vec4(material_data.diffuse_color.rgb, 0.0);
+#ifdef V3D_SHADING_TEXTURE_COLOR
+ diffuseColor = texture(image, uv_interp);
+ if (diffuseColor.a < ImageTransparencyCutoff) {
+ discard;
+ }
+#else
+ diffuseColor = vec4(materialDiffuseColor.rgb, 0.0);
# ifdef STUDIOLIGHT_ORIENTATION_VIEWNORMAL
+ specularColor = vec4(materialDiffuseColor.rgb, 0.0);
- specularColor = vec4(material_data.diffuse_color.rgb, 0.0);
# endif
-#endif /* OB_SOLID */
+#endif /* V3D_SHADING_TEXTURE_COLOR */
-#ifdef OB_TEXTURE
- diffuseColor = texture(image, uv_interp);
-#endif /* OB_TEXTURE */
#ifdef HAIR_SHADER
float hair_color_variation = hair_rand * 0.1;
diffuseColor.rgb = clamp(diffuseColor.rgb - hair_color_variation, 0.0, 1.0);
#endif
#ifdef V3D_SHADING_SPECULAR_HIGHLIGHT
- specularColor = vec4(material_data.specular_color.rgb, material_data.roughness);
+ specularColor = vec4(materialSpecularColor.rgb, materialRoughness);
# ifdef HAIR_SHADER
specularColor.rgb = clamp(specularColor.rgb - hair_color_variation, 0.0, 1.0);
# endif
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
index 82443e7336b..66b529fcf5e 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_vert.glsl
@@ -9,7 +9,7 @@ in vec3 pos;
in vec3 nor;
in vec2 uv;
#else /* HAIR_SHADER */
-# ifdef OB_TEXTURE
+# ifdef V3D_SHADING_TEXTURE_COLOR
uniform samplerBuffer u; /* active texture layer */
# endif
flat out float hair_rand;
@@ -19,7 +19,7 @@ flat out float hair_rand;
out vec3 normal_viewport;
#endif
-#ifdef OB_TEXTURE
+#ifdef V3D_SHADING_TEXTURE_COLOR
out vec2 uv_interp;
#endif
@@ -34,7 +34,7 @@ float integer_noise(int n)
void main()
{
#ifdef HAIR_SHADER
-# ifdef OB_TEXTURE
+# ifdef V3D_SHADING_TEXTURE_COLOR
vec2 uv = hair_get_customdata_vec2(u);
# endif
float time, thick_time, thickness;
@@ -55,7 +55,7 @@ void main()
#else
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
#endif
-#ifdef OB_TEXTURE
+#ifdef V3D_SHADING_TEXTURE_COLOR
uv_interp = uv;
#endif
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
index b13c4f1b43b..3eda4455487 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_world_light_lib.glsl
@@ -7,17 +7,40 @@ vec3 spherical_harmonics(vec3 N, vec3 spherical_harmonics_coefs[STUDIOLIGHT_SPHE
sh += 0.282095 * spherical_harmonics_coefs[0];
#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 0
- sh += -0.488603 * N.z * spherical_harmonics_coefs[1];
- sh += 0.488603 * N.y * spherical_harmonics_coefs[2];
- sh += -0.488603 * N.x * spherical_harmonics_coefs[3];
+ float nx = N.x;
+ float ny = N.y;
+ float nz = N.z;
+ sh += -0.488603 * nz * spherical_harmonics_coefs[1];
+ sh += 0.488603 * ny * spherical_harmonics_coefs[2];
+ sh += -0.488603 * nx * spherical_harmonics_coefs[3];
#endif
#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 1
- sh += 1.092548 * N.x * N.z * spherical_harmonics_coefs[4];
- sh += -1.092548 * N.z * N.y * spherical_harmonics_coefs[5];
- sh += 0.315392 * (3.0 * N.y * N.y - 1.0) * spherical_harmonics_coefs[6];
- sh += -1.092548 * N.x * N.y * spherical_harmonics_coefs[7];
- sh += 0.546274 * (N.x * N.x - N.z * N.z) * spherical_harmonics_coefs[8];
+ float nx2 = nx * nx;
+ float ny2 = ny * ny;
+ float nz2 = nz * nz;
+
+ sh += 1.092548 * nx * nz * spherical_harmonics_coefs[4];
+ sh += -1.092548 * nz * ny * spherical_harmonics_coefs[5];
+ sh += 0.315392 * (3.0 * ny2 - 1.0) * spherical_harmonics_coefs[6];
+ sh += -1.092548 * nx * ny * spherical_harmonics_coefs[7];
+ sh += 0.546274 * (nx2 - nz2) * spherical_harmonics_coefs[8];
+#endif
+
+#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL > 3
+ float nx4 = nx2 * nx2;
+ float ny4 = ny2 * ny2;
+ float nz4 = nz2 * nz2;
+
+ sh += (2.5033429417967046 * nx * nz * (nx2 - nz2)) * spherical_harmonics_coefs[9];
+ sh += (-1.7701307697799304 * nz * ny * (3.0 * nx2 - nz2)) * spherical_harmonics_coefs[10];
+ sh += (0.9461746957575601 * nz * nx * (-1.0 +7.0*ny2)) * spherical_harmonics_coefs[11];
+ sh += (-0.6690465435572892 * nz * ny * (-3.0 + 7.0 * ny2)) * spherical_harmonics_coefs[12];
+ sh += ((105.0*ny4-90.0*ny2+9.0)/28.359261614) * spherical_harmonics_coefs[13];
+ sh += (-0.6690465435572892 * nx * ny * (-3.0 + 7.0 * ny2)) * spherical_harmonics_coefs[14];
+ sh += (0.9461746957575601 * (nx2 - nz2) * (-1.0 + 7.0 * ny2)) * spherical_harmonics_coefs[15];
+ sh += (-1.7701307697799304 * nx * ny * (nx2 - 3.0 * nz2)) * spherical_harmonics_coefs[16];
+ sh += (0.6258357354491761 * (nx4 - 6.0 * nz2 * nx2 + nz4)) * spherical_harmonics_coefs[17];
#endif
return sh;
diff --git a/source/blender/draw/engines/workbench/solid_mode.c b/source/blender/draw/engines/workbench/solid_mode.c
index 1e49d1ae573..b28263d48cf 100644
--- a/source/blender/draw/engines/workbench/solid_mode.c
+++ b/source/blender/draw/engines/workbench/solid_mode.c
@@ -76,6 +76,12 @@ static void workbench_solid_engine_free(void)
workbench_deferred_engine_free();
}
+static void workbench_solid_view_update(void *vedata)
+{
+ WORKBENCH_Data *data = vedata;
+ workbench_taa_view_updated(data);
+}
+
static const DrawEngineDataSize workbench_data_size = DRW_VIEWPORT_DATA_SIZE(WORKBENCH_Data);
DrawEngineType draw_engine_workbench_solid = {
@@ -89,8 +95,7 @@ DrawEngineType draw_engine_workbench_solid = {
&workbench_solid_cache_finish,
&workbench_solid_draw_background,
&workbench_solid_draw_scene,
- NULL,
+ &workbench_solid_view_update,
NULL,
NULL,
};
-
diff --git a/source/blender/draw/engines/workbench/transparent_mode.c b/source/blender/draw/engines/workbench/transparent_mode.c
index c5d3db4b390..3c4f7796c2b 100644
--- a/source/blender/draw/engines/workbench/transparent_mode.c
+++ b/source/blender/draw/engines/workbench/transparent_mode.c
@@ -93,4 +93,3 @@ DrawEngineType draw_engine_workbench_transparent = {
NULL,
NULL,
};
-
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index efadf969830..0f0d879aae8 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -5,6 +5,12 @@
#include "UI_resources.h"
+void workbench_effect_info_init(WORKBENCH_EffectInfo *effect_info)
+{
+ effect_info->jitter_index = 0;
+ effect_info->view_updated = true;
+}
+
void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
@@ -15,7 +21,6 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
View3D *v3d = draw_ctx->v3d;
if (v3d) {
wpd->shading = v3d->shading;
- wpd->drawtype = v3d->drawtype;
if (wpd->shading.light == V3D_LIGHTING_MATCAP) {
wpd->studio_light = BKE_studiolight_find(
wpd->shading.matcap, STUDIOLIGHT_ORIENTATION_VIEWNORMAL);
@@ -30,7 +35,6 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
wpd->shading.light = V3D_LIGHTING_STUDIO;
wpd->shading.shadow_intensity = 0.5;
copy_v3_fl(wpd->shading.single_color, 0.8f);
- wpd->drawtype = OB_SOLID;
wpd->studio_light = BKE_studiolight_find_first(STUDIOLIGHT_INTERNAL);
}
wpd->shadow_multiplier = 1.0 - wpd->shading.shadow_intensity;
@@ -67,7 +71,6 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
const int ssao_samples = scene->display.matcap_ssao_samples;
float invproj[4][4];
- float dfdyfacs[2];
const bool is_persp = DRW_viewport_is_persp_get();
/* view vectors for the corners of the view frustum.
* Can be used to recreate the world space position easily */
@@ -79,12 +82,10 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
int i;
const float *size = DRW_viewport_size_get();
- DRW_state_dfdy_factors_get(dfdyfacs);
-
wpd->ssao_params[0] = ssao_samples;
wpd->ssao_params[1] = size[0] / 64.0;
wpd->ssao_params[2] = size[1] / 64.0;
- wpd->ssao_params[3] = dfdyfacs[1]; /* dfdy sign for offscreen */
+ wpd->ssao_params[3] = 0;
/* distance, factor, factor, attenuation */
copy_v4_fl4(wpd->ssao_settings, scene->display.matcap_ssao_distance, wpd->shading.cavity_valley_factor, wpd->shading.cavity_ridge_factor, scene->display.matcap_ssao_attenuation);
@@ -158,15 +159,8 @@ void workbench_private_data_get_light_direction(WORKBENCH_PrivateData *wpd, floa
DRW_uniformbuffer_update(wpd->world_ubo, wd);
}
-static void workbench_private_material_free(void *data)
-{
- WORKBENCH_MaterialData *material_data = data;
- DRW_UBO_FREE_SAFE(material_data->material_ubo);
- MEM_freeN(material_data);
-}
-
void workbench_private_data_free(WORKBENCH_PrivateData *wpd)
{
- BLI_ghash_free(wpd->material_hash, NULL, workbench_private_material_free);
+ BLI_ghash_free(wpd->material_hash, NULL, MEM_freeN);
DRW_UBO_FREE_SAFE(wpd->world_ubo);
}
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index 9b1a17a372a..1307f1c4446 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -65,7 +65,6 @@ static struct {
struct GPUShader *shadow_pass_manifold_sh;
struct GPUShader *shadow_caps_sh;
struct GPUShader *shadow_caps_manifold_sh;
- struct GPUShader *effect_fxaa_sh;
struct GPUTexture *object_id_tx; /* ref only, not alloced */
struct GPUTexture *color_buffer_tx; /* ref only, not alloced */
@@ -73,7 +72,6 @@ static struct {
struct GPUTexture *specular_buffer_tx; /* ref only, not alloced */
struct GPUTexture *normal_buffer_tx; /* ref only, not alloced */
struct GPUTexture *composite_buffer_tx; /* ref only, not alloced */
- struct GPUTexture *effect_buffer_tx; /* ref only, not alloced */
SceneDisplay display; /* world light direction for shadows */
int next_object_id;
@@ -85,8 +83,6 @@ static struct {
} e_data = {{NULL}};
/* Shaders */
-extern char datatoc_common_fxaa_lib_glsl[];
-extern char datatoc_common_fullscreen_vert_glsl[];
extern char datatoc_common_hair_lib_glsl[];
extern char datatoc_workbench_prepass_vert_glsl[];
@@ -103,7 +99,6 @@ extern char datatoc_workbench_background_lib_glsl[];
extern char datatoc_workbench_cavity_lib_glsl[];
extern char datatoc_workbench_common_lib_glsl[];
extern char datatoc_workbench_data_lib_glsl[];
-extern char datatoc_workbench_effect_fxaa_frag_glsl[];
extern char datatoc_workbench_object_outline_lib_glsl[];
extern char datatoc_workbench_world_light_lib_glsl[];
@@ -175,17 +170,17 @@ static char *workbench_build_cavity_frag(void)
return str;
}
-static void ensure_deferred_shaders(WORKBENCH_PrivateData *wpd, int index, int drawtype, bool is_hair)
+static void ensure_deferred_shaders(WORKBENCH_PrivateData *wpd, int index, bool use_textures, bool is_hair)
{
if (e_data.prepass_sh_cache[index] == NULL) {
- char *defines = workbench_material_build_defines(wpd, drawtype, is_hair);
+ char *defines = workbench_material_build_defines(wpd, use_textures, is_hair);
char *composite_frag = workbench_build_composite_frag(wpd);
char *prepass_vert = workbench_build_prepass_vert();
char *prepass_frag = workbench_build_prepass_frag();
e_data.prepass_sh_cache[index] = DRW_shader_create(
prepass_vert, NULL,
prepass_frag, defines);
- if (drawtype == OB_SOLID && !is_hair) {
+ if (!use_textures && !is_hair) {
e_data.composite_sh_cache[index] = DRW_shader_create_fullscreen(composite_frag, defines);
}
MEM_freeN(prepass_vert);
@@ -197,15 +192,15 @@ static void ensure_deferred_shaders(WORKBENCH_PrivateData *wpd, int index, int d
static void select_deferred_shaders(WORKBENCH_PrivateData *wpd)
{
- int index_solid = workbench_material_get_shader_index(wpd, OB_SOLID, false);
- int index_solid_hair = workbench_material_get_shader_index(wpd, OB_SOLID, true);
- int index_texture = workbench_material_get_shader_index(wpd, OB_TEXTURE, false);
- int index_texture_hair = workbench_material_get_shader_index(wpd, OB_TEXTURE, true);
+ int index_solid = workbench_material_get_shader_index(wpd, false, false);
+ int index_solid_hair = workbench_material_get_shader_index(wpd, false, true);
+ int index_texture = workbench_material_get_shader_index(wpd, true, false);
+ int index_texture_hair = workbench_material_get_shader_index(wpd, true, true);
- ensure_deferred_shaders(wpd, index_solid, OB_SOLID, false);
- ensure_deferred_shaders(wpd, index_solid_hair, OB_SOLID, true);
- ensure_deferred_shaders(wpd, index_texture, OB_TEXTURE, false);
- ensure_deferred_shaders(wpd, index_texture_hair, OB_TEXTURE, true);
+ ensure_deferred_shaders(wpd, index_solid, false, false);
+ ensure_deferred_shaders(wpd, index_solid_hair, false, true);
+ ensure_deferred_shaders(wpd, index_texture, true, false);
+ ensure_deferred_shaders(wpd, index_texture_hair, true, true);
wpd->prepass_solid_sh = e_data.prepass_sh_cache[index_solid];
wpd->prepass_solid_hair_sh = e_data.prepass_sh_cache[index_solid_hair];
@@ -216,18 +211,20 @@ static void select_deferred_shaders(WORKBENCH_PrivateData *wpd)
/* Using Hammersley distribution */
-static float *create_disk_samples(int num_samples)
+static float *create_disk_samples(int num_samples, int num_iterations)
{
/* vec4 to ensure memory alignment. */
- float (*texels)[4] = MEM_mallocN(sizeof(float[4]) * num_samples, "concentric_tex");
+ const int total_samples = num_samples * num_iterations;
+ float(*texels)[4] = MEM_mallocN(sizeof(float[4]) * total_samples, __func__);
const float num_samples_inv = 1.0f / num_samples;
- for (int i = 0; i < num_samples; i++) {
- float r = (i + 0.5f) * num_samples_inv;
+ for (int i = 0; i < total_samples; i++) {
+ float it_add = (i / num_samples) * 0.499f;
+ float r = fmodf((i + 0.5f + it_add) * num_samples_inv, 1.0f);
double dphi;
BLI_hammersley_1D(i, &dphi);
- float phi = (float)dphi * 2.0f * M_PI;
+ float phi = (float)dphi * 2.0f * M_PI + it_add;
texels[i][0] = cosf(phi);
texels[i][1] = sinf(phi);
/* This deliberatly distribute more samples
@@ -275,6 +272,15 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
WORKBENCH_PassList *psl = vedata->psl;
DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+ if (!stl->g_data) {
+ /* Alloc transient pointers */
+ stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
+ }
+ if (!stl->effects) {
+ stl->effects = MEM_callocN(sizeof(*stl->effects), __func__);
+ workbench_effect_info_init(stl->effects);
+ }
+
if (!e_data.next_object_id) {
memset(e_data.prepass_sh_cache, 0x00, sizeof(struct GPUShader *) * MAX_SHADERS);
memset(e_data.composite_sh_cache, 0x00, sizeof(struct GPUShader *) * MAX_SHADERS);
@@ -322,17 +328,10 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
e_data.cavity_sh = DRW_shader_create_fullscreen(cavity_frag, NULL);
MEM_freeN(cavity_frag);
- e_data.effect_fxaa_sh = DRW_shader_create_with_lib(
- datatoc_common_fullscreen_vert_glsl, NULL,
- datatoc_workbench_effect_fxaa_frag_glsl,
- datatoc_common_fxaa_lib_glsl,
- NULL);
}
+ workbench_fxaa_engine_init();
+ workbench_taa_engine_init(vedata);
- if (!stl->g_data) {
- /* Alloc transient pointers */
- stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
- }
WORKBENCH_PrivateData *wpd = stl->g_data;
workbench_private_data_init(wpd);
@@ -346,8 +345,6 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
e_data.specular_buffer_tx = DRW_texture_pool_query_2D(size[0], size[1], GPU_RGBA8, &draw_engine_workbench_solid);
e_data.composite_buffer_tx = DRW_texture_pool_query_2D(
size[0], size[1], GPU_RGBA16F, &draw_engine_workbench_solid);
- e_data.effect_buffer_tx = DRW_texture_pool_query_2D(
- size[0], size[1], GPU_RGBA16F, &draw_engine_workbench_solid);
if (NORMAL_ENCODING_ENABLED()) {
e_data.normal_buffer_tx = DRW_texture_pool_query_2D(
@@ -375,7 +372,7 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
});
GPU_framebuffer_ensure_config(&fbl->effect_fb, {
GPU_ATTACHMENT_NONE,
- GPU_ATTACHMENT_TEXTURE(e_data.effect_buffer_tx),
+ GPU_ATTACHMENT_TEXTURE(e_data.color_buffer_tx),
});
}
@@ -383,14 +380,18 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
/* AO Samples Tex */
- const int ssao_samples = scene->display.matcap_ssao_samples;
+ int num_iterations = workbench_taa_calculate_num_iterations(vedata);
+
+ const int ssao_samples_single_iteration = scene->display.matcap_ssao_samples;
+ const int ssao_samples = MIN2(num_iterations * ssao_samples_single_iteration, 500);
+
if (e_data.sampling_ubo && (e_data.cached_sample_num != ssao_samples)) {
DRW_UBO_FREE_SAFE(e_data.sampling_ubo);
DRW_TEXTURE_FREE_SAFE(e_data.jitter_tx);
}
if (e_data.sampling_ubo == NULL) {
- float *samples = create_disk_samples(ssao_samples);
+ float *samples = create_disk_samples(ssao_samples_single_iteration, num_iterations);
e_data.jitter_tx = create_jitter_texture(ssao_samples);
e_data.sampling_ubo = DRW_uniformbuffer_create(sizeof(float[4]) * ssao_samples, samples);
e_data.cached_sample_num = ssao_samples;
@@ -406,6 +407,10 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
}
{
+ workbench_aa_create_pass(vedata, &e_data.color_buffer_tx);
+ }
+
+ {
int state = DRW_STATE_WRITE_COLOR;
psl->cavity_pass = DRW_pass_create("Cavity", state);
DRWShadingGroup *grp = DRW_shgroup_create(e_data.cavity_sh, psl->cavity_pass);
@@ -422,17 +427,9 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
DRW_shgroup_uniform_block(grp, "samples_block", e_data.sampling_ubo);
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
}
-
- {
- psl->effect_fxaa_pass = DRW_pass_create("Effect FXAA", DRW_STATE_WRITE_COLOR);
- DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_fxaa_sh, psl->effect_fxaa_pass);
- DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", &e_data.effect_buffer_tx);
- DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
- DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
- }
}
-void workbench_deferred_engine_free()
+void workbench_deferred_engine_free(void)
{
for (int index = 0; index < MAX_SHADERS; index++) {
DRW_SHADER_FREE_SAFE(e_data.prepass_sh_cache[index]);
@@ -449,7 +446,8 @@ void workbench_deferred_engine_free()
DRW_SHADER_FREE_SAFE(e_data.shadow_caps_sh);
DRW_SHADER_FREE_SAFE(e_data.shadow_caps_manifold_sh);
- DRW_SHADER_FREE_SAFE(e_data.effect_fxaa_sh);
+ workbench_fxaa_engine_free();
+ workbench_taa_engine_free();
}
static void workbench_composite_uniforms(WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp)
@@ -557,7 +555,7 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata)
}
static WORKBENCH_MaterialData *get_or_create_material_data(
- WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int drawtype)
+ WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int color_type)
{
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PassList *psl = vedata->psl;
@@ -570,7 +568,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
/* Solid */
workbench_material_update_data(wpd, ob, mat, &material_template);
material_template.object_id = OBJECT_ID_PASS_ENABLED(wpd) ? engine_object_data->object_id : 1;
- material_template.drawtype = drawtype;
+ material_template.color_type = color_type;
material_template.ima = ima;
uint hash = workbench_material_get_hash(&material_template);
@@ -578,26 +576,11 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
if (material == NULL) {
material = MEM_mallocN(sizeof(WORKBENCH_MaterialData), __func__);
material->shgrp = DRW_shgroup_create(
- drawtype == OB_SOLID ? wpd->prepass_solid_sh : wpd->prepass_texture_sh, psl->prepass_pass);
+ color_type == V3D_SHADING_TEXTURE_COLOR ? wpd->prepass_texture_sh: wpd->prepass_solid_sh, psl->prepass_pass);
+ workbench_material_copy(material, &material_template);
DRW_shgroup_stencil_mask(material->shgrp, 0xFF);
- material->object_id = material_template.object_id;
- copy_v4_v4(material->material_data.diffuse_color, material_template.material_data.diffuse_color);
- copy_v4_v4(material->material_data.specular_color, material_template.material_data.specular_color);
- material->material_data.roughness = material_template.material_data.roughness;
- switch (drawtype) {
- case OB_SOLID:
- break;
-
- case OB_TEXTURE:
- {
- GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0);
- DRW_shgroup_uniform_texture(material->shgrp, "image", tex);
- break;
- }
- }
DRW_shgroup_uniform_int(material->shgrp, "object_id", &material->object_id, 1);
- material->material_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_Material), &material->material_data);
- DRW_shgroup_uniform_block(material->shgrp, "material_block", material->material_ubo);
+ workbench_material_shgroup_uniform(wpd, material->shgrp, material);
BLI_ghash_insert(wpd->material_hash, SET_UINT_IN_POINTER(hash), material);
}
@@ -630,32 +613,20 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o
if (draw_as == PART_DRAW_PATH) {
Image *image = NULL;
Material *mat = give_current_material(ob, part->omat);
- int mat_drawtype = OB_SOLID;
+ ED_object_get_active_image(ob, part->omat, &image, NULL, NULL, NULL);
+ int color_type = workbench_material_determine_color_type(wpd, image);
+ WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, color_type);
- if (wpd->drawtype == OB_TEXTURE) {
- ED_object_get_active_image(ob, part->omat, &image, NULL, NULL, NULL);
- /* use OB_SOLID when no texture could be determined */
- if (image) {
- mat_drawtype = OB_TEXTURE;
- }
- }
-
- WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, mat_drawtype);
-
- struct GPUShader *shader = (mat_drawtype == OB_SOLID)
- ? wpd->prepass_solid_hair_sh
- : wpd->prepass_texture_hair_sh;
+ struct GPUShader *shader = (color_type != V3D_SHADING_TEXTURE_COLOR) ?
+ wpd->prepass_solid_hair_sh :
+ wpd->prepass_texture_hair_sh;
DRWShadingGroup *shgrp = DRW_shgroup_hair_create(
- ob, psys, md,
- psl->prepass_hair_pass,
- shader);
+ ob, psys, md,
+ psl->prepass_hair_pass,
+ shader);
DRW_shgroup_stencil_mask(shgrp, 0xFF);
DRW_shgroup_uniform_int(shgrp, "object_id", &material->object_id, 1);
- DRW_shgroup_uniform_block(shgrp, "material_block", material->material_ubo);
- if (image) {
- GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, 0.0f);
- DRW_shgroup_uniform_texture(shgrp, "image", tex);
- }
+ workbench_material_shgroup_uniform(wpd, shgrp, material);
}
}
}
@@ -682,7 +653,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
const bool is_active = (ob == draw_ctx->obact);
const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0;
bool is_drawn = false;
- if (!is_sculpt_mode && wpd->drawtype == OB_TEXTURE && ELEM(ob->type, OB_MESH)) {
+ if (!is_sculpt_mode && TEXTURE_DRAWING_ENABLED(wpd) && ELEM(ob->type, OB_MESH)) {
const Mesh *me = ob->data;
if (me->mloopuv) {
const int materials_len = MAX2(1, (is_sculpt_mode ? 1 : ob->totcol));
@@ -697,12 +668,8 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
Material *mat = give_current_material(ob, i + 1);
Image *image;
ED_object_get_active_image(ob, i + 1, &image, NULL, NULL, NULL);
- /* use OB_SOLID when no texture could be determined */
- int mat_drawtype = OB_SOLID;
- if (image) {
- mat_drawtype = OB_TEXTURE;
- }
- material = get_or_create_material_data(vedata, ob, mat, image, mat_drawtype);
+ int color_type = workbench_material_determine_color_type(wpd, image);
+ material = get_or_create_material_data(vedata, ob, mat, image, color_type);
DRW_shgroup_call_object_add(material->shgrp, geom_array[i], ob);
}
is_drawn = true;
@@ -712,11 +679,11 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
/* Fallback from not drawn OB_TEXTURE mode or just OB_SOLID mode */
if (!is_drawn) {
- if ((wpd->shading.color_type != V3D_SHADING_MATERIAL_COLOR)) {
+ if (ELEM(wpd->shading.color_type, V3D_SHADING_SINGLE_COLOR, V3D_SHADING_RANDOM_COLOR)) {
/* No material split needed */
struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
- material = get_or_create_material_data(vedata, ob, NULL, NULL, OB_SOLID);
+ material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type);
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
}
@@ -741,7 +708,7 @@ void workbench_deferred_solid_cache_populate(WORKBENCH_Data *vedata, Object *ob)
}
Material *mat = give_current_material(ob, i + 1);
- material = get_or_create_material_data(vedata, ob, mat, NULL, OB_SOLID);
+ material = get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR);
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
}
@@ -855,6 +822,10 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata)
WORKBENCH_PrivateData *wpd = stl->g_data;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
+ if (TAA_ENABLED(wpd)) {
+ workbench_taa_draw_scene_start(vedata);
+ }
+
/* clear in background */
GPU_framebuffer_bind(fbl->prepass_fb);
DRW_draw_pass(psl->prepass_pass);
@@ -889,21 +860,6 @@ void workbench_deferred_draw_scene(WORKBENCH_Data *vedata)
DRW_draw_pass(psl->composite_pass);
}
- if (FXAA_ENABLED(wpd)) {
- GPU_framebuffer_bind(fbl->effect_fb);
- DRW_transform_to_display(e_data.composite_buffer_tx);
-
- /* TODO: when rendering the fxaa pass should be done in display space
- Currently we do not support rendering in the workbench
- */
- GPU_framebuffer_bind(dfbl->color_only_fb);
- DRW_draw_pass(psl->effect_fxaa_pass);
- }
- else {
- GPU_framebuffer_bind(dfbl->color_only_fb);
- DRW_transform_to_display(e_data.composite_buffer_tx);
- }
-
-
+ workbench_aa_draw_pass(vedata, e_data.composite_buffer_tx);
workbench_private_data_free(wpd);
}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_aa.c b/source/blender/draw/engines/workbench/workbench_effect_aa.c
new file mode 100644
index 00000000000..95a81649522
--- /dev/null
+++ b/source/blender/draw/engines/workbench/workbench_effect_aa.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2016, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Institute
+ *
+ */
+
+/** \file workbench_effect_aa.c
+ * \ingroup draw_engine
+ */
+
+#include "workbench_private.h"
+
+
+void workbench_aa_create_pass(WORKBENCH_Data *vedata, GPUTexture **tx)
+{
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_PrivateData *wpd = stl->g_data;
+ WORKBENCH_PassList *psl = vedata->psl;
+ WORKBENCH_EffectInfo *effect_info = stl->effects;
+
+ if (TAA_ENABLED(wpd)) {
+ psl->effect_aa_pass = workbench_taa_create_pass(vedata, tx);
+ }
+ else if (FXAA_ENABLED(wpd)) {
+ psl->effect_aa_pass = workbench_fxaa_create_pass(tx);
+ effect_info->jitter_index = 0;
+ }
+ else {
+ psl->effect_aa_pass = NULL;
+ }
+}
+
+void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx)
+{
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_PrivateData *wpd = stl->g_data;
+ WORKBENCH_FramebufferList *fbl = vedata->fbl;
+ WORKBENCH_PassList *psl = vedata->psl;
+ WORKBENCH_EffectInfo *effect_info = stl->effects;
+
+ DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
+ if (FXAA_ENABLED(wpd)) {
+ GPU_framebuffer_bind(fbl->effect_fb);
+ DRW_transform_to_display(tx);
+ GPU_framebuffer_bind(dfbl->color_only_fb);
+ DRW_draw_pass(psl->effect_aa_pass);
+ }
+ else if (TAA_ENABLED(wpd)) {
+ /*
+ * when drawing the first TAA frame, we transform directly to the
+ * color_only_fb as the TAA shader is just performing a direct copy.
+ * the workbench_taa_draw_screen_end will fill the history buffer
+ * for the other iterations.
+ */
+ if (effect_info->jitter_index == 1)
+ {
+ GPU_framebuffer_bind(dfbl->color_only_fb);
+ DRW_transform_to_display(tx);
+ }
+ else {
+ GPU_framebuffer_bind(fbl->effect_fb);
+ DRW_transform_to_display(tx);
+ GPU_framebuffer_bind(dfbl->color_only_fb);
+ DRW_draw_pass(psl->effect_aa_pass);
+ }
+ workbench_taa_draw_scene_end(vedata);
+ }
+ else {
+ GPU_framebuffer_bind(dfbl->color_only_fb);
+ DRW_transform_to_display(tx);
+ }
+}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_fxaa.c b/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
new file mode 100644
index 00000000000..1beb35e6440
--- /dev/null
+++ b/source/blender/draw/engines/workbench/workbench_effect_fxaa.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2016, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Institute
+ *
+ */
+
+/** \file workbench_effect_fxaa.c
+ * \ingroup draw_engine
+ */
+#include "workbench_private.h"
+
+/* *********** STATIC *********** */
+static struct {
+ struct GPUShader *effect_fxaa_sh;
+} e_data = {NULL};
+
+/* Shaders */
+extern char datatoc_common_fxaa_lib_glsl[];
+extern char datatoc_common_fullscreen_vert_glsl[];
+extern char datatoc_workbench_effect_fxaa_frag_glsl[];
+
+/* *********** Functions *********** */
+void workbench_fxaa_engine_init(void)
+{
+ if (e_data.effect_fxaa_sh == NULL) {
+ e_data.effect_fxaa_sh = DRW_shader_create_with_lib(
+ datatoc_common_fullscreen_vert_glsl, NULL,
+ datatoc_workbench_effect_fxaa_frag_glsl,
+ datatoc_common_fxaa_lib_glsl,
+ NULL);
+ }
+}
+
+DRWPass *workbench_fxaa_create_pass(GPUTexture **color_buffer_tx)
+{
+ DRWPass *pass = DRW_pass_create("Effect FXAA", DRW_STATE_WRITE_COLOR);
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_fxaa_sh, pass);
+ DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", color_buffer_tx);
+ DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
+ DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
+ return pass;
+}
+
+void workbench_fxaa_engine_free(void)
+{
+ DRW_SHADER_FREE_SAFE(e_data.effect_fxaa_sh);
+}
diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c
new file mode 100644
index 00000000000..0b4cc0a4e5b
--- /dev/null
+++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c
@@ -0,0 +1,292 @@
+/*
+ * Copyright 2016, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Institute
+ *
+ */
+
+/** \file workbench_effect_taa.c
+ * \ingroup draw_engine
+ */
+
+
+#include "workbench_private.h"
+#include "BLI_jitter_2d.h"
+
+static struct {
+ struct GPUShader *effect_taa_sh;
+ float jitter_8[8][2];
+ float jitter_16[16][2];
+ float jitter_32[32][2];
+} e_data = {NULL};
+
+extern char datatoc_workbench_effect_taa_frag_glsl[];
+
+
+static void workbench_taa_jitter_init_order(float (*table)[2], int num)
+{
+ BLI_jitter_init(table, num);
+
+ /* find closest element to center */
+ int closest_index = 0;
+ float closest_squared_distance = 1.0f;
+
+ for (int index = 0; index < num; index++) {
+ const float squared_dist = SQUARE(table[index][0]) + SQUARE(table[index][1]);
+ if (squared_dist < closest_squared_distance) {
+ closest_squared_distance = squared_dist;
+ closest_index = index;
+ }
+ }
+
+ /* move jitter table so that closest sample is in center */
+ for (int index = 0; index < num; index++) {
+ sub_v2_v2(table[index], table[closest_index]);
+ mul_v2_fl(table[index], 2.0f);
+ }
+
+ /* swap center sample to the start of the table */
+ if (closest_index != 0) {
+ swap_v2_v2(table[0], table[closest_index]);
+ }
+
+ /* sort list based on furtest distance with previous */
+ for (int i = 0; i < num - 2; i++) {
+ float f_squared_dist = 0.0;
+ int f_index = i;
+ for (int j = i + 1; j < num; j++) {
+ const float squared_dist = SQUARE(table[i][0] - table[j][0]) + SQUARE(table[i][1] - table[j][1]);
+ if (squared_dist > f_squared_dist) {
+ f_squared_dist = squared_dist;
+ f_index = j;
+ }
+ }
+ swap_v2_v2(table[i + 1], table[f_index]);
+ }
+}
+
+
+static void workbench_taa_jitter_init(void)
+{
+ workbench_taa_jitter_init_order(e_data.jitter_8, 8);
+ workbench_taa_jitter_init_order(e_data.jitter_16, 16);
+ workbench_taa_jitter_init_order(e_data.jitter_32, 32);
+}
+
+int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata)
+{
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_PrivateData *wpd = stl->g_data;
+ int result = 1;
+ if (TAA_ENABLED(wpd)) {
+ if (IN_RANGE_INCL(
+ wpd->user_preferences->gpu_viewport_quality,
+ GPU_VIEWPORT_QUALITY_TAA8, GPU_VIEWPORT_QUALITY_TAA16))
+ {
+ result = 8;
+ }
+ else if (IN_RANGE_INCL(
+ wpd->user_preferences->gpu_viewport_quality,
+ GPU_VIEWPORT_QUALITY_TAA16, GPU_VIEWPORT_QUALITY_TAA32))
+ {
+ result = 16;
+ }
+ else
+ {
+ result = 32;
+ }
+ }
+ return result;
+}
+
+void workbench_taa_engine_init(WORKBENCH_Data *vedata)
+{
+ WORKBENCH_EffectInfo *effect_info = vedata->stl->effects;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ RegionView3D *rv3d = draw_ctx->rv3d;
+
+ if (e_data.effect_taa_sh == NULL) {
+ e_data.effect_taa_sh = DRW_shader_create_fullscreen(datatoc_workbench_effect_taa_frag_glsl, NULL);
+ workbench_taa_jitter_init();
+ }
+
+ /* reset complete drawing when navigating. */
+ if (effect_info->jitter_index != 0) {
+ if (rv3d && rv3d->rflag & RV3D_NAVIGATING) {
+ effect_info->jitter_index = 0;
+ }
+ }
+
+ if (effect_info->view_updated) {
+ effect_info->jitter_index = 0;
+ effect_info->view_updated = false;
+ }
+
+ {
+ float view[4][4];
+ float win[4][4];
+ DRW_viewport_matrix_get(view, DRW_MAT_VIEW);
+ DRW_viewport_matrix_get(win, DRW_MAT_WIN);
+ mul_m4_m4m4(effect_info->curr_mat, view, win);
+ if (!equals_m4m4(effect_info->curr_mat, effect_info->last_mat)) {
+ effect_info->jitter_index = 0;
+ }
+ }
+}
+
+void workbench_taa_engine_free(void)
+{
+ DRW_SHADER_FREE_SAFE(e_data.effect_taa_sh);
+}
+
+
+DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_buffer_tx)
+{
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_TextureList *txl = vedata->txl;
+ WORKBENCH_EffectInfo *effect_info = stl->effects;
+ WORKBENCH_FramebufferList *fbl = vedata->fbl;
+ WORKBENCH_PrivateData *wpd = stl->g_data;
+ /*
+ * jitter_index is not updated yet. This will be done in during draw phase.
+ * so for now it is inversed.
+ */
+ int previous_jitter_index = effect_info->jitter_index;
+
+ {
+ DRW_texture_ensure_fullscreen_2D(&txl->history_buffer_tx, GPU_RGBA16F, 0);
+ DRW_texture_ensure_fullscreen_2D(&txl->depth_buffer_tx, GPU_DEPTH24_STENCIL8, 0);
+ }
+
+ {
+ GPU_framebuffer_ensure_config(&fbl->effect_taa_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(txl->history_buffer_tx),
+ });
+ GPU_framebuffer_ensure_config(&fbl->depth_buffer_fb, {
+ GPU_ATTACHMENT_TEXTURE(txl->depth_buffer_tx),
+ });
+ }
+
+
+ DRWPass *pass = DRW_pass_create("Effect TAA", DRW_STATE_WRITE_COLOR);
+ DRWShadingGroup *grp = DRW_shgroup_create(e_data.effect_taa_sh, pass);
+ DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", color_buffer_tx);
+ DRW_shgroup_uniform_texture_ref(grp, "historyBuffer", &txl->history_buffer_tx);
+ DRW_shgroup_uniform_float(grp, "mixFactor", &effect_info->taa_mix_factor, 1);
+ DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
+
+ /*
+ * Set the offset for the cavity shader so every iteration different
+ * samples will be selected
+ */
+ wpd->ssao_params[3] = previous_jitter_index;
+
+ return pass;
+}
+
+void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata)
+{
+ WORKBENCH_StorageList *stl = vedata->stl;
+ WORKBENCH_EffectInfo *effect_info = stl->effects;
+ const float *viewport_size = DRW_viewport_size_get();
+ int num_samples = 8;
+ float (*samples)[2];
+ float mix_factor;
+
+ num_samples = workbench_taa_calculate_num_iterations(vedata);
+ switch (num_samples) {
+ default:
+ case 8:
+ samples = e_data.jitter_8;
+ break;
+ case 16:
+ samples = e_data.jitter_16;
+ break;
+ case 32:
+ samples = e_data.jitter_32;
+ break;
+ }
+
+ mix_factor = 1.0f / (effect_info->jitter_index + 1);
+
+ const int bitmask = num_samples - 1;
+ const int jitter_index = effect_info->jitter_index;
+ const float *transform_offset = samples[jitter_index];
+ effect_info->jitter_index = (jitter_index + 1) & bitmask;
+
+ /* construct new matrices from transform delta */
+ float viewmat[4][4];
+ float persmat[4][4];
+ DRW_viewport_matrix_get(viewmat, DRW_MAT_VIEW);
+ DRW_viewport_matrix_get(persmat, DRW_MAT_PERS);
+ DRW_viewport_matrix_get(effect_info->override_winmat, DRW_MAT_WIN);
+
+ window_translate_m4(
+ effect_info->override_winmat, persmat,
+ transform_offset[0] / viewport_size[0],
+ transform_offset[1] / viewport_size[1]);
+
+ mul_m4_m4m4(effect_info->override_persmat, effect_info->override_winmat, viewmat);
+ invert_m4_m4(effect_info->override_persinv, effect_info->override_persmat);
+ invert_m4_m4(effect_info->override_wininv, effect_info->override_winmat);
+
+ DRW_viewport_matrix_override_set(effect_info->override_persmat, DRW_MAT_PERS);
+ DRW_viewport_matrix_override_set(effect_info->override_persinv, DRW_MAT_PERSINV);
+ DRW_viewport_matrix_override_set(effect_info->override_winmat, DRW_MAT_WIN);
+ DRW_viewport_matrix_override_set(effect_info->override_wininv, DRW_MAT_WININV);
+
+ /* weight the mix factor by the jitter index */
+ effect_info->taa_mix_factor = mix_factor;
+}
+
+void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata)
+{
+ /*
+ * If first frame than the offset is 0.0 and its depth is the depth buffer to use
+ * for the rest of the draw engines. We store it in a persistent buffer.
+ *
+ * If it is not the first frame we copy the persistent buffer back to the
+ * default depth buffer
+ */
+ const WORKBENCH_StorageList *stl = vedata->stl;
+ const WORKBENCH_FramebufferList *fbl = vedata->fbl;
+ const DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
+ WORKBENCH_EffectInfo *effect_info = stl->effects;
+
+ if (effect_info->jitter_index == 1) {
+ GPU_framebuffer_blit(dfbl->depth_only_fb, 0, fbl->depth_buffer_fb, 0, GPU_DEPTH_BIT);
+ }
+ else {
+ GPU_framebuffer_blit(fbl->depth_buffer_fb, 0, dfbl->depth_only_fb, 0, GPU_DEPTH_BIT);
+ }
+
+ GPU_framebuffer_blit(dfbl->color_only_fb, 0, fbl->effect_taa_fb, 0, GPU_COLOR_BIT);
+
+ DRW_viewport_matrix_override_unset_all();
+
+ copy_m4_m4(effect_info->last_mat, effect_info->curr_mat);
+ if (effect_info->jitter_index != 0) {
+ DRW_viewport_request_redraw();
+ }
+}
+
+void workbench_taa_view_updated(WORKBENCH_Data *vedata)
+{
+ WORKBENCH_EffectInfo *effect_info = vedata->stl->effects;
+ effect_info->view_updated = true;
+}
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index db07f9bb6f5..76172443c2d 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -51,6 +51,7 @@ static struct {
struct GPUShader *composite_sh_cache[MAX_SHADERS];
struct GPUShader *transparent_accum_sh_cache[MAX_SHADERS];
struct GPUShader *object_outline_sh;
+ struct GPUShader *object_outline_texture_sh;
struct GPUShader *object_outline_hair_sh;
struct GPUShader *checker_depth_sh;
@@ -58,12 +59,14 @@ static struct {
struct GPUTexture *transparent_accum_tx; /* ref only, not alloced */
struct GPUTexture *transparent_revealage_tx; /* ref only, not alloced */
struct GPUTexture *composite_buffer_tx; /* ref only, not alloced */
+
int next_object_id;
float normal_world_matrix[3][3];
} e_data = {{NULL}};
/* Shaders */
extern char datatoc_common_hair_lib_glsl[];
+
extern char datatoc_workbench_forward_composite_frag_glsl[];
extern char datatoc_workbench_forward_depth_frag_glsl[];
extern char datatoc_workbench_forward_transparent_accum_frag_glsl[];
@@ -76,20 +79,6 @@ extern char datatoc_workbench_common_lib_glsl[];
extern char datatoc_workbench_world_light_lib_glsl[];
/* static functions */
-static char *workbench_build_forward_depth_frag(void)
-{
- char *str = NULL;
-
- DynStr *ds = BLI_dynstr_new();
-
- BLI_dynstr_append(ds, datatoc_workbench_common_lib_glsl);
- BLI_dynstr_append(ds, datatoc_workbench_forward_depth_frag_glsl);
-
- str = BLI_dynstr_get_cstring(ds);
- BLI_dynstr_free(ds);
- return str;
-}
-
static char *workbench_build_forward_vert(void)
{
char *str = NULL;
@@ -144,7 +133,7 @@ static void workbench_init_object_data(ObjectEngineData *engine_data)
}
static WORKBENCH_MaterialData *get_or_create_material_data(
- WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int drawtype)
+ WORKBENCH_Data *vedata, Object *ob, Material *mat, Image *ima, int color_type)
{
WORKBENCH_StorageList *stl = vedata->stl;
WORKBENCH_PassList *psl = vedata->psl;
@@ -158,7 +147,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
/* Solid */
workbench_material_update_data(wpd, ob, mat, &material_template);
material_template.object_id = OBJECT_ID_PASS_ENABLED(wpd) ? engine_object_data->object_id : 1;
- material_template.drawtype = drawtype;
+ material_template.color_type = color_type;
material_template.ima = ima;
uint hash = workbench_material_get_hash(&material_template);
@@ -168,42 +157,34 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
/* transparent accum */
grp = DRW_shgroup_create(
- drawtype == OB_SOLID ? wpd->transparent_accum_sh : wpd->transparent_accum_texture_sh,
+ color_type == V3D_SHADING_TEXTURE_COLOR ? wpd->transparent_accum_texture_sh: wpd->transparent_accum_sh,
psl->transparent_accum_pass);
DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
DRW_shgroup_uniform_float(grp, "alpha", &wpd->shading.xray_alpha, 1);
DRW_shgroup_uniform_vec4(grp, "viewvecs[0]", (float *)wpd->viewvecs, 3);
workbench_material_set_normal_world_matrix(grp, wpd, e_data.normal_world_matrix);
- material->object_id = engine_object_data->object_id;
- copy_v4_v4(material->material_data.diffuse_color, material_template.material_data.diffuse_color);
- copy_v4_v4(material->material_data.specular_color, material_template.material_data.specular_color);
- material->material_data.roughness = material_template.material_data.roughness;
- switch (drawtype) {
- case OB_SOLID:
- {
- if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
- BKE_studiolight_ensure_flag(wpd->studio_light, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE);
- DRW_shgroup_uniform_texture(grp, "matcapImage", wpd->studio_light->equirectangular_radiance_gputexture);
- }
- if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || MATCAP_ENABLED(wpd)) {
- DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
- }
- break;
- }
-
- case OB_TEXTURE:
- {
- GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f);
- DRW_shgroup_uniform_texture(grp, "image", tex);
- break;
- }
+ workbench_material_copy(material, &material_template);
+ if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
+ BKE_studiolight_ensure_flag(wpd->studio_light, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE);
+ DRW_shgroup_uniform_texture(grp, "matcapImage", wpd->studio_light->equirectangular_radiance_gputexture);
+ }
+ if (SPECULAR_HIGHLIGHT_ENABLED(wpd) || MATCAP_ENABLED(wpd)) {
+ DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
}
- material->material_ubo = DRW_uniformbuffer_create(sizeof(WORKBENCH_UBO_Material), &material->material_data);
- DRW_shgroup_uniform_block(grp, "material_block", material->material_ubo);
+
+ workbench_material_shgroup_uniform(wpd, grp, material);
material->shgrp = grp;
/* Depth */
- material->shgrp_object_outline = DRW_shgroup_create(e_data.object_outline_sh, psl->object_outline_pass);
+ if (workbench_material_determine_color_type(wpd, material->ima) == V3D_SHADING_TEXTURE_COLOR)
+ {
+ material->shgrp_object_outline = DRW_shgroup_create(e_data.object_outline_texture_sh, psl->object_outline_pass);
+ GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false, 0.0f);
+ DRW_shgroup_uniform_texture(material->shgrp_object_outline, "image", tex);
+ }
+ else {
+ material->shgrp_object_outline = DRW_shgroup_create(e_data.object_outline_sh, psl->object_outline_pass);
+ }
material->object_id = engine_object_data->object_id;
DRW_shgroup_uniform_int(material->shgrp_object_outline, "object_id", &material->object_id, 1);
BLI_ghash_insert(wpd->material_hash, SET_UINT_IN_POINTER(hash), material);
@@ -211,10 +192,10 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
return material;
}
-static void ensure_forward_shaders(WORKBENCH_PrivateData *wpd, int index, int drawtype, bool is_hair)
+static void ensure_forward_shaders(WORKBENCH_PrivateData *wpd, int index, bool use_textures, bool is_hair)
{
- if (e_data.composite_sh_cache[index] == NULL && drawtype == OB_SOLID && !is_hair) {
- char *defines = workbench_material_build_defines(wpd, drawtype, is_hair);
+ if (e_data.composite_sh_cache[index] == NULL && !use_textures && !is_hair) {
+ char *defines = workbench_material_build_defines(wpd, use_textures, is_hair);
char *composite_frag = workbench_build_forward_composite_frag();
e_data.composite_sh_cache[index] = DRW_shader_create_fullscreen(composite_frag, defines);
MEM_freeN(composite_frag);
@@ -222,7 +203,7 @@ static void ensure_forward_shaders(WORKBENCH_PrivateData *wpd, int index, int dr
}
if (e_data.transparent_accum_sh_cache[index] == NULL) {
- char *defines = workbench_material_build_defines(wpd, drawtype, is_hair);
+ char *defines = workbench_material_build_defines(wpd, use_textures, is_hair);
char *transparent_accum_vert = workbench_build_forward_vert();
char *transparent_accum_frag = workbench_build_forward_transparent_accum_frag();
e_data.transparent_accum_sh_cache[index] = DRW_shader_create(
@@ -236,15 +217,15 @@ static void ensure_forward_shaders(WORKBENCH_PrivateData *wpd, int index, int dr
static void select_forward_shaders(WORKBENCH_PrivateData *wpd)
{
- int index_solid = workbench_material_get_shader_index(wpd, OB_SOLID, false);
- int index_solid_hair = workbench_material_get_shader_index(wpd, OB_SOLID, true);
- int index_texture = workbench_material_get_shader_index(wpd, OB_TEXTURE, false);
- int index_texture_hair = workbench_material_get_shader_index(wpd, OB_TEXTURE, true);
+ int index_solid = workbench_material_get_shader_index(wpd, false, false);
+ int index_solid_hair = workbench_material_get_shader_index(wpd, false, true);
+ int index_texture = workbench_material_get_shader_index(wpd, true, false);
+ int index_texture_hair = workbench_material_get_shader_index(wpd, true, true);
- ensure_forward_shaders(wpd, index_solid, OB_SOLID, false);
- ensure_forward_shaders(wpd, index_solid_hair, OB_SOLID, true);
- ensure_forward_shaders(wpd, index_texture, OB_TEXTURE, false);
- ensure_forward_shaders(wpd, index_texture_hair, OB_TEXTURE, true);
+ ensure_forward_shaders(wpd, index_solid, false, false);
+ ensure_forward_shaders(wpd, index_solid_hair, false, true);
+ ensure_forward_shaders(wpd, index_texture, true, false);
+ ensure_forward_shaders(wpd, index_texture_hair, true, true);
wpd->composite_sh = e_data.composite_sh_cache[index_solid];
wpd->transparent_accum_sh = e_data.transparent_accum_sh_cache[index_solid];
@@ -266,6 +247,10 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
/* Alloc transient pointers */
stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
}
+ if (!stl->effects) {
+ stl->effects = MEM_mallocN(sizeof(*stl->effects), __func__);
+ workbench_effect_info_init(stl->effects);
+ }
WORKBENCH_PrivateData *wpd = stl->g_data;
workbench_private_data_init(wpd);
float light_direction[3];
@@ -276,24 +261,31 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
memset(e_data.composite_sh_cache, 0x00, sizeof(struct GPUShader *) * MAX_SHADERS);
memset(e_data.transparent_accum_sh_cache, 0x00, sizeof(struct GPUShader *) * MAX_SHADERS);
- char *defines = workbench_material_build_defines(wpd, OB_SOLID, false);
- char *defines_hair = workbench_material_build_defines(wpd, OB_SOLID, true);
+ char *defines = workbench_material_build_defines(wpd, false, false);
+ char *defines_texture = workbench_material_build_defines(wpd, true, false);
+ char *defines_hair = workbench_material_build_defines(wpd, false, true);
char *forward_vert = workbench_build_forward_vert();
- char *forward_depth_frag = workbench_build_forward_depth_frag();
e_data.object_outline_sh = DRW_shader_create(
forward_vert, NULL,
- forward_depth_frag, defines);
+ datatoc_workbench_forward_depth_frag_glsl, defines);
+ e_data.object_outline_texture_sh = DRW_shader_create(
+ forward_vert, NULL,
+ datatoc_workbench_forward_depth_frag_glsl, defines_texture);
e_data.object_outline_hair_sh = DRW_shader_create(
forward_vert, NULL,
- forward_depth_frag, defines_hair);
+ datatoc_workbench_forward_depth_frag_glsl, defines_hair);
+
e_data.checker_depth_sh = DRW_shader_create_fullscreen(
datatoc_workbench_checkerboard_depth_frag_glsl, NULL);
MEM_freeN(forward_vert);
- MEM_freeN(forward_depth_frag);
MEM_freeN(defines);
+ MEM_freeN(defines_texture);
MEM_freeN(defines_hair);
}
+ workbench_fxaa_engine_init();
+ workbench_taa_engine_init(vedata);
+
select_forward_shaders(wpd);
const float *viewport_size = DRW_viewport_size_get();
@@ -323,6 +315,10 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
GPU_ATTACHMENT_NONE,
GPU_ATTACHMENT_TEXTURE(e_data.composite_buffer_tx),
});
+ GPU_framebuffer_ensure_config(&fbl->effect_fb, {
+ GPU_ATTACHMENT_NONE,
+ GPU_ATTACHMENT_TEXTURE(e_data.transparent_accum_tx),
+ });
/* Transparency Accum */
{
@@ -340,13 +336,20 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata)
psl->composite_pass = DRW_pass_create("Composite", state);
grp = DRW_shgroup_create(wpd->composite_sh, psl->composite_pass);
- DRW_shgroup_uniform_texture_ref(grp, "objectId", &e_data.object_id_tx);
+ if (OBJECT_ID_PASS_ENABLED(wpd)) {
+ DRW_shgroup_uniform_texture_ref(grp, "objectId", &e_data.object_id_tx);
+ }
DRW_shgroup_uniform_texture_ref(grp, "transparentAccum", &e_data.transparent_accum_tx);
DRW_shgroup_uniform_texture_ref(grp, "transparentRevealage", &e_data.transparent_revealage_tx);
DRW_shgroup_uniform_block(grp, "world_block", wpd->world_ubo);
DRW_shgroup_uniform_vec2(grp, "invertedViewportSize", DRW_viewport_invert_size_get(), 1);
DRW_shgroup_call_add(grp, DRW_cache_fullscreen_quad_get(), NULL);
}
+
+ {
+ workbench_aa_create_pass(vedata, &e_data.transparent_accum_tx);
+ }
+
/* Checker Depth */
{
int state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS;
@@ -364,8 +367,11 @@ void workbench_forward_engine_free()
DRW_SHADER_FREE_SAFE(e_data.transparent_accum_sh_cache[index]);
}
DRW_SHADER_FREE_SAFE(e_data.object_outline_sh);
+ DRW_SHADER_FREE_SAFE(e_data.object_outline_texture_sh);
DRW_SHADER_FREE_SAFE(e_data.object_outline_hair_sh);
DRW_SHADER_FREE_SAFE(e_data.checker_depth_sh);
+
+ workbench_fxaa_engine_free();
}
void workbench_forward_cache_init(WORKBENCH_Data *UNUSED(vedata))
@@ -399,19 +405,11 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
if (draw_as == PART_DRAW_PATH) {
Image *image = NULL;
Material *mat = give_current_material(ob, part->omat);
- int mat_drawtype = OB_SOLID;
-
- if (wpd->drawtype == OB_TEXTURE) {
- ED_object_get_active_image(ob, part->omat, &image, NULL, NULL, NULL);
- /* use OB_SOLID when no texture could be determined */
- if (image) {
- mat_drawtype = OB_TEXTURE;
- }
- }
-
- WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, mat_drawtype);
+ ED_object_get_active_image(ob, part->omat, &image, NULL, NULL, NULL);
+ int color_type = workbench_material_determine_color_type(wpd, image);
+ WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, mat, image, color_type);
- struct GPUShader *shader = (mat_drawtype == OB_SOLID)
+ struct GPUShader *shader = (color_type != V3D_SHADING_TEXTURE_COLOR)
? wpd->transparent_accum_hair_sh
: wpd->transparent_accum_texture_hair_sh;
DRWShadingGroup *shgrp = DRW_shgroup_hair_create(
@@ -420,16 +418,12 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
shader);
workbench_material_set_normal_world_matrix(shgrp, wpd, e_data.normal_world_matrix);
DRW_shgroup_uniform_block(shgrp, "world_block", wpd->world_ubo);
- DRW_shgroup_uniform_block(shgrp, "material_block", material->material_ubo);
+ workbench_material_shgroup_uniform(wpd, shgrp, material);
DRW_shgroup_uniform_vec4(shgrp, "viewvecs[0]", (float *)wpd->viewvecs, 3);
/* Hairs have lots of layer and can rapidly become the most prominent surface.
* So lower their alpha artificially. */
float hair_alpha = wpd->shading.xray_alpha * 0.33f;
DRW_shgroup_uniform_float_copy(shgrp, "alpha", hair_alpha);
- if (image) {
- GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, 0.0f);
- DRW_shgroup_uniform_texture(shgrp, "image", tex);
- }
if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
BKE_studiolight_ensure_flag(wpd->studio_light, STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE);
DRW_shgroup_uniform_texture(shgrp, "matcapImage", wpd->studio_light->equirectangular_radiance_gputexture);
@@ -461,14 +455,14 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
return;
}
+ WORKBENCH_MaterialData *material;
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) {
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool is_active = (ob == draw_ctx->obact);
const bool is_sculpt_mode = is_active && (draw_ctx->object_mode & OB_MODE_SCULPT) != 0;
bool is_drawn = false;
- WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, ob, NULL, NULL, OB_SOLID);
- if (!is_sculpt_mode && wpd->drawtype == OB_TEXTURE && ELEM(ob->type, OB_MESH)) {
+ if (!is_sculpt_mode && TEXTURE_DRAWING_ENABLED(wpd) && ELEM(ob->type, OB_MESH)) {
const Mesh *me = ob->data;
if (me->mloopuv) {
const int materials_len = MAX2(1, (is_sculpt_mode ? 1 : ob->totcol));
@@ -484,11 +478,16 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
Image *image;
ED_object_get_active_image(ob, i + 1, &image, NULL, NULL, NULL);
/* use OB_SOLID when no texture could be determined */
- int mat_drawtype = OB_SOLID;
- if (image) {
- mat_drawtype = OB_TEXTURE;
+
+ int color_type = wpd->shading.color_type;
+ if (color_type == V3D_SHADING_TEXTURE_COLOR) {
+ /* use OB_SOLID when no texture could be determined */
+ if (image == NULL) {
+ color_type = V3D_SHADING_MATERIAL_COLOR;
+ }
}
- material = get_or_create_material_data(vedata, ob, mat, image, mat_drawtype);
+
+ material = get_or_create_material_data(vedata, ob, mat, image, color_type);
DRW_shgroup_call_object_add(material->shgrp_object_outline, geom_array[i], ob);
DRW_shgroup_call_object_add(material->shgrp, geom_array[i], ob);
}
@@ -499,10 +498,11 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
/* Fallback from not drawn OB_TEXTURE mode or just OB_SOLID mode */
if (!is_drawn) {
- if ((wpd->shading.color_type != V3D_SHADING_MATERIAL_COLOR)) {
+ if (ELEM(wpd->shading.color_type, V3D_SHADING_SINGLE_COLOR, V3D_SHADING_RANDOM_COLOR)) {
/* No material split needed */
struct Gwn_Batch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
+ material = get_or_create_material_data(vedata, ob, NULL, NULL, wpd->shading.color_type);
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp_object_outline, ob, ob->obmat);
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
@@ -529,7 +529,7 @@ void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob)
}
Material *mat = give_current_material(ob, i + 1);
- material = get_or_create_material_data(vedata, ob, mat, NULL, OB_SOLID);
+ material = get_or_create_material_data(vedata, ob, mat, NULL, V3D_SHADING_MATERIAL_COLOR);
if (is_sculpt_mode) {
DRW_shgroup_call_sculpt_add(material->shgrp_object_outline, ob, ob->obmat);
DRW_shgroup_call_sculpt_add(material->shgrp, ob, ob->obmat);
@@ -567,6 +567,10 @@ void workbench_forward_draw_scene(WORKBENCH_Data *vedata)
WORKBENCH_PrivateData *wpd = stl->g_data;
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
+ if (TAA_ENABLED(wpd)) {
+ workbench_taa_draw_scene_start(vedata);
+ }
+
/* Write Depth + Object ID */
const float clear_outline[4] = {0.0f};
GPU_framebuffer_bind(fbl->object_outline_fb);
@@ -591,10 +595,10 @@ void workbench_forward_draw_scene(WORKBENCH_Data *vedata)
GPU_framebuffer_bind(fbl->composite_fb);
DRW_draw_pass(psl->composite_pass);
- /* Color correct */
- GPU_framebuffer_bind(dfbl->color_only_fb);
- DRW_transform_to_display(e_data.composite_buffer_tx);
+ /* Color correct and Anti aliasing */
+ workbench_aa_draw_pass(vedata, e_data.composite_buffer_tx);
+ /* Apply checker pattern */
GPU_framebuffer_bind(dfbl->depth_only_fb);
DRW_draw_pass(psl->checker_depth_pass);
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index c0857cf74aa..6755bf82ecd 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -2,6 +2,8 @@
#include "workbench_private.h"
+#include "BIF_gl.h"
+
#include "BLI_dynstr.h"
#define HSV_SATURATION 0.5
@@ -9,16 +11,16 @@
void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Material *mat, WORKBENCH_MaterialData *data)
{
- /* When in OB_TEXTURE always uyse V3D_SHADING_MATERIAL_COLOR as fallback when no texture could be determined */
- int color_type = wpd->drawtype == OB_SOLID ? wpd->shading.color_type : V3D_SHADING_MATERIAL_COLOR;
+ /* When V3D_SHADING_TEXTURE_COLOR is active, use V3D_SHADING_MATERIAL_COLOR as fallback when no texture could be determined */
+ int color_type = wpd->shading.color_type == V3D_SHADING_TEXTURE_COLOR ? V3D_SHADING_MATERIAL_COLOR : wpd->shading.color_type;
static float default_diffuse_color[] = {0.8f, 0.8f, 0.8f, 1.0f};
static float default_specular_color[] = {0.5f, 0.5f, 0.5f, 0.5f};
- copy_v4_v4(data->material_data.diffuse_color, default_diffuse_color);
- copy_v4_v4(data->material_data.specular_color, default_specular_color);
- data->material_data.roughness = 0.5f;
+ copy_v4_v4(data->diffuse_color, default_diffuse_color);
+ copy_v4_v4(data->specular_color, default_specular_color);
+ data->roughness = 0.5f;
- if (DRW_object_is_paint_mode(ob) || color_type == V3D_SHADING_SINGLE_COLOR) {
- copy_v3_v3(data->material_data.diffuse_color, wpd->shading.single_color);
+ if (color_type == V3D_SHADING_SINGLE_COLOR) {
+ copy_v3_v3(data->diffuse_color, wpd->shading.single_color);
}
else if (color_type == V3D_SHADING_RANDOM_COLOR) {
uint hash = BLI_ghashutil_strhash_p_murmur(ob->id.name);
@@ -28,19 +30,19 @@ void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Mate
float offset = fmodf((hash / 100000.0) * M_GOLDEN_RATION_CONJUGATE, 1.0);
float hsv[3] = {offset, HSV_SATURATION, HSV_VALUE};
- hsv_to_rgb_v(hsv, data->material_data.diffuse_color);
+ hsv_to_rgb_v(hsv, data->diffuse_color);
}
else {
/* V3D_SHADING_MATERIAL_COLOR */
if (mat) {
- copy_v3_v3(data->material_data.diffuse_color, &mat->r);
- copy_v3_v3(data->material_data.specular_color, &mat->specr);
- data->material_data.roughness = mat->roughness;
+ copy_v3_v3(data->diffuse_color, &mat->r);
+ copy_v3_v3(data->specular_color, &mat->specr);
+ data->roughness = mat->roughness;
}
}
}
-char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, int drawtype, bool is_hair)
+char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_textures, bool is_hair)
{
char *str = NULL;
@@ -79,15 +81,9 @@ char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, int drawtype,
if (NORMAL_VIEWPORT_PASS_ENABLED(wpd)) {
BLI_dynstr_appendf(ds, "#define NORMAL_VIEWPORT_PASS_ENABLED\n");
}
- switch (drawtype) {
- case OB_SOLID:
- BLI_dynstr_appendf(ds, "#define OB_SOLID\n");
- break;
- case OB_TEXTURE:
- BLI_dynstr_appendf(ds, "#define OB_TEXTURE\n");
- break;
+ if (use_textures) {
+ BLI_dynstr_appendf(ds, "#define V3D_SHADING_TEXTURE_COLOR\n");
}
-
if (NORMAL_ENCODING_ENABLED()) {
BLI_dynstr_appendf(ds, "#define WORKBENCH_ENCODE_NORMALS\n");
}
@@ -104,7 +100,10 @@ char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, int drawtype,
#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL == 2
BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL 2\n");
#endif
- BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_SPHERICAL_HARMONICS_MAX_COMPONENTS 9\n");
+#if STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL == 4
+ BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_SPHERICAL_HARMONICS_LEVEL 4\n");
+#endif
+ BLI_dynstr_appendf(ds, "#define STUDIOLIGHT_SPHERICAL_HARMONICS_MAX_COMPONENTS 18\n");
str = BLI_dynstr_get_cstring(ds);
BLI_dynstr_free(ds);
@@ -115,33 +114,35 @@ uint workbench_material_get_hash(WORKBENCH_MaterialData *material_template)
{
uint input[4];
uint result;
- float *color = material_template->material_data.diffuse_color;
+ float *color = material_template->diffuse_color;
input[0] = (uint)(color[0] * 512);
input[1] = (uint)(color[1] * 512);
input[2] = (uint)(color[2] * 512);
input[3] = material_template->object_id;
result = BLI_ghashutil_uinthash_v4_murmur(input);
- color = material_template->material_data.specular_color;
+ color = material_template->specular_color;
input[0] = (uint)(color[0] * 512);
input[1] = (uint)(color[1] * 512);
input[2] = (uint)(color[2] * 512);
- input[3] = (uint)(material_template->material_data.roughness * 512);
+ input[3] = (uint)(material_template->roughness * 512);
result += BLI_ghashutil_uinthash_v4_murmur(input);
- if (material_template->drawtype == OB_TEXTURE) {
- /* add texture reference */
+ /* add texture reference */
+ if (material_template->ima)
+ {
result += BLI_ghashutil_inthash_p_murmur(material_template->ima);
}
+
return result;
}
-int workbench_material_get_shader_index(WORKBENCH_PrivateData *wpd, int drawtype, bool is_hair)
+int workbench_material_get_shader_index(WORKBENCH_PrivateData *wpd, bool use_textures, bool is_hair)
{
/* NOTE: change MAX_SHADERS accordingly when modifying this function. */
int index = 0;
- /* 1 bit OB_SOLID and OB_TEXTURE */
- SET_FLAG_FROM_TEST(index, drawtype == OB_TEXTURE, 1 << 0);
+ /* 1 bit V3D_SHADING_TEXTURE_COLOR */
+ SET_FLAG_FROM_TEST(index, use_textures, 1 << 0);
/* 2 bits FLAT/STUDIO/MATCAP/SCENE */
SET_FLAG_FROM_TEST(index, wpd->shading.light, wpd->shading.light << 1);
/* 1 bit V3D_SHADING_SPECULAR_HIGHLIGHT */
@@ -171,3 +172,38 @@ void workbench_material_set_normal_world_matrix(
DRW_shgroup_uniform_mat3(grp, "normalWorldMatrix", persistent_matrix);
}
}
+
+int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd, Image *ima)
+{
+ int color_type = wpd->shading.color_type;
+ if (color_type == V3D_SHADING_TEXTURE_COLOR && ima == NULL) {
+ color_type = V3D_SHADING_MATERIAL_COLOR;
+ }
+ return color_type;
+}
+
+void workbench_material_shgroup_uniform(WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp, WORKBENCH_MaterialData *material)
+{
+ if (workbench_material_determine_color_type(wpd, material->ima) == V3D_SHADING_TEXTURE_COLOR)
+ {
+ GPUTexture *tex = GPU_texture_from_blender(material->ima, NULL, GL_TEXTURE_2D, false, 0.0f);
+ DRW_shgroup_uniform_texture(grp, "image", tex);
+ }
+ else {
+ DRW_shgroup_uniform_vec4(grp, "materialDiffuseColor", material->diffuse_color, 1);
+ }
+
+ if (SPECULAR_HIGHLIGHT_ENABLED(wpd)) {
+ DRW_shgroup_uniform_vec4(grp, "materialSpecularColor", material->specular_color, 1);
+ DRW_shgroup_uniform_float(grp, "materialRoughness", &material->roughness, 1);
+ }
+}
+
+void workbench_material_copy(WORKBENCH_MaterialData *dest_material, const WORKBENCH_MaterialData *source_material)
+{
+ dest_material->object_id = source_material->object_id;
+ copy_v4_v4(dest_material->diffuse_color, source_material->diffuse_color);
+ copy_v4_v4(dest_material->specular_color, source_material->specular_color);
+ dest_material->roughness = source_material->roughness;
+ dest_material->ima = source_material->ima;
+}
diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h
index 68d50a85c35..3bec6bb6d53 100644
--- a/source/blender/draw/engines/workbench/workbench_private.h
+++ b/source/blender/draw/engines/workbench/workbench_private.h
@@ -41,29 +41,36 @@
#define M_GOLDEN_RATION_CONJUGATE 0.618033988749895
#define MAX_SHADERS (1 << 10)
-#define OB_SOLID_ENABLED(wpd) (wpd->drawtype & OB_SOLID)
-#define OB_TEXTURE_ENABLED(wpd) (wpd->drawtype & OB_TEXTURE)
+#define TEXTURE_DRAWING_ENABLED(wpd) (wpd->color_type & V3D_SHADING_TEXTURE_COLOR)
#define FLAT_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_FLAT)
#define STUDIOLIGHT_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_STUDIO)
-#define MATCAP_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_MATCAP && OB_SOLID_ENABLED(wpd))
+#define MATCAP_ENABLED(wpd) (wpd->shading.light == V3D_LIGHTING_MATCAP)
#define STUDIOLIGHT_ORIENTATION_WORLD_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_WORLD))
#define STUDIOLIGHT_ORIENTATION_CAMERA_ENABLED(wpd) (STUDIOLIGHT_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_CAMERA))
#define STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd) (MATCAP_ENABLED(wpd) && (wpd->studio_light->flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL))
#define CAVITY_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_CAVITY)
#define SHADOW_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_SHADOW)
-#define FXAA_ENABLED(wpd) (wpd->user_preferences->gpu_viewport_antialias & USER_AA_FXAA && (!DRW_state_is_opengl_render()))
+
+#define IS_NAVIGATING(wpd) (DRW_context_state_get()->rv3d->rflag & RV3D_NAVIGATING)
+#define FXAA_ENABLED(wpd) ((!DRW_state_is_opengl_render()) && (IN_RANGE(wpd->user_preferences->gpu_viewport_quality, GPU_VIEWPORT_QUALITY_FXAA, GPU_VIEWPORT_QUALITY_TAA8) || ((wpd->user_preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8) && IS_NAVIGATING(wpd))))
+#define TAA_ENABLED(wpd) (wpd->user_preferences->gpu_viewport_quality >= GPU_VIEWPORT_QUALITY_TAA8 && !IS_NAVIGATING(wpd))
#define SPECULAR_HIGHLIGHT_ENABLED(wpd) ((wpd->shading.flag & V3D_SHADING_SPECULAR_HIGHLIGHT) && (!STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)))
#define OBJECT_ID_PASS_ENABLED(wpd) (wpd->shading.flag & V3D_SHADING_OBJECT_OUTLINE)
#define NORMAL_VIEWPORT_COMP_PASS_ENABLED(wpd) (MATCAP_ENABLED(wpd) || STUDIOLIGHT_ENABLED(wpd) || SHADOW_ENABLED(wpd) || SPECULAR_HIGHLIGHT_ENABLED(wpd))
#define NORMAL_VIEWPORT_PASS_ENABLED(wpd) (NORMAL_VIEWPORT_COMP_PASS_ENABLED(wpd) || CAVITY_ENABLED(wpd))
#define NORMAL_ENCODING_ENABLED() (true)
+#define TEXTURE_DRAWING_ENABLED(wpd) (wpd->color_type & V3D_SHADING_TEXTURE_COLOR)
+
typedef struct WORKBENCH_FramebufferList {
/* Deferred render buffers */
struct GPUFrameBuffer *prepass_fb;
struct GPUFrameBuffer *cavity_fb;
struct GPUFrameBuffer *composite_fb;
+
struct GPUFrameBuffer *effect_fb;
+ struct GPUFrameBuffer *effect_taa_fb;
+ struct GPUFrameBuffer *depth_buffer_fb;
/* Forward render buffers */
struct GPUFrameBuffer *object_outline_fb;
@@ -71,8 +78,14 @@ typedef struct WORKBENCH_FramebufferList {
struct GPUFrameBuffer *transparent_revealage_fb;
} WORKBENCH_FramebufferList;
+typedef struct WORKBENCH_TextureList {
+ struct GPUTexture *history_buffer_tx;
+ struct GPUTexture *depth_buffer_tx;
+} WORKBENCH_TextureList;
+
typedef struct WORKBENCH_StorageList {
struct WORKBENCH_PrivateData *g_data;
+ struct WORKBENCH_EffectInfo *effects;
} WORKBENCH_StorageList;
typedef struct WORKBENCH_PassList {
@@ -88,7 +101,7 @@ typedef struct WORKBENCH_PassList {
struct DRWPass *shadow_depth_fail_caps_mani_pass;
struct DRWPass *composite_pass;
struct DRWPass *composite_shadow_pass;
- struct DRWPass *effect_fxaa_pass;
+ struct DRWPass *effect_aa_pass;
/* forward rendering */
struct DRWPass *transparent_accum_pass;
@@ -100,7 +113,7 @@ typedef struct WORKBENCH_PassList {
typedef struct WORKBENCH_Data {
void *engine_type;
WORKBENCH_FramebufferList *fbl;
- DRWViewportEmptyList *txl;
+ WORKBENCH_TextureList *txl;
WORKBENCH_PassList *psl;
WORKBENCH_StorageList *stl;
} WORKBENCH_Data;
@@ -125,13 +138,6 @@ typedef struct WORKBENCH_UBO_World {
} WORKBENCH_UBO_World;
BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_World, 16)
-typedef struct WORKBENCH_UBO_Material {
- float diffuse_color[4];
- float specular_color[4];
- float roughness;
- float pad[3];
-} WORKBENCH_UBO_Material;
-BLI_STATIC_ASSERT_ALIGN(WORKBENCH_UBO_Material, 16)
typedef struct WORKBENCH_PrivateData {
struct GHash *material_hash;
@@ -147,7 +153,7 @@ typedef struct WORKBENCH_PrivateData {
View3DShading shading;
StudioLight *studio_light;
UserDef *user_preferences;
- int drawtype;
+ int color_type;
struct GPUUniformBuffer *world_ubo;
struct DRWShadingGroup *shadow_shgrp;
struct DRWShadingGroup *depth_shgrp;
@@ -170,13 +176,24 @@ typedef struct WORKBENCH_PrivateData {
float ssao_settings[4];
} WORKBENCH_PrivateData; /* Transient data */
-typedef struct WORKBENCH_MaterialData {
- /* Solid color */
- WORKBENCH_UBO_Material material_data;
- struct GPUUniformBuffer *material_ubo;
+typedef struct WORKBENCH_EffectInfo {
+ float override_persmat[4][4];
+ float override_persinv[4][4];
+ float override_winmat[4][4];
+ float override_wininv[4][4];
+ float last_mat[4][4];
+ float curr_mat[4][4];
+ int jitter_index;
+ float taa_mix_factor;
+ bool view_updated;
+} WORKBENCH_EffectInfo;
+typedef struct WORKBENCH_MaterialData {
+ float diffuse_color[4];
+ float specular_color[4];
+ float roughness;
int object_id;
- int drawtype;
+ int color_type;
Image *ima;
/* Linked shgroup for drawing */
@@ -227,13 +244,34 @@ void workbench_forward_cache_init(WORKBENCH_Data *vedata);
void workbench_forward_cache_populate(WORKBENCH_Data *vedata, Object *ob);
void workbench_forward_cache_finish(WORKBENCH_Data *vedata);
+/* workbench_effect_aa.c */
+void workbench_aa_create_pass(WORKBENCH_Data *vedata, GPUTexture **tx);
+void workbench_aa_draw_pass(WORKBENCH_Data *vedata, GPUTexture *tx);
+
+/* workbench_effect_fxaa.c */
+void workbench_fxaa_engine_init(void);
+void workbench_fxaa_engine_free(void);
+DRWPass *workbench_fxaa_create_pass(GPUTexture **color_buffer_tx);
+
+/* workbench_effect_taa.c */
+void workbench_taa_engine_init(WORKBENCH_Data *vedata);
+void workbench_taa_engine_free(void);
+DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_buffer_tx);
+void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata);
+void workbench_taa_draw_scene_end(WORKBENCH_Data *vedata);
+void workbench_taa_view_updated(WORKBENCH_Data *vedata);
+int workbench_taa_calculate_num_iterations(WORKBENCH_Data *vedata);
+
/* workbench_materials.c */
-char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, int drawtype, bool is_hair);
+int workbench_material_determine_color_type(WORKBENCH_PrivateData *wpd, Image *ima);
+char *workbench_material_build_defines(WORKBENCH_PrivateData *wpd, bool use_textures, bool is_hair);
void workbench_material_update_data(WORKBENCH_PrivateData *wpd, Object *ob, Material *mat, WORKBENCH_MaterialData *data);
uint workbench_material_get_hash(WORKBENCH_MaterialData *material_template);
-int workbench_material_get_shader_index(WORKBENCH_PrivateData *wpd, int drawtype, bool is_hair);
+int workbench_material_get_shader_index(WORKBENCH_PrivateData *wpd, bool use_textures, bool is_hair);
void workbench_material_set_normal_world_matrix(
DRWShadingGroup *grp, WORKBENCH_PrivateData *wpd, float persistent_matrix[3][3]);
+void workbench_material_shgroup_uniform(WORKBENCH_PrivateData *wpd, DRWShadingGroup *grp, WORKBENCH_MaterialData *material);
+void workbench_material_copy(WORKBENCH_MaterialData *dest_material, const WORKBENCH_MaterialData *source_material);
/* workbench_studiolight.c */
void studiolight_update_world(StudioLight *sl, WORKBENCH_UBO_World *wd);
@@ -243,6 +281,7 @@ float studiolight_object_shadow_distance(WORKBENCH_PrivateData *wpd, Object *ob,
bool studiolight_camera_in_object_shadow(WORKBENCH_PrivateData *wpd, Object *ob, WORKBENCH_ObjectData *oed);
/* workbench_data.c */
+void workbench_effect_info_init(WORKBENCH_EffectInfo *effect_info);
void workbench_private_data_init(WORKBENCH_PrivateData *wpd);
void workbench_private_data_free(WORKBENCH_PrivateData *wpd);
void workbench_private_data_get_light_direction(WORKBENCH_PrivateData *wpd, float light_direction[3]);
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index f79a2405c3f..d6187e32036 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -475,8 +475,6 @@ void DRW_lamp_engine_data_free(struct LampEngineData *led);
bool DRW_object_is_renderable(struct Object *ob);
bool DRW_check_object_visible_within_active_context(struct Object *ob);
bool DRW_object_is_flat_normal(const struct Object *ob);
-int DRW_object_is_mode_shade(const struct Object *ob);
-int DRW_object_is_paint_mode(const struct Object *ob);
bool DRW_check_psys_visible_within_active_context(struct Object *object, struct ParticleSystem *psys);
diff --git a/source/blender/draw/intern/draw_anim_viz.c b/source/blender/draw/intern/draw_anim_viz.c
index 717b23775dc..42c36ab3662 100644
--- a/source/blender/draw/intern/draw_anim_viz.c
+++ b/source/blender/draw/intern/draw_anim_viz.c
@@ -348,4 +348,3 @@ DrawEngineType draw_engine_motion_path_type = {
NULL,
NULL,
};
-
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 8e45833026d..687f116bbbf 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -44,7 +44,6 @@
#include "BKE_customdata.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_editmesh.h"
#include "BKE_editmesh_tangent.h"
#include "BKE_mesh.h"
@@ -2149,7 +2148,13 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active(
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPUV));
+
if (cache->tri_aligned_uv == NULL) {
+ const MLoopUV *mloopuv = rdata->mloopuv;
+ if (mloopuv == NULL) {
+ return NULL;
+ }
+
uint vidx = 0;
static Gwn_VertFormat format = { 0 };
@@ -2166,7 +2171,6 @@ static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active(
int vbo_len_used = 0;
GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
- const MLoopUV *mloopuv = rdata->mloopuv;
BMEditMesh *embm = rdata->edit_bmesh;
/* get uv's from active UVMap */
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index d1e05b525ef..28693b47c89 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -289,12 +289,12 @@ static void particle_calculate_parent_uvs(
}
ParticleData *particle = &psys->particles[parent_index];
int num = particle->num_dmcache;
- if (num == DMCACHE_NOTFOUND) {
+ if (num == DMCACHE_NOTFOUND || num == DMCACHE_ISCHILD) {
if (particle->num < psmd->mesh_final->totface) {
num = particle->num;
}
}
- if (num != DMCACHE_NOTFOUND) {
+ if (num != DMCACHE_NOTFOUND && num != DMCACHE_ISCHILD) {
MFace *mface = &psmd->mesh_final->mface[num];
for (int j = 0; j < num_uv_layers; j++) {
psys_interpolate_uvs(
@@ -323,12 +323,12 @@ static void particle_calculate_parent_mcol(
}
ParticleData *particle = &psys->particles[parent_index];
int num = particle->num_dmcache;
- if (num == DMCACHE_NOTFOUND) {
+ if (num == DMCACHE_NOTFOUND || num == DMCACHE_ISCHILD) {
if (particle->num < psmd->mesh_final->totface) {
num = particle->num;
}
}
- if (num != DMCACHE_NOTFOUND) {
+ if (num != DMCACHE_NOTFOUND && num != DMCACHE_ISCHILD) {
MFace *mface = &psmd->mesh_final->mface[num];
for (int j = 0; j < num_uv_layers; j++) {
psys_interpolate_mcol(
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index d40378dec2d..a1c60be4742 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -254,14 +254,14 @@ DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(DRWPass *pass, float colo
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
- static float dash_width = 12.0f;
+ static float dash_width = 6.0f;
static float dash_factor = 0.5f;
DRWShadingGroup *grp = DRW_shgroup_line_batch_create(sh, pass);
DRW_shgroup_uniform_vec4(grp, "color", color, 1);
DRW_shgroup_uniform_vec2(grp, "viewport_size", DRW_viewport_size_get(), 1);
DRW_shgroup_uniform_float(grp, "dash_width", &dash_width, 1);
DRW_shgroup_uniform_float(grp, "dash_factor", &dash_factor, 1);
- DRW_shgroup_uniform_int_copy(grp, "num_colors", 0); /* "simple" mode */
+ DRW_shgroup_uniform_int_copy(grp, "colors_len", 0); /* "simple" mode */
return grp;
}
diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c
index d5923419b37..8320ae55179 100644
--- a/source/blender/draw/intern/draw_hair.c
+++ b/source/blender/draw/intern/draw_hair.c
@@ -115,12 +115,12 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(
/* TODO optimize this. Only bind the ones GPUMaterial needs. */
for (int i = 0; i < hair_cache->num_uv_layers; ++i) {
- for (int n = 0; hair_cache->uv_layer_names[i][n][0] != '\0'; ++n) {
+ for (int n = 0; n < MAX_LAYER_NAME_CT && hair_cache->uv_layer_names[i][n][0] != '\0'; ++n) {
DRW_shgroup_uniform_texture(shgrp, hair_cache->uv_layer_names[i][n], hair_cache->uv_tex[i]);
}
}
for (int i = 0; i < hair_cache->num_col_layers; ++i) {
- for (int n = 0; hair_cache->col_layer_names[i][n][0] != '\0'; ++n) {
+ for (int n = 0; n < MAX_LAYER_NAME_CT && hair_cache->col_layer_names[i][n][0] != '\0'; ++n) {
DRW_shgroup_uniform_texture(shgrp, hair_cache->col_layer_names[i][n], hair_cache->col_tex[i]);
}
}
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index fcdc4a3a016..504e53fd206 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -187,39 +187,6 @@ bool DRW_object_is_flat_normal(const Object *ob)
return true;
}
-/**
- * Return true if the object has its own draw mode.
- * Caller must check this is active */
-int DRW_object_is_mode_shade(const Object *ob)
-{
- BLI_assert(ob == DST.draw_ctx.obact);
- UNUSED_VARS_NDEBUG(ob);
- if ((DST.draw_ctx.object_mode & OB_MODE_EDIT) == 0) {
- if ((DST.draw_ctx.object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) > 0) {
- if (ELEM(DST.draw_ctx.v3d->drawtype, OB_MATERIAL, OB_RENDER)) {
- return false;
- }
- else if ((DST.draw_ctx.v3d->flag2 & V3D_SHOW_MODE_SHADE_OVERRIDE) == 0) {
- return true;
- }
- else {
- return false;
- }
- }
- }
- return -1;
-}
-
-int DRW_object_is_paint_mode(const Object *ob)
-{
- if (ob == DST.draw_ctx.obact) {
- if ((DST.draw_ctx.object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) > 0) {
- return true;
- }
- }
- return false;
-}
-
bool DRW_check_psys_visible_within_active_context(
Object *object,
struct ParticleSystem *psys)
@@ -1024,7 +991,6 @@ static void drw_engines_enable_from_engine(RenderEngineType *engine_type, int dr
break;
case OB_SOLID:
- case OB_TEXTURE:
if (shading_flags & V3D_SHADING_XRAY) {
use_drw_engine(&draw_engine_workbench_transparent);
}
@@ -1055,6 +1021,27 @@ static void drw_engines_enable_from_object_mode(void)
use_drw_engine(&draw_engine_motion_path_type);
}
+static void drw_engines_enable_from_paint_mode(int mode)
+{
+ switch (mode) {
+ case CTX_MODE_SCULPT:
+ use_drw_engine(&draw_engine_sculpt_type);
+ break;
+ case CTX_MODE_PAINT_WEIGHT:
+ use_drw_engine(&draw_engine_pose_type);
+ use_drw_engine(&draw_engine_paint_weight_type);
+ break;
+ case CTX_MODE_PAINT_VERTEX:
+ use_drw_engine(&draw_engine_paint_vertex_type);
+ break;
+ case CTX_MODE_PAINT_TEXTURE:
+ use_drw_engine(&draw_engine_paint_texture_type);
+ break;
+ default:
+ break;
+ }
+}
+
static void drw_engines_enable_from_mode(int mode)
{
switch (mode) {
@@ -1082,21 +1069,14 @@ static void drw_engines_enable_from_mode(int mode)
case CTX_MODE_POSE:
use_drw_engine(&draw_engine_pose_type);
break;
- case CTX_MODE_SCULPT:
- use_drw_engine(&draw_engine_sculpt_type);
+ case CTX_MODE_PARTICLE:
+ use_drw_engine(&draw_engine_particle_type);
break;
+ case CTX_MODE_SCULPT:
case CTX_MODE_PAINT_WEIGHT:
- use_drw_engine(&draw_engine_pose_type);
- use_drw_engine(&draw_engine_paint_weight_type);
- break;
case CTX_MODE_PAINT_VERTEX:
- use_drw_engine(&draw_engine_paint_vertex_type);
- break;
case CTX_MODE_PAINT_TEXTURE:
- use_drw_engine(&draw_engine_paint_texture_type);
- break;
- case CTX_MODE_PARTICLE:
- use_drw_engine(&draw_engine_particle_type);
+ /* Should have already been enabled */
break;
case CTX_MODE_OBJECT:
break;
@@ -1130,6 +1110,8 @@ static void drw_engines_enable(ViewLayer *view_layer, RenderEngineType *engine_t
drw_engines_enable_from_engine(engine_type, drawtype, v3d->shading.flag);
if (DRW_state_draw_support()) {
+ /* Draw paint modes first so that they are drawn below the wireframes. */
+ drw_engines_enable_from_paint_mode(mode);
drw_engines_enable_from_overlays(v3d->overlay.flag);
drw_engines_enable_from_object_mode();
drw_engines_enable_from_mode(mode);
@@ -1467,7 +1449,7 @@ void DRW_render_to_image(RenderEngine *engine, struct Depsgraph *depsgraph)
Render *render = engine->re;
if (G.background && DST.gl_context == NULL) {
- WM_init_opengl();
+ WM_init_opengl(G_MAIN);
}
void *re_gl_context = RE_gl_context_get(render);
@@ -1682,6 +1664,7 @@ void DRW_draw_select_loop(
/* Get list of enabled engines */
if (use_obedit) {
+ drw_engines_enable_from_paint_mode(obedit_mode);
drw_engines_enable_from_mode(obedit_mode);
}
else {
@@ -1729,7 +1712,7 @@ void DRW_draw_select_loop(
DEG_ITER_OBJECT_FLAG_VISIBLE |
DEG_ITER_OBJECT_FLAG_DUPLI)
{
- if ((ob->base_flag & BASE_SELECTABLED) != 0) {
+ if ((ob->base_flag & BASE_SELECTABLE) != 0) {
if (object_filter_fn != NULL) {
if (ob->base_flag & BASE_FROMDUPLI) {
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 423b07cdb97..736bde725ae 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -35,6 +35,7 @@
#include "DNA_object_force_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_particle_types.h"
+#include "DNA_rigidbody_types.h"
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
@@ -178,6 +179,7 @@ typedef struct OBJECT_PrivateData {
DRWShadingGroup *lamp_distance;
DRWShadingGroup *lamp_buflimit;
DRWShadingGroup *lamp_buflimit_points;
+ DRWShadingGroup *lamp_area_sphere;
DRWShadingGroup *lamp_area_square;
DRWShadingGroup *lamp_area_disk;
DRWShadingGroup *lamp_hemi;
@@ -1199,6 +1201,9 @@ static void OBJECT_cache_init(void *vedata)
stl->g_data->lamp_groundline = shgroup_groundlines_uniform_color(psl->non_meshes, ts.colorLamp);
stl->g_data->lamp_groundpoint = shgroup_groundpoints_uniform_color(psl->non_meshes, ts.colorLamp);
+ geom = DRW_cache_screenspace_circle_get();
+ stl->g_data->lamp_area_sphere = shgroup_instance_screen_aligned(psl->non_meshes, geom);
+
geom = DRW_cache_lamp_area_square_get();
stl->g_data->lamp_area_square = shgroup_instance(psl->non_meshes, geom);
@@ -1450,6 +1455,15 @@ static void DRW_shgroup_lamp(OBJECT_StorageList *stl, Object *ob, ViewLayer *vie
}
}
+ if (ELEM(la->type, LA_LOCAL, LA_SPOT)) {
+ /* We only want position not scale. */
+ shapemat[0][0] = shapemat[1][1] = shapemat[2][2] = 1.0f;
+ shapemat[0][1] = shapemat[0][2] = 0.0f;
+ shapemat[1][0] = shapemat[1][2] = 0.0f;
+ shapemat[2][0] = shapemat[2][1] = 0.0f;
+ DRW_shgroup_call_dynamic_add(stl->g_data->lamp_area_sphere, color, &la->area_size, shapemat);
+ }
+
/* Line and point going to the ground */
DRW_shgroup_call_dynamic_add(stl->g_data->lamp_groundline, ob->obmat[3]);
DRW_shgroup_call_dynamic_add(stl->g_data->lamp_groundpoint, ob->obmat[3]);
@@ -1918,11 +1932,19 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl
static void DRW_shgroup_relationship_lines(OBJECT_StorageList *stl, Object *ob)
{
if (ob->parent && DRW_check_object_visible_within_active_context(ob->parent)) {
- /* Only draw relationship lines when object or its parent are selected
- * as a way of reducing visual clutter.
- */
- if ((ob->base_flag & BASE_SELECTED) || (ob->parent->base_flag & BASE_SELECTED)) {
- DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->parent->obmat[3]);
+ DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->parent->obmat[3]);
+ DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]);
+ }
+
+ if (ob->rigidbody_constraint) {
+ Object *rbc_ob1 = ob->rigidbody_constraint->ob1;
+ Object *rbc_ob2 = ob->rigidbody_constraint->ob2;
+ if (rbc_ob1 && DRW_check_object_visible_within_active_context(rbc_ob1)) {
+ DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, rbc_ob1->obmat[3]);
+ DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]);
+ }
+ if (rbc_ob2 && DRW_check_object_visible_within_active_context(rbc_ob2)) {
+ DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, rbc_ob2->obmat[3]);
DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]);
}
}
diff --git a/source/blender/draw/modes/overlay_mode.c b/source/blender/draw/modes/overlay_mode.c
index 97403b14ac5..a67c7ffb131 100644
--- a/source/blender/draw/modes/overlay_mode.c
+++ b/source/blender/draw/modes/overlay_mode.c
@@ -246,4 +246,3 @@ DrawEngineType draw_engine_overlay_type = {
NULL,
NULL,
};
-
diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c
index bd8a1c71a6a..85cff28b313 100644
--- a/source/blender/draw/modes/paint_texture_mode.c
+++ b/source/blender/draw/modes/paint_texture_mode.c
@@ -194,8 +194,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
{
/* Create a pass */
- DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
- DRW_STATE_MULTIPLY | DRW_STATE_WIRE;
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND;
psl->image_faces = DRW_pass_create("Image Color Pass", state);
stl->g_data->shgroup_fallback = DRW_shgroup_create(e_data.fallback_sh, psl->image_faces);
@@ -227,6 +226,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
if (tex) {
DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
DRW_shgroup_uniform_texture(grp, "image", tex);
+ DRW_shgroup_uniform_float(grp, "alpha", &draw_ctx->v3d->overlay.texture_paint_mode_opacity, 1);
stl->g_data->shgroup_image_array[i] = grp;
}
else {
@@ -242,6 +242,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
if (tex) {
DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
DRW_shgroup_uniform_texture(grp, "image", tex);
+ DRW_shgroup_uniform_float(grp, "alpha", &draw_ctx->v3d->overlay.texture_paint_mode_opacity, 1);
stl->g_data->shgroup_image_array[0] = grp;
}
else {
@@ -285,7 +286,7 @@ static void PAINT_TEXTURE_cache_populate(void *vedata, Object *ob)
/* Get geometry cache */
const Mesh *me = ob->data;
Scene *scene = draw_ctx->scene;
- const bool use_surface = DRW_object_is_mode_shade(ob) == true;
+ const bool use_surface = draw_ctx->v3d->overlay.texture_paint_mode_opacity != 0.0; //DRW_object_is_mode_shade(ob) == true;
const bool use_material_slots = (scene->toolsettings->imapaint.mode == IMAGEPAINT_MODE_MATERIAL);
bool ok = false;
diff --git a/source/blender/draw/modes/paint_vertex_mode.c b/source/blender/draw/modes/paint_vertex_mode.c
index d335e0a4d70..9cf6ea52d33 100644
--- a/source/blender/draw/modes/paint_vertex_mode.c
+++ b/source/blender/draw/modes/paint_vertex_mode.c
@@ -101,6 +101,8 @@ static void PAINT_VERTEX_cache_init(void *vedata)
{
PAINT_VERTEX_PassList *psl = ((PAINT_VERTEX_Data *)vedata)->psl;
PAINT_VERTEX_StorageList *stl = ((PAINT_VERTEX_Data *)vedata)->stl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ const View3D *v3d = draw_ctx->v3d;
if (!stl->g_data) {
/* Alloc transient pointers */
@@ -111,9 +113,10 @@ static void PAINT_VERTEX_cache_init(void *vedata)
/* Create a pass */
psl->vcolor_faces = DRW_pass_create(
"Vert Color Pass",
- DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_MULTIPLY);
+ DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND);
stl->g_data->fvcolor_shgrp = DRW_shgroup_create(e_data.vcolor_face_shader, psl->vcolor_faces);
+ DRW_shgroup_uniform_float(stl->g_data->fvcolor_shgrp, "alpha", &v3d->overlay.vertex_paint_mode_opacity, 1);
}
{
@@ -145,7 +148,7 @@ static void PAINT_VERTEX_cache_populate(void *vedata, Object *ob)
if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) {
const Mesh *me = ob->data;
const bool use_wire = (v3d->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0;
- const bool use_surface = DRW_object_is_mode_shade(ob) == true;
+ const bool use_surface = v3d->overlay.vertex_paint_mode_opacity != 0.0f;
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
struct Gwn_Batch *geom;
diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c
index 13ef42d8622..2b510a9a4c9 100644
--- a/source/blender/draw/modes/paint_weight_mode.c
+++ b/source/blender/draw/modes/paint_weight_mode.c
@@ -123,6 +123,8 @@ static void PAINT_WEIGHT_cache_init(void *vedata)
{
PAINT_WEIGHT_PassList *psl = ((PAINT_WEIGHT_Data *)vedata)->psl;
PAINT_WEIGHT_StorageList *stl = ((PAINT_WEIGHT_Data *)vedata)->stl;
+ const DRWContextState *draw_ctx = DRW_context_state_get();
+ const View3D *v3d = draw_ctx->v3d;
if (!stl->g_data) {
/* Alloc transient pointers */
@@ -133,15 +135,14 @@ static void PAINT_WEIGHT_cache_init(void *vedata)
/* Create a pass */
psl->weight_faces = DRW_pass_create(
"Weight Pass",
- DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_MULTIPLY);
+ DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND);
stl->g_data->fweights_shgrp = DRW_shgroup_create(e_data.weight_face_shader, psl->weight_faces);
static float light[3] = {-0.3f, 0.5f, 1.0f};
- static float alpha = 1.0f;
static float world_light = 1.0f;
DRW_shgroup_uniform_vec3(stl->g_data->fweights_shgrp, "light", light, 1);
- DRW_shgroup_uniform_float(stl->g_data->fweights_shgrp, "alpha", &alpha, 1);
+ DRW_shgroup_uniform_float(stl->g_data->fweights_shgrp, "alpha", &v3d->overlay.weight_paint_mode_opacity, 1);
DRW_shgroup_uniform_float(stl->g_data->fweights_shgrp, "global", &world_light, 1);
}
@@ -182,7 +183,7 @@ static void PAINT_WEIGHT_cache_populate(void *vedata, Object *ob)
if ((ob->type == OB_MESH) && (ob == draw_ctx->obact)) {
const Mesh *me = ob->data;
const bool use_wire = (v3d->overlay.paint_flag & V3D_OVERLAY_PAINT_WIRE) != 0;
- const bool use_surface = DRW_object_is_mode_shade(ob) == true;
+ const bool use_surface = v3d->overlay.weight_paint_mode_opacity != 0.0f;
const bool use_face_sel = (me->editflag & ME_EDIT_PAINT_FACE_SEL) != 0;
const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
struct Gwn_Batch *geom;
diff --git a/source/blender/draw/modes/shaders/common_fxaa_lib.glsl b/source/blender/draw/modes/shaders/common_fxaa_lib.glsl
index 8158437b943..236ac5c67f0 100644
--- a/source/blender/draw/modes/shaders/common_fxaa_lib.glsl
+++ b/source/blender/draw/modes/shaders/common_fxaa_lib.glsl
@@ -675,4 +675,3 @@ vec4 FxaaPixelShader(
return vec4(FxaaTexTop(tex, posM).xyz, lumaM);
}
/*==========================================================================*/
-
diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl
index 00ababc624d..5dfbb4352e4 100644
--- a/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl
+++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_frag.glsl
@@ -7,7 +7,7 @@ flat in vec3 ssVec2;
in float facing;
#ifdef LIGHT_EDGES
-in float edgeSharpness;
+flat in vec3 edgeSharpness;
#endif
out vec4 fragColor;
diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl
index 6e833a4e16b..eb69af92435 100644
--- a/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl
+++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_geom.glsl
@@ -20,7 +20,7 @@ in vec3 obPos[];
in vec3 vNor[];
in float forceEdge[];
-out float edgeSharpness;
+flat out vec3 edgeSharpness;
#endif
#define NO_EDGE vec3(10000.0);
@@ -33,6 +33,14 @@ vec3 compute_vec(vec2 v0, vec2 v1)
return vec3(v, -dot(v, v0));
}
+vec3 get_edge_normal(vec3 n1, vec3 n2, vec3 edge)
+{
+ edge = normalize(edge);
+ vec3 n = n1 + n2;
+ float p = dot(edge, n);
+ return normalize(n - p * edge);
+}
+
float get_edge_sharpness(vec3 fnor, vec3 vnor)
{
float sharpness = abs(dot(fnor, vnor));
@@ -50,27 +58,27 @@ void main(void)
ssVec2 = do_edge.z ? compute_vec(ssPos[2], ssPos[0]) : NO_EDGE;
#ifdef LIGHT_EDGES
- vec3 fnor = normalize(cross(obPos[1] - obPos[0], obPos[2] - obPos[0]));
-
- edgeSharpness = get_edge_sharpness(fnor, vNor[0]);
- edgeSharpness = (forceEdge[0] == 1.0 || forceEdge[2] == 1.0) ? 1.0 : edgeSharpness;
+ vec3 edges[3];
+ edges[0] = obPos[1] - obPos[0];
+ edges[1] = obPos[2] - obPos[1];
+ edges[2] = obPos[0] - obPos[2];
+ vec3 fnor = normalize(cross(edges[0], -edges[2]));
+
+ edgeSharpness.x = get_edge_sharpness(fnor, get_edge_normal(vNor[0], vNor[1], edges[0]));
+ edgeSharpness.y = get_edge_sharpness(fnor, get_edge_normal(vNor[1], vNor[2], edges[1]));
+ edgeSharpness.z = get_edge_sharpness(fnor, get_edge_normal(vNor[2], vNor[0], edges[2]));
+ edgeSharpness.x = (forceEdge[0] == 1.0) ? 1.0 : edgeSharpness.x;
+ edgeSharpness.y = (forceEdge[1] == 1.0) ? 1.0 : edgeSharpness.y;
+ edgeSharpness.z = (forceEdge[2] == 1.0) ? 1.0 : edgeSharpness.z;
#endif
gl_Position = gl_in[0].gl_Position;
facing = facings.x;
EmitVertex();
-#ifdef LIGHT_EDGES
- edgeSharpness = get_edge_sharpness(fnor, vNor[1]);
- edgeSharpness = (forceEdge[1] == 1.0 || forceEdge[0] == 1.0) ? 1.0 : edgeSharpness;
-#endif
gl_Position = gl_in[1].gl_Position;
facing = facings.y;
EmitVertex();
-#ifdef LIGHT_EDGES
- edgeSharpness = get_edge_sharpness(fnor, vNor[2]);
- edgeSharpness = (forceEdge[2] == 1.0 || forceEdge[1] == 1.0) ? 1.0 : edgeSharpness;
-#endif
gl_Position = gl_in[2].gl_Position;
facing = facings.z;
EmitVertex();
diff --git a/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl b/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl
index 616cd5379e9..fe3c2021b7e 100644
--- a/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl
+++ b/source/blender/draw/modes/shaders/overlay_face_wireframe_vert.glsl
@@ -27,7 +27,7 @@ out vec3 obPos;
out vec3 vNor;
out float forceEdge;
#else
-out float edgeSharpness;
+flat out vec3 edgeSharpness;
#endif
#endif
@@ -80,6 +80,14 @@ vec3 get_vertex_pos(uint id)
return pos;
}
+vec3 get_edge_normal(vec3 n1, vec3 n2, vec3 edge)
+{
+ edge = normalize(edge);
+ vec3 n = n1 + n2;
+ float p = dot(edge, n);
+ return normalize(n - p * edge);
+}
+
float get_edge_sharpness(vec3 fnor, vec3 vnor)
{
float sharpness = abs(dot(fnor, vnor));
@@ -152,24 +160,30 @@ void main()
gl_Position = p_pos[v_n];
+# ifndef LIGHT_EDGES
vec3 nor = get_vertex_nor(v_id[v_n]);
- facing = normalize(NormalMatrix * nor).z;
-
-# ifdef LIGHT_EDGES
- vec3 fnor = normalize(cross(pos[1] - pos[0], pos[2] - pos[0]));
- edgeSharpness = get_edge_sharpness(fnor, nor);
-
- /* Fix disapearing edges. */
- if (v_n == 0) {
- force_edge.xy = force_edge.xz;
- }
- else if (v_n == 2) {
- force_edge.xy = force_edge.yz;
- }
- if (any(force_edge.xy)) {
- edgeSharpness = 1.0;
- }
+# else
+ vec3 edges[3];
+ edges[0] = pos[1] - pos[0];
+ edges[1] = pos[2] - pos[1];
+ edges[2] = pos[0] - pos[2];
+ vec3 fnor = normalize(cross(edges[0], -edges[2]));
+
+ vec3 nors[3];
+ nors[0] = get_vertex_nor(v_id.x);
+ nors[1] = get_vertex_nor(v_id.y);
+ nors[2] = get_vertex_nor(v_id.z);
+ edgeSharpness.x = get_edge_sharpness(fnor, get_edge_normal(nors[0], nors[1], edges[0]));
+ edgeSharpness.y = get_edge_sharpness(fnor, get_edge_normal(nors[1], nors[2], edges[1]));
+ edgeSharpness.z = get_edge_sharpness(fnor, get_edge_normal(nors[2], nors[0], edges[2]));
+ edgeSharpness.x = force_edge.x ? 1.0 : edgeSharpness.x;
+ edgeSharpness.y = force_edge.y ? 1.0 : edgeSharpness.y;
+ edgeSharpness.z = force_edge.z ? 1.0 : edgeSharpness.z;
+
+ vec3 nor = nors[v_n];
# endif
+ facing = normalize(NormalMatrix * nor).z;
+
#endif
}
diff --git a/source/blender/draw/modes/shaders/paint_texture_frag.glsl b/source/blender/draw/modes/shaders/paint_texture_frag.glsl
index 18c58a54dca..4305e20ce7b 100644
--- a/source/blender/draw/modes/shaders/paint_texture_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_texture_frag.glsl
@@ -3,9 +3,9 @@ in vec2 uv_interp;
out vec4 fragColor;
uniform sampler2D image;
-
+uniform float alpha = 1.0;
void main()
{
- fragColor = texture(image, uv_interp);
+ fragColor = vec4(texture(image, uv_interp).rgb, alpha);
}
diff --git a/source/blender/draw/modes/shaders/paint_vertex_frag.glsl b/source/blender/draw/modes/shaders/paint_vertex_frag.glsl
index 5a00fec9c43..2c968dafa69 100644
--- a/source/blender/draw/modes/shaders/paint_vertex_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_vertex_frag.glsl
@@ -2,7 +2,7 @@
in vec3 finalColor;
out vec4 fragColor;
-
+uniform float alpha = 1.0;
vec3 linear_to_srgb_attrib(vec3 c) {
c = max(c, vec3(0.0));
vec3 c1 = c * 12.92;
@@ -13,5 +13,5 @@ vec3 linear_to_srgb_attrib(vec3 c) {
void main()
{
fragColor.rgb = linear_to_srgb_attrib(finalColor);
- fragColor.a = 1.0;
+ fragColor.a = alpha;
}
diff --git a/source/blender/draw/modes/shaders/paint_wire_frag.glsl b/source/blender/draw/modes/shaders/paint_wire_frag.glsl
index e4214a4c6d1..b6637fea308 100644
--- a/source/blender/draw/modes/shaders/paint_wire_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_wire_frag.glsl
@@ -18,7 +18,5 @@ void main()
const vec4 colSel = vec4(1.0, 1.0, 1.0, 1.0);
#endif
- const vec4 colUnsel = vec4(0.5, 0.5, 0.5, 1.0);
-
- fragColor = bool(finalFlag & VERTEX_SELECTED) ? colSel : colUnsel;
+ fragColor = bool(finalFlag & VERTEX_SELECTED) ? colSel : colorWire;
}
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index e4213a8d907..f0bde9dcdfb 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -70,6 +70,7 @@
#include "BKE_context.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "DEG_depsgraph.h"
@@ -3832,8 +3833,8 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
selected = 0;
/* set blending again, as may not be set in previous step */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
/* step 1) draw backdrop ........................................... */
if (acf->draw_backdrop)
@@ -3852,7 +3853,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
}
/* turn off blending, since not needed anymore... */
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* step 4) draw special toggles .................................
* - in Graph Editor, checkboxes for visibility in curves area
@@ -3930,7 +3931,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
/* FIXME: replace hardcoded color here, and check on extents! */
immUniformColor3f(1.0f, 0.0f, 0.0f);
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, (float)offset, yminc);
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index ebe977420c6..f629c20b04a 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -659,7 +659,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
/* ****************** Operator Utilities ********************************** */
/* poll callback for being in an Animation Editor channels list region */
-static int animedit_poll_channels_active(bContext *C)
+static bool animedit_poll_channels_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
@@ -675,7 +675,7 @@ static int animedit_poll_channels_active(bContext *C)
}
/* poll callback for Animation Editor channels list region + not in NLA-tweakmode for NLA */
-static int animedit_poll_channels_nla_tweakmode_off(bContext *C)
+static bool animedit_poll_channels_nla_tweakmode_off(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
@@ -1415,7 +1415,7 @@ static void ANIM_OT_channels_move(wmOperatorType *ot)
/* ******************** Group Channel Operator ************************ */
-static int animchannels_grouping_poll(bContext *C)
+static bool animchannels_grouping_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
SpaceLink *sl;
@@ -2190,7 +2190,7 @@ static void ANIM_OT_channels_clean_empty(wmOperatorType *ot)
/* ******************* Reenable Disabled Operator ******************* */
-static int animchannels_enable_poll(bContext *C)
+static bool animchannels_enable_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
@@ -2264,7 +2264,7 @@ static void ANIM_OT_channels_fcurves_enable(wmOperatorType *ot)
/* ****************** Find / Set Filter Operator ******************** */
/* XXX: make this generic? */
-static int animchannels_find_poll(bContext *C)
+static bool animchannels_find_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
@@ -2300,18 +2300,9 @@ static int animchannels_find_exec(bContext *C, wmOperator *op)
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
- /* update filter text, and ensure that filter is enabled if there's something there
- * NOTE: we turn the filter off if there's nothing (this is a quick shortcut for dismissing)
- */
+ /* update filter text */
RNA_string_get(op->ptr, "query", ac.ads->searchstr);
- if (ac.ads->searchstr[0]) {
- ac.ads->filterflag |= ADS_FILTER_BY_FCU_NAME;
- }
- else {
- ac.ads->filterflag &= ~ADS_FILTER_BY_FCU_NAME;
- }
-
/* redraw */
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
@@ -2693,7 +2684,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
AnimData *adt = ob->adt;
/* set selection status */
- if (base->flag & BASE_SELECTABLED) {
+ if (base->flag & BASE_SELECTABLE) {
if (selectmode == SELECT_INVERT) {
/* swap select */
ED_object_base_select(base, BA_INVERT);
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index c2cfb877745..953898a0586 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -64,6 +64,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
/* *************************************************** */
/* CURRENT FRAME DRAWING */
@@ -138,7 +139,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
const float time = scene->r.cfra + scene->r.subframe;
const float x = (float)(time * scene->r.framelen);
- glLineWidth((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0);
+ GPU_line_width((flag & DRAWCFRA_WIDE) ? 3.0 : 2.0);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -166,8 +167,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
/* only draw this if preview range is set */
if (PRVRANGEON) {
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -187,7 +188,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -199,8 +200,8 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
void ANIM_draw_framerange(Scene *scene, View2D *v2d)
{
/* draw darkened area outside of active timeline frame range */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -216,7 +217,7 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d)
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* thin lines where the actual frames are */
immUniformThemeColorShade(TH_BACK, -60);
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 8892fed025a..c59d24bbdf8 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -245,6 +245,18 @@ static bool actedit_get_context(bAnimContext *ac, SpaceAction *saction)
/* update scene-pointer (no need to check for pinning yet, as not implemented) */
saction->ads.source = (ID *)ac->scene;
+ /* sync scene's "selected keys only" flag with our "only selected" flag
+ * XXX: This is a workaround for T55525. We shouldn't really be syncing the flags like this,
+ * but it's a simpler fix for now than also figuring out how the next/prev keyframe tools
+ * should work in the 3D View if we allowed full access to the timeline's dopesheet filters
+ * (i.e. we'd have to figure out where to host those settings, to be on a scene level like
+ * this flag currently is, along with several other unknowns)
+ */
+ if (ac->scene->flag & SCE_KEYS_NO_SELONLY)
+ saction->ads.filterflag &= ~ADS_FILTER_ONLYSEL;
+ else
+ saction->ads.filterflag |= ADS_FILTER_ONLYSEL;
+
ac->datatype = ANIMCONT_TIMELINE;
ac->data = &saction->ads;
@@ -1209,7 +1221,7 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, eAnim_Chan
/* only include if this curve is active */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) {
/* name based filtering... */
- if ( ((ads) && (ads->filterflag & ADS_FILTER_BY_FCU_NAME)) && (owner_id) ) {
+ if ( ((ads) && (ads->searchstr[0] != '\0')) && (owner_id) ) {
if (skip_fcurve_with_name(ads, fcu, channel_type, owner, owner_id))
continue;
}
@@ -1441,7 +1453,7 @@ static size_t animfilter_nla(bAnimContext *UNUSED(ac), ListBase *anim_data, bDop
/* only include if this track is active */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (nlt->flag & NLATRACK_ACTIVE)) {
/* name based filtering... */
- if (((ads) && (ads->filterflag & ADS_FILTER_BY_FCU_NAME)) && (owner_id)) {
+ if (((ads) && (ads->searchstr[0] != '\0')) && (owner_id)) {
bool track_ok = false, strip_ok = false;
/* check if the name of the track, or the strips it has are ok... */
@@ -1621,7 +1633,7 @@ static size_t animdata_filter_gpencil_layers_data(ListBase *anim_data, bDopeShee
/* active... */
if (!(filter_mode & ANIMFILTER_ACTIVE) || (gpl->flag & GP_LAYER_ACTIVE)) {
/* skip layer if the name doesn't match the filter string */
- if ((ads) && (ads->filterflag & ADS_FILTER_BY_FCU_NAME)) {
+ if ((ads) && (ads->searchstr[0] != '\0')) {
if (name_matches_dopesheet_filter(ads, gpl->info) == false)
continue;
}
@@ -1713,7 +1725,7 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
*/
if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
/* layer visibility - we check both object and base, since these may not be in sync yet */
- if ((base->flag & BASE_VISIBLED) == 0) continue;
+ if ((base->flag & BASE_VISIBLE) == 0) continue;
/* outliner restrict-flag */
if (ob->restrictflag & OB_RESTRICT_VIEW) continue;
@@ -1729,7 +1741,7 @@ static size_t animdata_filter_gpencil(bAnimContext *ac, ListBase *anim_data, voi
* objects by the grouped status is on
* - used to ease the process of doing multiple-character choreographies
*/
- if (ads->filterflag & ADS_FILTER_ONLYOBGROUP) {
+ if (ads->filter_grp != NULL) {
if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0)
continue;
}
@@ -2852,7 +2864,7 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Base *base, int filter_m
*/
if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
/* layer visibility - we check both object and base, since these may not be in sync yet */
- if ((base->flag & BASE_VISIBLED) == 0)
+ if ((base->flag & BASE_VISIBLE) == 0)
return false;
/* outliner restrict-flag */
@@ -2896,7 +2908,7 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Base *base, int filter_m
* objects by the grouped status is on
* - used to ease the process of doing multiple-character choreographies
*/
- if (ads->filterflag & ADS_FILTER_ONLYOBGROUP) {
+ if (ads->filter_grp != NULL) {
if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0)
return false;
}
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index e957e84857a..05350ffd18e 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -61,6 +61,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -389,8 +390,8 @@ static void draw_marker(
#endif
int icon_id;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* vertical line - dotted */
#ifdef DURIAN_CAMERA_SWITCH
@@ -405,7 +406,7 @@ static void draw_marker(
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
if (marker->flag & SELECT) {
@@ -444,7 +445,7 @@ static void draw_marker(
UI_icon_draw(xpos - 0.45f * UI_DPI_ICON_SIZE, yoffs + UI_DPI_ICON_SIZE, icon_id);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* and the marker name too, shifted slightly to the top-right */
#ifdef DURIAN_CAMERA_SWITCH
@@ -491,12 +492,12 @@ void ED_markers_draw(const bContext *C, int flag)
const unsigned char shade[4] = {0, 0, 0, 16};
immUniformColor4ubv(shade);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
immRectf(pos, v2d->cur.xmin, 0, v2d->cur.xmax, UI_MARKER_MARGIN_Y);
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUnbindProgram();
}
@@ -540,7 +541,7 @@ void ED_markers_draw(const bContext *C, int flag)
/* ------------------------ */
/* special poll() which checks if there are selected markers first */
-static int ed_markers_poll_selected_markers(bContext *C)
+static bool ed_markers_poll_selected_markers(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
@@ -552,7 +553,7 @@ static int ed_markers_poll_selected_markers(bContext *C)
return ED_markers_get_first_selected(markers) != NULL;
}
-static int ed_markers_poll_selected_no_locked_markers(bContext *C)
+static bool ed_markers_poll_selected_no_locked_markers(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
ToolSettings *ts = CTX_data_tool_settings(C);
@@ -570,7 +571,7 @@ static int ed_markers_poll_selected_no_locked_markers(bContext *C)
/* special poll() which checks if there are any markers at all first */
-static int ed_markers_poll_markers_exist(bContext *C)
+static bool ed_markers_poll_markers_exist(bContext *C)
{
ListBase *markers = ED_context_get_markers(C);
ToolSettings *ts = CTX_data_tool_settings(C);
@@ -769,7 +770,7 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
BLI_snprintf(str, sizeof(str), IFACE_("Marker offset %s"), str_offs);
}
- ED_area_headerprint(CTX_wm_area(C), str);
+ ED_area_status_text(CTX_wm_area(C), str);
}
/* copy selection to temp buffer */
@@ -829,7 +830,7 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op)
op->customdata = NULL;
/* clear custom header prints */
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_area_status_text(CTX_wm_area(C), NULL);
}
static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1670,8 +1671,10 @@ void ED_keymap_marker(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "MARKER_OT_select_border", BKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MARKER_OT_delete", DELKEY, KM_PRESS, 0, 0);
+
WM_keymap_verify_item(keymap, "MARKER_OT_rename", MKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 4402ca78976..5f6b299c617 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -64,7 +64,7 @@
/* ********************** frame change operator ***************************/
/* Check if the operator can be run from the current context */
-static int change_frame_poll(bContext *C)
+static bool change_frame_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
@@ -279,7 +279,7 @@ static void ANIM_OT_change_frame(wmOperatorType *ot)
/* ****************** Start/End Frame Operators *******************************/
-static int anim_set_end_frames_poll(bContext *C)
+static bool anim_set_end_frames_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index f303be0dd76..99725c7da99 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -819,7 +819,7 @@ static const EnumPropertyItem *driver_mapping_type_itemsf(bContext *C, PointerRN
/* Add Driver (With Menu) Button Operator ------------------------ */
-static int add_driver_button_poll(bContext *C)
+static bool add_driver_button_poll(bContext *C)
{
PointerRNA ptr = {{NULL}};
PropertyRNA *prop = NULL;
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index d1377703949..fcccf07190b 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -54,6 +54,7 @@
#include "GPU_draw.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -561,7 +562,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
const float icon_sz = U.widget_unit * 0.5f * yscale_fac;
const float half_icon_sz = 0.5f * icon_sz;
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
/* TODO: allow this opacity factor to be themed? */
@@ -654,7 +655,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
}
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* *************************** Channel Drawing Funcs *************************** */
@@ -1056,4 +1057,3 @@ void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskLayer *masklay, DLRBT_Tree *ke
}
}
}
-
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index 6b24008c4d8..1bbfa6cc979 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -1471,4 +1471,3 @@ short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt)
return 0;
}
-
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index fe5714aba2e..e234a3a131a 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1331,7 +1331,7 @@ enum {
* This is based on the standard ED_operator_areaactive callback,
* except that it does special checks for a few spacetypes too...
*/
-static int modify_key_op_poll(bContext *C)
+static bool modify_key_op_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 5bf23a53819..b5a998f60da 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -74,14 +74,14 @@
*/
/* poll callback for adding default KeyingSet */
-static int keyingset_poll_default_add(bContext *C)
+static bool keyingset_poll_default_add(bContext *C)
{
/* as long as there's an active Scene, it's fine */
return (CTX_data_scene(C) != NULL);
}
/* poll callback for editing active KeyingSet */
-static int keyingset_poll_active_edit(bContext *C)
+static bool keyingset_poll_active_edit(bContext *C)
{
Scene *scene = CTX_data_scene(C);
@@ -93,7 +93,7 @@ static int keyingset_poll_active_edit(bContext *C)
}
/* poll callback for editing active KeyingSet Path */
-static int keyingset_poll_activePath_edit(bContext *C)
+static bool keyingset_poll_activePath_edit(bContext *C)
{
Scene *scene = CTX_data_scene(C);
KeyingSet *ks;
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 1fe729b7c4b..a37a2bada08 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -251,4 +251,3 @@ int bone_looper(struct Object *ob, struct Bone *bone, void *data,
#endif /* __ARMATURE_INTERN_H__ */
-
diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c
index a73e64af0ee..350dee07a2c 100644
--- a/source/blender/editors/armature/armature_naming.c
+++ b/source/blender/editors/armature/armature_naming.c
@@ -468,4 +468,3 @@ void ARMATURE_OT_autoside_names(wmOperatorType *ot)
/* settings */
ot->prop = RNA_def_enum(ot->srna, "type", axis_items, 0, "Axis", "Axis tag names with");
}
-
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index cee99c3b8f8..067b9fd76a8 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -204,7 +204,11 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "ARMATURE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_align", AKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "ARMATURE_OT_calculate_roll", NKEY, KM_PRESS, KM_CTRL, 0);
+#else
+ WM_keymap_add_item(keymap, "ARMATURE_OT_calculate_roll", NKEY, KM_PRESS, KM_SHIFT, 0);
+#endif
WM_keymap_add_item(keymap, "ARMATURE_OT_roll_clear", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_switch_direction", FKEY, KM_PRESS, KM_ALT, 0);
@@ -247,8 +251,12 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_armature_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_armature_delete", DELKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "ARMATURE_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0);
+
WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
+
+ WM_keymap_add_item(keymap, "ARMATURE_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "ARMATURE_OT_dissolve", DELKEY, KM_PRESS, KM_CTRL, 0);
+
WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_forked", EKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
@@ -395,4 +403,3 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_specials", WKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_pose_propagate", PKEY, KM_PRESS, KM_ALT, 0);
}
-
diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c
index cc149d3e42f..e0155a8c435 100644
--- a/source/blender/editors/armature/armature_relations.c
+++ b/source/blender/editors/armature/armature_relations.c
@@ -909,4 +909,3 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
ot->prop = RNA_def_enum(ot->srna, "type", prop_editarm_clear_parent_types, 0, "ClearType", "What way to clear parenting");
}
-
diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c
index e295e1fd35a..ae2e7339c66 100644
--- a/source/blender/editors/armature/armature_select.c
+++ b/source/blender/editors/armature/armature_select.c
@@ -349,7 +349,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv
return OPERATOR_FINISHED;
}
-static int armature_select_linked_poll(bContext *C)
+static bool armature_select_linked_poll(bContext *C)
{
return (ED_operator_view3d_active(C) && ED_operator_editarmature(C));
}
diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c
index 87a66514417..63068e61ba3 100644
--- a/source/blender/editors/armature/armature_skinning.c
+++ b/source/blender/editors/armature/armature_skinning.c
@@ -45,11 +45,12 @@
#include "BKE_armature.h"
#include "BKE_context.h"
#include "BKE_deform.h"
+#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
+#include "BKE_modifier.h"
#include "BKE_object_deform.h"
#include "BKE_report.h"
#include "BKE_subsurf.h"
-#include "BKE_modifier.h"
#include "DEG_depsgraph.h"
@@ -259,7 +260,7 @@ static void add_verts_to_dgroups(
* into account and vertex weights can be mirrored.
*
* The mesh vertex positions used are either the final deformed coords
- * from the derivedmesh in weightpaint mode, the final subsurf coords
+ * from the evaluated mesh in weightpaint mode, the final subsurf coords
* when parenting, or simply the original mesh coords.
*/
@@ -373,15 +374,11 @@ static void add_verts_to_dgroups(
verts = MEM_callocN(mesh->totvert * sizeof(*verts), "closestboneverts");
if (wpmode) {
- /* if in weight paint mode, use final verts from derivedmesh */
- DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ /* if in weight paint mode, use final verts from evaluated mesh */
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
- if (dm->foreachMappedVert) {
- mesh_get_mapped_verts_coords(dm, verts, mesh->totvert);
- vertsfilled = 1;
- }
-
- dm->release(dm);
+ BKE_mesh_foreach_mapped_vert_coords_get(me_eval, verts, mesh->totvert);
+ vertsfilled = 1;
}
else if (modifiers_findByType(ob, eModifierType_Subsurf)) {
/* is subsurf on? Lets use the verts on the limit surface then.
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 1f01def5133..001c8ce215f 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -29,6 +29,7 @@
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_scene_types.h"
#include "BLI_math.h"
@@ -39,10 +40,10 @@
#include "BLT_translation.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_modifier.h"
+#include "BKE_bvhutils.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
+#include "BKE_modifier.h"
#include "ED_mesh.h"
#include "ED_armature.h"
diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h
index 9c4ceacbee6..6758f9d16ac 100644
--- a/source/blender/editors/armature/meshlaplacian.h
+++ b/source/blender/editors/armature/meshlaplacian.h
@@ -71,4 +71,3 @@ void rigid_deform_end(int cancel);
/* ED_mesh_deform_bind_callback(...) defined in ED_armature.h */
#endif
-
diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c
index ffe64cc24b0..661492ba056 100644
--- a/source/blender/editors/armature/pose_edit.c
+++ b/source/blender/editors/armature/pose_edit.c
@@ -294,7 +294,7 @@ void POSE_OT_paths_calculate(wmOperatorType *ot)
/* --------- */
-static int pose_update_paths_poll(bContext *C)
+static bool pose_update_paths_poll(bContext *C)
{
if (ED_operator_posemode_exclusive(C)) {
Object *ob = CTX_data_active_object(C);
@@ -773,7 +773,7 @@ void POSE_OT_rotation_mode_set(wmOperatorType *ot)
/* ********************************************** */
-static int armature_layers_poll(bContext *C)
+static bool armature_layers_poll(bContext *C)
{
/* Armature layers operators can be used in posemode OR editmode for armatures */
return ED_operator_posemode(C) || ED_operator_editarmature(C);
@@ -806,7 +806,7 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op)
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16;
- int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {false}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
int i;
/* sanity checking */
@@ -858,7 +858,7 @@ static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *ev
Object *ob = CTX_data_active_object(C);
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
- int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* sanity checking */
if (arm == NULL)
@@ -879,7 +879,7 @@ static int armature_layers_exec(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
bArmature *arm = armature_layers_get_data(&ob);
PointerRNA ptr;
- int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
if (arm == NULL) {
return OPERATOR_CANCELLED;
@@ -923,7 +923,7 @@ void ARMATURE_OT_armature_layers(wmOperatorType *ot)
/* Present a popup to get the layers that should be used */
static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
@@ -949,7 +949,7 @@ static int pose_bone_layers_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
PointerRNA ptr;
- int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
if (ob == NULL || ob->data == NULL) {
return OPERATOR_CANCELLED;
@@ -998,7 +998,7 @@ void POSE_OT_bone_layers(wmOperatorType *ot)
/* Present a popup to get the layers that should be used */
static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get layers that are active already */
CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones)
@@ -1026,7 +1026,7 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_edit_object(C);
PointerRNA ptr;
- int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
+ bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
/* get the values set in the operator properties */
RNA_boolean_get_array(op->ptr, "layers", layers);
@@ -1262,7 +1262,7 @@ static int toggle_bone_selection_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int pose_select_linked_poll(bContext *C)
+static bool pose_select_linked_poll(bContext *C)
{
return (ED_operator_view3d_active(C) && ED_operator_posemode(C));
}
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index b9c4584ff15..2227bf33908 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -174,7 +174,7 @@ static Object *get_poselib_object(bContext *C)
}
/* Poll callback for operators that require existing PoseLib data (with poses) to work */
-static int has_poselib_pose_data_poll(bContext *C)
+static bool has_poselib_pose_data_poll(bContext *C)
{
Object *ob = get_poselib_object(C);
return (ob && ob->poselib);
@@ -183,7 +183,7 @@ static int has_poselib_pose_data_poll(bContext *C)
/* Poll callback for operators that require existing PoseLib data (with poses)
* as they need to do some editing work on those poses (i.e. not on lib-linked actions)
*/
-static int has_poselib_pose_data_for_editing_poll(bContext *C)
+static bool has_poselib_pose_data_for_editing_poll(bContext *C)
{
Object *ob = get_poselib_object(C);
return (ob && ob->poselib && !ID_IS_LINKED(ob->poselib));
@@ -379,7 +379,7 @@ void POSELIB_OT_action_sanitize(wmOperatorType *ot)
/* ------------------------------------------ */
/* Poll callback for adding poses to a PoseLib */
-static int poselib_add_poll(bContext *C)
+static bool poselib_add_poll(bContext *C)
{
/* There are 2 cases we need to be careful with:
* 1) When this operator is invoked from a hotkey, there may be no PoseLib yet
@@ -1115,10 +1115,8 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
/* do header print - if interactively previewing */
if (pld->state == PL_PREVIEW_RUNNING) {
if (pld->flag & PL_PREVIEW_SHOWORIGINAL) {
- BLI_strncpy(pld->headerstr,
- IFACE_("PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again"),
- sizeof(pld->headerstr));
- ED_area_headerprint(pld->sa, pld->headerstr);
+ ED_area_status_text(pld->sa, IFACE_("PoseLib Previewing Pose: [Showing Original Pose]"));
+ ED_workspace_status_text(C, IFACE_("Use Tab to start previewing poses again"));
}
else if (pld->searchstr[0]) {
char tempstr[65];
@@ -1142,17 +1140,17 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
IFACE_("PoseLib Previewing Pose: Filter - [%s] | "
- "Current Pose - \"%s\" | "
- "Use ScrollWheel or PageUp/Down to change"),
+ "Current Pose - \"%s\""),
tempstr, markern);
- ED_area_headerprint(pld->sa, pld->headerstr);
+ ED_area_status_text(pld->sa, pld->headerstr);
+ ED_workspace_status_text(C, IFACE_("Use ScrollWheel or PageUp/Down to change pose"));
}
else {
BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
- IFACE_("PoseLib Previewing Pose: \"%s\" | "
- "Use ScrollWheel or PageUp/Down to change"),
+ IFACE_("PoseLib Previewing Pose: \"%s\""),
pld->marker->name);
- ED_area_headerprint(pld->sa, pld->headerstr);
+ ED_area_status_text(pld->sa, pld->headerstr);
+ ED_workspace_status_text(C, NULL);
}
}
@@ -1602,7 +1600,8 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
TimeMarker *marker = pld->marker;
/* redraw the header so that it doesn't show any of our stuff anymore */
- ED_area_headerprint(pld->sa, NULL);
+ ED_area_status_text(pld->sa, NULL);
+ ED_workspace_status_text(C, NULL);
/* this signal does one recalc on pose, then unlocks, so ESC or edit will work */
pose->flag |= POSE_DO_UNLOCK;
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c
index 75fd952b52a..72f0c68f660 100644
--- a/source/blender/editors/armature/pose_select.c
+++ b/source/blender/editors/armature/pose_select.c
@@ -390,7 +390,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, const wmEve
return OPERATOR_FINISHED;
}
-static int pose_select_linked_poll(bContext *C)
+static bool pose_select_linked_poll(bContext *C)
{
return (ED_operator_view3d_active(C) && ED_operator_posemode(C));
}
@@ -1049,4 +1049,3 @@ void POSE_OT_select_mirror(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "only_active", false, "Active Only", "Only operate on the active bone");
RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection");
}
-
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index b82535f013b..0a07af4ab43 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -705,7 +705,7 @@ static void pose_slide_draw_status(tPoseSlideOp *pso)
BLI_snprintf(status_str, sizeof(status_str), "%s: %d %% | %s", mode_str, (int)(pso->percentage * 100.0f), limits_str);
}
- ED_area_headerprint(pso->sa, status_str);
+ ED_area_status_text(pso->sa, status_str);
}
/* common code for invoke() methods */
@@ -857,7 +857,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
case PADENTER:
{
/* return to normal cursor and header status */
- ED_area_headerprint(pso->sa, NULL);
+ ED_area_status_text(pso->sa, NULL);
WM_cursor_modal_restore(win);
/* insert keyframes as required... */
@@ -872,7 +872,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
case RIGHTMOUSE:
{
/* return to normal cursor and header status */
- ED_area_headerprint(pso->sa, NULL);
+ ED_area_status_text(pso->sa, NULL);
WM_cursor_modal_restore(win);
/* reset transforms back to original state */
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index 5d27e13ed17..29124f9c895 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -286,7 +286,11 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "CURVE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "unselected", true);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "CURVE_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
+#else
+ WM_keymap_add_item(keymap, "CURVE_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT, 0);
+#endif
WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index aa50916f5e0..1d7a9ac46c7 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -6244,7 +6244,7 @@ bool ED_curve_active_center(Curve *cu, float center[3])
/******************** Match texture space operator ***********************/
-static int match_texture_space_poll(bContext *C)
+static bool match_texture_space_poll(bContext *C)
{
Object *object = CTX_data_active_object(C);
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 887f3dd13da..e679b04f25d 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -53,6 +53,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "curve_intern.h"
@@ -433,15 +434,15 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
+ GPU_blend(true);
+ GPU_line_smooth(true);
imm_cpack(0x0);
immBegin(GWN_PRIM_LINE_STRIP, stroke_len);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
if (v3d->zbuf) {
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
}
for (int i = 0; i < stroke_len; i++) {
@@ -452,7 +453,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
imm_cpack(0xffffffff);
immBegin(GWN_PRIM_LINE_STRIP, stroke_len);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
for (int i = 0; i < stroke_len; i++) {
immVertex3fv(pos, coord_array[i]);
@@ -461,11 +462,11 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
immEnd();
if (v3d->zbuf) {
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
immUnbindProgram();
}
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index 98b57fcbd71..640239ccc60 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -202,6 +202,10 @@ set(ICON_NAMES
group_uvs
rna
rna_add
+ mouse_lmb
+ mouse_mmb
+ mouse_rmb
+ mouse_drag
outliner_ob_empty
outliner_ob_mesh
outliner_ob_curve
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index a30cb578046..a79a5052eb8 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -64,6 +64,7 @@
#include "GPU_immediate.h"
#include "GPU_draw.h"
+#include "GPU_state.h"
#include "ED_gpencil.h"
#include "ED_screen.h"
@@ -215,7 +216,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
if (totpoints == 1) {
/* if drawing a single point, draw it larger */
- glPointSize((float)(thickness + 2) * points->pressure);
+ GPU_point_size((float)(thickness + 2) * points->pressure);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
immBegin(GWN_PRIM_POINTS, 1);
gp_set_tpoint_varying_color(pt, ink, color);
@@ -225,7 +226,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
float oldpressure = points[0].pressure;
/* draw stroke curve */
- glLineWidth(max_ff(oldpressure * thickness, 1.0));
+ GPU_line_width(max_ff(oldpressure * thickness, 1.0));
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints);
@@ -245,7 +246,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
immEnd();
draw_points = 0;
- glLineWidth(max_ff(pt->pressure * thickness, 1.0f));
+ GPU_line_width(max_ff(pt->pressure * thickness, 1.0f));
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1);
/* need to roll-back one point to ensure that there are no gaps in the stroke */
@@ -625,7 +626,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
/* TODO: implement this with a geometry shader to draw one continuous tapered stroke */
/* draw stroke curve */
- glLineWidth(max_ff(curpressure * thickness, 1.0f));
+ GPU_line_width(max_ff(curpressure * thickness, 1.0f));
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints + cyclic_add);
const bGPDspoint *pt = points;
for (int i = 0; i < totpoints; i++, pt++) {
@@ -646,7 +647,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
draw_points = 0;
curpressure = pt->pressure;
- glLineWidth(max_ff(curpressure * thickness, 1.0f));
+ GPU_line_width(max_ff(curpressure * thickness, 1.0f));
immBeginAtMost(GWN_PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add);
/* need to roll-back one point to ensure that there are no gaps in the stroke */
@@ -941,7 +942,7 @@ static void gp_draw_strokes(
if (no_xray) {
glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig);
glDepthMask(0);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
/* first arg is normally rv3d->dist, but this isn't
* available here and seems to work quite well without */
@@ -1005,7 +1006,7 @@ static void gp_draw_strokes(
}
if (no_xray) {
glDepthMask(mask_orig);
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
bglPolygonOffset(0.0, 0.0);
}
@@ -1090,7 +1091,7 @@ static void gp_draw_strokes_edit(
if (no_xray) {
glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig);
glDepthMask(0);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
/* first arg is normally rv3d->dist, but this isn't
* available here and seems to work quite well without */
@@ -1215,7 +1216,7 @@ static void gp_draw_strokes_edit(
if (dflag & GP_DRAWDATA_ONLY3D) {
if (no_xray) {
glDepthMask(mask_orig);
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
bglPolygonOffset(0.0, 0.0);
#if 0
@@ -1329,7 +1330,7 @@ void ED_gp_draw_interpolation(tGPDinterpolate *tgpi, const int type)
}
/* turn on alpha-blending */
- glEnable(GL_BLEND);
+ GPU_blend(true);
for (tgpil = tgpi->ilayers.first; tgpil; tgpil = tgpil->next) {
/* calculate parent position */
ED_gpencil_parent_location(tgpil->gpl, diff_mat);
@@ -1338,7 +1339,7 @@ void ED_gp_draw_interpolation(tGPDinterpolate *tgpi, const int type)
tgpil->gpl->thickness, 1.0f, color, true, true, diff_mat);
}
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* loop over gpencil data layers, drawing them */
@@ -1365,7 +1366,7 @@ static void gp_draw_data_layers(
continue;
/* set basic stroke thickness */
- glLineWidth(lthick);
+ GPU_line_width(lthick);
/* Add layer drawing settings to the set of "draw flags"
* NOTE: If the setting doesn't apply, it *must* be cleared,
@@ -1479,15 +1480,15 @@ static void gp_draw_status_text(const bGPdata *gpd, ARegion *ar)
/* grease pencil icon... */
// XXX: is this too intrusive?
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
xco -= U.widget_unit;
yco -= (int)printable_size[1] / 2;
UI_icon_draw(xco, yco, ICON_GREASEPENCIL);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -1497,7 +1498,7 @@ static void gp_draw_data(
int offsx, int offsy, int winx, int winy, int cfra, int dflag)
{
/* turn on smooth lines (i.e. anti-aliasing) */
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
/* XXX: turn on some way of ensuring that the polygon edges get smoothed
* GL_POLYGON_SMOOTH is nasty and shouldn't be used, as it ends up
@@ -1505,15 +1506,15 @@ static void gp_draw_data(
*/
/* turn on alpha-blending */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
/* draw! */
gp_draw_data_layers(brush, alpha, gpd, offsx, offsy, winx, winy, cfra, dflag);
/* turn off alpha blending, then smooth lines */
- glDisable(GL_BLEND); // alpha blending
- glDisable(GL_LINE_SMOOTH); // smooth lines
+ GPU_blend(false); // alpha blending
+ GPU_line_smooth(false); // smooth lines
}
/* if we have strokes for scenes (3d view)/clips (movie clip editor)
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index f9284d71db3..75e4c510bcf 100644
--- a/source/blender/editors/gpencil/gpencil_brush.c
+++ b/source/blender/editors/gpencil/gpencil_brush.c
@@ -78,6 +78,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
+#include "GPU_state.h"
#include "gpencil_intern.h"
@@ -988,8 +989,8 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customda
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
/* Inner Ring: Light color for action of the brush */
/* TODO: toggle between add and remove? */
@@ -1002,8 +1003,8 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customda
immUnbindProgram();
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
}
}
@@ -1042,7 +1043,7 @@ static void gpsculpt_brush_header_set(bContext *C, tGP_BrushEditData *gso)
" | Shift-Wheel Up/Down for Strength"),
(brush_name) ? brush_name : "<?>");
- ED_area_headerprint(CTX_wm_area(C), str);
+ ED_workspace_status_text(C, str);
}
/* ************************************************ */
@@ -1176,7 +1177,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
}
/* disable cursor and headerprints */
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
WM_cursor_modal_restore(win);
gpencil_toggle_brush_cursor(C, false);
@@ -1186,7 +1187,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
}
/* poll callback for stroke sculpting operator(s) */
-static int gpsculpt_brush_poll(bContext *C)
+static bool gpsculpt_brush_poll(bContext *C)
{
/* NOTE: this is a bit slower, but is the most accurate... */
return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0;
diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c
index d2301337c0e..ccdbcba71f9 100644
--- a/source/blender/editors/gpencil/gpencil_convert.c
+++ b/source/blender/editors/gpencil/gpencil_convert.c
@@ -1291,7 +1291,7 @@ static void gp_convert_set_end_frame(struct Main *UNUSED(main), struct Scene *UN
}
}
-static int gp_convert_poll(bContext *C)
+static bool gp_convert_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDlayer *gpl = NULL;
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 9f437f28f0f..c28fea0fc41 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -131,7 +131,7 @@ void GPENCIL_OT_data_add(wmOperatorType *ot)
/* ******************* Unlink Data ************************ */
/* poll callback for adding data/layers - special */
-static int gp_data_unlink_poll(bContext *C)
+static bool gp_data_unlink_poll(bContext *C)
{
bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
@@ -420,7 +420,7 @@ void GPENCIL_OT_hide(wmOperatorType *ot)
/* ********************** Show All Layers ***************************** */
/* poll callback for showing layers */
-static int gp_reveal_poll(bContext *C)
+static bool gp_reveal_poll(bContext *C)
{
return ED_gpencil_data_get_active(C) != NULL;
}
@@ -1811,7 +1811,7 @@ void GPENCIL_OT_palettecolor_hide(wmOperatorType *ot)
/* ********************** Show All Colors ***************************** */
/* poll callback for showing colors */
-static int gp_palettecolor_reveal_poll(bContext *C)
+static bool gp_palettecolor_reveal_poll(bContext *C)
{
return ED_gpencil_data_get_active(C) != NULL;
}
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 45caadf3742..ec67b2da161 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -86,7 +86,7 @@
/* ************************************************ */
/* Stroke Edit Mode Management */
-static int gpencil_editmode_toggle_poll(bContext *C)
+static bool gpencil_editmode_toggle_poll(bContext *C)
{
return ED_gpencil_data_get_active(C) != NULL;
}
@@ -131,7 +131,7 @@ void GPENCIL_OT_editmode_toggle(wmOperatorType *ot)
/* Stroke Editing Operators */
/* poll callback for all stroke editing operators */
-static int gp_stroke_edit_poll(bContext *C)
+static bool gp_stroke_edit_poll(bContext *C)
{
/* NOTE: this is a bit slower, but is the most accurate... */
return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0;
@@ -517,7 +517,7 @@ void GPENCIL_OT_copy(wmOperatorType *ot)
/* --------------------- */
/* Paste selected strokes */
-static int gp_strokes_paste_poll(bContext *C)
+static bool gp_strokes_paste_poll(bContext *C)
{
/* 1) Must have GP datablock to paste to
* - We don't need to have an active layer though, as that can easily get added
@@ -784,7 +784,7 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot)
/* ********************* Add Blank Frame *************************** */
/* Basically the same as the drawing op */
-static int UNUSED_FUNCTION(gp_blank_frame_add_poll)(bContext *C)
+static bool UNUSED_FUNCTION(gp_blank_frame_add_poll)(bContext *C)
{
if (ED_operator_regionactive(C)) {
/* check if current context can support GPencil data */
@@ -864,7 +864,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot)
/* ******************* Delete Active Frame ************************ */
-static int gp_actframe_delete_poll(bContext *C)
+static bool gp_actframe_delete_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
@@ -916,7 +916,7 @@ void GPENCIL_OT_active_frame_delete(wmOperatorType *ot)
/* **************** Delete All Active Frames ****************** */
-static int gp_actframe_delete_all_poll(bContext *C)
+static bool gp_actframe_delete_all_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
@@ -1370,7 +1370,7 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot)
/* NOTE: For now, we only allow these in the 3D view, as other editors do not
* define a cursor or gridstep which can be used
*/
-static int gp_snap_poll(bContext *C)
+static bool gp_snap_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
ScrArea *sa = CTX_wm_area(C);
@@ -2090,7 +2090,7 @@ typedef enum eGP_ReprojectModes {
GP_REPROJECT_SURFACE,
} eGP_ReprojectModes;
-static int gp_strokes_reproject_poll(bContext *C)
+static bool gp_strokes_reproject_poll(bContext *C)
{
/* 2 Requirements:
* - 1) Editable GP data
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 67b88efa285..90ff1e0bb25 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -94,12 +94,12 @@ bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float
/* Poll Callbacks ------------------------------------ */
/* gpencil_utils.c */
-int gp_add_poll(struct bContext *C);
-int gp_active_layer_poll(struct bContext *C);
-int gp_active_brush_poll(struct bContext *C);
-int gp_active_palette_poll(struct bContext *C);
-int gp_active_palettecolor_poll(struct bContext *C);
-int gp_brush_crt_presets_poll(bContext *C);
+bool gp_add_poll(struct bContext *C);
+bool gp_active_layer_poll(struct bContext *C);
+bool gp_active_brush_poll(struct bContext *C);
+bool gp_active_palette_poll(struct bContext *C);
+bool gp_active_palettecolor_poll(struct bContext *C);
+bool gp_brush_crt_presets_poll(bContext *C);
/* Copy/Paste Buffer --------------------------------- */
/* gpencil_edit.c */
diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c
index ff3f5b20858..cc30d7ec266 100644
--- a/source/blender/editors/gpencil/gpencil_interpolate.c
+++ b/source/blender/editors/gpencil/gpencil_interpolate.c
@@ -85,7 +85,7 @@
/* Core/Shared Utilities */
/* Poll callback for interpolation operators */
-static int gpencil_view3d_poll(bContext *C)
+static bool gpencil_view3d_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
bGPDlayer *gpl = CTX_data_active_gpencil_layer(C);
@@ -352,32 +352,33 @@ static void gpencil_mouse_update_shift(tGPDinterpolate *tgpi, wmOperator *op, co
}
/* Helper: Draw status message while the user is running the operator */
-static void gpencil_interpolate_status_indicators(tGPDinterpolate *p)
+static void gpencil_interpolate_status_indicators(bContext *C, tGPDinterpolate *p)
{
Scene *scene = p->scene;
char status_str[UI_MAX_DRAW_STR];
char msg_str[UI_MAX_DRAW_STR];
- BLI_strncpy(msg_str, IFACE_("GPencil Interpolation: ESC/RMB to cancel, Enter/LMB to confirm, WHEEL/MOVE to adjust factor"), UI_MAX_DRAW_STR);
+ BLI_strncpy(msg_str, IFACE_("GPencil Interpolation: "), UI_MAX_DRAW_STR);
if (hasNumInput(&p->num)) {
char str_offs[NUM_STR_REP_LEN];
outputNumInput(&p->num, str_offs, &scene->unit);
- BLI_snprintf(status_str, sizeof(status_str), "%s: %s", msg_str, str_offs);
+ BLI_snprintf(status_str, sizeof(status_str), "%s%s", msg_str, str_offs);
}
else {
- BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", msg_str, (int)((p->init_factor + p->shift) * 100.0f));
+ BLI_snprintf(status_str, sizeof(status_str), "%s%d %%", msg_str, (int)((p->init_factor + p->shift) * 100.0f));
}
- ED_area_headerprint(p->sa, status_str);
+ ED_area_status_text(p->sa, status_str);
+ ED_workspace_status_text(C, IFACE_("ESC/RMB to cancel, Enter/LMB to confirm, WHEEL/MOVE to adjust factor"));
}
/* Update screen and stroke */
static void gpencil_interpolate_update(bContext *C, wmOperator *op, tGPDinterpolate *tgpi)
{
/* update shift indicator in header */
- gpencil_interpolate_status_indicators(tgpi);
+ gpencil_interpolate_status_indicators(C, tgpi);
/* apply... */
tgpi->shift = RNA_float_get(op->ptr, "shift");
/* update points position */
@@ -403,7 +404,8 @@ static void gpencil_interpolate_exit(bContext *C, wmOperator *op)
}
/* clear status message area */
- ED_area_headerprint(tgpi->sa, NULL);
+ ED_area_status_text(tgpi->sa, NULL);
+ ED_workspace_status_text(C, NULL);
/* finally, free memory used by temp data */
for (tgpil = tgpi->ilayers.first; tgpil; tgpil = tgpil->next) {
@@ -526,7 +528,7 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent
WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR);
/* update shift indicator in header */
- gpencil_interpolate_status_indicators(tgpi);
+ gpencil_interpolate_status_indicators(C, tgpi);
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
/* add a modal handler for this operator */
@@ -550,7 +552,8 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent
case RETKEY:
{
/* return to normal cursor and header status */
- ED_area_headerprint(tgpi->sa, NULL);
+ ED_area_status_text(tgpi->sa, NULL);
+ ED_workspace_status_text(C, NULL);
WM_cursor_modal_restore(win);
/* insert keyframes as required... */
@@ -585,7 +588,8 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent
case RIGHTMOUSE:
{
/* return to normal cursor and header status */
- ED_area_headerprint(tgpi->sa, NULL);
+ ED_area_status_text(tgpi->sa, NULL);
+ ED_workspace_status_text(C, NULL);
WM_cursor_modal_restore(win);
/* clean up temp data */
@@ -1032,7 +1036,7 @@ void GPENCIL_OT_interpolate_sequence(wmOperatorType *ot)
/* ******************** Remove Breakdowns ************************ */
-static int gpencil_interpolate_reverse_poll(bContext *C)
+static bool gpencil_interpolate_reverse_poll(bContext *C)
{
if (!gpencil_view3d_poll(C)) {
return 0;
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index cb6ccc8d8ef..f22d653800e 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -109,12 +109,13 @@ static void ed_keymap_gpencil_general(wmKeyConfig *keyconf)
/* Delete Active Frame - For easier video tutorials/review sessions */
/* NOTE: This works even when not in EditMode */
WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, 0, DKEY);
+ WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", DELKEY, KM_PRESS, 0, DKEY);
}
/* ==================== */
/* Poll callback for stroke editing mode */
-static int gp_stroke_editmode_poll(bContext *C)
+static bool gp_stroke_editmode_poll(bContext *C)
{
bGPdata *gpd = CTX_data_gpencil_data(C);
return (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE));
@@ -245,6 +246,7 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", DELKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", DELKEY, KM_PRESS, KM_SHIFT, 0);
/* menu edit specials */
WM_keymap_add_menu(keymap, "GPENCIL_MT_gpencil_edit_specials", WKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index c8f1901d075..ec8a213301f 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -73,6 +73,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -202,7 +203,7 @@ static void gp_session_validatebuffer(tGPsdata *p);
/* Context Wrangling... */
/* check if context is suitable for drawing */
-static int gpencil_draw_poll(bContext *C)
+static bool gpencil_draw_poll(bContext *C)
{
if (ED_operator_regionactive(C)) {
/* check if current context can support GPencil data */
@@ -1878,9 +1879,9 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
const uint shdr_pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_line_smooth(true);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
immUniformColor4ub(255, 100, 100, 20);
imm_draw_circle_fill_2d(shdr_pos, x, y, p->radius, 40);
@@ -1890,11 +1891,11 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
immUniformColor4f(1.0f, 0.39f, 0.39f, 0.78f);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniform1f("dash_width", 12.0f);
immUniform1f("dash_factor", 0.5f);
@@ -1905,8 +1906,8 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
immUnbindProgram();
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
}
}
@@ -2025,38 +2026,38 @@ static void gpencil_draw_cursor_set(tGPsdata *p)
}
/* update UI indicators of status, including cursor and header prints */
-static void gpencil_draw_status_indicators(tGPsdata *p)
+static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p)
{
/* header prints */
switch (p->status) {
case GP_STATUS_PAINTING:
/* only print this for paint-sessions, otherwise it gets annoying */
if (GPENCIL_SKETCH_SESSIONS_ON(p->scene))
- ED_area_headerprint(p->sa, IFACE_("Grease Pencil: Drawing/erasing stroke... Release to end stroke"));
+ ED_workspace_status_text(C, IFACE_("Grease Pencil: Drawing/erasing stroke... Release to end stroke"));
break;
case GP_STATUS_IDLING:
/* print status info */
switch (p->paintmode) {
case GP_PAINTMODE_ERASER:
- ED_area_headerprint(p->sa, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase | "
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Erase Session: Hold and drag LMB or RMB to erase | "
"ESC/Enter to end (or click outside this area)"));
break;
case GP_PAINTMODE_DRAW_STRAIGHT:
- ED_area_headerprint(p->sa, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | "
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Line Session: Hold and drag LMB to draw | "
"ESC/Enter to end (or click outside this area)"));
break;
case GP_PAINTMODE_DRAW:
- ED_area_headerprint(p->sa, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | "
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Freehand Session: Hold and drag LMB to draw | "
"E/ESC/Enter to end (or click outside this area)"));
break;
case GP_PAINTMODE_DRAW_POLY:
- ED_area_headerprint(p->sa, IFACE_("Grease Pencil Poly Session: LMB click to place next stroke vertex | "
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Poly Session: LMB click to place next stroke vertex | "
"ESC/Enter to end (or click outside this area)"));
break;
default: /* unhandled future cases */
- ED_area_headerprint(p->sa, IFACE_("Grease Pencil Session: ESC/Enter to end (or click outside this area)"));
+ ED_workspace_status_text(C, IFACE_("Grease Pencil Session: ESC/Enter to end (or click outside this area)"));
break;
}
break;
@@ -2064,7 +2065,7 @@ static void gpencil_draw_status_indicators(tGPsdata *p)
case GP_STATUS_ERROR:
case GP_STATUS_DONE:
/* clear status string */
- ED_area_headerprint(p->sa, NULL);
+ ED_workspace_status_text(C, NULL);
break;
}
}
@@ -2744,7 +2745,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
estate = OPERATOR_CANCELLED;
else {
/* update status indicators - cursor, header, etc. */
- gpencil_draw_status_indicators(p);
+ gpencil_draw_status_indicators(C, p);
gpencil_draw_cursor_set(p); /* cursor may have changed outside our control - T44084 */
}
diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c
index ac0b046e499..dd556e99264 100644
--- a/source/blender/editors/gpencil/gpencil_select.c
+++ b/source/blender/editors/gpencil/gpencil_select.c
@@ -67,7 +67,7 @@
/* ********************************************** */
/* Polling callbacks */
-static int gpencil_select_poll(bContext *C)
+static bool gpencil_select_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 4ee3bdd587e..8b65855f7c4 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -262,14 +262,14 @@ bool ED_gpencil_has_keyframe_v3d(Scene *scene, Object *ob, int cfra)
/* Poll Callbacks */
/* poll callback for adding data/layers - special */
-int gp_add_poll(bContext *C)
+bool gp_add_poll(bContext *C)
{
/* the base line we have is that we have somewhere to add Grease Pencil data */
return ED_gpencil_data_get_pointers(C, NULL) != NULL;
}
/* poll callback for checking if there is an active layer */
-int gp_active_layer_poll(bContext *C)
+bool gp_active_layer_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
@@ -278,7 +278,7 @@ int gp_active_layer_poll(bContext *C)
}
/* poll callback for checking if there is an active brush */
-int gp_active_brush_poll(bContext *C)
+bool gp_active_brush_poll(bContext *C)
{
ToolSettings *ts = CTX_data_tool_settings(C);
bGPDbrush *brush = BKE_gpencil_brush_getactive(ts);
@@ -287,7 +287,7 @@ int gp_active_brush_poll(bContext *C)
}
/* poll callback for checking if there is an active palette */
-int gp_active_palette_poll(bContext *C)
+bool gp_active_palette_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
@@ -296,7 +296,7 @@ int gp_active_palette_poll(bContext *C)
}
/* poll callback for checking if there is an active palette color */
-int gp_active_palettecolor_poll(bContext *C)
+bool gp_active_palettecolor_poll(bContext *C)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd);
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index f91e7d42bca..e2e110ffc31 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -48,4 +48,3 @@
#define GLA_PIXEL_OFS 0.375f
#endif /* #ifdef __BIF_GL_H__ */
-
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 943191c8892..59a54f03e56 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -690,6 +690,7 @@ void ANIM_list_elem_update(struct Main *bmain, struct Scene *scene, bAnimListEle
void ANIM_sync_animchannels_to_data(const struct bContext *C);
void ANIM_center_frame(struct bContext *C, int smooth_viewtx);
+
/* ************************************************* */
/* OPERATORS */
@@ -716,7 +717,10 @@ void ED_animedit_unlink_action(struct bContext *C, struct ID *id,
struct AnimData *adt, struct bAction *act,
struct ReportList *reports, bool force_delete);
+
+/* Drivers Editor - Utility to set up UI correctly */
+void ED_drivers_editor_init(struct bContext *C, struct ScrArea *sa);
+
/* ************************************************ */
#endif /* __ED_ANIM_API_H__ */
-
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 91f8b39f7b9..4844d96e6e8 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -44,13 +44,13 @@ struct Scene;
/* ** clip_editor.c ** */
/* common poll functions */
-int ED_space_clip_poll(struct bContext *C);
+bool ED_space_clip_poll(struct bContext *C);
-int ED_space_clip_view_clip_poll(struct bContext *C);
+bool ED_space_clip_view_clip_poll(struct bContext *C);
-int ED_space_clip_tracking_poll(struct bContext *C);
-int ED_space_clip_maskedit_poll(struct bContext *C);
-int ED_space_clip_maskedit_mask_poll(struct bContext *C);
+bool ED_space_clip_tracking_poll(struct bContext *C);
+bool ED_space_clip_maskedit_poll(struct bContext *C);
+bool ED_space_clip_maskedit_mask_poll(struct bContext *C);
void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height);
void ED_space_clip_get_size_fl(struct SpaceClip *sc, float size[2]);
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index 1559fc8f302..7d509d1243a 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -242,4 +242,3 @@ extern char datatoc_mc24_jpg[];
#endif /* __ED_DATAFILES_H__ */
-
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index f2b7d2cb4a1..64739d968b8 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -156,4 +156,3 @@ char *ED_fsmenu_entry_get_name(struct FSMenuEntry *fsentry);
void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name);
#endif /* __ED_FILESELECT_H__ */
-
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index 73926b8a687..f8af67b55ff 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -76,8 +76,8 @@ bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit);
bool ED_space_image_paint_curve(const struct bContext *C);
bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer);
-int ED_space_image_maskedit_poll(struct bContext *C);
-int ED_space_image_maskedit_mask_poll(struct bContext *C);
+bool ED_space_image_maskedit_poll(struct bContext *C);
+bool ED_space_image_maskedit_mask_poll(struct bContext *C);
void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y,
const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf);
@@ -85,4 +85,3 @@ void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, bool color_mana
bool ED_space_image_show_cache(struct SpaceImage *sima);
#endif /* __ED_IMAGE_H__ */
-
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 5882c44a9b3..b0807c8e5ae 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -133,7 +133,7 @@ struct KeyingSetInfo;
struct ExtensionRNA;
/* Polling Callback for KeyingSets */
-typedef int (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C);
+typedef bool (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C);
/* Context Iterator Callback for KeyingSets */
typedef void (*cbKeyingSet_Iterator)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks);
/* Property Specifier Callback for KeyingSets (called from iterators) */
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index a9c9e8c0fbd..a473974eb3f 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -225,14 +225,9 @@ typedef struct MirrTopoStore_t {
} MirrTopoStore_t;
bool ED_mesh_mirrtopo_recalc_check(
- struct Mesh *me, struct DerivedMesh *dm, MirrTopoStore_t *mesh_topo_store);
-bool ED_mesh_mirrtopo_recalc_check__real_mesh(
- struct Mesh *me, struct Mesh *dm, MirrTopoStore_t *mesh_topo_store);
+ struct Mesh *me, struct Mesh *me_eval, MirrTopoStore_t *mesh_topo_store);
void ED_mesh_mirrtopo_init(
- struct Mesh *me, struct DerivedMesh *dm, MirrTopoStore_t *mesh_topo_store,
- const bool skip_em_vert_array_init);
-void ED_mesh_mirrtopo_init__real_mesh(
- struct Mesh *me, struct Mesh *dm, MirrTopoStore_t *mesh_topo_store,
+ struct Mesh *me, struct Mesh *me_eval, MirrTopoStore_t *mesh_topo_store,
const bool skip_em_vert_array_init);
void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
@@ -284,7 +279,7 @@ void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int cou
void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count);
void ED_mesh_calc_tessface(struct Mesh *mesh, bool free_mpoly);
-void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface);
+void ED_mesh_update(struct Mesh *mesh, struct bContext *C, bool calc_edges, bool calc_tessface);
void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name);
int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set);
@@ -322,22 +317,17 @@ int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
/* mirror lookup api */
int ED_mesh_mirror_spatial_table(
- struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, const float co[3], char mode);
-int ED_mesh_mirror_spatial_table__real_mesh(
- struct Object *ob, struct BMEditMesh *em, struct Mesh *mesh, const float co[3], char mode);
-int ED_mesh_mirror_topo_table(struct Object *ob, struct DerivedMesh *dm, char mode);
-int ED_mesh_mirror_topo_table__real_mesh(struct Object *ob, struct Mesh *mesh, char mode);
+ struct Object *ob, struct BMEditMesh *em, struct Mesh *me_eval, const float co[3], char mode);
+int ED_mesh_mirror_topo_table(struct Object *ob, struct Mesh *me_eval, char mode);
/* retrieves mirrored cache vert, or NULL if there isn't one.
* note: calling this without ensuring the mirror cache state
* is bad.*/
-int mesh_get_x_mirror_vert(struct Object *ob, struct DerivedMesh *dm, int index, const bool use_topology);
-int mesh_get_x_mirror_vert__real_mesh(struct Object *ob, struct Mesh *mesh, int index, const bool use_topology);
+int mesh_get_x_mirror_vert(struct Object *ob, struct Mesh *me_eval, int index, const bool use_topology);
struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em,
struct BMVert *eve, const float co[3],
int index, const bool use_topology);
-int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm);
-int *mesh_get_x_mirror_faces__real_mesh(struct Object *ob, struct BMEditMesh *em, struct Mesh *mesh);
+int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em, struct Mesh *me_eval);
int ED_mesh_mirror_get_vert(struct Object *ob, int index);
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 0b3ce144097..8d652609fbc 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -110,4 +110,3 @@ void ED_operatormacros_node(void);
bool ED_space_node_color_sample(struct Main *bmain, struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]);
#endif /* __ED_NODE_H__ */
-
diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h
index c1b3c3e9e1c..52fdeb2045c 100644
--- a/source/blender/editors/include/ED_outliner.h
+++ b/source/blender/editors/include/ED_outliner.h
@@ -30,7 +30,7 @@
struct bContext;
struct ListBase;
-int ED_outliner_collections_editor_poll(struct bContext *C);
+bool ED_outliner_collections_editor_poll(struct bContext *C);
void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects);
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index 8b522c91188..b50250dfb96 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -71,4 +71,3 @@ void PE_deselect_all_visible(struct PTCacheEdit *edit);
void ED_particle_undosys_type(struct UndoType *ut);
#endif /* __ED_PARTICLE_H__ */
-
diff --git a/source/blender/editors/include/ED_physics.h b/source/blender/editors/include/ED_physics.h
index fed842c969e..32444beb0fe 100644
--- a/source/blender/editors/include/ED_physics.h
+++ b/source/blender/editors/include/ED_physics.h
@@ -40,9 +40,9 @@ struct Scene;
struct Object;
/* particle_edit.c */
-int PE_poll(struct bContext *C);
-int PE_hair_poll(struct bContext *C);
-int PE_poll_view3d(struct bContext *C);
+bool PE_poll(struct bContext *C);
+bool PE_hair_poll(struct bContext *C);
+bool PE_poll_view3d(struct bContext *C);
/* rigidbody_object.c */
bool ED_rigidbody_object_add(struct Main *bmain, struct Scene *scene, struct Object *ob, int type, struct ReportList *reports);
@@ -57,4 +57,3 @@ void ED_operatortypes_physics(void);
void ED_keymap_physics(struct wmKeyConfig *keyconf);
#endif /* __ED_PHYSICS_H__ */
-
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 204c5fa5956..1a7055e2cfa 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -60,6 +60,10 @@ struct Main;
struct wmMsgBus;
struct wmMsgSubscribeKey;
struct wmMsgSubscribeValue;
+struct wmOperatorType;
+struct IDProperty;
+struct MenuType;
+struct PropertyRNA;
/* regions */
void ED_region_do_listen(
@@ -141,13 +145,15 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int type);
void ED_area_tag_refresh(ScrArea *sa);
void ED_area_do_refresh(struct bContext *C, ScrArea *sa);
void ED_area_azones_update(ScrArea *sa, const int mouse_xy[]);
-void ED_area_headerprint(ScrArea *sa, const char *str);
+void ED_area_status_text(ScrArea *sa, const char *str);
void ED_area_newspace(struct bContext *C, ScrArea *sa, int type, const bool skip_ar_exit);
void ED_area_prevspace(struct bContext *C, ScrArea *sa);
void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2);
int ED_area_headersize(void);
int ED_area_header_alignment(const ScrArea *area);
int ED_area_global_size_y(const ScrArea *area);
+int ED_area_global_min_size_y(const ScrArea *area);
+int ED_area_global_max_size_y(const ScrArea *area);
bool ED_area_is_global(const ScrArea *area);
int ED_region_global_size_y(void);
void ED_area_update_region_sizes(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *area);
@@ -242,6 +248,8 @@ void ED_workspace_object_mode_sync_from_object(
void ED_workspace_object_mode_sync_from_scene(
struct wmWindowManager *wm, WorkSpace *workspace, struct Scene *scene);
+void ED_workspace_status_text(struct bContext *C, const char *str);
+
/* anim */
void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph);
@@ -257,61 +265,90 @@ void ED_keymap_screen(struct wmKeyConfig *keyconf);
void ED_operatortypes_workspace(void);
/* operators; context poll callbacks */
-int ED_operator_screenactive(struct bContext *C);
-int ED_operator_screen_mainwinactive(struct bContext *C);
-int ED_operator_areaactive(struct bContext *C);
-int ED_operator_regionactive(struct bContext *C);
-
-int ED_operator_scene(struct bContext *C);
-int ED_operator_scene_editable(struct bContext *C);
-int ED_operator_objectmode(struct bContext *C);
-
-int ED_operator_view3d_active(struct bContext *C);
-int ED_operator_region_view3d_active(struct bContext *C);
-int ED_operator_animview_active(struct bContext *C);
-int ED_operator_outliner_active(struct bContext *C);
-int ED_operator_outliner_active_no_editobject(struct bContext *C);
-int ED_operator_file_active(struct bContext *C);
-int ED_operator_action_active(struct bContext *C);
-int ED_operator_buttons_active(struct bContext *C);
-int ED_operator_node_active(struct bContext *C);
-int ED_operator_node_editable(struct bContext *C);
-int ED_operator_graphedit_active(struct bContext *C);
-int ED_operator_sequencer_active(struct bContext *C);
-int ED_operator_sequencer_active_editable(struct bContext *C);
-int ED_operator_image_active(struct bContext *C);
-int ED_operator_nla_active(struct bContext *C);
-int ED_operator_info_active(struct bContext *C);
-int ED_operator_console_active(struct bContext *C);
-
-
-int ED_operator_object_active(struct bContext *C);
-int ED_operator_object_active_editable(struct bContext *C);
-int ED_operator_object_active_editable_mesh(struct bContext *C);
-int ED_operator_object_active_editable_font(struct bContext *C);
-int ED_operator_editmesh(struct bContext *C);
-int ED_operator_editmesh_view3d(struct bContext *C);
-int ED_operator_editmesh_region_view3d(struct bContext *C);
-int ED_operator_editmesh_auto_smooth(struct bContext *C);
-int ED_operator_editarmature(struct bContext *C);
-int ED_operator_editcurve(struct bContext *C);
-int ED_operator_editcurve_3d(struct bContext *C);
-int ED_operator_editsurf(struct bContext *C);
-int ED_operator_editsurfcurve(struct bContext *C);
-int ED_operator_editsurfcurve_region_view3d(struct bContext *C);
-int ED_operator_editfont(struct bContext *C);
-int ED_operator_editlattice(struct bContext *C);
-int ED_operator_editmball(struct bContext *C);
-int ED_operator_uvedit(struct bContext *C);
-int ED_operator_uvedit_space_image(struct bContext *C);
-int ED_operator_uvmap(struct bContext *C);
-int ED_operator_posemode_exclusive(struct bContext *C);
-int ED_operator_posemode_context(struct bContext *C);
-int ED_operator_posemode(struct bContext *C);
-int ED_operator_posemode_local(struct bContext *C);
-int ED_operator_mask(struct bContext *C);
-int ED_operator_camera(struct bContext *C);
-
+bool ED_operator_screenactive(struct bContext *C);
+bool ED_operator_screen_mainwinactive(struct bContext *C);
+bool ED_operator_areaactive(struct bContext *C);
+bool ED_operator_regionactive(struct bContext *C);
+
+bool ED_operator_scene(struct bContext *C);
+bool ED_operator_scene_editable(struct bContext *C);
+bool ED_operator_objectmode(struct bContext *C);
+
+bool ED_operator_view3d_active(struct bContext *C);
+bool ED_operator_region_view3d_active(struct bContext *C);
+bool ED_operator_animview_active(struct bContext *C);
+bool ED_operator_outliner_active(struct bContext *C);
+bool ED_operator_outliner_active_no_editobject(struct bContext *C);
+bool ED_operator_file_active(struct bContext *C);
+bool ED_operator_action_active(struct bContext *C);
+bool ED_operator_buttons_active(struct bContext *C);
+bool ED_operator_node_active(struct bContext *C);
+bool ED_operator_node_editable(struct bContext *C);
+bool ED_operator_graphedit_active(struct bContext *C);
+bool ED_operator_sequencer_active(struct bContext *C);
+bool ED_operator_sequencer_active_editable(struct bContext *C);
+bool ED_operator_image_active(struct bContext *C);
+bool ED_operator_nla_active(struct bContext *C);
+bool ED_operator_info_active(struct bContext *C);
+bool ED_operator_console_active(struct bContext *C);
+
+
+bool ED_operator_object_active(struct bContext *C);
+bool ED_operator_object_active_editable(struct bContext *C);
+bool ED_operator_object_active_editable_mesh(struct bContext *C);
+bool ED_operator_object_active_editable_font(struct bContext *C);
+bool ED_operator_editmesh(struct bContext *C);
+bool ED_operator_editmesh_view3d(struct bContext *C);
+bool ED_operator_editmesh_region_view3d(struct bContext *C);
+bool ED_operator_editmesh_auto_smooth(struct bContext *C);
+bool ED_operator_editarmature(struct bContext *C);
+bool ED_operator_editcurve(struct bContext *C);
+bool ED_operator_editcurve_3d(struct bContext *C);
+bool ED_operator_editsurf(struct bContext *C);
+bool ED_operator_editsurfcurve(struct bContext *C);
+bool ED_operator_editsurfcurve_region_view3d(struct bContext *C);
+bool ED_operator_editfont(struct bContext *C);
+bool ED_operator_editlattice(struct bContext *C);
+bool ED_operator_editmball(struct bContext *C);
+bool ED_operator_uvedit(struct bContext *C);
+bool ED_operator_uvedit_space_image(struct bContext *C);
+bool ED_operator_uvmap(struct bContext *C);
+bool ED_operator_posemode_exclusive(struct bContext *C);
+bool ED_operator_posemode_context(struct bContext *C);
+bool ED_operator_posemode(struct bContext *C);
+bool ED_operator_posemode_local(struct bContext *C);
+bool ED_operator_mask(struct bContext *C);
+bool ED_operator_camera(struct bContext *C);
+
+/* screen_user_menu.c */
+
+struct bUserMenu *ED_screen_user_menu_find(struct bContext *C);
+struct bUserMenu *ED_screen_user_menu_ensure(struct bContext *C);
+
+
+struct bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(
+ struct ListBase *lb,
+ const struct wmOperatorType *ot, struct IDProperty *prop, short opcontext);
+struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu(
+ struct ListBase *lb,
+ const struct MenuType *mt);
+struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop(
+ struct ListBase *lb,
+ const char *context_data_path, const char *prop_id, int prop_index);
+
+void ED_screen_user_menu_item_add_operator(
+ struct ListBase *lb, const char *ui_name,
+ const struct wmOperatorType *ot, const struct IDProperty *prop, short opcontext);
+void ED_screen_user_menu_item_add_menu(
+ struct ListBase *lb, const char *ui_name,
+ const struct MenuType *mt);
+void ED_screen_user_menu_item_add_prop(
+ ListBase *lb, const char *ui_name,
+ const char *context_data_path, const char *prop_id, int prop_index);
+
+void ED_screen_user_menu_item_remove(
+ struct ListBase *lb, struct bUserMenuItem *umi);
+void ED_screen_user_menu_register(void);
/* Cache display helpers */
@@ -334,4 +371,3 @@ void ED_area_type_hud_ensure(struct bContext *C, struct ScrArea *sa);
#define ED_KEYMAP_HEADER 64
#endif /* __ED_SCREEN_H__ */
-
diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h
index 94885c2abe0..18446966c4f 100644
--- a/source/blender/editors/include/ED_sequencer.h
+++ b/source/blender/editors/include/ED_sequencer.h
@@ -35,9 +35,9 @@ struct SpaceSeq;
void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, bool deselect_all);
void ED_sequencer_deselect_all(struct Scene *scene);
-int ED_space_sequencer_maskedit_mask_poll(struct bContext *C);
+bool ED_space_sequencer_maskedit_mask_poll(struct bContext *C);
bool ED_space_sequencer_check_show_maskedit(struct SpaceSeq *sseq, struct Scene *scene);
-int ED_space_sequencer_maskedit_poll(struct bContext *C);
+bool ED_space_sequencer_maskedit_poll(struct bContext *C);
bool ED_space_sequencer_check_show_imbuf(struct SpaceSeq *sseq);
bool ED_space_sequencer_check_show_strip(struct SpaceSeq *sseq);
diff --git a/source/blender/editors/include/ED_sound.h b/source/blender/editors/include/ED_sound.h
index 87ab9041305..b4b424b0318 100644
--- a/source/blender/editors/include/ED_sound.h
+++ b/source/blender/editors/include/ED_sound.h
@@ -34,4 +34,3 @@
void ED_operatortypes_sound(void);
#endif /* __ED_SOUND_H__ */
-
diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h
index 9005d55feff..363bb31c3dc 100644
--- a/source/blender/editors/include/ED_transverts.h
+++ b/source/blender/editors/include/ED_transverts.h
@@ -50,7 +50,7 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, struct Object *obedit
void ED_transverts_update_obedit(TransVertStore *tvs, struct Object *obedit);
void ED_transverts_free(TransVertStore *tvs);
bool ED_transverts_check_obedit(Object *obedit);
-int ED_transverts_poll(struct bContext *C);
+bool ED_transverts_poll(struct bContext *C);
/* currently only used for bmesh index values */
enum {
diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h
index 37744e7eb0f..7995644f39e 100644
--- a/source/blender/editors/include/ED_undo.h
+++ b/source/blender/editors/include/ED_undo.h
@@ -68,4 +68,3 @@ void ED_undosys_type_free(void);
struct MemFile *ED_undosys_stack_memfile_get_active(struct UndoStack *ustack);
#endif /* __ED_UNDO_H__ */
-
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index 3a35bddeb77..7e91b5b88c1 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -55,4 +55,3 @@ void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, fl
void unpack_menu(struct bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf);
#endif /* __ED_UTIL_H__ */
-
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index e6cd276e5c7..434e9cfe2ac 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -145,4 +145,3 @@ void ED_uvedit_draw_main(
void ED_uvedit_buttons_register(struct ARegionType *art);
#endif /* __ED_UVEDIT_H__ */
-
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 343bffa0082..efcf5978968 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -98,11 +98,28 @@ typedef struct ViewDepths {
bool damaged;
} ViewDepths;
+
+/* Rotate 3D cursor on placement. */
+enum eV3DCursorOrient {
+ V3D_CURSOR_ORIENT_NONE = 0,
+ V3D_CURSOR_ORIENT_VIEW,
+ V3D_CURSOR_ORIENT_GEOM,
+};
+
struct View3DCursor *ED_view3d_cursor3d_get(struct Scene *scene, struct View3D *v3d);
-void ED_view3d_cursor3d_calc_mat3(const struct Scene *scene, const struct View3D *v3d, float mat[3][3]);
-void ED_view3d_cursor3d_calc_mat4(const struct Scene *scene, const struct View3D *v3d, float mat[4][4]);
-void ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]);
-void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2]);
+void ED_view3d_cursor3d_calc_mat3(const struct Scene *scene, const struct View3D *v3d, float mat[3][3]);
+void ED_view3d_cursor3d_calc_mat4(const struct Scene *scene, const struct View3D *v3d, float mat[4][4]);
+void ED_view3d_cursor3d_position(
+ struct bContext *C, const int mval[2],
+ const bool use_depth,
+ float cursor_co[3]);
+void ED_view3d_cursor3d_position_rotation(
+ struct bContext *C, const int mval[2],
+ const bool use_depth, enum eV3DCursorOrient orientation,
+ float cursor_co[3], float cursor_quat[4]);
+void ED_view3d_cursor3d_update(
+ struct bContext *C, const int mval[2],
+ bool use_depth, enum eV3DCursorOrient orientation);
struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d);
@@ -379,7 +396,7 @@ bool edge_inside_circle(const float cent[2], float radius, const float screen_co
/* get 3d region from context, also if mouse is in header or toolbar */
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar);
-int ED_operator_rv3d_user_region_poll(struct bContext *C);
+bool ED_operator_rv3d_user_region_poll(struct bContext *C);
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d);
@@ -390,7 +407,7 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d);
# define ED_view3d_clear_mats_rv3d(rv3d) (void)(rv3d)
# define ED_view3d_check_mats_rv3d(rv3d) (void)(rv3d)
#endif
-int ED_view3d_view_layer_set(int lay, const int *values, int *active);
+int ED_view3d_view_layer_set(int lay, const bool *values, int *active);
struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d);
void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat);
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 03c99bb7f0d..4c67a306e75 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -267,15 +267,16 @@ DEF_ICON(GROUP_UVS)
DEF_ICON(RNA)
DEF_ICON(RNA_ADD)
- /* available */
+ /* MONOCHROME ICONS */
+DEF_ICON(MOUSE_LMB)
+DEF_ICON(MOUSE_MMB)
+DEF_ICON(MOUSE_RMB)
+DEF_ICON(MOUSE_MOVE)
+DEF_ICON(MOUSE_LMB_DRAG)
+DEF_ICON(MOUSE_MMB_DRAG)
+DEF_ICON(MOUSE_RMB_DRAG)
+
#ifndef DEF_ICON_BLANK_SKIP
- DEF_ICON(BLANK092)
- DEF_ICON(BLANK093)
- DEF_ICON(BLANK094)
- DEF_ICON(BLANK095)
- DEF_ICON(BLANK096)
- DEF_ICON(BLANK097)
- DEF_ICON(BLANK098)
DEF_ICON(BLANK099)
DEF_ICON(BLANK100)
DEF_ICON(BLANK101)
@@ -292,10 +293,8 @@ DEF_ICON(RNA_ADD)
DEF_ICON(BLANK112)
DEF_ICON(BLANK113)
DEF_ICON(BLANK114)
-#endif
-DEF_ICON(RESTRICT_VIEW_OFF)
-DEF_ICON(RESTRICT_VIEW_ON)
-#ifndef DEF_ICON_BLANK_SKIP
+ DEF_ICON(BLANK115)
+ DEF_ICON(BLANK116)
DEF_ICON(BLANK116b)
#endif
@@ -356,8 +355,10 @@ DEF_ICON(OUTLINER_DATA_GREASEPENCIL)
DEF_ICON(BLANK138)
DEF_ICON(BLANK139)
DEF_ICON(BLANK140)
- DEF_ICON(BLANK141)
- DEF_ICON(BLANK142)
+#endif
+DEF_ICON(RESTRICT_VIEW_OFF)
+DEF_ICON(RESTRICT_VIEW_ON)
+#ifndef DEF_ICON_BLANK_SKIP
DEF_ICON(BLANK142b)
#endif
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 0b4817c8049..e5218e287d4 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -402,6 +402,15 @@ typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event);
*/
typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1);
+
+/* interface_query.c */
+bool UI_but_is_tool(const uiBut *but);
+#define UI_but_is_decorator(but) \
+ ((but)->func == ui_but_anim_decorate_cb)
+
+bool UI_block_is_empty(const uiBlock *block);
+
+
/* interface_region_menu_popup.c */
/* Popup Menus
*
@@ -418,6 +427,7 @@ uiPopupMenu *UI_popup_menu_begin_ex(
struct bContext *C, const char *title, const char *block_name,
int icon) ATTR_NONNULL();
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *head);
+bool UI_popup_menu_end_or_cancel(struct bContext *C, struct uiPopupMenu *head);
struct uiLayout *UI_popup_menu_layout(uiPopupMenu *head);
void UI_popup_menu_reports(struct bContext *C, struct ReportList *reports) ATTR_NONNULL();
@@ -980,16 +990,16 @@ bool uiLayoutGetPropSep(uiLayout *layout);
bool uiLayoutGetPropDecorate(uiLayout *layout);
/* layout specifiers */
-uiLayout *uiLayoutRow(uiLayout *layout, int align);
-uiLayout *uiLayoutColumn(uiLayout *layout, int align);
-uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align);
+uiLayout *uiLayoutRow(uiLayout *layout, bool align);
+uiLayout *uiLayoutColumn(uiLayout *layout, bool align);
+uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align);
uiLayout *uiLayoutGridFlow(
- uiLayout *layout, int row_major, int num_columns, int even_columns, int even_rows, int align);
+ uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align);
uiLayout *uiLayoutBox(uiLayout *layout);
uiLayout *uiLayoutListBox(uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop,
struct PointerRNA *actptr, struct PropertyRNA *actprop);
-uiLayout *uiLayoutAbsolute(uiLayout *layout, int align);
-uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align);
+uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align);
+uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align);
uiLayout *uiLayoutOverlap(uiLayout *layout);
uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout);
uiLayout *uiLayoutRadial(uiLayout *layout);
@@ -1030,22 +1040,22 @@ uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct Pointe
void uiTemplateOperatorRedoProperties(uiLayout *layout, const struct bContext *C);
uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
-void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, int show_buttons, struct ID *parent,
+void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, bool show_buttons, struct ID *parent,
struct MTex *slot, const char *preview_id);
-void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int expand);
+void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand);
void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale);
-void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int show_labels, float icon_scale);
+void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale);
void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type,
- int levels, int brush, int neg_slope);
-void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
-void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int color);
+ bool levels, bool brush, bool neg_slope);
+void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool value_slider, bool lock, bool lock_luminosity, bool cubic);
+void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool color);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
PointerRNA *used_ptr, const char *used_propname, int active_layer);
-void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview);
-void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management);
+void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, bool compact, bool multiview);
+void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, bool color_management);
void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr);
void uiTemplateImageViews(uiLayout *layout, struct PointerRNA *imaptr);
void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, PointerRNA *ptr);
@@ -1062,6 +1072,7 @@ void uiTemplateHeader3D_mode(uiLayout *layout, struct bContext *C);
void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
+void uiTemplateInputStatus(uiLayout *layout, struct bContext *C);
void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
void uiTemplateComponentMenu(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name);
void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float *color);
@@ -1078,9 +1089,9 @@ void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *
void uiTemplateTextureUser(uiLayout *layout, struct bContext *C);
void uiTemplateTextureShow(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop);
-void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, int compact);
+void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, bool compact);
void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname);
-void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int cmpact);
+void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, bool compact);
void uiTemplateMovieclipInformation(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr);
void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname);
@@ -1129,7 +1140,7 @@ void uiItemsFullEnumO_items(
void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); /* label icon for dragging */
-void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const char *name, int icon); /* menu */
+void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon); /* menu */
void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
void uiItemS(uiLayout *layout); /* separator */
void uiItemSpacer(uiLayout *layout); /* Special separator. */
@@ -1163,7 +1174,7 @@ void ED_operatortypes_ui(void);
void ED_keymap_ui(struct wmKeyConfig *keyconf);
void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop);
-int UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event);
+bool UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event);
bool UI_context_copy_to_selected_list(
struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop,
@@ -1258,8 +1269,4 @@ void UI_widgetbase_draw_cache_end(void);
/* Support click-drag motion which presses the button and closes a popover (like a menu). */
#define USE_UI_POPOVER_ONCE
-bool UI_but_is_tool(const uiBut *but);
-#define UI_but_is_decorator(but) \
- ((but)->func == ui_but_anim_decorate_cb)
-
#endif /* __UI_INTERFACE_H__ */
diff --git a/source/blender/editors/interface/CMakeLists.txt b/source/blender/editors/interface/CMakeLists.txt
index 07ba3b90e11..ee18f956cac 100644
--- a/source/blender/editors/interface/CMakeLists.txt
+++ b/source/blender/editors/interface/CMakeLists.txt
@@ -44,6 +44,7 @@ set(SRC
interface.c
interface_align.c
interface_anim.c
+ interface_context_menu.c
interface_draw.c
interface_eyedropper.c
interface_eyedropper_color.c
@@ -56,7 +57,7 @@ set(SRC
interface_layout.c
interface_ops.c
interface_panel.c
- interface_regions.c
+ interface_query.c
interface_region_color_picker.c
interface_region_hud.c
interface_region_menu_pie.c
@@ -65,6 +66,7 @@ set(SRC
interface_region_popup.c
interface_region_search.c
interface_region_tooltip.c
+ interface_regions.c
interface_style.c
interface_templates.c
interface_utils.c
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 8c37054098b..3b2a2e9d3ed 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -61,6 +61,7 @@
#include "GPU_glew.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "BLF_api.h"
#include "BLT_translation.h"
@@ -104,18 +105,6 @@ static void ui_but_to_pixelrect(struct rcti *rect, const struct ARegion *ar, str
static void ui_but_free(const bContext *C, uiBut *but);
-bool ui_block_is_menu(const uiBlock *block)
-{
- return (((block->flag & UI_BLOCK_LOOP) != 0) &&
- /* non-menu popups use keep-open, so check this is off */
- ((block->flag & UI_BLOCK_KEEP_OPEN) == 0));
-}
-
-bool ui_block_is_pie_menu(const uiBlock *block)
-{
- return ((block->flag & UI_BLOCK_RADIAL) != 0);
-}
-
static bool ui_but_is_unit_radians_ex(UnitSettings *unit, const int unit_type)
{
return (unit->system_rotation == USER_UNIT_ROT_RADIANS && unit_type == PROP_UNIT_ROTATION);
@@ -946,10 +935,11 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_str
else {
butstr_orig = BLI_strdup(but->str);
}
- BLI_snprintf(but->strdata,
- sizeof(but->strdata),
- "%s" UI_SEP_CHAR_S "%s",
- butstr_orig, shortcut_str);
+ BLI_snprintf(
+ but->strdata,
+ sizeof(but->strdata),
+ "%s" UI_SEP_CHAR_S "%s",
+ butstr_orig, shortcut_str);
MEM_freeN(butstr_orig);
but->str = but->strdata;
but->flag |= UI_BUT_HAS_SEP_CHAR;
@@ -1381,7 +1371,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
UI_block_end(C, block);
/* we set this only once */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* scale fonts */
ui_fontscale(&style.paneltitle.points, block->aspect);
@@ -2132,8 +2122,9 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va
precision = float_precision;
}
- bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision,
- unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad);
+ bUnit_AsString(
+ str, len_max, ui_get_but_scale_unit(but, value), precision,
+ unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad);
}
static float ui_get_but_step_unit(uiBut *but, float step_default)
@@ -2354,8 +2345,9 @@ static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char
/* ugly, use the draw string to get the value,
* this could cause problems if it includes some text which resolves to a unit */
- bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr,
- ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
+ bUnit_ReplaceString(
+ str_unit_convert, sizeof(str_unit_convert), but->drawstr,
+ ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
return BPY_execute_string_as_number(C, str_unit_convert, true, r_value);
}
@@ -3440,12 +3432,14 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
}
else {
if (item->icon) {
- uiDefIconTextButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0,
- UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
+ uiDefIconTextButI(
+ block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0,
+ UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
}
else {
- uiDefButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0,
- UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
+ uiDefButI(
+ block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0,
+ UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description);
}
}
}
@@ -4780,4 +4774,3 @@ void UI_exit(void)
ui_resources_free();
ui_but_clipboard_free();
}
-
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
new file mode 100644
index 00000000000..240649c8ab0
--- /dev/null
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -0,0 +1,817 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/interface/interface_context_menu.c
+ * \ingroup edinterface
+ *
+ * Generic context popup menus.
+ */
+
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+#include "BLI_utildefines.h"
+
+#include "BLT_translation.h"
+
+#include "BKE_addon.h"
+#include "BKE_context.h"
+#include "BKE_idprop.h"
+#include "BKE_screen.h"
+
+#include "ED_screen.h"
+#include "ED_keyframing.h"
+
+#include "UI_interface.h"
+
+#include "interface_intern.h"
+
+#include "RNA_access.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+/* This hack is needed because we don't have a good way to re-reference keymap items once added: T42944 */
+#define USE_KEYMAP_ADD_HACK
+
+/* -------------------------------------------------------------------- */
+/** \name Button Context Menu
+ * \{ */
+
+static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
+{
+ uiBut *but = (uiBut *)arg1;
+
+ if (but->optype) {
+ char shortcut_str[128];
+
+ IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+
+ /* complex code to change name of button */
+ if (WM_key_event_operator_string(
+ C, but->optype->idname, but->opcontext, prop, true,
+ shortcut_str, sizeof(shortcut_str)))
+ {
+ ui_but_add_shortcut(but, shortcut_str, true);
+ }
+ else {
+ /* simply strip the shortcut */
+ ui_but_add_shortcut(but, NULL, true);
+ }
+ }
+}
+
+static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ uiBlock *block;
+ uiBut *but = (uiBut *)arg;
+ wmKeyMap *km;
+ wmKeyMapItem *kmi;
+ PointerRNA ptr;
+ uiLayout *layout;
+ uiStyle *style = UI_style_get_dpi();
+ IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+
+ kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, true, &km);
+ BLI_assert(kmi != NULL);
+
+ RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
+
+ block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ UI_block_func_handle_set(block, but_shortcut_name_func, but);
+ UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
+ UI_block_direction_set(block, UI_DIR_CENTER_Y);
+
+ layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style);
+
+ uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
+
+ UI_block_bounds_set_popup(block, 6, -50, 26);
+
+ return block;
+}
+
+#ifdef USE_KEYMAP_ADD_HACK
+static int g_kmi_id_hack;
+#endif
+
+static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ uiBlock *block;
+ uiBut *but = (uiBut *)arg;
+ wmKeyMap *km;
+ wmKeyMapItem *kmi;
+ PointerRNA ptr;
+ uiLayout *layout;
+ uiStyle *style = UI_style_get_dpi();
+ IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+ int kmi_id;
+
+ /* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
+ km = WM_keymap_guess_opname(C, but->optype->idname);
+ kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
+ kmi_id = kmi->id;
+
+ /* copy properties, prop can be NULL for reset */
+ if (prop)
+ prop = IDP_CopyProperty(prop);
+ WM_keymap_properties_reset(kmi, prop);
+
+ /* update and get pointers again */
+ WM_keyconfig_update(wm);
+
+ km = WM_keymap_guess_opname(C, but->optype->idname);
+ kmi = WM_keymap_item_find_id(km, kmi_id);
+
+ RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
+
+ block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
+ UI_block_func_handle_set(block, but_shortcut_name_func, but);
+ UI_block_direction_set(block, UI_DIR_CENTER_Y);
+
+ layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style);
+
+ uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
+
+ UI_block_bounds_set_popup(block, 6, -50, 26);
+
+#ifdef USE_KEYMAP_ADD_HACK
+ g_kmi_id_hack = kmi_id;
+#endif
+ return block;
+}
+
+static void menu_add_shortcut_cancel(struct bContext *C, void *arg1)
+{
+ uiBut *but = (uiBut *)arg1;
+ wmKeyMap *km;
+ wmKeyMapItem *kmi;
+#ifndef USE_KEYMAP_ADD_HACK
+ IDProperty *prop;
+#endif
+ int kmi_id;
+
+#ifdef USE_KEYMAP_ADD_HACK
+ km = WM_keymap_guess_opname(C, but->optype->idname);
+ kmi_id = g_kmi_id_hack;
+ UNUSED_VARS(but);
+#else
+ prop = (but->opptr) ? but->opptr->data : NULL;
+ kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km);
+#endif
+
+ kmi = WM_keymap_item_find_id(km, kmi_id);
+ WM_keymap_remove_item(km, kmi);
+}
+
+static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
+{
+ uiBut *but = (uiBut *)arg1;
+ UI_popup_block_invoke(C, menu_change_shortcut, but);
+}
+
+static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
+{
+ uiBut *but = (uiBut *)arg1;
+ wmKeyMap *km;
+ wmKeyMapItem *kmi;
+ IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+
+ kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, true, &km);
+ BLI_assert(kmi != NULL);
+
+ WM_keymap_remove_item(km, kmi);
+
+ but_shortcut_name_func(C, but, 0);
+}
+
+static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
+{
+ uiBut *but = (uiBut *)arg1;
+ UI_popup_block_ex(C, menu_add_shortcut, NULL, menu_add_shortcut_cancel, but, NULL);
+}
+
+static bool ui_but_is_user_menu_compatible(bContext *C, uiBut *but)
+{
+ return (but->optype ||
+ (but->rnaprop &&
+ (RNA_property_type(but->rnaprop) == PROP_BOOLEAN) &&
+ (WM_context_member_from_ptr(C, &but->rnapoin) != NULL)) ||
+ UI_but_menutype_get(but));
+}
+
+static bUserMenuItem *ui_but_user_menu_find(bContext *C, uiBut *but, bUserMenu *um)
+{
+ MenuType *mt = NULL;
+ if (but->optype) {
+ IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+ return (bUserMenuItem *)ED_screen_user_menu_item_find_operator(
+ &um->items, but->optype, prop, but->opcontext);
+ }
+ else if (but->rnaprop) {
+ const char *member_id = WM_context_member_from_ptr(C, &but->rnapoin);
+ const char *prop_id = RNA_property_identifier(but->rnaprop);
+ return (bUserMenuItem *)ED_screen_user_menu_item_find_prop(
+ &um->items, member_id, prop_id, but->rnaindex);
+ }
+ else if ((mt = UI_but_menutype_get(but))) {
+ return (bUserMenuItem *)ED_screen_user_menu_item_find_menu(
+ &um->items, mt);
+ }
+ else {
+ return NULL;
+ }
+}
+
+static void ui_but_user_menu_add(bContext *C, uiBut *but, bUserMenu *um)
+{
+ BLI_assert(ui_but_is_user_menu_compatible(C, but));
+
+ char drawstr[sizeof(but->drawstr)];
+ STRNCPY(drawstr, but->drawstr);
+ if (but->flag & UI_BUT_HAS_SEP_CHAR) {
+ char *sep = strrchr(drawstr, UI_SEP_CHAR);
+ if (sep) {
+ *sep = '\0';
+ }
+ }
+
+ MenuType *mt = NULL;
+ if (but->optype) {
+ ED_screen_user_menu_item_add_operator(
+ &um->items, drawstr,
+ but->optype, but->opptr ? but->opptr->data : NULL, but->opcontext);
+ }
+ else if (but->rnaprop) {
+ /* Note: 'member_id' may be a path. */
+ const char *member_id = WM_context_member_from_ptr(C, &but->rnapoin);
+ const char *data_path = RNA_path_from_ID_to_struct(&but->rnapoin);
+ const char *member_id_data_path = member_id;
+ if (data_path) {
+ member_id_data_path = BLI_sprintfN("%s.%s", member_id, data_path);
+ }
+ const char *prop_id = RNA_property_identifier(but->rnaprop);
+ /* Note, ignore 'drawstr', use property idname always. */
+ ED_screen_user_menu_item_add_prop(
+ &um->items, "",
+ member_id_data_path, prop_id, but->rnaindex);
+ if (data_path) {
+ MEM_freeN((void *)data_path);
+ }
+ if (member_id != member_id_data_path) {
+ MEM_freeN((void *)member_id_data_path);
+ }
+ }
+ else if ((mt = UI_but_menutype_get(but))) {
+ ED_screen_user_menu_item_add_menu(
+ &um->items, drawstr,
+ mt);
+ }
+}
+
+static void popup_user_menu_add_or_replace_func(bContext *C, void *arg1, void *UNUSED(arg2))
+{
+ uiBut *but = arg1;
+ bUserMenu *um = ED_screen_user_menu_ensure(C);
+ ui_but_user_menu_add(C, but, um);
+}
+
+static void popup_user_menu_remove_func(bContext *UNUSED(C), void *arg1, void *arg2)
+{
+ bUserMenu *um = arg1;
+ bUserMenuItem *umi = arg2;
+ ED_screen_user_menu_item_remove(&um->items, umi);
+}
+
+static void ui_but_menu_add_path_operators(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop)
+{
+ const PropertySubType subtype = RNA_property_subtype(prop);
+ wmOperatorType *ot = WM_operatortype_find("WM_OT_path_open", true);
+ char filepath[FILE_MAX];
+ char dir[FILE_MAXDIR];
+ char file[FILE_MAXFILE];
+ PointerRNA props_ptr;
+
+ BLI_assert(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH));
+ UNUSED_VARS_NDEBUG(subtype);
+
+ RNA_property_string_get(ptr, prop, filepath);
+ BLI_split_dirfile(filepath, dir, file, sizeof(dir), sizeof(file));
+
+ if (file[0]) {
+ BLI_assert(subtype == PROP_FILEPATH);
+ uiItemFullO_ptr(
+ layout, ot, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open File Externally"),
+ ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &props_ptr);
+ RNA_string_set(&props_ptr, "filepath", filepath);
+ }
+
+ uiItemFullO_ptr(
+ layout, ot, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Location Externally"),
+ ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &props_ptr);
+ RNA_string_set(&props_ptr, "filepath", dir);
+}
+
+bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
+{
+ /* having this menu for some buttons makes no sense */
+ if (but->type == UI_BTYPE_IMAGE) {
+ return false;
+ }
+
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ {
+ uiStringInfo label = {BUT_GET_LABEL, NULL};
+
+ /* highly unlikely getting the label ever fails */
+ UI_but_string_info_get(C, but, &label, NULL);
+
+ pup = UI_popup_menu_begin(C, label.strinfo ? label.strinfo : "", ICON_NONE);
+ layout = UI_popup_menu_layout(pup);
+ if (label.strinfo) {
+ MEM_freeN(label.strinfo);
+ }
+ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
+ }
+
+ if (but->rnapoin.data && but->rnaprop) {
+ PointerRNA *ptr = &but->rnapoin;
+ PropertyRNA *prop = but->rnaprop;
+ const PropertyType type = RNA_property_type(prop);
+ const PropertySubType subtype = RNA_property_subtype(prop);
+ bool is_anim = RNA_property_animateable(ptr, prop);
+ bool is_editable = RNA_property_editable(ptr, prop);
+ /*bool is_idprop = RNA_property_is_idprop(prop);*/ /* XXX does not work as expected, not strictly needed */
+ bool is_set = RNA_property_is_set(ptr, prop);
+
+ /* second slower test, saved people finding keyframe items in menus when its not possible */
+ if (is_anim)
+ is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
+
+ /* determine if we can key a single component of an array */
+ const bool is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0;
+ const bool is_array_component = (is_array && but->rnaindex != -1);
+
+ const int override_status = RNA_property_static_override_status(ptr, prop, -1);
+ const bool is_overridable = (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE) != 0;
+
+ /* Keyframes */
+ if (but->flag & UI_BUT_ANIMATED_KEY) {
+ /* Set the (button_pointer, button_prop) and pointer data for Python access to the hovered ui element. */
+ uiLayoutSetContextFromBut(layout, but);
+
+ /* replace/delete keyfraemes */
+ if (is_array_component) {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Keyframes"),
+ ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Single Keyframe"),
+ ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Keyframes"),
+ ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Single Keyframe"),
+ ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 0);
+ }
+ else {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Keyframe"),
+ ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Keyframe"),
+ ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
+ }
+
+ /* keyframe settings */
+ uiItemS(layout);
+
+
+ }
+ else if (but->flag & UI_BUT_DRIVEN) {
+ /* pass */
+ }
+ else if (is_anim) {
+ if (is_array_component) {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframes"),
+ ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Single Keyframe"),
+ ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
+ }
+ else {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframe"),
+ ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
+ }
+ }
+
+ if ((but->flag & UI_BUT_ANIMATED) && (but->rnapoin.type != &RNA_NlaStrip)) {
+ if (is_array_component) {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
+ ICON_KEY_DEHLT, "ANIM_OT_keyframe_clear_button", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Single Keyframes"),
+ ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 0);
+ }
+ else {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
+ ICON_KEY_DEHLT, "ANIM_OT_keyframe_clear_button", "all", 1);
+ }
+ }
+
+ /* Drivers */
+ if (but->flag & UI_BUT_DRIVEN) {
+ uiItemS(layout);
+
+ if (is_array_component) {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Drivers"),
+ ICON_X, "ANIM_OT_driver_button_remove", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Single Driver"),
+ ICON_NONE, "ANIM_OT_driver_button_remove", "all", 0);
+ }
+ else {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Driver"),
+ ICON_X, "ANIM_OT_driver_button_remove", "all", 1);
+ }
+
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Driver"),
+ ICON_NONE, "ANIM_OT_copy_driver_button");
+ if (ANIM_driver_can_paste()) {
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
+ ICON_NONE, "ANIM_OT_paste_driver_button");
+ }
+
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Edit Driver"),
+ ICON_DRIVER, "ANIM_OT_driver_button_edit");
+
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"),
+ ICON_NONE, "SCREEN_OT_drivers_editor_show");
+ }
+ else if (but->flag & (UI_BUT_ANIMATED_KEY | UI_BUT_ANIMATED)) {
+ /* pass */
+ }
+ else if (is_anim) {
+ uiItemS(layout);
+
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Driver"),
+ ICON_DRIVER, "ANIM_OT_driver_button_add");
+
+ if (ANIM_driver_can_paste()) {
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
+ ICON_NONE, "ANIM_OT_paste_driver_button");
+ }
+
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"),
+ ICON_NONE, "SCREEN_OT_drivers_editor_show");
+ }
+
+ /* Keying Sets */
+ /* TODO: check on modifyability of Keying Set when doing this */
+ if (is_anim) {
+ uiItemS(layout);
+
+ if (is_array_component) {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add All to Keying Set"),
+ ICON_KEYINGSET, "ANIM_OT_keyingset_button_add", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Single to Keying Set"),
+ ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 0);
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"),
+ ICON_NONE, "ANIM_OT_keyingset_button_remove");
+ }
+ else {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Keying Set"),
+ ICON_KEYINGSET, "ANIM_OT_keyingset_button_add", "all", 1);
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"),
+ ICON_NONE, "ANIM_OT_keyingset_button_remove");
+ }
+ }
+
+ if (is_overridable) {
+ wmOperatorType *ot;
+ PointerRNA op_ptr;
+ /* Override Operators */
+ uiItemS(layout);
+
+ if (but->flag & UI_BUT_OVERRIDEN) {
+ if (is_array_component) {
+#if 0 /* Disabled for now. */
+ ot = WM_operatortype_find("UI_OT_override_type_set_button", false);
+ uiItemFullO_ptr(
+ layout, ot, "Overrides Type", ICON_NONE,
+ NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
+ RNA_boolean_set(&op_ptr, "all", true);
+ uiItemFullO_ptr(
+ layout, ot, "Single Override Type", ICON_NONE,
+ NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
+ RNA_boolean_set(&op_ptr, "all", false);
+#endif
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Overrides"),
+ ICON_X, "UI_OT_override_remove_button", "all", true);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Single Override"),
+ ICON_X, "UI_OT_override_remove_button", "all", false);
+ }
+ else {
+#if 0 /* Disabled for now. */
+ uiItemFullO(
+ layout, "UI_OT_override_type_set_button", "Override Type", ICON_NONE,
+ NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
+ RNA_boolean_set(&op_ptr, "all", false);
+#endif
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Override"),
+ ICON_X, "UI_OT_override_remove_button", "all", true);
+ }
+ }
+ else {
+ if (is_array_component) {
+ ot = WM_operatortype_find("UI_OT_override_type_set_button", false);
+ uiItemFullO_ptr(
+ layout, ot, "Define Overrides", ICON_NONE,
+ NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
+ RNA_boolean_set(&op_ptr, "all", true);
+ uiItemFullO_ptr(
+ layout, ot, "Define Single Override", ICON_NONE,
+ NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
+ RNA_boolean_set(&op_ptr, "all", false);
+ }
+ else {
+ uiItemFullO(
+ layout, "UI_OT_override_type_set_button", "Define Override", ICON_NONE,
+ NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
+ RNA_boolean_set(&op_ptr, "all", false);
+ }
+ }
+ }
+
+ uiItemS(layout);
+
+ /* Property Operators */
+
+ /* Copy Property Value
+ * Paste Property Value */
+
+ if (is_array_component) {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset All to Default Values"),
+ ICON_LOOP_BACK, "UI_OT_reset_default_button", "all", 1);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset Single to Default Value"),
+ ICON_NONE, "UI_OT_reset_default_button", "all", 0);
+ }
+ else {
+ uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset to Default Value"),
+ ICON_LOOP_BACK, "UI_OT_reset_default_button", "all", 1);
+ }
+ if (is_editable /*&& is_idprop*/ && is_set) {
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Unset"),
+ ICON_NONE, "UI_OT_unset_property_button");
+ }
+
+ if (is_array_component) {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy All To Selected"),
+ ICON_NONE, "UI_OT_copy_to_selected_button", "all", true);
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Single To Selected"),
+ ICON_NONE, "UI_OT_copy_to_selected_button", "all", false);
+ }
+ else {
+ uiItemBooleanO(
+ layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy To Selected"),
+ ICON_NONE, "UI_OT_copy_to_selected_button", "all", true);
+ }
+
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Data Path"),
+ ICON_NONE, "UI_OT_copy_data_path_button");
+
+ uiItemS(layout);
+
+ if (type == PROP_STRING && ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH)) {
+ ui_but_menu_add_path_operators(layout, ptr, prop);
+ uiItemS(layout);
+ }
+ }
+
+ /* Operator buttons */
+ if (but->optype) {
+ uiBlock *block = uiLayoutGetBlock(layout);
+ uiBut *but2;
+ IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
+ int w = uiLayoutGetWidth(layout);
+ wmKeyMap *km;
+ /* We want to know if this op has a shortcut, be it hotkey or not. */
+ wmKeyMapItem *kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, false, &km);
+
+ /* We do have a shortcut, but only keyboard ones are editbale that way... */
+ if (kmi) {
+ if (ISKEYBOARD(kmi->type)) {
+#if 0 /* would rather use a block but, but gets weirdly positioned... */
+ uiDefBlockBut(
+ block, menu_change_shortcut, but, "Change Shortcut",
+ 0, 0, uiLayoutGetWidth(layout), UI_UNIT_Y, "");
+#endif
+
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_HAND,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ UI_but_func_set(but2, popup_change_shortcut_func, but, NULL);
+
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_NONE,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Shortcut"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ UI_but_func_set(but2, remove_shortcut_func, but, NULL);
+ }
+ else {
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_HAND, IFACE_("Non-Keyboard Shortcut"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ TIP_("Only keyboard shortcuts can be edited that way, "
+ "please use User Preferences otherwise"));
+ UI_but_flag_enable(but2, UI_BUT_DISABLED);
+ }
+ }
+ /* only show 'add' if there's a suitable key map for it to go in */
+ else if (WM_keymap_guess_opname(C, but->optype->idname)) {
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_HAND,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Shortcut"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ UI_but_func_set(but2, popup_add_shortcut_func, but, NULL);
+ }
+
+ /* Set the operator pointer for python access */
+ uiLayoutSetContextFromBut(layout, but);
+
+ uiItemS(layout);
+ }
+
+ /* Favorites Menu */
+ if (ui_but_is_user_menu_compatible(C, but)) {
+ uiBlock *block = uiLayoutGetBlock(layout);
+ const int w = uiLayoutGetWidth(layout);
+ uiBut *but2;
+
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_MENU_PANEL,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Favorites Menu"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ "Add to a user defined context menu (stored in the user preferences)");
+ UI_but_func_set(but2, popup_user_menu_add_or_replace_func, but, NULL);
+
+ bUserMenu *um = ED_screen_user_menu_find(C);
+ if (um) {
+ bUserMenuItem *umi = ui_but_user_menu_find(C, but, um);
+ if (umi != NULL) {
+ but2 = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_CANCEL,
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Favorites Menu"),
+ 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+ UI_but_func_set(but2, popup_user_menu_remove_func, um, umi);
+ }
+ }
+ uiItemS(layout);
+ }
+
+ /* Show header tools for header buttons. */
+ if (ui_block_is_menu(but->block) == false) {
+ ARegion *ar = CTX_wm_region(C);
+ if (ar && (ar->regiontype == RGN_TYPE_HEADER)) {
+ uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL);
+ uiItemS(layout);
+ }
+ }
+
+ { /* Docs */
+ char buf[512];
+
+ if (UI_but_online_manual_id(but, buf, sizeof(buf))) {
+ PointerRNA ptr_props;
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Manual"),
+ ICON_URL, "WM_OT_doc_view_manual_ui_context");
+
+ uiItemFullO(
+ layout, "WM_OT_doc_view",
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Python Reference"),
+ ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &ptr_props);
+ RNA_string_set(&ptr_props, "doc_id", buf);
+
+ /* XXX inactive option, not for public! */
+#if 0
+ uiItemFullO(
+ layout, "WM_OT_doc_edit", "Submit Description", ICON_NONE,
+ NULL, WM_OP_INVOKE_DEFAULT, 0, &ptr_props);
+ RNA_string_set(&ptr_props, "doc_id", buf);
+ RNA_string_set(&ptr_props, "doc_new", RNA_property_description(but->rnaprop));
+#endif
+ }
+ }
+
+ if (but->optype) {
+ uiItemO(layout, NULL,
+ ICON_NONE, "UI_OT_copy_python_command_button");
+ }
+
+ /* perhaps we should move this into (G.debug & G_DEBUG) - campbell */
+ if (U.flag & USER_DEVELOPER_UI) {
+ if (ui_block_is_menu(but->block) == false) {
+ uiItemFullO(layout, "UI_OT_editsource", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
+ }
+ }
+
+ if (BKE_addon_find(&U.addons, "ui_translate")) {
+ uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
+ }
+
+ MenuType *mt = WM_menutype_find("WM_MT_button_context", true);
+ if (mt) {
+ UI_menutype_draw(C, mt, uiLayoutColumn(layout, false));
+ }
+
+ return UI_popup_menu_end_or_cancel(C, pup);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Panel Context Menu
+ * \{ */
+
+/**
+ * menu to show when right clicking on the panel header
+ */
+void ui_popup_context_menu_for_panel(bContext *C, ARegion *ar, Panel *pa)
+{
+ bScreen *sc = CTX_wm_screen(C);
+ const bool has_panel_category = UI_panel_category_is_visible(ar);
+ const bool any_item_visible = has_panel_category;
+ PointerRNA ptr;
+ uiPopupMenu *pup;
+ uiLayout *layout;
+
+ if (!any_item_visible) {
+ return;
+ }
+
+ RNA_pointer_create(&sc->id, &RNA_Panel, pa, &ptr);
+
+ pup = UI_popup_menu_begin(C, IFACE_("Panel"), ICON_NONE);
+ layout = UI_popup_menu_layout(pup);
+
+ if (has_panel_category) {
+ char tmpstr[80];
+ BLI_snprintf(tmpstr, sizeof(tmpstr), "%s" UI_SEP_CHAR_S "%s", IFACE_("Pin"), IFACE_("Shift+Left Mouse"));
+ uiItemR(layout, &ptr, "use_pin", 0, tmpstr, ICON_NONE);
+
+ /* evil, force shortcut flag */
+ {
+ uiBlock *block = uiLayoutGetBlock(layout);
+ uiBut *but = block->buttons.last;
+ but->flag |= UI_BUT_HAS_SEP_CHAR;
+ }
+ }
+ UI_popup_menu_end(C, pup);
+}
+
+/** \} */
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index f093f47519c..c336c48f62a 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -58,6 +58,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "UI_interface.h"
@@ -119,7 +120,7 @@ void UI_draw_roundbox_aa(bool filled, float minx, float miny, float maxx, float
.alpha_discard = 1.0f,
};
- glEnable(GL_BLEND);
+ GPU_blend(true);
if (filled) {
/* plain antialiased filled box */
@@ -135,24 +136,26 @@ void UI_draw_roundbox_aa(bool filled, float minx, float miny, float maxx, float
}
else {
/* plain antialiased unfilled box */
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
Gwn_Batch *batch = ui_batch_roundbox_get(filled, false);
GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE);
GWN_batch_uniform_4fv_array(batch, "parameters", 11, (float *)&widget_params);
GWN_batch_draw(batch);
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float maxy, float rad, const float col[4])
{
#if 0
- float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+ float vec[7][2] = {
+ {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+ {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805},
+ };
int a;
Gwn_VertFormat *format = immVertexFormat();
@@ -266,8 +269,10 @@ void UI_draw_roundbox_shade_x(
float rad, float shadetop, float shadedown, const float col[4])
{
#if 0
- float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+ float vec[7][2] = {
+ {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+ {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805},
+ };
const float div = maxy - miny;
const float idiv = 1.0f / div;
float coltop[3], coldown[3];
@@ -411,8 +416,10 @@ void UI_draw_roundbox_shade_y(
bool filled, float minx, float miny, float maxx, float maxy,
float rad, float shadeleft, float shaderight, const float col[4])
{
- float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
- {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+ float vec[7][2] = {
+ {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+ {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805},
+ };
const float div = maxx - minx;
const float idiv = 1.0f / div;
float colLeft[3], colRight[3];
@@ -550,10 +557,10 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highligh
const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize;
int a;
float vec[4][2] = {
- {0.195, 0.02},
- {0.55, 0.169},
- {0.831, 0.45},
- {0.98, 0.805},
+ {0.195, 0.02},
+ {0.55, 0.169},
+ {0.831, 0.45},
+ {0.98, 0.805},
};
@@ -645,12 +652,12 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
/* scissor doesn't seem to be doing the right thing...? */
#if 0
/* prevent drawing outside widget area */
- GLint scissor[4];
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor(rect->xmin, rect->ymin, w, h);
+ int scissor[4];
+ GPU_scissor_get_i(scissor);
+ GPU_scissor(rect->xmin, rect->ymin, w, h);
#endif
- glEnable(GL_BLEND);
+ GPU_blend(true);
if (w != ibuf->x || h != ibuf->y) {
facx = (float)w / (float)ibuf->x;
@@ -658,14 +665,15 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
- immDrawPixelsTex(&state, (float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect,
- facx, facy, NULL);
+ immDrawPixelsTex(
+ &state, (float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect,
+ facx, facy, NULL);
- glDisable(GL_BLEND);
+ GPU_blend(false);
#if 0
// restore scissortest
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
#endif
#endif
@@ -710,9 +718,9 @@ void UI_draw_safe_areas(
static void draw_scope_end(const rctf *rect, GLint *scissor)
{
/* restore scissortest */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* outline */
UI_draw_roundbox_corner_set(UI_CNR_ALL);
@@ -731,14 +739,14 @@ static void histogram_draw_one(
if (res == 0)
return;
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE);
immUniformColor4fv(color);
if (is_line) {
/* curve outline */
- glLineWidth(1.5);
+ GPU_line_width(1.5);
immBegin(GWN_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
@@ -762,7 +770,7 @@ static void histogram_draw_one(
/* curve outline */
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
immBegin(GWN_PRIM_LINE_STRIP, res);
for (int i = 0; i < res; i++) {
float x2 = x + i * (w / (float)res);
@@ -771,7 +779,7 @@ static void histogram_draw_one(
immEnd();
}
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
#define HISTOGRAM_TOT_GRID_LINES 4
@@ -792,8 +800,8 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS
float w = BLI_rctf_size_x(&rect);
float h = BLI_rctf_size_y(&rect) * hist->ymax;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
float color[4];
UI_GetThemeColor4fv(TH_PREVIEW_BACK, color);
@@ -801,12 +809,13 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS
UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
/* need scissor test, histogram can draw outside of boundary */
- GLint scissor[4];
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ int scissor[4];
+ GPU_scissor_get_i(scissor);
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -879,7 +888,7 @@ static void waveform_draw_one(float *waveform, int nbr, const float col[3])
void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
{
Scopes *scopes = (Scopes *)but->poin;
- GLint scissor[4];
+ int scissor[4];
float colors[3][3];
float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors pre multiplied by alpha for speed up */
@@ -916,8 +925,8 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
/* Flush text cache before changing scissors. */
BLF_batch_draw_flush();
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
float color[4];
UI_GetThemeColor4fv(TH_PREVIEW_BACK, color);
@@ -925,11 +934,12 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
/* need scissor test, waveform can draw outside of boundary */
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ GPU_scissor_get_i(scissor);
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
/* draw scale numbers first before binding any shader */
for (int i = 0; i < 6; i++) {
@@ -943,8 +953,8 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
/* Flush text cache before drawing things on top. */
BLF_batch_draw_flush();
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1010,7 +1020,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
if (scopes->ok && scopes->waveform_1 != NULL) {
glBlendFunc(GL_ONE, GL_ONE);
- glPointSize(1.0);
+ GPU_point_size(1.0);
/* LUMA (1 channel) */
if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
@@ -1098,7 +1108,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE
/* outline */
draw_scope_end(&rect, scissor);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static float polar_to_x(float center, float diam, float ampli, float angle)
@@ -1187,8 +1197,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
float color[4];
UI_GetThemeColor4fv(TH_PREVIEW_BACK, color);
@@ -1196,12 +1206,13 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
UI_draw_roundbox_4fv(true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color);
/* need scissor test, hvectorscope can draw outside of boundary */
- GLint scissor[4];
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ int scissor[4];
+ GPU_scissor_get_i(scissor);
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1249,7 +1260,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
float col[3] = {alpha, alpha, alpha};
glBlendFunc(GL_ONE, GL_ONE);
- glPointSize(1.0);
+ GPU_point_size(1.0);
gpuPushMatrix();
gpuTranslate2f(centerx, centery);
@@ -1265,12 +1276,12 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN
/* outline */
draw_scope_end(&rect, scissor);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, float y1, float halfwidth, float height)
{
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2f(pos, x1 + halfwidth, y1);
@@ -1278,7 +1289,7 @@ static void ui_draw_colorband_handle_tri_hlight(unsigned int pos, float x1, floa
immVertex2f(pos, x1 - halfwidth, y1);
immEnd();
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
static void ui_draw_colorband_handle_tri(unsigned int pos, float x1, float y1, float halfwidth, float height, bool fill)
@@ -1329,10 +1340,10 @@ static void ui_draw_colorband_handle(
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.8f, 0.8f, 0.8f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
immUniform1f("dash_width", active ? 4.0f : 2.0f);
@@ -1358,7 +1369,7 @@ static void ui_draw_colorband_handle(
ui_draw_colorband_handle_box(shdr_pos, x - half_width, y1 - 1, x + half_width, y1 + height, false);
/* draw all triangles blended */
- glEnable(GL_BLEND);
+ GPU_blend(true);
ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true);
@@ -1377,7 +1388,7 @@ static void ui_draw_colorband_handle(
immUniformColor3ub(0, 0, 0);
ui_draw_colorband_handle_tri_hlight(shdr_pos, x, y1 + height, half_width, half_width);
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUniformColor3ub(128, 128, 128);
ui_draw_colorband_handle_box(shdr_pos, x - (half_width - 1), y1, x + (half_width - 1), y1 + height, true);
@@ -1425,7 +1436,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
/* layer: color ramp */
- glEnable(GL_BLEND);
+ GPU_blend(true);
CBData *cbd = coba->data;
@@ -1471,7 +1482,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* New format */
format = immVertexFormat();
@@ -1483,7 +1494,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
imm_draw_box_wire_2d(position, x1, y1, x1 + sizex, rect->ymax);
/* layer: box outline */
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
immBegin(GWN_PRIM_LINES, 2);
@@ -1498,7 +1509,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti
immVertex2f(position, x1 + sizex, y1 - 1);
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* layer: draw handles */
for (int a = 0; a < coba->tot; a++, cbd++) {
@@ -1561,11 +1572,11 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3ubv((unsigned char *)wcol->inner);
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
+ GPU_blend(true);
+ GPU_line_smooth(true);
imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, 1.0f, 32);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
/* matrix after circle */
gpuPopMatrix();
@@ -1583,8 +1594,9 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
float fy = rect->ymin + zoomy * (-offsy);
if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin));
- float line_count = floorf((rect->xmax - fx) / dx) + 1.0f +
- floorf((rect->ymax - fy) / dy) + 1.0f;
+ float line_count = (
+ floorf((rect->xmax - fx) / dx) + 1.0f +
+ floorf((rect->ymax - fy) / dy) + 1.0f);
immBegin(GWN_PRIM_LINES, (int)line_count * 2);
while (fx < rect->xmax) {
@@ -1603,9 +1615,10 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo
static void gl_shaded_color(unsigned char *col, int shade)
{
- immUniformColor3ub(col[0] - shade > 0 ? col[0] - shade : 0,
- col[1] - shade > 0 ? col[1] - shade : 0,
- col[2] - shade > 0 ? col[2] - shade : 0);
+ immUniformColor3ub(
+ col[0] - shade > 0 ? col[0] - shade : 0,
+ col[1] - shade > 0 ? col[1] - shade : 0,
+ col[2] - shade > 0 ? col[2] - shade : 0);
}
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti *rect)
@@ -1622,8 +1635,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
CurveMap *cuma = &cumap->cm[cumap->cur];
/* need scissor test, curve can draw outside of boundary */
- GLint scissor[4];
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
+ int scissor[4];
+ GPU_scissor_get_i(scissor);
rcti scissor_new = {
.xmin = rect->xmin,
.ymin = rect->ymin,
@@ -1632,10 +1645,11 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
};
rcti scissor_region = {0, ar->winx, 0, ar->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
- glScissor(scissor_new.xmin,
- scissor_new.ymin,
- BLI_rcti_size_x(&scissor_new),
- BLI_rcti_size_y(&scissor_new));
+ GPU_scissor(
+ scissor_new.xmin,
+ scissor_new.ymin,
+ BLI_rcti_size_x(&scissor_new),
+ BLI_rcti_size_y(&scissor_new));
/* calculate offset and zoom */
float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&cumap->curr);
@@ -1658,7 +1672,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
}
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1667,21 +1681,22 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
/* backdrop */
if (but->a1 == UI_GRAD_H) {
/* grid, hsv uses different grid */
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
immUniformColor4ub(0, 0, 0, 48);
ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
else {
if (cumap->flag & CUMA_DO_CLIP) {
gl_shaded_color((unsigned char *)wcol->inner, -20);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
immUniformColor3ubv((unsigned char *)wcol->inner);
- immRectf(pos, rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
- rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
- rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
- rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
+ immRectf(pos,
+ rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
+ rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
+ rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
+ rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
}
else {
immUniformColor3ubv((unsigned char *)wcol->inner);
@@ -1752,8 +1767,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
/* the curve */
immUniformColor3ubv((unsigned char *)wcol->item);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
immBegin(GWN_PRIM_LINE_STRIP, (CM_TABLE + 1) + 2);
if (cuma->table == NULL)
@@ -1785,8 +1800,8 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
immVertex2f(pos, fx, fy);
}
immEnd();
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
immUnbindProgram();
/* the points, use aspect to make them visible on edges */
@@ -1796,7 +1811,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
cmp = cuma->curve;
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
immBegin(GWN_PRIM_POINTS, cuma->totpoint);
for (int a = 0; a < cuma->totpoint; a++) {
float color[4];
@@ -1813,7 +1828,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti
immUnbindProgram();
/* restore scissortest */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
/* outline */
format = immVertexFormat();
@@ -1841,16 +1856,17 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
int width = BLI_rctf_size_x(&rect) + 1;
int height = BLI_rctf_size_y(&rect);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* need scissor test, preview image can draw outside of boundary */
- GLint scissor[4];
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor((rect.xmin - 1),
- (rect.ymin - 1),
- (rect.xmax + 1) - (rect.xmin - 1),
- (rect.ymax + 1) - (rect.ymin - 1));
+ int scissor[4];
+ GPU_scissor_get_i(scissor);
+ GPU_scissor(
+ (rect.xmin - 1),
+ (rect.ymin - 1),
+ (rect.xmax + 1) - (rect.xmin - 1),
+ (rect.ymax + 1) - (rect.ymin - 1));
if (scopes->track_disabled) {
float color[4] = {0.7f, 0.3f, 0.3f, 0.3f};
@@ -1866,10 +1882,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
if (scopes->track_preview)
IMB_freeImBuf(scopes->track_preview);
- ImBuf *tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width, scopes->frame_height,
- scopes->track_search, scopes->track,
- &scopes->undist_marker, true, scopes->use_track_mask,
- width, height, scopes->track_pos);
+ ImBuf *tmpibuf = BKE_tracking_sample_pattern(
+ scopes->frame_width, scopes->frame_height,
+ scopes->track_search, scopes->track,
+ &scopes->undist_marker, true, scopes->use_track_mask,
+ width, height, scopes->track_pos);
if (tmpibuf) {
if (tmpibuf->rect_float)
IMB_rect_from_float(tmpibuf);
@@ -1885,7 +1902,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
gpuPushMatrix();
/* draw content of pattern area */
- glScissor(rect.xmin, rect.ymin, scissor[2], scissor[3]);
+ GPU_scissor(rect.xmin, rect.ymin, scissor[2], scissor[3]);
if (width > 0 && height > 0) {
ImBuf *drawibuf = scopes->track_preview;
@@ -1902,10 +1919,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
/* draw cross for pixel position */
gpuTranslate2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]);
- glScissor(rect.xmin,
- rect.ymin,
- BLI_rctf_size_x(&rect),
- BLI_rctf_size_y(&rect));
+ GPU_scissor(
+ rect.xmin,
+ rect.ymin,
+ BLI_rctf_size_x(&rect),
+ BLI_rctf_size_y(&rect));
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1953,7 +1971,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U
/* outline */
draw_scope_end(&rect, scissor);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
@@ -1975,10 +1993,10 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
0.15142777f, 0.52896401f, 0.82076344f, 0.97952994f,
};
- GLint scissor[4];
+ int scissor[4];
/* need scissor test, can draw outside of boundary */
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
+ GPU_scissor_get_i(scissor);
rcti scissor_new = {
.xmin = recti->xmin,
@@ -1990,10 +2008,11 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
rcti scissor_region = {0, ar->winx, 0, ar->winy};
BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new);
- glScissor(scissor_new.xmin,
- scissor_new.ymin,
- BLI_rcti_size_x(&scissor_new),
- BLI_rcti_size_y(&scissor_new));
+ GPU_scissor(
+ scissor_new.xmin,
+ scissor_new.ymin,
+ BLI_rcti_size_x(&scissor_new),
+ BLI_rcti_size_y(&scissor_new));
float x = 0.5f * (recti->xmin + recti->xmax);
float y = 0.5f * (recti->ymin + recti->ymax);
@@ -2003,26 +2022,26 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv(but->col);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immBegin(GWN_PRIM_TRI_FAN, 16);
for (int a = 0; a < 16; a++)
immVertex2f(pos, x + size * si[a], y + size * co[a]);
immEnd();
immUniformColor4ub(0, 0, 0, 150);
- glLineWidth(1);
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_width(1);
+ GPU_line_smooth(true);
immBegin(GWN_PRIM_LINE_LOOP, 16);
for (int a = 0; a < 16; a++)
immVertex2f(pos, x + size * si[a], y + size * co[a]);
immEnd();
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
immUnbindProgram();
/* restore scissortest */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
}
/* ****************************************************** */
@@ -2093,7 +2112,7 @@ static void ui_shadowbox(unsigned pos, unsigned color, float minx, float miny, f
void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy)
{
- glEnable(GL_BLEND);
+ GPU_blend(true);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -2112,7 +2131,7 @@ void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx,
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
@@ -2136,7 +2155,7 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha
a = i * aspect;
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
const float dalpha = alpha * 2.0f / 255.0f;
float calpha = dalpha;
float visibility = 1.0f;
@@ -2173,10 +2192,10 @@ void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha
GWN_batch_draw(batch);
/* outline emphasis */
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
float color[4] = {0.0f, 0.0f, 0.0f, 0.4f};
UI_draw_roundbox_4fv(false, rct->xmin - 0.5f, rct->ymin - 0.5f, rct->xmax + 0.5f, rct->ymax + 0.5f, radius + 0.5f, color);
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c
index 8cb55b724fb..eb8fff471e2 100644
--- a/source/blender/editors/interface/interface_eyedropper.c
+++ b/source/blender/editors/interface/interface_eyedropper.c
@@ -180,4 +180,3 @@ uiBut *eyedropper_get_property_button_under_mouse(bContext *C, const wmEvent *ev
}
/** \} */
-
diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c
index a60b6f3f60b..73efc59feb7 100644
--- a/source/blender/editors/interface/interface_eyedropper_color.c
+++ b/source/blender/editors/interface/interface_eyedropper_color.c
@@ -319,7 +319,7 @@ static int eyedropper_exec(bContext *C, wmOperator *op)
}
}
-static int eyedropper_poll(bContext *C)
+static bool eyedropper_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
diff --git a/source/blender/editors/interface/interface_eyedropper_colorband.c b/source/blender/editors/interface/interface_eyedropper_colorband.c
index b13d552dbeb..f414d524cd8 100644
--- a/source/blender/editors/interface/interface_eyedropper_colorband.c
+++ b/source/blender/editors/interface/interface_eyedropper_colorband.c
@@ -289,7 +289,7 @@ static int eyedropper_colorband_exec(bContext *C, wmOperator *op)
}
}
-static int eyedropper_colorband_poll(bContext *C)
+static bool eyedropper_colorband_poll(bContext *C)
{
uiBut *but = UI_context_active_but_get(C);
return (but && but->type == UI_BTYPE_COLORBAND);
diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c
index f814048c0c0..b1e649f4abe 100644
--- a/source/blender/editors/interface/interface_eyedropper_datablock.c
+++ b/source/blender/editors/interface/interface_eyedropper_datablock.c
@@ -305,7 +305,7 @@ static int datadropper_exec(bContext *C, wmOperator *op)
}
}
-static int datadropper_poll(bContext *C)
+static bool datadropper_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c
index df09c327da1..fb125a3845b 100644
--- a/source/blender/editors/interface/interface_eyedropper_depth.c
+++ b/source/blender/editors/interface/interface_eyedropper_depth.c
@@ -335,7 +335,7 @@ static int depthdropper_exec(bContext *C, wmOperator *op)
}
}
-static int depthdropper_poll(bContext *C)
+static bool depthdropper_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c
index 50a8473135a..852f7ea71b6 100644
--- a/source/blender/editors/interface/interface_eyedropper_driver.c
+++ b/source/blender/editors/interface/interface_eyedropper_driver.c
@@ -205,7 +205,7 @@ static int driverdropper_exec(bContext *C, wmOperator *op)
}
}
-static int driverdropper_poll(bContext *C)
+static bool driverdropper_poll(bContext *C)
{
if (!CTX_wm_window(C)) return 0;
else return 1;
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 63bf29a26ea..ac7ed3d5106 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -27,7 +27,6 @@
* \ingroup edinterface
*/
-
#include <float.h>
#include <limits.h>
#include <math.h>
@@ -40,31 +39,25 @@
#include "DNA_brush_types.h"
-#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_linklist.h"
-#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_string_cursor_utf8.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
-#include "BLT_translation.h"
-
#include "PIL_time.h"
-#include "BKE_addon.h"
#include "BKE_colorband.h"
#include "BKE_blender_undo.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
-#include "BKE_idprop.h"
#include "BKE_report.h"
#include "BKE_screen.h"
#include "BKE_tracking.h"
@@ -73,7 +66,6 @@
#include "ED_screen.h"
#include "ED_undo.h"
-#include "ED_keyframing.h"
#include "UI_interface.h"
#include "UI_view2d.h"
@@ -90,6 +82,7 @@
#ifdef WITH_INPUT_IME
# include "wm_window.h"
+# include "BLT_translation.h"
# include "BLT_lang.h"
#endif
@@ -112,9 +105,6 @@
#define UI_MAX_PASSWORD_STR 128
-/* This hack is needed because we don't have a good way to re-reference keymap items once added: T42944 */
-#define USE_KEYMAP_ADD_HACK
-
/* proto */
static int ui_do_but_EXIT(bContext *C, uiBut *but, struct uiHandleButtonData *data, const wmEvent *event);
static bool ui_but_find_select_in_enum__cmp(const uiBut *but_a, const uiBut *but_b);
@@ -477,46 +467,6 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
}
}
-bool ui_but_is_editable(const uiBut *but)
-{
- return !ELEM(but->type,
- UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE,
- UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR);
-}
-
-bool ui_but_is_editable_as_text(const uiBut *but)
-{
- return ELEM(but->type,
- UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER,
- UI_BTYPE_SEARCH_MENU);
-
-}
-
-bool ui_but_is_toggle(const uiBut *but)
-{
- return ELEM(
- but->type,
- UI_BTYPE_BUT_TOGGLE,
- UI_BTYPE_TOGGLE,
- UI_BTYPE_ICON_TOGGLE,
- UI_BTYPE_ICON_TOGGLE_N,
- UI_BTYPE_TOGGLE_N,
- UI_BTYPE_CHECKBOX,
- UI_BTYPE_CHECKBOX_N,
- UI_BTYPE_ROW
- );
-}
-
-#ifdef USE_UI_POPOVER_ONCE
-bool ui_but_is_popover_once_compat(const uiBut *but)
-{
- return (
- (but->type == UI_BTYPE_BUT) ||
- ui_but_is_toggle(but)
- );
-}
-#endif
-
static uiBut *ui_but_prev(uiBut *but)
{
while (but->prev) {
@@ -1301,7 +1251,6 @@ typedef struct uiDragToggleHandle {
bool is_init;
bool is_set;
float but_cent_start[2];
- eButType but_type_start;
bool xy_lock[2];
int xy_init[2];
@@ -1309,7 +1258,7 @@ typedef struct uiDragToggleHandle {
} uiDragToggleHandle;
static bool ui_drag_toggle_set_xy_xy(
- bContext *C, ARegion *ar, const bool is_set, const eButType but_type_start,
+ bContext *C, ARegion *ar, const bool is_set,
const int xy_src[2], const int xy_dst[2])
{
/* popups such as layers won't re-evaluate on redraw */
@@ -1333,7 +1282,7 @@ static bool ui_drag_toggle_set_xy_xy(
if (BLI_rctf_isect_segment(&but->rect, xy_a_block, xy_b_block)) {
/* execute the button */
- if (ui_drag_toggle_but_is_supported(but) && but->type == but_type_start) {
+ if (ui_drag_toggle_but_is_supported(but)) {
/* is it pressed? */
bool is_set_but = ui_drag_toggle_but_is_pushed(but);
if (is_set_but != is_set) {
@@ -1376,8 +1325,10 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
if (but) {
if (but->flag & UI_BUT_DRAG_LOCK) {
- const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect),
- BLI_rctf_cent_y(&but->rect)};
+ const float but_cent_new[2] = {
+ BLI_rctf_cent_x(&but->rect),
+ BLI_rctf_cent_y(&but->rect),
+ };
/* check if this is a different button, chances are high the button wont move about :) */
if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) {
@@ -1405,7 +1356,7 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const
/* touch all buttons between last mouse coord and this one */
- do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->is_set, drag_info->but_type_start, drag_info->xy_last, xy);
+ do_draw = ui_drag_toggle_set_xy_xy(C, ar, drag_info->is_set, drag_info->xy_last, xy);
if (do_draw) {
ED_region_tag_redraw(ar);
@@ -1449,10 +1400,11 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
ui_apply_but_undo(but);
}
- WM_event_remove_ui_handler(&win->modalhandlers,
- ui_handler_region_drag_toggle,
- ui_handler_region_drag_toggle_remove,
- drag_info, false);
+ WM_event_remove_ui_handler(
+ &win->modalhandlers,
+ ui_handler_region_drag_toggle,
+ ui_handler_region_drag_toggle_remove,
+ drag_info, false);
ui_handler_region_drag_toggle_remove(C, drag_info);
WM_event_add_mousemove(C);
@@ -1667,7 +1619,7 @@ static void ui_selectcontext_apply(
wmWindow *win = CTX_wm_window(C);
if (!win->eventstate->shift) {
const int len = RNA_property_array_length(&but->rnapoin, prop);
- int *tmparray = MEM_callocN(sizeof(int) * len, __func__);
+ bool *tmparray = MEM_callocN(sizeof(bool) * len, __func__);
tmparray[index] = true;
@@ -1784,7 +1736,6 @@ static bool ui_but_drag_init(
drag_info->is_set = ui_drag_toggle_but_is_pushed(but);
drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect);
drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect);
- drag_info->but_type_start = but->type;
copy_v2_v2_int(drag_info->xy_init, &event->x);
copy_v2_v2_int(drag_info->xy_last, &event->x);
@@ -3211,13 +3162,15 @@ static void ui_do_but_textedit(
}
break;
case RIGHTARROWKEY:
- ui_textedit_move(but, data, STRCUR_DIR_NEXT,
- event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_NEXT,
+ event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case LEFTARROWKEY:
- ui_textedit_move(but, data, STRCUR_DIR_PREV,
- event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_PREV,
+ event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case WHEELDOWNMOUSE:
@@ -3234,8 +3187,9 @@ static void ui_do_but_textedit(
}
ATTR_FALLTHROUGH;
case ENDKEY:
- ui_textedit_move(but, data, STRCUR_DIR_NEXT,
- event->shift != 0, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_NEXT,
+ event->shift != 0, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
break;
case WHEELUPMOUSE:
@@ -3252,8 +3206,9 @@ static void ui_do_but_textedit(
}
ATTR_FALLTHROUGH;
case HOMEKEY:
- ui_textedit_move(but, data, STRCUR_DIR_PREV,
- event->shift != 0, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_PREV,
+ event->shift != 0, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
break;
case PADENTER:
@@ -3262,14 +3217,16 @@ static void ui_do_but_textedit(
retval = WM_UI_HANDLER_BREAK;
break;
case DELKEY:
- changed = ui_textedit_delete(but, data, 1,
- event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ changed = ui_textedit_delete(
+ but, data, 1,
+ event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
case BACKSPACEKEY:
- changed = ui_textedit_delete(but, data, 0,
- event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+ changed = ui_textedit_delete(
+ but, data, 0,
+ event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
retval = WM_UI_HANDLER_BREAK;
break;
@@ -3284,10 +3241,12 @@ static void ui_do_but_textedit(
if (event->ctrl && !IS_EVENT_MOD(event, shift, alt, oskey))
#endif
{
- ui_textedit_move(but, data, STRCUR_DIR_PREV,
- false, STRCUR_JUMP_ALL);
- ui_textedit_move(but, data, STRCUR_DIR_NEXT,
- true, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_PREV,
+ false, STRCUR_JUMP_ALL);
+ ui_textedit_move(
+ but, data, STRCUR_DIR_NEXT,
+ true, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
}
break;
@@ -6496,596 +6455,6 @@ static int ui_do_but_TRACKPREVIEW(
return WM_UI_HANDLER_CONTINUE;
}
-static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
-{
- uiBut *but = (uiBut *)arg1;
-
- if (but->optype) {
- char shortcut_str[128];
-
- IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
-
- /* complex code to change name of button */
- if (WM_key_event_operator_string(
- C, but->optype->idname, but->opcontext, prop, true,
- shortcut_str, sizeof(shortcut_str)))
- {
- ui_but_add_shortcut(but, shortcut_str, true);
- }
- else {
- /* simply strip the shortcut */
- ui_but_add_shortcut(but, NULL, true);
- }
- }
-}
-
-static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
-{
- wmWindowManager *wm = CTX_wm_manager(C);
- uiBlock *block;
- uiBut *but = (uiBut *)arg;
- wmKeyMap *km;
- wmKeyMapItem *kmi;
- PointerRNA ptr;
- uiLayout *layout;
- uiStyle *style = UI_style_get_dpi();
- IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
-
- kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, true, &km);
- BLI_assert(kmi != NULL);
-
- RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
-
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
- UI_block_func_handle_set(block, but_shortcut_name_func, but);
- UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
- UI_block_direction_set(block, UI_DIR_CENTER_Y);
-
- layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style);
-
- uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
-
- UI_block_bounds_set_popup(block, 6, -50, 26);
-
- return block;
-}
-
-#ifdef USE_KEYMAP_ADD_HACK
-static int g_kmi_id_hack;
-#endif
-
-static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
-{
- wmWindowManager *wm = CTX_wm_manager(C);
- uiBlock *block;
- uiBut *but = (uiBut *)arg;
- wmKeyMap *km;
- wmKeyMapItem *kmi;
- PointerRNA ptr;
- uiLayout *layout;
- uiStyle *style = UI_style_get_dpi();
- IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
- int kmi_id;
-
- /* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
- km = WM_keymap_guess_opname(C, but->optype->idname);
- kmi = WM_keymap_add_item(km, but->optype->idname, AKEY, KM_PRESS, 0, 0);
- kmi_id = kmi->id;
-
- /* copy properties, prop can be NULL for reset */
- if (prop)
- prop = IDP_CopyProperty(prop);
- WM_keymap_properties_reset(kmi, prop);
-
- /* update and get pointers again */
- WM_keyconfig_update(wm);
-
- km = WM_keymap_guess_opname(C, but->optype->idname);
- kmi = WM_keymap_item_find_id(km, kmi_id);
-
- RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
-
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
- UI_block_func_handle_set(block, but_shortcut_name_func, but);
- UI_block_direction_set(block, UI_DIR_CENTER_Y);
-
- layout = UI_block_layout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, 0, style);
-
- uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
-
- UI_block_bounds_set_popup(block, 6, -50, 26);
-
-#ifdef USE_KEYMAP_ADD_HACK
- g_kmi_id_hack = kmi_id;
-#endif
- return block;
-}
-
-static void menu_add_shortcut_cancel(struct bContext *C, void *arg1)
-{
- uiBut *but = (uiBut *)arg1;
- wmKeyMap *km;
- wmKeyMapItem *kmi;
-#ifndef USE_KEYMAP_ADD_HACK
- IDProperty *prop;
-#endif
- int kmi_id;
-
-#ifdef USE_KEYMAP_ADD_HACK
- km = WM_keymap_guess_opname(C, but->optype->idname);
- kmi_id = g_kmi_id_hack;
- UNUSED_VARS(but);
-#else
- prop = (but->opptr) ? but->opptr->data : NULL;
- kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, true, &km);
-#endif
-
- kmi = WM_keymap_item_find_id(km, kmi_id);
- WM_keymap_remove_item(km, kmi);
-}
-
-static void popup_change_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
-{
- uiBut *but = (uiBut *)arg1;
- UI_popup_block_invoke(C, menu_change_shortcut, but);
-}
-
-static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
-{
- uiBut *but = (uiBut *)arg1;
- wmKeyMap *km;
- wmKeyMapItem *kmi;
- IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
-
- kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, true, &km);
- BLI_assert(kmi != NULL);
-
- WM_keymap_remove_item(km, kmi);
-
- but_shortcut_name_func(C, but, 0);
-}
-
-static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
-{
- uiBut *but = (uiBut *)arg1;
- UI_popup_block_ex(C, menu_add_shortcut, NULL, menu_add_shortcut_cancel, but, NULL);
-}
-
-/**
- * menu to chow when right clicking on the panel header
- */
-void ui_panel_menu(bContext *C, ARegion *ar, Panel *pa)
-{
- bScreen *sc = CTX_wm_screen(C);
- const bool has_panel_category = UI_panel_category_is_visible(ar);
- const bool any_item_visible = has_panel_category;
- PointerRNA ptr;
- uiPopupMenu *pup;
- uiLayout *layout;
-
- if (!any_item_visible) {
- return;
- }
-
- RNA_pointer_create(&sc->id, &RNA_Panel, pa, &ptr);
-
- pup = UI_popup_menu_begin(C, IFACE_("Panel"), ICON_NONE);
- layout = UI_popup_menu_layout(pup);
-
- if (has_panel_category) {
- char tmpstr[80];
- BLI_snprintf(tmpstr, sizeof(tmpstr), "%s" UI_SEP_CHAR_S "%s", IFACE_("Pin"), IFACE_("Shift+Left Mouse"));
- uiItemR(layout, &ptr, "use_pin", 0, tmpstr, ICON_NONE);
-
- /* evil, force shortcut flag */
- {
- uiBlock *block = uiLayoutGetBlock(layout);
- uiBut *but = block->buttons.last;
- but->flag |= UI_BUT_HAS_SEP_CHAR;
- }
- }
- UI_popup_menu_end(C, pup);
-}
-
-static void ui_but_menu_add_path_operators(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop)
-{
- const PropertySubType subtype = RNA_property_subtype(prop);
- wmOperatorType *ot = WM_operatortype_find("WM_OT_path_open", true);
- char filepath[FILE_MAX];
- char dir[FILE_MAXDIR];
- char file[FILE_MAXFILE];
- PointerRNA props_ptr;
-
- BLI_assert(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH));
- UNUSED_VARS_NDEBUG(subtype);
-
- RNA_property_string_get(ptr, prop, filepath);
- BLI_split_dirfile(filepath, dir, file, sizeof(dir), sizeof(file));
-
- if (file[0]) {
- BLI_assert(subtype == PROP_FILEPATH);
- uiItemFullO_ptr(
- layout, ot, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open File Externally"),
- ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &props_ptr);
- RNA_string_set(&props_ptr, "filepath", filepath);
- }
-
- uiItemFullO_ptr(
- layout, ot, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Location Externally"),
- ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &props_ptr);
- RNA_string_set(&props_ptr, "filepath", dir);
-}
-
-static bool ui_but_menu(bContext *C, uiBut *but)
-{
- uiPopupMenu *pup;
- uiLayout *layout;
- MenuType *mt = WM_menutype_find("WM_MT_button_context", true);
- bool is_array, is_array_component;
- uiStringInfo label = {BUT_GET_LABEL, NULL};
- wmOperatorType *ot;
- PointerRNA op_ptr;
-
-/* if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/
-/* return 0;*/
-
- /* having this menu for some buttons makes no sense */
- if (but->type == UI_BTYPE_IMAGE) {
- return false;
- }
-
- /* highly unlikely getting the label ever fails */
- UI_but_string_info_get(C, but, &label, NULL);
-
- pup = UI_popup_menu_begin(C, label.strinfo ? label.strinfo : "", ICON_NONE);
- layout = UI_popup_menu_layout(pup);
- if (label.strinfo)
- MEM_freeN(label.strinfo);
-
- uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
-
- if (but->rnapoin.data && but->rnaprop) {
- PointerRNA *ptr = &but->rnapoin;
- PropertyRNA *prop = but->rnaprop;
- const PropertyType type = RNA_property_type(prop);
- const PropertySubType subtype = RNA_property_subtype(prop);
- bool is_anim = RNA_property_animateable(ptr, prop);
- bool is_editable = RNA_property_editable(ptr, prop);
- /*bool is_idprop = RNA_property_is_idprop(prop);*/ /* XXX does not work as expected, not strictly needed */
- bool is_set = RNA_property_is_set(ptr, prop);
-
- const int override_status = RNA_property_static_override_status(ptr, prop, -1);
- const bool is_overridable = (override_status & RNA_OVERRIDE_STATUS_OVERRIDABLE) != 0;
-
- /* second slower test, saved people finding keyframe items in menus when its not possible */
- if (is_anim)
- is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
-
- /* determine if we can key a single component of an array */
- is_array = RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0;
- is_array_component = (is_array && but->rnaindex != -1);
-
- /* Keyframes */
- if (but->flag & UI_BUT_ANIMATED_KEY) {
- /* replace/delete keyfraemes */
- if (is_array_component) {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Keyframes"),
- ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Single Keyframe"),
- ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Keyframes"),
- ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Single Keyframe"),
- ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 0);
- }
- else {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Replace Keyframe"),
- ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Keyframe"),
- ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
- }
-
- /* keyframe settings */
- uiItemS(layout);
-
-
- }
- else if (but->flag & UI_BUT_DRIVEN) {
- /* pass */
- }
- else if (is_anim) {
- if (is_array_component) {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframes"),
- ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Single Keyframe"),
- ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
- }
- else {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Insert Keyframe"),
- ICON_KEY_HLT, "ANIM_OT_keyframe_insert_button", "all", 1);
- }
- }
-
- if ((but->flag & UI_BUT_ANIMATED) && (but->rnapoin.type != &RNA_NlaStrip)) {
- if (is_array_component) {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
- ICON_KEY_DEHLT, "ANIM_OT_keyframe_clear_button", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Single Keyframes"),
- ICON_NONE, "ANIM_OT_keyframe_clear_button", "all", 0);
- }
- else {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Keyframes"),
- ICON_KEY_DEHLT, "ANIM_OT_keyframe_clear_button", "all", 1);
- }
- }
-
- /* Drivers */
- if (but->flag & UI_BUT_DRIVEN) {
- uiItemS(layout);
-
- if (is_array_component) {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Drivers"),
- ICON_X, "ANIM_OT_driver_button_remove", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Single Driver"),
- ICON_NONE, "ANIM_OT_driver_button_remove", "all", 0);
- }
- else {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Delete Driver"),
- ICON_X, "ANIM_OT_driver_button_remove", "all", 1);
- }
-
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Driver"),
- ICON_NONE, "ANIM_OT_copy_driver_button");
- if (ANIM_driver_can_paste()) {
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
- ICON_NONE, "ANIM_OT_paste_driver_button");
- }
-
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Edit Driver"),
- ICON_DRIVER, "ANIM_OT_driver_button_edit");
-
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"),
- ICON_NONE, "SCREEN_OT_drivers_editor_show");
- }
- else if (but->flag & (UI_BUT_ANIMATED_KEY | UI_BUT_ANIMATED)) {
- /* pass */
- }
- else if (is_anim) {
- uiItemS(layout);
-
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Driver"),
- ICON_DRIVER, "ANIM_OT_driver_button_add");
-
- if (ANIM_driver_can_paste()) {
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"),
- ICON_NONE, "ANIM_OT_paste_driver_button");
- }
-
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"),
- ICON_NONE, "SCREEN_OT_drivers_editor_show");
- }
-
- /* Keying Sets */
- /* TODO: check on modifyability of Keying Set when doing this */
- if (is_anim) {
- uiItemS(layout);
-
- if (is_array_component) {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add All to Keying Set"),
- ICON_KEYINGSET, "ANIM_OT_keyingset_button_add", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Single to Keying Set"),
- ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 0);
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"),
- ICON_NONE, "ANIM_OT_keyingset_button_remove");
- }
- else {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add to Keying Set"),
- ICON_KEYINGSET, "ANIM_OT_keyingset_button_add", "all", 1);
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"),
- ICON_NONE, "ANIM_OT_keyingset_button_remove");
- }
- }
-
- if (is_overridable) {
- /* Override Operators */
- uiItemS(layout);
-
- if (but->flag & UI_BUT_OVERRIDEN) {
- if (is_array_component) {
-#if 0 /* Disabled for now. */
- ot = WM_operatortype_find("UI_OT_override_type_set_button", false);
- uiItemFullO_ptr(layout, ot, "Overrides Type", ICON_NONE,
- NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
- RNA_boolean_set(&op_ptr, "all", true);
- uiItemFullO_ptr(layout, ot, "Single Override Type", ICON_NONE,
- NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
- RNA_boolean_set(&op_ptr, "all", false);
-#endif
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Overrides"),
- ICON_X, "UI_OT_override_remove_button", "all", true);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Single Override"),
- ICON_X, "UI_OT_override_remove_button", "all", false);
- }
- else {
-#if 0 /* Disabled for now. */
- uiItemFullO(layout, "UI_OT_override_type_set_button", "Override Type", ICON_NONE,
- NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
- RNA_boolean_set(&op_ptr, "all", false);
-#endif
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Override"),
- ICON_X, "UI_OT_override_remove_button", "all", true);
- }
- }
- else {
- if (is_array_component) {
- ot = WM_operatortype_find("UI_OT_override_type_set_button", false);
- uiItemFullO_ptr(layout, ot, "Define Overrides", ICON_NONE,
- NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
- RNA_boolean_set(&op_ptr, "all", true);
- uiItemFullO_ptr(layout, ot, "Define Single Override", ICON_NONE,
- NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
- RNA_boolean_set(&op_ptr, "all", false);
- }
- else {
- uiItemFullO(layout, "UI_OT_override_type_set_button", "Define Override", ICON_NONE,
- NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
- RNA_boolean_set(&op_ptr, "all", false);
- }
- }
- }
-
- uiItemS(layout);
-
- /* Property Operators */
-
- /* Copy Property Value
- * Paste Property Value */
-
- if (is_array_component) {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset All to Default Values"),
- ICON_LOOP_BACK, "UI_OT_reset_default_button", "all", 1);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset Single to Default Value"),
- ICON_NONE, "UI_OT_reset_default_button", "all", 0);
- }
- else {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Reset to Default Value"),
- ICON_LOOP_BACK, "UI_OT_reset_default_button", "all", 1);
- }
- if (is_editable /*&& is_idprop*/ && is_set) {
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Unset"),
- ICON_NONE, "UI_OT_unset_property_button");
- }
-
- if (is_array_component) {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy All To Selected"),
- ICON_NONE, "UI_OT_copy_to_selected_button", "all", true);
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Single To Selected"),
- ICON_NONE, "UI_OT_copy_to_selected_button", "all", false);
- }
- else {
- uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy To Selected"),
- ICON_NONE, "UI_OT_copy_to_selected_button", "all", true);
- }
-
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Data Path"),
- ICON_NONE, "UI_OT_copy_data_path_button");
-
- uiItemS(layout);
-
- if (type == PROP_STRING && ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH)) {
- ui_but_menu_add_path_operators(layout, ptr, prop);
- uiItemS(layout);
- }
- }
-
- /* Operator buttons */
- if (but->optype) {
- uiBlock *block = uiLayoutGetBlock(layout);
- uiBut *but2;
- IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
- int w = uiLayoutGetWidth(layout);
- wmKeyMap *km;
- /* We want to know if this op has a shortcut, be it hotkey or not. */
- wmKeyMapItem *kmi = WM_key_event_operator(C, but->optype->idname, but->opcontext, prop, false, &km);
-
- /* We do have a shortcut, but only keyboard ones are editbale that way... */
- if (kmi) {
- if (ISKEYBOARD(kmi->type)) {
-#if 0 /* would rather use a block but, but gets weirdly positioned... */
- uiDefBlockBut(block, menu_change_shortcut, but, "Change Shortcut",
- 0, 0, uiLayoutGetWidth(layout), UI_UNIT_Y, "");
-#endif
-
- but2 = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_HAND,
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"),
- 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- UI_but_func_set(but2, popup_change_shortcut_func, but, NULL);
-
- but2 = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_NONE,
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove Shortcut"),
- 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- UI_but_func_set(but2, remove_shortcut_func, but, NULL);
- }
- else {
- but2 = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_HAND, IFACE_("Non-Keyboard Shortcut"),
- 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Only keyboard shortcuts can be edited that way, "
- "please use User Preferences otherwise"));
- UI_but_flag_enable(but2, UI_BUT_DISABLED);
- }
- }
- /* only show 'add' if there's a suitable key map for it to go in */
- else if (WM_keymap_guess_opname(C, but->optype->idname)) {
- but2 = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_HAND,
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Shortcut"),
- 0, 0, w, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- UI_but_func_set(but2, popup_add_shortcut_func, but, NULL);
- }
-
- /* Set the operator pointer for python access */
- uiLayoutSetContextFromBut(layout, but);
-
- uiItemS(layout);
- }
-
- /* Show header tools for header buttons. */
- if (ui_block_is_menu(but->block) == false) {
- ARegion *ar = CTX_wm_region(C);
- if (ar && (ar->regiontype == RGN_TYPE_HEADER)) {
- uiItemMenuF(layout, IFACE_("Header"), ICON_NONE, ED_screens_header_tools_menu_create, NULL);
- uiItemS(layout);
- }
- }
-
- { /* Docs */
- char buf[512];
-
- if (UI_but_online_manual_id(but, buf, sizeof(buf))) {
- PointerRNA ptr_props;
- uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Manual"),
- ICON_URL, "WM_OT_doc_view_manual_ui_context");
-
- uiItemFullO(
- layout, "WM_OT_doc_view",
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Python Reference"),
- ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &ptr_props);
- RNA_string_set(&ptr_props, "doc_id", buf);
-
- /* XXX inactive option, not for public! */
-#if 0
- uiItemFullO(
- layout, "WM_OT_doc_edit", "Submit Description", ICON_NONE,
- NULL, WM_OP_INVOKE_DEFAULT, 0, &ptr_props);
- RNA_string_set(&ptr_props, "doc_id", buf);
- RNA_string_set(&ptr_props, "doc_new", RNA_property_description(but->rnaprop));
-#endif
- }
- }
-
- if (but->optype) {
- uiItemO(layout, NULL,
- ICON_NONE, "UI_OT_copy_python_command_button");
- }
-
- /* perhaps we should move this into (G.debug & G_DEBUG) - campbell */
- if (ui_block_is_menu(but->block) == false) {
- uiItemFullO(layout, "UI_OT_editsource", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
- }
-
- if (BKE_addon_find(&U.addons, "ui_translate")) {
- uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
- }
-
- mt = WM_menutype_find("WM_MT_button_context", true);
- if (mt) {
- UI_menutype_draw(C, mt, uiLayoutColumn(layout, false));
- }
-
- UI_popup_menu_end(C, pup);
-
- return true;
-}
-
static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *event)
{
uiHandleButtonData *data;
@@ -7129,7 +6498,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent *
(event->val == KM_PRESS))
{
/* RMB has two options now */
- if (ui_but_menu(C, but)) {
+ if (ui_popup_context_menu_for_button(C, but)) {
return WM_UI_HANDLER_BREAK;
}
}
@@ -7724,10 +7093,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
/* highlight has timers for tooltips and auto open */
if (state == BUTTON_STATE_HIGHLIGHT) {
- /* for list-items (that are not drawn with regular emboss), don't change selection based on hovering */
- if (((but->flag & UI_BUT_LIST_ITEM) == 0) && (but->dragflag & UI_EMBOSS_NONE)) {
- but->flag &= ~UI_SELECT;
- }
+ but->flag &= ~UI_SELECT;
button_tooltip_timer_reset(C, but);
@@ -9597,6 +8963,11 @@ static int ui_handle_menu_event(
}
#endif
+ /* Don't handle double click events, rehandle as regular press/release. */
+ if (retval == WM_UI_HANDLER_CONTINUE && event->val == KM_DBL_CLICK) {
+ return retval;
+ }
+
/* if we set a menu return value, ensure we continue passing this on to
* lower menus and buttons, so always set continue then, and if we are
* inside the region otherwise, ensure we swallow the event */
@@ -10177,6 +9548,7 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
{
ARegion *ar;
uiBut *but;
+ int retval = WM_UI_HANDLER_CONTINUE;
ar = CTX_wm_menu(C);
if (!ar)
@@ -10220,29 +9592,32 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
if ((but_other->flag & UI_BUT_DISABLED) == 0) {
ui_handle_button_activate(C, ar, but_other, BUTTON_ACTIVATE_OVER);
button_activate_state(C, but_other, BUTTON_STATE_MENU_OPEN);
+ retval = WM_UI_HANDLER_BREAK;
}
}
else if (data->state == BUTTON_STATE_MENU_OPEN) {
- int retval;
-
/* handle events for menus and their buttons recursively,
* this will handle events from the top to the bottom menu */
- if (data->menu)
+ if (data->menu) {
retval = ui_handle_menus_recursive(C, event, data->menu, 0, false, false, false);
+ }
/* handle events for the activated button */
if ((data->menu && (retval == WM_UI_HANDLER_CONTINUE)) ||
(event->type == TIMER))
{
- if (data->menu && data->menu->menuretval)
+ if (data->menu && data->menu->menuretval) {
ui_handle_button_return_submenu(C, event, but);
- else
- ui_handle_button_event(C, event, but);
+ retval = WM_UI_HANDLER_BREAK;
+ }
+ else {
+ retval = ui_handle_button_event(C, event, but);
+ }
}
}
else {
/* handle events for the activated button */
- ui_handle_button_event(C, event, but);
+ retval = ui_handle_button_event(C, event, but);
}
}
@@ -10253,6 +9628,14 @@ static int ui_handler_region_menu(bContext *C, const wmEvent *event, void *UNUSE
/* delayed apply callbacks */
ui_apply_but_funcs_after(C);
+ /* Don't handle double-click events,
+ * these will be converted into regular clicks which we handle. */
+ if (retval == WM_UI_HANDLER_CONTINUE) {
+ if (event->val == KM_DBL_CLICK) {
+ return WM_UI_HANDLER_CONTINUE;
+ }
+ }
+
/* we block all events, this is modal interaction */
return WM_UI_HANDLER_BREAK;
}
@@ -10303,8 +9686,9 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
#ifdef USE_DRAG_TOGGLE
{
- WM_event_free_ui_handler_all(C, &win->modalhandlers,
- ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove);
+ WM_event_free_ui_handler_all(
+ C, &win->modalhandlers,
+ ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove);
}
#endif
@@ -10459,18 +9843,3 @@ void ui_but_clipboard_free(void)
{
curvemapping_free_data(&but_copypaste_curve);
}
-
-bool UI_but_is_tool(const uiBut *but)
-{
- /* very evil! */
- if (but->optype != NULL) {
- static wmOperatorType *ot = NULL;
- if (ot == NULL) {
- ot = WM_operatortype_find("WM_OT_tool_set_by_name", false);
- }
- if (but->optype == ot) {
- return true;
- }
- }
- return false;
-}
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 64fca05c082..c3246213d4e 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -37,6 +37,7 @@
#include "GPU_matrix.h"
#include "GPU_batch.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -101,11 +102,12 @@ typedef struct IconImage {
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
-#define ICON_TYPE_PREVIEW 0
-#define ICON_TYPE_TEXTURE 1
-#define ICON_TYPE_BUFFER 2
-#define ICON_TYPE_VECTOR 3
-#define ICON_TYPE_GEOM 4
+#define ICON_TYPE_PREVIEW 0
+#define ICON_TYPE_TEXTURE 1
+#define ICON_TYPE_MONO_TEXTURE 2
+#define ICON_TYPE_BUFFER 3
+#define ICON_TYPE_VECTOR 4
+#define ICON_TYPE_GEOM 5
typedef struct DrawInfo {
int type;
@@ -159,7 +161,7 @@ static DrawInfo *def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs,
di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
di->type = type;
- if (type == ICON_TYPE_TEXTURE) {
+ if (ELEM(type, ICON_TYPE_TEXTURE, ICON_TYPE_MONO_TEXTURE)) {
di->data.texture.x = xofs;
di->data.texture.y = yofs;
di->data.texture.w = size;
@@ -458,7 +460,7 @@ static void init_internal_icons(void)
{
// bTheme *btheme = UI_GetTheme();
ImBuf *b16buf = NULL, *b32buf = NULL;
- int x, y, icontype;
+ int x, y;
#if 0 // temp disabled
if ((btheme != NULL) && btheme->tui.iconfile[0]) {
@@ -492,56 +494,46 @@ static void init_internal_icons(void)
IMB_premultiply_alpha(b32buf);
if (b16buf && b32buf) {
- /* free existing texture if any */
+ /* Free existing texture if any. */
if (icongltex.id) {
glDeleteTextures(1, &icongltex.id);
icongltex.id = 0;
}
-#if 0 /* should be a compile-time check (if needed at all) */
- /* we only use a texture for cards with non-power of two */
- if (GPU_full_non_power_of_two_support()) {
-#else
- {
-#endif
- glGenTextures(1, &icongltex.id);
+ /* Allocate OpenGL texture. */
+ glGenTextures(1, &icongltex.id);
- if (icongltex.id) {
- int level = 2;
+ if (icongltex.id) {
+ int level = 2;
- icongltex.w = b32buf->x;
- icongltex.h = b32buf->y;
- icongltex.invw = 1.0f / b32buf->x;
- icongltex.invh = 1.0f / b32buf->y;
+ icongltex.w = b32buf->x;
+ icongltex.h = b32buf->y;
+ icongltex.invw = 1.0f / b32buf->x;
+ icongltex.invh = 1.0f / b32buf->y;
- glBindTexture(GL_TEXTURE_2D, icongltex.id);
+ glBindTexture(GL_TEXTURE_2D, icongltex.id);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, b32buf->x, b32buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b32buf->rect);
- glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA8, b16buf->x, b16buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b16buf->rect);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, b32buf->x, b32buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b32buf->rect);
+ glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA8, b16buf->x, b16buf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, b16buf->rect);
- while (b16buf->x > 1) {
- ImBuf *nbuf = IMB_onehalf(b16buf);
- glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, nbuf->x, nbuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nbuf->rect);
- level++;
- IMB_freeImBuf(b16buf);
- b16buf = nbuf;
- }
+ while (b16buf->x > 1) {
+ ImBuf *nbuf = IMB_onehalf(b16buf);
+ glTexImage2D(GL_TEXTURE_2D, level, GL_RGBA8, nbuf->x, nbuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, nbuf->rect);
+ level++;
+ IMB_freeImBuf(b16buf);
+ b16buf = nbuf;
+ }
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glBindTexture(GL_TEXTURE_2D, 0);
- }
+ glBindTexture(GL_TEXTURE_2D, 0);
}
- }
- if (icongltex.id)
- icontype = ICON_TYPE_TEXTURE;
- else
- icontype = ICON_TYPE_BUFFER;
-
- if (b32buf) {
+ /* Define icons. */
for (y = 0; y < ICON_GRID_ROWS; y++) {
+ /* Row W has monochrome icons. */
+ int icontype = (y == 8) ? ICON_TYPE_MONO_TEXTURE : ICON_TYPE_TEXTURE;
for (x = 0; x < ICON_GRID_COLS; x++) {
def_internal_icon(b32buf, BIFICONID_FIRST + y * ICON_GRID_COLS + x,
x * (ICON_GRID_W + ICON_GRID_MARGIN) + ICON_GRID_MARGIN,
@@ -858,7 +850,7 @@ static void ui_studiolight_kill_icon_preview_job(wmWindowManager *wm, int icon_i
icon->obj = NULL;
}
-static void ui_studiolight_free_function(StudioLight * sl, void* data)
+static void ui_studiolight_free_function(StudioLight *sl, void *data)
{
wmWindowManager *wm = data;
@@ -920,7 +912,7 @@ void ui_icon_ensure_deferred(const bContext *C, const int icon_id, const bool bi
di->data.buffer.image = img;
wmJob *wm_job = WM_jobs_get(wm, CTX_wm_window(C), icon, "StudioLight Icon", 0, WM_JOB_TYPE_STUDIOLIGHT);
- Icon** tmp = MEM_callocN(sizeof(Icon*), __func__);
+ Icon **tmp = MEM_callocN(sizeof(Icon *), __func__);
*tmp = icon;
WM_jobs_customdata_set(wm_job, tmp, MEM_freeN);
WM_jobs_timer(wm_job, 0.01, 0, NC_WINDOW);
@@ -1106,10 +1098,10 @@ static void icon_draw_cache_flush_ex(void)
return;
/* We need to flush widget base first to ensure correct ordering. */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
UI_widgetbase_draw_cache_flush();
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, icongltex.id);
@@ -1139,12 +1131,12 @@ void UI_icon_draw_cache_end(void)
if (g_icon_draw_cache.calls == 0)
return;
- glEnable(GL_BLEND);
+ GPU_blend(true);
icon_draw_cache_flush_ex();
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glDisable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(false);
}
static void icon_draw_texture_cached(
@@ -1187,7 +1179,7 @@ static void icon_draw_texture(
}
/* We need to flush widget base first to ensure correct ordering. */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
UI_widgetbase_draw_cache_flush();
float x1, x2, y1, y2;
@@ -1291,15 +1283,30 @@ static void icon_draw_size(
}
glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
icon_draw_rect(x, y, w, h, aspect, w, h, ibuf->rect, alpha, rgb, desaturate);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
else if (di->type == ICON_TYPE_TEXTURE) {
/* texture image use premul alpha for correct scaling */
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y,
di->data.texture.w, di->data.texture.h, alpha, rgb);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
+ else if (di->type== ICON_TYPE_MONO_TEXTURE) {
+ /* icon that matches text color, assumed to be white */
+ float text_color[4];
+ UI_GetThemeColor4fv(TH_TEXT, text_color);
+ if (rgb) {
+ mul_v3_v3(text_color, rgb);
+ }
+ text_color[3] *= alpha;
+
+ GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y,
+ di->data.texture.w, di->data.texture.h, text_color[3], text_color);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ }
+
else if (di->type == ICON_TYPE_BUFFER) {
/* it is a builtin icon */
iimg = di->data.buffer.image;
@@ -1308,9 +1315,9 @@ static void icon_draw_size(
#endif
if (!iimg->rect) return; /* something has gone wrong! */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, desaturate);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
else if (di->type == ICON_TYPE_PREVIEW) {
PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
@@ -1320,10 +1327,10 @@ static void icon_draw_size(
if (!pi->rect[size]) return; /* something has gone wrong! */
/* preview images use premul alpha ... */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], alpha, rgb, desaturate);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
}
}
@@ -1647,4 +1654,3 @@ void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspec
{
icon_draw_size(x, y, icon_id, aspect, alpha, NULL, ICON_SIZE_PREVIEW, size, false);
}
-
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 6f029b81e92..04e9e2b18b4 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -444,8 +444,6 @@ typedef struct uiSafetyRct {
void ui_fontscale(short *points, float aspect);
-extern bool ui_block_is_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
-extern bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
extern void ui_block_to_window_fl(const struct ARegion *ar, uiBlock *block, float *x, float *y);
extern void ui_block_to_window(const struct ARegion *ar, uiBlock *block, int *x, int *y);
extern void ui_block_to_window_rctf(const struct ARegion *ar, uiBlock *block, rctf *rct_dst, const rctf *rct_src);
@@ -696,17 +694,12 @@ extern void ui_but_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut
extern uiBut *ui_but_find_select_in_enum(uiBut *but, int direction);
extern uiBut *ui_but_find_active_in_region(struct ARegion *ar);
extern uiBut *ui_but_find_mouse_over(struct ARegion *ar, const struct wmEvent *event);
-bool ui_but_is_editable(const uiBut *but);
-bool ui_but_is_editable_as_text(const uiBut *but);
-bool ui_but_is_toggle(const uiBut *but);
-bool ui_but_is_popover_once_compat(const uiBut *but);
void ui_but_pie_dir_visual(RadialDirection dir, float vec[2]);
void ui_but_pie_dir(RadialDirection dir, float vec[2]);
float ui_block_calc_pie_segment(struct uiBlock *block, const float event_xy[2]);
void ui_but_add_shortcut(uiBut *but, const char *key_str, const bool do_strip);
void ui_but_clipboard_free(void);
-void ui_panel_menu(struct bContext *C, ARegion *ar, Panel *pa);
uiBut *ui_but_find_old(uiBlock *block_old, const uiBut *but_new);
uiBut *ui_but_find_new(uiBlock *block_old, const uiBut *but_new);
@@ -756,19 +749,16 @@ void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float m
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
void ui_draw_popover_back(ARegion *ar, struct uiStyle *style, uiBlock *block, rcti *rect);
void ui_draw_pie_center(uiBlock *block);
-uiWidgetColors *ui_tooltip_get_theme(void);
+struct uiWidgetColors *ui_tooltip_get_theme(void);
void ui_draw_widget_back_color(
uiWidgetTypeEnum type, bool use_shadow, const rcti *rect,
const float color[4]);
void ui_draw_widget_back(
uiWidgetTypeEnum type, bool use_shadow, const rcti *rect);
-void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
+void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
extern void ui_draw_but(const struct bContext *C, ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
-/* theme color init */
-struct ThemeUI;
-void ui_widget_color_init(struct ThemeUI *tui);
void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state, bool use_sep);
void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state);
@@ -818,6 +808,19 @@ void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, fl
void ui_but_anim_decorate_cb(struct bContext *C, void *arg_but, void *arg_dummy);
void ui_but_anim_decorate_update_from_flag(uiBut *but);
+/* interface_query.c */
+bool ui_but_is_editable(const uiBut *but);
+bool ui_but_is_editable_as_text(const uiBut *but);
+bool ui_but_is_toggle(const uiBut *but);
+bool ui_but_is_popover_once_compat(const uiBut *but);
+
+extern bool ui_block_is_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
+extern bool ui_block_is_pie_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT;
+
+/* interface_context_menu.c */
+bool ui_popup_context_menu_for_button(struct bContext *C, uiBut *but);
+void ui_popup_context_menu_for_panel(struct bContext *C, struct ARegion *ar, struct Panel *pa);
+
/* interface_eyedropper.c */
struct wmKeyMap *eyedropper_modal_keymap(struct wmKeyConfig *keyconf);
struct wmKeyMap *eyedropper_colorband_modal_keymap(struct wmKeyConfig *keyconf);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 3784ab635be..9b9199538d6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -67,6 +67,9 @@
/* Show an icon button after each RNA button to use to quickly set keyframes,
* this is a way to display animation/driven/override status, see T54951. */
#define UI_PROP_DECORATE
+/* Alternate draw mode where some buttons can use single icon width,
+ * giving more room for the text at the expense of nicely aligned text. */
+#define UI_PROP_SEP_ICON_WIDTH_EXCEPTION
/************************ Structs and Defines *************************/
@@ -183,7 +186,7 @@ typedef struct uiLayoutItemGridFlow {
/* If positive, absolute fixed number of columns.
* If 0, fully automatic (based on available width).
* If negative, automatic but only generates number of columns/rows multiple of given (absolute) value. */
- int num_columns;
+ int columns_len;
/* Pure internal runtime storage. */
int tot_items, tot_columns, tot_rows;
@@ -390,7 +393,7 @@ static int ui_layout_local_dir(uiLayout *layout)
}
}
-static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, int align)
+static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, bool align)
{
uiLayout *sub;
@@ -561,7 +564,7 @@ static void ui_item_array(
uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
}
else {
- int *boolarr = NULL;
+ bool *boolarr = NULL;
/* even if 'expand' is fale, expanding anyway */
@@ -576,7 +579,7 @@ static void ui_item_array(
/* show checkboxes for rna on a non-emboss block (menu for eg) */
if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSS_NONE, UI_EMBOSS_PULLDOWN)) {
- boolarr = MEM_callocN(sizeof(int) * len, __func__);
+ boolarr = MEM_callocN(sizeof(bool) * len, __func__);
RNA_property_boolean_get_array(ptr, prop, boolarr);
}
@@ -591,8 +594,9 @@ static void ui_item_array(
icon = boolarr[a] ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
}
- width_item = (compact && type == PROP_BOOLEAN) ?
- min_ii(w, ui_text_icon_width(layout, str_buf, icon, false)) : w;
+ width_item = (
+ (compact && type == PROP_BOOLEAN) ?
+ min_ii(w, ui_text_icon_width(layout, str_buf, icon, false)) : w);
but = uiDefAutoButR(block, ptr, prop, a, str_buf, icon, 0, 0, width_item, UI_UNIT_Y);
if (slider && but->type == UI_BTYPE_NUM)
@@ -773,8 +777,9 @@ static uiBut *ui_item_with_label(
but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, prop_but_width - UI_UNIT_X, h);
/* BUTTONS_OT_file_browse calls UI_context_active_but_prop_get_filebrowser */
- uiDefIconButO(block, UI_BTYPE_BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse",
- WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
+ uiDefIconButO(
+ block, UI_BTYPE_BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse",
+ WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
}
else if (flag & UI_ITEM_R_EVENT) {
but = uiDefButR_prop(block, UI_BTYPE_KEY_EVENT, 0, name, x, y, prop_but_width, h, ptr, prop, index, 0, 0, -1, -1, NULL);
@@ -793,8 +798,9 @@ static uiBut *ui_item_with_label(
}
else {
const char *str = (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY)) ? NULL : "";
- but = uiDefAutoButR(block, ptr, prop, index, str, icon,
- x, y, prop_but_width, h);
+ but = uiDefAutoButR(
+ block, ptr, prop, index, str, icon,
+ x, y, prop_but_width, h);
}
UI_block_layout_set_current(block, layout);
@@ -1182,8 +1188,9 @@ void uiItemsFullEnumO_items(
}
else {
/* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */
- but = uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
- 0.0, 0.0, 0, 0, "");
+ but = uiDefBut(
+ block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL,
+ 0.0, 0.0, 0, 0, "");
}
ui_but_tip_from_enum_item(but, item);
}
@@ -1547,13 +1554,24 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
/* use checkboxes only as a fallback in pie-menu's, when no icon is defined */
((layout->root->type == UI_LAYOUT_PIEMENU) && (icon == ICON_NONE)))
{
+ int prop_flag = RNA_property_flag(prop);
if (type == PROP_BOOLEAN && ((is_array == false) || (index != RNA_NO_INDEX))) {
- if (is_array) icon = (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
- else icon = (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
+ if (prop_flag & PROP_ICONS_CONSECUTIVE) {
+ icon = ICON_CHECKBOX_DEHLT; /* but->iconadd will set to correct icon */
+ }
+ else if (is_array) {
+ icon = (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
+ }
+ else {
+ icon = (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
+ }
}
else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
int enum_value = RNA_property_enum_get(ptr, prop);
- if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ if (prop_flag & PROP_ICONS_CONSECUTIVE) {
+ icon = ICON_CHECKBOX_DEHLT; /* but->iconadd will set to correct icon */
+ }
+ else if (prop_flag & PROP_ENUM_FLAG) {
icon = (enum_value & value) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
}
else {
@@ -1595,9 +1613,19 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
else {
const PropertySubType subtype = RNA_property_subtype(prop);
- uiLayout *layout_split = uiLayoutSplit(
- layout_row ? layout_row : layout,
- UI_ITEM_PROP_SEP_DIVIDE, true);
+ uiLayout *layout_split;
+#ifdef UI_PROP_SEP_ICON_WIDTH_EXCEPTION
+ if (type == PROP_BOOLEAN && (icon == ICON_NONE) && !icon_only) {
+ w = UI_UNIT_X;
+ layout_split = uiLayoutRow(layout_row ? layout_row : layout, true);
+ }
+ else
+#endif /* UI_PROP_SEP_ICON_WIDTH_EXCEPTION */
+ {
+ layout_split = uiLayoutSplit(
+ layout_row ? layout_row : layout,
+ UI_ITEM_PROP_SEP_DIVIDE, true);
+ }
layout_split->space = 0;
uiLayout *layout_sub = uiLayoutColumn(layout_split, true);
layout_sub->space = 0;
@@ -1697,7 +1725,7 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
}
/* Mark non-embossed textfields inside a listbox. */
- if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->dt & UI_EMBOSS_NONE)) {
+ if (but && (block->flag & UI_BLOCK_LIST_ITEM) && (but->type == UI_BTYPE_TEXT) && (but->dt & UI_EMBOSS_NONE)) {
UI_but_flag_enable(but, UI_BUT_LIST_ITEM);
}
@@ -1951,8 +1979,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
}
UI_but_func_search_set(
- but, ui_searchbox_create_generic, ui_rna_collection_search_cb,
- coll_search, NULL, NULL);
+ but, ui_searchbox_create_generic, ui_rna_collection_search_cb,
+ coll_search, NULL, NULL);
but->free_search_arg = true;
}
else if (but->type == UI_BTYPE_SEARCH_MENU) {
@@ -2100,7 +2128,7 @@ static uiBut *ui_item_menu(
return but;
}
-void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const char *name, int icon)
+void uiItemM(uiLayout *layout, const char *menuname, const char *name, int icon)
{
MenuType *mt;
@@ -2373,8 +2401,9 @@ void uiItemMenuEnumO_ptr(
BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname));
lvl->opcontext = layout->root->opcontext;
- but = ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl,
- RNA_struct_ui_description(ot->srna), true);
+ but = ui_item_menu(
+ layout, name, icon, menu_item_enum_opname_menu, NULL, lvl,
+ RNA_struct_ui_description(ot->srna), true);
/* add hotkey here, lower UI code can't detect it */
if ((layout->root->block->flag & UI_BLOCK_LOOP) &&
@@ -3171,12 +3200,12 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
.litem_y = litem->y,
.space_x = space_x,
.space_y = space_y,
- }),
+ }),
&((UILayoutGridFlowOutput) {
.tot_items = &gflow->tot_items,
.global_avg_w = &avg_w,
.global_max_h = &max_h,
- }));
+ }));
if (gflow->tot_items == 0) {
litem->w = litem->h = 0;
@@ -3187,8 +3216,8 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
/* Even in varying column width case, we fix our columns number from weighted average width of items,
* a proper solving of required width would be too costly, and this should give reasonably good results
* in all resonable cases... */
- if (gflow->num_columns > 0) {
- gflow->tot_columns = gflow->num_columns;
+ if (gflow->columns_len > 0) {
+ gflow->tot_columns = gflow->columns_len;
}
else {
if (avg_w == 0.0f) {
@@ -3205,7 +3234,7 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
* Note that modulo does not prevent ending with fewer columns/rows than modulo, if mandatory
* to avoid empty column/row. */
{
- const int modulo = (gflow->num_columns < -1) ? -gflow->num_columns : 0;
+ const int modulo = (gflow->columns_len < -1) ? -gflow->columns_len : 0;
const int step = modulo ? modulo : 1;
if (gflow->row_major) {
@@ -3258,11 +3287,11 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem)
.space_y = space_y,
.tot_columns = gflow->tot_columns,
.tot_rows = gflow->tot_rows,
- }),
+ }),
&((UILayoutGridFlowOutput) {
.tot_w = &tot_w,
.tot_h = &tot_h,
- }));
+ }));
litem->w = tot_w;
litem->h = tot_h;
@@ -3306,13 +3335,13 @@ static void ui_litem_layout_grid_flow(uiLayout *litem)
.space_y = space_y,
.tot_columns = gflow->tot_columns,
.tot_rows = gflow->tot_rows,
- }),
+ }),
&((UILayoutGridFlowOutput) {
.cos_x_array = cos_x,
.cos_y_array = cos_y,
.widths_array = widths,
.heights_array = heights,
- }));
+ }));
for (item = litem->items.first, i = 0; item; item = item->next, i++) {
const int col = gflow->row_major ? i % gflow->tot_columns : i / gflow->tot_rows;
@@ -3520,7 +3549,7 @@ static void ui_litem_init_from_parent(uiLayout *litem, uiLayout *layout, int ali
}
/* layout create functions */
-uiLayout *uiLayoutRow(uiLayout *layout, int align)
+uiLayout *uiLayoutRow(uiLayout *layout, bool align)
{
uiLayout *litem;
@@ -3535,7 +3564,7 @@ uiLayout *uiLayoutRow(uiLayout *layout, int align)
return litem;
}
-uiLayout *uiLayoutColumn(uiLayout *layout, int align)
+uiLayout *uiLayoutColumn(uiLayout *layout, bool align)
{
uiLayout *litem;
@@ -3550,7 +3579,7 @@ uiLayout *uiLayoutColumn(uiLayout *layout, int align)
return litem;
}
-uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align)
+uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align)
{
uiLayoutItemFlow *flow;
@@ -3567,7 +3596,7 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align)
}
uiLayout *uiLayoutGridFlow(
- uiLayout *layout, int row_major, int num_columns, int even_columns, int even_rows, int align)
+ uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align)
{
uiLayoutItemGridFlow *flow;
@@ -3577,7 +3606,7 @@ uiLayout *uiLayoutGridFlow(
flow->litem.space = (flow->litem.align) ? 0 : layout->root->style->columnspace;
flow->row_major = row_major;
- flow->num_columns = num_columns;
+ flow->columns_len = columns_len;
flow->even_columns = even_columns;
flow->even_rows = even_rows;
@@ -3676,7 +3705,7 @@ uiLayout *uiLayoutListBox(
return (uiLayout *)box;
}
-uiLayout *uiLayoutAbsolute(uiLayout *layout, int align)
+uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align)
{
uiLayout *litem;
@@ -3714,7 +3743,7 @@ uiLayout *uiLayoutOverlap(uiLayout *layout)
return litem;
}
-uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align)
+uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align)
{
uiLayoutItemSplit *split;
@@ -3848,6 +3877,11 @@ static void ui_item_scale(uiLayout *litem, const float scale[2])
int x, y, w, h;
for (item = litem->items.last; item; item = item->prev) {
+ if (item->type != ITEM_BUTTON) {
+ uiLayout *subitem = (uiLayout *)item;
+ ui_item_scale(subitem, scale);
+ }
+
ui_item_size(item, &w, &h);
ui_item_offset(item, &x, &y);
@@ -4292,6 +4326,9 @@ static void ui_paneltype_draw_impl(
panel->type = pt;
panel->flag = PNL_POPOVER;
+ uiLayout *last_item = layout->items.last;
+
+ /* Draw main panel. */
if (show_header) {
uiLayout *row = uiLayoutRow(layout, false);
if (pt->draw_header) {
@@ -4308,19 +4345,21 @@ static void ui_paneltype_draw_impl(
MEM_freeN(panel);
- PanelType *pt_iter = pt;
- while (pt_iter->prev) {
- pt_iter = pt_iter->prev;
- }
- do {
- if (pt_iter != pt && STREQ(pt_iter->parent_id, pt->idname)) {
- if (pt_iter->poll == NULL || pt_iter->poll(C, pt_iter)) {
+ /* Draw child panels. */
+ for (LinkData *link = pt->children.first; link; link = link->next) {
+ PanelType *child_pt = link->data;
+
+ if (child_pt->poll == NULL || child_pt->poll(C, child_pt)) {
+ /* Add space if something was added to the layout. */
+ if (last_item != layout->items.last) {
uiItemS(layout);
- uiLayout *col = uiLayoutColumn(layout, false);
- ui_paneltype_draw_impl(C, pt_iter, col, true);
+ last_item = layout->items.last;
}
+
+ uiLayout *col = uiLayoutColumn(layout, false);
+ ui_paneltype_draw_impl(C, child_pt, col, true);
}
- } while ((pt_iter = pt_iter->next));
+ }
}
/**
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index aad48d13277..3457d2e2eeb 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -98,7 +98,7 @@ static void UI_OT_reset_default_theme(wmOperatorType *ot)
/* Copy Data Path Operator ------------------------ */
-static int copy_data_path_button_poll(bContext *C)
+static bool copy_data_path_button_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
@@ -177,7 +177,7 @@ static void UI_OT_copy_data_path_button(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
-static int copy_python_command_button_poll(bContext *C)
+static bool copy_python_command_button_poll(bContext *C)
{
uiBut *but = UI_context_active_but_get(C);
@@ -248,7 +248,7 @@ static int operator_button_property_finish(bContext *C, PointerRNA *ptr, Propert
}
}
-static int reset_default_button_poll(bContext *C)
+static bool reset_default_button_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
@@ -347,7 +347,7 @@ enum {
static EnumPropertyItem override_type_items[] = {
{UIOverride_Type_NOOP, "NOOP", 0, "NoOp",
- "'No-Operation', place holder preventing automatic override to ever affect the property"},
+ "'No-Operation', place holder preventing automatic override to ever affect the property"},
{UIOverride_Type_Replace, "REPLACE", 0, "Replace", "Completely replace value from linked data by local one"},
{UIOverride_Type_Difference, "DIFFERENCE", 0, "Difference", "Store difference to linked data value"},
{UIOverride_Type_Factor, "FACTOR", 0, "Factor", "Store factor to linked data value (useful e.g. for scale)"},
@@ -355,7 +355,7 @@ static EnumPropertyItem override_type_items[] = {
};
-static int override_type_set_button_poll(bContext *C)
+static bool override_type_set_button_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
@@ -408,7 +408,7 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op)
}
IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_get(
- &ptr, prop, operation, index, true, NULL, &created);
+ &ptr, prop, operation, index, true, NULL, &created);
if (!created) {
opop->operation = operation;
}
@@ -443,13 +443,14 @@ static void UI_OT_override_type_set_button(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
- ot->prop = RNA_def_enum(ot->srna, "type", override_type_items, UIOverride_Type_Replace,
- "Type", "Type of override operation");
+ ot->prop = RNA_def_enum(
+ ot->srna, "type", override_type_items, UIOverride_Type_Replace,
+ "Type", "Type of override operation");
/* TODO: add itemf callback, not all options are available for all data types... */
}
-static int override_remove_button_poll(bContext *C)
+static bool override_remove_button_poll(bContext *C)
{
PointerRNA ptr;
PropertyRNA *prop;
@@ -464,6 +465,7 @@ static int override_remove_button_poll(bContext *C)
static int override_remove_button_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, id_refptr, src;
PropertyRNA *prop;
int index;
@@ -492,7 +494,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
bool is_strict_find;
/* Remove override operation for given item, add singular operations for the other items as needed. */
IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find(
- oprop, NULL, NULL, index, index, false, &is_strict_find);
+ oprop, NULL, NULL, index, index, false, &is_strict_find);
BLI_assert(opop != NULL);
if (!is_strict_find) {
/* No specific override operation, we have to get generic one,
@@ -505,7 +507,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
}
BKE_override_static_property_operation_delete(oprop, opop);
if (!is_template) {
- RNA_property_copy(&ptr, &src, prop, index);
+ RNA_property_copy(bmain, &ptr, &src, prop, index);
}
if (BLI_listbase_is_empty(&oprop->operations)) {
BKE_override_static_property_delete(id->override_static, oprop);
@@ -515,7 +517,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op)
/* Just remove whole generic override operation of this property. */
BKE_override_static_property_delete(id->override_static, oprop);
if (!is_template) {
- RNA_property_copy(&ptr, &src, prop, -1);
+ RNA_property_copy(bmain, &ptr, &src, prop, -1);
}
}
@@ -699,6 +701,7 @@ bool UI_context_copy_to_selected_list(
*/
static bool copy_to_selected_button(bContext *C, bool all, bool poll)
{
+ Main *bmain = CTX_data_main(C);
PointerRNA ptr, lptr, idptr;
PropertyRNA *prop, *lprop;
bool success = false;
@@ -747,7 +750,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
break;
}
else {
- if (RNA_property_copy(&lptr, &ptr, prop, (all) ? -1 : index)) {
+ if (RNA_property_copy(bmain, &lptr, &ptr, prop, (all) ? -1 : index)) {
RNA_property_update(C, &lptr, prop);
success = true;
}
@@ -764,7 +767,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll)
return success;
}
-static int copy_to_selected_button_poll(bContext *C)
+static bool copy_to_selected_button_poll(bContext *C)
{
return copy_to_selected_button(C, false, true);
}
@@ -804,7 +807,7 @@ static void UI_OT_copy_to_selected_button(wmOperatorType *ot)
* when there are too many to display...
*/
-static int reports_to_text_poll(bContext *C)
+static bool reports_to_text_poll(bContext *C)
{
return CTX_wm_reports(C) != NULL;
}
@@ -1022,9 +1025,10 @@ static int editsource_exec(bContext *C, wmOperator *op)
if (but_store) {
if (but_store->py_dbg_ln != -1) {
- ret = editsource_text_edit(C, op,
- but_store->py_dbg_fn,
- but_store->py_dbg_ln);
+ ret = editsource_text_edit(
+ C, op,
+ but_store->py_dbg_fn,
+ but_store->py_dbg_ln);
}
else {
BKE_report(op->reports, RPT_ERROR, "Active button is not from a script, cannot edit source");
@@ -1132,14 +1136,18 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL};
if (!BLI_is_dir(root)) {
- BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' 'Translation Branches "
- "Directory' path to a valid directory");
+ BKE_report(
+ op->reports, RPT_ERROR,
+ "Please set your User Preferences' 'Translation Branches "
+ "Directory' path to a valid directory");
return OPERATOR_CANCELLED;
}
ot = WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0);
if (ot == NULL) {
- BKE_reportf(op->reports, RPT_ERROR, "Could not find operator '%s'! Please enable ui_translate add-on "
- "in the User Preferences", EDTSRC_I18N_OP_NAME);
+ BKE_reportf(
+ op->reports, RPT_ERROR,
+ "Could not find operator '%s'! Please enable ui_translate add-on "
+ "in the User Preferences", EDTSRC_I18N_OP_NAME);
return OPERATOR_CANCELLED;
}
/* Try to find a valid po file for current language... */
@@ -1150,8 +1158,9 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- UI_but_string_info_get(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
- &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL);
+ UI_but_string_info_get(
+ C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip,
+ &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL);
WM_operator_properties_create_ptr(&ptr, ot);
RNA_string_set(&ptr, "lang", uilng);
@@ -1231,7 +1240,7 @@ static void UI_OT_reloadtranslation(wmOperatorType *ot)
ot->exec = reloadtranslation_exec;
}
-int UI_drop_color_poll(struct bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
+bool UI_drop_color_poll(struct bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
{
/* should only return true for regions that include buttons, for now
* return true always */
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index e383ae42f8c..8107254f30b 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -63,6 +63,7 @@
#include "UI_resources.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "interface_intern.h"
@@ -486,10 +487,10 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float
{
/* set antialias line */
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 4);
@@ -501,8 +502,8 @@ static void ui_draw_anti_x(unsigned int pos, float x1, float y1, float x2, float
immEnd();
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
}
@@ -529,7 +530,7 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
dx = 0.5f * (xmax - xmin);
dy = 0.5f * (ymax - ymin);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor4ub(255, 255, 255, 50);
immBegin(GWN_PRIM_LINES, 4);
@@ -554,11 +555,12 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect)
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
-static void immRectf_tris_color_ex(unsigned int pos, float x1, float y1, float x2, float y2,
- unsigned int col, const float color[3])
+static void immRectf_tris_color_ex(
+ unsigned int pos, float x1, float y1, float x2, float y2,
+ unsigned int col, const float color[3])
{
immAttrib4fv(col, color);
immVertex2f(pos, x1, y1);
@@ -603,10 +605,12 @@ static void ui_draw_panel_dragwidget(unsigned int pos, unsigned int col, const r
const int x_co = (x_min + x_ofs) + (i_x * (box_size + box_margin));
const int y_co = (y_min + y_ofs) + (i_y * (box_size + box_margin));
- immRectf_tris_color_ex(pos, x_co - box_size, y_co - px_zoom, x_co, (y_co + box_size) - px_zoom,
- col, col_dark);
- immRectf_tris_color_ex(pos, x_co - box_size, y_co, x_co, y_co + box_size,
- col, col_high);
+ immRectf_tris_color_ex(
+ pos, x_co - box_size, y_co - px_zoom, x_co, (y_co + box_size) - px_zoom,
+ col, col_dark);
+ immRectf_tris_color_ex(
+ pos, x_co - box_size, y_co, x_co, y_co + box_size,
+ col, col_high);
}
}
immEnd();
@@ -696,7 +700,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
float maxx = is_closed_x ? (minx + PNL_HEADER / block->aspect) : rect->xmax;
float y = headrect.ymax;
- glEnable(GL_BLEND);
+ GPU_blend(true);
if (UI_GetThemeValue(TH_PANEL_SHOW_HEADER)) {
/* draw with background color */
@@ -736,7 +740,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
immEnd();
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -749,11 +753,12 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
if (show_pin)
#endif
{
- glEnable(GL_BLEND);
- UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
- (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
- (block->aspect / UI_DPI_FAC), 1.0f);
- glDisable(GL_BLEND);
+ GPU_blend(true);
+ UI_icon_draw_aspect(
+ headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect),
+ (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED,
+ (block->aspect / UI_DPI_FAC), 1.0f);
+ GPU_blend(false);
}
@@ -809,12 +814,12 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
/* panel backdrop */
if (is_subpanel) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformThemeColor(TH_PANEL_SUB_BACK);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
else if (UI_GetThemeValue(TH_PANEL_SHOW_BACK)) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformThemeColor(TH_PANEL_BACK);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}
@@ -1959,14 +1964,14 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* begin drawing */
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* draw the background */
if (is_alpha) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor4ubv(theme_col_tab_bg);
}
else {
@@ -1976,7 +1981,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
immRecti(pos, v2d->mask.xmin, v2d->mask.ymin, v2d->mask.xmin + category_tabs_width, v2d->mask.ymax);
if (is_alpha) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -1997,25 +2002,28 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
}
#endif
- glEnable(GL_BLEND);
+ GPU_blend(true);
#ifdef USE_FLAT_INACTIVE
if (is_active)
#endif
{
- ui_panel_category_draw_tab(true, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
- tab_curve_radius - px, roundboxtype, true, true, NULL,
- is_active ? theme_col_tab_active : theme_col_tab_inactive);
+ ui_panel_category_draw_tab(
+ true, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
+ tab_curve_radius - px, roundboxtype, true, true, NULL,
+ is_active ? theme_col_tab_active : theme_col_tab_inactive);
/* tab outline */
- ui_panel_category_draw_tab(false, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px,
- tab_curve_radius, roundboxtype, true, true, NULL, theme_col_tab_outline);
+ ui_panel_category_draw_tab(
+ false, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px,
+ tab_curve_radius, roundboxtype, true, true, NULL, theme_col_tab_outline);
/* tab highlight (3d look) */
- ui_panel_category_draw_tab(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
- tab_curve_radius, roundboxtype, true, false,
- is_active ? theme_col_back : theme_col_tab_inactive,
- is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive);
+ ui_panel_category_draw_tab(
+ false, rct->xmin, rct->ymin, rct->xmax, rct->ymax,
+ tab_curve_radius, roundboxtype, true, false,
+ is_active ? theme_col_back : theme_col_tab_inactive,
+ is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive);
}
/* tab blackline */
@@ -2033,8 +2041,9 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
}
if (do_scaletabs) {
- category_draw_len = BLF_width_to_strlen(fontid, category_id_draw, category_draw_len,
- category_width, NULL);
+ category_draw_len = BLF_width_to_strlen(
+ fontid, category_id_draw, category_draw_len,
+ category_width, NULL);
}
BLF_position(fontid, rct->xmax - text_v_ofs, rct->ymin + tab_v_pad_text, 0.0f);
@@ -2047,7 +2056,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
/* main tab title */
BLF_draw(fontid, category_id_draw, category_draw_len);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* tab blackline remaining (last tab) */
pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
@@ -2085,7 +2094,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
pc_dyn->rect.xmin = v2d->mask.xmin;
}
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
BLF_disable(fontid, BLF_ROTATION);
@@ -2254,7 +2263,7 @@ int ui_handler_panel_region(bContext *C, const wmEvent *event, ARegion *ar, cons
}
else if (event->type == RIGHTMOUSE) {
if (mouse_state == PANEL_MOUSE_INSIDE_HEADER) {
- ui_panel_menu(C, ar, block->panel);
+ ui_popup_context_menu_for_panel(C, ar, block->panel);
retval = WM_UI_HANDLER_BREAK;
break;
}
diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c
new file mode 100644
index 00000000000..66f63fef82d
--- /dev/null
+++ b/source/blender/editors/interface/interface_query.c
@@ -0,0 +1,127 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/interface/interface_query.c
+ * \ingroup edinterface
+ *
+ * Utilities to inspect the interface, extract information.
+ */
+
+#include "BLI_utildefines.h"
+
+#include "DNA_screen_types.h"
+
+#include "UI_interface.h"
+
+#include "interface_intern.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Button (uiBut)
+ * \{ */
+
+bool ui_but_is_editable(const uiBut *but)
+{
+ return !ELEM(
+ but->type,
+ UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE,
+ UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR);
+}
+
+bool ui_but_is_editable_as_text(const uiBut *but)
+{
+ return ELEM(
+ but->type,
+ UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER,
+ UI_BTYPE_SEARCH_MENU);
+
+}
+
+bool ui_but_is_toggle(const uiBut *but)
+{
+ return ELEM(
+ but->type,
+ UI_BTYPE_BUT_TOGGLE,
+ UI_BTYPE_TOGGLE,
+ UI_BTYPE_ICON_TOGGLE,
+ UI_BTYPE_ICON_TOGGLE_N,
+ UI_BTYPE_TOGGLE_N,
+ UI_BTYPE_CHECKBOX,
+ UI_BTYPE_CHECKBOX_N,
+ UI_BTYPE_ROW
+ );
+}
+
+#ifdef USE_UI_POPOVER_ONCE
+bool ui_but_is_popover_once_compat(const uiBut *but)
+{
+ return (
+ (but->type == UI_BTYPE_BUT) ||
+ ui_but_is_toggle(but)
+ );
+}
+#endif
+
+bool UI_but_is_tool(const uiBut *but)
+{
+ /* very evil! */
+ if (but->optype != NULL) {
+ static wmOperatorType *ot = NULL;
+ if (ot == NULL) {
+ ot = WM_operatortype_find("WM_OT_tool_set_by_name", false);
+ }
+ if (but->optype == ot) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Block (uiBlock)
+ * \{ */
+
+bool ui_block_is_menu(const uiBlock *block)
+{
+ return (((block->flag & UI_BLOCK_LOOP) != 0) &&
+ /* non-menu popups use keep-open, so check this is off */
+ ((block->flag & UI_BLOCK_KEEP_OPEN) == 0));
+}
+
+bool ui_block_is_pie_menu(const uiBlock *block)
+{
+ return ((block->flag & UI_BLOCK_RADIAL) != 0);
+}
+
+bool UI_block_is_empty(const uiBlock *block)
+{
+ for (const uiBut *but = block->buttons.first; but; but = but->next) {
+ if (!ELEM(but->type, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+/** \} */
diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index 1a49010ad9d..f3ff6fdf2c0 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -60,6 +60,7 @@
#include "ED_undo.h"
#include "interface_intern.h"
+#include "GPU_framebuffer.h"
/* -------------------------------------------------------------------- */
@@ -87,7 +88,7 @@ static bool last_redo_poll(const bContext *C)
/** \name Redo Panel
* \{ */
-static int hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt))
{
return last_redo_poll(C);
}
@@ -194,8 +195,8 @@ static void hud_region_draw(const bContext *C, ARegion *ar)
{
UI_view2d_view_ortho(&ar->v2d);
wmOrtho2_region_pixelspace(ar);
- glClearColor(0, 0, 0, 0.0f);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(0, 0, 0, 0.0f);
+ GPU_clear(GPU_COLOR_BIT);
if ((ar->flag & RGN_FLAG_HIDDEN) == 0) {
float color[4];
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index a6046e551c6..b9222a75803 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -458,6 +458,21 @@ void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
MEM_freeN(pup);
}
+bool UI_popup_menu_end_or_cancel(bContext *C, uiPopupMenu *pup)
+{
+ if (!UI_block_is_empty(pup->block)) {
+ UI_popup_menu_end(C, pup);
+ return true;
+ }
+ else {
+ UI_block_layout_resolve(pup->block, NULL, NULL);
+ MEM_freeN(pup->block->handle);
+ UI_block_free(C, pup->block);
+ MEM_freeN(pup);
+ return false;
+ }
+}
+
uiLayout *UI_popup_menu_layout(uiPopupMenu *pup)
{
return pup->layout;
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index e0dc149be17..9ca79a3dc63 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -64,6 +64,7 @@
#include "interface_intern.h"
#include "interface_regions_intern.h"
+#include "GPU_state.h"
#define MENU_BORDER (int)(0.3f * U.widget_unit)
@@ -422,22 +423,23 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
- ui_draw_preview_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
- (a == data->active) ? UI_ACTIVE : 0);
+ ui_draw_preview_item(
+ &data->fstyle, &rect, data->items.names[a], data->items.icons[a],
+ (a == data->active) ? UI_ACTIVE : 0);
}
/* indicate more */
if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem - 1);
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw(rect.xmax - 18, rect.ymin - 7, ICON_TRIA_DOWN);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw(rect.xmin, rect.ymax - 9, ICON_TRIA_UP);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -447,22 +449,23 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar)
ui_searchbox_butrect(&rect, data, a);
/* widget itself */
- ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a],
- (a == data->active) ? UI_ACTIVE : 0, data->use_sep);
+ ui_draw_menu_item(
+ &data->fstyle, &rect, data->items.names[a], data->items.icons[a],
+ (a == data->active) ? UI_ACTIVE : 0, data->use_sep);
}
/* indicate more */
if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem - 1);
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
}
@@ -723,8 +726,9 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe
}
rect_pre.xmax += 4; /* sneaky, avoid showing ugly margin */
- ui_draw_menu_item(&data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre),
- data->items.icons[a], state, false);
+ ui_draw_menu_item(
+ &data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre),
+ data->items.icons[a], state, false);
ui_draw_menu_item(&data->fstyle, &rect_post, data->items.names[a], 0, state, data->use_sep);
}
@@ -732,15 +736,15 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe
/* indicate more */
if (data->items.more) {
ui_searchbox_butrect(&rect, data, data->items.maxitem - 1);
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (data->items.offset) {
ui_searchbox_butrect(&rect, data, 0);
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index adc3a24d1a9..36ad516bf7f 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -540,4 +540,3 @@ void UI_fontstyle_set(const uiFontStyle *fs)
BLF_size(font->blf_id, fs->points * U.pixelsize, U.dpi);
}
-
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 59cb2229905..fbfa64cbdbd 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -381,8 +381,8 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
}
return template_common_search_menu(
- C, ar, id_search_cb_p, &template_ui, template_ID_set_property_cb, active_item_ptr.data,
- template_ui.prv_rows, template_ui.prv_cols);
+ C, ar, id_search_cb_p, &template_ui, template_ID_set_property_cb, active_item_ptr.data,
+ template_ui.prv_rows, template_ui.prv_cols);
}
/************************ ID Template ***************************/
@@ -492,8 +492,9 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
break;
case UI_ID_ALONE:
if (id) {
- const bool do_scene_obj = (GS(id->name) == ID_OB) &&
- (template_ui->ptr.type == &RNA_SceneObjects);
+ const bool do_scene_obj = (
+ (GS(id->name) == ID_OB) &&
+ (template_ui->ptr.type == &RNA_SceneObjects));
/* make copy */
if (do_scene_obj) {
@@ -584,43 +585,49 @@ static uiBut *template_id_def_new_but(
const int but_type = use_tab_but ? UI_BTYPE_TAB : UI_BTYPE_BUT;
/* i18n markup, does nothing! */
- BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_DEFAULT,
- BLT_I18NCONTEXT_ID_SCENE,
- BLT_I18NCONTEXT_ID_OBJECT,
- BLT_I18NCONTEXT_ID_MESH,
- BLT_I18NCONTEXT_ID_CURVE,
- BLT_I18NCONTEXT_ID_METABALL,
- BLT_I18NCONTEXT_ID_MATERIAL,
- BLT_I18NCONTEXT_ID_TEXTURE,
- BLT_I18NCONTEXT_ID_IMAGE,
- BLT_I18NCONTEXT_ID_LATTICE,
- BLT_I18NCONTEXT_ID_LAMP,
- BLT_I18NCONTEXT_ID_CAMERA,
- BLT_I18NCONTEXT_ID_WORLD,
- BLT_I18NCONTEXT_ID_SCREEN,
- BLT_I18NCONTEXT_ID_TEXT,
+ BLT_I18N_MSGID_MULTI_CTXT(
+ "New",
+ BLT_I18NCONTEXT_DEFAULT,
+ BLT_I18NCONTEXT_ID_SCENE,
+ BLT_I18NCONTEXT_ID_OBJECT,
+ BLT_I18NCONTEXT_ID_MESH,
+ BLT_I18NCONTEXT_ID_CURVE,
+ BLT_I18NCONTEXT_ID_METABALL,
+ BLT_I18NCONTEXT_ID_MATERIAL,
+ BLT_I18NCONTEXT_ID_TEXTURE,
+ BLT_I18NCONTEXT_ID_IMAGE,
+ BLT_I18NCONTEXT_ID_LATTICE,
+ BLT_I18NCONTEXT_ID_LAMP,
+ BLT_I18NCONTEXT_ID_CAMERA,
+ BLT_I18NCONTEXT_ID_WORLD,
+ BLT_I18NCONTEXT_ID_SCREEN,
+ BLT_I18NCONTEXT_ID_TEXT,
);
- BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_ID_SPEAKER,
- BLT_I18NCONTEXT_ID_SOUND,
- BLT_I18NCONTEXT_ID_ARMATURE,
- BLT_I18NCONTEXT_ID_ACTION,
- BLT_I18NCONTEXT_ID_NODETREE,
- BLT_I18NCONTEXT_ID_BRUSH,
- BLT_I18NCONTEXT_ID_PARTICLESETTINGS,
- BLT_I18NCONTEXT_ID_GPENCIL,
- BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE,
- BLT_I18NCONTEXT_ID_WORKSPACE,
- BLT_I18NCONTEXT_ID_LIGHTPROBE,
+ BLT_I18N_MSGID_MULTI_CTXT(
+ "New",
+ BLT_I18NCONTEXT_ID_SPEAKER,
+ BLT_I18NCONTEXT_ID_SOUND,
+ BLT_I18NCONTEXT_ID_ARMATURE,
+ BLT_I18NCONTEXT_ID_ACTION,
+ BLT_I18NCONTEXT_ID_NODETREE,
+ BLT_I18NCONTEXT_ID_BRUSH,
+ BLT_I18NCONTEXT_ID_PARTICLESETTINGS,
+ BLT_I18NCONTEXT_ID_GPENCIL,
+ BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE,
+ BLT_I18NCONTEXT_ID_WORKSPACE,
+ BLT_I18NCONTEXT_ID_LIGHTPROBE,
);
if (newop) {
- but = uiDefIconTextButO(block, but_type, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
- (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, but_height, NULL);
+ but = uiDefIconTextButO(
+ block, but_type, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN,
+ (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, but_height, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
else {
- but = uiDefIconTextBut(block, but_type, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"),
- 0, 0, w, but_height, NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(
+ block, but_type, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"),
+ 0, 0, w, but_height, NULL, 0, 0, 0, 0, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW));
}
@@ -680,17 +687,20 @@ static void template_ID(
if (id->lib) {
if (id->tag & LIB_TAG_INDIRECT) {
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change"));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change"));
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
else {
- const bool disabled = (!id_make_local(CTX_data_main(C), id, true /* test */, false) ||
- (idfrom && idfrom->lib));
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0, 0, 0, 0,
- TIP_("Direct linked library data-block, click to make local, "
- "Shift + Click to create a static override"));
+ const bool disabled = (
+ !id_make_local(CTX_data_main(C), id, true /* test */, false) ||
+ (idfrom && idfrom->lib));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Direct linked library data-block, click to make local, "
+ "Shift + Click to create a static override"));
if (disabled) {
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
@@ -700,9 +710,10 @@ static void template_ID(
}
}
else if (ID_IS_STATIC_OVERRIDE(id)) {
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_OVERRIDE, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- NULL, 0, 0, 0, 0,
- TIP_("Static override of linked library data-block, click to make fully local"));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_OVERRIDE, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0,
+ TIP_("Static override of linked library data-block, click to make fully local"));
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OVERRIDE));
}
@@ -712,9 +723,10 @@ static void template_ID(
numstr_len = BLI_snprintf(numstr, sizeof(numstr), "%d", id->us);
- but = uiDefBut(block, UI_BTYPE_BUT, 0, numstr, 0, 0,
- numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Display number of users of this data (click to make a single-user copy)"));
+ but = uiDefBut(
+ block, UI_BTYPE_BUT, 0, numstr, 0, 0,
+ numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ TIP_("Display number of users of this data (click to make a single-user copy)"));
but->flag |= UI_BUT_UNDO;
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ALONE));
@@ -743,8 +755,9 @@ static void template_ID(
/* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack.
* Only for images, sound and fonts */
if (id && BKE_pack_check(id)) {
- but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
- UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));
+ but = uiDefIconButO(
+ block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0,
+ UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack"));
UI_but_operator_ptr_get(but);
RNA_string_set(but->opptr, "id_name", id->name + 2);
@@ -755,13 +768,15 @@ static void template_ID(
int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
if (openop) {
- but = uiDefIconTextButO(block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
- 0, 0, w, UI_UNIT_Y, NULL);
+ but = uiDefIconTextButO(
+ block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"),
+ 0, 0, w, UI_UNIT_Y, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
}
else {
- but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, NULL);
+ but = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, NULL);
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN));
}
@@ -782,9 +797,10 @@ static void template_ID(
}
else {
if ((RNA_property_flag(template_ui->prop) & PROP_NEVER_UNLINK) == 0) {
- but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
- TIP_("Unlink data-block "
- "(Shift + Click to set users to zero, data will then not be saved)"));
+ but = uiDefIconBut(
+ block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+ TIP_("Unlink data-block "
+ "(Shift + Click to set users to zero, data will then not be saved)"));
UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_DELETE));
if (RNA_property_flag(template_ui->prop) & PROP_NEVER_NULL) {
@@ -822,8 +838,9 @@ static void template_ID_tabs(
for (ID *id = template->idlb->first; id; id = id->next) {
wmOperatorType *unlink_ot = WM_operatortype_find(unlinkop, false);
const bool is_active = active_ptr.data == id;
- const unsigned int but_width = UI_fontstyle_string_width(&style->widgetlabel, id->name + 2) + UI_UNIT_X +
- (is_active ? ICON_DEFAULT_WIDTH_SCALE : 0);
+ const unsigned int but_width = (
+ UI_fontstyle_string_width(&style->widgetlabel, id->name + 2) + UI_UNIT_X +
+ (is_active ? ICON_DEFAULT_WIDTH_SCALE : 0));
uiButTab *tab;
tab = (uiButTab *)uiDefButR_prop(
@@ -1047,13 +1064,14 @@ static uiBlock *template_search_menu(bContext *C, ARegion *region, void *arg_tem
/* arg_template is malloced, can be freed by parent button */
template_search = *((TemplateSearch *)arg_template);
- active_ptr = RNA_property_pointer_get(&template_search.search_data.target_ptr,
- template_search.search_data.target_prop);
+ active_ptr = RNA_property_pointer_get(
+ &template_search.search_data.target_ptr,
+ template_search.search_data.target_prop);
return template_common_search_menu(
- C, region, ui_rna_collection_search_cb, &template_search,
- template_search_handle_cb, active_ptr.data,
- template_search.preview_rows, template_search.preview_cols);
+ C, region, ui_rna_collection_search_cb, &template_search,
+ template_search_handle_cb, active_ptr.data,
+ template_search.preview_rows, template_search.preview_cols);
}
static void template_search_add_button_searchmenu(
@@ -1232,8 +1250,9 @@ void uiTemplateSearchPreview(
* - propname: property identifier for property that path gets stored to
* - root_ptr: struct that path gets built from
*/
-void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
- const char *text)
+void uiTemplatePathBuilder(
+ uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr),
+ const char *text)
{
PropertyRNA *propPath;
uiLayout *row;
@@ -1338,8 +1357,9 @@ static uiLayout *draw_modifier(
BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name);
uiDefBut(block, UI_BTYPE_LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name"));
- but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
- TIP_("Convert virtual modifier to a real modifier"));
+ but = uiDefBut(
+ block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
+ TIP_("Convert virtual modifier to a real modifier"));
UI_but_func_set(but, modifiers_convertToReal, ob, md);
}
else {
@@ -1356,8 +1376,7 @@ static uiLayout *draw_modifier(
UI_block_emboss_set(block, UI_EMBOSS);
/* modifier name */
- md->scene = scene;
- if (mti->isDisabled && mti->isDisabled(md, 0)) {
+ if (mti->isDisabled && mti->isDisabled(scene, md, 0)) {
uiLayoutSetRedAlert(row, true);
}
uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
@@ -1395,9 +1414,10 @@ static uiLayout *draw_modifier(
if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
/* add disabled pre-tessellated button, so users could have
* message for this modifiers */
- but = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
- UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
- TIP_("This modifier can only be applied on splines' points"));
+ but = uiDefIconButBitI(
+ block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0,
+ UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0,
+ TIP_("This modifier can only be applied on splines' points"));
UI_but_flag_enable(but, UI_BUT_DISABLED);
}
else if (mti->type != eModifierTypeType_Constructive) {
@@ -1455,13 +1475,15 @@ static uiLayout *draw_modifier(
}
else {
uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT);
- uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
- 0, "apply_as", MODIFIER_APPLY_DATA);
+ uiItemEnumO(
+ row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"),
+ 0, "apply_as", MODIFIER_APPLY_DATA);
if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) {
- uiItemEnumO(row, "OBJECT_OT_modifier_apply",
- CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
- 0, "apply_as", MODIFIER_APPLY_SHAPE);
+ uiItemEnumO(
+ row, "OBJECT_OT_modifier_apply",
+ CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"),
+ 0, "apply_as", MODIFIER_APPLY_SHAPE);
}
}
@@ -1840,7 +1862,7 @@ static void do_preview_buttons(bContext *C, void *arg, int event)
}
void uiTemplatePreview(
- uiLayout *layout, bContext *C, ID *id, int show_buttons, ID *parent, MTex *slot,
+ uiLayout *layout, bContext *C, ID *id, bool show_buttons, ID *parent, MTex *slot,
const char *preview_id)
{
uiLayout *row, *col;
@@ -1919,8 +1941,9 @@ void uiTemplatePreview(
UI_but_func_drawextra_set(block, ED_preview_draw, pparent, slot);
UI_block_func_handle_set(block, do_preview_buttons, NULL);
- uiDefIconButS(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height,
- UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, "");
+ uiDefIconButS(
+ block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height,
+ UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, "");
/* add buttons */
if (pid && show_buttons) {
@@ -2068,17 +2091,20 @@ static void colorband_buttons_layout(
UI_block_align_begin(block);
row = uiLayoutRow(split, false);
- bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL,
- 0, 0, 0, 0, TIP_("Add a new color stop to the colorband"));
+ bt = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL,
+ 0, 0, 0, 0, TIP_("Add a new color stop to the colorband"));
UI_but_funcN_set(bt, colorband_add_cb, MEM_dupallocN(cb), coba);
- bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, TIP_("Delete the active position"));
+ bt = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Delete the active position"));
UI_but_funcN_set(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
- bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
- NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
+ bt = uiDefIconTextBut(
+ block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y,
+ NULL, 0, 0, 0, 0, TIP_("Flip the color ramp"));
UI_but_funcN_set(bt, colorband_flip_cb, MEM_dupallocN(cb), coba);
bt = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_colorband", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, xs + 6.0f * unit, ys + UI_UNIT_Y, UI_UNIT_X, UI_UNIT_Y, NULL);
@@ -2150,7 +2176,7 @@ static void colorband_buttons_layout(
}
}
-void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, int expand)
+void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, bool expand)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -2263,7 +2289,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem)
/**
* \param icon_scale: Scale of the icon, 1x == button height.
*/
-void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, int show_labels, float icon_scale)
+void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
IconViewMenuArgs *cb_args;
@@ -2499,8 +2525,9 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v)
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, UI_BTYPE_LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
- bt = uiDefButBitI(block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
- 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
+ bt = uiDefButBitI(
+ block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"),
+ 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
UI_but_func_set(bt, curvemap_buttons_setclip, cumap, NULL);
UI_block_align_begin(block);
@@ -2663,8 +2690,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */
static void curvemap_buttons_layout(
- uiLayout *layout, PointerRNA *ptr, char labeltype, int levels,
- int brush, int neg_slope, RNAUpdateCb *cb)
+ uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels,
+ bool brush, bool neg_slope, RNAUpdateCb *cb)
{
CurveMapping *cumap = ptr->data;
CurveMap *cm = &cumap->cm[cumap->cur];
@@ -2759,11 +2786,13 @@ static void curvemap_buttons_layout(
if (brush)
bt = uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
else if (neg_slope)
- bt = uiDefIconBlockBut(block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER,
- 0, 0, dx, dx, TIP_("Tools"));
+ bt = uiDefIconBlockBut(
+ block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER,
+ 0, 0, dx, dx, TIP_("Tools"));
else
- bt = uiDefIconBlockBut(block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER,
- 0, 0, dx, dx, TIP_("Tools"));
+ bt = uiDefIconBlockBut(
+ block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER,
+ 0, 0, dx, dx, TIP_("Tools"));
UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
@@ -2827,7 +2856,7 @@ static void curvemap_buttons_layout(
void uiTemplateCurveMapping(
uiLayout *layout, PointerRNA *ptr, const char *propname, int type,
- int levels, int brush, int neg_slope)
+ bool levels, bool brush, bool neg_slope)
{
RNAUpdateCb *cb;
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -2871,8 +2900,8 @@ void uiTemplateCurveMapping(
/* This template now follows User Preference for type - name is not correct anymore... */
void uiTemplateColorPicker(
- uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider,
- int lock, int lock_luminosity, int cubic)
+ uiLayout *layout, PointerRNA *ptr, const char *propname, bool value_slider,
+ bool lock, bool lock_luminosity, bool cubic)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
uiBlock *block = uiLayoutGetBlock(layout);
@@ -2893,24 +2922,28 @@ void uiTemplateColorPicker(
switch (U.color_picker_type) {
case USER_CP_SQUARE_SV:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_SV, 0, "");
break;
case USER_CP_SQUARE_HS:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_HS, 0, "");
break;
case USER_CP_SQUARE_HV:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, UI_GRAD_HV, 0, "");
break;
/* user default */
case USER_CP_CIRCLE_HSV:
case USER_CP_CIRCLE_HSL:
default:
- but = uiDefButR_prop(block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
- -1, 0.0, 0.0, 0, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop,
+ -1, 0.0, 0.0, 0, 0, "");
break;
}
@@ -2936,31 +2969,36 @@ void uiTemplateColorPicker(
switch (U.color_picker_type) {
case USER_CP_CIRCLE_HSL:
uiItemS(row);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
- -1, softmin, softmax, UI_GRAD_L_ALT, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_L_ALT, 0, "");
break;
case USER_CP_SQUARE_SV:
uiItemS(col);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
- -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_SV + 3, 0, "");
break;
case USER_CP_SQUARE_HS:
uiItemS(col);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
- -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_HS + 3, 0, "");
break;
case USER_CP_SQUARE_HV:
uiItemS(col);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
- -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_HV + 3, 0, "");
break;
/* user default */
case USER_CP_CIRCLE_HSV:
default:
uiItemS(row);
- but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
- -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
+ but = uiDefButR_prop(
+ block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop,
+ -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
break;
}
@@ -2968,7 +3006,7 @@ void uiTemplateColorPicker(
}
}
-void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, int UNUSED(colors))
+void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, bool UNUSED(colors))
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
@@ -3011,8 +3049,9 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname,
}
RNA_pointer_create(&palette->id, &RNA_PaletteColor, color, &color_ptr);
- uiDefButR(block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0,
- UI_PALETTE_COLOR, col_id, "");
+ uiDefButR(
+ block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0,
+ UI_PALETTE_COLOR, col_id, "");
row_cols++;
col_id++;
}
@@ -3173,8 +3212,9 @@ static int cmpstringp(const void *p1, const void *p2)
return BLI_strcasecmp(((StringCmp *) p1)->name, ((StringCmp *) p2)->name);
}
-static void uilist_filter_items_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr,
- const char *propname)
+static void uilist_filter_items_default(
+ struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr,
+ const char *propname)
{
uiListDyn *dyn_data = ui_list->dyn_data;
PropertyRNA *prop = RNA_struct_find_property(dataptr, propname);
@@ -3616,9 +3656,10 @@ void uiTemplateList(
/* list item behind label & other buttons */
sub = uiLayoutRow(overlap, false);
- but = uiDefButR_prop(subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
- active_dataptr, activeprop, 0, 0, org_i, 0, 0,
- TIP_("Double click to rename"));
+ but = uiDefButR_prop(
+ subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y,
+ active_dataptr, activeprop, 0, 0, org_i, 0, 0,
+ TIP_("Double click to rename"));
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr, item_dyntip_propname))) {
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data);
}
@@ -3674,8 +3715,9 @@ void uiTemplateList(
/* next/prev button */
BLI_snprintf(numstr, sizeof(numstr), "%d :", dyn_data->items_shown);
- but = uiDefIconTextButR_prop(block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
- active_dataptr, activeprop, 0, 0, 0, 0, 0, "");
+ but = uiDefIconTextButR_prop(
+ block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
+ active_dataptr, activeprop, 0, 0, 0, 0, 0, "");
if (dyn_data->items_shown == 0)
UI_but_flag_enable(but, UI_BUT_DISABLED);
break;
@@ -3945,7 +3987,7 @@ eAutoPropButsReturn uiTemplateOperatorPropertyButs(
block->ui_operator = op;
row = uiLayoutRow(layout, true);
- uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE);
+ uiItemM(row, "WM_MT_operator_presets", NULL, ICON_NONE);
wmOperatorType *ot = WM_operatortype_find("WM_OT_operator_preset_add", false);
uiItemFullO_ptr(row, ot, "", ICON_ZOOMIN, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr);
@@ -4223,9 +4265,6 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop this job"));
}
- if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
- uiDefIconTextBut(block, UI_BTYPE_BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, UI_UNIT_X * 4.25f, UI_UNIT_Y,
- NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop screencast"));
if (screen->animtimer)
uiDefIconTextBut(block, UI_BTYPE_BUT, B_STOPANIM, ICON_CANCEL, IFACE_("Anim Player"), 0, 0, UI_UNIT_X * 5.0f, UI_UNIT_Y,
NULL, 0.0f, 0.0f, 0, 0, TIP_("Stop animation playback"));
@@ -4263,18 +4302,18 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
/* make a box around the report to make it stand out */
UI_block_align_begin(block);
- but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 5, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
/* set the report's bg color in but->col - UI_BTYPE_ROUNDBOX feature */
rgb_float_to_uchar(but->col, rti->col);
but->col[3] = 255;
- but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y,
+ but = uiDefBut(block, UI_BTYPE_ROUNDBOX, 0, "", UI_UNIT_X + 5, 0, UI_UNIT_X + width, UI_UNIT_Y,
NULL, 0.0f, 0.0f, 0, 0, "");
- but->col[0] = but->col[1] = but->col[2] = unit_float_to_uchar_clamp(rti->grayscale);
- but->col[3] = 255;
UI_block_align_end(block);
+ UI_GetThemeColorShade3ubv(TH_BACK, 20, but->col);
+ but->col[3] = 255;
/* icon and report message on top */
icon = UI_icon_from_report_type(report->type);
@@ -4292,10 +4331,44 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
UI_block_emboss_set(block, UI_EMBOSS);
- uiDefBut(block, UI_BTYPE_LABEL, 0, report->message, UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y,
+ uiDefBut(block, UI_BTYPE_LABEL, 0, report->message, UI_UNIT_X + 5, 0, UI_UNIT_X + width, UI_UNIT_Y,
NULL, 0.0f, 0.0f, 0, 0, "");
}
+
+void uiTemplateInputStatus(uiLayout *layout, struct bContext *C)
+{
+ wmWindow *win = CTX_wm_window(C);
+ WorkSpace *workspace = CTX_wm_workspace(C);
+
+ /* Workspace status text has priority. */
+ if (workspace->status_text) {
+ uiItemL(layout, workspace->status_text, ICON_NONE);
+ return;
+ }
+
+ /* Otherwise should cursor keymap status. */
+ for (int i = 0; i < 3; i++) {
+ uiLayout *box = uiLayoutRow(layout, false);
+ uiLayout *col = uiLayoutColumn(box, false);
+ uiLayout *row = uiLayoutRow(col, true);
+ uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
+
+ const char *msg = WM_window_cursor_keymap_status_get(win, i, 0);
+ const char *msg_drag = WM_window_cursor_keymap_status_get(win, i, 1);
+
+ uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
+
+ if (msg_drag) {
+ uiItemL(row, msg_drag, (ICON_MOUSE_LMB_DRAG + i));
+ }
+
+ /* Use trick with empty string to keep icons in same position. */
+ row = uiLayoutRow(col, false);
+ uiItemL(row, " ", ICON_NONE);
+ }
+}
+
/********************************* Keymap *************************************/
static void keymap_item_modified(bContext *UNUSED(C), void *kmi_p, void *UNUSED(unused))
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index e049416ce07..d080397c488 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -409,8 +409,9 @@ int UI_calc_float_precision(int prec, double value)
bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
{
if (but->rnapoin.id.data && but->rnapoin.data && but->rnaprop) {
- BLI_snprintf(r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type),
- RNA_property_identifier(but->rnaprop));
+ BLI_snprintf(
+ r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type),
+ RNA_property_identifier(but->rnaprop));
return true;
}
else if (but->optype) {
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 3b7ccb68fd4..dbd65ade307 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -58,6 +58,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#ifdef WITH_INPUT_IME
# include "WM_types.h"
@@ -509,7 +510,7 @@ void UI_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
/* Note: This won't give back the original color. */
draw_color[3] *= 1.0f / WIDGET_AA_JITTER;
- glEnable(GL_BLEND);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -528,7 +529,7 @@ void UI_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float color[4])
@@ -538,7 +539,7 @@ void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float col
copy_v4_v4(draw_color, color);
draw_color[3] *= 2.0f / WIDGET_AA_JITTER;
- glEnable(GL_BLEND);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -562,7 +563,7 @@ void UI_draw_anti_fan(float tri_array[][2], unsigned int length, const float col
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void widget_init(uiWidgetBase *wtb)
@@ -673,13 +674,16 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re
float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
int a, tot = 0, minsize;
- const int hnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
- (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
- 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;
+ const int hnum = (
+ (roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
+ (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
+ 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 = min_ii(BLI_rcti_size_x(rect) * hnum,
- BLI_rcti_size_y(rect) * vnum);
+ minsize = min_ii(
+ BLI_rcti_size_x(rect) * hnum,
+ BLI_rcti_size_y(rect) * vnum);
if (2.0f * rad > minsize)
rad = 0.5f * minsize;
@@ -1109,11 +1113,11 @@ void UI_widgetbase_draw_cache_end(void)
BLI_assert(g_widget_base_batch.enabled == true);
g_widget_base_batch.enabled = false;
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_widgetbase_draw_cache_flush();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void draw_widgetbase_batch(Gwn_Batch *batch, uiWidgetBase *wtb)
@@ -1169,7 +1173,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol)
/* For color widget. */
bool alpha_check = (wcol->alpha_check && (wcol->shaded == 0));
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* backdrop non AA */
if (wtb->draw_inner) {
@@ -1213,7 +1217,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, const uiWidgetColors *wcol)
draw_widgetbase_batch(roundbox_batch, wtb);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* *********************** text/icon ************************************** */
@@ -1258,9 +1262,9 @@ static void widget_draw_icon_ex(
float aspect, height;
if (but->flag & UI_BUT_ICON_PREVIEW) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
widget_draw_preview(icon, alpha, rect);
- glDisable(GL_BLEND);
+ GPU_blend(false);
return;
}
@@ -1288,7 +1292,7 @@ static void widget_draw_icon_ex(
}
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
if (icon && icon != ICON_BLANK1) {
float ofs = 1.0f / aspect;
@@ -1334,7 +1338,7 @@ static void widget_draw_icon_ex(
UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, aspect, alpha);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void widget_draw_icon(
@@ -1420,8 +1424,8 @@ float UI_text_clip_middle_ex(
strwidth = BLF_width(fstyle->uifont_id, str, max_len);
if ((okwidth > 0.0f) && (strwidth > okwidth)) {
- /* utf8 ellipsis '...', some compilers complain */
- const char sep[] = {0xe2, 0x80, 0xa6, 0x0};
+ /* utf8 ellipsis '..', some compilers complain */
+ const char sep[] = {0xe2, 0x80, 0xA5, 0x0};
const int sep_len = sizeof(sep) - 1;
const float sep_strwidth = BLF_width(fstyle->uifont_id, sep, sep_len + 1);
float parts_strwidth;
@@ -1500,6 +1504,8 @@ float UI_text_clip_middle_ex(
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
}
+ BLI_assert(strwidth <= okwidth);
+
return strwidth;
}
@@ -1659,8 +1665,9 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti
/* once the label's gone, chop off the least significant digits */
if (but->strwidth > okwidth) {
float strwidth;
- drawstr_len = BLF_width_to_strlen(fstyle->uifont_id, but->drawstr + but->ofs,
- drawstr_len - but->ofs, okwidth, &strwidth) + but->ofs;
+ drawstr_len = BLF_width_to_strlen(
+ fstyle->uifont_id, but->drawstr + but->ofs,
+ drawstr_len - but->ofs, okwidth, &strwidth) + but->ofs;
but->strwidth = strwidth;
but->drawstr[drawstr_len] = 0;
}
@@ -1687,8 +1694,9 @@ static void widget_draw_text_ime_underline(
ofs_x = 0;
}
- width = BLF_width(fstyle->uifont_id, drawstr + but->ofs,
- ime_data->composite_len + but->pos - but->ofs);
+ width = BLF_width(
+ fstyle->uifont_id, drawstr + but->ofs,
+ ime_data->composite_len + but->pos - but->ofs);
rgba_uchar_to_float(fcol, wcol->text);
UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 1, fcol);
@@ -1705,8 +1713,9 @@ static void widget_draw_text_ime_underline(
ofs_x = 0;
}
- width = BLF_width(fstyle->uifont_id, drawstr + but->ofs,
- sel_end + sel_start - but->ofs);
+ width = BLF_width(
+ fstyle->uifont_id, drawstr + but->ofs,
+ sel_end + sel_start - but->ofs);
UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 2, fcol);
}
@@ -1759,9 +1768,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
if (ime_data && ime_data->composite_len) {
/* insert composite string into cursor pos */
- BLI_snprintf((char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s",
- but->editstr, ime_data->str_composite,
- but->editstr + but->pos);
+ BLI_snprintf(
+ (char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s",
+ but->editstr, ime_data->str_composite,
+ but->editstr + but->pos);
}
else
#endif
@@ -1783,9 +1793,9 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
if (drawstr[0] != 0) {
/* We are drawing on top of widget bases. Flush cache. */
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_widgetbase_draw_cache_flush();
- glDisable(GL_BLEND);
+ GPU_blend(false);
if (but->selsta >= but->ofs) {
selsta_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selsta - but->ofs);
@@ -1828,9 +1838,9 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
t = 0;
}
/* We are drawing on top of widget bases. Flush cache. */
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_widgetbase_draw_cache_flush();
- glDisable(GL_BLEND);
+ GPU_blend(false);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1993,9 +2003,9 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
/* draw icon in rect above the space reserved for the label */
rect->ymin += text_size;
- glEnable(GL_BLEND);
+ GPU_blend(true);
widget_draw_preview(icon, alpha, rect);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* offset rect to draw label in */
rect->ymin -= text_size;
@@ -2114,370 +2124,6 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
/* *********************** widget types ************************************* */
-static struct uiWidgetStateColors wcol_state_colors = {
- {115, 190, 76, 255},
- {90, 166, 51, 255},
- {240, 235, 100, 255},
- {215, 211, 75, 255},
- {180, 0, 255, 255},
- {153, 0, 230, 255},
- {74, 137, 137, 255},
- {49, 112, 112, 255},
- 0.5f, 0.0f
-};
-
-static struct uiWidgetColors wcol_num = {
- {25, 25, 25, 255},
- {180, 180, 180, 255},
- {153, 153, 153, 255},
- {90, 90, 90, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 1,
- -20, 0,
- 0,
- 0.5f,
-};
-
-static struct uiWidgetColors wcol_numslider = {
- {25, 25, 25, 255},
- {180, 180, 180, 255},
- {153, 153, 153, 255},
- {128, 128, 128, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 1,
- -20, 0,
- 0,
- 0.5f,
-};
-
-static struct uiWidgetColors wcol_text = {
- {25, 25, 25, 255},
- {153, 153, 153, 255},
- {153, 153, 153, 255},
- {90, 90, 90, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 1,
- 0, 25,
- 0,
- 0.2f,
-};
-
-static struct uiWidgetColors wcol_option = {
- {0, 0, 0, 255},
- {70, 70, 70, 255},
- {70, 70, 70, 255},
- {255, 255, 255, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 1,
- 15, -15,
- 0,
- 0.3333333f,
-};
-
-/* button that shows popup */
-static struct uiWidgetColors wcol_menu = {
- {0, 0, 0, 255},
- {70, 70, 70, 255},
- {70, 70, 70, 255},
- {255, 255, 255, 255},
-
- {255, 255, 255, 255},
- {204, 204, 204, 255},
-
- 1,
- 15, -15,
- 0,
- 0.2f,
-};
-
-/* button that starts pulldown */
-static struct uiWidgetColors wcol_pulldown = {
- {0, 0, 0, 255},
- {63, 63, 63, 255},
- {86, 128, 194, 255},
- {255, 255, 255, 255},
-
- {0, 0, 0, 255},
- {0, 0, 0, 255},
-
- 0,
- 25, -20,
- 0,
- 0.2f,
-};
-
-/* button inside menu */
-static struct uiWidgetColors wcol_menu_item = {
- {0, 0, 0, 255},
- {0, 0, 0, 0},
- {86, 128, 194, 255},
- {172, 172, 172, 128},
-
- {255, 255, 255, 255},
- {0, 0, 0, 255},
-
- 1,
- 38, 0,
- 0,
- 0.2f,
-};
-
-/* backdrop menu + title text color */
-static struct uiWidgetColors wcol_menu_back = {
- {0, 0, 0, 255},
- {25, 25, 25, 230},
- {45, 45, 45, 230},
- {100, 100, 100, 255},
-
- {160, 160, 160, 255},
- {255, 255, 255, 255},
-
- 0,
- 25, -20,
- 0,
- 0.25f,
-};
-
-/* pie menus */
-static struct uiWidgetColors wcol_pie_menu = {
- {10, 10, 10, 200},
- {25, 25, 25, 230},
- {140, 140, 140, 255},
- {45, 45, 45, 230},
-
- {160, 160, 160, 255},
- {255, 255, 255, 255},
-
- 1,
- 10, -10,
- 0,
- 0.5f,
-};
-
-
-/* tooltip color */
-static struct uiWidgetColors wcol_tooltip = {
- {0, 0, 0, 255},
- {25, 25, 25, 230},
- {45, 45, 45, 230},
- {100, 100, 100, 255},
-
- {255, 255, 255, 255},
- {255, 255, 255, 255},
-
- 0,
- 25, -20,
- 0,
- 0.25f,
-};
-
-static struct uiWidgetColors wcol_radio = {
- {0, 0, 0, 255},
- {70, 70, 70, 255},
- {86, 128, 194, 255},
- {255, 255, 255, 255},
-
- {255, 255, 255, 255},
- {0, 0, 0, 255},
-
- 1,
- 15, -15,
- 0,
- 0.2f,
-};
-
-static struct uiWidgetColors wcol_regular = {
- {25, 25, 25, 255},
- {153, 153, 153, 255},
- {100, 100, 100, 255},
- {25, 25, 25, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 0,
- 0, 0,
- 0,
- 0.25f,
-};
-
-static struct uiWidgetColors wcol_tool = {
- {25, 25, 25, 255},
- {153, 153, 153, 255},
- {100, 100, 100, 255},
- {25, 25, 25, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 1,
- 15, -15,
- 0,
- 0.2f,
-};
-
-static struct uiWidgetColors wcol_toolbar_item = {
- .outline = {0x19, 0x19, 0x19, 0xff},
- .inner = {0x46, 0x46, 0x46, 0xff},
- .inner_sel = {0xcc, 0xcc, 0xcc, 0xff},
- .item = {0x0, 0x0, 0x0, 0xff},
-
- .text = {0xff, 0xff, 0xff, 0xff},
- .text_sel = {0x33, 0x33, 0x33, 0xff},
-
- .shaded = 0,
- .shadetop = 0,
- .shadedown = 0,
- .alpha_check = 0,
- .roundness = 0.3f,
-};
-
-static struct uiWidgetColors wcol_box = {
- {25, 25, 25, 255},
- {128, 128, 128, 255},
- {100, 100, 100, 255},
- {25, 25, 25, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 0,
- 0, 0,
- 0,
- 0.2f,
-};
-
-static struct uiWidgetColors wcol_toggle = {
- {25, 25, 25, 255},
- {153, 153, 153, 255},
- {100, 100, 100, 255},
- {25, 25, 25, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 0,
- 0, 0,
- 0,
- 0.25f,
-};
-
-static struct uiWidgetColors wcol_scroll = {
- {50, 50, 50, 180},
- {80, 80, 80, 180},
- {100, 100, 100, 180},
- {128, 128, 128, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 1,
- 5, -5,
- 0,
- 0.5f,
-};
-
-static struct uiWidgetColors wcol_progress = {
- {0, 0, 0, 255},
- {190, 190, 190, 255},
- {100, 100, 100, 180},
- {128, 128, 128, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 0,
- 0, 0,
- 0,
- 0.25f,
-};
-
-static struct uiWidgetColors wcol_list_item = {
- {0, 0, 0, 255},
- {0, 0, 0, 0},
- {86, 128, 194, 255},
- {90, 90, 90, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 0,
- 0, 0,
- 0,
- 0.2f,
-};
-
-struct uiWidgetColors wcol_tab = {
- {60, 60, 60, 255},
- {83, 83, 83, 255},
- {114, 114, 114, 255},
- {90, 90, 90, 255},
-
- {0, 0, 0, 255},
- {0, 0, 0, 255},
-
- 0,
- 0, 0,
- 0,
- 0.25f,
-};
-
-/* free wcol struct to play with */
-static struct uiWidgetColors wcol_tmp = {
- {0, 0, 0, 255},
- {128, 128, 128, 255},
- {100, 100, 100, 255},
- {25, 25, 25, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 0,
- 0, 0,
- 0,
- 0.25f,
-};
-
-
-/* called for theme init (new theme) and versions */
-void ui_widget_color_init(ThemeUI *tui)
-{
- tui->wcol_regular = wcol_regular;
- tui->wcol_tool = wcol_tool;
- tui->wcol_toolbar_item = wcol_toolbar_item;
- tui->wcol_text = wcol_text;
- tui->wcol_radio = wcol_radio;
- tui->wcol_tab = wcol_tab;
- tui->wcol_option = wcol_option;
- tui->wcol_toggle = wcol_toggle;
- tui->wcol_num = wcol_num;
- tui->wcol_numslider = wcol_numslider;
- tui->wcol_menu = wcol_menu;
- tui->wcol_pulldown = wcol_pulldown;
- tui->wcol_menu_back = wcol_menu_back;
- tui->wcol_pie_menu = wcol_pie_menu;
- tui->wcol_tooltip = wcol_tooltip;
- tui->wcol_menu_item = wcol_menu_item;
- tui->wcol_box = wcol_box;
- tui->wcol_scroll = wcol_scroll;
- tui->wcol_list_item = wcol_list_item;
- tui->wcol_progress = wcol_progress;
-
- tui->wcol_state = wcol_state_colors;
-}
-
/* ************ button callbacks, state ***************** */
static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
@@ -2775,14 +2421,14 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
rect->ymax += 0.1f * U.widget_unit;
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
widget_softshadow(rect, roundboxalign, wcol->roundness * U.widget_unit);
round_box_edges(&wtb, roundboxalign, rect, wcol->roundness * U.widget_unit);
wtb.draw_emboss = false;
widgetbase_draw(&wtb, wcol);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void ui_hsv_cursor(float x, float y)
@@ -2794,18 +2440,19 @@ static void ui_hsv_cursor(float x, float y)
immUniformColor3f(1.0f, 1.0f, 1.0f);
imm_draw_circle_fill_2d(pos, x, y, 3.0f * U.pixelsize, 8);
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
+ GPU_blend(true);
+ GPU_line_smooth(true);
immUniformColor3f(0.0f, 0.0f, 0.0f);
imm_draw_circle_wire_2d(pos, x, y, 3.0f * U.pixelsize, 12);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
immUnbindProgram();
}
-void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect,
- const float mx, const float my)
+void ui_hsvcircle_vals_from_pos(
+ float *val_rad, float *val_dist, const rcti *rect,
+ const float mx, const float my)
{
/* duplication of code... well, simple is better now */
const float centx = BLI_rcti_cent_x_fl(rect);
@@ -2913,16 +2560,16 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
+ GPU_blend(true);
+ GPU_line_smooth(true);
immUniformColor3ubv((unsigned char *)wcol->outline);
imm_draw_circle_wire_2d(pos, centx, centy, radius, tot);
immUnbindProgram();
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
/* cursor */
float xpos, ypos;
@@ -3201,18 +2848,21 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect)
round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
/* setup temp colors */
- wcol_tmp.outline[0] = wcol_tmp.outline[1] = wcol_tmp.outline[2] = 0;
- wcol_tmp.inner[0] = wcol_tmp.inner[1] = wcol_tmp.inner[2] = 128;
- wcol_tmp.shadetop = 127;
- wcol_tmp.shadedown = -128;
- wcol_tmp.shaded = 1;
-
- widgetbase_draw(&wtb, &wcol_tmp);
+ widgetbase_draw(
+ &wtb,
+ &((uiWidgetColors){
+ .outline = {0, 0, 0, 255},
+ .inner = {128, 128, 128, 255},
+ .shadetop = 127,
+ .shadedown = -128,
+ .shaded = 1,
+ })
+ );
/* We are drawing on top of widget bases. Flush cache. */
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_widgetbase_draw_cache_flush();
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* cursor */
x = rect->xmin + 0.5f * BLI_rcti_size_x(rect);
@@ -3231,9 +2881,9 @@ static void ui_draw_roundbox(const rcti *rect, const float rad, const uiWidgetCo
widgetbase_draw(&wtb, wcol);
/* We are drawing on top of widget bases. Flush cache. */
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_widgetbase_draw_cache_flush();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
@@ -3251,16 +2901,16 @@ static void ui_draw_separator(const rcti *rect, uiWidgetColors *wcol)
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor4ubv(col);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, rect->xmin, y);
immVertex2f(pos, rect->xmax, y);
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUnbindProgram();
}
@@ -3706,9 +3356,9 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
bw += (bw < 0.5f) ? 0.5f : -0.5f;
/* We are drawing on top of widget bases. Flush cache. */
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_widgetbase_draw_cache_flush();
- glDisable(GL_BLEND);
+ GPU_blend(false);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -4079,9 +3729,9 @@ static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundbox
widgetbase_draw(&wtb, wcol);
/* We are drawing on top of widget bases. Flush cache. */
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_widgetbase_draw_cache_flush();
- glDisable(GL_BLEND);
+ GPU_blend(false);
#ifdef USE_TAB_SHADED_HIGHLIGHT
/* draw outline (3d look) */
@@ -4660,7 +4310,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
wt->draw(&wt->wcol, rect, state, roundboxalign);
if (disabled)
- glEnable(GL_BLEND);
+ GPU_blend(true);
#ifdef USE_UI_POPOVER_ONCE
if (but->block->flag & UI_BLOCK_POPOVER_ONCE) {
@@ -4682,7 +4332,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
wt->text(fstyle, &wt->wcol, but, rect);
if (disabled)
- glDisable(GL_BLEND);
+ GPU_blend(false);
// if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE))
// if (but->dt != UI_EMBOSS_PULLDOWN)
@@ -4739,7 +4389,7 @@ static void ui_draw_popover_back_impl(
rect->ymax -= unit_half;
rect->ymin += unit_half;
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* Extracted from 'widget_menu_back', keep separate to avoid menu changes breaking popovers */
{
@@ -4759,7 +4409,7 @@ static void ui_draw_popover_back_impl(
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ubv((unsigned char *)wcol->inner);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immBegin(GWN_PRIM_TRIS, 3);
if (direction == UI_DIR_DOWN) {
const float y = rect->ymax;
@@ -4777,7 +4427,7 @@ static void ui_draw_popover_back_impl(
immUnbindProgram();
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
void ui_draw_popover_back(ARegion *ar, uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
@@ -4871,7 +4521,7 @@ void ui_draw_pie_center(uiBlock *block)
gpuPushMatrix();
gpuTranslate2f(cx, cy);
- glEnable(GL_BLEND);
+ GPU_blend(true);
if (btheme->tui.wcol_pie_menu.shaded) {
char col1[4], col2[4];
shadecolors4(col1, col2, btheme->tui.wcol_pie_menu.inner, btheme->tui.wcol_pie_menu.shadetop, btheme->tui.wcol_pie_menu.shadedown);
@@ -4914,7 +4564,7 @@ void ui_draw_pie_center(uiBlock *block)
draw_disk_shaded(angle - range / 2.0f, range, pie_confirm_radius, pie_confirm_external, subd, col, NULL, false);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
}
@@ -4935,9 +4585,9 @@ void ui_draw_widget_back_color(
uiWidgetType *wt = widget_type(type);
if (use_shadow) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
widget_softshadow(rect, UI_CNR_ALL, 0.25f * U.widget_unit);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
rcti rect_copy = *rect;
@@ -5034,9 +4684,9 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
height = ICON_SIZE_FROM_BUTRECT(rect);
aspect = ICON_DEFAULT_HEIGHT / height;
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw_aspect(xs, ys, iconid, aspect, 1.0f); /* XXX scale weak get from fstyle? */
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -5053,9 +4703,9 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
/* draw icon in rect above the space reserved for the label */
rect->ymin += text_size;
- glEnable(GL_BLEND);
+ GPU_blend(true);
widget_draw_preview(iconid, 1.0f, rect);
- glDisable(GL_BLEND);
+ GPU_blend(false);
BLF_width_and_height(fstyle->uifont_id, name, BLF_DRAW_STR_DUMMY_MAX, &font_dims[0], &font_dims[1]);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 8bd41b874f5..fb4d6e0ea14 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -48,9 +48,9 @@
#include "BKE_addon.h"
#include "BKE_appdir.h"
#include "BKE_colorband.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_main.h"
+#include "BKE_mesh_runtime.h"
#include "BIF_gl.h"
@@ -62,6 +62,10 @@
#include "UI_interface_icons.h"
#include "interface_intern.h"
+#include "GPU_framebuffer.h"
+
+
+extern const bTheme U_theme_default;
/* global for themes */
typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
@@ -734,146 +738,6 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
return (const unsigned char *)cp;
}
-/* use this call to init new bone color sets in Theme */
-static void ui_theme_init_boneColorSets(bTheme *btheme)
-{
- int i;
-
- /* define default color sets - currently we only define 15 of these, though that should be ample */
- /* set 1 */
- rgba_char_args_set(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
- rgba_char_args_set(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
- /* set 2 */
- rgba_char_args_set(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
- rgba_char_args_set(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
- rgba_char_args_set(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
- /* set 3 */
- rgba_char_args_set(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
- rgba_char_args_set(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
- rgba_char_args_set(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
- /* set 4 */
- rgba_char_args_set(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
- rgba_char_args_set(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
- rgba_char_args_set(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
- /* set 5 */
- rgba_char_args_set(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
- rgba_char_args_set(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
- rgba_char_args_set(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
- /* set 6 */
- rgba_char_args_set(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
- rgba_char_args_set(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
- rgba_char_args_set(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
- /* set 7 */
- rgba_char_args_set(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
- rgba_char_args_set(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
- rgba_char_args_set(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
- /* set 8 */
- rgba_char_args_set(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
- rgba_char_args_set(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
- rgba_char_args_set(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
- /* set 9 */
- rgba_char_args_set(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
- rgba_char_args_set(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
- rgba_char_args_set(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
- /* set 10 */
- rgba_char_args_set(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
- rgba_char_args_set(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
- rgba_char_args_set(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
- /* set 11 */
- rgba_char_args_set(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
- rgba_char_args_set(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
- rgba_char_args_set(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
- /* set 12 */
- rgba_char_args_set(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
- rgba_char_args_set(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
- rgba_char_args_set(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
- /* set 13 */
- rgba_char_args_set(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
- rgba_char_args_set(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
- rgba_char_args_set(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
- /* set 14 */
- rgba_char_args_set(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
- rgba_char_args_set(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
- rgba_char_args_set(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
- /* set 15 */
- rgba_char_args_set(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
- rgba_char_args_set(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
- rgba_char_args_set(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
-
- /* reset flags too */
- for (i = 0; i < 20; i++)
- btheme->tarm[i].flag = 0;
-}
-
-/* use this call to init new variables in themespace, if they're same for all */
-static void ui_theme_init_new_do(ThemeSpace *ts)
-{
- rgba_char_args_set(ts->header_text, 0, 0, 0, 255);
- rgba_char_args_set(ts->header_title, 0, 0, 0, 255);
- rgba_char_args_set(ts->header_text_hi, 255, 255, 255, 255);
-
-#if 0
- rgba_char_args_set(ts->panel_text, 0, 0, 0, 255);
- rgba_char_args_set(ts->panel_title, 0, 0, 0, 255);
- rgba_char_args_set(ts->panel_text_hi, 255, 255, 255, 255);
-#endif
-
- ts->panelcolors.show_back = false;
- ts->panelcolors.show_header = false;
- rgba_char_args_set(ts->panelcolors.back, 114, 114, 114, 128);
- rgba_char_args_set(ts->panelcolors.header, 0, 0, 0, 25);
- rgba_char_args_set(ts->panelcolors.sub_back, 0, 0, 0, 25);
-
- rgba_char_args_set(ts->button, 145, 145, 145, 245);
- rgba_char_args_set(ts->button_title, 0, 0, 0, 255);
- rgba_char_args_set(ts->button_text, 0, 0, 0, 255);
- rgba_char_args_set(ts->button_text_hi, 255, 255, 255, 255);
-
- rgba_char_args_set(ts->list, 165, 165, 165, 255);
- rgba_char_args_set(ts->list_title, 0, 0, 0, 255);
- rgba_char_args_set(ts->list_text, 0, 0, 0, 255);
- rgba_char_args_set(ts->list_text_hi, 255, 255, 255, 255);
-
- rgba_char_args_set(ts->tab_active, 114, 114, 114, 255);
- rgba_char_args_set(ts->tab_inactive, 83, 83, 83, 255);
- rgba_char_args_set(ts->tab_back, 64, 64, 64, 255);
- rgba_char_args_set(ts->tab_outline, 60, 60, 60, 255);
-}
-
-static void ui_theme_init_new(bTheme *btheme)
-{
- ThemeSpace *ts;
-
- for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
- ui_theme_init_new_do(ts);
- }
-}
-
-static void ui_theme_space_init_handles_color(ThemeSpace *theme_space)
-{
- rgba_char_args_set(theme_space->handle_free, 0, 0, 0, 255);
- rgba_char_args_set(theme_space->handle_auto, 0x90, 0x90, 0x00, 255);
- rgba_char_args_set(theme_space->handle_vect, 0x40, 0x90, 0x30, 255);
- rgba_char_args_set(theme_space->handle_align, 0x80, 0x30, 0x60, 255);
- rgba_char_args_set(theme_space->handle_sel_free, 0, 0, 0, 255);
- rgba_char_args_set(theme_space->handle_sel_auto, 0xf0, 0xff, 0x40, 255);
- rgba_char_args_set(theme_space->handle_sel_vect, 0x40, 0xc0, 0x30, 255);
- rgba_char_args_set(theme_space->handle_sel_align, 0xf0, 0x90, 0xa0, 255);
- rgba_char_args_set(theme_space->handle_vertex, 0x00, 0x00, 0x00, 0xff);
- rgba_char_args_set(theme_space->handle_vertex_select, 0xff, 0xff, 0, 0xff);
- rgba_char_args_set(theme_space->act_spline, 0xdb, 0x25, 0x12, 255);
-}
-
-static void ui_theme_space_init_manipulator_colors(bTheme *btheme)
-{
- rgba_char_args_set(btheme->tui.manipulator_hi, 255, 255, 255, 255);
- rgba_char_args_set(btheme->tui.manipulator_primary, 222, 255, 13, 255);
- rgba_char_args_set(btheme->tui.manipulator_secondary, 0, 255, 255, 255);
- rgba_char_args_set(btheme->tui.manipulator_a, 23, 127, 23, 255);
- rgba_char_args_set(btheme->tui.manipulator_b, 127, 23, 23, 255);
-}
-
/**
* initialize default theme
* \note: when you add new colors, created & saved themes need initialized
@@ -881,381 +745,17 @@ static void ui_theme_space_init_manipulator_colors(bTheme *btheme)
*/
void ui_theme_init_default(void)
{
- bTheme *btheme;
/* we search for the theme with name Default */
- btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
-
+ bTheme *btheme = BLI_findstring(&U.themes, "Default", offsetof(bTheme, name));
if (btheme == NULL) {
- btheme = MEM_callocN(sizeof(bTheme), "theme");
+ btheme = MEM_callocN(sizeof(bTheme), __func__);
BLI_addtail(&U.themes, btheme);
- strcpy(btheme->name, "Default");
}
UI_SetTheme(0, 0); /* make sure the global used in this file is set */
- /* UI buttons */
- ui_widget_color_init(&btheme->tui);
-
- btheme->tui.iconfile[0] = 0;
- rgba_char_args_set(btheme->tui.wcol_tooltip.text, 255, 255, 255, 255);
- rgba_char_args_set_fl(btheme->tui.widget_emboss, 1.0f, 1.0f, 1.0f, 0.02f);
- rgba_char_args_set_fl(btheme->tui.editor_outline, 0.25f, 0.25f, 0.25f, 1.0f);
-
- rgba_char_args_set(btheme->tui.xaxis, 220, 0, 0, 255);
- rgba_char_args_set(btheme->tui.yaxis, 0, 220, 0, 255);
- rgba_char_args_set(btheme->tui.zaxis, 0, 0, 220, 255);
-
- btheme->tui.menu_shadow_fac = 0.5f;
- btheme->tui.menu_shadow_width = 12;
-
- /* Bone Color Sets */
- ui_theme_init_boneColorSets(btheme);
-
- /* common (new) variables */
- ui_theme_init_new(btheme);
-
- /* Manipulator. */
- ui_theme_space_init_manipulator_colors(btheme);
-
- /* space view3d */
- rgba_char_args_set_fl(btheme->tv3d.back, 0.225, 0.225, 0.225, 1.0);
- rgba_char_args_set(btheme->tv3d.text, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
-
- rgba_char_args_set_fl(btheme->tv3d.header, 0.45, 0.45, 0.45, 1.0);
- rgba_char_args_set_fl(btheme->tv3d.button, 0.45, 0.45, 0.45, 0.5);
-// rgba_char_args_set(btheme->tv3d.panel, 165, 165, 165, 127);
-
- rgba_char_args_set(btheme->tv3d.shade1, 160, 160, 160, 100);
- rgba_char_args_set(btheme->tv3d.shade2, 0x7f, 0x70, 0x70, 100);
-
- rgba_char_args_set_fl(btheme->tv3d.grid, 0.251, 0.251, 0.251, 1.0);
- rgba_char_args_set(btheme->tv3d.view_overlay, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.wire, 0x0, 0x0, 0x0, 255);
- rgba_char_args_set(btheme->tv3d.wire_edit, 0x0, 0x0, 0x0, 255);
- rgba_char_args_set(btheme->tv3d.lamp, 0, 0, 0, 40);
- rgba_char_args_set(btheme->tv3d.speaker, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.camera, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.empty, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.select, 241, 88, 0, 255);
- rgba_char_args_set(btheme->tv3d.active, 255, 170, 64, 255);
- rgba_char_args_set(btheme->tv3d.group, 8, 48, 8, 255);
- rgba_char_args_set(btheme->tv3d.group_active, 85, 187, 85, 255);
- rgba_char_args_set(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
- rgba_char_args_set(btheme->tv3d.vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.vertex_select, 255, 133, 0, 255);
- rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255);
- rgba_char_args_set(btheme->tv3d.vertex_unreferenced, 0, 0, 0, 255);
- btheme->tv3d.vertex_size = 3;
- btheme->tv3d.outline_width = 1;
- rgba_char_args_set(btheme->tv3d.edge, 0x0, 0x0, 0x0, 255);
- rgba_char_args_set(btheme->tv3d.edge_select, 255, 160, 0, 255);
- rgba_char_args_set(btheme->tv3d.edge_seam, 219, 37, 18, 255);
- rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255);
- rgba_char_args_set(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
- rgba_char_args_set(btheme->tv3d.face, 0, 0, 0, 18);
- rgba_char_args_set(btheme->tv3d.face_select, 255, 133, 0, 60);
- rgba_char_args_set(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
- rgba_char_args_set(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
- rgba_char_args_set(btheme->tv3d.loop_normal, 0xDD, 0x23, 0xDD, 255);
- rgba_char_args_set(btheme->tv3d.face_dot, 255, 133, 0, 255);
- rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
- rgba_char_args_set_fl(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
- rgba_char_args_set(btheme->tv3d.edge_sharp, 0, 255, 255, 255);
- rgba_char_args_set(btheme->tv3d.header_text, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.header_text_hi, 255, 255, 255, 255);
- rgba_char_args_set(btheme->tv3d.button_text, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
- rgba_char_args_set(btheme->tv3d.button_title, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.title, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
- rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
- rgba_char_args_set_fl(btheme->tv3d.paint_curve_handle, 0.5f, 1.0f, 0.5f, 0.5f);
- rgba_char_args_set_fl(btheme->tv3d.paint_curve_pivot, 1.0f, 0.5f, 0.5f, 0.5f);
- rgba_char_args_set(btheme->tv3d.gp_vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.gp_vertex_select, 255, 133, 0, 255);
- btheme->tv3d.gp_vertex_size = 3;
-
- btheme->tv3d.facedot_size = 4;
-
- rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.extra_edge_angle, 32, 32, 0, 255);
- rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
- rgba_char_args_set(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
-
- rgba_char_args_set(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
-
- rgba_char_args_set(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
- rgba_char_args_set(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
- rgba_char_args_set(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
- rgba_char_args_set(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
-
- ui_theme_space_init_handles_color(&btheme->tv3d);
-
- rgba_char_args_set(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
- rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
-
- rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
- /* alpha 80 is not meant editable, used for wire+action draw */
- rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80);
- rgba_char_args_set(btheme->tv3d.bone_pose_active, 140, 255, 255, 80);
-
- rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
- rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
-
- rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
- rgba_char_args_set(btheme->tv3d.gradients.gradient, 0, 0, 0, 0);
- rgba_char_args_set(btheme->tv3d.gradients.high_gradient, 58, 58, 58, 255);
- btheme->tv3d.gradients.show_grad = false;
-
- rgba_char_args_set(btheme->tv3d.clipping_border_3d, 50, 50, 50, 255);
-
- rgba_char_args_set(btheme->tv3d.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
- rgba_char_args_set(btheme->tv3d.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
-
- /* space buttons */
- /* to have something initialized */
- btheme->tbuts = btheme->tv3d;
-
- rgba_char_args_set_fl(btheme->tbuts.back, 0.45, 0.45, 0.45, 1.0);
-// rgba_char_args_set(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
-
- /* graph editor */
- btheme->tipo = btheme->tv3d;
- rgba_char_args_set_fl(btheme->tipo.back, 0.42, 0.42, 0.42, 1.0);
- rgba_char_args_set_fl(btheme->tipo.list, 0.4, 0.4, 0.4, 1.0);
- rgba_char_args_set(btheme->tipo.grid, 94, 94, 94, 255);
-// rgba_char_args_set(btheme->tipo.panel, 255, 255, 255, 150);
- rgba_char_args_set(btheme->tipo.shade1, 150, 150, 150, 100); /* scrollbars */
- rgba_char_args_set(btheme->tipo.shade2, 0x70, 0x70, 0x70, 100);
- rgba_char_args_set(btheme->tipo.vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tipo.vertex_select, 255, 133, 0, 255);
- rgba_char_args_set(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255);
- btheme->tipo.vertex_size = 6;
-
- rgba_char_args_set(btheme->tipo.handle_vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
- rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
- rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
- btheme->tipo.handle_vertex_size = 5;
-
- rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
- rgba_char_args_set(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
- rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
- rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
-
- /* dopesheet */
- btheme->tact = btheme->tipo;
- rgba_char_args_set(btheme->tact.strip, 12, 10, 10, 128);
- rgba_char_args_set(btheme->tact.strip_select, 255, 140, 0, 255);
-
- rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
-
- rgba_char_args_set(btheme->tact.keytype_keyframe, 232, 232, 232, 255);
- rgba_char_args_set(btheme->tact.keytype_keyframe_select, 255, 190, 50, 255);
- rgba_char_args_set(btheme->tact.keytype_extreme, 232, 179, 204, 255);
- rgba_char_args_set(btheme->tact.keytype_extreme_select, 242, 128, 128, 255);
- rgba_char_args_set(btheme->tact.keytype_breakdown, 179, 219, 232, 255);
- rgba_char_args_set(btheme->tact.keytype_breakdown_select, 84, 191, 237, 255);
- rgba_char_args_set(btheme->tact.keytype_jitter, 148, 229, 117, 255);
- rgba_char_args_set(btheme->tact.keytype_jitter_select, 97, 192, 66, 255);
-
- rgba_char_args_set(btheme->tact.keyborder, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tact.keyborder_select, 0, 0, 0, 255);
-
- btheme->tact.keyframe_scale_fac = 1.0f;
-
- /* space nla */
- btheme->tnla = btheme->tact;
-
- rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as for dopesheet; duplicate here for easier reference */
- rgba_char_args_set(btheme->tnla.anim_non_active, 153, 135, 97, 77);
-
- rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
- rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
-
- rgba_char_args_set(btheme->tnla.nla_transition, 28, 38, 48, 255);
- rgba_char_args_set(btheme->tnla.nla_transition_sel, 46, 117, 219, 255);
- rgba_char_args_set(btheme->tnla.nla_meta, 51, 38, 66, 255);
- rgba_char_args_set(btheme->tnla.nla_meta_sel, 105, 33, 150, 255);
- rgba_char_args_set(btheme->tnla.nla_sound, 43, 61, 61, 255);
- rgba_char_args_set(btheme->tnla.nla_sound_sel, 31, 122, 122, 255);
-
- rgba_char_args_set(btheme->tnla.keyborder, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tnla.keyborder_select, 0, 0, 0, 255);
-
- /* space file */
- /* to have something initialized */
- btheme->tfile = btheme->tv3d;
- rgba_char_args_set_fl(btheme->tfile.back, 0.3, 0.3, 0.3, 1);
-// rgba_char_args_set_fl(btheme->tfile.panel, 0.3, 0.3, 0.3, 1);
- rgba_char_args_set_fl(btheme->tfile.list, 0.4, 0.4, 0.4, 1);
- rgba_char_args_set(btheme->tfile.text, 250, 250, 250, 255);
- rgba_char_args_set(btheme->tfile.text_hi, 15, 15, 15, 255);
-// rgba_char_args_set(btheme->tfile.panel, 145, 145, 145, 255); /* bookmark/ui regions */
- rgba_char_args_set(btheme->tfile.hilite, 255, 140, 25, 255); /* selected files */
-
- rgba_char_args_set(btheme->tfile.image, 250, 250, 250, 255);
- rgba_char_args_set(btheme->tfile.movie, 250, 250, 250, 255);
- rgba_char_args_set(btheme->tfile.scene, 250, 250, 250, 255);
-
-
- /* space seq */
- btheme->tseq = btheme->tv3d;
- rgba_char_args_set(btheme->tseq.back, 116, 116, 116, 255);
- rgba_char_args_set(btheme->tseq.movie, 81, 105, 135, 255);
- rgba_char_args_set(btheme->tseq.movieclip, 32, 32, 143, 255);
- rgba_char_args_set(btheme->tseq.mask, 152, 78, 62, 255);
- rgba_char_args_set(btheme->tseq.image, 109, 88, 129, 255);
- rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
- rgba_char_args_set(btheme->tseq.audio, 46, 143, 143, 255);
- rgba_char_args_set(btheme->tseq.effect, 169, 84, 124, 255);
- rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
- rgba_char_args_set(btheme->tseq.meta, 109, 145, 131, 255);
- rgba_char_args_set(btheme->tseq.text_strip, 162, 151, 0, 255);
- rgba_char_args_set(btheme->tseq.preview_back, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tseq.grid, 64, 64, 64, 255);
-
- /* space image */
- btheme->tima = btheme->tv3d;
- rgba_char_args_set(btheme->tima.back, 53, 53, 53, 255);
- rgba_char_args_set(btheme->tima.vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tima.vertex_select, 255, 133, 0, 255);
- rgba_char_args_set(btheme->tima.wire_edit, 192, 192, 192, 255);
- rgba_char_args_set(btheme->tima.edge_select, 255, 133, 0, 255);
- btheme->tima.vertex_size = 3;
- btheme->tima.facedot_size = 3;
- rgba_char_args_set(btheme->tima.face, 255, 255, 255, 10);
- rgba_char_args_set(btheme->tima.face_select, 255, 133, 0, 60);
- rgba_char_args_set(btheme->tima.editmesh_active, 255, 255, 255, 128);
- rgba_char_args_set_fl(btheme->tima.preview_back, 0.0, 0.0, 0.0, 0.3);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
-
- rgba_char_args_test_set(btheme->tima.uv_others, 96, 96, 96, 255);
- rgba_char_args_test_set(btheme->tima.uv_shadow, 112, 112, 112, 255);
-
- ui_theme_space_init_handles_color(&btheme->tima);
- btheme->tima.handle_vertex_size = 5;
-
- /* space text */
- btheme->text = btheme->tv3d;
- rgba_char_args_set(btheme->text.back, 153, 153, 153, 255);
- rgba_char_args_set(btheme->text.shade1, 143, 143, 143, 255);
- rgba_char_args_set(btheme->text.shade2, 0xc6, 0x77, 0x77, 255);
- rgba_char_args_set(btheme->text.hilite, 255, 0, 0, 255);
-
- /* syntax highlighting */
- rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
- rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings Red */
- rgba_char_args_set(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments Greenish */
- rgba_char_args_set(btheme->text.syntaxv, 95, 95, 0, 255); /* Special Yellow*/
- rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */
- rgba_char_args_set(btheme->text.syntaxr, 140, 60, 0, 255); /* Reserved Orange*/
- rgba_char_args_set(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin Red-purple */
- rgba_char_args_set(btheme->text.syntaxs, 76, 76, 76, 255); /* Gray (mix between fg/bg) */
-
- /* space oops */
- btheme->toops = btheme->tv3d;
- rgba_char_args_set_fl(btheme->toops.back, 0.45, 0.45, 0.45, 1.0);
-
- rgba_char_args_set_fl(btheme->toops.match, 0.2, 0.5, 0.2, 0.3); /* highlighting search match - soft green*/
- rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
-
- /* space info */
- btheme->tinfo = btheme->tv3d;
- rgba_char_args_set_fl(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
- rgba_char_args_set(btheme->tinfo.info_selected, 96, 128, 255, 255);
- rgba_char_args_set(btheme->tinfo.info_selected_text, 255, 255, 255, 255);
- rgba_char_args_set(btheme->tinfo.info_error, 220, 0, 0, 255);
- rgba_char_args_set(btheme->tinfo.info_error_text, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tinfo.info_warning, 220, 128, 96, 255);
- rgba_char_args_set(btheme->tinfo.info_warning_text, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tinfo.info_info, 0, 170, 0, 255);
- rgba_char_args_set(btheme->tinfo.info_info_text, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tinfo.info_debug, 196, 196, 196, 255);
- rgba_char_args_set(btheme->tinfo.info_debug_text, 0, 0, 0, 255);
-
- /* space user preferences */
- btheme->tuserpref = btheme->tv3d;
- rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
-
- /* space console */
- btheme->tconsole = btheme->tv3d;
- rgba_char_args_set(btheme->tconsole.back, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tconsole.console_output, 96, 128, 255, 255);
- rgba_char_args_set(btheme->tconsole.console_input, 255, 255, 255, 255);
- rgba_char_args_set(btheme->tconsole.console_info, 0, 170, 0, 255);
- rgba_char_args_set(btheme->tconsole.console_error, 220, 96, 96, 255);
- rgba_char_args_set(btheme->tconsole.console_cursor, 220, 96, 96, 255);
- rgba_char_args_set(btheme->tconsole.console_select, 255, 255, 255, 48);
-
- /* space time */
- btheme->ttime = btheme->tv3d;
- rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
- rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
- rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); /* sliders */
-
- rgba_char_args_set(btheme->ttime.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
- rgba_char_args_set(btheme->ttime.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
-
- /* space node, re-uses syntax and console color storage */
- btheme->tnode = btheme->tv3d;
- rgba_char_args_set(btheme->tnode.syntaxr, 115, 115, 115, 255); /* wire inner color */
- rgba_char_args_set(btheme->tnode.edge_select, 255, 255, 255, 255); /* wire selected */
- rgba_char_args_set(btheme->tnode.syntaxl, 155, 155, 155, 160); /* TH_NODE, backdrop */
- rgba_char_args_set(btheme->tnode.syntaxn, 100, 100, 100, 255); /* in */
- rgba_char_args_set(btheme->tnode.nodeclass_output, 100, 100, 100, 255); /* output */
- rgba_char_args_set(btheme->tnode.syntaxb, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.syntaxv, 104, 106, 117, 255); /* generator */
- rgba_char_args_set(btheme->tnode.syntaxc, 105, 117, 110, 255); /* group */
- rgba_char_args_set(btheme->tnode.nodeclass_texture, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.nodeclass_shader, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.nodeclass_filter, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.nodeclass_script, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.nodeclass_pattern, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.nodeclass_vector, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.nodeclass_layout, 108, 105, 111, 255); /* operator */
- rgba_char_args_set(btheme->tnode.movie, 155, 155, 155, 160); /* frame */
- rgba_char_args_set(btheme->tnode.syntaxs, 151, 116, 116, 255); /* matte nodes */
- rgba_char_args_set(btheme->tnode.syntaxd, 116, 151, 151, 255); /* distort nodes */
- rgba_char_args_set(btheme->tnode.console_output, 223, 202, 53, 255); /* interface nodes */
- btheme->tnode.noodle_curving = 5;
-
- /* space clip */
- btheme->tclip = btheme->tv3d;
-
- rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
- rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
- rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
- rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
- rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
- rgba_char_args_set(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
- rgba_char_args_set(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
- rgba_char_args_set(btheme->tclip.list, 0x66, 0x66, 0x66, 0xff);
- rgba_char_args_set(btheme->tclip.strip, 0x0c, 0x0a, 0x0a, 0x80);
- rgba_char_args_set(btheme->tclip.strip_select, 0xff, 0x8c, 0x00, 0xff);
- btheme->tclip.handle_vertex_size = 5;
- ui_theme_space_init_handles_color(&btheme->tclip);
-
- /* space topbar */
- char tmp[4];
- btheme->ttopbar = btheme->tv3d;
- /* swap colors */
- copy_v4_v4_char(tmp, btheme->ttopbar.header);
- copy_v4_v4_char(btheme->ttopbar.header, btheme->ttopbar.tab_inactive);
- copy_v4_v4_char(btheme->ttopbar.back, tmp);
-
- /* space statusbar */
- btheme->tstatusbar = btheme->tv3d;
+ memcpy(btheme, &U_theme_default, sizeof(*btheme));
}
void ui_style_init_default(void)
@@ -1775,14 +1275,14 @@ void UI_ThemeClearColor(int colorid)
float col[3];
UI_GetThemeColor3fv(colorid, col);
- glClearColor(col[0], col[1], col[2], 0.0f);
+ GPU_clear_color(col[0], col[1], col[2], 0.0f);
}
void UI_ThemeClearColorAlpha(int colorid, float alpha)
{
float col[3];
UI_GetThemeColor3fv(colorid, col);
- glClearColor(col[0], col[1], col[2], alpha);
+ GPU_clear_color(col[0], col[1], col[2], alpha);
}
@@ -1856,9 +1356,9 @@ void init_userdef_do_versions(Main *bmain)
U.fcu_inactive_alpha = 0.25f;
}
- /* signal for derivedmesh to use colorband */
+ /* signal for evaluated mesh to use colorband */
/* run in case this was on and is now off in the user prefs [#28096] */
- vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, UI_GetTheme()->tv3d.vertex_unreferenced);
+ BKE_mesh_runtime_color_band_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, UI_GetTheme()->tv3d.vertex_unreferenced);
if (!USER_VERSION_ATLEAST(192, 0)) {
strcpy(U.sounddir, "/");
@@ -1871,121 +1371,19 @@ void init_userdef_do_versions(Main *bmain)
/* added seam, normal color, undo */
if (!USER_VERSION_ATLEAST(235, 0)) {
- bTheme *btheme;
-
U.uiflag |= USER_GLOBALUNDO;
if (U.undosteps == 0) U.undosteps = 32;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* check for (alpha == 0) is safe, then color was never set */
- if (btheme->tv3d.edge_seam[3] == 0) {
- rgba_char_args_set(btheme->tv3d.edge_seam, 230, 150, 50, 255);
- }
- if (btheme->tv3d.normal[3] == 0) {
- rgba_char_args_set(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
- }
- if (btheme->tv3d.vertex_normal[3] == 0) {
- rgba_char_args_set(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
- }
- if (btheme->tv3d.face_dot[3] == 0) {
- rgba_char_args_set(btheme->tv3d.face_dot, 255, 138, 48, 255);
- btheme->tv3d.facedot_size = 4;
- }
- }
}
if (!USER_VERSION_ATLEAST(236, 0)) {
/* illegal combo... */
if (U.flag & USER_LMOUSESELECT)
U.flag &= ~USER_TWOBUTTONMOUSE;
}
- if (!USER_VERSION_ATLEAST(237, 0)) {
- bTheme *btheme;
- /* new space type */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* check for (alpha == 0) is safe, then color was never set */
- if (btheme->ttime.back[3] == 0) {
- /* copied from ui_theme_init_default */
- btheme->ttime = btheme->tv3d;
- rgba_char_args_set_fl(btheme->ttime.back, 0.45, 0.45, 0.45, 1.0);
- rgba_char_args_set_fl(btheme->ttime.grid, 0.36, 0.36, 0.36, 1.0);
- rgba_char_args_set(btheme->ttime.shade1, 173, 173, 173, 255); /* sliders */
- }
- if (btheme->text.syntaxn[3] == 0) {
- rgba_char_args_set(btheme->text.syntaxn, 0, 0, 200, 255); /* Numbers Blue*/
- rgba_char_args_set(btheme->text.syntaxl, 100, 0, 0, 255); /* Strings red */
- rgba_char_args_set(btheme->text.syntaxc, 0, 100, 50, 255); /* Comments greenish */
- rgba_char_args_set(btheme->text.syntaxv, 95, 95, 0, 255); /* Special */
- rgba_char_args_set(btheme->text.syntaxb, 128, 0, 80, 255); /* Builtin, red-purple */
- }
- }
- }
- if (!USER_VERSION_ATLEAST(238, 0)) {
- bTheme *btheme;
- /* bone colors */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* check for alpha==0 is safe, then color was never set */
- if (btheme->tv3d.bone_solid[3] == 0) {
- rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
- rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80);
- }
- }
- }
- if (!USER_VERSION_ATLEAST(239, 0)) {
- bTheme *btheme;
- /* bone colors */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* check for alpha==0 is safe, then color was never set */
- if (btheme->tnla.strip[3] == 0) {
- rgba_char_args_set(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
- rgba_char_args_set(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
- }
- }
- }
if (!USER_VERSION_ATLEAST(240, 0)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* Lamp theme, check for alpha==0 is safe, then color was never set */
- if (btheme->tv3d.lamp[3] == 0) {
- rgba_char_args_set(btheme->tv3d.lamp, 0, 0, 0, 40);
-/* TEMPORAL, remove me! (ton) */
- U.uiflag |= USER_PLAINMENUS;
- }
-
- }
+ U.uiflag |= USER_PLAINMENUS;
if (U.obcenter_dia == 0) U.obcenter_dia = 6;
}
if (!USER_VERSION_ATLEAST(242, 0)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* Node editor theme, check for alpha==0 is safe, then color was never set */
- if (btheme->tnode.syntaxn[3] == 0) {
- /* re-uses syntax color storage */
- btheme->tnode = btheme->tv3d;
- rgba_char_args_set(btheme->tnode.edge_select, 255, 255, 255, 255);
- rgba_char_args_set(btheme->tnode.syntaxl, 150, 150, 150, 255); /* TH_NODE, backdrop */
- rgba_char_args_set(btheme->tnode.syntaxn, 129, 131, 144, 255); /* in/output */
- rgba_char_args_set(btheme->tnode.syntaxb, 127, 127, 127, 255); /* operator */
- rgba_char_args_set(btheme->tnode.syntaxv, 142, 138, 145, 255); /* generator */
- rgba_char_args_set(btheme->tnode.syntaxc, 120, 145, 120, 255); /* group */
- }
- /* Group theme colors */
- if (btheme->tv3d.group[3] == 0) {
- rgba_char_args_set(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
- rgba_char_args_set(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
- }
- /* Sequence editor theme*/
- if (btheme->tseq.movie[3] == 0) {
- rgba_char_args_set(btheme->tseq.movie, 81, 105, 135, 255);
- rgba_char_args_set(btheme->tseq.image, 109, 88, 129, 255);
- rgba_char_args_set(btheme->tseq.scene, 78, 152, 62, 255);
- rgba_char_args_set(btheme->tseq.audio, 46, 143, 143, 255);
- rgba_char_args_set(btheme->tseq.effect, 169, 84, 124, 255);
- rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
- rgba_char_args_set(btheme->tseq.meta, 109, 145, 131, 255);
- }
- }
-
/* set defaults for 3D View rotating axis indicator */
/* since size can't be set to 0, this indicates it's not saved in startup.blend */
if (U.rvisize == 0) {
@@ -1995,119 +1393,18 @@ void init_userdef_do_versions(Main *bmain)
}
}
- if (!USER_VERSION_ATLEAST(243, 0)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* long keyframe color */
- /* check for alpha==0 is safe, then color was never set */
- if (btheme->tact.strip[3] == 0) {
- rgba_char_args_set(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
- rgba_char_args_set(btheme->tact.strip_select, 0xff, 0xff, 0xaa, 204);
- rgba_char_args_set(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
- }
-
- /* IPO-Editor - Vertex Size*/
- if (btheme->tipo.vertex_size == 0) {
- btheme->tipo.vertex_size = 3;
- }
- }
- }
if (!USER_VERSION_ATLEAST(244, 0)) {
/* set default number of recently-used files (if not set) */
if (U.recent_files == 0) U.recent_files = 10;
}
if (!USER_VERSION_ATLEAST(245, 3)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
- }
if (U.coba_weight.tot == 0)
BKE_colorband_init(&U.coba_weight, true);
}
if (!USER_VERSION_ATLEAST(245, 3)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* these should all use the same color */
- rgba_char_args_set(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
- rgba_char_args_set(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
- rgba_char_args_set(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
- rgba_char_args_set(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
- rgba_char_args_set(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
- //rgba_char_args_set(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
- rgba_char_args_set(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
- }
- }
- if (!USER_VERSION_ATLEAST(245, 3)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* action channel groups (recolor anyway) */
- rgba_char_args_set(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
- rgba_char_args_set(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
-
- /* bone custom-color sets */
- if (btheme->tarm[0].solid[3] == 0)
- ui_theme_init_boneColorSets(btheme);
- }
- }
- if (!USER_VERSION_ATLEAST(245, 3)) {
U.flag |= USER_ADD_VIEWALIGNED | USER_ADD_EDITMODE;
}
- if (!USER_VERSION_ATLEAST(245, 3)) {
- bTheme *btheme;
-
- /* adjust themes */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- const char *col;
-
- /* IPO Editor: Handles/Vertices */
- col = btheme->tipo.vertex;
- rgba_char_args_set(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
- col = btheme->tipo.vertex_select;
- rgba_char_args_set(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
- btheme->tipo.handle_vertex_size = btheme->tipo.vertex_size;
-
- /* Sequence/Image Editor: colors for GPencil text */
- col = btheme->tv3d.bone_pose;
- rgba_char_args_set(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
- rgba_char_args_set(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
- col = btheme->tv3d.vertex_select;
- rgba_char_args_set(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
- }
- }
if (!USER_VERSION_ATLEAST(250, 0)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* this was not properly initialized in 2.45 */
- if (btheme->tima.face_dot[3] == 0) {
- rgba_char_args_set(btheme->tima.editmesh_active, 255, 255, 255, 128);
- rgba_char_args_set(btheme->tima.face_dot, 255, 133, 0, 255);
- btheme->tima.facedot_size = 2;
- }
-
- /* DopeSheet - (Object) Channel color */
- rgba_char_args_set(btheme->tact.ds_channel, 82, 96, 110, 255);
- rgba_char_args_set(btheme->tact.ds_subchannel, 124, 137, 150, 255);
- /* DopeSheet - Group Channel color (saner version) */
- rgba_char_args_set(btheme->tact.group, 79, 101, 73, 255);
- rgba_char_args_set(btheme->tact.group_active, 135, 177, 125, 255);
-
- /* Graph Editor - (Object) Channel color */
- rgba_char_args_set(btheme->tipo.ds_channel, 82, 96, 110, 255);
- rgba_char_args_set(btheme->tipo.ds_subchannel, 124, 137, 150, 255);
- /* Graph Editor - Group Channel color */
- rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
- rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
-
- /* Nla Editor - (Object) Channel color */
- rgba_char_args_set(btheme->tnla.ds_channel, 82, 96, 110, 255);
- rgba_char_args_set(btheme->tnla.ds_subchannel, 124, 137, 150, 255);
- /* NLA Editor - New Strip colors */
- rgba_char_args_set(btheme->tnla.strip, 12, 10, 10, 128);
- rgba_char_args_set(btheme->tnla.strip_select, 255, 140, 0, 255);
- }
-
/* adjust grease-pencil distances */
U.gp_manhattendist = 1;
U.gp_euclideandist = 2;
@@ -2116,22 +1413,6 @@ void init_userdef_do_versions(Main *bmain)
U.ipo_new = BEZT_IPO_BEZ;
}
- if (!USER_VERSION_ATLEAST(250, 1)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
-
- /* common (new) variables, it checks for alpha==0 */
- ui_theme_init_new(btheme);
-
- if (btheme->tui.wcol_num.outline[3] == 0)
- ui_widget_color_init(&btheme->tui);
-
- rgba_char_args_set_fl(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
- rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
- }
- }
-
if (!USER_VERSION_ATLEAST(250, 3)) {
/* new audio system */
if (U.audiochannels == 0)
@@ -2194,66 +1475,8 @@ void init_userdef_do_versions(Main *bmain)
U.flag &= ~USER_TWOBUTTONMOUSE;
}
if (!USER_VERSION_ATLEAST(252, 4)) {
- bTheme *btheme;
-
/* default new handle type is auto handles */
U.keyhandles_new = HD_AUTO;
-
- /* init new curve colors */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- ui_theme_space_init_handles_color(&btheme->tv3d);
- ui_theme_space_init_handles_color(&btheme->tipo);
-
- /* edge crease */
- rgba_char_args_set_fl(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
- }
- }
- if (!USER_VERSION_ATLEAST(253, 0)) {
- bTheme *btheme;
-
- /* init new curve colors */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tv3d.lastsel_point[3] == 0)
- rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
- }
- }
- if (!USER_VERSION_ATLEAST(252, 5)) {
- bTheme *btheme;
-
- /* interface_widgets.c */
- struct uiWidgetColors wcol_progress = {
- {0, 0, 0, 255},
- {190, 190, 190, 255},
- {100, 100, 100, 180},
- {128, 128, 128, 255},
-
- {0, 0, 0, 255},
- {255, 255, 255, 255},
-
- 0,
- 5, -5
- };
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* init progress bar theme */
- btheme->tui.wcol_progress = wcol_progress;
- }
- }
-
- if (!USER_VERSION_ATLEAST(255, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
- rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(256, 4)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if ((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width = 1;
- }
}
if (!USER_VERSION_ATLEAST(257, 0)) {
@@ -2262,226 +1485,22 @@ void init_userdef_do_versions(Main *bmain)
U.autokey_flag &= ~AUTOKEY_FLAG_ONLYKEYINGSET;
}
- if (!USER_VERSION_ATLEAST(258, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- btheme->tnode.noodle_curving = 5;
- }
- }
-
- if (!USER_VERSION_ATLEAST(259, 1)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- btheme->tv3d.speaker[3] = 255;
- }
- }
-
if (!USER_VERSION_ATLEAST(260, 3)) {
- bTheme *btheme;
-
/* if new keyframes handle default is stuff "auto", make it "auto-clamped" instead
* was changed in 260 as part of GSoC11, but version patch was wrong
*/
if (U.keyhandles_new == HD_AUTO)
U.keyhandles_new = HD_AUTO_ANIM;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tv3d.bundle_solid[3] == 0)
- rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
-
- if (btheme->tv3d.camera_path[3] == 0)
- rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
-
- if ((btheme->tclip.back[3]) == 0) {
- btheme->tclip = btheme->tv3d;
-
- rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
- rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
- rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
- rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
- rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
- rgba_char_args_set(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
- rgba_char_args_set(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
- rgba_char_args_set(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
- rgba_char_args_set(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
- rgba_char_args_set(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
- btheme->tclip.handle_vertex_size = 5;
- }
-
- /* auto-clamped handles -> based on auto */
- if (btheme->tipo.handle_auto_clamped[3] == 0)
- rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
- if (btheme->tipo.handle_sel_auto_clamped[3] == 0)
- rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
- }
-
/* enable (Cycles) addon by default */
BKE_addon_ensure(&U.addons, "cycles");
}
- if (!USER_VERSION_ATLEAST(260, 5)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
- btheme->tui.icon_alpha = 1.0;
- }
- }
-
if (!USER_VERSION_ATLEAST(261, 4)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
- rgba_char_args_set_fl(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
-
- rgba_char_args_set_fl(btheme->toops.match, 0.2, 0.5, 0.2, 0.3);
- rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
- }
-
U.use_16bit_textures = true;
}
- if (!USER_VERSION_ATLEAST(262, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tui.wcol_menu_item.item[3] == 255)
- rgba_char_args_set(btheme->tui.wcol_menu_item.item, 172, 172, 172, 128);
- }
- }
-
- if (!USER_VERSION_ATLEAST(262, 3)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tui.wcol_tooltip.inner[3] == 0) {
- btheme->tui.wcol_tooltip = btheme->tui.wcol_menu_back;
- }
- if (btheme->tui.wcol_tooltip.text[0] == 160) { /* hrmf */
- rgba_char_args_set(btheme->tui.wcol_tooltip.text, 255, 255, 255, 255);
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(262, 4)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tseq.movieclip[3] == 0) {
- rgba_char_args_set(btheme->tseq.movieclip, 32, 32, 143, 255);
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(263, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tclip.strip[0] == 0) {
- rgba_char_args_set(btheme->tclip.list, 0x66, 0x66, 0x66, 0xff);
- rgba_char_args_set(btheme->tclip.strip, 0x0c, 0x0a, 0x0a, 0x80);
- rgba_char_args_set(btheme->tclip.strip_select, 0xff, 0x8c, 0x00, 0xff);
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(263, 6)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next)
- rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
- }
-
- if (!USER_VERSION_ATLEAST(263, 7)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* DopeSheet Summary */
- rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
-
- /* NLA Colors */
- rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as dopesheet above */
- rgba_char_args_set(btheme->tnla.anim_non_active, 153, 135, 97, 77);
-
- rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
- rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
-
- rgba_char_args_set(btheme->tnla.nla_transition, 28, 38, 48, 255);
- rgba_char_args_set(btheme->tnla.nla_transition_sel, 46, 117, 219, 255);
- rgba_char_args_set(btheme->tnla.nla_meta, 51, 38, 66, 255);
- rgba_char_args_set(btheme->tnla.nla_meta_sel, 105, 33, 150, 255);
- rgba_char_args_set(btheme->tnla.nla_sound, 43, 61, 61, 255);
- rgba_char_args_set(btheme->tnla.nla_sound_sel, 31, 122, 122, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(263, 11)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tseq.mask[3] == 0) {
- rgba_char_args_set(btheme->tseq.mask, 152, 78, 62, 255);
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(263, 15)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tv3d.bone_pose_active, 140, 255, 255, 80);
- }
- }
-
- if (!USER_VERSION_ATLEAST(263, 16)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tact.anim_active[3] == 0)
- rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
-
- if (btheme->tnla.anim_active[3] == 0)
- rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102);
- }
- }
-
- if (!USER_VERSION_ATLEAST(263, 22)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tipo.lastsel_point[3] == 0)
- rgba_char_args_set(btheme->tipo.lastsel_point, 0xff, 0xff, 0xff, 255);
-
- if (btheme->tv3d.skin_root[3] == 0)
- rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(264, 9)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tui.xaxis, 220, 0, 0, 255);
- rgba_char_args_set(btheme->tui.yaxis, 0, 220, 0, 255);
- rgba_char_args_set(btheme->tui.zaxis, 0, 0, 220, 255);
- }
- }
-
if (!USER_VERSION_ATLEAST(267, 0)) {
- /* Freestyle color settings */
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* check for alpha == 0 is safe, then color was never set */
- if (btheme->tv3d.freestyle_edge_mark[3] == 0) {
- rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255);
- rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51);
- }
-
- if (btheme->tv3d.wire_edit[3] == 0) {
- rgba_char_args_set(btheme->tv3d.wire_edit, 0x0, 0x0, 0x0, 255);
- }
- }
/* GL Texture Garbage Collection */
if (U.textimeout == 0) {
@@ -2494,10 +1513,6 @@ void init_userdef_do_versions(Main *bmain)
if (U.dbl_click_time == 0) {
U.dbl_click_time = 350;
}
- if (U.scrcastfps == 0) {
- U.scrcastfps = 10;
- U.scrcastwait = 50;
- }
if (U.v2d_min_gridsize == 0) {
U.v2d_min_gridsize = 35;
}
@@ -2523,175 +1538,12 @@ void init_userdef_do_versions(Main *bmain)
U.tweak_threshold = 10;
}
- if (!USER_VERSION_ATLEAST(265, 1)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* note: the toggle operator for transparent backdrops limits to these spacetypes */
- if (btheme->tnode.button[3] == 255) {
- btheme->tv3d.button[3] = 128;
- btheme->tnode.button[3] = 128;
- btheme->tima.button[3] = 128;
- btheme->tseq.button[3] = 128;
- btheme->tclip.button[3] = 128;
- }
- }
- }
-
- /* panel header/backdrop supported locally per editor now */
- if (!USER_VERSION_ATLEAST(265, 2)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- ThemeSpace *ts;
-
- /* new color, panel backdrop. Not used anywhere yet, until you enable it */
- copy_v3_v3_char(btheme->tui.panel.back, btheme->tbuts.button);
- btheme->tui.panel.back[3] = 128;
-
- for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
- ts->panelcolors = btheme->tui.panel;
- }
- }
- }
-
/* NOTE!! from now on use U.versionfile and U.subversionfile */
#undef USER_VERSION_ATLEAST
#define USER_VERSION_ATLEAST(ver, subver) MAIN_VERSION_ATLEAST((&(U)), ver, subver)
- if (!USER_VERSION_ATLEAST(266, 0)) {
- bTheme *btheme;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* rna definition limits fac to 0.01 */
- if (btheme->tui.menu_shadow_fac == 0.0f) {
- btheme->tui.menu_shadow_fac = 0.5f;
- btheme->tui.menu_shadow_width = 12;
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(265, 4)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */
- rgba_char_args_set(btheme->text.syntaxr, 140, 60, 0, 255); /* Reserved Orange */
- rgba_char_args_set(btheme->text.syntaxs, 76, 76, 76, 255); /* Gray (mix between fg/bg) */
- }
- }
-
- if (!USER_VERSION_ATLEAST(265, 6)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- copy_v4_v4_char(btheme->tv3d.gradients.high_gradient, btheme->tv3d.back);
- }
- }
-
- if (!USER_VERSION_ATLEAST(265, 9)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_test_set(btheme->tnode.syntaxs, 151, 116, 116, 255); /* matte nodes */
- rgba_char_args_test_set(btheme->tnode.syntaxd, 116, 151, 151, 255); /* distort nodes */
- }
- }
-
- if (!USER_VERSION_ATLEAST(265, 11)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_test_set(btheme->tconsole.console_select, 255, 255, 255, 48);
- }
- }
-
- if (!USER_VERSION_ATLEAST(266, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_test_set(btheme->tnode.console_output, 223, 202, 53, 255); /* interface nodes */
- }
- }
-
- if (!USER_VERSION_ATLEAST(268, 3)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_test_set(btheme->tima.uv_others, 96, 96, 96, 255);
- rgba_char_args_test_set(btheme->tima.uv_shadow, 112, 112, 112, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(269, 5)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tima.wire_edit, 192, 192, 192, 255);
- rgba_char_args_set(btheme->tima.edge_select, 255, 133, 0, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(269, 6)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- char r, g, b;
- r = btheme->tnode.syntaxn[0];
- g = btheme->tnode.syntaxn[1];
- b = btheme->tnode.syntaxn[2];
- rgba_char_args_test_set(btheme->tnode.nodeclass_output, r, g, b, 255);
- r = btheme->tnode.syntaxb[0];
- g = btheme->tnode.syntaxb[1];
- b = btheme->tnode.syntaxb[2];
- rgba_char_args_test_set(btheme->tnode.nodeclass_filter, r, g, b, 255);
- rgba_char_args_test_set(btheme->tnode.nodeclass_vector, r, g, b, 255);
- rgba_char_args_test_set(btheme->tnode.nodeclass_texture, r, g, b, 255);
- rgba_char_args_test_set(btheme->tnode.nodeclass_shader, r, g, b, 255);
- rgba_char_args_test_set(btheme->tnode.nodeclass_script, r, g, b, 255);
- rgba_char_args_test_set(btheme->tnode.nodeclass_pattern, r, g, b, 255);
- rgba_char_args_test_set(btheme->tnode.nodeclass_layout, r, g, b, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(269, 8)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_test_set(btheme->tinfo.info_selected, 96, 128, 255, 255);
- rgba_char_args_test_set(btheme->tinfo.info_selected_text, 255, 255, 255, 255);
- rgba_char_args_test_set(btheme->tinfo.info_error, 220, 0, 0, 255);
- rgba_char_args_test_set(btheme->tinfo.info_error_text, 0, 0, 0, 255);
- rgba_char_args_test_set(btheme->tinfo.info_warning, 220, 128, 96, 255);
- rgba_char_args_test_set(btheme->tinfo.info_warning_text, 0, 0, 0, 255);
- rgba_char_args_test_set(btheme->tinfo.info_info, 0, 170, 0, 255);
- rgba_char_args_test_set(btheme->tinfo.info_info_text, 0, 0, 0, 255);
- rgba_char_args_test_set(btheme->tinfo.info_debug, 196, 196, 196, 255);
- rgba_char_args_test_set(btheme->tinfo.info_debug_text, 0, 0, 0, 255);
- }
- }
if (!USER_VERSION_ATLEAST(269, 9)) {
- bTheme *btheme;
- /* Action Editor (and NLA Editor) - Keyframe Colors */
- /* Graph Editor - larger vertex size defaults */
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* Action Editor ................. */
- /* key types */
- rgba_char_args_set(btheme->tact.keytype_keyframe, 232, 232, 232, 255);
- rgba_char_args_set(btheme->tact.keytype_keyframe_select, 255, 190, 50, 255);
- rgba_char_args_set(btheme->tact.keytype_extreme, 232, 179, 204, 255);
- rgba_char_args_set(btheme->tact.keytype_extreme_select, 242, 128, 128, 255);
- rgba_char_args_set(btheme->tact.keytype_breakdown, 179, 219, 232, 255);
- rgba_char_args_set(btheme->tact.keytype_breakdown_select, 84, 191, 237, 255);
- rgba_char_args_set(btheme->tact.keytype_jitter, 148, 229, 117, 255);
- rgba_char_args_set(btheme->tact.keytype_jitter_select, 97, 192, 66, 255);
-
- /* key border */
- rgba_char_args_set(btheme->tact.keyborder, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tact.keyborder_select, 0, 0, 0, 255);
-
- /* NLA ............................ */
- /* key border */
- rgba_char_args_set(btheme->tnla.keyborder, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tnla.keyborder_select, 0, 0, 0, 255);
-
- /* Graph Editor ................... */
- btheme->tipo.vertex_size = 6;
- btheme->tipo.handle_vertex_size = 5;
- }
-
/* grease pencil - new layer color */
if (U.gpencil_new_layer_col[3] < 0.1f) {
/* defaults to black, but must at least be visible! */
@@ -2699,139 +1551,10 @@ void init_userdef_do_versions(Main *bmain)
}
}
- if (!USER_VERSION_ATLEAST(269, 10)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- ThemeSpace *ts;
-
- for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
- rgba_char_args_set(ts->tab_active, 114, 114, 114, 255);
- rgba_char_args_set(ts->tab_inactive, 83, 83, 83, 255);
- rgba_char_args_set(ts->tab_back, 64, 64, 64, 255);
- rgba_char_args_set(ts->tab_outline, 60, 60, 60, 255);
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(271, 0)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tui.wcol_tooltip.text, 255, 255, 255, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(272, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set_fl(btheme->tv3d.paint_curve_handle, 0.5f, 1.0f, 0.5f, 0.5f);
- rgba_char_args_set_fl(btheme->tv3d.paint_curve_pivot, 1.0f, 0.5f, 0.5f, 0.5f);
- rgba_char_args_set_fl(btheme->tima.paint_curve_handle, 0.5f, 1.0f, 0.5f, 0.5f);
- rgba_char_args_set_fl(btheme->tima.paint_curve_pivot, 1.0f, 0.5f, 0.5f, 0.5f);
- rgba_char_args_set(btheme->tnode.syntaxr, 115, 115, 115, 255);
- }
- }
-
if (!USER_VERSION_ATLEAST(271, 5)) {
- bTheme *btheme;
-
- struct uiWidgetColors wcol_pie_menu = {
- {10, 10, 10, 200},
- {25, 25, 25, 230},
- {140, 140, 140, 255},
- {45, 45, 45, 230},
-
- {160, 160, 160, 255},
- {255, 255, 255, 255},
-
- 1,
- 10, -10
- };
-
U.pie_menu_radius = 100;
U.pie_menu_threshold = 12;
U.pie_animation_timeout = 6;
-
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- btheme->tui.wcol_pie_menu = wcol_pie_menu;
-
- ui_theme_space_init_handles_color(&btheme->tclip);
- ui_theme_space_init_handles_color(&btheme->tima);
- btheme->tima.handle_vertex_size = 5;
- btheme->tclip.handle_vertex_size = 5;
- }
- }
-
- if (!USER_VERSION_ATLEAST(271, 6)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* check for (alpha == 0) is safe, then color was never set */
- if (btheme->tv3d.loop_normal[3] == 0) {
- rgba_char_args_set(btheme->tv3d.loop_normal, 0xDD, 0x23, 0xDD, 255);
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(272, 3)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set_fl(btheme->tui.widget_emboss, 1.0f, 1.0f, 1.0f, 0.02f);
- }
- }
-
- if (!USER_VERSION_ATLEAST(273, 1)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* Grease Pencil vertex settings */
- rgba_char_args_set(btheme->tv3d.gp_vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tv3d.gp_vertex_select, 255, 133, 0, 255);
- btheme->tv3d.gp_vertex_size = 3;
-
- rgba_char_args_set(btheme->tseq.gp_vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tseq.gp_vertex_select, 255, 133, 0, 255);
- btheme->tseq.gp_vertex_size = 3;
-
- rgba_char_args_set(btheme->tima.gp_vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tima.gp_vertex_select, 255, 133, 0, 255);
- btheme->tima.gp_vertex_size = 3;
-
- rgba_char_args_set(btheme->tnode.gp_vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tnode.gp_vertex_select, 255, 133, 0, 255);
- btheme->tnode.gp_vertex_size = 3;
- }
- }
-
- if (!USER_VERSION_ATLEAST(273, 5)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- unsigned char *cp = (unsigned char *)btheme->tv3d.clipping_border_3d;
- int c;
- copy_v4_v4_char((char *)cp, btheme->tv3d.back);
- c = cp[0] - 8;
- CLAMP(c, 0, 255);
- cp[0] = c;
- c = cp[1] - 8;
- CLAMP(c, 0, 255);
- cp[1] = c;
- c = cp[2] - 8;
- CLAMP(c, 0, 255);
- cp[2] = c;
- cp[3] = 255;
- }
- }
-
- if (!USER_VERSION_ATLEAST(274, 5)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- copy_v4_v4_char(btheme->tima.metadatatext, btheme->tima.text_hi);
- copy_v4_v4_char(btheme->tseq.metadatatext, btheme->tseq.text_hi);
- }
- }
-
- if (!USER_VERSION_ATLEAST(275, 1)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- copy_v4_v4_char(btheme->tclip.metadatatext, btheme->tseq.text_hi);
- }
}
if (!USER_VERSION_ATLEAST(275, 2)) {
@@ -2842,85 +1565,12 @@ void init_userdef_do_versions(Main *bmain)
U.node_margin = 80;
}
- if (!USER_VERSION_ATLEAST(276, 1)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set_fl(btheme->tima.preview_back, 0.0f, 0.0f, 0.0f, 0.3f);
- }
- }
-
- if (!USER_VERSION_ATLEAST(276, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tclip.gp_vertex, 0, 0, 0, 255);
- rgba_char_args_set(btheme->tclip.gp_vertex_select, 255, 133, 0, 255);
- btheme->tclip.gp_vertex_size = 3;
- }
- }
-
- if (!USER_VERSION_ATLEAST(276, 3)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tseq.text_strip, 162, 151, 0, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(276, 8)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tui.wcol_progress.item, 128, 128, 128, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(276, 10)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* 3dView Keyframe Indicators */
- rgba_char_args_set(btheme->tv3d.time_keyframe, 0xDD, 0xD7, 0x00, 0xFF);
- rgba_char_args_set(btheme->tv3d.time_gp_keyframe, 0xB5, 0xE6, 0x1D, 0xFF);
- }
- }
-
- if (!USER_VERSION_ATLEAST(277, 0)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (memcmp(btheme->tui.wcol_list_item.item, btheme->tui.wcol_list_item.text_sel, sizeof(char) * 3) == 0) {
- copy_v4_v4_char(btheme->tui.wcol_list_item.item, btheme->tui.wcol_text.item);
- copy_v4_v4_char(btheme->tui.wcol_list_item.text_sel, btheme->tui.wcol_text.text_sel);
- }
- }
- }
-
- if (!USER_VERSION_ATLEAST(277, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tact.keyframe_scale_fac < 0.1f)
- btheme->tact.keyframe_scale_fac = 1.0f;
- }
- }
-
- if (!USER_VERSION_ATLEAST(278, 2)) {
- bTheme *btheme;
- for (btheme = U.themes.first; btheme; btheme = btheme->next) {
- rgba_char_args_set(btheme->tv3d.vertex_bevel, 0, 165, 255, 255);
- rgba_char_args_set(btheme->tv3d.edge_bevel, 0, 165, 255, 255);
- }
- }
-
- if (!USER_VERSION_ATLEAST(278, 3)) {
- for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- /* Keyframe Indicators (were using wrong alpha) */
- btheme->tv3d.time_keyframe[3] = btheme->tv3d.time_gp_keyframe[3] = 255;
- btheme->ttime.time_keyframe[3] = btheme->ttime.time_gp_keyframe[3] = 255;
- }
- }
-
if (!USER_VERSION_ATLEAST(278, 6)) {
/* Clear preference flags for re-use. */
U.flag &= ~(
USER_FLAG_DEPRECATED_1 | USER_FLAG_DEPRECATED_2 | USER_FLAG_DEPRECATED_3 |
USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 |
- USER_FLAG_DEPRECATED_9 | USER_FLAG_DEPRECATED_10);
+ USER_FLAG_DEPRECATED_9 | USER_DEVELOPER_UI);
U.uiflag &= ~(
USER_UIFLAG_DEPRECATED_7);
U.transopts &= ~(
@@ -2930,110 +1580,16 @@ void init_userdef_do_versions(Main *bmain)
U.uiflag |= USER_LOCK_CURSOR_ADJUST;
}
- if (!USER_VERSION_ATLEAST(280, 9)) {
- /* interface_widgets.c */
- struct uiWidgetColors wcol_tab = {
- {60, 60, 60, 255},
- {83, 83, 83, 255},
- {114, 114, 114, 255},
- {90, 90, 90, 255},
-
- {0, 0, 0, 255},
- {0, 0, 0, 255},
-
- 0,
- 0, 0
- };
- for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- char tmp[4];
-
- btheme->tui.wcol_tab = wcol_tab;
- btheme->ttopbar = btheme->tv3d;
- /* swap colors */
- copy_v4_v4_char(tmp, btheme->ttopbar.header);
- copy_v4_v4_char(btheme->ttopbar.header, btheme->ttopbar.tab_inactive);
- copy_v4_v4_char(btheme->ttopbar.back, tmp);
- }
- }
-
- if (!USER_VERSION_ATLEAST(280, 9)) {
- /* Timeline removal */
- for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- if (btheme->tipo.anim_active[3] == 0) {
- rgba_char_args_set(btheme->tipo.anim_active, 204, 112, 26, 102);
- }
- if (btheme->tseq.anim_active[3] == 0) {
- rgba_char_args_set(btheme->tseq.anim_active, 204, 112, 26, 102);
- }
- }
- }
+ if (!USER_VERSION_ATLEAST(280, 20)) {
+ U.gpu_viewport_quality = 0.6f;
- if (!USER_VERSION_ATLEAST(280, 10)) {
- /* Roundness */
+ /* Reset theme, old themes will not be compatible with minor version updates from now on. */
for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- btheme->tui.wcol_regular.roundness = 0.25f;
- btheme->tui.wcol_tool.roundness = 0.2f;
- btheme->tui.wcol_text.roundness = 0.2f;
- btheme->tui.wcol_radio.roundness = 0.2f;
- btheme->tui.wcol_option.roundness = 0.333333f;
- btheme->tui.wcol_toggle.roundness = 0.25f;
- btheme->tui.wcol_num.roundness = 0.5f;
- btheme->tui.wcol_numslider.roundness = 0.5f;
- btheme->tui.wcol_tab.roundness = 0.25f;
- btheme->tui.wcol_menu.roundness = 0.2f;
- btheme->tui.wcol_pulldown.roundness = 0.2f;
- btheme->tui.wcol_menu_back.roundness = 0.25f;
- btheme->tui.wcol_menu_item.roundness = 0.25f;
- btheme->tui.wcol_tooltip.roundness = 0.25f;
- btheme->tui.wcol_box.roundness = 0.2f;
- btheme->tui.wcol_scroll.roundness = 0.5f;
- btheme->tui.wcol_progress.roundness = 0.25f;
- btheme->tui.wcol_list_item.roundness = 0.2f;
- btheme->tui.wcol_pie_menu.roundness = 0.5f;
- rgba_char_args_set_fl(btheme->tui.editor_outline, 0.25f, 0.25f, 0.25f, 1.0f);
+ memcpy(btheme, &U_theme_default, sizeof(*btheme));
}
}
- if (((bTheme *)U.themes.first)->tui.wcol_toolbar_item.text[3] == 0) {
- struct uiWidgetColors wcol_toolbar_item = {
- .outline = {0x0, 0x0, 0x0, 0xff},
- .inner = {0x46, 0x46, 0x46, 0xff},
- .inner_sel = {0xcc, 0xcc, 0xcc, 0xff},
- .item = {0x0, 0x0, 0x0, 0xff},
-
- .text = {0xff, 0xff, 0xff, 0xff},
- .text_sel = {0x33, 0x33, 0x33, 0xff},
-
- .shaded = 0,
- .shadetop = 0,
- .shadedown = 0,
- .alpha_check = 0,
- .roundness = 0.3f,
- };
- for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- btheme->tui.wcol_toolbar_item = wcol_toolbar_item;
- btheme->tui.icon_saturation = 1.0f;
- }
- }
-
- if (!USER_VERSION_ATLEAST(280, 16)) {
- for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- btheme->tstatusbar = btheme->tv3d;
- }
- }
-
- if (!USER_VERSION_ATLEAST(280, 17)) {
- for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- ThemeSpace *ts;
-
- for (ts = UI_THEMESPACE_START(btheme); ts != UI_THEMESPACE_END(btheme); ts++) {
- rgba_char_args_set(ts->panelcolors.sub_back, 0, 0, 0, 25);
- }
- }
- U.gpu_viewport_antialias = USER_AA_FXAA;
- }
-
/**
* Include next version bump.
*/
@@ -3041,12 +1597,6 @@ void init_userdef_do_versions(Main *bmain)
/* (keep this block even if it becomes empty). */
}
- if (((bTheme *)U.themes.first)->tui.manipulator_hi[3] == 0) {
- for (bTheme *btheme = U.themes.first; btheme; btheme = btheme->next) {
- ui_theme_space_init_manipulator_colors(btheme);
- }
- }
-
if (U.pixelsize == 0.0f)
U.pixelsize = 1.0f;
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 530a6e28860..fc282e50ce2 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -51,6 +51,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_api.h"
@@ -1535,7 +1536,7 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
immBeginAtMost(GWN_PRIM_LINES, vertex_count);
@@ -1754,9 +1755,10 @@ View2DScrollers *UI_view2d_scrollers_calc(
scrollers->yclamp = yclamp;
scrollers->yunits = yunits;
- scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d,
- xunits, xclamp, yunits, yclamp,
- BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert));
+ scrollers->grid = UI_view2d_grid_calc(
+ CTX_data_scene(C), v2d,
+ xunits, xclamp, yunits, yclamp,
+ BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert));
}
/* return scrollers */
@@ -2131,12 +2133,14 @@ void UI_view2d_listview_visible_cells(
/* using 'cur' rect coordinates, call the cell-getting function to get the cells for this */
if (v2d) {
/* min */
- UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty,
- v2d->cur.xmin, v2d->cur.ymin, column_min, row_min);
+ UI_view2d_listview_view_to_cell(
+ v2d, columnwidth, rowheight, startx, starty,
+ v2d->cur.xmin, v2d->cur.ymin, column_min, row_min);
/* max*/
- UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty,
- v2d->cur.xmax, v2d->cur.ymax, column_max, row_max);
+ UI_view2d_listview_view_to_cell(
+ v2d, columnwidth, rowheight, startx, starty,
+ v2d->cur.xmax, v2d->cur.ymax, column_max, row_max);
}
}
@@ -2546,8 +2550,9 @@ void UI_view2d_text_cache_draw(ARegion *ar)
}
if (v2s->rect.xmin >= v2s->rect.xmax)
- BLF_draw_default((float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0,
- v2s->str, BLF_DRAW_STR_DUMMY_MAX);
+ BLF_draw_default(
+ (float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0,
+ v2s->str, BLF_DRAW_STR_DUMMY_MAX);
else {
BLF_enable(font_id, BLF_CLIPPING);
BLF_clipping(font_id, v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
@@ -2566,5 +2571,3 @@ void UI_view2d_text_cache_draw(ARegion *ar)
/* ******************************************************** */
-
-
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index b9e6d43aa87..dfc401c1635 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -33,6 +33,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
+#include "DNA_windowmanager_types.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
@@ -53,7 +54,7 @@
#include "PIL_time.h" /* USER_ZOOM_CONT */
-static int view2d_poll(bContext *C)
+static bool view2d_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
@@ -128,7 +129,7 @@ static int view_pan_init(bContext *C, wmOperator *op)
}
#ifdef WITH_INPUT_NDOF
-static int view_pan_poll(bContext *C)
+static bool view_pan_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d;
@@ -182,9 +183,10 @@ static void view_pan_apply(bContext *C, wmOperator *op)
{
v2dViewPanData *vpd = op->customdata;
- view_pan_apply_ex(C, vpd,
- RNA_int_get(op->ptr, "deltax"),
- RNA_int_get(op->ptr, "deltay"));
+ view_pan_apply_ex(
+ C, vpd,
+ RNA_int_get(op->ptr, "deltax"),
+ RNA_int_get(op->ptr, "deltay"));
}
@@ -604,7 +606,7 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op)
}
/* check if step-zoom can be applied */
-static int view_zoom_poll(bContext *C)
+static bool view_zoom_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
View2D *v2d;
@@ -735,9 +737,10 @@ static void view_zoomstep_apply_ex(
static void view_zoomstep_apply(bContext *C, wmOperator *op)
{
v2dViewZoomData *vzd = op->customdata;
- view_zoomstep_apply_ex(C, vzd, true,
- RNA_float_get(op->ptr, "zoomfacx"),
- RNA_float_get(op->ptr, "zoomfacy"));
+ view_zoomstep_apply_ex(
+ C, vzd, true,
+ RNA_float_get(op->ptr, "zoomfacx"),
+ RNA_float_get(op->ptr, "zoomfacy"));
}
/* --------------- Individual Operators ------------------- */
@@ -790,9 +793,10 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d,
- event->mval[0], event->mval[1],
- &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &ar->v2d,
+ event->mval[0], event->mval[1],
+ &vzd->mx_2d, &vzd->my_2d);
}
return view_zoomin_exec(C, op);
@@ -855,9 +859,10 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d,
- event->mval[0], event->mval[1],
- &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &ar->v2d,
+ event->mval[0], event->mval[1],
+ &vzd->mx_2d, &vzd->my_2d);
}
return view_zoomout_exec(C, op);
@@ -1065,9 +1070,10 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even
ARegion *ar = CTX_wm_region(C);
/* store initial mouse position (in view space) */
- UI_view2d_region_to_view(&ar->v2d,
- event->mval[0], event->mval[1],
- &vzd->mx_2d, &vzd->my_2d);
+ UI_view2d_region_to_view(
+ &ar->v2d,
+ event->mval[0], event->mval[1],
+ &vzd->mx_2d, &vzd->my_2d);
}
if (v2d->keepofs & V2D_LOCKOFS_X)
@@ -1354,9 +1360,10 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event)
vzd = op->customdata;
- view_zoomstep_apply_ex(C, vzd, false,
- do_zoom_xy[0] ? zoom_factor : 0.0f,
- do_zoom_xy[1] ? zoom_factor : 0.0f);
+ view_zoomstep_apply_ex(
+ C, vzd, false,
+ do_zoom_xy[0] ? zoom_factor : 0.0f,
+ do_zoom_xy[1] ? zoom_factor : 0.0f);
view_zoomstep_exit(op);
}
@@ -1401,14 +1408,18 @@ struct SmoothView2DStore {
*/
static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b)
{
- const float size_a[2] = {BLI_rctf_size_x(rect_a),
- BLI_rctf_size_y(rect_a)};
- const float size_b[2] = {BLI_rctf_size_x(rect_b),
- BLI_rctf_size_y(rect_b)};
- const float cent_a[2] = {BLI_rctf_cent_x(rect_a),
- BLI_rctf_cent_y(rect_a)};
- const float cent_b[2] = {BLI_rctf_cent_x(rect_b),
- BLI_rctf_cent_y(rect_b)};
+ const float size_a[2] = {
+ BLI_rctf_size_x(rect_a),
+ BLI_rctf_size_y(rect_a)};
+ const float size_b[2] = {
+ BLI_rctf_size_x(rect_b),
+ BLI_rctf_size_y(rect_b)};
+ const float cent_a[2] = {
+ BLI_rctf_cent_x(rect_a),
+ BLI_rctf_cent_y(rect_a)};
+ const float cent_b[2] = {
+ BLI_rctf_cent_x(rect_b),
+ BLI_rctf_cent_y(rect_b)};
float fac_max = 0.0f;
float tfac;
@@ -1667,6 +1678,21 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_
return SCROLLHANDLE_BAR;
}
+static bool scroller_activate_poll(bContext *C)
+{
+ if (!view2d_poll(C)) {
+ return false;
+ }
+
+ wmWindow *win = CTX_wm_window(C);
+ ARegion *ar = CTX_wm_region(C);
+ View2D *v2d = &ar->v2d;
+ wmEvent *event = win->eventstate;
+
+ /* check if mouse in scrollbars, if they're enabled */
+ return (UI_view2d_mouse_in_scrollers(ar, v2d, event->x, event->y) != 0);
+}
+
/* initialize customdata for scroller manipulation operator */
static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *event, short in_scroller)
{
@@ -1708,9 +1734,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1);
/* 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);
+ vsm->zone = mouse_in_scroller_handle(
+ event->mval[0],
+ v2d->hor.xmin, v2d->hor.xmax,
+ scrollers->hor_min, scrollers->hor_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
@@ -1729,9 +1756,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1);
/* 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);
+ vsm->zone = mouse_in_scroller_handle(
+ event->mval[1],
+ v2d->vert.ymin, v2d->vert.ymax,
+ scrollers->vert_min, scrollers->vert_max);
if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
/* default to scroll, as handles not usable */
@@ -1997,7 +2025,7 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
ot->modal = scroller_activate_modal;
ot->cancel = scroller_activate_cancel;
- ot->poll = view2d_poll;
+ ot->poll = scroller_activate_poll;
}
/* ********************************************************* */
@@ -2184,4 +2212,3 @@ void ED_keymap_view2d(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_in", PADPLUSKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "VIEW2D_OT_reset", HOMEKEY, KM_PRESS, 0, 0);
}
-
diff --git a/source/blender/editors/lattice/editlattice_tools.c b/source/blender/editors/lattice/editlattice_tools.c
index bf60c1e7da6..c6ba0237a68 100644
--- a/source/blender/editors/lattice/editlattice_tools.c
+++ b/source/blender/editors/lattice/editlattice_tools.c
@@ -56,7 +56,7 @@
/** \name Make Regular Operator
* \{ */
-static int make_regular_poll(bContext *C)
+static bool make_regular_poll(bContext *C)
{
Object *ob;
diff --git a/source/blender/editors/manipulator_library/manipulator_draw_utils.c b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
index 430841311aa..a0b226b7502 100644
--- a/source/blender/editors/manipulator_library/manipulator_draw_utils.c
+++ b/source/blender/editors/manipulator_library/manipulator_draw_utils.c
@@ -41,6 +41,7 @@
#include "GPU_batch.h"
#include "GPU_glew.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "MEM_guardedalloc.h"
@@ -104,13 +105,13 @@ void wm_manipulator_geometryinfo_draw(const ManipulatorGeomInfo *info, const boo
* since it causes issues leaving the GL state modified. */
#if 0
glEnable(GL_CULL_FACE);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
#endif
GWN_batch_draw(batch);
#if 0
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
glDisable(GL_CULL_FACE);
#endif
diff --git a/source/blender/editors/manipulator_library/manipulator_library_intern.h b/source/blender/editors/manipulator_library/manipulator_library_intern.h
index 01ca217fc0a..55db99236e0 100644
--- a/source/blender/editors/manipulator_library/manipulator_library_intern.h
+++ b/source/blender/editors/manipulator_library/manipulator_library_intern.h
@@ -109,4 +109,3 @@ void wm_manipulator_vec_draw(
#endif /* __MANIPULATOR_LIBRARY_INTERN_H__ */
-
diff --git a/source/blender/editors/manipulator_library/manipulator_library_presets.c b/source/blender/editors/manipulator_library/manipulator_library_presets.c
index cccf484f29d..12f07611722 100644
--- a/source/blender/editors/manipulator_library/manipulator_library_presets.c
+++ b/source/blender/editors/manipulator_library/manipulator_library_presets.c
@@ -148,4 +148,3 @@ void ED_manipulator_draw_preset_facemap(
GPU_select_load_id(-1);
}
}
-
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
index 749e92e25fb..5acf1ab2d64 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/arrow2d_manipulator.c
@@ -44,6 +44,7 @@
#include "GPU_draw.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "MEM_guardedalloc.h"
@@ -103,20 +104,20 @@ static void manipulator_arrow2d_draw(const bContext *UNUSED(C), wmManipulator *m
manipulator_color_get(mpr, mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT, color);
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
WM_manipulator_calc_matrix_final(mpr, matrix_final);
- glEnable(GL_BLEND);
+ GPU_blend(true);
arrow2d_draw_geom(mpr, matrix_final, color);
- glDisable(GL_BLEND);
+ GPU_blend(false);
if (mpr->interaction_data) {
ManipulatorInteraction *inter = mpr->interaction_data;
- glEnable(GL_BLEND);
+ GPU_blend(true);
arrow2d_draw_geom(mpr, inter->init_matrix_final, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f});
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
index 8516b9d8244..a5bcef7ed5e 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
@@ -51,6 +51,7 @@
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_select.h"
+#include "GPU_state.h"
#include "MEM_guardedalloc.h"
@@ -118,7 +119,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
{-unitx, unity, 0},
};
- glLineWidth(arrow->manipulator.line_width);
+ GPU_line_width(arrow->manipulator.line_width);
wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_LOOP);
}
else {
@@ -133,7 +134,7 @@ static void arrow_draw_geom(const ArrowManipulator3D *arrow, const bool select,
};
if (draw_options & ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM) {
- glLineWidth(arrow->manipulator.line_width);
+ GPU_line_width(arrow->manipulator.line_width);
wm_manipulator_vec_draw(color, vec, ARRAY_SIZE(vec), pos, GWN_PRIM_LINE_STRIP);
}
else {
@@ -197,9 +198,9 @@ static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, cons
gpuPushMatrix();
gpuMultMatrix(matrix_final);
- glEnable(GL_BLEND);
+ GPU_blend(true);
arrow_draw_geom(arrow, select, color);
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
@@ -210,9 +211,9 @@ static void arrow_draw_intern(ArrowManipulator3D *arrow, const bool select, cons
gpuMultMatrix(inter->init_matrix_final);
- glEnable(GL_BLEND);
+ GPU_blend(true);
arrow_draw_geom(arrow, select, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f});
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
}
diff --git a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
index 86c3b4a09de..db33f457056 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/button2d_manipulator.c
@@ -45,6 +45,7 @@
#include "GPU_matrix.h"
#include "GPU_select.h"
#include "GPU_batch.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -80,7 +81,7 @@ typedef struct ButtonManipulator2D {
static void button2d_geom_draw_backdrop(
const wmManipulator *mpr, const float color[4], const bool select)
{
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
Gwn_VertFormat *format = immVertexFormat();
uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -138,7 +139,7 @@ static void button2d_draw_intern(
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(color);
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
immUniformColor4fv(color);
immBegin(GWN_PRIM_LINE_STRIP, 2);
immVertex3fv(pos, matrix_final[3]);
@@ -168,11 +169,11 @@ static void button2d_draw_intern(
}
else {
- glEnable(GL_BLEND);
+ GPU_blend(true);
if (button->shape_batch[0] != NULL) {
- glEnable(GL_LINE_SMOOTH);
- glDisable(GL_POLYGON_SMOOTH);
- glLineWidth(1.0f);
+ GPU_line_smooth(true);
+ GPU_polygon_smooth(false);
+ GPU_line_width(1.0f);
for (uint i = 0; i < ARRAY_SIZE(button->shape_batch) && button->shape_batch[i]; i++) {
/* Invert line color for wire. */
GWN_batch_program_set_builtin(button->shape_batch[i], GPU_SHADER_2D_UNIFORM_COLOR);
@@ -185,8 +186,8 @@ static void button2d_draw_intern(
color[2] = 1.0f - color[2];
}
}
- glDisable(GL_LINE_SMOOTH);
- glEnable(GL_POLYGON_SMOOTH);
+ GPU_line_smooth(false);
+ GPU_polygon_smooth(true);
}
else if (button->icon != ICON_NONE) {
button2d_geom_draw_backdrop(mpr, color, select);
@@ -206,7 +207,7 @@ static void button2d_draw_intern(
}
UI_icon_draw(size[0], size[1], button->icon);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (need_to_pop) {
@@ -224,9 +225,9 @@ static void manipulator_button2d_draw(const bContext *C, wmManipulator *mpr)
{
const bool is_highlight = (mpr->state & WM_MANIPULATOR_STATE_HIGHLIGHT) != 0;
- glEnable(GL_BLEND);
+ GPU_blend(true);
button2d_draw_intern(C, mpr, false, is_highlight);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static int manipulator_button2d_test_select(
diff --git a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
index fe748f33d35..b7b19ccd634 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/cage2d_manipulator.c
@@ -49,6 +49,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_select.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -420,7 +421,7 @@ static void cage2d_draw_box_interaction(
}
else {
BLI_assert(ELEM(prim_type, GWN_PRIM_LINE_STRIP, GWN_PRIM_LINES));
- glLineWidth(line_width + 3.0f);
+ GPU_line_width(line_width + 3.0f);
immBegin(prim_type, verts_len);
immAttrib3f(attr_id.col, 0.0f, 0.0f, 0.0f);
@@ -429,7 +430,7 @@ static void cage2d_draw_box_interaction(
}
immEnd();
- glLineWidth(line_width);
+ GPU_line_width(line_width);
immBegin(prim_type, verts_len);
immAttrib3fv(attr_id.col, color);
@@ -558,14 +559,14 @@ static void manipulator_cage2d_draw_intern(
/* Handy for quick testing draw (if it's outside bounds). */
if (false) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv((const float[4]){1, 1, 1, 0.5f});
float s = 0.5f;
immRectf(pos, -s, -s, s, s);
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (select) {
@@ -610,13 +611,13 @@ static void manipulator_cage2d_draw_intern(
};
if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_BOX) {
/* corner manipulators */
- glLineWidth(mpr->line_width + 3.0f);
+ GPU_line_width(mpr->line_width + 3.0f);
cage2d_draw_box_corners(&r, margin, (const float[3]){0, 0, 0});
/* corner manipulators */
float color[4];
manipulator_color_get(mpr, highlight, color);
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
cage2d_draw_box_corners(&r, margin, color);
bool show = false;
@@ -645,12 +646,12 @@ static void manipulator_cage2d_draw_intern(
float color[4];
manipulator_color_get(mpr, highlight, color);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
- glLineWidth(mpr->line_width + 3.0f);
+ GPU_line_width(mpr->line_width + 3.0f);
cage2d_draw_circle_wire(&r, margin, (const float[3]){0, 0, 0}, transform_flag, draw_options);
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
cage2d_draw_circle_wire(&r, margin, color, transform_flag, draw_options);
@@ -658,15 +659,15 @@ static void manipulator_cage2d_draw_intern(
cage2d_draw_circle_handles(&r, margin, color, transform_flag, true);
cage2d_draw_circle_handles(&r, margin, (const float[3]){0, 0, 0}, transform_flag, false);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
}
else {
BLI_assert(0);
}
}
- glLineWidth(1.0);
+ GPU_line_width(1.0);
gpuPopMatrix();
}
diff --git a/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c
index 6c2e2bd564d..a907816b08f 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/cage3d_manipulator.c
@@ -48,6 +48,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_select.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -303,14 +304,14 @@ static void manipulator_cage3d_draw_intern(
/* Handy for quick testing draw (if it's outside bounds). */
if (false) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv((const float[4]){1, 1, 1, 0.5f});
float s = 0.5f;
immRectf(pos, -s, -s, s, s);
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (select) {
@@ -358,13 +359,13 @@ static void manipulator_cage3d_draw_intern(
#endif
if (draw_style == ED_MANIPULATOR_CAGE2D_STYLE_BOX) {
/* corner manipulators */
- glLineWidth(mpr->line_width + 3.0f);
+ GPU_line_width(mpr->line_width + 3.0f);
cage3d_draw_box_corners(size_real, margin, (const float[3]){0, 0, 0});
/* corner manipulators */
float color[4];
manipulator_color_get(mpr, highlight, color);
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
cage3d_draw_box_corners(size_real, margin, color);
bool show = false;
@@ -388,29 +389,29 @@ static void manipulator_cage3d_draw_intern(
float color[4];
manipulator_color_get(mpr, highlight, color);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_POLYGON_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_polygon_smooth(true);
+ GPU_blend(true);
- glLineWidth(mpr->line_width + 3.0f);
+ GPU_line_width(mpr->line_width + 3.0f);
cage3d_draw_circle_wire(size_real, margin, (const float[3]){0, 0, 0}, transform_flag, draw_options);
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
cage3d_draw_circle_wire(size_real, margin, color, transform_flag, draw_options);
/* corner manipulators */
cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, (const float[3]){0, 0, 0}, true, 60);
cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, color, true, 40);
- glDisable(GL_BLEND);
- glDisable(GL_POLYGON_SMOOTH);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_polygon_smooth(false);
+ GPU_line_smooth(false);
}
else {
BLI_assert(0);
}
}
- glLineWidth(1.0);
+ GPU_line_width(1.0);
gpuPopMatrix();
}
diff --git a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
index 643a379cbb0..74ba8bd77a9 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
@@ -51,6 +51,7 @@
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_select.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -123,7 +124,7 @@ static void dial_geom_draw(
const int draw_options = RNA_enum_get(mpr->ptr, "draw_options");
const bool filled = (draw_options & ED_MANIPULATOR_DIAL_DRAW_FLAG_FILL) != 0;
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
Gwn_VertFormat *format = immVertexFormat();
uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -158,7 +159,7 @@ static void dial_geom_draw(
*/
static void dial_ghostarc_draw_helpline(const float angle, const float co_outer[3], const float color[4])
{
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
gpuPushMatrix();
gpuRotate3f(RAD2DEGF(angle), 0.0f, 0.0f, -1.0f);
@@ -313,9 +314,9 @@ static void dial_draw_intern(
/* draw! */
for (int i = 0; i < 2; i++) {
- glDisable(GL_POLYGON_SMOOTH);
+ GPU_polygon_smooth(false);
dial_ghostarc_draw(mpr, angle_ofs, angle_delta, (const float[4]){0.8f, 0.8f, 0.8f, 0.4f});
- glEnable(GL_POLYGON_SMOOTH);
+ GPU_polygon_smooth(true);
dial_ghostarc_draw_helpline(angle_ofs, co_outer, color); /* starting position */
dial_ghostarc_draw_helpline(angle_ofs + angle_delta, co_outer, color); /* starting position + current value */
@@ -382,9 +383,9 @@ static void manipulator_dial_draw(const bContext *C, wmManipulator *mpr)
glEnable(GL_CLIP_DISTANCE0);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
dial_draw_intern(C, mpr, false, is_highlight, clip_plane);
- glDisable(GL_BLEND);
+ GPU_blend(false);
if (clip_plane) {
glDisable(GL_CLIP_DISTANCE0);
diff --git a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
index e2d1979b7a6..458dc2fd1c8 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
@@ -46,6 +46,7 @@
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_select.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -102,7 +103,7 @@ static void grab_geom_draw(
const int draw_style = RNA_enum_get(mpr->ptr, "draw_style");
const bool filled = (draw_options & ED_MANIPULATOR_GRAB_DRAW_FLAG_FILL) != 0;
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
Gwn_VertFormat *format = immVertexFormat();
uint pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -188,9 +189,9 @@ static void grab3d_draw_intern(
gpuMultMatrix(matrix_align);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
grab_geom_draw(mpr, color, select, draw_options);
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
if (mpr->interaction_data) {
@@ -201,9 +202,9 @@ static void grab3d_draw_intern(
gpuMultMatrix(matrix_align);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
grab_geom_draw(mpr, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}, select, draw_options);
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
}
}
@@ -221,9 +222,9 @@ static void manipulator_grab_draw(const bContext *C, wmManipulator *mpr)
(void)is_modal;
- glEnable(GL_BLEND);
+ GPU_blend(true);
grab3d_draw_intern(C, mpr, false, is_highlight);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static int manipulator_grab_modal(
diff --git a/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c
index 531cf742e6f..419873ccfff 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/primitive3d_manipulator.c
@@ -42,6 +42,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
#include "GPU_select.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -101,9 +102,9 @@ static void manipulator_primitive_draw_intern(
gpuPushMatrix();
gpuMultMatrix(matrix_final);
- glEnable(GL_BLEND);
+ GPU_blend(true);
manipulator_primitive_draw_geom(color_inner, color_outer, draw_style);
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
@@ -117,9 +118,9 @@ static void manipulator_primitive_draw_intern(
gpuPushMatrix();
gpuMultMatrix(inter->init_matrix_final);
- glEnable(GL_BLEND);
+ GPU_blend(true);
manipulator_primitive_draw_geom(color_inner, color_outer, draw_style);
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
}
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index 689a96a3dec..6b5fce26deb 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -56,6 +56,7 @@
#include "GPU_draw.h"
#include "GPU_shader.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -132,7 +133,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
/* this could be split into its own loop */
if (draw_type == MASK_DT_OUTLINE) {
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, point_pos);
immVertex2fv(pos, handle_pos);
@@ -152,7 +153,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
break;
}
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBegin(GWN_PRIM_LINES, 2);
immVertex2fv(pos, point_pos);
immVertex2fv(pos, handle_pos);
@@ -262,7 +263,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline
immUnbindProgram();
if (is_smooth) {
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
}
/* control points */
@@ -329,7 +330,7 @@ static void draw_spline_points(const bContext *C, MaskLayer *masklay, MaskSpline
}
if (is_smooth) {
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
if (is_spline_sel) {
@@ -412,13 +413,13 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (*
*/
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
mask_color_active_tint(rgb_tmp, rgb_black, is_active);
immUniformColor4ubv(rgb_tmp);
mask_draw_array(pos, draw_method, points, tot_point);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
mask_color_active_tint(rgb_tmp, rgb_spline, is_active);
immUniformColor4ubv(rgb_tmp);
@@ -430,7 +431,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (*
case MASK_DT_BLACK:
case MASK_DT_WHITE:
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
if (draw_type == MASK_DT_BLACK) { rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 0; }
else { rgb_tmp[0] = rgb_tmp[1] = rgb_tmp[2] = 255; }
@@ -456,7 +457,7 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (*
* probably better with geometry shader (after core profile switch)
*/
#if 0
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE);
GPU_basic_shader_line_stipple(3, 0xAAAA);
@@ -508,7 +509,7 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline
return;
if (is_smooth) {
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
}
feather_points = BKE_mask_spline_feather_differentiated_points_with_resolution(spline, &tot_feather_point, resol, (is_fill != false));
@@ -547,15 +548,15 @@ static void draw_spline_curve(const bContext *C, MaskLayer *masklay, MaskSpline
MEM_freeN(diff_points);
if (is_smooth) {
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
}
static void draw_masklays(const bContext *C, Mask *mask, const char draw_flag, const char draw_type,
const int width, const int height)
{
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
GPU_enable_program_point_size();
MaskLayer *masklay;
@@ -592,7 +593,7 @@ static void draw_masklays(const bContext *C, Mask *mask, const char draw_flag, c
}
GPU_disable_program_point_size();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
void ED_mask_draw(const bContext *C,
@@ -690,8 +691,8 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
/* More blending types could be supported in the future. */
- glEnable(GL_BLEND);
- glBlendFunc(GL_DST_COLOR, GL_ZERO);
+ GPU_blend(true);
+ GPU_blend_set_func(GPU_DST_COLOR, GPU_ZERO);
}
gpuPushMatrix();
@@ -707,7 +708,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar,
gpuPopMatrix();
if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
MEM_freeN(buffer);
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index 9a2635c37d2..85f5836ecd7 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -57,7 +57,7 @@
/********************** generic poll functions *********************/
-int ED_maskedit_poll(bContext *C)
+bool ED_maskedit_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if (sa) {
@@ -73,7 +73,7 @@ int ED_maskedit_poll(bContext *C)
return false;
}
-int ED_maskedit_mask_poll(bContext *C)
+bool ED_maskedit_mask_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if (sa) {
@@ -540,6 +540,7 @@ void ED_keymap_mask(wmKeyConfig *keyconf)
/* geometry */
WM_keymap_add_item(keymap, "MASK_OT_add_vertex_slide", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MASK_OT_add_feather_vertex_slide", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0);
+
WM_keymap_add_item(keymap, "MASK_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MASK_OT_delete", DELKEY, KM_PRESS, 0, 0);
@@ -594,7 +595,11 @@ void ED_keymap_mask(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MASK_OT_slide_point", ACTIONMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MASK_OT_slide_spline_curvature", ACTIONMOUSE, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MASK_OT_handle_type_set", VKEY, KM_PRESS, 0, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "MASK_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
+#else
+ WM_keymap_add_item(keymap, "MASK_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT, 0);
+#endif
// WM_keymap_add_item(keymap, "MASK_OT_feather_weight_clear", SKEY, KM_PRESS, KM_ALT, 0);
/* ... matches curve editmode */
diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c
index 364800ed1a2..771deca69b6 100644
--- a/source/blender/editors/mask/mask_editaction.c
+++ b/source/blender/editors/mask/mask_editaction.c
@@ -336,4 +336,3 @@ void ED_masklayer_snap_frames(MaskLayer *masklay, Scene *scene, short mode)
break;
}
}
-
diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h
index 66a6c75272e..e9ef06a368f 100644
--- a/source/blender/editors/mask/mask_intern.h
+++ b/source/blender/editors/mask/mask_intern.h
@@ -121,8 +121,8 @@ void ED_mask_select_toggle_all(struct Mask *mask, int action);
void ED_mask_select_flush_all(struct Mask *mask);
/* mask_editor.c */
-int ED_maskedit_poll(struct bContext *C);
-int ED_maskedit_mask_poll(struct bContext *C);
+bool ED_maskedit_poll(struct bContext *C);
+bool ED_maskedit_mask_poll(struct bContext *C);
/* mask_shapekey.c */
void MASK_OT_shape_key_insert(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c
index b6ac23a37e8..a93ef4405dc 100644
--- a/source/blender/editors/mask/mask_ops.c
+++ b/source/blender/editors/mask/mask_ops.c
@@ -2106,7 +2106,7 @@ void MASK_OT_feather_weight_clear(wmOperatorType *ot)
/******************** move mask layer operator *********************/
-static int mask_layer_move_poll(bContext *C)
+static bool mask_layer_move_poll(bContext *C)
{
if (ED_maskedit_mask_poll(C)) {
Mask *mask = CTX_data_edit_mask(C);
@@ -2335,7 +2335,7 @@ void MASK_OT_copy_splines(wmOperatorType *ot)
/********************** paste tracks from clipboard operator *********************/
-static int paste_splines_poll(bContext *C)
+static bool paste_splines_poll(bContext *C)
{
if (ED_maskedit_mask_poll(C)) {
return BKE_mask_clipboard_is_empty() == false;
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index cf4d8ebf05d..405c19f1c1d 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -33,13 +33,14 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
+#include "DNA_meshdata_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
-#include "BKE_DerivedMesh.h"
+#include "BKE_context.h"
+#include "BKE_customdata.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
-#include "BKE_context.h"
#include "BIF_gl.h"
@@ -61,7 +62,7 @@
void paintface_flush_flags(Object *ob, short flag)
{
Mesh *me = BKE_mesh_from_object(ob);
- DerivedMesh *dm = ob->derivedFinal;
+ Mesh *me_eval = ob->runtime.mesh_eval;
MPoly *polys, *mp_orig;
const int *index_array = NULL;
int totpoly;
@@ -80,14 +81,14 @@ void paintface_flush_flags(Object *ob, short flag)
BKE_mesh_flush_select_from_polys(me);
}
- if (dm == NULL)
+ if (me_eval == NULL)
return;
/* Mesh polys => Final derived polys */
- if ((index_array = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX))) {
- polys = dm->getPolyArray(dm);
- totpoly = dm->getNumPolys(dm);
+ if ((index_array = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX))) {
+ polys = me_eval->mpoly;
+ totpoly = me_eval->totpoly;
/* loop over final derived polys */
for (i = 0; i < totpoly; i++) {
@@ -474,8 +475,8 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, bool select, bool exten
void paintvert_flush_flags(Object *ob)
{
Mesh *me = BKE_mesh_from_object(ob);
- DerivedMesh *dm = ob->derivedFinal;
- MVert *dm_mvert, *dm_mv;
+ Mesh *me_eval = ob->runtime.mesh_eval;
+ MVert *mvert_eval, *mv;
const int *index_array = NULL;
int totvert;
int i;
@@ -487,28 +488,28 @@ void paintvert_flush_flags(Object *ob)
* since this could become slow for realtime updates (circle-select for eg) */
BKE_mesh_flush_select_from_verts(me);
- if (dm == NULL)
+ if (me_eval == NULL)
return;
- index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
+ index_array = CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX);
- dm_mvert = dm->getVertArray(dm);
- totvert = dm->getNumVerts(dm);
+ mvert_eval = me_eval->mvert;
+ totvert = me_eval->totvert;
- dm_mv = dm_mvert;
+ mv = mvert_eval;
if (index_array) {
int orig_index;
- for (i = 0; i < totvert; i++, dm_mv++) {
+ for (i = 0; i < totvert; i++, mv++) {
orig_index = index_array[i];
if (orig_index != ORIGINDEX_NONE) {
- dm_mv->flag = me->mvert[index_array[i]].flag;
+ mv->flag = me->mvert[index_array[i]].flag;
}
}
}
else {
- for (i = 0; i < totvert; i++, dm_mv++) {
- dm_mv->flag = me->mvert[i].flag;
+ for (i = 0; i < totvert; i++, mv++) {
+ mv->flag = me->mvert[i].flag;
}
}
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c
index d92d655641f..f6b69beac71 100644
--- a/source/blender/editors/mesh/editmesh_bevel.c
+++ b/source/blender/editors/mesh/editmesh_bevel.c
@@ -132,7 +132,7 @@ static void edbm_bevel_update_header(bContext *C, wmOperator *op)
WM_bool_as_string(opdata->value_mode == PROFILE_VALUE),
offset_str, RNA_int_get(op->ptr, "segments"), RNA_float_get(op->ptr, "profile"));
- ED_area_headerprint(sa, msg);
+ ED_area_status_text(sa, msg);
}
}
@@ -364,7 +364,7 @@ static void edbm_bevel_exit(bContext *C, wmOperator *op)
ScrArea *sa = CTX_wm_area(C);
if (sa) {
- ED_area_headerprint(sa, NULL);
+ ED_area_status_text(sa, NULL);
}
if (opdata->is_modal) {
@@ -775,7 +775,7 @@ void MESH_OT_bevel(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_CURSOR | OPTYPE_BLOCKING;
RNA_def_enum(ot->srna, "offset_type", offset_type_items, 0, "Amount Type", "What distance Amount measures");
- prop = RNA_def_float(ot->srna, "offset", 0.0f, -1e6f, 1e6f, "Amount", "", 0.0f, 1.0f);
+ prop = RNA_def_float(ot->srna, "offset", 0.0f, -1e6f, 1e6f, "Amount", "", 0.0f, 100.0f);
RNA_def_property_float_array_funcs_runtime(prop, NULL, NULL, mesh_ot_bevel_offset_range_func);
RNA_def_int(ot->srna, "segments", 1, 1, SEGMENTS_HARD_MAX, "Segments", "Segments for curved edge", 1, 8);
RNA_def_float(ot->srna, "profile", 0.5f, PROFILE_HARD_MIN, 1.0f, "Profile",
diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c
index ee06f7abd2b..568983e47ee 100644
--- a/source/blender/editors/mesh/editmesh_bisect.c
+++ b/source/blender/editors/mesh/editmesh_bisect.c
@@ -160,7 +160,7 @@ static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
v3d->twflag = 0;
/* initialize modal callout */
- ED_area_headerprint(CTX_wm_area(C), IFACE_("LMB: Click and drag to draw cut line"));
+ ED_workspace_status_text(C, IFACE_("LMB: Click and drag to draw cut line"));
}
return ret;
}
@@ -185,10 +185,10 @@ static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* update or clear modal callout */
if (event->type == EVT_MODAL_MAP) {
if (event->val == GESTURE_MODAL_BEGIN) {
- ED_area_headerprint(CTX_wm_area(C), IFACE_("LMB: Release to confirm cut line"));
+ ED_workspace_status_text(C, IFACE_("LMB: Release to confirm cut line"));
}
else {
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
}
}
@@ -368,7 +368,8 @@ void MESH_OT_bisect(struct wmOperatorType *ot)
RNA_def_boolean(ot->srna, "clear_inner", false, "Clear Inner", "Remove geometry behind the plane");
RNA_def_boolean(ot->srna, "clear_outer", false, "Clear Outer", "Remove geometry in front of the plane");
- RNA_def_float(ot->srna, "threshold", 0.0001, 0.0, 10.0, "Axis Threshold", "", 0.00001, 0.1);
+ RNA_def_float(ot->srna, "threshold", 0.0001, 0.0, 10.0, "Axis Threshold",
+ "Preserves the existing geometry along the cut plane", 0.00001, 0.1);
WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT);
diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c
index 4841de3c856..be68bfda09c 100644
--- a/source/blender/editors/mesh/editmesh_extrude.c
+++ b/source/blender/editors/mesh/editmesh_extrude.c
@@ -480,7 +480,7 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula
for (int i = 0; i < 4; i++) {
PointerRNA *ptr = WM_manipulator_operator_set(man->invoke_xyz_no[i], 0, man->ot_extrude, NULL);
{
- int constraint[3] = {0, 0, 0};
+ bool constraint[3] = {0, 0, 0};
constraint[MIN2(i, 2)] = 1;
PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate");
RNA_boolean_set(&macroptr, "release_confirm", true);
@@ -492,7 +492,7 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula
for (int i = 0; i < 4; i++) {
PointerRNA *ptr = WM_manipulator_operator_set(man->adjust_xyz_no[i], 0, man->ot_extrude, NULL);
{
- int constraint[3] = {0, 0, 0};
+ bool constraint[3] = {0, 0, 0};
constraint[MIN2(i, 2)] = 1;
PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate");
RNA_boolean_set(&macroptr, "release_confirm", true);
@@ -588,7 +588,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro
wmOperator *op_transform = op->macro.last;
float value[4];
RNA_float_get_array(op_transform->ptr, "value", value);
- int constraint_axis[3];
+ bool constraint_axis[3];
RNA_boolean_get_array(op_transform->ptr, "constraint_axis", constraint_axis);
int orientation_type = RNA_enum_get(op_transform->ptr, "constraint_orientation");
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 985d873dfc2..8758fa66a14 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -112,7 +112,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
WM_bool_as_string(RNA_boolean_get(op->ptr, "use_individual"))
);
- ED_area_headerprint(sa, msg);
+ ED_area_status_text(sa, msg);
}
}
@@ -202,7 +202,7 @@ static void edbm_inset_exit(bContext *C, wmOperator *op)
}
if (sa) {
- ED_area_headerprint(sa, NULL);
+ ED_area_status_text(sa, NULL);
}
MEM_SAFE_FREE(opdata->ob_store);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index be54bba7aa4..a511100ff4e 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -48,7 +48,7 @@
#include "BLT_translation.h"
-#include "BKE_DerivedMesh.h"
+#include "BKE_bvhutils.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
#include "BKE_editmesh_bvh.h"
@@ -58,6 +58,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_screen.h"
#include "ED_space_api.h"
@@ -301,7 +302,7 @@ static void knife_update_header(bContext *C, wmOperator *op, KnifeTool_OpData *k
#undef WM_MODALKEY
- ED_area_headerprint(CTX_wm_area(C), header);
+ ED_workspace_status_text(C, header);
}
static void knife_project_v2(const KnifeTool_OpData *kcd, const float co[3], float sco[2])
@@ -1010,7 +1011,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_TRANSFORM);
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, v1);
@@ -1041,7 +1042,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
View3D *v3d = CTX_wm_view3d(C);
const KnifeTool_OpData *kcd = arg;
- if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) GPU_depth_test(false);
glPolygonOffset(1.0f, 1.0f);
@@ -1057,7 +1058,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
knifetool_draw_angle_snapping(kcd);
immUniformColor3ubv(kcd->colors.line);
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, kcd->prev.cage);
@@ -1067,7 +1068,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->prev.vert) {
immUniformColor3ubv(kcd->colors.point);
- glPointSize(11);
+ GPU_point_size(11);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
@@ -1076,7 +1077,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->prev.bmface) {
immUniformColor3ubv(kcd->colors.curpoint);
- glPointSize(9);
+ GPU_point_size(9);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->prev.cage);
@@ -1085,7 +1086,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->curr.edge) {
immUniformColor3ubv(kcd->colors.edge);
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex3fv(pos, kcd->curr.edge->v1->cageco);
@@ -1094,7 +1095,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
}
else if (kcd->curr.vert) {
immUniformColor3ubv(kcd->colors.point);
- glPointSize(11);
+ GPU_point_size(11);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->curr.cage);
@@ -1103,7 +1104,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if (kcd->curr.bmface) {
immUniformColor3ubv(kcd->colors.curpoint);
- glPointSize(9);
+ GPU_point_size(9);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(pos, kcd->curr.cage);
@@ -1114,12 +1115,12 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
KnifeLineHit *lh;
int i;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* draw any snapped verts first */
immUniformColor4ubv(kcd->colors.point_a);
- glPointSize(11);
+ GPU_point_size(11);
immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit);
@@ -1134,7 +1135,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
/* now draw the rest */
immUniformColor4ubv(kcd->colors.curpoint_a);
- glPointSize(7);
+ GPU_point_size(7);
immBeginAtMost(GWN_PRIM_POINTS, kcd->totlinehit);
@@ -1147,7 +1148,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (kcd->totkedge > 0) {
@@ -1155,7 +1156,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
KnifeEdge *kfe;
immUniformColor3ubv(kcd->colors.line);
- glLineWidth(1.0);
+ GPU_line_width(1.0);
immBeginAtMost(GWN_PRIM_LINES, BLI_mempool_len(kcd->kedges) * 2);
@@ -1176,7 +1177,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
KnifeVert *kfv;
immUniformColor3ubv(kcd->colors.point);
- glPointSize(5.0);
+ GPU_point_size(5.0);
immBeginAtMost(GWN_PRIM_POINTS, BLI_mempool_len(kcd->kverts));
@@ -1195,7 +1196,7 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
gpuPopMatrix();
- if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) GPU_depth_test(true);
}
/**
@@ -2787,7 +2788,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (!obedit || obedit->type != OB_MESH || BKE_editmesh_from_object(obedit) != kcd->em) {
knifetool_exit(C, op);
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_FINISHED;
}
@@ -2808,7 +2809,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
ED_region_tag_redraw(kcd->ar);
knifetool_exit(C, op);
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
case KNF_MODAL_CONFIRM:
@@ -2817,7 +2818,7 @@ static int knifetool_modal(bContext *C, wmOperator *op, const wmEvent *event)
knifetool_finish(op);
knifetool_exit(C, op);
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_FINISHED;
case KNF_MODAL_MIDPOINT_ON:
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 7dac9a09b97..8493d15a3b1 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -48,6 +48,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "UI_interface.h"
@@ -112,7 +113,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
if ((lcd->totedge > 0) || (lcd->totpoint > 0)) {
if (v3d && v3d->zbuf)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
gpuPushMatrix();
gpuMultMatrix(lcd->ob->obmat);
@@ -134,7 +135,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
}
if (lcd->totpoint > 0) {
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
immBegin(GWN_PRIM_POINTS, lcd->totpoint);
@@ -150,7 +151,7 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
gpuPopMatrix();
if (v3d && v3d->zbuf)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
@@ -692,7 +693,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
{
Scene *scene = CTX_data_scene(C);
ToolSettings *settings = scene->toolsettings;
- const int mesh_select_mode[3] = {
+ const bool mesh_select_mode[3] = {
(settings->selectmode & SCE_SELECT_VERTEX) != 0,
(settings->selectmode & SCE_SELECT_EDGE) != 0,
(settings->selectmode & SCE_SELECT_FACE) != 0,
@@ -703,8 +704,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
#endif
if (is_interactive) {
- ScrArea *sa = CTX_wm_area(C);
- ED_area_headerprint(sa, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, "
+ ED_workspace_status_text(C, IFACE_("Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, "
"hold Alt for smooth"));
return OPERATOR_RUNNING_MODAL;
}
@@ -729,7 +729,7 @@ static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
{
/* finish */
ED_region_tag_redraw(lcd->ar);
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
if (lcd->eed) {
/* set for redo */
@@ -785,14 +785,14 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
case RIGHTMOUSE: /* abort */ // XXX hardcoded
ED_region_tag_redraw(lcd->ar);
ringsel_exit(C, op);
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
case ESCKEY:
if (event->val == KM_RELEASE) {
/* cancel */
ED_region_tag_redraw(lcd->ar);
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
ringcut_cancel(C, op);
return OPERATOR_CANCELLED;
@@ -897,7 +897,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
BLI_snprintf(buf, sizeof(buf), IFACE_("Number of Cuts: %s, Smooth: %s (Alt)"),
str_rep, str_rep + NUM_STR_REP_LEN);
- ED_area_headerprint(CTX_wm_area(C), buf);
+ ED_workspace_status_text(C, buf);
}
/* keep going until the user confirms */
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 99a95c27b7b..2e7cf1fc76f 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -4204,7 +4204,7 @@ void MESH_OT_select_random(wmOperatorType *ot)
/** \name Select Ungrouped Operator
* \{ */
-static int edbm_select_ungrouped_poll(bContext *C)
+static bool edbm_select_ungrouped_poll(bContext *C)
{
if (ED_operator_editmesh(C)) {
Object *obedit = CTX_data_edit_object(C);
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 15840f8f9d6..f8c1db30276 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -4360,11 +4360,13 @@ void MESH_OT_fill_grid(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop = RNA_def_int(ot->srna, "span", 1, 1, 1000, "Span", "Number of sides (zero disables)", 1, 100);
+ prop = RNA_def_int(ot->srna, "span", 1, 1, 1000, "Span", "Number of grid columns", 1, 100);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- prop = RNA_def_int(ot->srna, "offset", 0, -1000, 1000, "Offset", "Number of sides (zero disables)", -100, 100);
+ prop = RNA_def_int(ot->srna, "offset", 0, -1000, 1000, "Offset",
+ "Vertex that is the corner of the grid", -100, 100);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- RNA_def_boolean(ot->srna, "use_interp_simple", false, "Simple Blending", "");
+ RNA_def_boolean(ot->srna, "use_interp_simple", false, "Simple Blending",
+ "Use simple interpolation of grid vertices");
}
/** \} */
@@ -6616,7 +6618,8 @@ void MESH_OT_symmetrize(struct wmOperatorType *ot)
ot->srna, "direction", rna_enum_symmetrize_direction_items,
BMO_SYMMETRIZE_NEGATIVE_X,
"Direction", "Which sides to copy from and to");
- RNA_def_float(ot->srna, "threshold", 1e-4f, 0.0f, 10.0f, "Threshold", "", 1e-5f, 0.1f);
+ RNA_def_float(ot->srna, "threshold", 1e-4f, 0.0f, 10.0f, "Threshold",
+ "Limit for snap middle vertices to the axis center", 1e-5f, 0.1f);
}
/** \} */
@@ -6747,9 +6750,11 @@ void MESH_OT_symmetry_snap(struct wmOperatorType *ot)
ot->srna, "direction", rna_enum_symmetrize_direction_items,
BMO_SYMMETRIZE_NEGATIVE_X,
"Direction", "Which sides to copy from and to");
- RNA_def_float_distance(ot->srna, "threshold", 0.05f, 0.0f, 10.0f, "Threshold", "", 1e-4f, 1.0f);
- RNA_def_float(ot->srna, "factor", 0.5f, 0.0f, 1.0f, "Factor", "", 0.0f, 1.0f);
- RNA_def_boolean(ot->srna, "use_center", true, "Center", "Snap mid verts to the axis center");
+ RNA_def_float_distance(ot->srna, "threshold", 0.05f, 0.0f, 10.0f, "Threshold",
+ "Distance within which matching vertices are searched", 1e-4f, 1.0f);
+ RNA_def_float(ot->srna, "factor", 0.5f, 0.0f, 1.0f, "Factor",
+ "Mix factor of the locations of the vertices", 0.0f, 1.0f);
+ RNA_def_boolean(ot->srna, "use_center", true, "Center", "Snap middle vertices to the axis center");
}
/** \} */
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 33864cd1e95..26f3c17a97c 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -27,6 +27,7 @@
#include "CLG_log.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_key_types.h"
#include "DNA_layer_types.h"
@@ -35,7 +36,6 @@
#include "BLI_array_utils.h"
#include "BLI_alloca.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_context.h"
#include "BKE_key.h"
#include "BKE_layer.h"
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 9524d1b0791..6cae7e8c1ee 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -1035,7 +1035,7 @@ void EDBM_verts_mirror_cache_begin_ex(
BM_mesh_elem_index_ensure(bm, BM_VERT);
if (use_topology) {
- ED_mesh_mirrtopo_init__real_mesh(me, NULL, &mesh_topo_store, true);
+ ED_mesh_mirrtopo_init(me, NULL, &mesh_topo_store, true);
}
else {
tree = BLI_kdtree_new(bm->totvert);
@@ -1385,7 +1385,7 @@ DerivedMesh *EDBM_mesh_deform_dm_get(BMEditMesh *em)
* \{ */
/* poll call for mesh operators requiring a view3d context */
-int EDBM_view3d_poll(bContext *C)
+bool EDBM_view3d_poll(bContext *C)
{
if (ED_operator_editmesh(C) && ED_operator_view3d_active(C)) {
return 1;
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 46b84f328cc..d4a6267fa6b 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -497,7 +497,7 @@ bool ED_mesh_color_remove_named(Mesh *me, const char *name)
/*********************** UV texture operators ************************/
-static int layers_poll(bContext *C)
+static bool layers_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -584,8 +584,8 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e
MEM_freeN(me->edit_btmesh);
me->edit_btmesh = NULL;
- /* load_editMesh free's pointers used by CustomData layers which might be used by DerivedMesh too,
- * so signal to re-create DerivedMesh here (sergey) */
+ /* load_editMesh free's pointers used by CustomData layers which might be used by evaluated mesh too,
+ * so signal to re-create evaluated mesh here (sergey) */
DEG_id_tag_update(&me->id, 0);
}
@@ -736,7 +736,7 @@ static int mesh_customdata_clear_exec__internal(bContext *C,
}
/* Clear Mask */
-static int mesh_customdata_mask_clear_poll(bContext *C)
+static bool mesh_customdata_mask_clear_poll(bContext *C)
{
Object *ob = ED_object_context(C);
if (ob && ob->type == OB_MESH) {
@@ -809,7 +809,7 @@ static int mesh_customdata_skin_state(bContext *C)
return -1;
}
-static int mesh_customdata_skin_add_poll(bContext *C)
+static bool mesh_customdata_skin_add_poll(bContext *C)
{
return (mesh_customdata_skin_state(C) == 0);
}
@@ -842,7 +842,7 @@ void MESH_OT_customdata_skin_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int mesh_customdata_skin_clear_poll(bContext *C)
+static bool mesh_customdata_skin_clear_poll(bContext *C)
{
return (mesh_customdata_skin_state(C) == 1);
}
@@ -963,7 +963,7 @@ void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot)
/************************** Add Geometry Layers *************************/
-void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
+void ED_mesh_update(Mesh *mesh, bContext *C, bool calc_edges, bool calc_tessface)
{
bool tessface_input = false;
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index eb04d62452c..2a9ad4bd3d8 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -73,7 +73,7 @@ bool EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop,
void EDBM_stats_update(struct BMEditMesh *em);
-int EDBM_view3d_poll(struct bContext *C);
+bool EDBM_view3d_poll(struct bContext *C);
struct BMElem *EDBM_elem_from_selectmode(
struct BMEditMesh *em,
diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c
index 4c078d2ac8b..4b526915551 100644
--- a/source/blender/editors/mesh/mesh_mirror.c
+++ b/source/blender/editors/mesh/mesh_mirror.c
@@ -32,9 +32,9 @@
#include "BLI_bitmap.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
-#include "BKE_DerivedMesh.h"
#include "BLI_kdtree.h"
#include "BKE_editmesh.h"
#include "BKE_library.h"
@@ -52,11 +52,11 @@ static struct { void *tree; } MirrKdStore = {NULL};
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
-int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, DerivedMesh *dm, const float co[3], char mode)
+int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, Mesh *me_eval, const float co[3], char mode)
{
if (mode == 'u') { /* use table */
if (MirrKdStore.tree == NULL)
- ED_mesh_mirror_spatial_table(ob, em, dm, NULL, 's');
+ ED_mesh_mirror_spatial_table(ob, em, me_eval, NULL, 's');
if (MirrKdStore.tree) {
KDTreeNearest nearest;
@@ -72,11 +72,11 @@ int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, DerivedMesh *dm, co
}
else if (mode == 's') { /* start table */
Mesh *me = ob->data;
- const bool use_em = (!dm && em && me->edit_btmesh == em);
- const int totvert = use_em ? em->bm->totvert : dm ? dm->getNumVerts(dm) : me->totvert;
+ const bool use_em = (!me_eval && em && me->edit_btmesh == em);
+ const int totvert = use_em ? em->bm->totvert : me_eval ? me_eval->totvert : me->totvert;
if (MirrKdStore.tree) /* happens when entering this call without ending it */
- ED_mesh_mirror_spatial_table(ob, em, dm, co, 'e');
+ ED_mesh_mirror_spatial_table(ob, em, me_eval, co, 'e');
MirrKdStore.tree = BLI_kdtree_new(totvert);
@@ -93,73 +93,7 @@ int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, DerivedMesh *dm, co
}
}
else {
- MVert *mvert = dm ? dm->getVertArray(dm) : me->mvert;
- int i;
-
- for (i = 0; i < totvert; i++, mvert++) {
- BLI_kdtree_insert(MirrKdStore.tree, i, mvert->co);
- }
- }
-
- BLI_kdtree_balance(MirrKdStore.tree);
- }
- else if (mode == 'e') { /* end table */
- if (MirrKdStore.tree) {
- BLI_kdtree_free(MirrKdStore.tree);
- MirrKdStore.tree = NULL;
- }
- }
- else {
- BLI_assert(0);
- }
-
- return 0;
-}
-
-/* mode is 's' start, or 'e' end, or 'u' use */
-/* if end, ob can be NULL */
-int ED_mesh_mirror_spatial_table__real_mesh(Object *ob, BMEditMesh *em, Mesh *mesh, const float co[3], char mode)
-{
- if (mode == 'u') { /* use table */
- if (MirrKdStore.tree == NULL)
- ED_mesh_mirror_spatial_table__real_mesh(ob, em, mesh, NULL, 's');
-
- if (MirrKdStore.tree) {
- KDTreeNearest nearest;
- const int i = BLI_kdtree_find_nearest(MirrKdStore.tree, co, &nearest);
-
- if (i != -1) {
- if (nearest.dist < KD_THRESH) {
- return i;
- }
- }
- }
- return -1;
- }
- else if (mode == 's') { /* start table */
- Mesh *me = ob->data;
- const bool use_em = (!mesh && em && me->edit_btmesh == em);
- const int totvert = use_em ? em->bm->totvert : mesh ? mesh->totvert : me->totvert;
-
- if (MirrKdStore.tree) /* happens when entering this call without ending it */
- ED_mesh_mirror_spatial_table__real_mesh(ob, em, mesh, co, 'e');
-
- MirrKdStore.tree = BLI_kdtree_new(totvert);
-
- if (use_em) {
- BMVert *eve;
- BMIter iter;
- int i;
-
- /* this needs to be valid for index lookups later (callers need) */
- BM_mesh_elem_table_ensure(em->bm, BM_VERT);
-
- BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
- BLI_kdtree_insert(MirrKdStore.tree, i, eve->co);
- }
- }
- else {
- MVert *mvert = mesh ? mesh->mvert : me->mvert;
+ MVert *mvert = me_eval ? me_eval->mvert : me->mvert;
int i;
for (i = 0; i < totvert; i++, mvert++) {
@@ -209,46 +143,15 @@ static int mirrtopo_vert_sort(const void *v1, const void *v2)
return 0;
}
-bool ED_mesh_mirrtopo_recalc_check(Mesh *me, DerivedMesh *dm, MirrTopoStore_t *mesh_topo_store)
-{
- const bool is_editmode = (me->edit_btmesh != NULL);
- int totvert;
- int totedge;
-
- if (dm) {
- totvert = dm->getNumVerts(dm);
- totedge = dm->getNumEdges(dm);
- }
- else if (me->edit_btmesh) {
- totvert = me->edit_btmesh->bm->totvert;
- totedge = me->edit_btmesh->bm->totedge;
- }
- else {
- totvert = me->totvert;
- totedge = me->totedge;
- }
-
- if ((mesh_topo_store->index_lookup == NULL) ||
- (mesh_topo_store->prev_is_editmode != is_editmode) ||
- (totvert != mesh_topo_store->prev_vert_tot) ||
- (totedge != mesh_topo_store->prev_edge_tot))
- {
- return true;
- }
- else {
- return false;
- }
-
-}
-bool ED_mesh_mirrtopo_recalc_check__real_mesh(Mesh *me, Mesh *dm, MirrTopoStore_t *mesh_topo_store)
+bool ED_mesh_mirrtopo_recalc_check(Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store)
{
const bool is_editmode = (me->edit_btmesh != NULL);
int totvert;
int totedge;
- if (dm) {
- totvert = dm->totvert;
- totedge = dm->totedge;
+ if (me_eval) {
+ totvert = me_eval->totvert;
+ totedge = me_eval->totedge;
}
else if (me->edit_btmesh) {
totvert = me->edit_btmesh->bm->totvert;
@@ -272,33 +175,13 @@ bool ED_mesh_mirrtopo_recalc_check__real_mesh(Mesh *me, Mesh *dm, MirrTopoStore_
}
-
void ED_mesh_mirrtopo_init(
- Mesh *me, DerivedMesh *dm, MirrTopoStore_t *mesh_topo_store,
- const bool skip_em_vert_array_init)
-{
- Mesh *fake_mesh = NULL;
-
- if (dm != NULL) {
- /* ED_real_mesh_mirrtopo_init() only uses the counts, not the actual data */
- fake_mesh = BKE_mesh_new_nomain(dm->getNumVerts(dm), dm->getNumEdges(dm), dm->getNumTessFaces(dm),
- dm->getNumLoops(dm), dm->getNumPolys(dm));
- }
-
- ED_mesh_mirrtopo_init__real_mesh(me, fake_mesh, mesh_topo_store, skip_em_vert_array_init);
-
- if (dm != NULL) {
- BKE_id_free(NULL, fake_mesh);
- }
-}
-
-void ED_mesh_mirrtopo_init__real_mesh(
- Mesh *me, Mesh *dm, MirrTopoStore_t *mesh_topo_store,
+ Mesh *me, Mesh *me_eval, MirrTopoStore_t *mesh_topo_store,
const bool skip_em_vert_array_init)
{
const bool is_editmode = (me->edit_btmesh != NULL);
MEdge *medge = NULL, *med;
- BMEditMesh *em = dm ? NULL : me->edit_btmesh;
+ BMEditMesh *em = me_eval ? NULL : me->edit_btmesh;
/* editmode*/
BMEdge *eed;
@@ -327,7 +210,7 @@ void ED_mesh_mirrtopo_init__real_mesh(
totvert = em->bm->totvert;
}
else {
- totvert = dm ? dm->totvert : me->totvert;
+ totvert = me_eval ? me_eval->totvert : me->totvert;
}
topo_hash = MEM_callocN(totvert * sizeof(MirrTopoHash_t), "TopoMirr");
@@ -343,8 +226,8 @@ void ED_mesh_mirrtopo_init__real_mesh(
}
}
else {
- totedge = dm ? dm->totedge : me->totedge;
- medge = dm ? dm->medge : me->medge;
+ totedge = me_eval ? me_eval->totedge : me->totedge;
+ medge = me_eval ? me_eval->medge : me->medge;
for (a = 0, med = medge; a < totedge; a++, med++) {
const unsigned int i1 = med->v1, i2 = med->v2;
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
deleted file mode 100644
index 5cfb269cbc3..00000000000
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ /dev/null
@@ -1,732 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2011 by Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Benoit Bolsee,
- * Nick Samarin
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/mesh/mesh_navmesh.c
- * \ingroup edmesh
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-
-#include "BLI_listbase.h"
-#include "BLI_math_vector.h"
-#include "BLI_linklist.h"
-
-#include "BKE_library.h"
-#include "BKE_depsgraph.h"
-#include "BKE_context.h"
-#include "BKE_mesh.h"
-#include "BKE_scene.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_report.h"
-#include "BKE_editmesh.h"
-
-#include "ED_object.h"
-#include "ED_mesh.h"
-#include "ED_screen.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "recast-capi.h"
-
-#include "mesh_intern.h" /* own include */
-
-
-static void createVertsTrisData(bContext *C, LinkNode *obs,
- int *nverts_r, float **verts_r, int *ntris_r, int **tris_r, unsigned int *r_lay)
-{
- MVert *mvert;
- int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces;
- MFace *mface;
- float co[3], wco[3];
- Object *ob;
- LinkNode *oblink, *dmlink;
- DerivedMesh *dm;
- Scene *scene = CTX_data_scene(C);
- LinkNodePair dms_pair = {NULL, NULL};
-
- int nverts, ntris, *tris;
- float *verts;
-
- nverts = 0;
- ntris = 0;
-
- /* calculate number of verts and tris */
- for (oblink = obs; oblink; oblink = oblink->next) {
- ob = (Object *) oblink->link;
- dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH);
- DM_ensure_tessface(dm);
- BLI_linklist_append(&dms_pair, dm);
-
- nverts += dm->getNumVerts(dm);
- nfaces = dm->getNumTessFaces(dm);
- ntris += nfaces;
-
- /* resolve quad faces */
- mface = dm->getTessFaceArray(dm);
- for (i = 0; i < nfaces; i++) {
- MFace *mf = &mface[i];
- if (mf->v4)
- ntris += 1;
- }
-
- *r_lay |= ob->lay;
- }
- LinkNode *dms = dms_pair.list;
-
- /* create data */
- verts = MEM_mallocN(sizeof(float) * 3 * nverts, "createVertsTrisData verts");
- tris = MEM_mallocN(sizeof(int) * 3 * ntris, "createVertsTrisData faces");
-
- basenverts = 0;
- tri = tris;
- for (oblink = obs, dmlink = dms; oblink && dmlink;
- oblink = oblink->next, dmlink = dmlink->next)
- {
- ob = (Object *) oblink->link;
- dm = (DerivedMesh *) dmlink->link;
-
- curnverts = dm->getNumVerts(dm);
- mvert = dm->getVertArray(dm);
-
- /* copy verts */
- for (i = 0; i < curnverts; i++) {
- MVert *v = &mvert[i];
-
- copy_v3_v3(co, v->co);
- mul_v3_m4v3(wco, ob->obmat, co);
-
- verts[3 * (basenverts + i) + 0] = wco[0];
- verts[3 * (basenverts + i) + 1] = wco[2];
- verts[3 * (basenverts + i) + 2] = wco[1];
- }
-
- /* create tris */
- curnfaces = dm->getNumTessFaces(dm);
- mface = dm->getTessFaceArray(dm);
-
- for (i = 0; i < curnfaces; i++) {
- MFace *mf = &mface[i];
-
- tri[0] = basenverts + mf->v1;
- tri[1] = basenverts + mf->v3;
- tri[2] = basenverts + mf->v2;
- tri += 3;
-
- if (mf->v4) {
- tri[0] = basenverts + mf->v1;
- tri[1] = basenverts + mf->v4;
- tri[2] = basenverts + mf->v3;
- tri += 3;
- }
- }
-
- basenverts += curnverts;
- }
-
- /* release derived mesh */
- for (dmlink = dms; dmlink; dmlink = dmlink->next) {
- dm = (DerivedMesh *) dmlink->link;
- dm->release(dm);
- }
-
- BLI_linklist_free(dms, NULL);
-
- *nverts_r = nverts;
- *verts_r = verts;
- *ntris_r = ntris;
- *tris_r = tris;
-}
-
-static bool buildNavMesh(const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris,
- struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh,
- ReportList *reports)
-{
- float bmin[3], bmax[3];
- struct recast_heightfield *solid;
- unsigned char *triflags;
- struct recast_compactHeightfield *chf;
- struct recast_contourSet *cset;
- int width, height, walkableHeight, walkableClimb, walkableRadius;
- int minRegionArea, mergeRegionArea, maxEdgeLen;
- float detailSampleDist, detailSampleMaxError;
-
- recast_calcBounds(verts, nverts, bmin, bmax);
-
- /* ** Step 1. Initialize build config ** */
- walkableHeight = (int)ceilf(recastParams->agentheight / recastParams->cellheight);
- walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight);
- walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize);
- minRegionArea = (int)(recastParams->regionminsize * recastParams->regionminsize);
- mergeRegionArea = (int)(recastParams->regionmergesize * recastParams->regionmergesize);
- maxEdgeLen = (int)(recastParams->edgemaxlen / recastParams->cellsize);
- detailSampleDist = recastParams->detailsampledist < 0.9f ? 0 :
- recastParams->cellsize * recastParams->detailsampledist;
- detailSampleMaxError = recastParams->cellheight * recastParams->detailsamplemaxerror;
-
- /* Set the area where the navigation will be build. */
- recast_calcGridSize(bmin, bmax, recastParams->cellsize, &width, &height);
-
- /* zero dimensions cause zero alloc later on [#33758] */
- if (width <= 0 || height <= 0) {
- BKE_report(reports, RPT_ERROR, "Object has a width or height of zero");
- return false;
- }
-
- /* ** Step 2: Rasterize input polygon soup ** */
- /* Allocate voxel heightfield where we rasterize our input data to */
- solid = recast_newHeightfield();
-
- if (!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
- recast_destroyHeightfield(solid);
- BKE_report(reports, RPT_ERROR, "Failed to create height field");
- return false;
- }
-
- /* Allocate array that can hold triangle flags */
- triflags = MEM_callocN(sizeof(unsigned char) * ntris, "buildNavMesh triflags");
-
- /* Find triangles which are walkable based on their slope and rasterize them */
- recast_markWalkableTriangles(RAD2DEGF(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags);
- recast_rasterizeTriangles(verts, nverts, tris, triflags, ntris, solid, 1);
- MEM_freeN(triflags);
-
- /* ** Step 3: Filter walkables surfaces ** */
- recast_filterLowHangingWalkableObstacles(walkableClimb, solid);
- recast_filterLedgeSpans(walkableHeight, walkableClimb, solid);
- recast_filterWalkableLowHeightSpans(walkableHeight, solid);
-
- /* ** Step 4: Partition walkable surface to simple regions ** */
-
- chf = recast_newCompactHeightfield();
- if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
- recast_destroyHeightfield(solid);
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to create compact height field");
- return false;
- }
-
- recast_destroyHeightfield(solid);
- solid = NULL;
-
- if (!recast_erodeWalkableArea(walkableRadius, chf)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to erode walkable area");
- return false;
- }
-
- if (recastParams->partitioning == RC_PARTITION_WATERSHED) {
- /* Prepare for region partitioning, by calculating distance field along the walkable surface */
- if (!recast_buildDistanceField(chf)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build distance field");
- return false;
- }
-
- /* Partition the walkable surface into simple regions without holes */
- if (!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build watershed regions");
- return false;
- }
- }
- else if (recastParams->partitioning == RC_PARTITION_MONOTONE) {
- /* Partition the walkable surface into simple regions without holes */
- /* Monotone partitioning does not need distancefield. */
- if (!recast_buildRegionsMonotone(chf, 0, minRegionArea, mergeRegionArea)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build monotone regions");
- return false;
- }
- }
- else { /* RC_PARTITION_LAYERS */
- /* Partition the walkable surface into simple regions without holes */
- if (!recast_buildLayerRegions(chf, 0, minRegionArea)) {
- recast_destroyCompactHeightfield(chf);
-
- BKE_report(reports, RPT_ERROR, "Failed to build layer regions");
- return false;
- }
- }
-
- /* ** Step 5: Trace and simplify region contours ** */
- /* Create contours */
- cset = recast_newContourSet();
-
- if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset, RECAST_CONTOUR_TESS_WALL_EDGES)) {
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
-
- BKE_report(reports, RPT_ERROR, "Failed to build contours");
- return false;
- }
-
- /* ** Step 6: Build polygons mesh from contours ** */
- *pmesh = recast_newPolyMesh();
- if (!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
- recast_destroyPolyMesh(*pmesh);
-
- BKE_report(reports, RPT_ERROR, "Failed to build poly mesh");
- return false;
- }
-
-
- /* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */
-
- *dmesh = recast_newPolyMeshDetail();
- if (!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
- recast_destroyPolyMesh(*pmesh);
- recast_destroyPolyMeshDetail(*dmesh);
-
- BKE_report(reports, RPT_ERROR, "Failed to build poly mesh detail");
- return false;
- }
-
- recast_destroyCompactHeightfield(chf);
- recast_destroyContourSet(cset);
-
- return true;
-}
-
-static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh,
- Base *base, unsigned int lay)
-{
- float co[3], rot[3];
- BMEditMesh *em;
- int i, j, k;
- unsigned short *v;
- int face[3];
- Scene *scene = CTX_data_scene(C);
- Object *obedit;
- int createob = base == NULL;
- int nverts, nmeshes, nvp;
- unsigned short *verts, *polys;
- unsigned int *meshes;
- float bmin[3], cs, ch, *dverts;
- unsigned char *tris;
-
- zero_v3(co);
- zero_v3(rot);
-
- if (createob) {
- /* create new object */
- obedit = ED_object_add_type(C, OB_MESH, "Navmesh", co, rot, false, lay);
- }
- else {
- obedit = base->object;
- BKE_scene_base_deselect_all(scene);
- BKE_scene_base_select(scene, base);
- copy_v3_v3(obedit->loc, co);
- copy_v3_v3(obedit->rot, rot);
- }
-
- ED_object_editmode_enter(C, EM_IGNORE_LAYER);
- em = BKE_editmesh_from_object(obedit);
-
- if (!createob) {
- /* clear */
- EDBM_mesh_clear(em);
- }
-
- /* create verts for polygon mesh */
- verts = recast_polyMeshGetVerts(pmesh, &nverts);
- recast_polyMeshGetBoundbox(pmesh, bmin, NULL);
- recast_polyMeshGetCell(pmesh, &cs, &ch);
-
- for (i = 0; i < nverts; i++) {
- v = &verts[3 * i];
- co[0] = bmin[0] + v[0] * cs;
- co[1] = bmin[1] + v[1] * ch;
- co[2] = bmin[2] + v[2] * cs;
- SWAP(float, co[1], co[2]);
- BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP);
- }
-
- /* create custom data layer to save polygon idx */
- CustomData_add_layer_named(&em->bm->pdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData");
- CustomData_bmesh_init_pool(&em->bm->pdata, 0, BM_FACE);
-
- /* create verts and faces for detailed mesh */
- meshes = recast_polyMeshDetailGetMeshes(dmesh, &nmeshes);
- polys = recast_polyMeshGetPolys(pmesh, NULL, &nvp);
- dverts = recast_polyMeshDetailGetVerts(dmesh, NULL);
- tris = recast_polyMeshDetailGetTris(dmesh, NULL);
-
- for (i = 0; i < nmeshes; i++) {
- int uniquevbase = em->bm->totvert;
- unsigned int vbase = meshes[4 * i + 0];
- unsigned short ndv = meshes[4 * i + 1];
- unsigned short tribase = meshes[4 * i + 2];
- unsigned short trinum = meshes[4 * i + 3];
- const unsigned short *p = &polys[i * nvp * 2];
- int nv = 0;
-
- for (j = 0; j < nvp; ++j) {
- if (p[j] == 0xffff) break;
- nv++;
- }
-
- /* create unique verts */
- for (j = nv; j < ndv; j++) {
- copy_v3_v3(co, &dverts[3 * (vbase + j)]);
- SWAP(float, co[1], co[2]);
- BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP);
- }
-
- /* need to rebuild entirely because array size changes */
- BM_mesh_elem_table_init(em->bm, BM_VERT);
-
- /* create faces */
- for (j = 0; j < trinum; j++) {
- unsigned char *tri = &tris[4 * (tribase + j)];
- BMFace *newFace;
- int *polygonIdx;
-
- for (k = 0; k < 3; k++) {
- if (tri[k] < nv)
- face[k] = p[tri[k]]; /* shared vertex */
- else
- face[k] = uniquevbase + tri[k] - nv; /* unique vertex */
- }
- newFace = BM_face_create_quad_tri(em->bm,
- BM_vert_at_index(em->bm, face[0]),
- BM_vert_at_index(em->bm, face[2]),
- BM_vert_at_index(em->bm, face[1]), NULL,
- NULL, BM_CREATE_NOP);
-
- /* set navigation polygon idx to the custom layer */
- polygonIdx = (int *)CustomData_bmesh_get(&em->bm->pdata, newFace->head.data, CD_RECAST);
- *polygonIdx = i + 1; /* add 1 to avoid zero idx */
- }
- }
-
- recast_destroyPolyMesh(pmesh);
- recast_destroyPolyMeshDetail(dmesh);
-
- DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
-
- ED_object_editmode_exit(C, EM_FREEDATA);
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
-
- if (createob) {
- obedit->gameflag &= ~OB_COLLISION;
- obedit->gameflag |= OB_NAVMESH;
- obedit->body_type = OB_BODY_TYPE_NAVMESH;
- }
-
- BKE_mesh_ensure_navmesh(obedit->data);
-
- return obedit;
-}
-
-static int navmesh_create_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- LinkNode *obs = NULL;
- Base *navmeshBase = NULL;
-
- CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
- {
- if (base->object->type == OB_MESH) {
- if (base->object->body_type == OB_BODY_TYPE_NAVMESH) {
- if (!navmeshBase || base == scene->basact) {
- navmeshBase = base;
- }
- }
- else {
- BLI_linklist_prepend(&obs, base->object);
- }
- }
- }
- CTX_DATA_END;
-
- if (obs) {
- struct recast_polyMesh *pmesh = NULL;
- struct recast_polyMeshDetail *dmesh = NULL;
- bool ok;
- unsigned int lay = 0;
-
- int nverts = 0, ntris = 0;
- int *tris = NULL;
- float *verts = NULL;
-
- createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay);
- BLI_linklist_free(obs, NULL);
- if ((ok = buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh, op->reports))) {
- createRepresentation(C, pmesh, dmesh, navmeshBase, lay);
- }
-
- MEM_freeN(verts);
- MEM_freeN(tris);
-
- return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
- }
- else {
- BKE_report(op->reports, RPT_ERROR, "No mesh objects found");
-
- return OPERATOR_CANCELLED;
- }
-}
-
-void MESH_OT_navmesh_make(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Create Navigation Mesh";
- ot->description = "Create navigation mesh for selected objects";
- ot->idname = "MESH_OT_navmesh_make";
-
- /* api callbacks */
- ot->exec = navmesh_create_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
-{
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
-
- /* do work here */
- BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, false);
-
- if (efa_act) {
- if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
- BMFace *efa;
- BMIter iter;
- int targetPolyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, efa_act->head.data, CD_RECAST);
- targetPolyIdx = targetPolyIdx >= 0 ? targetPolyIdx : -targetPolyIdx;
-
- if (targetPolyIdx > 0) {
- /* set target poly idx to other selected faces */
- BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
- int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST);
- *recastDataBlock = targetPolyIdx;
- }
- }
- }
- else {
- BKE_report(op->reports, RPT_ERROR, "Active face has no index set");
- }
- }
- }
-
- DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh Copy Face Index";
- ot->description = "Copy the index from the active face";
- ot->idname = "MESH_OT_navmesh_face_copy";
-
- /* api callbacks */
- ot->poll = ED_operator_editmesh;
- ot->exec = navmesh_face_copy_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int compare(const void *a, const void *b)
-{
- return (*(int *)a - *(int *)b);
-}
-
-static int findFreeNavPolyIndex(BMEditMesh *em)
-{
- /* construct vector of indices */
- int numfaces = em->bm->totface;
- int *indices = MEM_callocN(sizeof(int) * numfaces, "findFreeNavPolyIndex(indices)");
- BMFace *ef;
- BMIter iter;
- int i, idx = em->bm->totface - 1, freeIdx = 1;
-
- /*XXX this originally went last to first, but that isn't possible anymore*/
- BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
- int polyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
- indices[idx] = polyIdx;
- idx--;
- }
-
- qsort(indices, numfaces, sizeof(int), compare);
-
- /* search first free index */
- freeIdx = 1;
- for (i = 0; i < numfaces; i++) {
- if (indices[i] == freeIdx)
- freeIdx++;
- else if (indices[i] > freeIdx)
- break;
- }
-
- MEM_freeN(indices);
-
- return freeIdx;
-}
-
-static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *obedit = CTX_data_edit_object(C);
- BMEditMesh *em = BKE_editmesh_from_object(obedit);
- BMFace *ef;
- BMIter iter;
-
- if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
- int targetPolyIdx = findFreeNavPolyIndex(em);
-
- if (targetPolyIdx > 0) {
- /* set target poly idx to selected faces */
- /*XXX this originally went last to first, but that isn't possible anymore*/
-
- BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
- if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
- int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
- *recastDataBlock = targetPolyIdx;
- }
- }
- }
- }
-
- DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_face_add(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh New Face Index";
- ot->description = "Add a new index and assign it to selected faces";
- ot->idname = "MESH_OT_navmesh_face_add";
-
- /* api callbacks */
- ot->poll = ED_operator_editmesh;
- ot->exec = navmesh_face_add_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int navmesh_obmode_data_poll(bContext *C)
-{
- Object *ob = ED_object_active_context(C);
- if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
- Mesh *me = ob->data;
- return CustomData_has_layer(&me->pdata, CD_RECAST);
- }
- return false;
-}
-
-static int navmesh_obmode_poll(bContext *C)
-{
- Object *ob = ED_object_active_context(C);
- if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
- return true;
- }
- return false;
-}
-
-static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_active_context(C);
- Mesh *me = ob->data;
-
- CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
-
- BKE_mesh_ensure_navmesh(me);
-
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_reset(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh Reset Index Values";
- ot->description = "Assign a new index to every face";
- ot->idname = "MESH_OT_navmesh_reset";
-
- /* api callbacks */
- ot->poll = navmesh_obmode_poll;
- ot->exec = navmesh_reset_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
-
-static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
-{
- Object *ob = ED_object_active_context(C);
- Mesh *me = ob->data;
-
- CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
-
- DAG_id_tag_update(&me->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id);
-
- return OPERATOR_FINISHED;
-}
-
-void MESH_OT_navmesh_clear(struct wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "NavMesh Clear Data";
- ot->description = "Remove navmesh data from this mesh";
- ot->idname = "MESH_OT_navmesh_clear";
-
- /* api callbacks */
- ot->poll = navmesh_obmode_data_poll;
- ot->exec = navmesh_clear_exec;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-}
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 546c000d726..09d6ea7226a 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -329,7 +329,6 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
{
wmKeyMap *keymap;
wmKeyMapItem *kmi;
- int i;
keymap = WM_keymap_find(keyconf, "Mesh", 0, 0);
keymap->poll = ED_operator_editmesh;
@@ -337,7 +336,9 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_offset_edge_loops_slide", RKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "MESH_OT_poke", PKEY, KM_PRESS, KM_ALT, 0);
+#endif
kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "vertex_only", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
@@ -398,7 +399,9 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_select_next_item", PADPLUSKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
WM_keymap_add_item(keymap, "MESH_OT_select_prev_item", PADMINUS, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0);
+#endif
WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
@@ -406,7 +409,9 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "deselect", true);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0);
+#endif
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
@@ -418,20 +423,31 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
/* tools */
+#ifdef USE_WM_KEYMAP_27X
kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "inside", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "inside", true);
+#else
+ kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT, 0);
+ RNA_boolean_set(kmi->ptr, "inside", false);
+ kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+ RNA_boolean_set(kmi->ptr, "inside", true);
+#endif
WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */
WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_extrude", EKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TRANSFORM_OT_edge_crease", EKEY, KM_PRESS, KM_SHIFT, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
+#endif
WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_ALT, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
+#endif
kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "quad_method", MOD_TRIANGULATE_QUAD_BEAUTY);
@@ -490,9 +506,11 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "use_occlude_geometry", true);
RNA_boolean_set(kmi->ptr, "only_selected", false);
+#ifdef USE_WM_KEYMAP_27X
kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "use_occlude_geometry", false);
RNA_boolean_set(kmi->ptr, "only_selected", true);
+#endif
WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
@@ -505,11 +523,13 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "VIEW3D_MT_uv_map", UKEY, KM_PRESS, 0, 0);
WM_keymap_add_menu(keymap, "VIEW3D_MT_vertex_group", GKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
/* useful stuff from object-mode */
- for (i = 0; i <= 5; i++) {
+ for (int i = 0; i <= 5; i++) {
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0);
RNA_int_set(kmi->ptr, "level", i);
}
+#endif
ED_keymap_proportional_cycle(keyconf, keymap);
ED_keymap_proportional_editmode(keyconf, keymap, true);
@@ -517,4 +537,3 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
knifetool_modal_keymap(keyconf);
point_normals_modal_keymap(keyconf);
}
-
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 6c8de1a481e..537056cd1ba 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -34,9 +34,10 @@
#include "MEM_guardedalloc.h"
-#include "DNA_mesh_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -49,11 +50,11 @@
#include "BKE_context.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
+#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
#include "BKE_material.h"
#include "BKE_object.h"
@@ -612,7 +613,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Mesh *me = (Mesh *)ob->data;
Mesh *selme = NULL;
- DerivedMesh *dm = NULL;
+ Mesh *me_deformed = NULL;
Key *key = me->key;
KeyBlock *kb;
bool ok = false, nonequal_verts = false;
@@ -646,7 +647,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
/* first key added, so it was the basis. initialize it with the existing mesh */
kb = BKE_keyblock_add(key, NULL);
- BKE_keyblock_convert_from_mesh(me, kb);
+ BKE_keyblock_convert_from_mesh(me, key, kb);
}
/* now ready to add new keys from selected meshes */
@@ -658,15 +659,15 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
selme = (Mesh *)base->object->data;
if (selme->totvert == me->totvert) {
- dm = mesh_get_derived_deform(depsgraph, scene, base->object, CD_MASK_BAREMESH);
+ me_deformed = mesh_get_eval_deform(depsgraph, scene, base->object, CD_MASK_BAREMESH);
- if (!dm) continue;
+ if (!me_deformed) {
+ continue;
+ }
kb = BKE_keyblock_add(key, base->object->id.name + 2);
- DM_to_meshkey(dm, me, kb);
-
- dm->release(dm);
+ BKE_mesh_runtime_eval_to_meshkey(me_deformed, me, kb);
}
}
}
@@ -690,40 +691,15 @@ static MirrTopoStore_t mesh_topo_store = {NULL, -1. - 1, -1};
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
/* note, is supposed return -1 on error, which callers are currently checking for, but is not used so far */
-int ED_mesh_mirror_topo_table(
- Object *ob, DerivedMesh *dm, char mode)
+int ED_mesh_mirror_topo_table(Object *ob, Mesh *me_eval, char mode)
{
if (mode == 'u') { /* use table */
- if (ED_mesh_mirrtopo_recalc_check(ob->data, dm, &mesh_topo_store)) {
- ED_mesh_mirror_topo_table(ob, dm, 's');
+ if (ED_mesh_mirrtopo_recalc_check(ob->data, me_eval, &mesh_topo_store)) {
+ ED_mesh_mirror_topo_table(ob, me_eval, 's');
}
}
else if (mode == 's') { /* start table */
- ED_mesh_mirrtopo_init(ob->data, dm, &mesh_topo_store, false);
- }
- else if (mode == 'e') { /* end table */
- ED_mesh_mirrtopo_free(&mesh_topo_store);
- }
- else {
- BLI_assert(0);
- }
-
- return 0;
-}
-
-/* mode is 's' start, or 'e' end, or 'u' use */
-/* if end, ob can be NULL */
-/* note, is supposed return -1 on error, which callers are currently checking for, but is not used so far */
-int ED_mesh_mirror_topo_table__real_mesh(
- Object *ob, Mesh *mesh, char mode)
-{
- if (mode == 'u') { /* use table */
- if (ED_mesh_mirrtopo_recalc_check__real_mesh(ob->data, mesh, &mesh_topo_store)) {
- ED_mesh_mirror_topo_table__real_mesh(ob, mesh, 's');
- }
- }
- else if (mode == 's') { /* start table */
- ED_mesh_mirrtopo_init__real_mesh(ob->data, mesh, &mesh_topo_store, false);
+ ED_mesh_mirrtopo_init(ob->data, me_eval, &mesh_topo_store, false);
}
else if (mode == 'e') { /* end table */
ED_mesh_mirrtopo_free(&mesh_topo_store);
@@ -738,39 +714,7 @@ int ED_mesh_mirror_topo_table__real_mesh(
/** \} */
-static int mesh_get_x_mirror_vert_spatial(Object *ob, DerivedMesh *dm, int index)
-{
- Mesh *me = ob->data;
- MVert *mvert = dm ? dm->getVertArray(dm) : me->mvert;
- float vec[3];
-
- mvert = &mvert[index];
- vec[0] = -mvert->co[0];
- vec[1] = mvert->co[1];
- vec[2] = mvert->co[2];
-
- return ED_mesh_mirror_spatial_table(ob, NULL, dm, vec, 'u');
-}
-
-static int mesh_get_x_mirror_vert_topo(Object *ob, DerivedMesh *dm, int index)
-{
- if (ED_mesh_mirror_topo_table(ob, dm, 'u') == -1)
- return -1;
-
- return mesh_topo_store.index_lookup[index];
-}
-
-int mesh_get_x_mirror_vert(Object *ob, DerivedMesh *dm, int index, const bool use_topology)
-{
- if (use_topology) {
- return mesh_get_x_mirror_vert_topo(ob, dm, index);
- }
- else {
- return mesh_get_x_mirror_vert_spatial(ob, dm, index);
- }
-}
-
-static int mesh_get_x_mirror_vert_spatial__real_mesh(Object *ob, Mesh *mesh, int index)
+static int mesh_get_x_mirror_vert_spatial(Object *ob, Mesh *mesh, int index)
{
Mesh *me = ob->data;
MVert *mvert = mesh ? mesh->mvert : me->mvert;
@@ -781,24 +725,24 @@ static int mesh_get_x_mirror_vert_spatial__real_mesh(Object *ob, Mesh *mesh, int
vec[1] = mvert->co[1];
vec[2] = mvert->co[2];
- return ED_mesh_mirror_spatial_table__real_mesh(ob, NULL, mesh, vec, 'u');
+ return ED_mesh_mirror_spatial_table(ob, NULL, mesh, vec, 'u');
}
-static int mesh_get_x_mirror_vert_topo__real_mesh(Object *ob, Mesh *mesh, int index)
+static int mesh_get_x_mirror_vert_topo(Object *ob, Mesh *mesh, int index)
{
- if (ED_mesh_mirror_topo_table__real_mesh(ob, mesh, 'u') == -1)
+ if (ED_mesh_mirror_topo_table(ob, mesh, 'u') == -1)
return -1;
return mesh_topo_store.index_lookup[index];
}
-int mesh_get_x_mirror_vert__real_mesh(Object *ob, Mesh *mesh, int index, const bool use_topology)
+int mesh_get_x_mirror_vert(Object *ob, Mesh *me_eval, int index, const bool use_topology)
{
if (use_topology) {
- return mesh_get_x_mirror_vert_topo__real_mesh(ob, mesh, index);
+ return mesh_get_x_mirror_vert_topo(ob, me_eval, index);
}
else {
- return mesh_get_x_mirror_vert_spatial__real_mesh(ob, mesh, index);
+ return mesh_get_x_mirror_vert_spatial(ob, me_eval, index);
}
}
@@ -995,68 +939,8 @@ static bool mirror_facecmp(const void *a, const void *b)
return (mirror_facerotation((MFace *)a, (MFace *)b) == -1);
}
-/* BMESH_TODO, convert to MPoly (functions above also) */
-int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, DerivedMesh *dm)
-{
- Mesh *me = ob->data;
- MVert *mv, *mvert;
- MFace mirrormf, *mf, *hashmf, *mface;
- GHash *fhash;
- int *mirrorverts, *mirrorfaces;
-
- BLI_assert(em == NULL); /* Does not work otherwise, currently... */
-
- const bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
- const int totvert = dm ? dm->getNumVerts(dm) : me->totvert;
- const int totface = dm ? dm->getNumTessFaces(dm) : me->totface;
- int a;
-
- mirrorverts = MEM_callocN(sizeof(int) * totvert, "MirrorVerts");
- mirrorfaces = MEM_callocN(sizeof(int) * 2 * totface, "MirrorFaces");
-
- mvert = dm ? dm->getVertArray(dm) : me->mvert;
- mface = dm ? dm->getTessFaceArray(dm) : me->mface;
-
- ED_mesh_mirror_spatial_table(ob, em, dm, NULL, 's');
-
- for (a = 0, mv = mvert; a < totvert; a++, mv++)
- mirrorverts[a] = mesh_get_x_mirror_vert(ob, dm, a, use_topology);
-
- ED_mesh_mirror_spatial_table(ob, em, dm, NULL, 'e');
-
- fhash = BLI_ghash_new_ex(mirror_facehash, mirror_facecmp, "mirror_facehash gh", me->totface);
- for (a = 0, mf = mface; a < totface; a++, mf++)
- BLI_ghash_insert(fhash, mf, mf);
-
- for (a = 0, mf = mface; a < totface; a++, mf++) {
- mirrormf.v1 = mirrorverts[mf->v3];
- mirrormf.v2 = mirrorverts[mf->v2];
- mirrormf.v3 = mirrorverts[mf->v1];
- mirrormf.v4 = (mf->v4) ? mirrorverts[mf->v4] : 0;
-
- /* make sure v4 is not 0 if a quad */
- if (mf->v4 && mirrormf.v4 == 0) {
- SWAP(unsigned int, mirrormf.v1, mirrormf.v3);
- SWAP(unsigned int, mirrormf.v2, mirrormf.v4);
- }
-
- hashmf = BLI_ghash_lookup(fhash, &mirrormf);
- if (hashmf) {
- mirrorfaces[a * 2] = hashmf - mface;
- mirrorfaces[a * 2 + 1] = mirror_facerotation(&mirrormf, hashmf);
- }
- else
- mirrorfaces[a * 2] = -1;
- }
-
- BLI_ghash_free(fhash, NULL, NULL);
- MEM_freeN(mirrorverts);
-
- return mirrorfaces;
-}
-
/* This is a Mesh-based copy of mesh_get_x_mirror_faces() */
-int *mesh_get_x_mirror_faces__real_mesh(Object *ob, BMEditMesh *em, Mesh *mesh)
+int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
{
Mesh *me = ob->data;
MVert *mv, *mvert;
@@ -1067,22 +951,22 @@ int *mesh_get_x_mirror_faces__real_mesh(Object *ob, BMEditMesh *em, Mesh *mesh)
BLI_assert(em == NULL); /* Does not work otherwise, currently... */
const bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
- const int totvert = mesh ? mesh->totvert : me->totvert;
- const int totface = mesh ? mesh->totface : me->totface;
+ const int totvert = me_eval ? me_eval->totvert : me->totvert;
+ const int totface = me_eval ? me_eval->totface : me->totface;
int a;
mirrorverts = MEM_callocN(sizeof(int) * totvert, "MirrorVerts");
mirrorfaces = MEM_callocN(sizeof(int) * 2 * totface, "MirrorFaces");
- mvert = mesh ? mesh->mvert : me->mvert;
- mface = mesh ? mesh->mface : me->mface;
+ mvert = me_eval ? me_eval->mvert : me->mvert;
+ mface = me_eval ? me_eval->mface : me->mface;
- ED_mesh_mirror_spatial_table__real_mesh(ob, em, mesh, NULL, 's');
+ ED_mesh_mirror_spatial_table(ob, em, me_eval, NULL, 's');
for (a = 0, mv = mvert; a < totvert; a++, mv++)
- mirrorverts[a] = mesh_get_x_mirror_vert__real_mesh(ob, mesh, a, use_topology);
+ mirrorverts[a] = mesh_get_x_mirror_vert(ob, me_eval, a, use_topology);
- ED_mesh_mirror_spatial_table__real_mesh(ob, em, mesh, NULL, 'e');
+ ED_mesh_mirror_spatial_table(ob, em, me_eval, NULL, 'e');
fhash = BLI_ghash_new_ex(mirror_facehash, mirror_facecmp, "mirror_facehash gh", me->totface);
for (a = 0, mf = mface; a < totface; a++, mf++)
@@ -1322,7 +1206,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
}
else {
/* derived mesh to find deformed locations */
- DerivedMesh *dm = mesh_get_derived_final(vc.depsgraph, vc.scene, ob, CD_MASK_BAREMESH);
+ Mesh *me_eval = mesh_get_eval_final(vc.depsgraph, vc.scene, ob, CD_MASK_BAREMESH);
ARegion *ar = vc.ar;
RegionView3D *rv3d = ar->regiondata;
@@ -1334,7 +1218,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
ED_view3d_init_mats_rv3d(ob, rv3d);
- if (dm == NULL) {
+ if (me_eval == NULL) {
return false;
}
@@ -1345,9 +1229,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int
data.len_best = FLT_MAX;
data.v_idx_best = -1;
- dm->foreachMappedVert(dm, ed_mesh_pick_vert__mapFunc, &data, DM_FOREACH_NOP);
-
- dm->release(dm);
+ BKE_mesh_foreach_mapped_vert(me_eval, ed_mesh_pick_vert__mapFunc, &data, MESH_FOREACH_NOP);
if (data.v_idx_best == -1) {
return false;
diff --git a/source/blender/editors/metaball/mball_intern.h b/source/blender/editors/metaball/mball_intern.h
index 6e96514c022..927a8acf5db 100644
--- a/source/blender/editors/metaball/mball_intern.h
+++ b/source/blender/editors/metaball/mball_intern.h
@@ -47,4 +47,3 @@ void MBALL_OT_select_similar(struct wmOperatorType *ot);
void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot);
#endif
-
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c
index 2e1b7299295..567ef3150bf 100644
--- a/source/blender/editors/metaball/mball_ops.c
+++ b/source/blender/editors/metaball/mball_ops.c
@@ -85,6 +85,7 @@ void ED_keymap_metaball(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", DELKEY, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "MBALL_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", AKEY, KM_PRESS, 0, 0);
@@ -97,4 +98,3 @@ void ED_keymap_metaball(wmKeyConfig *keyconf)
ED_keymap_proportional_cycle(keyconf, keymap);
ED_keymap_proportional_editmode(keyconf, keymap, true);
}
-
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index dd358b95722..a8c3c905dd4 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -333,7 +333,8 @@ bool ED_object_add_generic_get_opts(bContext *C, wmOperator *op, const char view
/* Get layers! */
{
- int a, layer_values[20];
+ int a;
+ bool layer_values[20];
if (!layer)
layer = &_layer;
@@ -946,7 +947,7 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEv
/* add under the mouse */
ED_object_location_from_view(C, ob->loc);
- ED_view3d_cursor3d_position(C, ob->loc, event->mval);
+ ED_view3d_cursor3d_position(C, event->mval, false, ob->loc);
}
BKE_object_empty_draw_type_set(ob, OB_EMPTY_IMAGE);
@@ -1013,7 +1014,21 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
ob = ED_object_add_type(C, OB_LAMP, get_lamp_defname(type), loc, rot, false, layer);
- BKE_object_obdata_size_init(ob, RNA_float_get(op->ptr, "radius"));
+
+ float size = RNA_float_get(op->ptr, "radius");
+ /* Better defaults for lamp size. */
+ switch (type) {
+ case LA_LOCAL:
+ case LA_SPOT:
+ break;
+ case LA_AREA:
+ size *= 4.0f;
+ break;
+ default:
+ size *= 0.5f;
+ break;
+ }
+ BKE_object_obdata_size_init(ob, size);
la = (Lamp *)ob->data;
la->type = type;
@@ -1070,7 +1085,7 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
const int mval[2] = {event->x - ar->winrct.xmin,
event->y - ar->winrct.ymin};
ED_object_location_from_view(C, loc);
- ED_view3d_cursor3d_position(C, loc, mval);
+ ED_view3d_cursor3d_position(C, mval, false, loc);
RNA_float_set_array(op->ptr, "location", loc);
}
}
@@ -1097,8 +1112,6 @@ static int collection_instance_add_exec(bContext *C, wmOperator *op)
/* works without this except if you try render right after, see: 22027 */
DEG_relations_tag_update(bmain);
- DEG_id_tag_update(&collection->id, 0);
-
DEG_id_tag_update(&scene->id, DEG_TAG_SELECT_UPDATE);
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
@@ -1648,7 +1661,7 @@ static void curvetomesh(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object
}
}
-static int convert_poll(bContext *C)
+static bool convert_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
Base *base_act = CTX_data_active_base(C);
@@ -2002,9 +2015,6 @@ static int convert_exec(bContext *C, wmOperator *op)
}
FOREACH_SCENE_OBJECT_END;
}
-
- /* delete object should renew depsgraph */
- DEG_relations_tag_update(bmain);
}
// XXX ED_object_editmode_enter(C, 0);
@@ -2079,7 +2089,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, ViewLayer
DEG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA);
base = BKE_view_layer_base_find(view_layer, ob);
- if ((base != NULL) && (base->flag & BASE_VISIBLED)) {
+ if ((base != NULL) && (base->flag & BASE_VISIBLE)) {
BKE_collection_object_add_from(bmain, scene, ob, obn);
}
else {
@@ -2426,7 +2436,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
const int mval[2] = {event->x - ar->winrct.xmin,
event->y - ar->winrct.ymin};
ED_object_location_from_view(C, basen->object->loc);
- ED_view3d_cursor3d_position(C, basen->object->loc, mval);
+ ED_view3d_cursor3d_position(C, mval, false, basen->object->loc);
}
ED_object_base_select(basen, BA_SELECT);
@@ -2466,7 +2476,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot)
/**************************** Join *************************/
-static int join_poll(bContext *C)
+static bool join_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -2518,7 +2528,7 @@ void OBJECT_OT_join(wmOperatorType *ot)
/**************************** Join as Shape Key*************************/
-static int join_shapes_poll(bContext *C)
+static bool join_shapes_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index a8da5c038b4..8ad0d09a9fb 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -118,6 +118,7 @@ typedef struct MultiresBakerJobData {
/* data passing to multires-baker job */
typedef struct {
+ Scene *scene;
ListBase data;
bool bake_clear; /* Clear the images before baking */
int bake_filter; /* Bake-filter, aka margin */
@@ -241,7 +242,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
tmp_mmd.lvl = *lvl;
tmp_mmd.sculptlvl = *lvl;
- dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
+ dm = multires_make_derived_from_derived(cddm, &tmp_mmd, scene, ob, 0);
cddm->release(cddm);
return dm;
@@ -268,7 +269,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
tmp_mmd.lvl = mmd->totlvl;
tmp_mmd.sculptlvl = mmd->totlvl;
- dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, 0);
+ dm = multires_make_derived_from_derived(cddm, &tmp_mmd, scene, ob, 0);
cddm->release(cddm);
return dm;
@@ -371,6 +372,7 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
multires_force_update(ob);
/* copy data stored in job descriptor */
+ bkr.scene = scene;
bkr.bake_filter = scene->r.bake_filter;
bkr.mode = scene->r.bake_mode;
bkr.use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
@@ -413,6 +415,7 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
Object *ob;
/* backup scene settings, so their changing in UI would take no effect on baker */
+ bkj->scene = scene;
bkj->bake_filter = scene->r.bake_filter;
bkj->mode = scene->r.bake_mode;
bkj->use_lores_mesh = scene->r.bake_flag & R_BAKE_LORES_MESH;
@@ -474,6 +477,7 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
MultiresBakeRender bkr = {NULL};
/* copy data stored in job descriptor */
+ bkr.scene = bkj->scene;
bkr.bake_filter = bkj->bake_filter;
bkr.mode = bkj->mode;
bkr.use_lores_mesh = bkj->use_lores_mesh;
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 3b5a8d190ff..d7bef459b82 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -578,7 +578,7 @@ static const EnumPropertyItem constraint_owner_items[] = {
{0, NULL, 0, NULL, NULL}};
-static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
+static bool edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", rna_type);
Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
@@ -606,7 +606,7 @@ static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type)
return 1;
}
-static int edit_constraint_poll(bContext *C)
+static bool edit_constraint_poll(bContext *C)
{
return edit_constraint_poll_generic(C, &RNA_Constraint);
}
@@ -1265,7 +1265,7 @@ void ED_object_constraint_dependency_tag_update(Main *bmain, Object *ob, bConstr
DEG_relations_tag_update(bmain);
}
-static int constraint_poll(bContext *C)
+static bool constraint_poll(bContext *C)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint);
return (ptr.id.data && ptr.data);
@@ -2102,4 +2102,3 @@ void POSE_OT_ik_clear(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-
diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c
index 788f0826848..f56fd560946 100644
--- a/source/blender/editors/object/object_data_transfer.c
+++ b/source/blender/editors/object/object_data_transfer.c
@@ -442,7 +442,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op)
/* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */
/* Note this context poll is only really partial, it cannot check for all possible invalid cases. */
-static int data_transfer_poll(bContext *C)
+static bool data_transfer_poll(bContext *C)
{
Object *ob = ED_object_active_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -610,7 +610,7 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot)
* or as a DataTransfer modifier tool.
*/
-static int datalayout_transfer_poll(bContext *C)
+static bool datalayout_transfer_poll(bContext *C)
{
return (edit_modifier_poll_generic(C, &RNA_DataTransferModifier, (1 << OB_MESH)) || data_transfer_poll(C));
}
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index f050297ee2f..0ca797e43b6 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -148,7 +148,7 @@ Object *ED_object_active_context(bContext *C)
/* ********************** object hiding *************************** */
-static int object_hide_poll(bContext *C)
+static bool object_hide_poll(bContext *C)
{
if (CTX_wm_space_outliner(C) != NULL) {
return ED_outliner_collections_editor_poll(C);
@@ -166,8 +166,8 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *op)
bool changed = false;
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (base->flag & BASE_HIDE) {
- base->flag &= ~BASE_HIDE;
+ if (base->flag & BASE_HIDDEN) {
+ base->flag &= ~BASE_HIDDEN;
changed = true;
if (select) {
@@ -210,33 +210,42 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
- bool changed = false;
+ /* Do nothing if no objects was selected. */
+ bool have_selected = false;
+ for (Base *base = view_layer->object_bases.first; base; base = base->next) {
+ if (base->flag & BASE_VISIBLE) {
+ if (base->flag & BASE_SELECTED) {
+ have_selected = true;
+ break;
+ }
+ }
+ }
+
+ if (!have_selected) {
+ return OPERATOR_CANCELLED;
+ }
+
+ /* Hide selected or unselected objects. */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (!(base->flag & BASE_VISIBLED)) {
+ if (!(base->flag & BASE_VISIBLE)) {
continue;
}
if (!unselected) {
if (base->flag & BASE_SELECTED) {
ED_object_base_select(base, BA_DESELECT);
- base->flag |= BASE_HIDE;
- changed = true;
+ base->flag |= BASE_HIDDEN;
}
}
else {
if (!(base->flag & BASE_SELECTED)) {
ED_object_base_select(base, BA_DESELECT);
- base->flag |= BASE_HIDE;
- changed = true;
+ base->flag |= BASE_HIDDEN;
}
}
}
- if (!changed) {
- return OPERATOR_CANCELLED;
- }
-
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -306,7 +315,8 @@ void ED_hide_collections_menu_draw(const bContext *C, uiLayout *layout)
}
if ((view_layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS)) {
+ !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS))
+ {
uiLayoutSetActive(row, false);
}
@@ -704,7 +714,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int editmode_toggle_poll(bContext *C)
+static bool editmode_toggle_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -876,7 +886,6 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
Base *base;
Curve *cu, *cu1;
Nurb *nu;
- bool do_depgraph_update = false;
if (ID_IS_LINKED(scene)) return;
@@ -1033,8 +1042,8 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
else if (event == 22) {
/* Copy the constraint channels over */
BKE_constraints_copy(&base->object->constraints, &ob->constraints, true);
-
- do_depgraph_update = true;
+ DEG_id_tag_update(&base->object->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
}
else if (event == 23) {
base->object->softflag = ob->softflag;
@@ -1045,6 +1054,9 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
if (!modifiers_findByType(base->object, eModifierType_Softbody)) {
BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
}
+
+ DEG_id_tag_update(&base->object->id, DEG_TAG_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
}
else if (event == 26) {
#if 0 // XXX old animation system
@@ -1085,9 +1097,6 @@ static void copy_attr(Main *bmain, Scene *scene, ViewLayer *view_layer, short ev
}
}
}
-
- if (do_depgraph_update)
- DEG_relations_tag_update(bmain);
}
static void UNUSED_FUNCTION(copy_attr_menu) (Main *bmain, Scene *scene, ViewLayer *view_layer, Object *obedit)
@@ -1316,7 +1325,7 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot)
/* --------- */
-static int object_update_paths_poll(bContext *C)
+static bool object_update_paths_poll(bContext *C)
{
if (ED_operator_object_active_editable(C)) {
Object *ob = ED_object_active_context(C);
@@ -1485,7 +1494,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
return (done) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
-static int shade_poll(bContext *C)
+static bool shade_poll(bContext *C)
{
return (CTX_data_edit_object(C) == NULL);
}
@@ -1572,7 +1581,7 @@ static const EnumPropertyItem *object_mode_set_itemsf(
return item;
}
-static int object_mode_set_poll(bContext *C)
+static bool object_mode_set_poll(bContext *C)
{
/* Since Grease Pencil editmode is also handled here,
* we have a special exception for allowing this operator
@@ -1770,7 +1779,7 @@ bool ED_object_editmode_calc_active_center(Object *obedit, const bool select_onl
return false;
}
-static int move_to_collection_poll(bContext *C)
+static bool move_to_collection_poll(bContext *C)
{
if (CTX_wm_space_outliner(C) != NULL) {
return ED_outliner_collections_editor_poll(C);
@@ -1850,7 +1859,7 @@ static int move_to_collection_exec(bContext *C, wmOperator *op)
is_link ? "linked" : "moved",
collection->id.name + 2);
- DEG_relations_tag_update(CTX_data_main(C));
+ DEG_relations_tag_update(bmain);
DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
@@ -2089,4 +2098,3 @@ void OBJECT_OT_link_to_collection(wmOperatorType *ot)
"Name of the newly added collection");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
-
diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c
index c5882560083..a561556bba0 100644
--- a/source/blender/editors/object/object_facemap_ops.c
+++ b/source/blender/editors/object/object_facemap_ops.c
@@ -163,14 +163,14 @@ static void object_facemap_swap(Object *ob, int num1, int num2)
object_fmap_swap_object_mode(ob, num1, num2);
}
-static int face_map_supported_poll(bContext *C)
+static bool face_map_supported_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
return (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib);
}
-static int face_map_supported_edit_mode_poll(bContext *C)
+static bool face_map_supported_edit_mode_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 8a52b6c5ef5..53cabe3759e 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -47,6 +47,7 @@
#include "BKE_report.h"
#include "BKE_object.h"
+#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "ED_screen.h"
@@ -153,6 +154,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
if (!BKE_collection_object_cyclic_check(bmain, base->object, collection)) {
BKE_collection_object_add(bmain, collection, base->object);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
updated = true;
}
else {
@@ -223,6 +225,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
BKE_collection_object_remove(bmain, collection, base->object, false);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
ok = 1;
}
CTX_DATA_END;
@@ -315,6 +318,7 @@ static int collection_objects_remove_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
BKE_collection_object_remove(bmain, collection, base->object, false);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
updated = true;
}
CTX_DATA_END;
@@ -366,6 +370,7 @@ static int collection_create_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, selected_bases)
{
BKE_collection_object_add(bmain, collection, base->object);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
}
CTX_DATA_END;
@@ -555,7 +560,7 @@ static int select_grouped_exec(bContext *C, wmOperator *UNUSED(op)) /* Select o
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
if (BKE_collection_has_object_recursive(collection, base->object)) {
ED_object_base_select(base, BA_SELECT);
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 6a3cb9aa097..392fde4ceec 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -434,7 +434,7 @@ static void object_hook_select(Object *ob, HookModifierData *hmd)
/* special poll operators for hook operators */
/* TODO: check for properties window modifier context too as alternative? */
-static int hook_op_edit_poll(bContext *C)
+static bool hook_op_edit_poll(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
@@ -917,4 +917,3 @@ void OBJECT_OT_hook_select(wmOperatorType *ot)
RNA_def_enum_funcs(prop, hook_mod_itemf);
RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
}
-
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index f7179912f52..b1ea6d72346 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -145,8 +145,8 @@ void COLLECTION_OT_objects_add_active(struct wmOperatorType *ot);
void COLLECTION_OT_objects_remove_active(struct wmOperatorType *ot);
/* object_modifier.c */
-int edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag);
-int edit_modifier_poll(struct bContext *C);
+bool edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag);
+bool edit_modifier_poll(struct bContext *C);
void edit_modifier_properties(struct wmOperatorType *ot);
int edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op);
struct ModifierData *edit_modifier_property_get(struct wmOperator *op, struct Object *ob, int type);
@@ -273,4 +273,3 @@ void OBJECT_OT_data_transfer(struct wmOperatorType *ot);
void OBJECT_OT_datalayout_transfer(struct wmOperatorType *ot);
#endif /* __OBJECT_INTERN_H__ */
-
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 425a0acff17..2889f798dd8 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -324,8 +324,6 @@ static bool object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
}
- DEG_relations_tag_update(bmain);
-
BLI_remlink(&ob->modifiers, md);
modifier_free(md);
BKE_object_free_derived_caches(ob);
@@ -529,9 +527,7 @@ static int modifier_apply_shape(
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
- if (mti->isDisabled && mti->isDisabled(md, 0)) {
+ if (mti->isDisabled && mti->isDisabled(scene, md, 0)) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
return 0;
}
@@ -570,7 +566,7 @@ static int modifier_apply_shape(
/* if that was the first key block added, then it was the basis.
* Initialize it with the mesh, and add another for the modifier */
kb = BKE_keyblock_add(key, NULL);
- BKE_keyblock_convert_from_mesh(me, kb);
+ BKE_keyblock_convert_from_mesh(me, key, kb);
}
kb = BKE_keyblock_add(key, md->name);
@@ -589,9 +585,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen
{
const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
- md->scene = scene;
-
- if (mti->isDisabled && mti->isDisabled(md, 0)) {
+ if (mti->isDisabled && mti->isDisabled(scene, md, 0)) {
BKE_report(reports, RPT_ERROR, "Modifier is disabled, skipping apply");
return 0;
}
@@ -644,7 +638,7 @@ static int modifier_apply_obdata(ReportList *reports, Depsgraph *depsgraph, Scen
BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
vertexCos = BKE_curve_nurbs_vertexCos_get(&cu->nurb, &numVerts);
- modifier_deformVerts_DM_deprecated(md, &mectx, NULL, vertexCos, numVerts);
+ modifier_deformVerts(md, &mectx, NULL, vertexCos, numVerts);
BK_curve_nurbs_vertexCos_apply(&cu->nurb, vertexCos);
MEM_freeN(vertexCos);
@@ -822,7 +816,7 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
/************************ generic functions for operators using mod names and data context *********************/
-int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
+bool edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C);
@@ -844,7 +838,7 @@ int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag
return 1;
}
-int edit_modifier_poll(bContext *C)
+bool edit_modifier_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_Modifier, 0);
}
@@ -1149,20 +1143,21 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot)
/************* multires delete higher levels operator ****************/
-static int multires_poll(bContext *C)
+static bool multires_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1 << OB_MESH));
}
static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
{
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
- multiresModifier_del_levels(mmd, ob, 1);
+ multiresModifier_del_levels(mmd, scene, ob, 1);
ED_object_iter_other(CTX_data_main(C), ob, true,
ED_object_multires_update_totlevels_cb,
@@ -1200,13 +1195,14 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
static int multires_subdivide_exec(bContext *C, wmOperator *op)
{
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
- multiresModifier_subdivide(mmd, ob, 0, mmd->simple);
+ multiresModifier_subdivide(mmd, scene, ob, 0, mmd->simple);
ED_object_iter_other(CTX_data_main(C), ob, true,
ED_object_multires_update_totlevels_cb,
@@ -1423,13 +1419,14 @@ void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
/********************* multires apply base ***********************/
static int multires_base_apply_exec(bContext *C, wmOperator *op)
{
+ Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
- multiresModifier_base_apply(mmd, ob);
+ multiresModifier_base_apply(mmd, scene, ob);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1475,13 +1472,13 @@ static void modifier_skin_customdata_delete(Object *ob)
CustomData_free_layer_active(&me->vdata, CD_MVERT_SKIN, me->totvert);
}
-static int skin_poll(bContext *C)
+static bool skin_poll(bContext *C)
{
return (!CTX_data_edit_object(C) &&
edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH)));
}
-static int skin_edit_poll(bContext *C)
+static bool skin_edit_poll(bContext *C)
{
return (CTX_data_edit_object(C) &&
edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH)));
@@ -1849,7 +1846,7 @@ void OBJECT_OT_skin_armature_create(wmOperatorType *ot)
}
/************************ delta mush bind operator *********************/
-static int correctivesmooth_poll(bContext *C)
+static bool correctivesmooth_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_CorrectiveSmoothModifier, 0);
}
@@ -1917,7 +1914,7 @@ void OBJECT_OT_correctivesmooth_bind(wmOperatorType *ot)
/************************ mdef bind operator *********************/
-static int meshdeform_poll(bContext *C)
+static bool meshdeform_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, 0);
}
@@ -2013,7 +2010,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
/****************** explode refresh operator *********************/
-static int explode_poll(bContext *C)
+static bool explode_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_ExplodeModifier, 0);
}
@@ -2061,7 +2058,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot)
/****************** ocean bake operator *********************/
-static int ocean_bake_poll(bContext *C)
+static bool ocean_bake_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_OceanModifier, 0);
}
@@ -2279,7 +2276,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot)
/************************ LaplacianDeform bind operator *********************/
-static int laplaciandeform_poll(bContext *C)
+static bool laplaciandeform_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0);
}
@@ -2355,7 +2352,7 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot)
/************************ sdef bind operator *********************/
-static int surfacedeform_bind_poll(bContext *C)
+static bool surfacedeform_bind_poll(bContext *C)
{
return edit_modifier_poll_generic(C, &RNA_SurfaceDeformModifier, 0);
}
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 89dd54b6f64..b52ef7a1abc 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -278,7 +278,7 @@ void ED_operatormacros_object(void)
}
-static int object_mode_poll(bContext *C)
+static bool object_mode_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
return (!ob || ob->mode == OB_MODE_OBJECT);
@@ -299,7 +299,9 @@ void ED_keymap_object(wmKeyConfig *keyconf)
kmi = WM_keymap_add_menu_pie(keymap, "VIEW3D_MT_object_mode_pie", TABKEY, KM_CLICK_DRAG, 0, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "OBJECT_OT_origin_set", CKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_CTRL, 0);
+#endif
/* Object Mode ---------------------------------------------------------------- */
/* Note: this keymap gets disabled in non-objectmode, */
@@ -320,7 +322,9 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+#endif
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
RNA_enum_set_identifier(NULL, kmi->ptr, "direction", "PARENT");
@@ -339,14 +343,19 @@ void ED_keymap_object(wmKeyConfig *keyconf)
RNA_boolean_set(kmi->ptr, "extend", true);
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+#endif
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_verify_item(keymap, "OBJECT_OT_track_set", TKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_track_clear", TKEY, KM_PRESS, KM_ALT, 0);
+#endif
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
-
+#endif
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_location_clear", GKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "clear_delta", false);
@@ -355,11 +364,12 @@ void ED_keymap_object(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "clear_delta", false);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_verify_item(keymap, "OBJECT_OT_origin_clear", OKEY, KM_PRESS, KM_ALT, 0);
+#endif
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "use_global", false);
-
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "use_global", true);
@@ -370,19 +380,25 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+#endif
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_apply", AKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_menu(keymap, "VIEW3D_MT_make_single_user", UKEY, KM_PRESS, 0, 0);
+#endif
WM_keymap_add_menu(keymap, "VIEW3D_MT_make_links", LKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move_linked", DKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "OBJECT_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "OBJECT_OT_make_local", LKEY, KM_PRESS, 0, 0);
+#endif
/* XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith */
WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
@@ -397,7 +413,9 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_verify_item(keymap, "OBJECT_OT_data_transfer", TKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+#endif
/* XXX No more available 'T' shortcuts... :/ */
/* WM_keymap_verify_item(keymap, "OBJECT_OT_datalayout_transfer", TKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0); */
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index a114b2cc6d5..324b6eca34a 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -118,7 +118,7 @@
/*********************** Make Vertex Parent Operator ************************/
-static int vertex_parent_set_poll(bContext *C)
+static bool vertex_parent_set_poll(bContext *C)
{
return ED_operator_editmesh(C) || ED_operator_editsurfcurve(C) || ED_operator_editlattice(C);
}
@@ -1419,6 +1419,7 @@ static bool allow_make_links_data(const int type, Object *ob_src, Object *ob_dst
static int make_links_data_exec(bContext *C, wmOperator *op)
{
+ Scene *scene = CTX_data_scene(C);
Main *bmain = CTX_data_main(C);
const int type = RNA_enum_get(op->ptr, "type");
Object *ob_src;
@@ -1503,7 +1504,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
}
break;
case MAKE_LINKS_MODIFIERS:
- BKE_object_link_modifiers(ob_dst, ob_src);
+ BKE_object_link_modifiers(scene, ob_dst, ob_src);
DEG_id_tag_update(&ob_dst->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
break;
case MAKE_LINKS_FONTS:
@@ -2342,7 +2343,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
new_ob->id.override_static->flag &= ~STATICOVERRIDE_AUTO;
}
/* We still want to store all objects' current override status (i.e. change of parent). */
- BKE_override_static_operations_create(&new_ob->id, true);
+ BKE_override_static_operations_create(bmain, &new_ob->id, true);
}
}
FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
@@ -2386,7 +2387,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
return success ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
-static int make_override_static_poll(bContext *C)
+static bool make_override_static_poll(bContext *C)
{
Object *obact = CTX_data_active_object(C);
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index ce29125ac79..b1dee812f45 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -100,7 +100,7 @@ void ED_object_base_select(Base *base, eObjectSelect_Mode mode)
if (base) {
switch (mode) {
case BA_SELECT:
- if ((base->flag & BASE_SELECTABLED) != 0) {
+ if ((base->flag & BASE_SELECTABLE) != 0) {
base->flag |= BASE_SELECTED;
}
break;
@@ -134,7 +134,7 @@ void ED_object_base_activate(bContext *C, Base *base)
/********************** Selection Operators **********************/
-static int objects_selectable_poll(bContext *C)
+static bool objects_selectable_poll(bContext *C)
{
/* we don't check for linked scenes here, selection is
* still allowed then for inspection of scene */
@@ -229,7 +229,7 @@ static bool object_select_all_by_obdata(bContext *C, void *obdata)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
if (base->object->data == obdata) {
ED_object_base_select(base, BA_SELECT);
changed = true;
@@ -247,7 +247,7 @@ static bool object_select_all_by_material(bContext *C, Material *mat)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
Object *ob = base->object;
Material *mat1;
int a;
@@ -274,7 +274,7 @@ static bool object_select_all_by_dup_group(bContext *C, Object *ob)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
Collection *dup_group_other = (base->object->transflag & OB_DUPLICOLLECTION) ? base->object->dup_group : NULL;
if (dup_group == dup_group_other) {
ED_object_base_select(base, BA_SELECT);
@@ -294,7 +294,7 @@ static bool object_select_all_by_particle(bContext *C, Object *ob)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
/* loop through other particles*/
ParticleSystem *psys;
@@ -322,7 +322,7 @@ static bool object_select_all_by_library(bContext *C, Library *lib)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
if (lib == base->object->id.lib) {
ED_object_base_select(base, BA_SELECT);
changed = true;
@@ -340,7 +340,7 @@ static bool object_select_all_by_library_obdata(bContext *C, Library *lib)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
if (base->object->data && lib == ((ID *)base->object->data)->lib) {
ED_object_base_select(base, BA_SELECT);
changed = true;
@@ -568,7 +568,7 @@ static bool select_grouped_collection(bContext *C, Object *ob) /* Select object
collection = ob_collections[0];
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
if (BKE_collection_has_object(collection, base->object)) {
ED_object_base_select(base, BA_SELECT);
changed = true;
@@ -931,7 +931,7 @@ static int object_select_same_collection_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN (C, Base *, base, visible_bases)
{
- if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
if (BKE_collection_has_object(collection, base->object)) {
ED_object_base_select(base, BA_SELECT);
}
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 4f985293ec3..5e66dc00fd2 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -224,14 +224,14 @@ static bool object_shape_key_mirror(bContext *C, Object *ob,
/********************** shape key operators *********************/
-static int shape_key_mode_poll(bContext *C)
+static bool shape_key_mode_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && ob->mode != OB_MODE_EDIT);
}
-static int shape_key_mode_exists_poll(bContext *C)
+static bool shape_key_mode_exists_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -242,7 +242,7 @@ static int shape_key_mode_exists_poll(bContext *C)
(BKE_keyblock_from_object(ob) != NULL);
}
-static int shape_key_move_poll(bContext *C)
+static bool shape_key_move_poll(bContext *C)
{
/* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */
Object *ob = ED_object_context(C);
@@ -253,7 +253,7 @@ static int shape_key_move_poll(bContext *C)
ob->mode != OB_MODE_EDIT && key && key->totkey > 1);
}
-static int shape_key_poll(bContext *C)
+static bool shape_key_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -502,4 +502,3 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
}
-
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index a6f688c49fb..ca5c000819d 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -63,7 +63,6 @@
#include "BKE_layer.h"
#include "BKE_modifier.h"
#include "BKE_report.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_object_deform.h"
#include "BKE_object.h"
#include "BKE_lattice.h"
@@ -1258,27 +1257,6 @@ static void getVerticalAndHorizontalChange(
changes[index][1] = len_v3v3(projA, projB);
}
-/* I need the derived mesh to be forgotten so the positions are recalculated
- * with weight changes (see dm_deform_recalc) */
-static void dm_deform_clear(DerivedMesh *dm, Object *ob)
-{
- if (ob->derivedDeform && (ob->derivedDeform) == dm) {
- ob->derivedDeform->needsFree = 1;
- ob->derivedDeform->release(ob->derivedDeform);
- ob->derivedDeform = NULL;
- }
- else if (dm) {
- dm->needsFree = 1;
- dm->release(dm);
- }
-}
-
-/* recalculate the deformation */
-static DerivedMesh *dm_deform_recalc(Depsgraph *depsgraph, Scene *scene, Object *ob)
-{
- return mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
-}
-
/* by changing nonzero weights, try to move a vertex in me->mverts with index 'index' to
* distToBe distance away from the provided plane strength can change distToBe so that it moves
* towards distToBe by that percentage cp changes how much the weights are adjusted
@@ -1292,7 +1270,7 @@ static void moveCloserToDistanceFromPlane(
Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *me, int index, float norm[3],
float coord[3], float d, float distToBe, float strength, float cp)
{
- DerivedMesh *dm;
+ Mesh *me_deform;
MDeformWeight *dw;
MVert m;
MDeformVert *dvert = me->dvert + index;
@@ -1316,8 +1294,8 @@ static void moveCloserToDistanceFromPlane(
float originalDistToBe = distToBe;
do {
wasChange = false;
- dm = dm_deform_recalc(depsgraph, scene, ob);
- dm->getVert(dm, index, &m);
+ me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ m = me_deform->mvert[index];
copy_v3_v3(oldPos, m.co);
distToStart = dot_v3v3(norm, oldPos) + d;
@@ -1335,8 +1313,10 @@ static void moveCloserToDistanceFromPlane(
continue;
}
for (k = 0; k < 2; k++) {
- if (dm) {
- dm_deform_clear(dm, ob); dm = NULL;
+ if (me_deform) {
+ /* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs!
+ * Better to over-free and recompute a bit. */
+ BKE_object_free_derived_caches(ob);
}
oldw = dw->weight;
if (k) {
@@ -1354,8 +1334,8 @@ static void moveCloserToDistanceFromPlane(
if (dw->weight > 1) {
dw->weight = 1;
}
- dm = dm_deform_recalc(depsgraph, scene, ob);
- dm->getVert(dm, index, &m);
+ me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ m = me_deform->mvert[index];
getVerticalAndHorizontalChange(norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
dw->weight = oldw;
if (!k) {
@@ -1449,8 +1429,10 @@ static void moveCloserToDistanceFromPlane(
if (oldw == dw->weight) {
wasChange = false;
}
- if (dm) {
- dm_deform_clear(dm, ob); dm = NULL;
+ if (me_deform) {
+ /* DO NOT try to do own cleanup here, this is call for dramatic failures and bugs!
+ * Better to over-free and recompute a bit. */
+ BKE_object_free_derived_caches(ob);
}
}
} while (wasChange && ((distToStart - distToBe) / fabsf(distToStart - distToBe) ==
@@ -1482,11 +1464,10 @@ static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distTo
MVert *p = MEM_callocN(sizeof(MVert) * (count), "deformedPoints");
int k;
- DerivedMesh *dm = mesh_get_derived_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ Mesh *me_deform = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
k = count;
while (k--) {
- dm->getVert(dm, verts[k], &m);
- p[k] = m;
+ p[k] = me_deform->mvert[verts[k]];
}
if (count >= 3) {
@@ -1494,7 +1475,7 @@ static void vgroup_fix(const bContext *C, Scene *scene, Object *ob, float distTo
float coord[3];
float norm[3];
getSingleCoordinate(p, count, coord);
- dm->getVert(dm, i, &m);
+ m = me_deform->mvert[i];
sub_v3_v3v3(norm, m.co, coord);
mag = normalize_v3(norm);
if (mag) { /* zeros fix */
@@ -2485,7 +2466,7 @@ static void vgroup_assign_verts(Object *ob, const float weight)
/********************** vertex group operators *********************/
-static int vertex_group_poll(bContext *C)
+static bool vertex_group_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -2496,7 +2477,7 @@ static int vertex_group_poll(bContext *C)
ob->defbase.first);
}
-static int vertex_group_supported_poll(bContext *C)
+static bool vertex_group_supported_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -2504,7 +2485,7 @@ static int vertex_group_supported_poll(bContext *C)
data && !ID_IS_LINKED(data));
}
-static int vertex_group_mesh_poll(bContext *C)
+static bool vertex_group_mesh_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -2515,7 +2496,7 @@ static int vertex_group_mesh_poll(bContext *C)
ob->defbase.first);
}
-static int UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C)
+static bool UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -2523,7 +2504,7 @@ static int UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C)
}
-static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C)
+static bool UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -2535,7 +2516,7 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C)
}
/* editmode _or_ weight paint vertex sel */
-static int vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const short ob_type_flag)
+static bool vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const short ob_type_flag)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -2570,25 +2551,25 @@ static int vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const
}
#if 0
-static int vertex_group_vert_poll(bContext *C)
+static bool vertex_group_vert_poll(bContext *C)
{
return vertex_group_vert_poll_ex(C, false, 0);
}
#endif
-static int vertex_group_mesh_vert_poll(bContext *C)
+static bool vertex_group_mesh_vert_poll(bContext *C)
{
return vertex_group_vert_poll_ex(C, false, (1 << OB_MESH));
}
-static int vertex_group_vert_select_poll(bContext *C)
+static bool vertex_group_vert_select_poll(bContext *C)
{
return vertex_group_vert_poll_ex(C, true, 0);
}
#if 0
-static int vertex_group_mesh_vert_select_poll(bContext *C)
+static bool vertex_group_mesh_vert_select_poll(bContext *C)
{
return vertex_group_vert_poll_ex(C, true, (1 << OB_MESH));
}
@@ -2596,7 +2577,7 @@ static int vertex_group_mesh_vert_select_poll(bContext *C)
/* editmode _or_ weight paint vertex sel and active group unlocked */
-static int vertex_group_vert_select_unlocked_poll(bContext *C)
+static bool vertex_group_vert_select_unlocked_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
@@ -2619,7 +2600,7 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C)
return 1;
}
-static int vertex_group_vert_select_mesh_poll(bContext *C)
+static bool vertex_group_vert_select_mesh_poll(bContext *C)
{
Object *ob = ED_object_context(C);
ID *data = (ob) ? ob->data : NULL;
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index 57b22991f94..ac031079434 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -370,4 +370,3 @@ void BOID_OT_state_move_down(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 08eaaa7284f..e637a58e8c6 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -53,7 +53,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_library.h"
@@ -80,6 +79,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
+#include "GPU_state.h"
#include "UI_resources.h"
@@ -101,7 +101,7 @@
/**************************** utilities *******************************/
-int PE_poll(bContext *C)
+bool PE_poll(bContext *C)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -112,7 +112,7 @@ int PE_poll(bContext *C)
return (PE_get_current(scene, ob) != NULL);
}
-int PE_hair_poll(bContext *C)
+bool PE_hair_poll(bContext *C)
{
Scene *scene= CTX_data_scene(C);
Object *ob= CTX_data_active_object(C);
@@ -126,7 +126,7 @@ int PE_hair_poll(bContext *C)
return (edit && edit->psys);
}
-int PE_poll_view3d(bContext *C)
+bool PE_poll_view3d(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
ARegion *ar = CTX_wm_region(C);
@@ -2897,13 +2897,13 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
immUniformColor4ub(255, 255, 255, 128);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
imm_draw_circle_wire_2d(pos, (float)x, (float)y, pe_brush_size_get(scene, brush), 40);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
immUnbindProgram();
}
@@ -3017,7 +3017,7 @@ static void PE_mirror_x(
/* Note: In case psys uses Mesh tessface indices, we mirror final Mesh itself, not orig mesh. Avoids an (impossible)
* mesh -> orig -> mesh tessface indices conversion... */
- mirrorfaces = mesh_get_x_mirror_faces__real_mesh(ob, NULL, use_dm_final_indices ? psmd_eval->mesh_final : NULL);
+ mirrorfaces = mesh_get_x_mirror_faces(ob, NULL, use_dm_final_indices ? psmd_eval->mesh_final : NULL);
if (!edit->mirror_cache)
PE_update_mirror_cache(ob, psys);
@@ -3531,7 +3531,7 @@ static void intersect_dm_quad_weights(const float v1[3], const float v2[3], cons
interp_weights_poly_v3(w, vert, 4, co);
}
-/* check intersection with a derivedmesh */
+/** Check intersection with an evaluated mesh. */
static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *scene, Object *ob, Mesh *mesh,
float *vert_cos,
const float co1[3], const float co2[3],
@@ -3548,18 +3548,16 @@ static int particle_intersect_mesh(Depsgraph *depsgraph, Scene *scene, Object *o
if (mesh == NULL) {
psys_disable_all(ob);
- /* TODO(Sybren): port to Mesh when we have decided how to handle derivedFinal and derivedDeform */
- DerivedMesh *dm = mesh_get_derived_final(depsgraph, scene, ob, 0);
- if (dm == NULL)
- dm = mesh_get_derived_deform(depsgraph, scene, ob, 0);
+ mesh = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ if (mesh == NULL) {
+ mesh = mesh_get_eval_deform(depsgraph, scene, ob, CD_MASK_BAREMESH);
+ }
psys_enable_all(ob);
- if (dm == NULL)
+ if (mesh == NULL) {
return 0;
-
- mesh = BKE_id_new_nomain(ID_ME, NULL);
- DM_to_mesh(dm, mesh, ob, CD_MASK_EVERYTHING, false);
+ }
}
/* BMESH_ONLY, deform dm may not have tessface */
@@ -4393,7 +4391,7 @@ void PARTICLE_OT_brush_edit(wmOperatorType *ot)
/*********************** cut shape ***************************/
-static int shape_cut_poll(bContext *C)
+static bool shape_cut_poll(bContext *C)
{
if (PE_hair_poll(C)) {
Scene *scene = CTX_data_scene(C);
@@ -4759,7 +4757,7 @@ void PE_create_particle_edit(
}
}
-static int particle_edit_toggle_poll(bContext *C)
+static bool particle_edit_toggle_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -5005,4 +5003,3 @@ void PARTICLE_OT_unify_length(struct wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 8a9eb369e66..4431e4f4a54 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -43,9 +43,8 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
+#include "BKE_bvhutils.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -160,7 +159,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
/********************** new particle settings operator *********************/
-static int psys_poll(bContext *C)
+static bool psys_poll(bContext *C)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
return (ptr.data != NULL);
@@ -388,6 +387,35 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/************************ refresh dupli objects *********************/
+
+static int dupliob_refresh_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
+ ParticleSystem *psys= ptr.data;
+
+ if (!psys)
+ return OPERATOR_CANCELLED;
+
+ psys_check_group_weights(psys->part);
+ DEG_id_tag_update(&psys->part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
+
+ return OPERATOR_FINISHED;
+}
+
+void PARTICLE_OT_dupliob_refresh(wmOperatorType *ot)
+{
+ ot->name = "Refresh Dupli Objects";
+ ot->idname = "PARTICLE_OT_dupliob_refresh";
+ ot->description = "Refresh list of dupli objects and their weights";
+
+ ot->exec = dupliob_refresh_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/************************ move up particle dupliweight operator *********************/
static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
@@ -406,6 +434,7 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
BLI_remlink(&part->dupliweights, dw);
BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
+ DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
break;
}
@@ -445,6 +474,7 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
dw->flag |= PART_DUPLIW_CURRENT;
BLI_addhead(&part->dupliweights, dw);
+ DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
break;
}
@@ -491,6 +521,7 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
if (dw)
dw->flag |= PART_DUPLIW_CURRENT;
+ DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
return OPERATOR_FINISHED;
@@ -528,6 +559,7 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
BLI_remlink(&part->dupliweights, dw);
BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
+ DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
break;
}
@@ -1046,11 +1078,8 @@ static bool copy_particle_systems_to_object(const bContext *C,
*/
psys_start = totpsys > 0 ? tmp_psys[0] : NULL;
- /* get the DM (psys and their modifiers have not been appended yet) */
- /* TODO(Sybren): use mesh_eval instead */
- DerivedMesh *final_dm = mesh_get_derived_final(depsgraph, scene, ob_to, cdmask);
- final_mesh = BKE_id_new_nomain(ID_ME, NULL);
- DM_to_mesh(final_dm, final_mesh, ob_to, CD_MASK_EVERYTHING, false);
+ /* Get the evaluated mesh (psys and their modifiers have not been appended yet) */
+ final_mesh = mesh_get_eval_final(depsgraph, scene, ob_to, cdmask);
/* now append psys to the object and make modifiers */
for (i = 0, psys_from = PSYS_FROM_FIRST;
@@ -1138,7 +1167,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
return true;
}
-static int copy_particle_systems_poll(bContext *C)
+static bool copy_particle_systems_poll(bContext *C)
{
Object *ob;
if (!ED_operator_object_active_editable(C))
@@ -1214,7 +1243,7 @@ void PARTICLE_OT_copy_particle_systems(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_active", false, "Use Active", "Use the active particle system from the context");
}
-static int duplicate_particle_systems_poll(bContext *C)
+static bool duplicate_particle_systems_poll(bContext *C)
{
if (!ED_operator_object_active_editable(C)) {
return false;
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 904e4242ed1..6cc9b9b8e4d 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -1125,4 +1125,3 @@ void FLUID_OT_bake(wmOperatorType *ot)
ot->exec = fluid_bake_exec;
ot->poll = ED_operator_object_active_editable;
}
-
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index e94f582141b..df688d90e44 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -95,6 +95,7 @@ void PARTICLE_OT_dupliob_copy(struct wmOperatorType *ot);
void PARTICLE_OT_dupliob_remove(struct wmOperatorType *ot);
void PARTICLE_OT_dupliob_move_up(struct wmOperatorType *ot);
void PARTICLE_OT_dupliob_move_down(struct wmOperatorType *ot);
+void PARTICLE_OT_dupliob_refresh(struct wmOperatorType *ot);
/* particle_boids.c */
void BOID_OT_rule_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index ffa73b41bd9..73bb2d14505 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -85,6 +85,7 @@ static void operatortypes_particle(void)
WM_operatortype_append(PARTICLE_OT_copy_particle_systems);
WM_operatortype_append(PARTICLE_OT_duplicate_particle_system);
+ WM_operatortype_append(PARTICLE_OT_dupliob_refresh);
WM_operatortype_append(PARTICLE_OT_dupliob_copy);
WM_operatortype_append(PARTICLE_OT_dupliob_remove);
WM_operatortype_append(PARTICLE_OT_dupliob_move_up);
@@ -228,6 +229,3 @@ void ED_keymap_physics(wmKeyConfig *keyconf)
keymap_particle(keyconf);
//keymap_pointcache(keyconf);
}
-
-
-
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 343804726bf..7fc3dc2e1b8 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -57,12 +57,12 @@
#include "physics_intern.h"
-static int ptcache_bake_all_poll(bContext *C)
+static bool ptcache_bake_all_poll(bContext *C)
{
return CTX_data_scene(C) != NULL;
}
-static int ptcache_poll(bContext *C)
+static bool ptcache_poll(bContext *C)
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache);
return (ptr.data && ptr.id.data);
@@ -440,4 +440,3 @@ void PTCACHE_OT_remove(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
-
diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c
index f62b72679d0..7ec814bc142 100644
--- a/source/blender/editors/physics/rigidbody_constraint.c
+++ b/source/blender/editors/physics/rigidbody_constraint.c
@@ -61,7 +61,7 @@
/* ********************************************** */
/* Helper API's for RigidBody Constraint Editing */
-static int ED_operator_rigidbody_con_active_poll(bContext *C)
+static bool ED_operator_rigidbody_con_active_poll(bContext *C)
{
if (ED_operator_object_active_editable(C)) {
Object *ob = CTX_data_active_object(C);
@@ -84,6 +84,7 @@ bool ED_rigidbody_constraint_add(Main *bmain, Scene *scene, Object *ob, int type
/* create constraint group if it doesn't already exits */
if (rbw->constraints == NULL) {
rbw->constraints = BKE_collection_add(bmain, NULL, "RigidBodyConstraints");
+ id_fake_user_set(&rbw->constraints->id);
}
/* make rigidbody constraint settings */
ob->rigidbody_constraint = BKE_rigidbody_create_constraint(scene, ob, type);
@@ -94,6 +95,8 @@ bool ED_rigidbody_constraint_add(Main *bmain, Scene *scene, Object *ob, int type
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
+ DEG_id_tag_update(&rbw->constraints->id, DEG_TAG_COPY_ON_WRITE);
+
return true;
}
@@ -102,8 +105,10 @@ void ED_rigidbody_constraint_remove(Main *bmain, Scene *scene, Object *ob)
RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
BKE_rigidbody_remove_constraint(scene, ob);
- if (rbw)
+ if (rbw) {
BKE_collection_object_remove(bmain, rbw->constraints, ob, false);
+ DEG_id_tag_update(&rbw->constraints->id, DEG_TAG_COPY_ON_WRITE);
+ }
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index bdfbc47b22f..56d80e232c0 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -67,7 +67,7 @@
/* ********************************************** */
/* Helper API's for RigidBody Objects Editing */
-static int ED_operator_rigidbody_active_poll(bContext *C)
+static bool ED_operator_rigidbody_active_poll(bContext *C)
{
if (ED_operator_object_active_editable(C)) {
Object *ob = ED_object_active_context(C);
@@ -77,7 +77,7 @@ static int ED_operator_rigidbody_active_poll(bContext *C)
return 0;
}
-static int ED_operator_rigidbody_add_poll(bContext *C)
+static bool ED_operator_rigidbody_add_poll(bContext *C)
{
if (ED_operator_object_active_editable(C)) {
Object *ob = ED_object_active_context(C);
@@ -125,6 +125,7 @@ bool ED_rigidbody_object_add(Main *bmain, Scene *scene, Object *ob, int type, Re
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
+ DEG_id_tag_update(&rbw->group->id, DEG_TAG_COPY_ON_WRITE);
return true;
}
diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c
index 8d5258a7522..da0099ba469 100644
--- a/source/blender/editors/physics/rigidbody_world.c
+++ b/source/blender/editors/physics/rigidbody_world.c
@@ -58,12 +58,12 @@
/* API */
/* check if there is an active rigid body world */
-static int ED_rigidbody_world_active_poll(bContext *C)
+static bool ED_rigidbody_world_active_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
return (scene && scene->rigidbody_world);
}
-static int ED_rigidbody_world_add_poll(bContext *C)
+static bool ED_rigidbody_world_add_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
return (scene && scene->rigidbody_world == NULL);
@@ -114,8 +114,7 @@ static int rigidbody_world_remove_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- BKE_rigidbody_free_world(rbw);
- scene->rigidbody_world = NULL;
+ BKE_rigidbody_free_world(scene);
/* done */
return OPERATOR_FINISHED;
@@ -152,14 +151,14 @@ static int rigidbody_world_export_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No Rigid Body World to export");
return OPERATOR_CANCELLED;
}
- if (rbw->physics_world == NULL) {
+ if (rbw->shared->physics_world == NULL) {
BKE_report(op->reports, RPT_ERROR, "Rigid Body World has no associated physics data to export");
return OPERATOR_CANCELLED;
}
RNA_string_get(op->ptr, "filepath", path);
#ifdef WITH_BULLET
- RB_dworld_export(rbw->physics_world, path);
+ RB_dworld_export(rbw->shared->physics_world, path);
#endif
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h
index d7b92c00ed4..77bf16f5e22 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -98,4 +98,3 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot);
void RENDER_OT_opengl(struct wmOperatorType *ot);
#endif /* __RENDER_INTERN_H__ */
-
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index 6a5844e323f..1385baa51ad 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -819,7 +819,7 @@ static void screen_render_cancel(bContext *C, wmOperator *op)
static void clean_viewport_memory_base(Base *base)
{
- if ((base->flag & BASE_VISIBLED) == 0) {
+ if ((base->flag & BASE_VISIBLE) == 0) {
return;
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index fb007accaeb..b5c1ffc64dd 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -322,8 +322,8 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
DRW_opengl_context_enable();
GPU_offscreen_bind(oglrender->ofs, true);
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ GPU_clear_color(0.0f, 0.0f, 0.0f, 0.0f);
+ GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);
wmOrtho2(0, sizex, 0, sizey);
gpuTranslate2f(sizex / 2, sizey / 2);
diff --git a/source/blender/editors/render/render_ops.c b/source/blender/editors/render/render_ops.c
index dd5ed5b78f1..fd534dd9129 100644
--- a/source/blender/editors/render/render_ops.c
+++ b/source/blender/editors/render/render_ops.c
@@ -95,4 +95,3 @@ void ED_operatortypes_render(void)
/* render_opengl.c */
WM_operatortype_append(RENDER_OT_opengl);
}
-
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index cdd79f43a72..04632838cf3 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -176,9 +176,6 @@ typedef struct ShaderPreview {
Main *bmain;
Main *pr_main;
-
- void *gl_context;
- bool gl_context_owner;
} ShaderPreview;
typedef struct IconPreviewSize {
@@ -194,8 +191,6 @@ typedef struct IconPreview {
void *owner;
ID *id;
ListBase sizes;
-
- void *gl_context;
} IconPreview;
/* *************************** Preview for buttons *********************** */
@@ -428,7 +423,7 @@ static Scene *preview_prepare_scene(Main *bmain, Scene *scene, ID *id, int id_ty
(*matar)[actcol] = mat;
}
else if (base->object->type == OB_LAMP) {
- base->flag |= BASE_VISIBLED;
+ base->flag |= BASE_VISIBLE;
}
}
}
@@ -746,10 +741,6 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
/* set this for all previews, default is react to G.is_break still */
RE_test_break_cb(re, sp, shader_preview_break);
- if (sp->gl_context) {
- RE_gl_context_set(re, sp->gl_context);
- }
-
/* lens adjust */
oldlens = ((Camera *)sce->camera->data)->lens;
if (sizex > sp->sizey)
@@ -869,10 +860,6 @@ static void shader_preview_free(void *customdata)
}
MEM_freeN(sp->lampcopy);
}
- if (sp->gl_context_owner && sp->gl_context) {
- WM_opengl_context_dispose(sp->gl_context);
- sp->gl_context = NULL;
- }
MEM_freeN(sp);
}
@@ -1088,8 +1075,6 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short
sp->pr_rect = cur_size->rect;
sp->id = ip->id;
sp->bmain = ip->bmain;
- sp->gl_context = ip->gl_context;
- sp->gl_context_owner = false;
if (is_render) {
BLI_assert(ip->id);
@@ -1106,11 +1091,6 @@ static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short
common_preview_startjob(sp, stop, do_update, progress);
shader_preview_free(sp);
}
-
- if (ip->gl_context) {
- WM_opengl_context_dispose(ip->gl_context);
- ip->gl_context = NULL;
- }
}
static void icon_preview_endjob(void *customdata)
@@ -1194,17 +1174,8 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
/* render all resolutions from suspended job too */
old_ip = WM_jobs_customdata_get(wm_job);
- if (old_ip) {
+ if (old_ip)
BLI_movelisttolist(&ip->sizes, &old_ip->sizes);
- /* NOTE: This assumes that it will be the same thread
- * that will be used when resuming the job. */
- ip->gl_context = old_ip->gl_context;
- }
-
- if (ip->gl_context == NULL) {
- /* Create context in the main thread. */
- ip->gl_context = WM_opengl_context_create();
- }
/* customdata for preview thread */
ip->bmain = CTX_data_main(C);
@@ -1235,7 +1206,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
{
Object *ob = CTX_data_active_object(C);
wmJob *wm_job;
- ShaderPreview *sp, *old_sp;
+ ShaderPreview *sp;
Scene *scene = CTX_data_scene(C);
short id_type = GS(id->name);
@@ -1252,21 +1223,6 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
- /* Reuse previous gl context. */
- old_sp = WM_jobs_customdata_get(wm_job);
- if (old_sp) {
- /* NOTE: This assumes that it will be the same thread
- * that will be used when resuming the job. */
- old_sp->gl_context_owner = false; /* Don't free it */
- sp->gl_context = old_sp->gl_context;
- }
-
- if (sp->gl_context == NULL) {
- /* Create context in the main thread. */
- sp->gl_context = WM_opengl_context_create();
- }
- sp->gl_context_owner = true;
-
/* customdata for preview thread */
sp->scene = scene;
sp->depsgraph = CTX_data_depsgraph(C);
@@ -1304,4 +1260,3 @@ void ED_preview_kill_jobs(wmWindowManager *wm, Main *UNUSED(bmain))
if (wm)
WM_jobs_kill(wm, NULL, common_preview_startjob);
}
-
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index a822dabf7b4..31f25720f8d 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -675,7 +675,7 @@ void SCENE_OT_view_layer_remove(wmOperatorType *ot)
/********************** render view operators *********************/
-static int render_view_remove_poll(bContext *C)
+static bool render_view_remove_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
@@ -753,7 +753,7 @@ static bool freestyle_linestyle_check_report(FreestyleLineSet *lineset, ReportLi
return true;
}
-static int freestyle_active_module_poll(bContext *C)
+static bool freestyle_active_module_poll(bContext *C)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
FreestyleModuleConfig *module = ptr.data;
@@ -886,7 +886,7 @@ void SCENE_OT_freestyle_lineset_add(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-static int freestyle_active_lineset_poll(bContext *C)
+static bool freestyle_active_lineset_poll(bContext *C)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -1626,7 +1626,7 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int copy_mtex_poll(bContext *C)
+static bool copy_mtex_poll(bContext *C)
{
ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
@@ -1694,4 +1694,3 @@ void TEXTURE_OT_slot_paste(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
}
-
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index b7e6508117e..97fd7295a7b 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -49,7 +49,6 @@
#include "BLI_utildefines.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_icons.h"
#include "BKE_layer.h"
#include "BKE_main.h"
@@ -371,4 +370,3 @@ void ED_render_id_flush_update(const DEGEditorUpdateContext *update_ctx, ID *id)
break;
}
}
-
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index 351ceda90e3..12f9c8f40c1 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -353,4 +353,3 @@ void RENDER_OT_view_show(struct wmOperatorType *ot)
ot->invoke = render_view_show_invoke;
ot->poll = ED_operator_screenactive;
}
-
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index 29b9971eabb..4be65f60b21 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -46,7 +46,9 @@ set(SRC
screen_context.c
screen_draw.c
screen_edit.c
+ screen_geometry.c
screen_ops.c
+ screen_user_menu.c
screendump.c
workspace_edit.c
workspace_layout_edit.c
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index d9851487569..46bbc0fdf4f 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -62,6 +62,8 @@
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_draw.h"
+#include "GPU_state.h"
+#include "GPU_framebuffer.h"
#include "BLF_api.h"
@@ -97,8 +99,8 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct, int sides)
rect.ymax = scirct->ymax - ar->winrct.ymin;
/* set transp line */
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
float color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
UI_GetThemeColor3fv(TH_EDITOR_OUTLINE, color);
@@ -137,7 +139,7 @@ static void region_draw_emboss(const ARegion *ar, const rcti *scirct, int sides)
immEnd();
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
@@ -296,7 +298,7 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2)
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4f(0.8f, 0.8f, 0.8f, 0.4f);
@@ -305,12 +307,12 @@ static void draw_azone_plus(float x1, float y1, float x2, float y2)
immRectf(pos, (x1 + x2 + width) * 0.5f, (y1 + y2 - width) * 0.5f, x2 - pad, (y1 + y2 + width) * 0.5f);
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void region_draw_azone_tab_plus(AZone *az)
{
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* add code to draw region hidden as 'too small' */
switch (az->edge) {
@@ -346,9 +348,9 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
if (!sa)
return;
- glLineWidth(1.0f);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_line_width(1.0f);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
gpuPushMatrix();
gpuTranslate2f(-ar->winrct.xmin, -ar->winrct.ymin);
@@ -388,7 +390,7 @@ static void region_draw_azones(ScrArea *sa, ARegion *ar)
gpuPopMatrix();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* Follow wmMsgNotifyFn spec */
@@ -419,6 +421,17 @@ void ED_area_do_msg_notify_tag_refresh(
ED_area_tag_refresh(sa);
}
+/**
+ * Although there's no general support for minimizing areas, the status-bar can
+ * be snapped to be only a few pixels high. A few pixels rather than 0 so it
+ * can be un-minimized again. We consider it pseudo-minimalized and don't draw
+ * it then.
+ */
+static bool area_is_pseudo_minimized(const ScrArea *area)
+{
+ return (area->winx < 3) || (area->winy < 3);
+}
+
/* only exported for WM */
void ED_region_do_layout(bContext *C, ARegion *ar)
{
@@ -430,7 +443,7 @@ void ED_region_do_layout(bContext *C, ARegion *ar)
return;
}
- if (at->do_lock) {
+ if (at->do_lock || (sa && area_is_pseudo_minimized(sa))) {
return;
}
@@ -460,8 +473,13 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
UI_SetTheme(sa ? sa->spacetype : 0, at->regionid);
+ if (sa && area_is_pseudo_minimized(sa)) {
+ UI_ThemeClearColor(TH_EDITOR_OUTLINE);
+ glClear(GL_COLOR_BUFFER_BIT);
+ return;
+ }
/* optional header info instead? */
- if (ar->headerstr) {
+ else if (ar->headerstr) {
UI_ThemeClearColor(TH_HEADER);
glClear(GL_COLOR_BUFFER_BIT);
@@ -481,7 +499,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
/* for debugging unneeded area redraws and partial redraw */
#if 0
- glEnable(GL_BLEND);
+ GPU_blend(true);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -489,7 +507,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
immRectf(pos, ar->drawrct.xmin - ar->winrct.xmin, ar->drawrct.ymin - ar->winrct.ymin,
ar->drawrct.xmax - ar->winrct.xmin, ar->drawrct.ymax - ar->winrct.ymin);
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
#endif
memset(&ar->drawrct, 0, sizeof(ar->drawrct));
@@ -639,7 +657,7 @@ void ED_area_tag_refresh(ScrArea *sa)
/* *************************************************************** */
/* use NULL to disable it */
-void ED_area_headerprint(ScrArea *sa, const char *str)
+void ED_area_status_text(ScrArea *sa, const char *str)
{
ARegion *ar;
@@ -663,6 +681,34 @@ void ED_area_headerprint(ScrArea *sa, const char *str)
}
}
+void ED_workspace_status_text(bContext *C, const char *str)
+{
+ wmWindow *win = CTX_wm_window(C);
+ WorkSpace *workspace = CTX_wm_workspace(C);
+
+ /* Can be NULL when running operators in background mode. */
+ if (workspace == NULL)
+ return;
+
+ if (str) {
+ if (workspace->status_text == NULL)
+ workspace->status_text = MEM_mallocN(UI_MAX_DRAW_STR, "headerprint");
+ BLI_strncpy(workspace->status_text, str, UI_MAX_DRAW_STR);
+ }
+ else if (workspace->status_text) {
+ MEM_freeN(workspace->status_text);
+ workspace->status_text = NULL;
+ }
+
+ /* Redraw status bar. */
+ for (ScrArea *sa = win->global_areas.areabase.first; sa; sa = sa->next) {
+ if (sa->spacetype == SPACE_STATUSBAR) {
+ ED_area_tag_redraw(sa);
+ break;
+ }
+ }
+}
+
/* ************************************************************ */
@@ -1036,7 +1082,7 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
return 0;
}
-static void region_rect_recursive(wmWindow *win, ScrArea *sa, ARegion *ar, rcti *remainder, rcti *overlap_remainder, int quad)
+static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, rcti *overlap_remainder, int quad)
{
rcti *remainder_prev = remainder;
int prefsizex, prefsizey;
@@ -1287,7 +1333,7 @@ static void region_rect_recursive(wmWindow *win, ScrArea *sa, ARegion *ar, rcti
*overlap_remainder = *remainder;
}
- region_rect_recursive(win, sa, ar->next, remainder, overlap_remainder, quad);
+ region_rect_recursive(sa, ar->next, remainder, overlap_remainder, quad);
}
static void area_calc_totrct(ScrArea *sa, const rcti *window_rect)
@@ -1417,7 +1463,7 @@ void ED_area_update_region_sizes(wmWindowManager *wm, wmWindow *win, ScrArea *ar
/* region rect sizes */
rect = area->totrct;
overlap_rect = rect;
- region_rect_recursive(win, area, area->regionbase.first, &rect, &overlap_rect, 0);
+ region_rect_recursive(area, area->regionbase.first, &rect, &overlap_rect, 0);
for (ARegion *ar = area->regionbase.first; ar; ar = ar->next) {
region_subwindow(ar);
@@ -1463,7 +1509,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
/* region rect sizes */
rect = sa->totrct;
overlap_rect = rect;
- region_rect_recursive(win, sa, sa->regionbase.first, &rect, &overlap_rect, 0);
+ region_rect_recursive(sa, sa->regionbase.first, &rect, &overlap_rect, 0);
sa->flag &= ~AREA_FLAG_REGION_SIZE_UPDATE;
/* default area handlers */
@@ -1821,12 +1867,12 @@ static void region_clear_color(const bContext *C, const ARegion *ar, ThemeColorI
float back[4];
UI_GetThemeColor4fv(colorid, back);
- glClearColor(back[3] * back[0], back[3] * back[1], back[3] * back[2], back[3]);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(back[3] * back[0], back[3] * back[1], back[3] * back[2], back[3]);
+ GPU_clear(GPU_COLOR_BIT);
}
else {
UI_ThemeClearColor(colorid);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
}
}
@@ -2152,7 +2198,7 @@ void ED_region_panels_draw(const bContext *C, ARegion *ar)
}
/* reset line width for drawing tabs */
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
/* set the view */
UI_view2d_view_ortho(v2d);
@@ -2208,26 +2254,33 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
uiLayout *layout;
HeaderType *ht;
Header header = {NULL};
- int maxco, xco, yco;
- int headery = ED_area_headersize();
bool region_layout_based = ar->flag & RGN_FLAG_DYNAMIC_SIZE;
- /* set view2d view matrix for scrolling (without scrollers) */
- UI_view2d_view_ortho(&ar->v2d);
+ /* Height of buttons and scaling needed to achieve it. */
+ const int buttony = min_ii(UI_UNIT_Y, ar->winy - 2 * UI_DPI_FAC);
+ const float buttony_scale = buttony / (float)UI_UNIT_Y;
- xco = maxco = UI_HEADER_OFFSET;
- yco = headery + (ar->winy - headery) / 2 - floor(0.2f * UI_UNIT_Y);
+ /* Vertically center buttons. */
+ int xco = UI_HEADER_OFFSET;
+ int yco = buttony + (ar->winy - buttony) / 2;
+ int maxco = xco;
/* XXX workaround for 1 px alignment issue. Not sure what causes it... Would prefer a proper fix - Julian */
- if (CTX_wm_area(C)->spacetype == SPACE_TOPBAR) {
- xco += 1;
- yco += 1;
+ if (!ELEM(CTX_wm_area(C)->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR)) {
+ yco -= 1;
}
+ /* set view2d view matrix for scrolling (without scrollers) */
+ UI_view2d_view_ortho(&ar->v2d);
+
/* draw all headers types */
for (ht = ar->type->headertypes.first; ht; ht = ht->next) {
block = UI_block_begin(C, ar, ht->idname, UI_EMBOSS);
- layout = UI_block_layout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, 0, style);
+ layout = UI_block_layout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, buttony, 1, 0, style);
+
+ if (buttony_scale != 1.0f) {
+ uiLayoutSetScaleY(layout, buttony_scale);
+ }
if (ht->draw) {
header.type = ht;
@@ -2264,7 +2317,7 @@ void ED_region_header_layout(const bContext *C, ARegion *ar)
}
/* always as last */
- UI_view2d_totRect_set(&ar->v2d, maxco, headery);
+ UI_view2d_totRect_set(&ar->v2d, maxco, ar->winy);
/* restore view matrix */
UI_view2d_view_restore(C);
@@ -2325,6 +2378,16 @@ int ED_area_global_size_y(const ScrArea *area)
BLI_assert(ED_area_is_global(area));
return round_fl_to_int(area->global->cur_fixed_height * UI_DPI_FAC);
}
+int ED_area_global_min_size_y(const ScrArea *area)
+{
+ BLI_assert(ED_area_is_global(area));
+ return round_fl_to_int(area->global->size_min * UI_DPI_FAC);
+}
+int ED_area_global_max_size_y(const ScrArea *area)
+{
+ BLI_assert(ED_area_is_global(area));
+ return round_fl_to_int(area->global->size_max * UI_DPI_FAC);
+}
bool ED_area_is_global(const ScrArea *area)
{
@@ -2375,7 +2438,7 @@ void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float
const int header_height = UI_UNIT_Y;
uiStyle *style = UI_style_get_dpi();
int fontid = style->widget.uifont_id;
- GLint scissor[4];
+ int scissor[4];
rcti rect;
int num_lines = 0;
@@ -2403,19 +2466,19 @@ void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float
rect.ymin = rect.ymax - header_height * num_lines;
/* setup scissor */
- glGetIntegerv(GL_SCISSOR_BOX, scissor);
- glScissor(rect.xmin, rect.ymin,
+ GPU_scissor_get_i(scissor);
+ GPU_scissor(rect.xmin, rect.ymin,
BLI_rcti_size_x(&rect) + 1, BLI_rcti_size_y(&rect) + 1);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(fill_color);
immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1);
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* text */
UI_FontThemeColor(fontid, TH_TEXT_HI);
@@ -2435,7 +2498,7 @@ void ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float
BLF_disable(fontid, BLF_CLIPPING);
/* restore scissor as it was before */
- glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+ GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]);
}
void ED_region_info_draw(ARegion *ar, const char *text, float fill_color[4], const bool full_redraw)
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 1d73566e5a8..6cff82295f0 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -51,6 +51,7 @@
#include "GPU_basic_shader.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "UI_interface.h"
@@ -59,11 +60,11 @@
void setlinestyle(int nr)
{
if (nr == 0) {
- glDisable(GL_LINE_STIPPLE);
+ GPU_line_stipple(false);
}
else {
- glEnable(GL_LINE_STIPPLE);
+ GPU_line_stipple(true);
if (U.pixelsize > 1.0f)
glLineStipple(nr, 0xCCCC);
else
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 864150be9da..fa18826005e 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -115,7 +115,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "selectable_objects")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if (((base->flag & BASE_VISIBLED) != 0) && ((base->flag & BASE_SELECTABLED) != 0)) {
+ if (((base->flag & BASE_VISIBLE) != 0) && ((base->flag & BASE_SELECTABLE) != 0)) {
CTX_data_id_list_add(result, &base->object->id);
}
}
@@ -165,7 +165,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "selectable_bases")) {
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if ((base->flag & BASE_SELECTABLED) != 0) {
+ if ((base->flag & BASE_SELECTABLE) != 0) {
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
}
@@ -195,7 +195,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
else if (CTX_data_equals(member, "editable_bases")) {
/* Visible + Editable, but not necessarily selected */
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
- if ((base->flag & BASE_VISIBLED) != 0) {
+ if ((base->flag & BASE_VISIBLE) != 0) {
if (0 == BKE_object_is_libdata(base->object)) {
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}
@@ -665,4 +665,3 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return -1; /* found but not available */
}
-
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c
index fec39ade110..b5b0d16f6a7 100644
--- a/source/blender/editors/screen/screen_draw.c
+++ b/source/blender/editors/screen/screen_draw.c
@@ -27,6 +27,7 @@
#include "GPU_framebuffer.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "BLI_math.h"
@@ -43,11 +44,11 @@
*/
static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos)
{
+ const float width = screen_geom_area_width(sa) - 1;
+ const float height = screen_geom_area_height(sa) - 1;
vec2f points[10];
short i;
float w, h;
- float width = sa->v3->vec.x - sa->v1->vec.x;
- float height = sa->v3->vec.y - sa->v1->vec.y;
if (height < width) {
h = height / 8;
@@ -124,11 +125,11 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir, unsigned int pos)
*/
static void draw_vertical_join_shape(ScrArea *sa, char dir, unsigned int pos)
{
+ const float width = screen_geom_area_width(sa) - 1;
+ const float height = screen_geom_area_height(sa) - 1;
vec2f points[10];
short i;
float w, h;
- float width = sa->v3->vec.x - sa->v1->vec.x;
- float height = sa->v3->vec.y - sa->v1->vec.y;
if (height < width) {
h = height / 4;
@@ -353,7 +354,7 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey)
*/
static void scrarea_draw_shape_dark(ScrArea *sa, char dir, unsigned int pos)
{
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
immUniformColor4ub(0, 0, 0, 50);
draw_join_shape(sa, dir, pos);
@@ -364,7 +365,7 @@ static void scrarea_draw_shape_dark(ScrArea *sa, char dir, unsigned int pos)
*/
static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir), unsigned int pos)
{
- glBlendFunc(GL_DST_COLOR, GL_SRC_ALPHA);
+ GPU_blend_set_func(GPU_DST_COLOR, GPU_SRC_ALPHA);
/* value 181 was hardly computed: 181~105 */
immUniformColor4ub(255, 255, 255, 50);
/* draw_join_shape(sa, dir); */
@@ -444,7 +445,7 @@ void ED_screen_draw_edges(wmWindow *win)
/* Note: first loop only draws if U.pixelsize > 1, skip otherwise */
if (U.pixelsize > 1.0f) {
/* FIXME: doesn't our glLineWidth already scale by U.pixelsize? */
- glLineWidth((2.0f * U.pixelsize) - 1);
+ GPU_line_width((2.0f * U.pixelsize) - 1);
immUniformThemeColor(TH_EDITOR_OUTLINE);
for (sa = screen->areabase.first; sa; sa = sa->next) {
@@ -452,7 +453,7 @@ void ED_screen_draw_edges(wmWindow *win)
}
}
- glLineWidth(1);
+ GPU_line_width(1);
immUniformThemeColor(TH_EDITOR_OUTLINE);
for (sa = screen->areabase.first; sa; sa = sa->next) {
@@ -479,7 +480,7 @@ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2)
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glLineWidth(1);
+ GPU_line_width(1);
/* blended join arrow */
int dir = area_getorientation(sa1, sa2);
@@ -504,12 +505,12 @@ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2)
break;
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
scrarea_draw_shape_dark(sa2, dir, pos);
scrarea_draw_shape_light(sa1, dira, pos);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -521,7 +522,7 @@ void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* splitpoint */
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor4ub(255, 255, 255, 100);
immBegin(GWN_PRIM_LINES, 2);
@@ -562,7 +563,7 @@ void ED_screen_draw_split_preview(ScrArea *sa, const int dir, const float fac)
immEnd();
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUnbindProgram();
}
@@ -645,8 +646,8 @@ void ED_screen_preview_render(const bScreen *screen, int size_x, int size_y, uns
GPUOffScreen *offscreen = GPU_offscreen_create(size_x, size_y, 0, true, false, err_out);
GPU_offscreen_bind(offscreen, true);
- glClearColor(0.0, 0.0, 0.0, 0.0);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ GPU_clear_color(0.0, 0.0, 0.0, 0.0);
+ GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);
screen_preview_draw(screen, size_x, size_y);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 53abe3ed4ea..6bc8a6c10cf 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -74,104 +74,6 @@
#include "screen_intern.h" /* own module include */
-/* ******************* screen vert, edge, area managing *********************** */
-
-static ScrVert *screen_addvert_ex(ScrAreaMap *area_map, short x, short y)
-{
- ScrVert *sv = MEM_callocN(sizeof(ScrVert), "addscrvert");
- sv->vec.x = x;
- sv->vec.y = y;
-
- BLI_addtail(&area_map->vertbase, sv);
- return sv;
-}
-static ScrVert *screen_addvert(bScreen *sc, short x, short y)
-{
- return screen_addvert_ex(AREAMAP_FROM_SCREEN(sc), x, y);
-}
-
-static ScrEdge *screen_addedge_ex(ScrAreaMap *area_map, ScrVert *v1, ScrVert *v2)
-{
- ScrEdge *se = MEM_callocN(sizeof(ScrEdge), "addscredge");
-
- BKE_screen_sort_scrvert(&v1, &v2);
- se->v1 = v1;
- se->v2 = v2;
-
- BLI_addtail(&area_map->edgebase, se);
- return se;
-}
-static ScrEdge *screen_addedge(bScreen *sc, ScrVert *v1, ScrVert *v2)
-{
- return screen_addedge_ex(AREAMAP_FROM_SCREEN(sc), v1, v2);
-}
-
-bool scredge_is_horizontal(ScrEdge *se)
-{
- return (se->v1->vec.y == se->v2->vec.y);
-}
-
-/**
- * \param bounds_rect: Either window or screen bounds. Used to exclude edges along window/screen edges.
- */
-ScrEdge *screen_area_map_find_active_scredge(
- const ScrAreaMap *area_map,
- const rcti *bounds_rect,
- const int mx, const int my)
-{
- int safety = U.widget_unit / 10;
-
- CLAMP_MIN(safety, 2);
-
- for (ScrEdge *se = area_map->edgebase.first; se; se = se->next) {
- if (scredge_is_horizontal(se)) {
- if ((se->v1->vec.y > bounds_rect->ymin) && (se->v1->vec.y < (bounds_rect->ymax - 1))) {
- short min, max;
- min = MIN2(se->v1->vec.x, se->v2->vec.x);
- max = MAX2(se->v1->vec.x, se->v2->vec.x);
-
- if (abs(my - se->v1->vec.y) <= safety && mx >= min && mx <= max)
- return se;
- }
- }
- else {
- if ((se->v1->vec.x > bounds_rect->xmin) && (se->v1->vec.x < (bounds_rect->xmax - 1))) {
- short min, max;
- min = MIN2(se->v1->vec.y, se->v2->vec.y);
- max = MAX2(se->v1->vec.y, se->v2->vec.y);
-
- if (abs(mx - se->v1->vec.x) <= safety && my >= min && my <= max)
- return se;
- }
- }
- }
-
- return NULL;
-}
-
-/* need win size to make sure not to include edges along screen edge */
-ScrEdge *screen_find_active_scredge(
- const wmWindow *win, const bScreen *screen,
- const int mx, const int my)
-{
- /* Use layout size (screen excluding global areas) for screen-layout area edges */
- rcti screen_rect;
- ScrEdge *se;
-
- WM_window_screen_rect_calc(win, &screen_rect);
- se = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(screen), &screen_rect, mx, my);
-
- if (!se) {
- /* Use entire window size (screen including global areas) for global area edges */
- rcti win_rect;
- WM_window_rect_calc(win, &win_rect);
- se = screen_area_map_find_active_scredge(&win->global_areas, &win_rect, mx, my);
- }
- return se;
-}
-
-
-
/* adds no space data */
static ScrArea *screen_addarea_ex(
ScrAreaMap *area_map,
@@ -210,54 +112,18 @@ static void screen_delarea(bContext *C, bScreen *sc, ScrArea *sa)
MEM_freeN(sa);
}
-/* return 0: no split possible */
-/* else return (integer) screencoordinate split point */
-static short testsplitpoint(ScrArea *sa, char dir, float fac)
-{
- short x, y;
- const short area_min_x = AREAMINX;
- const short area_min_y = ED_area_headersize();
-
- // area big enough?
- if (dir == 'v' && (sa->v4->vec.x - sa->v1->vec.x <= 2 * area_min_x)) return 0;
- if (dir == 'h' && (sa->v2->vec.y - sa->v1->vec.y <= 2 * area_min_y)) return 0;
-
- // to be sure
- CLAMP(fac, 0.0f, 1.0f);
-
- if (dir == 'h') {
- y = sa->v1->vec.y +
- round_fl_to_short(fac * (float)(sa->v2->vec.y - sa->v1->vec.y));
-
- if (y - sa->v1->vec.y < area_min_y)
- y = sa->v1->vec.y + area_min_y;
- else if (sa->v2->vec.y - y < area_min_y)
- y = sa->v2->vec.y - area_min_y;
-
- return y;
- }
- else {
- x = sa->v1->vec.x +
- round_fl_to_short(fac * (float)(sa->v4->vec.x - sa->v1->vec.x));
-
- if (x - sa->v1->vec.x < area_min_x)
- x = sa->v1->vec.x + area_min_x;
- else if (sa->v4->vec.x - x < area_min_x)
- x = sa->v4->vec.x - area_min_x;
-
- return x;
- }
-}
-
-ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
+ScrArea *area_split(const wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
{
ScrArea *newa = NULL;
ScrVert *sv1, *sv2;
short split;
+ rcti window_rect;
if (sa == NULL) return NULL;
- split = testsplitpoint(sa, dir, fac);
+ WM_window_rect_calc(win, &window_rect);
+
+ split = screen_geom_find_area_split_point(sa, &window_rect, dir, fac);
if (split == 0) return NULL;
/* note regarding (fac > 0.5f) checks below.
@@ -266,15 +132,15 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
if (dir == 'h') {
/* new vertices */
- sv1 = screen_addvert(sc, sa->v1->vec.x, split);
- sv2 = screen_addvert(sc, sa->v4->vec.x, split);
+ sv1 = screen_geom_vertex_add(sc, sa->v1->vec.x, split);
+ sv2 = screen_geom_vertex_add(sc, sa->v4->vec.x, split);
/* new edges */
- screen_addedge(sc, sa->v1, sv1);
- screen_addedge(sc, sv1, sa->v2);
- screen_addedge(sc, sa->v3, sv2);
- screen_addedge(sc, sv2, sa->v4);
- screen_addedge(sc, sv1, sv2);
+ screen_geom_edge_add(sc, sa->v1, sv1);
+ screen_geom_edge_add(sc, sv1, sa->v2);
+ screen_geom_edge_add(sc, sa->v3, sv2);
+ screen_geom_edge_add(sc, sv2, sa->v4);
+ screen_geom_edge_add(sc, sv1, sv2);
if (fac > 0.5f) {
/* new areas: top */
@@ -298,15 +164,15 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
}
else {
/* new vertices */
- sv1 = screen_addvert(sc, split, sa->v1->vec.y);
- sv2 = screen_addvert(sc, split, sa->v2->vec.y);
+ sv1 = screen_geom_vertex_add(sc, split, sa->v1->vec.y);
+ sv2 = screen_geom_vertex_add(sc, split, sa->v2->vec.y);
/* new edges */
- screen_addedge(sc, sa->v1, sv1);
- screen_addedge(sc, sv1, sa->v4);
- screen_addedge(sc, sa->v2, sv2);
- screen_addedge(sc, sv2, sa->v3);
- screen_addedge(sc, sv1, sv2);
+ screen_geom_edge_add(sc, sa->v1, sv1);
+ screen_geom_edge_add(sc, sv1, sa->v4);
+ screen_geom_edge_add(sc, sa->v2, sv2);
+ screen_geom_edge_add(sc, sv2, sa->v3);
+ screen_geom_edge_add(sc, sv1, sv2);
if (fac > 0.5f) {
/* new areas: right */
@@ -349,15 +215,15 @@ bScreen *screen_add(Main *bmain, const char *name, const rcti *rect)
sc->do_refresh = true;
sc->redraws_flag = TIME_ALL_3D_WIN | TIME_ALL_ANIM_WIN;
- sv1 = screen_addvert(sc, rect->xmin, rect->ymin);
- sv2 = screen_addvert(sc, rect->xmin, rect->ymax - 1);
- sv3 = screen_addvert(sc, rect->xmax - 1, rect->ymax - 1);
- sv4 = screen_addvert(sc, rect->xmax - 1, rect->ymin);
+ sv1 = screen_geom_vertex_add(sc, rect->xmin, rect->ymin);
+ sv2 = screen_geom_vertex_add(sc, rect->xmin, rect->ymax - 1);
+ sv3 = screen_geom_vertex_add(sc, rect->xmax - 1, rect->ymax - 1);
+ sv4 = screen_geom_vertex_add(sc, rect->xmax - 1, rect->ymin);
- screen_addedge(sc, sv1, sv2);
- screen_addedge(sc, sv2, sv3);
- screen_addedge(sc, sv3, sv4);
- screen_addedge(sc, sv4, sv1);
+ screen_geom_edge_add(sc, sv1, sv2);
+ screen_geom_edge_add(sc, sv2, sv3);
+ screen_geom_edge_add(sc, sv3, sv4);
+ screen_geom_edge_add(sc, sv4, sv1);
/* dummy type, no spacedata */
screen_addarea(sc, sv1, sv2, sv3, sv4, SPACE_EMPTY);
@@ -473,26 +339,26 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
if (dir == 0) {
sa1->v1 = sa2->v1;
sa1->v2 = sa2->v2;
- screen_addedge(scr, sa1->v2, sa1->v3);
- screen_addedge(scr, sa1->v1, sa1->v4);
+ screen_geom_edge_add(scr, sa1->v2, sa1->v3);
+ screen_geom_edge_add(scr, sa1->v1, sa1->v4);
}
else if (dir == 1) {
sa1->v2 = sa2->v2;
sa1->v3 = sa2->v3;
- screen_addedge(scr, sa1->v1, sa1->v2);
- screen_addedge(scr, sa1->v3, sa1->v4);
+ screen_geom_edge_add(scr, sa1->v1, sa1->v2);
+ screen_geom_edge_add(scr, sa1->v3, sa1->v4);
}
else if (dir == 2) {
sa1->v3 = sa2->v3;
sa1->v4 = sa2->v4;
- screen_addedge(scr, sa1->v2, sa1->v3);
- screen_addedge(scr, sa1->v1, sa1->v4);
+ screen_geom_edge_add(scr, sa1->v2, sa1->v3);
+ screen_geom_edge_add(scr, sa1->v1, sa1->v4);
}
else if (dir == 3) {
sa1->v1 = sa2->v1;
sa1->v4 = sa2->v4;
- screen_addedge(scr, sa1->v1, sa1->v2);
- screen_addedge(scr, sa1->v3, sa1->v4);
+ screen_geom_edge_add(scr, sa1->v1, sa1->v2);
+ screen_geom_edge_add(scr, sa1->v3, sa1->v4);
}
screen_delarea(C, scr, sa2);
@@ -503,232 +369,6 @@ int screen_area_join(bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2)
return 1;
}
-void select_connected_scredge(const wmWindow *win, ScrEdge *edge)
-{
- bScreen *sc = WM_window_get_active_screen(win);
- ScrEdge *se;
- int oneselected;
- char dir;
-
- /* select connected, only in the right direction */
- /* 'dir' is the direction of EDGE */
-
- if (edge->v1->vec.x == edge->v2->vec.x) dir = 'v';
- else dir = 'h';
-
- ED_screen_verts_iter(win, sc, sv) {
- sv->flag = 0;
- }
-
- edge->v1->flag = 1;
- edge->v2->flag = 1;
-
- oneselected = 1;
- while (oneselected) {
- se = sc->edgebase.first;
- oneselected = 0;
- while (se) {
- if (se->v1->flag + se->v2->flag == 1) {
- if (dir == 'h') {
- if (se->v1->vec.y == se->v2->vec.y) {
- se->v1->flag = se->v2->flag = 1;
- oneselected = 1;
- }
- }
- if (dir == 'v') {
- if (se->v1->vec.x == se->v2->vec.x) {
- se->v1->flag = se->v2->flag = 1;
- oneselected = 1;
- }
- }
- }
- se = se->next;
- }
- }
-}
-
-/**
- * Test if screen vertices should be scaled and do if needed.
- */
-static void screen_vertices_scale(
- const wmWindow *win, bScreen *sc,
- const rcti *window_rect, const rcti *screen_rect)
-{
- /* clamp Y size of header sized areas when expanding windows
- * avoids annoying empty space around file menu */
-#define USE_HEADER_SIZE_CLAMP
-
- const int headery_init = ED_area_headersize();
- const int screen_size_x = BLI_rcti_size_x(screen_rect);
- const int screen_size_y = BLI_rcti_size_y(screen_rect);
- ScrVert *sv = NULL;
- ScrArea *sa;
- int screen_size_x_prev, screen_size_y_prev;
- float min[2], max[2];
-
- /* calculate size */
- min[0] = min[1] = 20000.0f;
- max[0] = max[1] = 0.0f;
-
- for (sv = sc->vertbase.first; sv; sv = sv->next) {
- const float fv[2] = {(float)sv->vec.x, (float)sv->vec.y};
- minmax_v2v2_v2(min, max, fv);
- }
-
- screen_size_x_prev = (max[0] - min[0]) + 1;
- screen_size_y_prev = (max[1] - min[1]) + 1;
-
-
-#ifdef USE_HEADER_SIZE_CLAMP
-#define TEMP_BOTTOM 1
-#define TEMP_TOP 2
-
- /* if the window's Y axis grows, clamp header sized areas */
- if (screen_size_y_prev < screen_size_y) { /* growing? */
- const int headery_margin_max = headery_init + 4;
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
- sa->temp = 0;
-
- if (ar && !(ar->flag & RGN_FLAG_HIDDEN)) {
- if (sa->v2->vec.y == max[1]) {
- if ((sa->v2->vec.y - sa->v1->vec.y) < headery_margin_max) {
- sa->temp = TEMP_TOP;
- }
- }
- else if (sa->v1->vec.y == min[1]) {
- if ((sa->v2->vec.y - sa->v1->vec.y) < headery_margin_max) {
- sa->temp = TEMP_BOTTOM;
- }
- }
- }
- }
- }
-#endif
-
-
- if (screen_size_x_prev != screen_size_x || screen_size_y_prev != screen_size_y) {
- const float facx = ((float)screen_size_x - 1) / ((float)screen_size_x_prev - 1);
- const float facy = ((float)screen_size_y - 1) / ((float)screen_size_y_prev - 1);
-
- /* make sure it fits! */
- for (sv = sc->vertbase.first; sv; sv = sv->next) {
- sv->vec.x = screen_rect->xmin + round_fl_to_short((sv->vec.x - min[0]) * facx);
- CLAMP(sv->vec.x, screen_rect->xmin, screen_rect->xmax - 1);
-
- sv->vec.y = screen_rect->ymin + round_fl_to_short((sv->vec.y - min[1]) * facy);
- CLAMP(sv->vec.y, screen_rect->ymin, screen_rect->ymax - 1);
- }
- }
-
-
-#ifdef USE_HEADER_SIZE_CLAMP
- if (screen_size_y_prev < screen_size_y) { /* growing? */
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- ScrEdge *se = NULL;
-
- if (sa->temp == 0)
- continue;
-
- if (sa->v1 == sa->v2)
- continue;
-
- /* adjust headery if verts are along the edge of window */
- if (sa->temp == TEMP_TOP) {
- /* lower edge */
- const int yval = sa->v2->vec.y - headery_init;
- se = BKE_screen_find_edge(sc, sa->v4, sa->v1);
- if (se != NULL) {
- select_connected_scredge(win, se);
- }
- for (sv = sc->vertbase.first; sv; sv = sv->next) {
- if (sv != sa->v2 && sv != sa->v3) {
- if (sv->flag) {
- sv->vec.y = yval;
- }
- }
- }
- }
- else {
- /* upper edge */
- const int yval = sa->v1->vec.y + headery_init;
- se = BKE_screen_find_edge(sc, sa->v2, sa->v3);
- if (se != NULL) {
- select_connected_scredge(win, se);
- }
- for (sv = sc->vertbase.first; sv; sv = sv->next) {
- if (sv != sa->v1 && sv != sa->v4) {
- if (sv->flag) {
- sv->vec.y = yval;
- }
- }
- }
- }
- }
- }
-
-#undef USE_HEADER_SIZE_CLAMP
-#undef TEMP_BOTTOM
-#undef TEMP_TOP
-#endif
-
-
- /* test for collapsed areas. This could happen in some blender version... */
- /* ton: removed option now, it needs Context... */
-
- /* make each window at least ED_area_headersize() high */
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- int headery = headery_init;
-
- /* adjust headery if verts are along the edge of window */
- if (sa->v1->vec.y > window_rect->ymin)
- headery += U.pixelsize;
- if (sa->v2->vec.y < window_rect->ymax)
- headery += U.pixelsize;
-
- if (sa->v2->vec.y - sa->v1->vec.y + 1 < headery) {
- /* lower edge */
- ScrEdge *se = BKE_screen_find_edge(sc, sa->v4, sa->v1);
- if (se && sa->v1 != sa->v2) {
- const int yval = sa->v2->vec.y - headery + 1;
-
- select_connected_scredge(win, se);
-
- /* all selected vertices get the right offset */
- for (sv = sc->vertbase.first; sv; sv = sv->next) {
- /* if is a collapsed area */
- if (sv != sa->v2 && sv != sa->v3) {
- if (sv->flag) {
- sv->vec.y = yval;
- }
- }
- }
- }
- }
- }
-
- /* Global areas have a fixed size that only changes with the DPI. Here we ensure that exactly this size is set. */
- for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) {
- if (area->global->flag & GLOBAL_AREA_IS_HIDDEN) {
- continue;
- }
- /* width */
- area->v1->vec.x = area->v2->vec.x = window_rect->xmin;
- area->v3->vec.x = area->v4->vec.x = window_rect->xmax - 1;
- /* height */
- area->v1->vec.y = area->v4->vec.y = window_rect->ymin;
- area->v2->vec.y = area->v3->vec.y = window_rect->ymax - 1;
- switch (area->global->align) {
- case GLOBAL_AREA_ALIGN_TOP:
- area->v1->vec.y = area->v4->vec.y = area->v2->vec.y - ED_area_global_size_y(area);
- break;
- case GLOBAL_AREA_ALIGN_BOTTOM:
- area->v2->vec.y = area->v3->vec.y = area->v1->vec.y + ED_area_global_size_y(area);
- break;
- }
- }
-}
-
/* ****************** EXPORTED API TO OTHER MODULES *************************** */
@@ -808,7 +448,7 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
WM_window_rect_calc(win, &window_rect);
WM_window_screen_rect_calc(win, &screen_rect); /* Get screen bounds __after__ updating window DPI! */
- screen_vertices_scale(win, screen, &window_rect, &screen_rect);
+ screen_geom_vertices_scale(win, screen);
ED_screen_areas_iter(win, screen, area) {
/* set spacetype and region callbacks, calls init() */
@@ -975,10 +615,10 @@ static void screen_cursor_set(wmWindow *win, const int xy[2])
}
}
else {
- ScrEdge *actedge = screen_find_active_scredge(win, screen, xy[0], xy[1]);
+ ScrEdge *actedge = screen_geom_find_active_scredge(win, screen, xy[0], xy[1]);
if (actedge) {
- if (scredge_is_horizontal(actedge))
+ if (screen_geom_edge_is_horizontal(actedge))
WM_cursor_set(win, CURSOR_Y_MOVE);
else
WM_cursor_set(win, CURSOR_X_MOVE);
@@ -1094,15 +734,15 @@ static ScrArea *screen_area_create_with_geometry(
ScrAreaMap *area_map, const rcti *rect,
short spacetype)
{
- ScrVert *bottom_left = screen_addvert_ex(area_map, rect->xmin, rect->ymin);
- ScrVert *top_left = screen_addvert_ex(area_map, rect->xmin, rect->ymax);
- ScrVert *top_right = screen_addvert_ex(area_map, rect->xmax, rect->ymax);
- ScrVert *bottom_right = screen_addvert_ex(area_map, rect->xmax, rect->ymin);
+ ScrVert *bottom_left = screen_geom_vertex_add_ex(area_map, rect->xmin, rect->ymin);
+ ScrVert *top_left = screen_geom_vertex_add_ex(area_map, rect->xmin, rect->ymax);
+ ScrVert *top_right = screen_geom_vertex_add_ex(area_map, rect->xmax, rect->ymax);
+ ScrVert *bottom_right = screen_geom_vertex_add_ex(area_map, rect->xmax, rect->ymin);
- screen_addedge_ex(area_map, bottom_left, top_left);
- screen_addedge_ex(area_map, top_left, top_right);
- screen_addedge_ex(area_map, top_right, bottom_right);
- screen_addedge_ex(area_map, bottom_right, bottom_left);
+ screen_geom_edge_add_ex(area_map, bottom_left, top_left);
+ screen_geom_edge_add_ex(area_map, top_left, top_right);
+ screen_geom_edge_add_ex(area_map, top_right, bottom_right);
+ screen_geom_edge_add_ex(area_map, bottom_right, bottom_left);
return screen_addarea_ex(area_map, bottom_left, top_left, top_right, bottom_right, spacetype);
}
@@ -1141,13 +781,13 @@ static void screen_global_topbar_area_create(wmWindow *win)
static void screen_global_statusbar_area_create(wmWindow *win)
{
- const short size_y = HEADERY;
+ const short size_y = 0.8f * HEADERY;
rcti rect;
BLI_rcti_init(&rect, 0, WM_window_pixels_x(win) - 1, 0, WM_window_pixels_y(win) - 1);
rect.ymax = rect.ymin + size_y;
- screen_global_area_create(win, SPACE_STATUSBAR, GLOBAL_AREA_ALIGN_BOTTOM, &rect, size_y, size_y, size_y);
+ screen_global_area_create(win, SPACE_STATUSBAR, GLOBAL_AREA_ALIGN_BOTTOM, &rect, size_y, 0, size_y);
}
void ED_screen_global_areas_create(wmWindow *win)
@@ -1418,8 +1058,9 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s
}
}
- /* prevent hanging header prints */
- ED_area_headerprint(sa, NULL);
+ /* prevent hanging status prints */
+ ED_area_status_text(sa, NULL);
+ ED_workspace_status_text(C, NULL);
}
if (sa && sa->full) {
@@ -1680,6 +1321,7 @@ void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph)
for (sc = bmain->screen.first; sc; sc = sc->id.next) {
BKE_screen_view3d_scene_sync(sc, scene);
}
+ DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
}
#endif
diff --git a/source/blender/editors/screen/screen_geometry.c b/source/blender/editors/screen/screen_geometry.c
new file mode 100644
index 00000000000..5d87479e371
--- /dev/null
+++ b/source/blender/editors/screen/screen_geometry.c
@@ -0,0 +1,462 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/screen/screen_geometry.c
+ * \ingroup edscr
+ * \brief Functions for screen vertices and edges
+ *
+ * Screen geometry refers to the vertices (ScrVert) and edges (ScrEdge) through
+ * which the flexible screen-layout system of Blender is established.
+ */
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_rect.h"
+
+#include "BKE_screen.h"
+
+#include "DNA_screen_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "ED_screen.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "WM_api.h"
+
+#include "screen_intern.h"
+
+
+int screen_geom_area_height(const ScrArea *area)
+{
+ return area->v2->vec.y - area->v1->vec.y + 1;
+}
+int screen_geom_area_width(const ScrArea *area)
+{
+ return area->v4->vec.x - area->v1->vec.x + 1;
+}
+
+ScrVert *screen_geom_vertex_add_ex(ScrAreaMap *area_map, short x, short y)
+{
+ ScrVert *sv = MEM_callocN(sizeof(ScrVert), "addscrvert");
+ sv->vec.x = x;
+ sv->vec.y = y;
+
+ BLI_addtail(&area_map->vertbase, sv);
+ return sv;
+}
+ScrVert *screen_geom_vertex_add(bScreen *sc, short x, short y)
+{
+ return screen_geom_vertex_add_ex(AREAMAP_FROM_SCREEN(sc), x, y);
+}
+
+ScrEdge *screen_geom_edge_add_ex(ScrAreaMap *area_map, ScrVert *v1, ScrVert *v2)
+{
+ ScrEdge *se = MEM_callocN(sizeof(ScrEdge), "addscredge");
+
+ BKE_screen_sort_scrvert(&v1, &v2);
+ se->v1 = v1;
+ se->v2 = v2;
+
+ BLI_addtail(&area_map->edgebase, se);
+ return se;
+}
+ScrEdge *screen_geom_edge_add(bScreen *sc, ScrVert *v1, ScrVert *v2)
+{
+ return screen_geom_edge_add_ex(AREAMAP_FROM_SCREEN(sc), v1, v2);
+}
+
+bool screen_geom_edge_is_horizontal(ScrEdge *se)
+{
+ return (se->v1->vec.y == se->v2->vec.y);
+}
+
+/**
+ * \param bounds_rect: Either window or screen bounds. Used to exclude edges along window/screen edges.
+ */
+ScrEdge *screen_geom_area_map_find_active_scredge(
+ const ScrAreaMap *area_map,
+ const rcti *bounds_rect,
+ const int mx, const int my)
+{
+ int safety = U.widget_unit / 10;
+
+ CLAMP_MIN(safety, 2);
+
+ for (ScrEdge *se = area_map->edgebase.first; se; se = se->next) {
+ if (screen_geom_edge_is_horizontal(se)) {
+ if ((se->v1->vec.y > bounds_rect->ymin) && (se->v1->vec.y < (bounds_rect->ymax - 1))) {
+ short min, max;
+ min = MIN2(se->v1->vec.x, se->v2->vec.x);
+ max = MAX2(se->v1->vec.x, se->v2->vec.x);
+
+ if (abs(my - se->v1->vec.y) <= safety && mx >= min && mx <= max)
+ return se;
+ }
+ }
+ else {
+ if ((se->v1->vec.x > bounds_rect->xmin) && (se->v1->vec.x < (bounds_rect->xmax - 1))) {
+ short min, max;
+ min = MIN2(se->v1->vec.y, se->v2->vec.y);
+ max = MAX2(se->v1->vec.y, se->v2->vec.y);
+
+ if (abs(mx - se->v1->vec.x) <= safety && my >= min && my <= max)
+ return se;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/* need win size to make sure not to include edges along screen edge */
+ScrEdge *screen_geom_find_active_scredge(
+ const wmWindow *win, const bScreen *screen,
+ const int mx, const int my)
+{
+ /* Use layout size (screen excluding global areas) for screen-layout area edges */
+ rcti screen_rect;
+ ScrEdge *se;
+
+ WM_window_screen_rect_calc(win, &screen_rect);
+ se = screen_geom_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(screen), &screen_rect, mx, my);
+
+ if (!se) {
+ /* Use entire window size (screen including global areas) for global area edges */
+ rcti win_rect;
+ WM_window_rect_calc(win, &win_rect);
+ se = screen_geom_area_map_find_active_scredge(&win->global_areas, &win_rect, mx, my);
+ }
+ return se;
+}
+
+/**
+ * \brief Main screen-layout calculation function.
+ *
+ * * Scale areas nicely on window size and DPI changes.
+ * * Ensure areas have a minimum height.
+ * * Correctly set global areas to their fixed height.
+ */
+void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc)
+{
+ /* clamp Y size of header sized areas when expanding windows
+ * avoids annoying empty space around file menu */
+#define USE_HEADER_SIZE_CLAMP
+
+ rcti window_rect, screen_rect;
+
+ WM_window_rect_calc(win, &window_rect);
+ WM_window_screen_rect_calc(win, &screen_rect);
+
+ const int headery_init = ED_area_headersize();
+ const int screen_size_x = BLI_rcti_size_x(&screen_rect);
+ const int screen_size_y = BLI_rcti_size_y(&screen_rect);
+ ScrVert *sv = NULL;
+ ScrArea *sa;
+ int screen_size_x_prev, screen_size_y_prev;
+ float min[2], max[2];
+
+ /* calculate size */
+ min[0] = min[1] = 20000.0f;
+ max[0] = max[1] = 0.0f;
+
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
+ const float fv[2] = {(float)sv->vec.x, (float)sv->vec.y};
+ minmax_v2v2_v2(min, max, fv);
+ }
+
+ screen_size_x_prev = (max[0] - min[0]) + 1;
+ screen_size_y_prev = (max[1] - min[1]) + 1;
+
+
+#ifdef USE_HEADER_SIZE_CLAMP
+#define TEMP_BOTTOM 1
+#define TEMP_TOP 2
+
+ /* if the window's Y axis grows, clamp header sized areas */
+ if (screen_size_y_prev < screen_size_y) { /* growing? */
+ const int headery_margin_max = headery_init + 5;
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ sa->temp = 0;
+
+ if (ar && !(ar->flag & RGN_FLAG_HIDDEN)) {
+ if (sa->v2->vec.y == max[1]) {
+ if (screen_geom_area_height(sa) < headery_margin_max) {
+ sa->temp = TEMP_TOP;
+ }
+ }
+ else if (sa->v1->vec.y == min[1]) {
+ if (screen_geom_area_height(sa) < headery_margin_max) {
+ sa->temp = TEMP_BOTTOM;
+ }
+ }
+ }
+ }
+ }
+#endif
+
+
+ if (screen_size_x_prev != screen_size_x || screen_size_y_prev != screen_size_y) {
+ const float facx = ((float)screen_size_x - 1) / ((float)screen_size_x_prev - 1);
+ const float facy = ((float)screen_size_y - 1) / ((float)screen_size_y_prev - 1);
+
+ /* make sure it fits! */
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
+ sv->vec.x = screen_rect.xmin + round_fl_to_short((sv->vec.x - min[0]) * facx);
+ CLAMP(sv->vec.x, screen_rect.xmin, screen_rect.xmax - 1);
+
+ sv->vec.y = screen_rect.ymin + round_fl_to_short((sv->vec.y - min[1]) * facy);
+ CLAMP(sv->vec.y, screen_rect.ymin, screen_rect.ymax - 1);
+ }
+ }
+
+
+#ifdef USE_HEADER_SIZE_CLAMP
+ if (screen_size_y_prev < screen_size_y) { /* growing? */
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ ScrEdge *se = NULL;
+
+ if (sa->temp == 0)
+ continue;
+
+ if (sa->v1 == sa->v2)
+ continue;
+
+ /* adjust headery if verts are along the edge of window */
+ if (sa->temp == TEMP_TOP) {
+ /* lower edge */
+ const int yval = sa->v2->vec.y - headery_init;
+ se = BKE_screen_find_edge(sc, sa->v4, sa->v1);
+ if (se != NULL) {
+ screen_geom_select_connected_edge(win, se);
+ }
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
+ if (sv != sa->v2 && sv != sa->v3) {
+ if (sv->flag) {
+ sv->vec.y = yval;
+ }
+ }
+ }
+ }
+ else {
+ /* upper edge */
+ const int yval = sa->v1->vec.y + headery_init;
+ se = BKE_screen_find_edge(sc, sa->v2, sa->v3);
+ if (se != NULL) {
+ screen_geom_select_connected_edge(win, se);
+ }
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
+ if (sv != sa->v1 && sv != sa->v4) {
+ if (sv->flag) {
+ sv->vec.y = yval;
+ }
+ }
+ }
+ }
+ }
+ }
+
+#undef USE_HEADER_SIZE_CLAMP
+#undef TEMP_BOTTOM
+#undef TEMP_TOP
+#endif
+
+
+ /* test for collapsed areas. This could happen in some blender version... */
+ /* ton: removed option now, it needs Context... */
+
+ /* make each window at least ED_area_headersize() high */
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ int headery = headery_init;
+
+ /* adjust headery if verts are along the edge of window */
+ if (sa->v1->vec.y > window_rect.ymin)
+ headery += U.pixelsize;
+ if (sa->v2->vec.y < (window_rect.ymax - 1))
+ headery += U.pixelsize;
+
+ if (screen_geom_area_height(sa) < headery) {
+ /* lower edge */
+ ScrEdge *se = BKE_screen_find_edge(sc, sa->v4, sa->v1);
+ if (se && sa->v1 != sa->v2) {
+ const int yval = sa->v2->vec.y - headery + 1;
+
+ screen_geom_select_connected_edge(win, se);
+
+ /* all selected vertices get the right offset */
+ for (sv = sc->vertbase.first; sv; sv = sv->next) {
+ /* if is a collapsed area */
+ if (sv != sa->v2 && sv != sa->v3) {
+ if (sv->flag) {
+ sv->vec.y = yval;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* Global areas have a fixed size that only changes with the DPI. Here we ensure that exactly this size is set. */
+ for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) {
+ if (area->global->flag & GLOBAL_AREA_IS_HIDDEN) {
+ continue;
+ }
+
+ int height = ED_area_global_size_y(area) - 1;
+
+ if (area->v1->vec.y > window_rect.ymin) {
+ height += U.pixelsize;
+ }
+ if (area->v2->vec.y < (window_rect.ymax - 1)) {
+ height += U.pixelsize;
+ }
+
+ /* width */
+ area->v1->vec.x = area->v2->vec.x = window_rect.xmin;
+ area->v3->vec.x = area->v4->vec.x = window_rect.xmax - 1;
+ /* height */
+ area->v1->vec.y = area->v4->vec.y = window_rect.ymin;
+ area->v2->vec.y = area->v3->vec.y = window_rect.ymax - 1;
+
+ switch (area->global->align) {
+ case GLOBAL_AREA_ALIGN_TOP:
+ area->v1->vec.y = area->v4->vec.y = area->v2->vec.y - height;
+ break;
+ case GLOBAL_AREA_ALIGN_BOTTOM:
+ area->v2->vec.y = area->v3->vec.y = area->v1->vec.y + height;
+ break;
+ }
+ }
+}
+
+/**
+ * \return 0 if no split is possible, otherwise the screen-coordinate at which to split.
+ */
+short screen_geom_find_area_split_point(const ScrArea *sa, const rcti *window_rect, char dir, float fac)
+{
+ short x, y;
+ const int cur_area_width = screen_geom_area_width(sa);
+ const int cur_area_height = screen_geom_area_height(sa);
+ const short area_min_x = AREAMINX;
+ const short area_min_y = ED_area_headersize();
+ int area_min;
+
+ // area big enough?
+ if ((dir == 'v') && (cur_area_width <= 2 * area_min_x)) {
+ return 0;
+ }
+ if ((dir == 'h') && (cur_area_height <= 2 * area_min_y)) {
+ return 0;
+ }
+
+ // to be sure
+ CLAMP(fac, 0.0f, 1.0f);
+
+ if (dir == 'h') {
+ y = sa->v1->vec.y + round_fl_to_short(fac * cur_area_height);
+
+ area_min = area_min_y;
+
+ if (sa->v1->vec.y > window_rect->ymin) {
+ area_min += U.pixelsize;
+ }
+ if (sa->v2->vec.y < (window_rect->ymax - 1)) {
+ area_min += U.pixelsize;
+ }
+
+ if (y - sa->v1->vec.y < area_min) {
+ y = sa->v1->vec.y + area_min;
+ }
+ else if (sa->v2->vec.y - y < area_min) {
+ y = sa->v2->vec.y - area_min;
+ }
+
+ return y;
+ }
+ else {
+ x = sa->v1->vec.x + round_fl_to_short(fac * cur_area_width);
+
+ area_min = area_min_x;
+
+ if (sa->v1->vec.x > window_rect->xmin) {
+ area_min += U.pixelsize;
+ }
+ if (sa->v4->vec.x < (window_rect->xmax - 1)) {
+ area_min += U.pixelsize;
+ }
+
+ if (x - sa->v1->vec.x < area_min) {
+ x = sa->v1->vec.x + area_min;
+ }
+ else if (sa->v4->vec.x - x < area_min) {
+ x = sa->v4->vec.x - area_min;
+ }
+
+ return x;
+ }
+}
+
+/**
+ * Select all edges that are directly or indirectly connected to \a edge.
+ */
+void screen_geom_select_connected_edge(const wmWindow *win, ScrEdge *edge)
+{
+ bScreen *sc = WM_window_get_active_screen(win);
+ bool oneselected = true;
+ char dir;
+
+ /* select connected, only in the right direction */
+ /* 'dir' is the direction of EDGE */
+
+ if (edge->v1->vec.x == edge->v2->vec.x) {
+ dir = 'v';
+ }
+ else {
+ dir = 'h';
+ }
+
+ ED_screen_verts_iter(win, sc, sv) {
+ sv->flag = 0;
+ }
+
+ edge->v1->flag = 1;
+ edge->v2->flag = 1;
+
+ while (oneselected) {
+ oneselected = false;
+ for (ScrEdge *se = sc->edgebase.first; se; se = se->next) {
+ if (se->v1->flag + se->v2->flag == 1) {
+ if (dir == 'h') {
+ if (se->v1->vec.y == se->v2->vec.y) {
+ se->v1->flag = se->v2->flag = 1;
+ oneselected = true;
+ }
+ }
+ if (dir == 'v') {
+ if (se->v1->vec.x == se->v2->vec.x) {
+ se->v1->flag = se->v2->flag = 1;
+ oneselected = true;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index 2c343fb9d70..cd71c07a3c0 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -53,22 +53,32 @@ void screen_data_copy(bScreen *to, bScreen *from);
void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new);
void screen_change_update(struct bContext *C, wmWindow *win, bScreen *sc);
bScreen *screen_change_prepare(bScreen *screen_old, bScreen *screen_new, struct Main *bmain, struct bContext *C, wmWindow *win);
-ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
+ScrArea *area_split(const wmWindow *win, bScreen *sc, ScrArea *sa, char dir, float fac, int merge);
int screen_area_join(struct bContext *C, bScreen *scr, ScrArea *sa1, ScrArea *sa2);
int area_getorientation(ScrArea *sa, ScrArea *sb);
-void select_connected_scredge(const wmWindow *win, ScrEdge *edge);
-bool scredge_is_horizontal(ScrEdge *se);
-ScrEdge *screen_area_map_find_active_scredge(
+struct AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]);
+struct AZone *ED_area_actionzone_refresh_xy(ScrArea *sa, const int xy[2]);
+
+/* screen_geometry.c */
+int screen_geom_area_height(const ScrArea *area);
+int screen_geom_area_width(const ScrArea *area);
+ScrVert *screen_geom_vertex_add_ex(ScrAreaMap *area_map, short x, short y);
+ScrVert *screen_geom_vertex_add(bScreen *sc, short x, short y);
+ScrEdge *screen_geom_edge_add_ex(ScrAreaMap *area_map, ScrVert *v1, ScrVert *v2);
+ScrEdge *screen_geom_edge_add(bScreen *sc, ScrVert *v1, ScrVert *v2);
+bool screen_geom_edge_is_horizontal(ScrEdge *se);
+ScrEdge *screen_geom_area_map_find_active_scredge(
const struct ScrAreaMap *area_map,
const rcti *bounds_rect,
const int mx, const int my);
-ScrEdge *screen_find_active_scredge(
+ScrEdge *screen_geom_find_active_scredge(
const wmWindow *win, const bScreen *screen,
const int mx, const int my);
+void screen_geom_vertices_scale(const wmWindow *win, bScreen *sc);
+short screen_geom_find_area_split_point(const ScrArea *sa, const rcti *window_rect, char dir, float fac);
+void screen_geom_select_connected_edge(const wmWindow *win, ScrEdge *edge);
-struct AZone *ED_area_actionzone_find_xy(ScrArea *sa, const int xy[2]);
-struct AZone *ED_area_actionzone_refresh_xy(ScrArea *sa, const int xy[2]);
/* screen_context.c */
int ed_screen_context(
@@ -78,7 +88,6 @@ extern const char *screen_context_dir[]; /* doc access */
/* screendump.c */
void SCREEN_OT_screenshot(struct wmOperatorType *ot);
-void SCREEN_OT_screencast(struct wmOperatorType *ot);
/* screen_ops.c */
void region_blend_start(struct bContext *C, struct ScrArea *sa, struct ARegion *ar);
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index e08755c84c6..fb269740109 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -104,7 +104,7 @@
/** \name Public Poll API
* \{ */
-int ED_operator_regionactive(bContext *C)
+bool ED_operator_regionactive(bContext *C)
{
if (CTX_wm_window(C) == NULL) return 0;
if (CTX_wm_screen(C) == NULL) return 0;
@@ -112,7 +112,7 @@ int ED_operator_regionactive(bContext *C)
return 1;
}
-int ED_operator_areaactive(bContext *C)
+bool ED_operator_areaactive(bContext *C)
{
if (CTX_wm_window(C) == NULL) return 0;
if (CTX_wm_screen(C) == NULL) return 0;
@@ -120,7 +120,7 @@ int ED_operator_areaactive(bContext *C)
return 1;
}
-int ED_operator_screenactive(bContext *C)
+bool ED_operator_screenactive(bContext *C)
{
if (CTX_wm_window(C) == NULL) return 0;
if (CTX_wm_screen(C) == NULL) return 0;
@@ -128,7 +128,7 @@ int ED_operator_screenactive(bContext *C)
}
/* XXX added this to prevent anim state to change during renders */
-static int ED_operator_screenactive_norender(bContext *C)
+static bool ED_operator_screenactive_norender(bContext *C)
{
if (G.is_rendering) return 0;
if (CTX_wm_window(C) == NULL) return 0;
@@ -137,7 +137,7 @@ static int ED_operator_screenactive_norender(bContext *C)
}
/* when mouse is over area-edge */
-int ED_operator_screen_mainwinactive(bContext *C)
+bool ED_operator_screen_mainwinactive(bContext *C)
{
bScreen *screen;
if (CTX_wm_window(C) == NULL) return 0;
@@ -147,7 +147,7 @@ int ED_operator_screen_mainwinactive(bContext *C)
return 1;
}
-int ED_operator_scene(bContext *C)
+bool ED_operator_scene(bContext *C)
{
Scene *scene = CTX_data_scene(C);
if (scene)
@@ -155,7 +155,7 @@ int ED_operator_scene(bContext *C)
return 0;
}
-int ED_operator_scene_editable(bContext *C)
+bool ED_operator_scene_editable(bContext *C)
{
Scene *scene = CTX_data_scene(C);
if (scene && !ID_IS_LINKED(scene))
@@ -163,7 +163,7 @@ int ED_operator_scene_editable(bContext *C)
return 0;
}
-int ED_operator_objectmode(bContext *C)
+bool ED_operator_objectmode(bContext *C)
{
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
@@ -190,12 +190,12 @@ static bool ed_spacetype_test(bContext *C, int type)
return 0;
}
-int ED_operator_view3d_active(bContext *C)
+bool ED_operator_view3d_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_VIEW3D);
}
-int ED_operator_region_view3d_active(bContext *C)
+bool ED_operator_region_view3d_active(bContext *C)
{
if (CTX_wm_region_view3d(C))
return true;
@@ -205,7 +205,7 @@ int ED_operator_region_view3d_active(bContext *C)
}
/* generic for any view2d which uses anim_ops */
-int ED_operator_animview_active(bContext *C)
+bool ED_operator_animview_active(bContext *C)
{
if (ED_operator_areaactive(C)) {
SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C);
@@ -217,12 +217,12 @@ int ED_operator_animview_active(bContext *C)
return 0;
}
-int ED_operator_outliner_active(bContext *C)
+bool ED_operator_outliner_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_OUTLINER);
}
-int ED_operator_outliner_active_no_editobject(bContext *C)
+bool ED_operator_outliner_active_no_editobject(bContext *C)
{
if (ed_spacetype_test(C, SPACE_OUTLINER)) {
Object *ob = ED_object_active_context(C);
@@ -235,22 +235,22 @@ int ED_operator_outliner_active_no_editobject(bContext *C)
return 0;
}
-int ED_operator_file_active(bContext *C)
+bool ED_operator_file_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_FILE);
}
-int ED_operator_action_active(bContext *C)
+bool ED_operator_action_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_ACTION);
}
-int ED_operator_buttons_active(bContext *C)
+bool ED_operator_buttons_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_BUTS);
}
-int ED_operator_node_active(bContext *C)
+bool ED_operator_node_active(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -260,7 +260,7 @@ int ED_operator_node_active(bContext *C)
return 0;
}
-int ED_operator_node_editable(bContext *C)
+bool ED_operator_node_editable(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -270,75 +270,75 @@ int ED_operator_node_editable(bContext *C)
return 0;
}
-int ED_operator_graphedit_active(bContext *C)
+bool ED_operator_graphedit_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_IPO);
}
-int ED_operator_sequencer_active(bContext *C)
+bool ED_operator_sequencer_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_SEQ);
}
-int ED_operator_sequencer_active_editable(bContext *C)
+bool ED_operator_sequencer_active_editable(bContext *C)
{
return ed_spacetype_test(C, SPACE_SEQ) && ED_operator_scene_editable(C);
}
-int ED_operator_image_active(bContext *C)
+bool ED_operator_image_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_IMAGE);
}
-int ED_operator_nla_active(bContext *C)
+bool ED_operator_nla_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_NLA);
}
-int ED_operator_info_active(bContext *C)
+bool ED_operator_info_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_INFO);
}
-int ED_operator_console_active(bContext *C)
+bool ED_operator_console_active(bContext *C)
{
return ed_spacetype_test(C, SPACE_CONSOLE);
}
-static int ed_object_hidden(Object *ob)
+static bool ed_object_hidden(Object *ob)
{
/* if hidden but in edit mode, we still display, can happen with animation */
return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT));
}
-int ED_operator_object_active(bContext *C)
+bool ED_operator_object_active(bContext *C)
{
Object *ob = ED_object_active_context(C);
return ((ob != NULL) && !ed_object_hidden(ob));
}
-int ED_operator_object_active_editable(bContext *C)
+bool ED_operator_object_active_editable(bContext *C)
{
Object *ob = ED_object_active_context(C);
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob));
}
-int ED_operator_object_active_editable_mesh(bContext *C)
+bool ED_operator_object_active_editable_mesh(bContext *C)
{
Object *ob = ED_object_active_context(C);
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) &&
(ob->type == OB_MESH) && !ID_IS_LINKED(ob->data));
}
-int ED_operator_object_active_editable_font(bContext *C)
+bool ED_operator_object_active_editable_font(bContext *C)
{
Object *ob = ED_object_active_context(C);
return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) &&
(ob->type == OB_FONT));
}
-int ED_operator_editmesh(bContext *C)
+bool ED_operator_editmesh(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_MESH)
@@ -346,12 +346,12 @@ int ED_operator_editmesh(bContext *C)
return 0;
}
-int ED_operator_editmesh_view3d(bContext *C)
+bool ED_operator_editmesh_view3d(bContext *C)
{
return ED_operator_editmesh(C) && ED_operator_view3d_active(C);
}
-int ED_operator_editmesh_region_view3d(bContext *C)
+bool ED_operator_editmesh_region_view3d(bContext *C)
{
if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C))
return 1;
@@ -360,7 +360,7 @@ int ED_operator_editmesh_region_view3d(bContext *C)
return 0;
}
-int ED_operator_editmesh_auto_smooth(bContext *C)
+bool ED_operator_editmesh_auto_smooth(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_MESH && (((Mesh *)(obedit->data))->flag & ME_AUTOSMOOTH)) {
@@ -369,7 +369,7 @@ int ED_operator_editmesh_auto_smooth(bContext *C)
return 0;
}
-int ED_operator_editarmature(bContext *C)
+bool ED_operator_editarmature(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_ARMATURE)
@@ -384,7 +384,7 @@ int ED_operator_editarmature(bContext *C)
* when it comes to transforming bones, but managing bones layers/groups
* can be left for pose mode only. (not weight paint mode)
*/
-int ED_operator_posemode_exclusive(bContext *C)
+bool ED_operator_posemode_exclusive(bContext *C)
{
Object *obact = CTX_data_active_object(C);
@@ -402,7 +402,7 @@ int ED_operator_posemode_exclusive(bContext *C)
/* allows for pinned pose objects to be used in the object buttons
* and the non-active pose object to be used in the 3D view */
-int ED_operator_posemode_context(bContext *C)
+bool ED_operator_posemode_context(bContext *C)
{
Object *obpose = ED_pose_object_from_context(C);
@@ -415,7 +415,7 @@ int ED_operator_posemode_context(bContext *C)
return 0;
}
-int ED_operator_posemode(bContext *C)
+bool ED_operator_posemode(bContext *C)
{
Object *obact = CTX_data_active_object(C);
@@ -431,7 +431,7 @@ int ED_operator_posemode(bContext *C)
return 0;
}
-int ED_operator_posemode_local(bContext *C)
+bool ED_operator_posemode_local(bContext *C)
{
if (ED_operator_posemode(C)) {
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
@@ -443,21 +443,21 @@ int ED_operator_posemode_local(bContext *C)
}
/* wrapper for ED_space_image_show_uvedit */
-int ED_operator_uvedit(bContext *C)
+bool ED_operator_uvedit(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
Object *obedit = CTX_data_edit_object(C);
return ED_space_image_show_uvedit(sima, obedit);
}
-int ED_operator_uvedit_space_image(bContext *C)
+bool ED_operator_uvedit_space_image(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
Object *obedit = CTX_data_edit_object(C);
return sima && ED_space_image_show_uvedit(sima, obedit);
}
-int ED_operator_uvmap(bContext *C)
+bool ED_operator_uvmap(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = NULL;
@@ -473,7 +473,7 @@ int ED_operator_uvmap(bContext *C)
return false;
}
-int ED_operator_editsurfcurve(bContext *C)
+bool ED_operator_editsurfcurve(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF))
@@ -481,7 +481,7 @@ int ED_operator_editsurfcurve(bContext *C)
return 0;
}
-int ED_operator_editsurfcurve_region_view3d(bContext *C)
+bool ED_operator_editsurfcurve_region_view3d(bContext *C)
{
if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C))
return 1;
@@ -490,7 +490,7 @@ int ED_operator_editsurfcurve_region_view3d(bContext *C)
return 0;
}
-int ED_operator_editcurve(bContext *C)
+bool ED_operator_editcurve(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_CURVE)
@@ -498,7 +498,7 @@ int ED_operator_editcurve(bContext *C)
return 0;
}
-int ED_operator_editcurve_3d(bContext *C)
+bool ED_operator_editcurve_3d(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_CURVE) {
@@ -509,7 +509,7 @@ int ED_operator_editcurve_3d(bContext *C)
return 0;
}
-int ED_operator_editsurf(bContext *C)
+bool ED_operator_editsurf(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_SURF)
@@ -517,7 +517,7 @@ int ED_operator_editsurf(bContext *C)
return 0;
}
-int ED_operator_editfont(bContext *C)
+bool ED_operator_editfont(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_FONT)
@@ -525,7 +525,7 @@ int ED_operator_editfont(bContext *C)
return 0;
}
-int ED_operator_editlattice(bContext *C)
+bool ED_operator_editlattice(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_LATTICE)
@@ -533,7 +533,7 @@ int ED_operator_editlattice(bContext *C)
return 0;
}
-int ED_operator_editmball(bContext *C)
+bool ED_operator_editmball(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_MBALL)
@@ -541,7 +541,7 @@ int ED_operator_editmball(bContext *C)
return 0;
}
-int ED_operator_mask(bContext *C)
+bool ED_operator_mask(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacedata.first) {
@@ -569,7 +569,7 @@ int ED_operator_mask(bContext *C)
return false;
}
-int ED_operator_camera(bContext *C)
+bool ED_operator_camera(bContext *C)
{
struct Camera *cam = CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
return (cam != NULL);
@@ -581,7 +581,7 @@ int ED_operator_camera(bContext *C)
/** \name Internal Screen Utilities
* \{ */
-static int screen_active_editable(bContext *C)
+static bool screen_active_editable(bContext *C)
{
if (ED_operator_screenactive(C)) {
/* no full window splitting allowed */
@@ -645,7 +645,7 @@ typedef struct sActionzoneData {
} sActionzoneData;
/* quick poll to save operators to be created and handled */
-static int actionzone_area_poll(bContext *C)
+static bool actionzone_area_poll(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
@@ -854,8 +854,8 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
AZone *az = ED_area_actionzone_find_xy(sa, &event->x);
sActionzoneData *sad;
- /* quick escape */
- if (az == NULL)
+ /* quick escape - Scroll azones only hide/unhide the scroll-bars, they have their own handling. */
+ if (az == NULL || ELEM(az->type, AZONE_REGION_SCROLL))
return OPERATOR_PASS_THROUGH;
/* ok we do the actionzone */
@@ -870,9 +870,6 @@ static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
actionzone_exit(op);
return OPERATOR_FINISHED;
}
- else if (ELEM(sad->az->type, AZONE_REGION_SCROLL)) {
- return OPERATOR_PASS_THROUGH;
- }
else {
/* add modal handler */
WM_event_add_modal_handler(C, op);
@@ -913,7 +910,7 @@ static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* once we drag outside the actionzone, register a gesture
* check we're not on an edge so join finds the other area */
is_gesture = ((ED_area_actionzone_find_xy(sad->sa1, &event->x) != sad->az) &&
- (screen_area_map_find_active_scredge(
+ (screen_geom_area_map_find_active_scredge(
AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y) == NULL));
}
else {
@@ -1235,10 +1232,10 @@ typedef struct sAreaMoveData {
* need window bounds in order to get correct limits */
static void area_move_set_limits(
wmWindow *win, bScreen *sc, int dir,
- const rcti *screen_rect,
int *bigger, int *smaller,
bool *use_bigger_smaller_snap)
{
+ rcti window_rect;
int areaminy = ED_area_headersize();
int areamin;
@@ -1248,8 +1245,11 @@ static void area_move_set_limits(
if (use_bigger_smaller_snap != NULL) {
*use_bigger_smaller_snap = false;
for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) {
- const int size_min = round_fl_to_int(area->global->size_min * UI_DPI_FAC);
- const int size_max = round_fl_to_int(area->global->size_max * UI_DPI_FAC);
+ int size_min = ED_area_global_min_size_y(area) - 1;
+ int size_max = ED_area_global_max_size_y(area) - 1;
+
+ size_min = MAX2(size_min, 0);
+ BLI_assert(size_min < size_max);
/* logic here is only tested for lower edge :) */
/* left edge */
@@ -1283,17 +1283,19 @@ static void area_move_set_limits(
}
}
+ WM_window_rect_calc(win, &window_rect);
+
for (ScrArea *sa = sc->areabase.first; sa; sa = sa->next) {
if (dir == 'h') {
int y1;
areamin = areaminy;
- if (sa->v1->vec.y > screen_rect->ymin)
+ if (sa->v1->vec.y > window_rect.ymin)
areamin += U.pixelsize;
- if (sa->v2->vec.y < (screen_rect->ymax - 1))
+ if (sa->v2->vec.y < (window_rect.ymax - 1))
areamin += U.pixelsize;
- y1 = sa->v2->vec.y - sa->v1->vec.y + 1 - areamin;
+ y1 = screen_geom_area_height(sa) - areamin;
/* if top or down edge selected, test height */
if (sa->v1->editflag && sa->v4->editflag)
@@ -1305,12 +1307,12 @@ static void area_move_set_limits(
int x1;
areamin = AREAMINX;
- if (sa->v1->vec.x > screen_rect->xmin)
+ if (sa->v1->vec.x > window_rect.xmin)
areamin += U.pixelsize;
- if (sa->v4->vec.x < (screen_rect->xmax - 1))
+ if (sa->v4->vec.x < (window_rect.xmax - 1))
areamin += U.pixelsize;
- x1 = sa->v4->vec.x - sa->v1->vec.x + 1 - areamin;
+ x1 = screen_geom_area_width(sa) - areamin;
/* if left or right edge selected, test width */
if (sa->v1->editflag && sa->v2->editflag)
@@ -1329,7 +1331,6 @@ static int area_move_init(bContext *C, wmOperator *op)
wmWindow *win = CTX_wm_window(C);
ScrEdge *actedge;
sAreaMoveData *md;
- rcti screen_rect;
int x, y;
/* required properties */
@@ -1337,28 +1338,24 @@ static int area_move_init(bContext *C, wmOperator *op)
y = RNA_int_get(op->ptr, "y");
/* setup */
- actedge = screen_find_active_scredge(win, sc, x, y);
+ actedge = screen_geom_find_active_scredge(win, sc, x, y);
if (actedge == NULL) return 0;
md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
op->customdata = md;
- md->dir = scredge_is_horizontal(actedge) ? 'h' : 'v';
+ md->dir = screen_geom_edge_is_horizontal(actedge) ? 'h' : 'v';
if (md->dir == 'h') md->origval = actedge->v1->vec.y;
else md->origval = actedge->v1->vec.x;
- select_connected_scredge(win, actedge);
+ screen_geom_select_connected_edge(win, actedge);
/* now all vertices with 'flag == 1' are the ones that can be moved. Move this to editflag */
ED_screen_verts_iter(win, sc, v1) {
v1->editflag = v1->flag;
}
- WM_window_screen_rect_calc(win, &screen_rect);
-
bool use_bigger_smaller_snap = false;
- area_move_set_limits(win, sc, md->dir, &screen_rect,
- &md->bigger, &md->smaller,
- &use_bigger_smaller_snap);
+ area_move_set_limits(win, sc, md->dir, &md->bigger, &md->smaller, &use_bigger_smaller_snap);
md->snap_type = use_bigger_smaller_snap ? SNAP_BIGGER_SMALLER_ONLY : SNAP_AREAGRID;
@@ -1379,6 +1376,7 @@ static int area_snap_calc_location(
final_loc = m_loc;
if (delta != bigger && delta != -smaller) {
final_loc -= (m_loc % AREAGRID);
+ CLAMP(final_loc, origval - smaller, origval + bigger);
}
break;
@@ -1427,6 +1425,9 @@ static int area_snap_calc_location(
break;
}
+ BLI_assert(ELEM(snap_type, SNAP_BIGGER_SMALLER_ONLY) ||
+ IN_RANGE_INCL(final_loc, origval - smaller, origval + bigger));
+
return final_loc;
}
@@ -1439,10 +1440,12 @@ static void area_move_apply_do(
{
wmWindow *win = CTX_wm_window(C);
bScreen *sc = CTX_wm_screen(C);
+ short final_loc = -1;
bool doredraw = false;
- CLAMP(delta, -smaller, bigger);
- short final_loc = -1;
+ if (snap_type != SNAP_BIGGER_SMALLER_ONLY) {
+ CLAMP(delta, -smaller, bigger);
+ }
if (snap_type == SNAP_NONE) {
final_loc = origval + delta;
@@ -1473,7 +1476,7 @@ static void area_move_apply_do(
ED_screen_areas_iter(win, sc, sa) {
if (sa->v1->editflag || sa->v2->editflag || sa->v3->editflag || sa->v4->editflag) {
if (ED_area_is_global(sa)) {
- sa->global->cur_fixed_height = round_fl_to_int((sa->v2->vec.y - sa->v1->vec.y) / UI_DPI_FAC);
+ sa->global->cur_fixed_height = round_fl_to_int(screen_geom_area_height(sa) / UI_DPI_FAC);
sc->do_refresh = true;
redraw_all = true;
}
@@ -1766,6 +1769,7 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb)
/* do the split, return success */
static int area_split_apply(bContext *C, wmOperator *op)
{
+ const wmWindow *win = CTX_wm_window(C);
bScreen *sc = CTX_wm_screen(C);
sAreaSplitData *sd = (sAreaSplitData *)op->customdata;
float fac;
@@ -1774,16 +1778,15 @@ static int area_split_apply(bContext *C, wmOperator *op)
fac = RNA_float_get(op->ptr, "factor");
dir = RNA_enum_get(op->ptr, "direction");
- sd->narea = area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */
+ sd->narea = area_split(win, sc, sd->sarea, dir, fac, 0); /* 0 = no merge */
if (sd->narea) {
- ScrVert *sv;
-
sd->nedge = area_findsharededge(sc, sd->sarea, sd->narea);
/* select newly created edge, prepare for moving edge */
- for (sv = sc->vertbase.first; sv; sv = sv->next)
+ ED_screen_verts_iter(win, sc, sv) {
sv->editflag = 0;
+ }
sd->nedge->v1->editflag = 1;
sd->nedge->v2->editflag = 1;
@@ -1839,14 +1842,14 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
wmWindow *win = CTX_wm_window(C);
bScreen *sc = CTX_wm_screen(C);
sAreaSplitData *sd;
- rcti screen_rect;
int dir;
/* no full window splitting allowed */
- if (sc->state != SCREENNORMAL)
- return OPERATOR_CANCELLED;
+ BLI_assert(sc->state == SCREENNORMAL);
- WM_window_screen_rect_calc(win, &screen_rect);
+ PropertyRNA *prop_dir = RNA_struct_find_property(op->ptr, "direction");
+ PropertyRNA *prop_factor = RNA_struct_find_property(op->ptr, "factor");
+ PropertyRNA *prop_cursor = RNA_struct_find_property(op->ptr, "cursor");
if (event->type == EVT_ACTIONZONE_AREA) {
sActionzoneData *sad = event->customdata;
@@ -1866,46 +1869,73 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* prepare operator state vars */
if (sad->gesture_dir == 'n' || sad->gesture_dir == 's') {
dir = 'h';
- RNA_float_set(op->ptr, "factor", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx);
+ RNA_property_float_set(
+ op->ptr, prop_factor,
+ ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx);
}
else {
dir = 'v';
- RNA_float_set(op->ptr, "factor", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy);
+ RNA_property_float_set(
+ op->ptr, prop_factor,
+ ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy);
}
- RNA_enum_set(op->ptr, "direction", dir);
+ RNA_property_enum_set(op->ptr, prop_dir, dir);
/* general init, also non-UI case, adds customdata, sets area and defaults */
- if (!area_split_init(C, op))
+ if (!area_split_init(C, op)) {
return OPERATOR_PASS_THROUGH;
+ }
+ }
+ else if (RNA_property_is_set(op->ptr, prop_dir)) {
+ ScrArea *sa = CTX_wm_area(C);
+ if (sa == NULL) {
+ return OPERATOR_CANCELLED;
+ }
+ dir = RNA_property_enum_get(op->ptr, prop_dir);
+ if (dir == 'h') {
+ RNA_property_float_set(
+ op->ptr, prop_factor,
+ ((float)(event->x - sa->v1->vec.x)) / (float)sa->winx);
+ }
+ else {
+ RNA_property_float_set(
+ op->ptr, prop_factor,
+ ((float)(event->y - sa->v1->vec.y)) / (float)sa->winy);
+ }
+ if (!area_split_init(C, op)) {
+ return OPERATOR_CANCELLED;
+ }
}
else {
ScrEdge *actedge;
- int x, y;
+ rcti window_rect;
+ int event_co[2];
/* retrieve initial mouse coord, so we can find the active edge */
- if (RNA_struct_property_is_set(op->ptr, "mouse_x"))
- x = RNA_int_get(op->ptr, "mouse_x");
- else
- x = event->x;
+ if (RNA_property_is_set(op->ptr, prop_cursor)) {
+ RNA_property_int_get_array(op->ptr, prop_cursor, event_co);
+ }
+ else {
+ copy_v2_v2_int(event_co, &event->x);
+ }
- if (RNA_struct_property_is_set(op->ptr, "mouse_y"))
- y = RNA_int_get(op->ptr, "mouse_y");
- else
- y = event->x;
+ WM_window_rect_calc(win, &window_rect);
- actedge = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, x, y);
- if (actedge == NULL)
+ actedge = screen_geom_area_map_find_active_scredge(
+ AREAMAP_FROM_SCREEN(sc), &window_rect, event_co[0], event_co[1]);
+ if (actedge == NULL) {
return OPERATOR_CANCELLED;
+ }
- dir = scredge_is_horizontal(actedge) ? 'v' : 'h';
+ dir = screen_geom_edge_is_horizontal(actedge) ? 'v' : 'h';
- RNA_enum_set(op->ptr, "direction", dir);
+ RNA_property_enum_set(op->ptr, prop_dir, dir);
/* special case, adds customdata, sets defaults */
- if (!area_split_menu_init(C, op))
+ if (!area_split_menu_init(C, op)) {
return OPERATOR_CANCELLED;
-
+ }
}
sd = (sAreaSplitData *)op->customdata;
@@ -1914,7 +1944,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* do the split */
if (area_split_apply(C, op)) {
- area_move_set_limits(win, sc, dir, &screen_rect, &sd->bigger, &sd->smaller, NULL);
+ area_move_set_limits(win, sc, dir, &sd->bigger, &sd->smaller, NULL);
/* add temp handler for edge move or cancel */
WM_event_add_modal_handler(C, op);
@@ -2105,8 +2135,7 @@ static void SCREEN_OT_area_split(wmOperatorType *ot)
/* rna */
RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", "");
RNA_def_float(ot->srna, "factor", 0.5f, 0.0, 1.0, "Factor", "", 0.0, 1.0);
- RNA_def_int(ot->srna, "mouse_x", -100, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX);
- RNA_def_int(ot->srna, "mouse_y", -100, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX);
+ RNA_def_int_vector(ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX);
}
/** \} */
@@ -2794,7 +2823,7 @@ static int screen_maximize_area_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int screen_maximize_area_poll(bContext *C)
+static bool screen_maximize_area_poll(bContext *C)
{
const bScreen *screen = CTX_wm_screen(C);
const ScrArea *area = CTX_wm_area(C);
@@ -2875,6 +2904,8 @@ static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata
/* XXX todo: find edge based on (x,y) and set other area? */
static int area_join_init(bContext *C, wmOperator *op)
{
+ const wmWindow *win = CTX_wm_window(C);
+ bScreen *screen = CTX_wm_screen(C);
ScrArea *sa1, *sa2;
sAreaJoinData *jd = NULL;
int x1, y1;
@@ -2887,10 +2918,21 @@ static int area_join_init(bContext *C, wmOperator *op)
x2 = RNA_int_get(op->ptr, "max_x");
y2 = RNA_int_get(op->ptr, "max_y");
- sa1 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, x1, y1);
- sa2 = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, x2, y2);
- if (sa1 == NULL || sa2 == NULL || sa1 == sa2)
+ sa1 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, x1, y1);
+ if (sa1 == NULL) {
+ sa1 = BKE_screen_area_map_find_area_xy(&win->global_areas, SPACE_TYPE_ANY, x1, y1);
+ }
+ sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, x2, y2);
+ if (sa2 == NULL) {
+ sa2 = BKE_screen_area_map_find_area_xy(&win->global_areas, SPACE_TYPE_ANY, x2, y2);
+ }
+ if ((sa1 && ED_area_is_global(sa1)) || (sa2 && ED_area_is_global(sa2))) {
+ BKE_report(op->reports, RPT_ERROR, "Global areas (Top Bar, Status Bar) do not support joining");
return 0;
+ }
+ else if (sa1 == NULL || sa2 == NULL || sa1 == sa2) {
+ return 0;
+ }
/* do areas share an edge? */
if (sa1->v1 == sa2->v1 || sa1->v1 == sa2->v2 || sa1->v1 == sa2->v3 || sa1->v1 == sa2->v4) shared++;
@@ -2989,7 +3031,7 @@ static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
if (!area_join_init(C, op))
- return OPERATOR_PASS_THROUGH;
+ return OPERATOR_CANCELLED;
/* add temp handler */
WM_event_add_modal_handler(C, op);
@@ -3122,10 +3164,10 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
uiLayout *layout;
PointerRNA ptr;
ScrEdge *actedge;
- rcti screen_rect;
+ rcti window_rect;
- WM_window_screen_rect_calc(win, &screen_rect);
- actedge = screen_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, event->x, event->y);
+ WM_window_rect_calc(win, &window_rect);
+ actedge = screen_geom_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &window_rect, event->x, event->y);
if (actedge == NULL) return OPERATOR_CANCELLED;
@@ -3134,8 +3176,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent
uiItemFullO(layout, "SCREEN_OT_area_split", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &ptr);
/* store initial mouse cursor position */
- RNA_int_set(&ptr, "mouse_x", event->x);
- RNA_int_set(&ptr, "mouse_y", event->y);
+ RNA_int_set_array(&ptr, "cursor", &event->x);
uiItemFullO(layout, "SCREEN_OT_area_join", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &ptr);
/* mouse cursor on edge, '4' can fail on wide edges... */
@@ -3529,7 +3570,7 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int region_flip_poll(bContext *C)
+static bool region_flip_poll(bContext *C)
{
ScrArea *area = CTX_wm_area(C);
@@ -3654,7 +3695,7 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UN
}
}
-static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
+static int header_context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
uiPopupMenu *pup;
uiLayout *layout;
@@ -3669,15 +3710,15 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
return OPERATOR_INTERFACE;
}
-static void SCREEN_OT_header_toolbox(wmOperatorType *ot)
+static void SCREEN_OT_header_context_menu(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Header Toolbox";
- ot->description = "Display header region toolbox";
- ot->idname = "SCREEN_OT_header_toolbox";
+ ot->name = "Header Context Menu";
+ ot->description = "Display header region context menu";
+ ot->idname = "SCREEN_OT_header_context_menu";
/* api callbacks */
- ot->invoke = header_toolbox_invoke;
+ ot->invoke = header_context_menu_invoke;
}
/** \} */
@@ -4552,7 +4593,7 @@ static const EnumPropertyItem space_context_cycle_direction[] = {
{0, NULL, 0, NULL, NULL}
};
-static int space_context_cycle_poll(bContext *C)
+static bool space_context_cycle_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
/* sa might be NULL if called out of window bounds */
@@ -4692,13 +4733,12 @@ void ED_operatortypes_screen(void)
WM_operatortype_append(SCREEN_OT_region_flip);
WM_operatortype_append(SCREEN_OT_header);
WM_operatortype_append(SCREEN_OT_header_toggle_menus);
- WM_operatortype_append(SCREEN_OT_header_toolbox);
+ WM_operatortype_append(SCREEN_OT_header_context_menu);
WM_operatortype_append(SCREEN_OT_screen_set);
WM_operatortype_append(SCREEN_OT_screen_full_area);
WM_operatortype_append(SCREEN_OT_back_to_previous);
WM_operatortype_append(SCREEN_OT_spacedata_cleanup);
WM_operatortype_append(SCREEN_OT_screenshot);
- WM_operatortype_append(SCREEN_OT_screencast);
WM_operatortype_append(SCREEN_OT_userpref_show);
WM_operatortype_append(SCREEN_OT_drivers_editor_show);
WM_operatortype_append(SCREEN_OT_region_blend);
@@ -4761,7 +4801,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
}
-static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_PATH) {
if (drag->icon == ICON_FILE_BLEND)
@@ -4805,13 +4845,15 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "SCREEN_OT_area_options", RIGHTMOUSE, KM_PRESS, 0, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "SCREEN_OT_header", F9KEY, KM_PRESS, KM_ALT, 0);
+#endif
/* Header Editing ------------------------------------------------ */
/* note: this is only used when the cursor is inside the header */
keymap = WM_keymap_find(keyconf, "Header", 0, 0);
- WM_keymap_add_item(keymap, "SCREEN_OT_header_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "SCREEN_OT_header_context_menu", RIGHTMOUSE, KM_PRESS, 0, 0);
/* Screen General ------------------------------------------------ */
keymap = WM_keymap_find(keyconf, "Screen", 0, 0);
@@ -4820,33 +4862,37 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_region_blend", TIMERREGION, KM_ANY, KM_ANY, 0);
-
+#ifdef USE_WM_KEYMAP_27X
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_screen_set", RIGHTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_screen_set", LEFTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
+#endif
WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", SPACEKEY, KM_PRESS, KM_SHIFT, 0);
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_screen_full_area", SPACEKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "use_hide_panels", true);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "SCREEN_OT_screenshot", F3KEY, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "SCREEN_OT_screencast", F3KEY, KM_PRESS, KM_ALT, 0);
+#endif
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_NEXT);
kmi = WM_keymap_add_item(keymap, "SCREEN_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_PREV);
- kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", TABKEY, KM_PRESS, KM_CTRL, 0);
+ kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", PAGEDOWNKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_NEXT);
- kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+ kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", PAGEUPKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_PREV);
/* tests */
WM_keymap_add_item(keymap, "SCREEN_OT_region_quadview", QKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
- WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_history", F3KEY, KM_PRESS, 0, 0);
+#ifdef USE_WM_KEYMAP_27X
+ WM_keymap_verify_item(keymap, "SCREEN_OT_repeat_history", RKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_repeat_last", RKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "SCREEN_OT_region_flip", F5KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "SCRIPT_OT_reload", F8KEY, KM_PRESS, 0, 0);
+#endif
/* files */
WM_keymap_add_item(keymap, "FILE_OT_execute", RETKEY, KM_PRESS, 0, 0);
@@ -4857,12 +4903,15 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
#ifdef __APPLE__
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT | KM_OSKEY, 0);
#endif
+#endif
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "ED_OT_redo", ZKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "ED_OT_undo_history", ZKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
-
+#endif
/* render */
kmi = WM_keymap_add_item(keymap, "RENDER_OT_render", F12KEY, KM_PRESS, 0, 0);
@@ -4878,23 +4927,29 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
#ifdef __APPLE__
WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", COMMAKEY, KM_PRESS, KM_OSKEY, 0);
#endif
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "SCREEN_OT_userpref_show", UKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+#endif
/* Anim Playback ------------------------------------------------ */
keymap = WM_keymap_find(keyconf, "Frames", 0, 0);
/* frame offsets */
+#ifdef USE_WM_KEYMAP_27X
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", 10);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", -10);
+#endif
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", -1);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
+#ifdef USE_WM_KEYMAP_27X
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELDOWNMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", WHEELUPMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "delta", -1);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", true);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "end", false);
+#endif
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", true);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", false);
diff --git a/source/blender/editors/screen/screen_user_menu.c b/source/blender/editors/screen/screen_user_menu.c
new file mode 100644
index 00000000000..e945a5ae291
--- /dev/null
+++ b/source/blender/editors/screen/screen_user_menu.c
@@ -0,0 +1,269 @@
+/*
+ * ***** 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) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/screen/screen_user_menu.c
+ * \ingroup spview3d
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+#include <float.h>
+
+#include "DNA_scene_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+#include "BLI_string.h"
+
+#include "BLT_translation.h"
+
+#include "BKE_blender_user_menu.h"
+#include "BKE_context.h"
+#include "BKE_screen.h"
+#include "BKE_idprop.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_screen.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
+
+/* -------------------------------------------------------------------- */
+/** \name Menu Type
+ * \{ */
+
+bUserMenu *ED_screen_user_menu_find(bContext *C)
+{
+ SpaceLink *sl = CTX_wm_space_data(C);
+ const char *context = CTX_data_mode_string(C);
+ return BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context);
+}
+
+bUserMenu *ED_screen_user_menu_ensure(bContext *C)
+{
+ SpaceLink *sl = CTX_wm_space_data(C);
+ const char *context = CTX_data_mode_string(C);
+ return BKE_blender_user_menu_ensure(&U.user_menus, sl->spacetype, context);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Menu Item
+ * \{ */
+
+bUserMenuItem_Op *ED_screen_user_menu_item_find_operator(
+ ListBase *lb,
+ const wmOperatorType *ot, IDProperty *prop, short opcontext)
+{
+ for (bUserMenuItem *umi = lb->first; umi; umi = umi->next) {
+ if (umi->type == USER_MENU_TYPE_OPERATOR) {
+ bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi;
+ if (STREQ(ot->idname, umi_op->op_idname) &&
+ (opcontext == umi_op->opcontext) &&
+ (IDP_EqualsProperties(prop, umi_op->prop)))
+ {
+ return umi_op;
+ }
+ }
+ }
+ return NULL;
+}
+
+struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu(
+ struct ListBase *lb,
+ const struct MenuType *mt)
+{
+ for (bUserMenuItem *umi = lb->first; umi; umi = umi->next) {
+ if (umi->type == USER_MENU_TYPE_MENU) {
+ bUserMenuItem_Menu *umi_mt = (bUserMenuItem_Menu *)umi;
+ if (STREQ(mt->idname, umi_mt->mt_idname)) {
+ return umi_mt;
+ }
+ }
+ }
+ return NULL;
+}
+
+struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop(
+ struct ListBase *lb,
+ const char *context_data_path, const char *prop_id, int prop_index)
+{
+ for (bUserMenuItem *umi = lb->first; umi; umi = umi->next) {
+ if (umi->type == USER_MENU_TYPE_PROP) {
+ bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)umi;
+ if (STREQ(context_data_path, umi_pr->context_data_path) &&
+ STREQ(prop_id, umi_pr->prop_id) &&
+ (prop_index == umi_pr->prop_index))
+ {
+ return umi_pr;
+ }
+ }
+ }
+ return NULL;
+}
+
+void ED_screen_user_menu_item_add_operator(
+ ListBase *lb, const char *ui_name,
+ const wmOperatorType *ot, const IDProperty *prop, short opcontext)
+{
+ bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)BKE_blender_user_menu_item_add(lb, USER_MENU_TYPE_OPERATOR);
+ umi_op->opcontext = opcontext;
+ if (!STREQ(ui_name, ot->name)) {
+ STRNCPY(umi_op->item.ui_name, ui_name);
+ }
+ STRNCPY(umi_op->op_idname, ot->idname);
+ umi_op->prop = prop ? IDP_CopyProperty(prop) : NULL;
+}
+
+void ED_screen_user_menu_item_add_menu(
+ ListBase *lb, const char *ui_name,
+ const MenuType *mt)
+{
+ bUserMenuItem_Menu *umi_mt = (bUserMenuItem_Menu *)BKE_blender_user_menu_item_add(lb, USER_MENU_TYPE_MENU);
+ if (!STREQ(ui_name, mt->label)) {
+ STRNCPY(umi_mt->item.ui_name, ui_name);
+ }
+ STRNCPY(umi_mt->mt_idname, mt->idname);
+}
+
+void ED_screen_user_menu_item_add_prop(
+ ListBase *lb, const char *ui_name,
+ const char *context_data_path, const char *prop_id, int prop_index)
+{
+ bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)BKE_blender_user_menu_item_add(lb, USER_MENU_TYPE_PROP);
+ STRNCPY(umi_pr->item.ui_name, ui_name);
+ STRNCPY(umi_pr->context_data_path, context_data_path);
+ STRNCPY(umi_pr->prop_id, prop_id);
+ umi_pr->prop_index = prop_index;
+}
+
+void ED_screen_user_menu_item_remove(ListBase *lb, bUserMenuItem *umi)
+{
+ BLI_remlink(lb, umi);
+ BKE_blender_user_menu_item_free(umi);
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name Menu Definition
+ * \{ */
+
+static void screen_user_menu_draw(const bContext *C, Menu *menu)
+{
+ SpaceLink *sl = CTX_wm_space_data(C);
+ const char *context = CTX_data_mode_string(C);
+ bUserMenu *um_array[] = {
+ BKE_blender_user_menu_find(&U.user_menus, sl->spacetype, context),
+ (sl->spacetype != SPACE_TOPBAR) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_TOPBAR, context) : NULL,
+ (sl->spacetype == SPACE_VIEW3D) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_BUTS, context) : NULL,
+ };
+ for (int um_index = 0; um_index < ARRAY_SIZE(um_array); um_index++) {
+ bUserMenu *um = um_array[um_index];
+ if (um == NULL) {
+ continue;
+ }
+ for (bUserMenuItem *umi = um->items.first; umi; umi = umi->next) {
+ const char *ui_name = umi->ui_name[0] ? umi->ui_name : NULL;
+ if (umi->type == USER_MENU_TYPE_OPERATOR) {
+ bUserMenuItem_Op *umi_op = (bUserMenuItem_Op *)umi;
+ IDProperty *prop = umi_op->prop ? IDP_CopyProperty(umi_op->prop) : NULL;
+ uiItemFullO(
+ menu->layout, umi_op->op_idname, ui_name,
+ ICON_NONE, prop, umi_op->opcontext, 0, NULL);
+ }
+ else if (umi->type == USER_MENU_TYPE_MENU) {
+ bUserMenuItem_Menu *umi_mt = (bUserMenuItem_Menu *)umi;
+ uiItemM(menu->layout, umi_mt->mt_idname, ui_name,
+ ICON_NONE);
+ }
+ else if (umi->type == USER_MENU_TYPE_PROP) {
+ bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)umi;
+
+ char *data_path = strchr(umi_pr->context_data_path, '.');
+ if (data_path) {
+ *data_path = '\0';
+ }
+ PointerRNA ptr = CTX_data_pointer_get(C, umi_pr->context_data_path);
+ if (ptr.type == NULL) {
+ PointerRNA ctx_ptr;
+ RNA_pointer_create(NULL, &RNA_Context, (void *)C, &ctx_ptr);
+ if (!RNA_path_resolve_full(&ctx_ptr, umi_pr->context_data_path, &ptr, NULL, NULL)) {
+ ptr.type = NULL;
+ }
+ }
+ if (data_path) {
+ *data_path = '.';
+ data_path += 1;
+ }
+
+ bool ok = false;
+ if (ptr.type != NULL) {
+ PropertyRNA *prop = NULL;
+ PointerRNA prop_ptr = ptr;
+ if ((data_path == NULL) || RNA_path_resolve_full(&ptr, data_path, &prop_ptr, NULL, NULL)) {
+ prop = RNA_struct_find_property(&prop_ptr, umi_pr->prop_id);
+ if (prop) {
+ ok = true;
+ uiItemFullR(
+ menu->layout,
+ &prop_ptr, prop, umi_pr->prop_index,
+ 0, 0, ui_name, ICON_NONE);
+ }
+ }
+ }
+ if (!ok) {
+ char label[512];
+ SNPRINTF(label, "Missing: %s.%s", umi_pr->context_data_path, umi_pr->prop_id);
+ uiItemL(menu->layout, label, ICON_NONE);
+ }
+ }
+ else if (umi->type == USER_MENU_TYPE_SEP) {
+ uiItemS(menu->layout);
+ }
+ }
+ }
+}
+
+void ED_screen_user_menu_register(void)
+{
+ MenuType *mt = MEM_callocN(sizeof(MenuType), __func__);
+ strcpy(mt->idname, "SCREEN_MT_user_menu");
+ strcpy(mt->label, "Quick Favorites");
+ strcpy(mt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ mt->draw = screen_user_menu_draw;
+ WM_menutype_add(mt);
+}
+
+/** \} */
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index e7b075dd5d0..afaad3963d5 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -36,7 +36,6 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_math.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -44,20 +43,15 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
-#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_image.h"
#include "BKE_report.h"
-#include "BKE_writeavi.h"
#include "BIF_gl.h"
-#include "GPU_immediate.h"
-#include "GPU_immediate_util.h"
-
#include "RNA_access.h"
#include "RNA_define.h"
@@ -66,9 +60,6 @@
#include "WM_types.h"
#include "WM_api.h"
-#include "PIL_time.h"
-
-
#include "screen_intern.h"
typedef struct ScreenshotData {
@@ -278,7 +269,7 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
uiDefAutoButsRNA(layout, &ptr, screenshot_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false);
}
-static int screenshot_poll(bContext *C)
+static bool screenshot_poll(bContext *C)
{
if (G.background)
return false;
@@ -307,258 +298,3 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "full", 1, "Full Screen",
"Capture the whole window (otherwise only capture the active area)");
}
-
-/* *************** screenshot movie job ************************* */
-
-typedef struct ScreenshotJob {
- Main *bmain;
- Scene *scene;
- wmWindowManager *wm;
- unsigned int *dumprect;
- int x, y, dumpsx, dumpsy;
- const short *stop;
- const short *do_update;
- ReportList reports;
-
- bMovieHandle *movie_handle;
- void *movie_ctx;
-} ScreenshotJob;
-
-
-static void screenshot_freejob(void *sjv)
-{
- ScreenshotJob *sj = sjv;
-
- if (sj->dumprect)
- MEM_freeN(sj->dumprect);
-
- if (sj->movie_handle) {
- bMovieHandle *mh = sj->movie_handle;
- mh->end_movie(sj->movie_ctx);
- mh->context_free(sj->movie_ctx);
- }
-
- MEM_freeN(sj);
-}
-
-
-/* called before redraw notifiers, copies a new dumprect */
-static void screenshot_updatejob(void *sjv)
-{
- ScreenshotJob *sj = sjv;
- unsigned int *dumprect;
-
- if (sj->dumprect == NULL) {
- dumprect = MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
- screenshot_read_pixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, (unsigned char *)dumprect);
-
- sj->dumprect = dumprect;
- }
-}
-
-
-/* only this runs inside thread */
-static void screenshot_startjob(void *sjv, short *stop, short *do_update, float *UNUSED(progress))
-{
- ScreenshotJob *sj = sjv;
- RenderData rd = sj->scene->r;
- bMovieHandle *mh = NULL;
-
- /* we need this as local variables for renderdata */
- rd.frs_sec = U.scrcastfps;
- rd.frs_sec_base = 1.0f;
-
- if (BKE_imtype_is_movie(rd.im_format.imtype)) {
- mh = BKE_movie_handle_get(sj->scene->r.im_format.imtype);
- if (mh == NULL) {
- printf("Movie format unsupported\n");
- return;
- }
- sj->movie_ctx = mh->context_create();
- sj->movie_handle = mh;
-
- if (!mh->start_movie(sj->movie_ctx, sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports, false, "")) {
- printf("screencast job stopped\n");
- return;
- }
- }
-
- sj->stop = stop;
- sj->do_update = do_update;
-
- *do_update = true; /* wait for opengl rect */
-
- while (*stop == 0) {
-
- if (sj->dumprect) {
-
- if (mh) {
- if (mh->append_movie(sj->movie_ctx, &rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
- sj->dumpsx, sj->dumpsy, "", &sj->reports))
- {
- BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", rd.cfra);
- printf("Appended frame %d\n", rd.cfra);
- }
- else {
- break;
- }
- }
- else {
- ImBuf *ibuf = IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
- char name[FILE_MAX];
- int ok;
-
- BKE_image_path_from_imformat(
- name, rd.pic, BKE_main_blendfile_path(sj->bmain), rd.cfra,
- &rd.im_format, (rd.scemode & R_EXTENSION) != 0, true, NULL);
-
- ibuf->rect = sj->dumprect;
- ok = BKE_imbuf_write(ibuf, name, &rd.im_format);
-
- if (ok == 0) {
- printf("Write error: cannot save %s\n", name);
- BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s", name);
- break;
- }
- else {
- printf("Saved file: %s\n", name);
- BKE_reportf(&sj->reports, RPT_INFO, "Saved file: %s", name);
- }
-
- /* imbuf knows which rects are not part of ibuf */
- IMB_freeImBuf(ibuf);
- }
-
- MEM_freeN(sj->dumprect);
- sj->dumprect = NULL;
-
- *do_update = true;
-
- rd.cfra++;
-
- }
- else
- PIL_sleep_ms(U.scrcastwait);
- }
-
- if (mh) {
- mh->end_movie(sj->movie_ctx);
- mh->context_free(sj->movie_ctx);
- sj->movie_handle = NULL;
- }
-
- BKE_report(&sj->reports, RPT_INFO, "Screencast job stopped");
-}
-
-/* Helper callback for drawing the cursor itself */
-static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUSED(p_ptr))
-{
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
-
- Gwn_VertFormat *format = immVertexFormat();
- unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
-
- immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-
- immUniformColor4ub(0, 0, 0, 32);
- imm_draw_circle_fill_2d(pos, (float)x, (float)y, 20, 40);
-
- immUniformColor4ub(255, 255, 255, 128);
- imm_draw_circle_wire_2d(pos, (float)x, (float)y, 20, 40);
-
- immUnbindProgram();
-
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
-}
-
-/* Turn brush cursor in 3D view on/off */
-static void screencast_cursor_toggle(wmWindowManager *wm, short enable)
-{
- static void *cursor = NULL;
-
- if (cursor && !enable) {
- /* clear cursor */
- WM_paint_cursor_end(wm, cursor);
- cursor = NULL;
- }
- else if (enable) {
- /* enable cursor */
- cursor = WM_paint_cursor_activate(wm, NULL, screencast_draw_cursor, NULL);
- }
-}
-
-static void screenshot_endjob(void *sjv)
-{
- ScreenshotJob *sj = sjv;
-
- screencast_cursor_toggle(sj->wm, 0);
-}
-
-
-static int screencast_exec(bContext *C, wmOperator *op)
-{
- wmWindowManager *wm = CTX_wm_manager(C);
- wmWindow *win = CTX_wm_window(C);
- bScreen *screen = CTX_wm_screen(C);
- wmJob *wm_job;
- ScreenshotJob *sj;
-
- /* if called again, stop the running job */
- if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
- WM_jobs_stop(wm, screen, screenshot_startjob);
-
- wm_job = WM_jobs_get(wm, win, screen, "Screencast", 0, WM_JOB_TYPE_SCREENCAST);
- sj = MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
-
- /* setup sj */
- if (RNA_boolean_get(op->ptr, "full")) {
- sj->x = 0;
- sj->y = 0;
- sj->dumpsx = WM_window_pixels_x(win);
- sj->dumpsy = WM_window_pixels_y(win);
- }
- else {
- ScrArea *curarea = CTX_wm_area(C);
- sj->x = curarea->totrct.xmin;
- sj->y = curarea->totrct.ymin;
- sj->dumpsx = curarea->totrct.xmax - sj->x;
- sj->dumpsy = curarea->totrct.ymax - sj->y;
- }
- sj->bmain = CTX_data_main(C);
- sj->scene = CTX_data_scene(C);
- sj->wm = wm;
-
- BKE_reports_init(&sj->reports, RPT_PRINT);
-
- /* setup job */
- WM_jobs_customdata_set(wm_job, sj, screenshot_freejob);
- WM_jobs_timer(wm_job, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
- WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, screenshot_endjob);
-
- WM_jobs_start(sj->wm, wm_job);
-
- screencast_cursor_toggle(sj->wm, 1);
-
- WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);
-
- return OPERATOR_FINISHED;
-}
-
-void SCREEN_OT_screencast(wmOperatorType *ot)
-{
- ot->name = "Make Screencast";
- ot->idname = "SCREEN_OT_screencast";
- ot->description = "Capture a video of the active area or whole Blender window";
-
- ot->invoke = WM_operator_confirm;
- ot->exec = screencast_exec;
- ot->poll = screenshot_poll; /* shared poll */
-
- ot->flag = 0;
-
- RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_boolean(ot->srna, "full", 1, "Full Screen",
- "Capture the whole window (otherwise only capture the active area)");
-}
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index a044a7d377a..9d329355500 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -332,7 +332,7 @@ static void WORKSPACE_OT_workspace_delete(wmOperatorType *ot)
ot->exec = workspace_delete_exec;
}
-static int workspace_append_activate_poll(bContext *C)
+static bool workspace_append_activate_poll(bContext *C)
{
wmOperatorType *ot = WM_operatortype_find("WM_OT_append", false);
return WM_operator_poll(C, ot);
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 848d12bcfaa..815bcd8a050 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -62,6 +62,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "UI_resources.h"
@@ -257,9 +258,10 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
int size;
bool refresh;
- eOverlayControlFlags invalid = (primary) ? (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) :
- (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY);
-
+ eOverlayControlFlags invalid = (
+ (primary) ?
+ (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY) :
+ (overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY));
target = (primary) ? &primary_snap : &secondary_snap;
refresh =
@@ -493,9 +495,10 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
-static int project_brush_radius(ViewContext *vc,
- float radius,
- const float location[3])
+static int project_brush_radius(
+ ViewContext *vc,
+ float radius,
+ const float location[3])
{
float view[3], nonortho[3], ortho[3], offset[3], p1[2], p2[2];
@@ -566,10 +569,8 @@ static bool sculpt_get_brush_geometry(
if (hit) {
Brush *brush = BKE_paint_brush(paint);
- *pixel_radius =
- project_brush_radius(vc,
- BKE_brush_unprojected_radius_get(scene, brush),
- location);
+ *pixel_radius = project_brush_radius(
+ vc, BKE_brush_unprojected_radius_get(scene, brush), location);
if (*pixel_radius == 0)
*pixel_radius = BKE_brush_size_get(scene, brush);
@@ -588,15 +589,18 @@ static bool sculpt_get_brush_geometry(
/* Draw an overlay that shows what effect the brush's texture will
* have on brush strength */
-static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
- ViewContext *vc, int x, int y, float zoom, bool col, bool primary)
+static void paint_draw_tex_overlay(
+ UnifiedPaintSettings *ups, Brush *brush,
+ ViewContext *vc, int x, int y, float zoom, bool col, bool primary)
{
rctf quad;
/* check for overlay mode */
MTex *mtex = (primary) ? &brush->mtex : &brush->mask_mtex;
- bool valid = (primary) ? (brush->overlay_flags & BRUSH_OVERLAY_PRIMARY) != 0 :
- (brush->overlay_flags & BRUSH_OVERLAY_SECONDARY) != 0;
+ bool valid = (
+ (primary) ?
+ (brush->overlay_flags & BRUSH_OVERLAY_PRIMARY) != 0 :
+ (brush->overlay_flags & BRUSH_OVERLAY_SECONDARY) != 0);
int overlay_alpha = (primary) ? brush->texture_overlay_alpha : brush->mask_overlay_alpha;
if (!(mtex->tex) || !((mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) ||
@@ -607,7 +611,7 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
}
if (load_tex(brush, vc, zoom, col, primary)) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthMask(GL_FALSE);
@@ -713,8 +717,9 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
/* Draw an overlay that shows what effect the brush's texture will
* have on brush strength */
-static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
- ViewContext *vc, int x, int y, float zoom)
+static void paint_draw_cursor_overlay(
+ UnifiedPaintSettings *ups, Brush *brush,
+ ViewContext *vc, int x, int y, float zoom)
{
rctf quad;
/* check for overlay mode */
@@ -726,7 +731,7 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
if (load_tex_cursor(brush, vc, zoom)) {
bool do_pop = false;
float center[2];
- glEnable(GL_BLEND);
+ GPU_blend(true);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthMask(GL_FALSE);
@@ -795,8 +800,9 @@ static void paint_draw_cursor_overlay(UnifiedPaintSettings *ups, Brush *brush,
}
}
-static void paint_draw_alpha_overlay(UnifiedPaintSettings *ups, Brush *brush,
- ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
+static void paint_draw_alpha_overlay(
+ UnifiedPaintSettings *ups, Brush *brush,
+ ViewContext *vc, int x, int y, float zoom, ePaintMode mode)
{
/* color means that primary brush texture is colured and secondary is used for alpha/mask control */
bool col = ELEM(mode, ePaintTextureProjective, ePaintTexture2D, ePaintVertex) ? true : false;
@@ -829,7 +835,7 @@ BLI_INLINE void draw_tri_point(
{
immUniformColor4fv(selected ? sel_col : pivot_col);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
float w = width / 2.0f;
float tri[3][2] = {
@@ -845,7 +851,7 @@ BLI_INLINE void draw_tri_point(
immEnd();
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBegin(GWN_PRIM_LINE_LOOP, 3);
immVertex2fv(pos, tri[0]);
@@ -860,7 +866,7 @@ BLI_INLINE void draw_rect_point(
{
immUniformColor4fv(selected ? sel_col : handle_col);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
float w = width / 2.0f;
float minx = co[0] - w;
@@ -871,7 +877,7 @@ BLI_INLINE void draw_rect_point(
imm_draw_box_wire_2d(pos, minx, miny, maxx, maxy);
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
imm_draw_box_wire_2d(pos, minx, miny, maxx, maxy);
}
@@ -880,7 +886,7 @@ BLI_INLINE void draw_rect_point(
BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], BezTriple *bez)
{
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
immBegin(GWN_PRIM_LINE_STRIP, 3);
immVertex2fv(pos, bez->vec[0]);
@@ -888,7 +894,7 @@ BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], Bez
immVertex2fv(pos, bez->vec[2]);
immEnd();
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
if (bez->f1 || bez->f2) {
immUniformColor4fv(sel_col);
@@ -920,8 +926,8 @@ static void paint_draw_curve_cursor(Brush *brush)
PaintCurve *pc = brush->paint_curve;
PaintCurvePoint *cp = pc->points;
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
/* draw the bezier handles and the curve segment between the current and next point */
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -954,7 +960,7 @@ static void paint_draw_curve_cursor(Brush *brush)
float (*v)[2] = (float(*)[2])data;
immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1);
for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) {
immVertex2fv(pos, v[j]);
@@ -962,7 +968,7 @@ static void paint_draw_curve_cursor(Brush *brush)
immEnd();
immUniformColor4f(0.9f, 0.9f, 1.0f, 0.5f);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBegin(GWN_PRIM_LINE_STRIP, PAINT_CURVE_NUM_SEGMENTS + 1);
for (j = 0; j <= PAINT_CURVE_NUM_SEGMENTS; j++) {
immVertex2fv(pos, v[j]);
@@ -976,8 +982,8 @@ static void paint_draw_curve_cursor(Brush *brush)
draw_rect_point(pos, selec_col, handle_col, &cp->bez.vec[0][0], 8.0f, cp->bez.f1 || cp->bez.f2);
draw_rect_point(pos, selec_col, handle_col, &cp->bez.vec[2][0], 8.0f, cp->bez.f3 || cp->bez.f2);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
immUnbindProgram();
}
@@ -985,8 +991,9 @@ static void paint_draw_curve_cursor(Brush *brush)
/* Special actions taken when paint cursor goes over mesh */
/* TODO: sculpt only for now */
-static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewContext *vc,
- const float location[3])
+static void paint_cursor_on_hit(
+ UnifiedPaintSettings *ups, Brush *brush, ViewContext *vc,
+ const float location[3])
{
float unprojected_radius, projected_radius;
@@ -1003,8 +1010,8 @@ static void paint_cursor_on_hit(UnifiedPaintSettings *ups, Brush *brush, ViewCon
}
/* convert brush radius from 2D to 3D */
- unprojected_radius = paint_calc_object_space_radius(vc, location,
- projected_radius);
+ unprojected_radius = paint_calc_object_space_radius(
+ vc, location, projected_radius);
/* scale 3D brush radius by pressure */
if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush))
@@ -1107,9 +1114,9 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
}
/* make lines pretty */
- glLineWidth(1.0f);
- glEnable(GL_BLEND); /* TODO: also set blend mode? */
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_width(1.0f);
+ GPU_blend(true); /* TODO: also set blend mode? */
+ GPU_line_smooth(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1129,13 +1136,13 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
immUnbindProgram();
/* restore GL state */
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
}
/* Public API */
-void paint_cursor_start(bContext *C, int (*poll)(bContext *C))
+void paint_cursor_start(bContext *C, bool (*poll)(bContext *C))
{
Paint *p = BKE_paint_get_active_from_context(C);
@@ -1146,7 +1153,7 @@ void paint_cursor_start(bContext *C, int (*poll)(bContext *C))
BKE_paint_invalidate_overlay_all();
}
-void paint_cursor_start_explicit(Paint *p, wmWindowManager *wm, int (*poll)(bContext *C))
+void paint_cursor_start_explicit(Paint *p, wmWindowManager *wm, bool (*poll)(bContext *C))
{
if (p && !p->paint_cursor)
p->paint_cursor = WM_paint_cursor_activate(wm, poll, paint_draw_cursor, NULL);
diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c
index af0b828ae39..3213ee005cf 100644
--- a/source/blender/editors/sculpt_paint/paint_curve.c
+++ b/source/blender/editors/sculpt_paint/paint_curve.c
@@ -57,7 +57,7 @@
#define PAINT_CURVE_SELECT_THRESHOLD 40.0f
#define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = SELECT)
-int paint_curve_poll(bContext *C)
+bool paint_curve_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
Paint *p;
@@ -605,8 +605,9 @@ static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *ev
{
ARegion *ar = CTX_wm_region(C);
wmWindow *window = CTX_wm_window(C);
- float diff[2] = {event->mval[0] - psd->initial_loc[0],
- event->mval[1] - psd->initial_loc[1]};
+ float diff[2] = {
+ event->mval[0] - psd->initial_loc[0],
+ event->mval[1] - psd->initial_loc[1]};
if (psd->select == 1) {
int i;
for (i = 0; i < 3; i++)
@@ -714,7 +715,7 @@ static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const w
break;
}
default:
- ED_view3d_cursor3d_update(C, event->mval);
+ ED_view3d_cursor3d_update(C, event->mval, true, V3D_CURSOR_ORIENT_VIEW);
break;
}
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index ac5b0624d56..a0589623f92 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -46,7 +46,6 @@
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_multires.h"
@@ -72,10 +71,11 @@
#include <assert.h>
/* return true if the element should be hidden/shown */
-static bool is_effected(PartialVisArea area,
- float planes[4][4],
- const float co[3],
- const float mask)
+static bool is_effected(
+ PartialVisArea area,
+ float planes[4][4],
+ const float co[3],
+ const float mask)
{
if (area == PARTIALVIS_ALL)
return 1;
@@ -89,12 +89,13 @@ static bool is_effected(PartialVisArea area,
}
}
-static void partialvis_update_mesh(Object *ob,
- PBVH *pbvh,
- PBVHNode *node,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4])
+static void partialvis_update_mesh(
+ Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
{
Mesh *me = ob->data;
MVert *mvert;
@@ -134,12 +135,13 @@ static void partialvis_update_mesh(Object *ob,
/* Hide or show elements in multires grids with a special GridFlags
* customdata layer. */
-static void partialvis_update_grids(Object *ob,
- PBVH *pbvh,
- PBVHNode *node,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4])
+static void partialvis_update_grids(
+ Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
{
CCGElem **grids;
CCGKey key;
@@ -149,9 +151,10 @@ static void partialvis_update_grids(Object *ob,
/* get PBVH data */
- BKE_pbvh_node_get_grids(pbvh, node,
- &grid_indices, &totgrid, NULL, NULL,
- &grids);
+ BKE_pbvh_node_get_grids(
+ pbvh, node,
+ &grid_indices, &totgrid, NULL, NULL,
+ &grids);
grid_hidden = BKE_pbvh_grid_hidden(pbvh);
BKE_pbvh_get_grid_key(pbvh, &key);
@@ -166,8 +169,9 @@ static void partialvis_update_grids(Object *ob,
switch (action) {
case PARTIALVIS_HIDE:
/* create grid flags data */
- gh = grid_hidden[g] = BLI_BITMAP_NEW(key.grid_area,
- "partialvis_update_grids");
+ gh = grid_hidden[g] = BLI_BITMAP_NEW(
+ key.grid_area,
+ "partialvis_update_grids");
break;
case PARTIALVIS_SHOW:
/* entire grid is visible, nothing to show */
@@ -193,8 +197,9 @@ static void partialvis_update_grids(Object *ob,
/* skip grid element if not in the effected area */
if (is_effected(area, planes, co, mask)) {
/* set or clear the hide flag */
- BLI_BITMAP_SET(gh, y * key.grid_size + x,
- action == PARTIALVIS_HIDE);
+ BLI_BITMAP_SET(
+ gh, y * key.grid_size + x,
+ action == PARTIALVIS_HIDE);
any_changed = true;
}
@@ -223,21 +228,21 @@ static void partialvis_update_grids(Object *ob,
}
}
-static void partialvis_update_bmesh_verts(BMesh *bm,
- GSet *verts,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4],
- bool *any_changed,
- bool *any_visible)
+static void partialvis_update_bmesh_verts(
+ BMesh *bm,
+ GSet *verts,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4],
+ bool *any_changed,
+ bool *any_visible)
{
GSetIterator gs_iter;
GSET_ITER (gs_iter, verts) {
BMVert *v = BLI_gsetIterator_getKey(&gs_iter);
- float *vmask = CustomData_bmesh_get(&bm->vdata,
- v->head.data,
- CD_PAINT_MASK);
+ float *vmask = CustomData_bmesh_get(
+ &bm->vdata, v->head.data, CD_PAINT_MASK);
/* hide vertex if in the hide volume */
if (is_effected(area, planes, v->co, *vmask)) {
@@ -267,12 +272,13 @@ static void partialvis_update_bmesh_faces(GSet *faces)
}
}
-static void partialvis_update_bmesh(Object *ob,
- PBVH *pbvh,
- PBVHNode *node,
- PartialVisAction action,
- PartialVisArea area,
- float planes[4][4])
+static void partialvis_update_bmesh(
+ Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
{
BMesh *bm;
GSet *unique, *other, *faces;
@@ -285,21 +291,23 @@ static void partialvis_update_bmesh(Object *ob,
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
- partialvis_update_bmesh_verts(bm,
- unique,
- action,
- area,
- planes,
- &any_changed,
- &any_visible);
-
- partialvis_update_bmesh_verts(bm,
- other,
- action,
- area,
- planes,
- &any_changed,
- &any_visible);
+ partialvis_update_bmesh_verts(
+ bm,
+ unique,
+ action,
+ area,
+ planes,
+ &any_changed,
+ &any_visible);
+
+ partialvis_update_bmesh_verts(
+ bm,
+ other,
+ action,
+ area,
+ planes,
+ &any_changed,
+ &any_visible);
/* finally loop over node faces and tag the ones that are fully hidden */
partialvis_update_bmesh_faces(faces);
@@ -318,9 +326,10 @@ static void rect_from_props(rcti *rect, PointerRNA *ptr)
rect->ymax = RNA_int_get(ptr, "ymax");
}
-static void clip_planes_from_rect(bContext *C,
- float clip_planes[4][4],
- const rcti *rect)
+static void clip_planes_from_rect(
+ bContext *C,
+ float clip_planes[4][4],
+ const rcti *rect)
{
ViewContext vc;
BoundBox bb;
@@ -335,11 +344,12 @@ static void clip_planes_from_rect(bContext *C,
* inside the clip_planes volume. If mode is outside, get all nodes
* that lie at least partially outside the volume. If showing all, get
* all nodes. */
-static void get_pbvh_nodes(PBVH *pbvh,
- PBVHNode ***nodes,
- int *totnode,
- float clip_planes[4][4],
- PartialVisArea mode)
+static void get_pbvh_nodes(
+ PBVH *pbvh,
+ PBVHNode ***nodes,
+ int *totnode,
+ float clip_planes[4][4],
+ PartialVisArea mode)
{
BKE_pbvh_SearchCallback cb = NULL;
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 93fa3aac0d7..7f71270c52d 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -46,15 +46,16 @@
#include "IMB_imbuf_types.h"
#include "DNA_brush_types.h"
+#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "BKE_colorband.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_brush.h"
#include "BKE_main.h"
#include "BKE_material.h"
+#include "BKE_mesh.h"
#include "BKE_node.h"
#include "BKE_paint.h"
#include "BKE_undo_system.h"
@@ -81,6 +82,7 @@
#include "GPU_draw.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "BIF_gl.h"
@@ -166,8 +168,9 @@ void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short te
if (imapaintpartial.x1 != imapaintpartial.x2 &&
imapaintpartial.y1 != imapaintpartial.y2)
{
- IMB_partial_display_buffer_update_delayed(ibuf, imapaintpartial.x1, imapaintpartial.y1,
- imapaintpartial.x2, imapaintpartial.y2);
+ IMB_partial_display_buffer_update_delayed(
+ ibuf, imapaintpartial.x1, imapaintpartial.y1,
+ imapaintpartial.x2, imapaintpartial.y2);
}
if (ibuf->mipmap[0])
@@ -266,7 +269,7 @@ static Brush *image_paint_brush(bContext *C)
return BKE_paint_brush(&settings->imapaint.paint);
}
-static int image_paint_poll_ex(bContext *C, bool check_tool)
+static bool image_paint_poll_ex(bContext *C, bool check_tool)
{
Object *obact;
@@ -294,17 +297,17 @@ static int image_paint_poll_ex(bContext *C, bool check_tool)
return 0;
}
-static int image_paint_poll(bContext *C)
+static bool image_paint_poll(bContext *C)
{
return image_paint_poll_ex(C, true);
}
-static int image_paint_ignore_tool_poll(bContext *C)
+static bool image_paint_ignore_tool_poll(bContext *C)
{
return image_paint_poll_ex(C, false);
}
-static int image_paint_2d_clone_poll(bContext *C)
+static bool image_paint_2d_clone_poll(bContext *C)
{
Brush *brush = image_paint_brush(C);
@@ -337,15 +340,16 @@ typedef struct PaintOperation {
bool paint_use_opacity_masking(Brush *brush)
{
- return (brush->flag & BRUSH_AIRBRUSH) ||
- (brush->flag & BRUSH_DRAG_DOT) ||
- (brush->flag & BRUSH_ANCHORED) ||
- (brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
- (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
- (brush->imagepaint_tool == PAINT_TOOL_FILL) ||
- (brush->flag & BRUSH_USE_GRADIENT) ||
- (brush->mtex.tex && !ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)) ?
- false : true;
+ return ((brush->flag & BRUSH_AIRBRUSH) ||
+ (brush->flag & BRUSH_DRAG_DOT) ||
+ (brush->flag & BRUSH_ANCHORED) ||
+ (brush->imagepaint_tool == PAINT_TOOL_SMEAR) ||
+ (brush->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
+ (brush->imagepaint_tool == PAINT_TOOL_FILL) ||
+ (brush->flag & BRUSH_USE_GRADIENT) ||
+ (brush->mtex.tex &&
+ !ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D)) ?
+ false : true);
}
void paint_brush_color_get(
@@ -412,15 +416,15 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
PaintOperation *pop = (PaintOperation *)customdata;
if (pop) {
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glLineWidth(4.0);
+ GPU_line_width(4.0);
immUniformColor4ub(0, 0, 0, 255);
immBegin(GWN_PRIM_LINES, 2);
@@ -428,7 +432,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
immVertex2i(pos, pop->startmouse[0], pop->startmouse[1]);
immEnd();
- glLineWidth(2.0);
+ GPU_line_width(2.0);
immUniformColor4ub(255, 255, 255, 255);
immBegin(GWN_PRIM_LINES, 2);
@@ -438,8 +442,8 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
immUnbindProgram();
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
}
}
@@ -570,8 +574,9 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
paint_2d_gradient_fill(C, brush, pop->startmouse, pop->prevmouse, pop->custom_paint);
}
else {
- paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
- 1.0, 0.0, BKE_brush_size_get(scene, brush));
+ paint_proj_stroke(
+ C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
+ 1.0, 0.0, BKE_brush_size_get(scene, brush));
/* two redraws, one for GPU update, one for notification */
paint_proj_redraw(C, pop->custom_paint, false);
paint_proj_redraw(C, pop->custom_paint, true);
@@ -585,8 +590,9 @@ static void paint_stroke_done(const bContext *C, struct PaintStroke *stroke)
paint_2d_bucket_fill(C, color, brush, pop->prevmouse, pop->custom_paint);
}
else {
- paint_proj_stroke(C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
- 1.0, 0.0, BKE_brush_size_get(scene, brush));
+ paint_proj_stroke(
+ C, pop->custom_paint, pop->startmouse, pop->prevmouse, paint_stroke_flipped(stroke),
+ 1.0, 0.0, BKE_brush_size_get(scene, brush));
/* two redraws, one for GPU update, one for notification */
paint_proj_redraw(C, pop->custom_paint, false);
paint_proj_redraw(C, pop->custom_paint, true);
@@ -637,10 +643,11 @@ static int paint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
int retval;
- op->customdata = paint_stroke_new(C, op, NULL, paint_stroke_test_start,
- paint_stroke_update_step,
- paint_stroke_redraw,
- paint_stroke_done, event->type);
+ op->customdata = paint_stroke_new(
+ C, op, NULL, paint_stroke_test_start,
+ paint_stroke_update_step,
+ paint_stroke_redraw,
+ paint_stroke_done, event->type);
if ((retval = op->type->modal(C, op, event)) == OPERATOR_FINISHED) {
paint_stroke_data_free(op);
@@ -668,10 +675,11 @@ static int paint_exec(bContext *C, wmOperator *op)
RNA_float_get_array(&firstpoint, "mouse", mouse);
- op->customdata = paint_stroke_new(C, op, NULL, paint_stroke_test_start,
- paint_stroke_update_step,
- paint_stroke_redraw,
- paint_stroke_done, 0);
+ op->customdata = paint_stroke_new(
+ C, op, NULL, paint_stroke_test_start,
+ paint_stroke_update_step,
+ paint_stroke_redraw,
+ paint_stroke_done, 0);
/* frees op->customdata */
return paint_stroke_exec(C, op);
}
@@ -880,12 +888,13 @@ static void sample_color_update_header(SampleColorData *data, bContext *C)
ScrArea *sa = CTX_wm_area(C);
if (sa) {
- BLI_snprintf(msg, sizeof(msg),
- IFACE_("Sample color for %s"),
- !data->sample_palette ?
- IFACE_("Brush. Use Left Click to sample for palette instead") :
- IFACE_("Palette. Use Left Click to sample more colors"));
- ED_area_headerprint(sa, msg);
+ BLI_snprintf(
+ msg, sizeof(msg),
+ IFACE_("Sample color for %s"),
+ !data->sample_palette ?
+ IFACE_("Brush. Use Left Click to sample for palette instead") :
+ IFACE_("Palette. Use Left Click to sample more colors"));
+ ED_workspace_status_text(C, msg);
}
}
@@ -964,8 +973,6 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
Brush *brush = BKE_paint_brush(paint);
if ((event->type == data->event_type) && (event->val == KM_RELEASE)) {
- ScrArea *sa = CTX_wm_area(C);
-
if (data->show_cursor) {
paint->flags |= PAINT_SHOW_BRUSH;
}
@@ -976,7 +983,7 @@ static int sample_color_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
WM_cursor_modal_restore(CTX_wm_window(C));
MEM_freeN(data);
- ED_area_headerprint(sa, NULL);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_FINISHED;
}
@@ -1039,7 +1046,7 @@ void PAINT_OT_sample_color(wmOperatorType *ot)
/******************** texture paint toggle operator ********************/
-static int texture_paint_toggle_poll(bContext *C)
+static bool texture_paint_toggle_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
if (ob == NULL || ob->type != OB_MESH)
@@ -1055,6 +1062,7 @@ static int texture_paint_toggle_poll(bContext *C)
static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
{
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
const int mode_flag = OB_MODE_TEXTURE_PAINT;
@@ -1070,14 +1078,13 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
ob->mode &= ~mode_flag;
if (U.glreslimit != 0)
- GPU_free_images();
- GPU_paint_set_mipmap(1);
+ GPU_free_images(bmain);
+ GPU_paint_set_mipmap(bmain, 1);
toggle_paint_cursor(C, 0);
}
else {
bScreen *sc;
- Main *bmain = CTX_data_main(C);
Image *ima = NULL;
ImagePaintSettings *imapaint = &scene->toolsettings->imapaint;
@@ -1122,12 +1129,16 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
BKE_paint_init(bmain, scene, ePaintTextureProjective, PAINT_CURSOR_TEXTURE_PAINT);
if (U.glreslimit != 0)
- GPU_free_images();
- GPU_paint_set_mipmap(0);
+ GPU_free_images(bmain);
+ GPU_paint_set_mipmap(bmain, 0);
toggle_paint_cursor(C, 1);
}
+ Mesh *me = BKE_mesh_from_object(ob);
+ BLI_assert(me != NULL);
+ DEG_id_tag_update(&me->id, DEG_TAG_COPY_ON_WRITE);
+
WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
WM_msg_publish_rna_prop(mbus, &ob->id, ob, Object, mode);
@@ -1181,7 +1192,7 @@ static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int brush_colors_flip_poll(bContext *C)
+static bool brush_colors_flip_poll(bContext *C)
{
if (image_paint_poll(C)) {
Brush *br = image_paint_brush(C);
@@ -1231,7 +1242,7 @@ void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op)
}
-static int texture_paint_poll(bContext *C)
+static bool texture_paint_poll(bContext *C)
{
if (texture_paint_toggle_poll(C))
if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT)
@@ -1240,23 +1251,22 @@ static int texture_paint_poll(bContext *C)
return 0;
}
-int image_texture_paint_poll(bContext *C)
+bool image_texture_paint_poll(bContext *C)
{
return (texture_paint_poll(C) || image_paint_poll(C));
}
-int facemask_paint_poll(bContext *C)
+bool facemask_paint_poll(bContext *C)
{
return BKE_paint_select_face_test(CTX_data_active_object(C));
}
-int vert_paint_poll(bContext *C)
+bool vert_paint_poll(bContext *C)
{
return BKE_paint_select_vert_test(CTX_data_active_object(C));
}
-int mask_paint_poll(bContext *C)
+bool mask_paint_poll(bContext *C)
{
return BKE_paint_select_elem_test(CTX_data_active_object(C));
}
-
diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c
index a75d6344849..da08766b322 100644
--- a/source/blender/editors/sculpt_paint/paint_image_2d.c
+++ b/source/blender/editors/sculpt_paint/paint_image_2d.c
@@ -442,8 +442,9 @@ static ImBuf *brush_painter_imbuf_new(BrushPainter *painter, int size, float pre
}
/* update rectangular section of the brush image */
-static void brush_painter_imbuf_update(BrushPainter *painter, ImBuf *oldtexibuf,
- int origx, int origy, int w, int h, int xt, int yt)
+static void brush_painter_imbuf_update(
+ BrushPainter *painter, ImBuf *oldtexibuf,
+ int origx, int origy, int w, int h, int xt, int yt)
{
Scene *scene = painter->scene;
Brush *brush = painter->brush;
@@ -660,11 +661,12 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
bool do_random = false;
bool do_partial_update = false;
- bool update_color = (brush->flag & BRUSH_USE_GRADIENT) &&
- ((ELEM(brush->gradient_stroke_mode,
- BRUSH_GRADIENT_SPACING_REPEAT,
- BRUSH_GRADIENT_SPACING_CLAMP)) ||
- (cache->last_pressure != pressure));
+ bool update_color = (
+ (brush->flag & BRUSH_USE_GRADIENT) &&
+ ((ELEM(brush->gradient_stroke_mode,
+ BRUSH_GRADIENT_SPACING_REPEAT,
+ BRUSH_GRADIENT_SPACING_CLAMP)) ||
+ (cache->last_pressure != pressure)));
float tex_rotation = -brush->mtex.rot;
float mask_rotation = -brush->mask_mtex.rot;
@@ -680,8 +682,9 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
else if (!((brush->flag & BRUSH_ANCHORED) || update_color))
do_partial_update = true;
- brush_painter_2d_tex_mapping(s, diameter, painter->startpaintpos, pos, mouse,
- brush->mtex.brush_map_mode, &painter->tex_mapping);
+ brush_painter_2d_tex_mapping(
+ s, diameter, painter->startpaintpos, pos, mouse,
+ brush->mtex.brush_map_mode, &painter->tex_mapping);
}
if (painter->cache.is_maskbrush) {
@@ -713,8 +716,9 @@ static void brush_painter_2d_refresh_cache(ImagePaintState *s, BrushPainter *pai
cache->tex_mask = NULL;
}
- brush_painter_2d_tex_mapping(s, diameter, painter->startpaintpos, pos, mouse,
- brush->mask_mtex.brush_map_mode, &painter->mask_mapping);
+ brush_painter_2d_tex_mapping(
+ s, diameter, painter->startpaintpos, pos, mouse,
+ brush->mask_mtex.brush_map_mode, &painter->mask_mapping);
if (do_partial_update_mask)
brush_painter_mask_imbuf_partial_update(painter, pos, diameter);
@@ -862,8 +866,9 @@ static void paint_2d_lift_soften(ImagePaintState *s, ImBuf *ibuf, ImBuf *ibufb,
out_off[0] = out_off[1] = 0;
if (!tile) {
- IMB_rectclip(ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0],
- &out_off[1], &dim[0], &dim[1]);
+ IMB_rectclip(
+ ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0],
+ &out_off[1], &dim[0], &dim[1]);
if ((dim[0] == 0) || (dim[1] == 0))
return;
@@ -894,9 +899,10 @@ static void paint_2d_lift_soften(ImagePaintState *s, ImBuf *ibuf, ImBuf *ibufb,
for (yk = 0; yk < kernel->side; yk++) {
for (xk = 0; xk < kernel->side; xk++) {
- count += paint_2d_ibuf_add_if(ibuf, xi + xk - kernel->pixel_len,
- yi + yk - kernel->pixel_len, outrgb, tile,
- kernel->wdata[xk + yk * kernel->side]);
+ count += paint_2d_ibuf_add_if(
+ ibuf, xi + xk - kernel->pixel_len,
+ yi + yk - kernel->pixel_len, outrgb, tile,
+ kernel->wdata[xk + yk * kernel->side]);
}
}
@@ -995,10 +1001,11 @@ static void paint_2d_lift_smear(ImBuf *ibuf, ImBuf *ibufb, int *pos, short tile)
tot = paint_2d_torus_split_region(region, ibufb, ibuf, tile);
for (a = 0; a < tot; a++)
- IMB_rectblend(ibufb, ibufb, ibuf, NULL, NULL, NULL, 0, region[a].destx, region[a].desty,
- region[a].destx, region[a].desty,
- region[a].srcx, region[a].srcy,
- region[a].width, region[a].height, IMB_BLEND_COPY, false);
+ IMB_rectblend(
+ ibufb, ibufb, ibuf, NULL, NULL, NULL, 0, region[a].destx, region[a].desty,
+ region[a].destx, region[a].desty,
+ region[a].srcx, region[a].srcy,
+ region[a].width, region[a].height, IMB_BLEND_COPY, false);
}
static ImBuf *paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
@@ -1009,10 +1016,12 @@ static ImBuf *paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
ImBuf *clonebuf = IMB_allocImBuf(w, h, ibufb->planes, ibufb->flags);
IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h);
- IMB_rectblend(clonebuf, clonebuf, ibufb, NULL, NULL, NULL, 0, destx, desty, destx, desty, destx, desty, w, h,
- IMB_BLEND_COPY_ALPHA, false);
- IMB_rectblend(clonebuf, clonebuf, ibuf, NULL, NULL, NULL, 0, destx, desty, destx, desty, srcx, srcy, w, h,
- IMB_BLEND_COPY_RGB, false);
+ IMB_rectblend(
+ clonebuf, clonebuf, ibufb, NULL, NULL, NULL, 0, destx, desty, destx, desty, destx, desty, w, h,
+ IMB_BLEND_COPY_ALPHA, false);
+ IMB_rectblend(
+ clonebuf, clonebuf, ibuf, NULL, NULL, NULL, 0, destx, desty, destx, desty, srcx, srcy, w, h,
+ IMB_BLEND_COPY_RGB, false);
return clonebuf;
}
@@ -1023,15 +1032,16 @@ static void paint_2d_convert_brushco(ImBuf *ibufb, const float pos[2], int ipos[
ipos[1] = (int)floorf((pos[1] - ibufb->y / 2));
}
-static void paint_2d_do_making_brush(ImagePaintState *s,
- ImagePaintRegion *region,
- unsigned short *curveb,
- unsigned short *texmaskb,
- ImBuf *frombuf,
- float mask_max,
- short blend,
- int tilex, int tiley,
- int tilew, int tileh)
+static void paint_2d_do_making_brush(
+ ImagePaintState *s,
+ ImagePaintRegion *region,
+ unsigned short *curveb,
+ unsigned short *texmaskb,
+ ImBuf *frombuf,
+ float mask_max,
+ short blend,
+ int tilex, int tiley,
+ int tilew, int tileh)
{
ImBuf tmpbuf;
IMB_initImBuf(&tmpbuf, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, 0);
@@ -1050,13 +1060,14 @@ static void paint_2d_do_making_brush(ImagePaintState *s,
else
tmpbuf.rect = image_undo_find_tile(undo_tiles, s->image, s->canvas, tx, ty, &mask, false);
- IMB_rectblend(s->canvas, &tmpbuf, frombuf, mask,
- curveb, texmaskb, mask_max,
- region->destx, region->desty,
- origx, origy,
- region->srcx, region->srcy,
- region->width, region->height,
- blend, ((s->brush->flag & BRUSH_ACCUMULATE) != 0));
+ IMB_rectblend(
+ s->canvas, &tmpbuf, frombuf, mask,
+ curveb, texmaskb, mask_max,
+ region->destx, region->desty,
+ origx, origy,
+ region->srcx, region->srcy,
+ region->width, region->height,
+ blend, ((s->brush->flag & BRUSH_ACCUMULATE) != 0));
}
}
}
@@ -1079,11 +1090,12 @@ static void paint_2d_op_foreach_do(
const ParallelRangeTLS *__restrict UNUSED(tls))
{
Paint2DForeachData *data = (Paint2DForeachData *)data_v;
- paint_2d_do_making_brush(data->s, data->region, data->curveb,
- data->texmaskb, data->frombuf, data->mask_max,
- data->blend,
- data->tilex, iter,
- data->tilew, iter);
+ paint_2d_do_making_brush(
+ data->s, data->region, data->curveb,
+ data->texmaskb, data->frombuf, data->mask_max,
+ data->blend,
+ data->tilex, iter,
+ data->tilew, iter);
}
static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsigned short *texmaskb, const float lastpos[2], const float pos[2])
@@ -1135,21 +1147,24 @@ static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsign
/* blend into canvas */
for (a = 0; a < tot; a++) {
- ED_imapaint_dirty_region(s->image, s->canvas,
- region[a].destx, region[a].desty,
- region[a].width, region[a].height, true);
+ ED_imapaint_dirty_region(
+ s->image, s->canvas,
+ region[a].destx, region[a].desty,
+ region[a].width, region[a].height, true);
if (s->do_masking) {
/* masking, find original pixels tiles from undo buffer to composite over */
int tilex, tiley, tilew, tileh;
- imapaint_region_tiles(s->canvas, region[a].destx, region[a].desty,
- region[a].width, region[a].height,
- &tilex, &tiley, &tilew, &tileh);
+ imapaint_region_tiles(
+ s->canvas, region[a].destx, region[a].desty,
+ region[a].width, region[a].height,
+ &tilex, &tiley, &tilew, &tileh);
if (tiley == tileh) {
- paint_2d_do_making_brush(s, &region[a], curveb, texmaskb, frombuf,
- mask_max, blend, tilex, tiley, tilew, tileh);
+ paint_2d_do_making_brush(
+ s, &region[a], curveb, texmaskb, frombuf,
+ mask_max, blend, tilex, tiley, tilew, tileh);
}
else {
Paint2DForeachData data;
@@ -1165,19 +1180,21 @@ static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsign
ParallelRangeSettings settings;
BLI_parallel_range_settings_defaults(&settings);
- BLI_task_parallel_range(tiley, tileh + 1, &data,
- paint_2d_op_foreach_do,
- &settings);
+ BLI_task_parallel_range(
+ tiley, tileh + 1, &data,
+ paint_2d_op_foreach_do,
+ &settings);
}
}
else {
/* no masking, composite brush directly onto canvas */
- IMB_rectblend_threaded(s->canvas, s->canvas, frombuf, NULL, curveb, texmaskb, mask_max,
- region[a].destx, region[a].desty,
- region[a].destx, region[a].desty,
- region[a].srcx, region[a].srcy,
- region[a].width, region[a].height, blend, false);
+ IMB_rectblend_threaded(
+ s->canvas, s->canvas, frombuf, NULL, curveb, texmaskb, mask_max,
+ region[a].destx, region[a].desty,
+ region[a].destx, region[a].desty,
+ region[a].srcx, region[a].srcy,
+ region[a].width, region[a].height, blend, false);
}
}
@@ -1478,16 +1495,18 @@ void paint_2d_bucket_fill(
if (do_float) {
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
- blend_color_mix_float(ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
- ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px), color_f);
+ blend_color_mix_float(
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px), color_f);
}
}
}
else {
for (x_px = 0; x_px < ibuf->x; x_px++) {
for (y_px = 0; y_px < ibuf->y; y_px++) {
- blend_color_mix_byte((unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
- (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), (unsigned char *)&color_b);
+ blend_color_mix_byte(
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), (unsigned char *)&color_b);
}
}
}
@@ -1538,9 +1557,10 @@ void paint_2d_bucket_fill(
while (!BLI_stack_is_empty(stack)) {
BLI_stack_pop(stack, &coordinate);
- IMB_blend_color_float(ibuf->rect_float + 4 * (coordinate),
- ibuf->rect_float + 4 * (coordinate),
- color_f, br->blend);
+ IMB_blend_color_float(
+ ibuf->rect_float + 4 * (coordinate),
+ ibuf->rect_float + 4 * (coordinate),
+ color_f, br->blend);
/* reconstruct the coordinates here */
x_px = coordinate % width;
@@ -1569,9 +1589,10 @@ void paint_2d_bucket_fill(
while (!BLI_stack_is_empty(stack)) {
BLI_stack_pop(stack, &coordinate);
- IMB_blend_color_byte((unsigned char *)(ibuf->rect + coordinate),
- (unsigned char *)(ibuf->rect + coordinate),
- (unsigned char *)&color_b, br->blend);
+ IMB_blend_color_byte(
+ (unsigned char *)(ibuf->rect + coordinate),
+ (unsigned char *)(ibuf->rect + coordinate),
+ (unsigned char *)&color_b, br->blend);
/* reconstruct the coordinates here */
x_px = coordinate % width;
@@ -1679,9 +1700,10 @@ void paint_2d_gradient_fill(
/* convert to premultiplied */
mul_v3_fl(color_f, color_f[3]);
color_f[3] *= br->alpha;
- IMB_blend_color_float(ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
- ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
- color_f, br->blend);
+ IMB_blend_color_float(
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
+ ibuf->rect_float + 4 * (((size_t)y_px) * ibuf->x + x_px),
+ color_f, br->blend);
}
}
}
@@ -1709,9 +1731,10 @@ void paint_2d_gradient_fill(
linearrgb_to_srgb_v3_v3(color_f, color_f);
rgba_float_to_uchar((unsigned char *)&color_b, color_f);
((unsigned char *)&color_b)[3] *= br->alpha;
- IMB_blend_color_byte((unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
- (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
- (unsigned char *)&color_b, br->blend);
+ IMB_blend_color_byte(
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
+ (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px),
+ (unsigned char *)&color_b, br->blend);
}
}
}
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 62bc379241f..04329697b54 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -58,6 +58,7 @@
#include "DNA_brush_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
@@ -65,7 +66,6 @@
#include "BKE_colorband.h"
#include "BKE_context.h"
#include "BKE_colortools.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_idprop.h"
#include "BKE_brush.h"
#include "BKE_image.h"
@@ -2604,8 +2604,9 @@ static void project_paint_face_init(
if (pixel_bounds_array(uv_clip, &bounds_px, ibuf->x, ibuf->y, uv_clip_tot)) {
#if 0
- project_paint_undo_tiles_init(&bounds_px, ps->projImages + image_index, tmpibuf,
- tile_width, threaded, ps->do_masking);
+ project_paint_undo_tiles_init(
+ &bounds_px, ps->projImages + image_index, tmpibuf,
+ tile_width, threaded, ps->do_masking);
#endif
/* clip face and */
@@ -2654,10 +2655,10 @@ static void project_paint_face_init(
if (mask > 0.0f) {
BLI_linklist_prepend_arena(
bucketPixelNodes,
- project_paint_uvpixel_init(ps, arena, &tinf, x, y, mask, tri_index,
- pixelScreenCo, wco, w),
- arena
- );
+ project_paint_uvpixel_init(
+ ps, arena, &tinf, x, y, mask, tri_index,
+ pixelScreenCo, wco, w),
+ arena);
}
}
@@ -4187,8 +4188,9 @@ static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, fl
* accumulation of color greater than 'projPixel->mask' however in the case of smear its not
* really that important to be correct as it is with clone and painting
*/
-static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *smearArena, LinkNode **smearPixels, const float co[2])
+static void do_projectpaint_smear(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *smearArena, LinkNode **smearPixels, const float co[2])
{
unsigned char rgba_ub[4];
@@ -4199,8 +4201,9 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa
BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena);
}
-static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *smearArena, LinkNode **smearPixels_f, const float co[2])
+static void do_projectpaint_smear_f(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *smearArena, LinkNode **smearPixels_f, const float co[2])
{
float rgba[4];
@@ -4211,8 +4214,9 @@ static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, fl
BLI_linklist_prepend_arena(smearPixels_f, (void *)projPixel, smearArena);
}
-static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *softenArena, LinkNode **softenPixels)
+static void do_projectpaint_soften_f(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *softenArena, LinkNode **softenPixels)
{
float accum_tot = 0.0f;
int xk, yk;
@@ -4267,8 +4271,9 @@ static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, f
}
}
-static void do_projectpaint_soften(ProjPaintState *ps, ProjPixel *projPixel, float mask,
- MemArena *softenArena, LinkNode **softenPixels)
+static void do_projectpaint_soften(
+ ProjPaintState *ps, ProjPixel *projPixel, float mask,
+ MemArena *softenArena, LinkNode **softenPixels)
{
float accum_tot = 0;
int xk, yk;
@@ -4549,8 +4554,9 @@ static void *do_projectpaint_thread(void *ph_v)
if (is_floatbuf) {
/* convert to premultipied */
mul_v3_fl(color_f, color_f[3]);
- IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->origColor.f_pt,
- color_f, ps->blend);
+ IMB_blend_color_float(
+ projPixel->pixel.f_pt, projPixel->origColor.f_pt,
+ color_f, ps->blend);
}
else {
linearrgb_to_srgb_v3_v3(color_f, color_f);
@@ -4562,8 +4568,9 @@ static void *do_projectpaint_thread(void *ph_v)
unit_float_to_uchar_clamp_v3(projPixel->newColor.ch, color_f);
}
projPixel->newColor.ch[3] = unit_float_to_uchar_clamp(color_f[3]);
- IMB_blend_color_byte(projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
- projPixel->newColor.ch, ps->blend);
+ IMB_blend_color_byte(
+ projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
+ projPixel->newColor.ch, ps->blend);
}
}
else {
@@ -4572,16 +4579,18 @@ static void *do_projectpaint_thread(void *ph_v)
newColor_f[3] = ((float)projPixel->mask) * (1.0f / 65535.0f) * brush->alpha;
copy_v3_v3(newColor_f, ps->paint_color_linear);
- IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->origColor.f_pt,
- newColor_f, ps->blend);
+ IMB_blend_color_float(
+ projPixel->pixel.f_pt, projPixel->origColor.f_pt,
+ newColor_f, ps->blend);
}
else {
float mask = ((float)projPixel->mask) * (1.0f / 65535.0f);
projPixel->newColor.ch[3] = mask * 255 * brush->alpha;
rgb_float_to_uchar(projPixel->newColor.ch, ps->paint_color);
- IMB_blend_color_byte(projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
- projPixel->newColor.ch, ps->blend);
+ IMB_blend_color_byte(
+ projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
+ projPixel->newColor.ch, ps->blend);
}
}
@@ -4609,15 +4618,17 @@ static void *do_projectpaint_thread(void *ph_v)
ps->reproject_ibuf_free_float = true;
}
- bicubic_interpolation_color(ps->reproject_ibuf, NULL, projPixel->newColor.f,
- projPixel->projCoSS[0], projPixel->projCoSS[1]);
+ bicubic_interpolation_color(
+ ps->reproject_ibuf, NULL, projPixel->newColor.f,
+ projPixel->projCoSS[0], projPixel->projCoSS[1]);
if (projPixel->newColor.f[3]) {
float mask = ((float)projPixel->mask) * (1.0f / 65535.0f);
mul_v4_v4fl(projPixel->newColor.f, projPixel->newColor.f, mask);
- blend_color_mix_float(projPixel->pixel.f_pt, projPixel->origColor.f_pt,
- projPixel->newColor.f);
+ blend_color_mix_float(
+ projPixel->pixel.f_pt, projPixel->origColor.f_pt,
+ projPixel->newColor.f);
}
}
else {
@@ -4626,14 +4637,16 @@ static void *do_projectpaint_thread(void *ph_v)
ps->reproject_ibuf_free_uchar = true;
}
- bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL,
- projPixel->projCoSS[0], projPixel->projCoSS[1]);
+ bicubic_interpolation_color(
+ ps->reproject_ibuf, projPixel->newColor.ch, NULL,
+ projPixel->projCoSS[0], projPixel->projCoSS[1]);
if (projPixel->newColor.ch[3]) {
float mask = ((float)projPixel->mask) * (1.0f / 65535.0f);
projPixel->newColor.ch[3] *= mask;
- blend_color_mix_byte(projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
- projPixel->newColor.ch);
+ blend_color_mix_byte(
+ projPixel->pixel.ch_pt, projPixel->origColor.ch_pt,
+ projPixel->newColor.ch);
}
}
}
@@ -5495,12 +5508,13 @@ void PAINT_OT_image_from_view(wmOperatorType *ot)
void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil)
{
- BKE_reportf(reports, RPT_WARNING, "Missing%s%s%s%s detected!",
- !uvs ? " UVs," : "",
- !mat ? " Materials," : "",
- !tex ? " Textures," : "",
- !stencil ? " Stencil," : ""
- );
+ BKE_reportf(
+ reports, RPT_WARNING, "Missing%s%s%s%s detected!",
+ !uvs ? " UVs," : "",
+ !mat ? " Materials," : "",
+ !tex ? " Textures," : "",
+ !stencil ? " Stencil," : ""
+ );
}
/* Make sure that active object has a material, and assign UVs and image layers if they do not exist */
@@ -5628,8 +5642,9 @@ static Image *proj_paint_image_create(wmOperator *op, Main *bmain)
alpha = RNA_boolean_get(op->ptr, "alpha");
RNA_string_get(op->ptr, "name", imagename);
}
- ima = BKE_image_add_generated(bmain, width, height, imagename, alpha ? 32 : 24, use_float,
- gen_type, color, false);
+ ima = BKE_image_add_generated(
+ bmain, width, height, imagename, alpha ? 32 : 24, use_float,
+ gen_type, color, false);
return ima;
}
@@ -5803,7 +5818,7 @@ static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int add_simple_uvs_poll(bContext *C)
+static bool add_simple_uvs_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -5827,4 +5842,3 @@ void PAINT_OT_add_simple_uvs(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sculpt_paint/paint_image_undo.c
index ade775d14e6..e26a4811afc 100644
--- a/source/blender/editors/sculpt_paint/paint_image_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_image_undo.c
@@ -105,8 +105,9 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, Cop
{
if (mode == COPY) {
/* copy or swap contents of tile->rect and region in ibuf->rect */
- IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
- tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+ IMB_rectcpy(
+ tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
+ tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (ibuf->rect_float) {
SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
@@ -117,8 +118,9 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, Cop
}
else {
if (mode == RESTORE_COPY) {
- IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
- tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+ IMB_rectcpy(
+ tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
+ tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
}
/* swap to the tmpbuf for easy copying */
if (ibuf->rect_float) {
@@ -128,8 +130,9 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, Cop
SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
}
- IMB_rectcpy(ibuf, tmpibuf, tile->x * IMAPAINT_TILE_SIZE,
- tile->y * IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+ IMB_rectcpy(
+ ibuf, tmpibuf, tile->x * IMAPAINT_TILE_SIZE,
+ tile->y * IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
if (mode == RESTORE) {
if (ibuf->rect_float) {
@@ -156,8 +159,9 @@ void *image_undo_find_tile(
if (mask) {
/* allocate mask if requested */
if (!tile->mask) {
- tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
- "UndoImageTile.mask");
+ tile->mask = MEM_callocN(
+ sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
+ "UndoImageTile.mask");
}
*mask = tile->mask;
@@ -204,8 +208,9 @@ void *image_undo_push_tile(
/* add mask explicitly here */
if (mask) {
- *mask = tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
- "UndoImageTile.mask");
+ *mask = tile->mask = MEM_callocN(
+ sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE,
+ "UndoImageTile.mask");
}
allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
@@ -253,8 +258,9 @@ static void image_undo_restore_runtime(ListBase *lb)
ImBuf *ibuf, *tmpibuf;
UndoImageTile *tile;
- tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
- IB_rectfloat | IB_rect);
+ tmpibuf = IMB_allocImBuf(
+ IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
+ IB_rectfloat | IB_rect);
for (tile = lb->first; tile; tile = tile->next) {
Image *ima = tile->ima;
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 8d94978f5c6..7d3049434d6 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -65,10 +65,11 @@ typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke,
typedef void (*StrokeRedraw)(const struct bContext *C, struct PaintStroke *stroke, bool final);
typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke);
-struct PaintStroke *paint_stroke_new(struct bContext *C, struct wmOperator *op,
- StrokeGetLocation get_location, StrokeTestStart test_start,
- StrokeUpdateStep update_step, StrokeRedraw redraw,
- StrokeDone done, int event_type);
+struct PaintStroke *paint_stroke_new(
+ struct bContext *C, struct wmOperator *op,
+ StrokeGetLocation get_location, StrokeTestStart test_start,
+ StrokeUpdateStep update_step, StrokeRedraw redraw,
+ StrokeDone done, int event_type);
void paint_stroke_data_free(struct wmOperator *op);
bool paint_space_stroke_enabled(struct Brush *br, enum ePaintMode mode);
@@ -87,18 +88,18 @@ struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke);
void *paint_stroke_mode_data(struct PaintStroke *stroke);
float paint_stroke_distance_get(struct PaintStroke *stroke);
void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data);
-int paint_poll(struct bContext *C);
-void paint_cursor_start(struct bContext *C, int (*poll)(struct bContext *C));
-void paint_cursor_start_explicit(struct Paint *p, struct wmWindowManager *wm, int (*poll)(struct bContext *C));
+bool paint_poll(struct bContext *C);
+void paint_cursor_start(struct bContext *C, bool (*poll)(struct bContext *C));
+void paint_cursor_start_explicit(struct Paint *p, struct wmWindowManager *wm, bool (*poll)(struct bContext *C));
void paint_cursor_delete_textures(void);
/* paint_vertex.c */
-int weight_paint_poll(struct bContext *C);
-int weight_paint_poll_ignore_tool(bContext *C);
-int weight_paint_mode_poll(struct bContext *C);
-int vertex_paint_poll(struct bContext *C);
-int vertex_paint_poll_ignore_tool(struct bContext *C);
-int vertex_paint_mode_poll(struct bContext *C);
+bool weight_paint_poll(struct bContext *C);
+bool weight_paint_poll_ignore_tool(bContext *C);
+bool weight_paint_mode_poll(struct bContext *C);
+bool vertex_paint_poll(struct bContext *C);
+bool vertex_paint_poll_ignore_tool(struct bContext *C);
+bool vertex_paint_mode_poll(struct bContext *C);
typedef void (*VPaintTransform_Callback)(const float col[3], const void *user_data, float r_col[3]);
@@ -179,7 +180,7 @@ typedef struct ImagePaintPartialRedraw {
#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
#define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
-int image_texture_paint_poll(struct bContext *C);
+bool image_texture_paint_poll(struct bContext *C);
void imapaint_image_update(struct SpaceImage *sima, struct Image *image, struct ImBuf *ibuf, short texpaint);
struct ImagePaintPartialRedraw *get_imapaintpartial(void);
void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr);
@@ -238,8 +239,8 @@ struct ListBase *ED_image_undosys_step_get_tiles(struct UndoStep *us_p);
struct ListBase *ED_image_undo_get_tiles(void);
/* sculpt_uv.c */
-int uv_sculpt_poll(struct bContext *C);
-int uv_sculpt_keymap_poll(struct bContext *C);
+bool uv_sculpt_poll(struct bContext *C);
+bool uv_sculpt_keymap_poll(struct bContext *C);
void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
@@ -248,24 +249,28 @@ void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
/* Convert the object-space axis-aligned bounding box (expressed as
* its minimum and maximum corners) into a screen-space rectangle,
* returns zero if the result is empty */
-bool paint_convert_bb_to_rect(struct rcti *rect,
- const float bb_min[3],
- const float bb_max[3],
- const struct ARegion *ar,
- struct RegionView3D *rv3d,
- struct Object *ob);
+bool paint_convert_bb_to_rect(
+ struct rcti *rect,
+ const float bb_min[3],
+ const float bb_max[3],
+ const struct ARegion *ar,
+ struct RegionView3D *rv3d,
+ struct Object *ob);
/* Get four planes in object-space that describe the projection of
* screen_rect from screen into object-space (essentially converting a
* 2D screens-space bounding box into four 3D planes) */
-void paint_calc_redraw_planes(float planes[4][4],
- const struct ARegion *ar,
- struct Object *ob,
- const struct rcti *screen_rect);
+void paint_calc_redraw_planes(
+ float planes[4][4],
+ const struct ARegion *ar,
+ struct Object *ob,
+ const struct rcti *screen_rect);
float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
float paint_get_tex_pixel(const struct MTex *mtex, float u, float v, struct ImagePool *pool, int thread);
-void paint_get_tex_pixel_col(const struct MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert, struct ColorSpace *colorspace);
+void paint_get_tex_pixel_col(
+ const struct MTex *mtex, float u, float v, float rgba[4],
+ struct ImagePool *pool, int thread, bool convert, struct ColorSpace *colorspace);
void paint_sample_color(struct bContext *C, struct ARegion *ar, int x, int y, bool texpaint_proj, bool palette);
@@ -282,11 +287,11 @@ void PAINT_OT_face_select_reveal(struct wmOperatorType *ot);
void PAINT_OT_vert_select_all(struct wmOperatorType *ot);
void PAINT_OT_vert_select_ungrouped(struct wmOperatorType *ot);
-int vert_paint_poll(struct bContext *C);
-int mask_paint_poll(struct bContext *C);
-int paint_curve_poll(struct bContext *C);
+bool vert_paint_poll(struct bContext *C);
+bool mask_paint_poll(struct bContext *C);
+bool paint_curve_poll(struct bContext *C);
-int facemask_paint_poll(struct bContext *C);
+bool facemask_paint_poll(struct bContext *C);
void flip_v3_v3(float out[3], const float in[3], const char symm);
void flip_qt_qt(float out[3], const float in[3], const char symm);
@@ -307,8 +312,9 @@ typedef enum {
RC_COLOR_OVERRIDE = 32,
} RCFlags;
-void set_brush_rc_props(struct PointerRNA *ptr, const char *paint, const char *prop, const char *secondary_prop,
- RCFlags flags);
+void set_brush_rc_props(
+ struct PointerRNA *ptr, const char *paint, const char *prop, const char *secondary_prop,
+ RCFlags flags);
/* paint_hide.c */
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index f22e6f514e6..aed48aef3a9 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -45,7 +45,6 @@
#include "BKE_pbvh.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_subsurf.h"
@@ -76,9 +75,10 @@ static const EnumPropertyItem mode_items[] = {
{0}};
-static void mask_flood_fill_set_elem(float *elem,
- PaintMaskFloodMode mode,
- float value)
+static void mask_flood_fill_set_elem(
+ float *elem,
+ PaintMaskFloodMode mode,
+ float value)
{
switch (mode) {
case PAINT_MASK_FLOOD_VALUE:
@@ -163,8 +163,9 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
BLI_parallel_range_settings_defaults(&settings);
settings.use_threading = ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT);
BLI_task_parallel_range(
- 0, totnode, &data, mask_flood_fill_task_cb,
- &settings);
+
+ 0, totnode, &data, mask_flood_fill_task_cb,
+ &settings);
if (multires)
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 3a8ab12b96d..9f14a821613 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -184,7 +184,7 @@ static void PALETTE_OT_new(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-static int palette_poll(bContext *C)
+static bool palette_poll(bContext *C)
{
Paint *paint = BKE_paint_get_active_from_context(C);
@@ -366,10 +366,11 @@ static Brush *brush_tool_toggle(Main *bmain, Brush *brush_orig, const int tool,
return NULL;
}
-static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool,
- const size_t tool_offset, const int ob_mode,
- const char *tool_name, const bool create_missing,
- const bool toggle)
+static int brush_generic_tool_set(
+ Main *bmain, Paint *paint, const int tool,
+ const size_t tool_offset, const int ob_mode,
+ const char *tool_name, const bool create_missing,
+ const bool toggle)
{
Brush *brush, *brush_orig = BKE_paint_brush(paint);
@@ -455,21 +456,19 @@ static int brush_select_exec(bContext *C, wmOperator *op)
/* TODO(campbell): Use the toolsystem for now, ideally the toolsystem will display brushes directly
* so we don't need to sync between tools and brushes. */
- if (false) {
- return brush_generic_tool_set(
- bmain, paint, tool, tool_offset,
- paint_mode, tool_name, create_missing,
- toggle);
- }
- else {
+ int ret = brush_generic_tool_set(
+ bmain, paint, tool, tool_offset,
+ paint_mode, tool_name, create_missing,
+ toggle);
+
+ if ((ret == OPERATOR_FINISHED) && (paint->brush != NULL)) {
+ Brush *brush = paint->brush;
WorkSpace *workspace = CTX_wm_workspace(C);
- if (WM_toolsystem_ref_set_by_name(C, workspace, NULL, tool_name, true)) {
- return OPERATOR_FINISHED;
- }
- else {
- return OPERATOR_CANCELLED;
+ if (WM_toolsystem_ref_set_by_name(C, workspace, NULL, brush->id.name + 2, true)) {
+ /* ok */
}
}
+ return ret;
}
static void PAINT_OT_brush_select(wmOperatorType *ot)
@@ -514,8 +513,9 @@ static wmKeyMapItem *keymap_brush_select(
int keymap_modifier)
{
wmKeyMapItem *kmi;
- kmi = WM_keymap_add_item(keymap, "PAINT_OT_brush_select",
- keymap_type, KM_PRESS, keymap_modifier, 0);
+ kmi = WM_keymap_add_item(
+ keymap, "PAINT_OT_brush_select",
+ keymap_type, KM_PRESS, keymap_modifier, 0);
RNA_enum_set(kmi->ptr, "paint_mode", paint_mode);
@@ -699,8 +699,7 @@ static void stencil_control_calculate(StencilControlData *scd, const int mval[2]
switch (scd->mode) {
case STENCIL_TRANSLATE:
sub_v2_v2v2(mdiff, mvalf, scd->init_mouse);
- add_v2_v2v2(scd->pos_target, scd->init_spos,
- mdiff);
+ add_v2_v2v2(scd->pos_target, scd->init_spos, mdiff);
CLAMP(scd->pos_target[0],
-scd->dim_target[0] + PIXEL_MARGIN,
scd->area_size[0] + scd->dim_target[0] - PIXEL_MARGIN);
@@ -794,7 +793,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve
return OPERATOR_RUNNING_MODAL;
}
-static int stencil_control_poll(bContext *C)
+static bool stencil_control_poll(bContext *C)
{
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
@@ -1003,8 +1002,9 @@ void ED_operatormacros_paint(void)
wmOperatorType *ot;
wmOperatorTypeMacro *otmacro;
- ot = WM_operatortype_append_macro("PAINTCURVE_OT_add_point_slide", "Add Curve Point and Slide",
- "Add new curve point and slide it", OPTYPE_UNDO);
+ ot = WM_operatortype_append_macro(
+ "PAINTCURVE_OT_add_point_slide", "Add Curve Point and Slide",
+ "Add new curve point and slide it", OPTYPE_UNDO);
ot->description = "Add new curve point and slide it";
WM_operatortype_macro_define(ot, "PAINTCURVE_OT_add_point");
otmacro = WM_operatortype_macro_define(ot, "PAINTCURVE_OT_slide");
@@ -1107,8 +1107,9 @@ static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path
RNA_float_set(kmi->ptr, "scalar", 10.0 / 9.0); // 1.1111....
}
-static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path,
- const char *output_name, const char *input_name)
+static void set_brush_rc_path(
+ PointerRNA *ptr, const char *brush_path,
+ const char *output_name, const char *input_name)
{
char *path;
@@ -1117,9 +1118,10 @@ static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path,
MEM_freeN(path);
}
-void set_brush_rc_props(PointerRNA *ptr, const char *paint,
- const char *prop, const char *secondary_prop,
- RCFlags flags)
+void set_brush_rc_props(
+ PointerRNA *ptr, const char *paint,
+ const char *prop, const char *secondary_prop,
+ RCFlags flags)
{
const char *ups_path = "tool_settings.unified_paint_settings";
char *brush_path;
@@ -1168,8 +1170,9 @@ void set_brush_rc_props(PointerRNA *ptr, const char *paint,
MEM_freeN(brush_path);
}
-static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *paint,
- RCFlags flags)
+static void ed_keymap_paint_brush_radial_control(
+ wmKeyMap *keymap, const char *paint,
+ RCFlags flags)
{
wmKeyMapItem *kmi;
/* only size needs to follow zoom, strength shows fixed size circle */
@@ -1230,6 +1233,7 @@ static void paint_keymap_curve(wmKeyMap *keymap)
RNA_boolean_set(kmi->ptr, "toggle", true);
WM_keymap_add_item(keymap, "PAINTCURVE_OT_cursor", ACTIONMOUSE, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "PAINTCURVE_OT_delete_point", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINTCURVE_OT_delete_point", DELKEY, KM_PRESS, 0, 0);
@@ -1336,8 +1340,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "PAINT_OT_brush_colors_flip", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PAINT_OT_sample_color", SKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap,
- "PAINT_OT_vertex_color_set", KKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "PAINT_OT_vertex_color_set", KKEY, KM_PRESS, KM_SHIFT, 0);
ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "vertex_paint", RC_COLOR | RC_COLOR_OVERRIDE | RC_ROTATION);
@@ -1368,8 +1371,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_LINEAR);
RNA_enum_set(WM_keymap_add_item(keymap, "PAINT_OT_weight_gradient", LEFTMOUSE, KM_PRESS, KM_ALT | KM_CTRL, 0)->ptr, "type", WPAINT_GRADIENT_TYPE_RADIAL);
- WM_keymap_add_item(keymap,
- "PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size");
ed_keymap_paint_brush_radial_control(keymap, "weight_paint", RC_WEIGHT);
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index a7aa19807dd..8db78a41252 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -62,6 +62,7 @@
#include "BIF_glutil.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -149,8 +150,8 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata
PaintStroke *stroke = customdata;
if (stroke && brush) {
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
ARegion *ar = stroke->vc.ar;
@@ -168,8 +169,8 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata
immUnbindProgram();
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
}
}
@@ -178,17 +179,17 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
Paint *paint = BKE_paint_get_active_from_context(C);
PaintStroke *stroke = customdata;
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
const float alpha = (float)paint->paint_cursor_col[3] / 255.0f;
immUniformArray4fv("colors", (float *)(float[][4]){{0.0f, 0.0f, 0.0f, alpha}, {1.0f, 1.0f, 1.0f, alpha}}, 2);
immUniform1f("dash_width", 6.0f);
@@ -218,15 +219,16 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
immUnbindProgram();
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
static bool paint_tool_require_location(Brush *brush, ePaintMode mode)
{
switch (mode) {
case ePaintSculpt:
- if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB))
+ if (ELEM(brush->sculpt_tool,
+ SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB))
{
return false;
}
@@ -241,13 +243,14 @@ static bool paint_tool_require_location(Brush *brush, ePaintMode mode)
}
/* Initialize the stroke cache variants from operator properties */
-static bool paint_brush_update(bContext *C,
- Brush *brush,
- ePaintMode mode,
- struct PaintStroke *stroke,
- const float mouse_init[2],
- float mouse[2], float pressure,
- float location[3])
+static bool paint_brush_update(
+ bContext *C,
+ Brush *brush,
+ ePaintMode mode,
+ struct PaintStroke *stroke,
+ const float mouse_init[2],
+ float mouse[2], float pressure,
+ float r_location[3], bool *r_location_is_set)
{
Scene *scene = CTX_data_scene(C);
UnifiedPaintSettings *ups = stroke->ups;
@@ -258,6 +261,7 @@ static bool paint_brush_update(bContext *C,
bool is_dry_run = false;
bool do_random = false;
bool do_random_mask = false;
+ *r_location_is_set = false;
/* XXX: Use pressure value from first brush step for brushes which don't
* support strokes (grab, thumb). They depends on initial state and
* brush coord/pressure/etc.
@@ -356,10 +360,11 @@ static bool paint_brush_update(bContext *C,
halfway[1] = dy * 0.5f + stroke->initial_mouse[1];
if (stroke->get_location) {
- if (stroke->get_location(C, location, halfway)) {
+ if (stroke->get_location(C, r_location, halfway)) {
hit = true;
location_sampled = true;
location_success = true;
+ *r_location_is_set = true;
}
else if (!paint_tool_require_location(brush, mode)) {
hit = true;
@@ -429,14 +434,17 @@ static bool paint_brush_update(bContext *C,
if (!location_sampled) {
if (stroke->get_location) {
- if (stroke->get_location(C, location, mouse))
+ if (stroke->get_location(C, r_location, mouse)) {
location_success = true;
+ *r_location_is_set = true;
+ }
else if (!paint_tool_require_location(brush, mode))
location_success = true;
}
else {
- zero_v3(location);
+ zero_v3(r_location);
location_success = true;
+ /* don't set 'r_location_is_set', since we don't want to use the value. */
}
}
@@ -477,14 +485,24 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
#if 0
/* special exception here for too high pressure values on first touch in
* windows for some tablets, then we just skip first touch .. */
- if (tablet && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ if (tablet && (pressure >= 0.99f) &&
+ ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) ||
+ BKE_brush_use_alpha_pressure(scene, pop->s.brush) ||
+ BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ {
return;
+ }
/* This can be removed once fixed properly in
* BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user)
* at zero pressure we should do nothing 1/2^12 is 0.0002 which is the sensitivity of the most sensitive pen tablet available */
- if (tablet && (pressure < 0.0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ if (tablet && (pressure < 0.0002f) &&
+ ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) ||
+ BKE_brush_use_alpha_pressure(scene, pop->s.brush) ||
+ BKE_brush_use_size_pressure(scene, pop->s.brush)))
+ {
return;
+ }
#endif
/* copy last position -before- jittering, or space fill code
@@ -515,8 +533,13 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, const float
}
- ups->last_hit = paint_brush_update(C, brush, mode, stroke, mouse_in, mouse_out, pressure, location);
- copy_v3_v3(ups->last_location, location);
+ bool is_location_is_set;
+ ups->last_hit = paint_brush_update(
+ C, brush, mode, stroke, mouse_in, mouse_out, pressure,
+ location, &is_location_is_set);
+ if (is_location_is_set) {
+ copy_v3_v3(ups->last_location, location);
+ }
if (!ups->last_hit) {
return;
}
@@ -563,7 +586,8 @@ static bool paint_smooth_stroke(
return true;
}
-static float paint_space_stroke_spacing(const Scene *scene, PaintStroke *stroke, float size_pressure, float spacing_pressure)
+static float paint_space_stroke_spacing(
+ const Scene *scene, PaintStroke *stroke, float size_pressure, float spacing_pressure)
{
/* brushes can have a minimum size of 1.0 but with pressure it can be smaller then a pixel
* causing very high step sizes, hanging blender [#32381] */
@@ -633,7 +657,8 @@ static float paint_stroke_integrate_overlap(Brush *br, float factor)
return 1.0f / max;
}
-static float paint_space_stroke_spacing_variable(const Scene *scene, PaintStroke *stroke, float pressure, float dpressure, float length)
+static float paint_space_stroke_spacing_variable(
+ const Scene *scene, PaintStroke *stroke, float pressure, float dpressure, float length)
{
if (BKE_brush_use_size_pressure(scene, stroke->brush)) {
/* use pressure to modify size. set spacing so that at 100%, the circles
@@ -708,13 +733,14 @@ static int paint_space_stroke(bContext *C, wmOperator *op, const float final_mou
/**** Public API ****/
-PaintStroke *paint_stroke_new(bContext *C,
- wmOperator *op,
- StrokeGetLocation get_location,
- StrokeTestStart test_start,
- StrokeUpdateStep update_step,
- StrokeRedraw redraw,
- StrokeDone done, int event_type)
+PaintStroke *paint_stroke_new(
+ bContext *C,
+ wmOperator *op,
+ StrokeGetLocation get_location,
+ StrokeTestStart test_start,
+ StrokeUpdateStep update_step,
+ StrokeRedraw redraw,
+ StrokeDone done, int event_type)
{
PaintStroke *stroke = MEM_callocN(sizeof(PaintStroke), "PaintStroke");
ToolSettings *toolsettings = CTX_data_tool_settings(C);
@@ -815,11 +841,12 @@ bool paint_space_stroke_enabled(Brush *br, ePaintMode mode)
static bool sculpt_is_grab_tool(Brush *br)
{
- return ELEM(br->sculpt_tool,
- SCULPT_TOOL_GRAB,
- SCULPT_TOOL_THUMB,
- SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SNAKE_HOOK);
+ return ELEM(
+ br->sculpt_tool,
+ SCULPT_TOOL_GRAB,
+ SCULPT_TOOL_THUMB,
+ SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK);
}
/* return true if the brush size can change during paint (normally used for pressure) */
@@ -920,9 +947,10 @@ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf)
return keymap;
}
-static void paint_stroke_add_sample(const Paint *paint,
- PaintStroke *stroke,
- float x, float y, float pressure)
+static void paint_stroke_add_sample(
+ const Paint *paint,
+ PaintStroke *stroke,
+ float x, float y, float pressure)
{
PaintSample *sample = &stroke->samples[stroke->cur_sample];
int max_samples = CLAMPIS(paint->num_input_samples, 1, PAINT_MAX_INPUT_SAMPLES);
@@ -938,8 +966,9 @@ static void paint_stroke_add_sample(const Paint *paint,
stroke->num_samples++;
}
-static void paint_stroke_sample_average(const PaintStroke *stroke,
- PaintSample *average)
+static void paint_stroke_sample_average(
+ const PaintStroke *stroke,
+ PaintSample *average)
{
int i;
@@ -1084,11 +1113,13 @@ static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *str
if (stroke->stroke_started) {
paint_brush_stroke_add_step(C, op, data + 2 * j, 1.0);
- paint_line_strokes_spacing(C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
+ paint_line_strokes_spacing(
+ C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
}
}
else {
- paint_line_strokes_spacing(C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
+ paint_line_strokes_spacing(
+ C, op, stroke, spacing, &length_residue, data + 2 * j, data + 2 * (j + 1));
}
}
}
@@ -1148,7 +1179,9 @@ int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event)
float pressure;
/* see if tablet affects event. Line, anchored and drag dot strokes do not support pressure */
- pressure = (br->flag & (BRUSH_LINE | BRUSH_ANCHORED | BRUSH_DRAG_DOT)) ? 1.0f : WM_event_tablet_data(event, &stroke->pen_flip, NULL);
+ pressure = (
+ (br->flag & (BRUSH_LINE | BRUSH_ANCHORED | BRUSH_DRAG_DOT)) ?
+ 1.0f : WM_event_tablet_data(event, &stroke->pen_flip, NULL));
paint_stroke_add_sample(p, stroke, event->mval[0], event->mval[1], pressure);
paint_stroke_sample_average(stroke, &sample_average);
@@ -1350,7 +1383,7 @@ void paint_stroke_set_mode_data(PaintStroke *stroke, void *mode_data)
stroke->mode_data = mode_data;
}
-int paint_poll(bContext *C)
+bool paint_poll(bContext *C)
{
Paint *p = BKE_paint_get_active_from_context(C);
Object *ob = CTX_data_active_object(C);
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 80c4d4099a2..697ffc32759 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -65,6 +65,7 @@
#include "GPU_glew.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h"
@@ -86,12 +87,13 @@
/* Convert the object-space axis-aligned bounding box (expressed as
* its minimum and maximum corners) into a screen-space rectangle,
* returns zero if the result is empty */
-bool paint_convert_bb_to_rect(rcti *rect,
- const float bb_min[3],
- const float bb_max[3],
- const ARegion *ar,
- RegionView3D *rv3d,
- Object *ob)
+bool paint_convert_bb_to_rect(
+ rcti *rect,
+ const float bb_min[3],
+ const float bb_max[3],
+ const ARegion *ar,
+ RegionView3D *rv3d,
+ Object *ob)
{
float projection_mat[4][4];
int i, j, k;
@@ -132,10 +134,11 @@ bool paint_convert_bb_to_rect(rcti *rect,
/* Get four planes in object-space that describe the projection of
* screen_rect from screen into object-space (essentially converting a
* 2D screens-space bounding box into four 3D planes) */
-void paint_calc_redraw_planes(float planes[4][4],
- const ARegion *ar,
- Object *ob,
- const rcti *screen_rect)
+void paint_calc_redraw_planes(
+ float planes[4][4],
+ const ARegion *ar,
+ Object *ob,
+ const rcti *screen_rect)
{
BoundBox bb;
rcti rect;
@@ -151,8 +154,9 @@ void paint_calc_redraw_planes(float planes[4][4],
negate_m4(planes);
}
-float paint_calc_object_space_radius(ViewContext *vc, const float center[3],
- float pixel_radius)
+float paint_calc_object_space_radius(
+ ViewContext *vc, const float center[3],
+ float pixel_radius)
{
Object *ob = vc->obact;
float delta[3], scale, loc[3];
@@ -181,7 +185,9 @@ float paint_get_tex_pixel(const MTex *mtex, float u, float v, struct ImagePool *
return intensity;
}
-void paint_get_tex_pixel_col(const MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool, int thread, bool convert_to_linear, struct ColorSpace *colorspace)
+void paint_get_tex_pixel_col(
+ const MTex *mtex, float u, float v, float rgba[4], struct ImagePool *pool,
+ int thread, bool convert_to_linear, struct ColorSpace *colorspace)
{
float co[3] = {u, v, 0.0f};
int hasrgb;
@@ -237,9 +243,10 @@ static void imapaint_project(float matrix[4][4], const float co[3], float pco[4]
mul_m4_v4(matrix, pco);
}
-static void imapaint_tri_weights(float matrix[4][4], GLint view[4],
- const float v1[3], const float v2[3], const float v3[3],
- const float co[2], float w[3])
+static void imapaint_tri_weights(
+ float matrix[4][4], GLint view[4],
+ const float v1[3], const float v2[3], const float v3[3],
+ const float co[2], float w[3])
{
float pv1[4], pv2[4], pv3[4], h[3], divw;
float wmat[3][3], invwmat[3][3];
@@ -291,7 +298,7 @@ static void imapaint_pick_uv(Mesh *me_eval, Scene *scene, Object *ob_eval, unsig
const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
/* get the needed opengl matrices */
- glGetIntegerv(GL_VIEWPORT, view);
+ GPU_viewport_size_get_i(view);
gpuGetModelViewMatrix(matrix);
gpuGetProjectionMatrix(proj);
view[0] = view[1] = 0;
@@ -567,7 +574,7 @@ static int brush_curve_preset_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int brush_curve_preset_poll(bContext *C)
+static bool brush_curve_preset_poll(bContext *C)
{
Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C));
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 85a1f11be4b..dd03c07a43f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -201,14 +201,14 @@ static void paint_last_stroke_update(Scene *scene, ARegion *ar, const float mval
/* polling - retrieve whether cursor should be set or operator should be done */
/* Returns true if vertex paint mode is active */
-int vertex_paint_mode_poll(bContext *C)
+bool vertex_paint_mode_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh *)ob->data)->totpoly;
}
-static int vertex_paint_poll_ex(bContext *C, bool check_tool)
+static bool vertex_paint_poll_ex(bContext *C, bool check_tool)
{
if (vertex_paint_mode_poll(C) &&
BKE_paint_brush(&CTX_data_tool_settings(C)->vpaint->paint))
@@ -226,24 +226,24 @@ static int vertex_paint_poll_ex(bContext *C, bool check_tool)
return 0;
}
-int vertex_paint_poll(bContext *C)
+bool vertex_paint_poll(bContext *C)
{
return vertex_paint_poll_ex(C, true);
}
-int vertex_paint_poll_ignore_tool(bContext *C)
+bool vertex_paint_poll_ignore_tool(bContext *C)
{
return vertex_paint_poll_ex(C, true);
}
-int weight_paint_mode_poll(bContext *C)
+bool weight_paint_mode_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
return ob && ob->mode == OB_MODE_WEIGHT_PAINT && ((Mesh *)ob->data)->totpoly;
}
-static int weight_paint_poll_ex(bContext *C, bool check_tool)
+static bool weight_paint_poll_ex(bContext *C, bool check_tool)
{
Object *ob = CTX_data_active_object(C);
ScrArea *sa;
@@ -264,12 +264,12 @@ static int weight_paint_poll_ex(bContext *C, bool check_tool)
return 0;
}
-int weight_paint_poll(bContext *C)
+bool weight_paint_poll(bContext *C)
{
return weight_paint_poll_ex(C, true);
}
-int weight_paint_poll_ignore_tool(bContext *C)
+bool weight_paint_poll_ignore_tool(bContext *C)
{
return weight_paint_poll_ex(C, false);
}
@@ -1282,7 +1282,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
}
/* for switching to/from mode */
-static int paint_poll_test(bContext *C)
+static bool paint_poll_test(bContext *C)
{
Object *ob = CTX_data_active_object(C);
if (ob == NULL || ob->type != OB_MESH)
@@ -1510,8 +1510,9 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo
wpd = MEM_callocN(sizeof(struct WPaintData), "WPaintData");
paint_stroke_set_mode_data(stroke, wpd);
ED_view3d_viewcontext_init(C, &wpd->vc);
- view_angle_limits_init(&wpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
- (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
+ view_angle_limits_init(
+ &wpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
+ (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
wpd->active.index = vgroup_index.active;
wpd->mirror.index = vgroup_index.mirror;
@@ -2512,13 +2513,13 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f
vpd = MEM_callocN(sizeof(*vpd), "VPaintData");
paint_stroke_set_mode_data(stroke, vpd);
ED_view3d_viewcontext_init(C, &vpd->vc);
- view_angle_limits_init(&vpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
- (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
+ view_angle_limits_init(
+ &vpd->normal_angle_precalc, vp->paint.brush->falloff_angle,
+ (vp->paint.brush->flag & BRUSH_FRONTFACE_FALLOFF) != 0);
vpd->paintcol = vpaint_get_current_col(scene, vp);
- vpd->is_texbrush = !(brush->vertexpaint_tool == PAINT_BLEND_BLUR) &&
- brush->mtex.tex;
+ vpd->is_texbrush = !(brush->vertexpaint_tool == PAINT_BLEND_BLUR) && brush->mtex.tex;
/* are we painting onto a modified mesh?,
* if not we can skip face map trickiness */
@@ -3258,4 +3259,3 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot)
paint_stroke_operator_properties(ot);
}
-
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
index 8516d92214d..4c8ca493cd1 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c
@@ -49,7 +49,7 @@
#include "paint_intern.h" /* own include */
-static int vertex_weight_paint_mode_poll(bContext *C)
+static bool vertex_weight_paint_mode_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
Mesh *me = BKE_mesh_from_object(ob);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
index cacfdc2dbba..602bfe1ab8e 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c
@@ -28,7 +28,7 @@
* \ingroup edsculpt
*
* Utility functions for getting vertex locations while painting
- * (since they may be instanced multiple times in a DerivedMesh)
+ * (since they may be instanced multiple times in an evaluated mesh)
*/
#include "MEM_guardedalloc.h"
@@ -39,8 +39,9 @@
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
-#include "BKE_DerivedMesh.h"
+#include "BKE_DerivedMesh.h" /* XXX To be removed, only used for DMCoNo struct */
#include "BKE_context.h"
+#include "BKE_mesh_iterators.h"
#include "BKE_mesh_runtime.h"
#include "DEG_depsgraph.h"
@@ -107,24 +108,10 @@ static void vpaint_proj_dm_map_cosnos_init(
struct VertProjHandle *vp_handle)
{
Mesh *me = ob->data;
- DerivedMesh *dm;
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
- dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
-
- if (dm->foreachMappedVert) {
- memset(vp_handle->vcosnos, 0, sizeof(DMCoNo) * me->totvert);
- dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, DM_FOREACH_USE_NORMAL);
- }
- else {
- DMCoNo *v_co_no = vp_handle->vcosnos;
- int a;
- for (a = 0; a < me->totvert; a++, v_co_no++) {
- dm->getVertCo(dm, a, v_co_no->co);
- dm->getVertNo(dm, a, v_co_no->no);
- }
- }
-
- dm->release(dm);
+ memset(vp_handle->vcosnos, 0, sizeof(*vp_handle->vcosnos) * me->totvert);
+ BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, MESH_FOREACH_USE_NORMAL);
}
@@ -185,21 +172,13 @@ static void vpaint_proj_dm_map_cosnos_update(
Scene *scene = vp_handle->scene;
Object *ob = vp_handle->ob;
Mesh *me = ob->data;
- DerivedMesh *dm;
+ Mesh *me_eval = mesh_get_eval_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
/* quick sanity check - we shouldn't have to run this if there are no modifiers */
BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false);
- dm = mesh_get_derived_final(depsgraph, scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);
-
- /* highly unlikely this will become unavailable once painting starts (perhaps with animated modifiers) */
- if (LIKELY(dm->foreachMappedVert)) {
- copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
-
- dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL);
- }
-
- dm->release(dm);
+ copy_vn_fl(vp_handle->dists_sq, me->totvert, FLT_MAX);
+ BKE_mesh_foreach_mapped_vert(me_eval, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, MESH_FOREACH_USE_NORMAL);
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
index 01c62704db3..436f4ac5993 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c
@@ -35,8 +35,8 @@
#include "IMB_imbuf_types.h"
#include "IMB_colormanagement.h"
-//#include "DNA_armature_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_particle_types.h"
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
@@ -46,7 +46,6 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_deform.h"
@@ -118,7 +117,7 @@ static void wpaint_prev_destroy(struct WPaintPrev *wpp)
/** \name Weight from Bones Operator
* \{ */
-static int weight_from_bones_poll(bContext *C)
+static bool weight_from_bones_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -152,8 +151,9 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot)
/* identifiers */
ot->name = "Weight from Bones";
ot->idname = "PAINT_OT_weight_from_bones";
- ot->description = "Set the weights of the groups matching the attached armature's selected bones, "
- "using the distance between the vertices and the bones";
+ ot->description = (
+ "Set the weights of the groups matching the attached armature's selected bones, "
+ "using the distance between the vertices and the bones");
/* api callbacks */
ot->exec = weight_from_bones_exec;
@@ -644,9 +644,10 @@ static void gradientVertInit__mapFunc(
if (BLI_BITMAP_TEST(grad_data->vert_visit, index) == 0) {
WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index];
- if (ED_view3d_project_float_object(grad_data->ar,
- co, vs->sco,
- V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
+ if (ED_view3d_project_float_object(
+ grad_data->ar,
+ co, vs->sco,
+ V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{
/* ok */
MDeformVert *dv = &me->dvert[index];
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 414b9f2062f..a5871c90d56 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -4082,25 +4082,25 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
-int sculpt_mode_poll(bContext *C)
+bool sculpt_mode_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
return ob && ob->mode & OB_MODE_SCULPT;
}
-int sculpt_mode_poll_view3d(bContext *C)
+bool sculpt_mode_poll_view3d(bContext *C)
{
return (sculpt_mode_poll(C) &&
CTX_wm_region_view3d(C));
}
-int sculpt_poll_view3d(bContext *C)
+bool sculpt_poll_view3d(bContext *C)
{
return (sculpt_poll(C) &&
CTX_wm_region_view3d(C));
}
-int sculpt_poll(bContext *C)
+bool sculpt_poll(bContext *C)
{
return sculpt_mode_poll(C) && paint_poll(C);
}
@@ -5537,7 +5537,7 @@ static int sculpt_optimize_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int sculpt_and_dynamic_topology_poll(bContext *C)
+static bool sculpt_and_dynamic_topology_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -5853,7 +5853,7 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot)
}
-static int sculpt_and_dynamic_topology_constant_detail_poll(bContext *C)
+static bool sculpt_and_dynamic_topology_constant_detail_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
@@ -5970,8 +5970,7 @@ static int sculpt_sample_detail_size_exec(bContext *C, wmOperator *op)
static int sculpt_sample_detail_size_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e))
{
- ScrArea *sa = CTX_wm_area(C);
- ED_area_headerprint(sa, "Click on the mesh to set the detail");
+ ED_workspace_status_text(C, "Click on the mesh to set the detail");
WM_cursor_modal_set(CTX_wm_window(C), BC_EYEDROPPER_CURSOR);
WM_event_add_modal_handler(C, op);
return OPERATOR_RUNNING_MODAL;
@@ -5982,14 +5981,13 @@ static int sculpt_sample_detail_size_modal(bContext *C, wmOperator *op, const wm
switch (e->type) {
case LEFTMOUSE:
if (e->val == KM_PRESS) {
- ScrArea *sa = CTX_wm_area(C);
int ss_co[2] = {e->mval[0], e->mval[1]};
sample_detail(C, ss_co);
RNA_int_set_array(op->ptr, "location", ss_co);
WM_cursor_modal_restore(CTX_wm_window(C));
- ED_area_headerprint(sa, NULL);
+ ED_workspace_status_text(C, NULL);
WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
return OPERATOR_FINISHED;
@@ -5998,9 +5996,8 @@ static int sculpt_sample_detail_size_modal(bContext *C, wmOperator *op, const wm
case RIGHTMOUSE:
{
- ScrArea *sa = CTX_wm_area(C);
WM_cursor_modal_restore(CTX_wm_window(C));
- ED_area_headerprint(sa, NULL);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index ff6b5a6f374..2154061da1b 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -48,11 +48,11 @@ struct Object;
struct SculptUndoNode;
struct SculptOrigVertData;
-int sculpt_mode_poll(struct bContext *C);
-int sculpt_mode_poll_view3d(struct bContext *C);
+bool sculpt_mode_poll(struct bContext *C);
+bool sculpt_mode_poll_view3d(struct bContext *C);
/* checks for a brush, not just sculpt mode */
-int sculpt_poll(struct bContext *C);
-int sculpt_poll_view3d(struct bContext *C);
+bool sculpt_poll(struct bContext *C);
+bool sculpt_poll_view3d(struct bContext *C);
/* Stroke */
bool sculpt_stroke_get_location(struct bContext *C, float out[3], const float mouse[2]);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 2872ad4fb9c..bc22147b15d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -561,7 +561,7 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb)
else {
BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, &rebuild);
}
- BKE_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw, NULL);
+ BKE_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw | PBVH_UpdateNormals, NULL);
if (BKE_sculpt_multires_active(scene, ob)) {
if (rebuild)
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index cf9feae62b5..29b258fc80d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -59,6 +59,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
+#include "GPU_state.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -159,7 +160,7 @@ static Brush *uv_sculpt_brush(bContext *C)
}
-static int uv_sculpt_brush_poll_do(bContext *C, const bool check_region)
+static bool uv_sculpt_brush_poll_do(bContext *C, const bool check_region)
{
BMEditMesh *em;
int ret;
@@ -187,7 +188,7 @@ static int uv_sculpt_brush_poll_do(bContext *C, const bool check_region)
return ret;
}
-static int uv_sculpt_brush_poll(bContext *C)
+static bool uv_sculpt_brush_poll(bContext *C)
{
return uv_sculpt_brush_poll_do(C, true);
}
@@ -218,11 +219,11 @@ static void brush_drawcursor_uvsculpt(bContext *C, int x, int y, void *UNUSED(cu
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor3fvAlpha(brush->add_col, alpha);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
imm_draw_circle_wire_2d(pos, (float)x, (float)y, size, 40);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ GPU_line_smooth(false);
immUnbindProgram();
}
@@ -246,8 +247,9 @@ void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *sc
BKE_paint_init(bmain, scene, ePaintSculptUV, PAINT_CURSOR_SCULPT);
- settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate(wm, uv_sculpt_brush_poll,
- brush_drawcursor_uvsculpt, NULL);
+ settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate(
+ wm, uv_sculpt_brush_poll,
+ brush_drawcursor_uvsculpt, NULL);
}
else {
if (settings->uvsculpt) {
@@ -257,12 +259,12 @@ void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *sc
}
}
-int uv_sculpt_poll(bContext *C)
+bool uv_sculpt_poll(bContext *C)
{
return uv_sculpt_brush_poll_do(C, true);
}
-int uv_sculpt_keymap_poll(bContext *C)
+bool uv_sculpt_keymap_poll(bContext *C)
{
return uv_sculpt_brush_poll_do(C, false);
}
diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h
index c1516c0f25e..d95f473e4d9 100644
--- a/source/blender/editors/sound/sound_intern.h
+++ b/source/blender/editors/sound/sound_intern.h
@@ -34,4 +34,3 @@
#endif /* __SOUND_INTERN_H__ */
-
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 049feea2d8a..3fc68a50057 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -703,7 +703,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
/* ******************************************************* */
-static int sound_poll(bContext *C)
+static bool sound_poll(bContext *C)
{
Editing *ed = CTX_data_scene(C)->ed;
diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c
index 74c9f2f8cfb..8d4596a79a7 100644
--- a/source/blender/editors/space_action/action_data.c
+++ b/source/blender/editors/space_action/action_data.c
@@ -175,7 +175,7 @@ static void actedit_change_action(bContext *C, bAction *act)
* The NLA Editor is active (i.e. Animation Data panel -> new action)
* 2) The associated AnimData block must not be in tweakmode
*/
-static int action_new_poll(bContext *C)
+static bool action_new_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
@@ -295,7 +295,7 @@ void ACTION_OT_new(wmOperatorType *ot)
* 2) There must be an action active
* 3) The associated AnimData block must not be in tweakmode
*/
-static int action_pushdown_poll(bContext *C)
+static bool action_pushdown_poll(bContext *C)
{
if (ED_operator_action_active(C)) {
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
@@ -426,7 +426,7 @@ void ACTION_OT_stash(wmOperatorType *ot)
* 1) There must be an dopesheet/action editor, and it must be in a mode which uses actions
* 2) The associated AnimData block must not be in tweakmode
*/
-static int action_stash_create_poll(bContext *C)
+static bool action_stash_create_poll(bContext *C)
{
if (ED_operator_action_active(C)) {
AnimData *adt = ED_actedit_animdata_from_context(C);
@@ -618,7 +618,7 @@ void ED_animedit_unlink_action(bContext *C, ID *id, AnimData *adt, bAction *act,
/* -------------------------- */
-static int action_unlink_poll(bContext *C)
+static bool action_unlink_poll(bContext *C)
{
if (ED_operator_action_active(C)) {
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
@@ -749,7 +749,7 @@ static void action_layer_switch_strip(AnimData *adt,
/* ********************** One Layer Up Operator ************************** */
-static int action_layer_next_poll(bContext *C)
+static bool action_layer_next_poll(bContext *C)
{
/* Action Editor's action editing modes only */
if (ED_operator_action_active(C)) {
@@ -860,7 +860,7 @@ void ACTION_OT_layer_next(wmOperatorType *ot)
/* ********************* One Layer Down Operator ************************* */
-static int action_layer_prev_poll(bContext *C)
+static bool action_layer_prev_poll(bContext *C)
{
/* Action Editor's action editing modes only */
if (ED_operator_action_active(C)) {
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 35ebb62a7cc..6105652a4c7 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -59,6 +59,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -215,7 +216,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glEnable(GL_BLEND);
+ GPU_blend(true);
for (ale = anim_data.first; ale; ale = ale->next) {
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
@@ -319,7 +320,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
/* Increment the step */
y -= ACHANNEL_STEP(ac);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* black line marking 'current frame' for Time-Slide transform mode */
if (saction->flag & SACTION_MOVING) {
@@ -475,7 +476,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
const int sta = pid->cache->startframe, end = pid->cache->endframe;
const int len = (end - sta + 1) * 6;
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor4fv(col);
immRectf(pos, (float)sta, 0.0, (float)end, 1.0);
@@ -509,7 +510,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
immEnd();
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a9f9488d049..1d8766ba773 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -93,7 +93,7 @@
* 3) that the set of markers being shown are the scene markers, not the list we're merging
* 4) that there are some selected markers
*/
-static int act_markers_make_local_poll(bContext *C)
+static bool act_markers_make_local_poll(bContext *C)
{
SpaceAction *sact = CTX_wm_space_action(C);
@@ -1491,7 +1491,7 @@ void ACTION_OT_keyframe_type(wmOperatorType *ot)
/* ***************** Jump to Selected Frames Operator *********************** */
-static int actkeys_framejump_poll(bContext *C)
+static bool actkeys_framejump_poll(bContext *C)
{
/* prevent changes during render */
if (G.is_rendering)
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 25d3560b175..fc1f40cdb5a 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -153,4 +153,3 @@ void action_operatortypes(void);
void action_keymap(struct wmKeyConfig *keyconf);
#endif /* __ACTION_INTERN_H__ */
-
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 83bda4d63a5..11145e29627 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -1590,7 +1590,7 @@ void ACTION_OT_clickselect(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name = "Mouse Select Keys";
+ ot->name = "Select Keyframes";
ot->idname = "ACTION_OT_clickselect";
ot->description = "Select keyframes by clicking on them";
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 527e382ec1e..876b73a4a76 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -47,6 +47,8 @@
#include "BKE_screen.h"
#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -63,6 +65,7 @@
#include "ED_markers.h"
#include "action_intern.h" /* own include */
+#include "GPU_framebuffer.h"
/* ******************** manage regions ********************* */
@@ -102,6 +105,7 @@ static SpaceLink *action_new(const ScrArea *sa, const Scene *scene)
saction->autosnap = SACTSNAP_FRAME;
saction->mode = SACTCONT_DOPESHEET;
+ saction->mode_prev = SACTCONT_DOPESHEET;
saction->ads.filterflag |= ADS_FILTER_SUMMARY;
@@ -223,7 +227,7 @@ static void action_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -309,7 +313,7 @@ static void action_channel_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -835,6 +839,37 @@ static void action_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, I
}
+/**
+ * \note Used for splitting out a subset of modes is more involved,
+ * The previous non-timeline mode is stored so switching back to the
+ * dope-sheet doesn't always reset the sub-mode.
+ */
+static int action_space_subtype_get(ScrArea *sa)
+{
+ SpaceAction *sact = sa->spacedata.first;
+ return sact->mode == SACTCONT_TIMELINE ? SACTCONT_TIMELINE : SACTCONT_DOPESHEET;
+}
+
+static void action_space_subtype_set(ScrArea *sa, int value)
+{
+ SpaceAction *sact = sa->spacedata.first;
+ if (value == SACTCONT_TIMELINE) {
+ if (sact->mode != SACTCONT_TIMELINE) {
+ sact->mode_prev = sact->mode;
+ }
+ sact->mode = value;
+ }
+ else {
+ sact->mode = sact->mode_prev;
+ }
+}
+
+static void action_space_subtype_item_extend(
+ bContext *UNUSED(C), EnumPropertyItem **item, int *totitem)
+{
+ RNA_enum_items_add(item, totitem, rna_enum_space_action_mode_items);
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_action(void)
{
@@ -853,6 +888,9 @@ void ED_spacetype_action(void)
st->listener = action_listener;
st->refresh = action_refresh;
st->id_remap = action_id_remap;
+ st->space_subtype_item_extend = action_space_subtype_item_extend;
+ st->space_subtype_get = action_space_subtype_get;
+ st->space_subtype_set = action_space_subtype_set;
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 33ec7f771ba..2ee791e81d6 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -127,6 +127,8 @@ void ED_spacetypes_init(void)
ED_operatortypes_view2d();
ED_operatortypes_ui();
+ ED_screen_user_menu_register();
+
/* manipulator types */
ED_manipulatortypes_button_2d();
ED_manipulatortypes_dial_3d();
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index 2219b2a932c..aab7b39484d 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -98,7 +98,6 @@ void buttons_texture_context_compute(const struct bContext *C, struct SpaceButs
/* buttons_ops.c */
void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
void BUTTONS_OT_directory_browse(struct wmOperatorType *ot);
-void BUTTONS_OT_toolbox(struct wmOperatorType *ot);
+void BUTTONS_OT_context_menu(struct wmOperatorType *ot);
#endif /* __BUTTONS_INTERN_H__ */
-
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 47f97b8087f..93670919d4c 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -60,9 +60,9 @@
#include "buttons_intern.h" /* own include */
-/********************** toolbox operator *********************/
+/********************** context_menu operator *********************/
-static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
+static int context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
{
bScreen *sc = CTX_wm_screen(C);
SpaceButs *sbuts = CTX_wm_space_buts(C);
@@ -80,15 +80,15 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UN
return OPERATOR_INTERFACE;
}
-void BUTTONS_OT_toolbox(wmOperatorType *ot)
+void BUTTONS_OT_context_menu(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Toolbox";
- ot->description = "Display button panel toolbox";
- ot->idname = "BUTTONS_OT_toolbox";
+ ot->name = "Context Menu";
+ ot->description = "Display button panel context_menu";
+ ot->idname = "BUTTONS_OT_context_menu";
/* api callbacks */
- ot->invoke = toolbox_invoke;
+ ot->invoke = context_menu_invoke;
ot->poll = ED_operator_buttons_active;
}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 4fe3423e730..a951c2a8524 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -298,7 +298,7 @@ static void buttons_main_region_listener(
static void buttons_operatortypes(void)
{
- WM_operatortype_append(BUTTONS_OT_toolbox);
+ WM_operatortype_append(BUTTONS_OT_context_menu);
WM_operatortype_append(BUTTONS_OT_file_browse);
WM_operatortype_append(BUTTONS_OT_directory_browse);
}
@@ -307,7 +307,7 @@ static void buttons_keymap(struct wmKeyConfig *keyconf)
{
wmKeyMap *keymap = WM_keymap_find(keyconf, "Property Editor", SPACE_BUTS, 0);
- WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "BUTTONS_OT_context_menu", RIGHTMOUSE, KM_PRESS, 0, 0);
}
/* add handlers, stuff you only do once or on area/region changes */
@@ -632,4 +632,3 @@ void ED_spacetype_buttons(void)
BKE_spacetype_register(st);
}
-
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index f2fe06874d7..db5f6c2451c 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -77,7 +77,7 @@ void ED_clip_buttons_register(ARegionType *UNUSED(art))
/********************* MovieClip Template ************************/
-void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, int compact)
+void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, bool compact)
{
PropertyRNA *prop;
PointerRNA clipptr;
@@ -333,7 +333,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
}
void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr,
- PointerRNA *trackptr, int compact)
+ PointerRNA *trackptr, bool compact)
{
PropertyRNA *prop;
uiBlock *block;
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
index bc2aa3ae67f..d50d10d5cc3 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c
@@ -54,6 +54,7 @@
#include "GPU_draw.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "clip_intern.h" /* own include */
@@ -147,7 +148,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
strip[3] = 0.5f;
selected_strip[3] = 1.0f;
- glEnable(GL_BLEND);
+ GPU_blend(true);
clip_draw_dopesheet_background(ar, clip, pos_id);
@@ -279,7 +280,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
immUnbindProgram();
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -378,7 +379,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
PropertyRNA *chan_prop_lock = RNA_struct_type_find_property(&RNA_MovieTrackingTrack, "lock");
BLI_assert(chan_prop_lock);
- glEnable(GL_BLEND);
+ GPU_blend(true);
for (channel = dopesheet->channels.first; channel; channel = channel->next) {
float yminc = (float)(y - CHANNEL_HEIGHT_HALF);
float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF);
@@ -403,7 +404,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
/* adjust y-position for next one */
y -= CHANNEL_STEP;
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
UI_block_end(C, block);
UI_block_draw(C, block);
diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c
index c8675fc390b..a12e8db6daf 100644
--- a/source/blender/editors/space_clip/clip_dopesheet_ops.c
+++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c
@@ -53,7 +53,7 @@
#include "clip_intern.h" // own include
-static int space_clip_dopesheet_poll(bContext *C)
+static bool space_clip_dopesheet_poll(bContext *C)
{
if (ED_space_clip_tracking_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -70,7 +70,7 @@ static int space_clip_dopesheet_poll(bContext *C)
/********************** select channel operator *********************/
-static int dopesheet_select_channel_poll(bContext *C)
+static bool dopesheet_select_channel_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 5962bfe33f3..909f0a55c1c 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -60,6 +60,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_types.h"
@@ -156,8 +157,8 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
MovieTrackingPlaneTrack *act_plane_track = BKE_tracking_plane_track_get_active(&clip->tracking);
MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(tracking);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* cache background */
ED_region_cache_draw_background(ar);
@@ -235,7 +236,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
}
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* current frame */
x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
@@ -313,8 +314,8 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
/* checkerboard for case alpha */
if (ibuf->planes == 32) {
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
imm_draw_box_checker_2d(x, y, x + zoomx * ibuf->x, y + zoomy * ibuf->y);
}
@@ -335,7 +336,7 @@ static void draw_movieclip_buffer(const bContext *C, SpaceClip *sc, ARegion *ar,
}
if (ibuf->planes == 32)
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int height, float zoomx, float zoomy)
@@ -364,10 +365,10 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.0f);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -460,7 +461,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if (TRACK_VIEW_SELECTED(sc, track)) {
if ((b - a - 1) >= 1) {
- glPointSize(5.0f);
+ GPU_point_size(5.0f);
immBegin(GWN_PRIM_POINTS, b - a - 1);
@@ -475,7 +476,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
}
if ((b - a) >= 2) {
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
immBegin(GWN_PRIM_LINE_STRIP, b - a);
@@ -488,7 +489,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
}
if (TRACK_VIEW_SELECTED(sc, track)) {
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
if ((curindex - a) >= 1) {
immUniformThemeColor(TH_PATH_BEFORE);
@@ -515,7 +516,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
}
}
- glLineWidth(1);
+ GPU_line_width(1);
if ((curindex - a + 1) >= 2) {
immUniformThemeColor(TH_PATH_BEFORE);
@@ -559,7 +560,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
px[0] = 1.0f / width / sc->zoom;
px[1] = 1.0f / height / sc->zoom;
- glLineWidth(tiny ? 1.0f : 3.0f);
+ GPU_line_width(tiny ? 1.0f : 3.0f);
immUniformThemeColor(TH_MARKER_OUTLINE);
@@ -576,7 +577,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
if (isect_point_quad_v2(p, marker->pattern_corners[0], marker->pattern_corners[1],
marker->pattern_corners[2], marker->pattern_corners[3]))
{
- glPointSize(tiny ? 3.0f : 4.0f);
+ GPU_point_size(tiny ? 3.0f : 4.0f);
immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(position, pos[0], pos[1]);
@@ -660,7 +661,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
px[0] = 1.0f / width / sc->zoom;
px[1] = 1.0f / height / sc->zoom;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
/* Since we are switching solid and dashed lines in rather complex logic here, just always go with dashed shader. */
immUnbindProgram();
@@ -668,10 +669,10 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
/* marker position and offset position */
if ((track->flag & SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) {
@@ -700,7 +701,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
if (isect_point_quad_v2(p, marker->pattern_corners[0], marker->pattern_corners[1],
marker->pattern_corners[2], marker->pattern_corners[3]))
{
- glPointSize(tiny ? 1.0f : 2.0f);
+ GPU_point_size(tiny ? 1.0f : 2.0f);
immUniform1f("dash_factor", 2.0f); /* Solid "line" */
@@ -932,7 +933,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
- glLineWidth(outline ? 3.0f : 1.0f);
+ GPU_line_width(outline ? 3.0f : 1.0f);
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, 0.0f, 0.0f);
@@ -1125,8 +1126,8 @@ static void draw_plane_marker_image(Scene *scene,
if (plane_track->image_opacity != 1.0f || ibuf->planes == 32) {
transparent = true;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
glGenTextures(1, (GLuint *)&texid);
@@ -1174,7 +1175,7 @@ static void draw_plane_marker_image(Scene *scene,
glBindTexture(GL_TEXTURE_2D, 0);
if (transparent) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -1210,16 +1211,16 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
if (draw_plane_quad) {
const bool stipple = !draw_outline && tiny;
const bool thick = draw_outline && !tiny;
- glLineWidth(thick ? 3.0f : 1.0f);
+ GPU_line_width(thick ? 3.0f : 1.0f);
if (stipple) {
immUniform1f("dash_width", 6.0f);
@@ -1483,7 +1484,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie
MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
float pos[4], vec[4], mat[4][4], aspy;
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
aspy = 1.0f / clip->tracking.camera.pixel_aspect;
BKE_tracking_get_projection_matrix(tracking, object, framenr, width, height, mat);
@@ -1711,8 +1712,8 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
immUniformColor4fv(layer->color);
- glLineWidth(layer->thickness);
- glPointSize((float)(layer->thickness + 2));
+ GPU_line_width(layer->thickness);
+ GPU_point_size((float)(layer->thickness + 2));
while (frame) {
bGPDstroke *stroke = frame->strokes.first;
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 67aa7e19de7..0fb7d63180f 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -76,7 +76,7 @@
/* ******** operactor poll functions ******** */
-int ED_space_clip_poll(bContext *C)
+bool ED_space_clip_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -86,7 +86,7 @@ int ED_space_clip_poll(bContext *C)
return false;
}
-int ED_space_clip_view_clip_poll(bContext *C)
+bool ED_space_clip_view_clip_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -97,7 +97,7 @@ int ED_space_clip_view_clip_poll(bContext *C)
return false;
}
-int ED_space_clip_tracking_poll(bContext *C)
+bool ED_space_clip_tracking_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -107,7 +107,7 @@ int ED_space_clip_tracking_poll(bContext *C)
return false;
}
-int ED_space_clip_maskedit_poll(bContext *C)
+bool ED_space_clip_maskedit_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -118,7 +118,7 @@ int ED_space_clip_maskedit_poll(bContext *C)
return false;
}
-int ED_space_clip_maskedit_mask_poll(bContext *C)
+bool ED_space_clip_maskedit_mask_poll(bContext *C)
{
if (ED_space_clip_maskedit_poll(C)) {
MovieClip *clip = CTX_data_edit_movieclip(C);
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 8d29cb73a68..d463f585470 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -45,6 +45,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_types.h"
@@ -80,11 +81,11 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track,
if (track == data->act_track) {
col[3] = 1.0f;
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
}
else {
col[3] = 0.5f;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
}
immUniformColor4fv(col);
@@ -152,13 +153,13 @@ static void draw_tracks_motion_curves(View2D *v2d, SpaceClip *sc, unsigned int p
(sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,
&userdata, tracking_segment_knot_cb, NULL, NULL);
/* draw graph lines */
- glEnable(GL_BLEND);
+ GPU_blend(true);
clip_graph_tracking_values_iterate(sc,
(sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0,
(sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0,
&userdata, tracking_segment_point_cb, tracking_segment_start_cb,
tracking_segment_end_cb);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* selected knot handles on top of curves */
userdata.sel = true;
@@ -226,11 +227,11 @@ static void tracking_error_segment_start_cb(void *userdata, MovieTrackingTrack *
if (track == data->active_track) {
col[3] = 1.0f;
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
}
else {
col[3] = 0.5f;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
}
immUniformColor4fv(col);
@@ -330,7 +331,7 @@ void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glPointSize(3.0f);
+ GPU_point_size(3.0f);
if (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) {
draw_tracks_motion_curves(v2d, sc, pos);
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index 02ea340eb57..b5a0e374431 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -55,7 +55,7 @@
/******************** common graph-editing utilities ********************/
-static int ED_space_clip_graph_poll(bContext *C)
+static bool ED_space_clip_graph_poll(bContext *C)
{
if (ED_space_clip_tracking_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -66,7 +66,7 @@ static int ED_space_clip_graph_poll(bContext *C)
return false;
}
-static int clip_graph_knots_poll(bContext *C)
+static bool clip_graph_knots_poll(bContext *C)
{
if (ED_space_clip_graph_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 498a4d6fbbd..26327dc9b41 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -468,7 +468,7 @@ static void view_pan_cancel(bContext *C, wmOperator *op)
void CLIP_OT_view_pan(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "View Pan";
+ ot->name = "Pan View";
ot->idname = "CLIP_OT_view_pan";
ot->description = "Pan the view";
@@ -899,7 +899,7 @@ void CLIP_OT_view_selected(wmOperatorType *ot)
/********************** change frame operator *********************/
-static int change_frame_poll(bContext *C)
+static bool change_frame_poll(bContext *C)
{
/* prevent changes during render */
if (G.is_rendering)
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index 3e4d0cd5bb4..304954b56e3 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -87,7 +87,7 @@ ARegion *ED_clip_has_properties_region(ScrArea *sa)
return arnew;
}
-static int properties_poll(bContext *C)
+static bool properties_poll(bContext *C)
{
return (CTX_wm_space_clip(C) != NULL);
}
@@ -151,7 +151,7 @@ static ARegion *clip_has_tools_region(ScrArea *sa)
return artool;
}
-static int tools_poll(bContext *C)
+static bool tools_poll(bContext *C)
{
return (CTX_wm_space_clip(C) != NULL);
}
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index a666b20dfa4..c3208260b3b 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -46,6 +46,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -269,8 +270,8 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
UI_view2d_view_ortho(v2d);
/* currently clip editor supposes that editing clip length is equal to scene frame range */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -279,12 +280,12 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
immRectf(pos, (float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUniformThemeColorShade(TH_BACK, -60);
/* thin lines where the actual frames are */
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, (float)SFRA, v2d->cur.ymin);
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index b050e991140..c66a9a42292 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -63,6 +63,7 @@
#include "GPU_glew.h"
#include "GPU_matrix.h"
+#include "GPU_framebuffer.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -660,8 +661,8 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
/* marker */
WM_keymap_add_item(keymap, "CLIP_OT_add_marker_slide", LEFTMOUSE, KM_PRESS, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", DELKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", XKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", DELKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CLIP_OT_slide_marker", LEFTMOUSE, KM_PRESS, 0, 0);
@@ -669,8 +670,8 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "action", 2); /* toggle */
/* tracks */
- WM_keymap_add_item(keymap, "CLIP_OT_delete_track", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CLIP_OT_delete_track", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "CLIP_OT_delete_track", DELKEY, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_CTRL, 0);
RNA_enum_set(kmi->ptr, "action", 0); /* lock */
@@ -769,11 +770,11 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "CLIP_OT_graph_select_border", BKEY, KM_PRESS, 0, 0);
/* delete */
- WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", DELKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", DELKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_knot", DELKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_knot", XKEY, KM_PRESS, KM_SHIFT, 0);
+ WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_knot", DELKEY, KM_PRESS, KM_SHIFT, 0);
/* view */
WM_keymap_add_item(keymap, "CLIP_OT_graph_view_all", HOMEKEY, KM_PRESS, 0, 0);
@@ -842,7 +843,7 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
}
/* dropboxes */
-static int clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_PATH)
if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
@@ -1146,7 +1147,7 @@ static void clip_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
/* data... */
movieclip_main_area_set_view2d(C, ar);
@@ -1253,7 +1254,7 @@ static void graph_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1295,7 +1296,7 @@ static void dopesheet_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1368,7 +1369,7 @@ static void clip_channels_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index bfce5a862d0..42077280cca 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -155,8 +155,8 @@ static int add_marker_at_click_invoke(bContext *C,
wmOperator *op,
const wmEvent *UNUSED(event))
{
- ED_area_headerprint(
- CTX_wm_area(C),
+ ED_workspace_status_text(
+ C,
IFACE_("Use LMB click to define location where place the marker"));
/* Add modal handler for ESC. */
@@ -180,7 +180,7 @@ static int add_marker_at_click_modal(bContext *C,
ARegion *ar = CTX_wm_region(C);
float pos[2];
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
ED_clip_point_stable_pos(sc, ar,
event->x - ar->winrct.xmin,
@@ -196,7 +196,7 @@ static int add_marker_at_click_modal(bContext *C,
}
case ESCKEY:
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
return OPERATOR_CANCELLED;
}
@@ -2107,7 +2107,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
/********************* paste tracks from clipboard operator ********************/
-static int paste_tracks_poll(bContext *C)
+static bool paste_tracks_poll(bContext *C)
{
if (ED_space_clip_tracking_poll(C)) {
return BKE_tracking_clipboard_has_tracks();
diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c
index 3db52e6a39b..4d1c3e0b137 100644
--- a/source/blender/editors/space_clip/tracking_ops_orient.c
+++ b/source/blender/editors/space_clip/tracking_ops_orient.c
@@ -108,7 +108,7 @@ static Object *get_orientation_object(bContext *C)
return object;
}
-static int set_orientation_poll(bContext *C)
+static bool set_orientation_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc != NULL) {
@@ -754,7 +754,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
/********************** set solution scale operator *********************/
-static int set_solution_scale_poll(bContext *C)
+static bool set_solution_scale_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc != NULL) {
@@ -814,7 +814,7 @@ void CLIP_OT_set_solution_scale(wmOperatorType *ot)
/********************** apply solution scale operator *********************/
-static int apply_solution_scale_poll(bContext *C)
+static bool apply_solution_scale_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc != NULL) {
diff --git a/source/blender/editors/space_clip/tracking_ops_stabilize.c b/source/blender/editors/space_clip/tracking_ops_stabilize.c
index 4eb6a4fbb24..2888607a049 100644
--- a/source/blender/editors/space_clip/tracking_ops_stabilize.c
+++ b/source/blender/editors/space_clip/tracking_ops_stabilize.c
@@ -50,7 +50,7 @@
/********************* add 2d stabilization tracks operator ********************/
-static int stabilize_2d_poll(bContext *C)
+static bool stabilize_2d_poll(bContext *C)
{
if (ED_space_clip_tracking_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
@@ -345,4 +345,3 @@ void CLIP_OT_stabilize_2d_rotation_select(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
-
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index ecbc1f5ae1e..cf4687dca31 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -350,7 +350,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
return OPERATOR_FINISHED;
}
-static int select_poll(bContext *C)
+static bool select_poll(bContext *C)
{
SpaceClip *sc = CTX_wm_space_clip(C);
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index c65c9a175a0..4b577a7cb7e 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -49,6 +49,7 @@
#include "UI_view2d.h"
#include "console_intern.h" // own include
+#include "GPU_framebuffer.h"
/* ******************** default callbacks for console space ***************** */
@@ -169,7 +170,7 @@ static void console_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
/* ************* dropboxes ************* */
-static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
// SpaceConsole *sc = CTX_wm_space_console(C);
if (drag->type == WM_DRAG_ID)
@@ -188,7 +189,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
MEM_freeN(text);
}
-static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
// SpaceConsole *sc = CTX_wm_space_console(C);
if (drag->type == WM_DRAG_PATH)
@@ -227,7 +228,7 @@ static void console_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
/* worlks best with no view2d matrix set */
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 360009d3ea4..4d4845c41b9 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -74,6 +74,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
+#include "GPU_state.h"
#include "filelist.h"
@@ -377,14 +378,14 @@ static void file_draw_preview(
xco = sx + (int)dx;
yco = sy - layout->prv_h + (int)dy;
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* shadow */
if (use_dropshadow) {
UI_draw_box_shadow(220, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* the image */
if (!is_icon && typeflags & FILE_TYPE_FTFONT) {
@@ -419,7 +420,7 @@ static void file_draw_preview(
UI_but_drag_set_image(but, BLI_strdup(path), icon, imb, scale, true);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index 742715039cf..6eaf2dda084 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -130,4 +130,3 @@ void file_panels_register(struct ARegionType *art);
void file_tile_boundbox(const ARegion *ar, FileLayout *layout, const int file, rcti *r_bounds);
#endif /* __FILE_INTERN_H__ */
-
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 0cd31ce7ca5..7c080044aee 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -458,7 +458,7 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
void FILE_OT_select_border(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Activate/Select File";
+ ot->name = "Border Select";
ot->description = "Activate/select the file(s) contained in the border";
ot->idname = "FILE_OT_select_border";
@@ -527,7 +527,7 @@ void FILE_OT_select(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name = "Activate/Select File";
+ ot->name = "Select";
ot->description = "Activate/select file";
ot->idname = "FILE_OT_select";
@@ -1179,9 +1179,9 @@ int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
return OPERATOR_FINISHED;
}
-static int file_operator_poll(bContext *C)
+static bool file_operator_poll(bContext *C)
{
- int poll = ED_operator_file_active(C);
+ bool poll = ED_operator_file_active(C);
SpaceFile *sfile = CTX_wm_space_file(C);
if (!sfile || !sfile->op) poll = 0;
@@ -2202,7 +2202,7 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
}
-static int file_rename_poll(bContext *C)
+static bool file_rename_poll(bContext *C)
{
bool poll = ED_operator_file_active(C);
SpaceFile *sfile = CTX_wm_space_file(C);
@@ -2248,9 +2248,9 @@ void FILE_OT_rename(struct wmOperatorType *ot)
}
-static int file_delete_poll(bContext *C)
+static bool file_delete_poll(bContext *C)
{
- int poll = ED_operator_file_active(C);
+ bool poll = ED_operator_file_active(C);
SpaceFile *sfile = CTX_wm_space_file(C);
if (sfile && sfile->params) {
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 78bbe3aea58..812a671ff33 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -57,7 +57,7 @@
#include <string.h>
-static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceFile *sfile = CTX_wm_space_file(C);
return (sfile && sfile->op);
@@ -107,4 +107,3 @@ void file_panels_register(ARegionType *art)
pt->draw = file_panel_operator;
BLI_addtail(&art->paneltypes, pt);
}
-
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index 4e9c1e0dd1d..76845c44226 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -127,4 +127,3 @@ bool filelist_cache_previews_running(struct FileList *filelist);
#endif
#endif
-
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index 85804538e19..bb201a7a80c 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -80,4 +80,3 @@ void fsmenu_refresh_bookmarks_status(struct FSMenu *fsmenu);
int fsmenu_get_active_indices(struct FSMenu *fsmenu, enum FSMenuCategory category, const char *dir);
#endif
-
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 7b045a42595..853d31edebf 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -65,6 +65,7 @@
#include "file_intern.h" // own include
#include "fsmenu.h"
#include "filelist.h"
+#include "GPU_framebuffer.h"
/* ******************** default callbacks for file space ***************** */
@@ -408,8 +409,8 @@ static void file_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
/* Allow dynamically sliders to be set, saves notifiers etc. */
@@ -505,6 +506,7 @@ static void file_keymap(struct wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", HKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "space_data.params.show_hidden");
WM_keymap_add_item(keymap, "FILE_OT_directory_new", IKEY, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "FILE_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "FILE_OT_delete", DELKEY, KM_PRESS, 0, 0);
@@ -687,8 +689,8 @@ static void file_ui_region_draw(const bContext *C, ARegion *ar)
float col[3];
/* clear */
UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
/* scrolling here is just annoying, disable it */
ar->v2d.cur.ymax = BLI_rctf_size_y(&ar->v2d.cur);
@@ -719,7 +721,7 @@ static void file_ui_region_listener(
}
}
-static int filepath_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
+static bool filepath_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_PATH) {
SpaceFile *sfile = CTX_wm_space_file(C);
@@ -854,4 +856,3 @@ void ED_file_read_bookmarks(void)
fsmenu_read_bookmarks(ED_fsmenu_get(), name);
}
}
-
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 2a0d5baa5c3..4162e6dec92 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -103,7 +103,7 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **
return 1;
}
-static int graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
return graph_panel_context(C, NULL, NULL);
}
@@ -564,7 +564,7 @@ static void driver_update_flags_cb(bContext *UNUSED(C), void *fcu_v, void *UNUSE
}
/* drivers panel poll */
-static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceIpo *sipo = CTX_wm_space_graph(C);
@@ -1016,7 +1016,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
/* ----------------------------------------------------------------- */
/* poll to make this not show up in the graph editor, as this is only to be used as a popup elsewhere */
-static int graph_panel_drivers_popover_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool graph_panel_drivers_popover_poll(const bContext *C, PanelType *UNUSED(pt))
{
return ED_operator_graphedit_active((bContext *)C) == false;
}
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 7c6af0b4c62..b08ff8dcfa1 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -51,6 +51,7 @@
#include "GPU_draw.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_anim_api.h"
@@ -87,15 +88,15 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* Simple dashes. */
+ immUniform1i("colors_len", 0); /* Simple dashes. */
immUniformColor3f(0.0f, 0.0f, 0.0f);
immUniform1f("dash_width", 10.0f);
immUniform1f("dash_factor", 0.5f);
@@ -114,7 +115,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
if (env->totvert > 0) {
/* set size of vertices (non-adjustable for now) */
- glPointSize(2.0f);
+ GPU_point_size(2.0f);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -281,7 +282,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- glEnable(GL_BLEND);
+ GPU_blend(true);
GPU_enable_program_point_size();
/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
@@ -293,7 +294,7 @@ static void draw_fcurve_vertices(ARegion *ar, FCurve *fcu, bool do_handles, bool
draw_fcurve_keyframe_vertices(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), pos);
GPU_disable_program_point_size();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* Handles ---------------- */
@@ -449,8 +450,8 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
/* draw */
if (first && last) {
/* anti-aliased lines for more consistent appearance */
- if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) GPU_line_smooth(true);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -462,8 +463,8 @@ static void draw_fcurve_samples(SpaceIpo *sipo, ARegion *ar, FCurve *fcu)
immUnbindProgram();
- glDisable(GL_BLEND);
- if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
+ GPU_blend(false);
+ if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) GPU_line_smooth(false);
}
}
@@ -846,10 +847,10 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* Simple dashes. */
+ immUniform1i("colors_len", 0); /* Simple dashes. */
/* No curve to modify/visualize the result?
* => We still want to show the 1-1 default...
@@ -862,7 +863,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
immUniform1f("dash_width", 40.0f);
immUniform1f("dash_factor", 0.5f);
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
/* draw 1-1 line, stretching just past the screen limits
* NOTE: we need to scale the y-values to be valid for the units
@@ -925,7 +926,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* x marks the spot .................................................... */
/* -> outer frame */
immUniformColor3f(0.9f, 0.9f, 0.9f);
- glPointSize(7.0);
+ GPU_point_size(7.0);
immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(shdr_pos, x, y);
@@ -933,7 +934,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* inner frame */
immUniformColor3f(0.9f, 0.0f, 0.0f);
- glPointSize(3.0);
+ GPU_point_size(3.0);
immBegin(GWN_PRIM_POINTS, 1);
immVertex2f(shdr_pos, x, y);
@@ -954,23 +955,23 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
FCurve *fcu;
/* draw with thick dotted lines */
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* Simple dashes. */
+ immUniform1i("colors_len", 0); /* Simple dashes. */
immUniform1f("dash_width", 20.0f);
immUniform1f("dash_factor", 0.5f);
@@ -989,9 +990,9 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* This is called twice from space_graph.c -> graph_main_region_draw()
@@ -1036,27 +1037,27 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
/* set color/drawing style for curve itself */
/* draw active F-Curve thicker than the rest to make it stand out */
if (fcu->flag & FCURVE_ACTIVE) {
- glLineWidth(2.5);
+ GPU_line_width(2.5);
}
else {
- glLineWidth(1.0);
+ GPU_line_width(1.0);
}
/* anti-aliased lines for less jagged appearance */
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* Simple dashes. */
+ immUniform1i("colors_len", 0); /* Simple dashes. */
if (BKE_fcurve_is_protected(fcu)) {
/* protected curves (non editable) are drawn with dotted lines */
@@ -1104,9 +1105,9 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
immUnbindProgram();
if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) {
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* 2) draw handles and vertices as appropriate based on active
@@ -1134,16 +1135,16 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
gpuTranslate2f(0.0f, offset);
/* set this once and for all - all handles and handle-verts should use the same thickness */
- glLineWidth(1.0);
+ GPU_line_width(1.0);
if (fcu->bezt) {
bool do_handles = draw_fcurve_handles_check(sipo, fcu);
if (do_handles) {
/* only draw handles/vertices on keyframes */
- glEnable(GL_BLEND);
+ GPU_blend(true);
draw_fcurve_handles(sipo, fcu);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
draw_fcurve_vertices(ar, fcu, do_handles, (sipo->flag & SIPO_SELVHANDLESONLY));
@@ -1229,8 +1230,8 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
y = (float)ACHANNEL_FIRST(ac);
/* set blending again, as may not be set in previous step */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
for (ale = anim_data.first, i = 0; ale; ale = ale->next, i++) {
const float yminc = (float)(y - ACHANNEL_HEIGHT_HALF(ac));
@@ -1252,7 +1253,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
UI_block_end(C, block);
UI_block_draw(C, block);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* free tempolary channels */
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 26a6e93ba57..b10141929d5 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -1973,7 +1973,7 @@ void GRAPH_OT_euler_filter(wmOperatorType *ot)
/* ***************** Jump to Selected Frames Operator *********************** */
-static int graphkeys_framejump_poll(bContext *C)
+static bool graphkeys_framejump_poll(bContext *C)
{
/* prevent changes during render */
if (G.is_rendering)
@@ -2808,7 +2808,7 @@ static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int graph_driver_delete_invalid_poll(bContext *C)
+static bool graph_driver_delete_invalid_poll(bContext *C)
{
bAnimContext ac;
ScrArea *sa = CTX_wm_area(C);
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index da352d4ea06..c50e0497519 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -170,10 +170,10 @@ void graph_buttons_register(struct ARegionType *art);
struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac);
-int graphop_visible_keyframes_poll(struct bContext *C);
-int graphop_editable_keyframes_poll(struct bContext *C);
-int graphop_active_fcurve_poll(struct bContext *C);
-int graphop_selected_fcurve_poll(struct bContext *C);
+bool graphop_visible_keyframes_poll(struct bContext *C);
+bool graphop_editable_keyframes_poll(struct bContext *C);
+bool graphop_active_fcurve_poll(struct bContext *C);
+bool graphop_selected_fcurve_poll(struct bContext *C);
/* ***************************************** */
/* graph_ops.c */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index bae5798ca21..8ac2c61b8e9 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -67,7 +67,7 @@
* 2) Value Indicator (stored per Graph Editor instance)
*/
-static int graphview_cursor_poll(bContext *C)
+static bool graphview_cursor_poll(bContext *C)
{
/* prevent changes during render */
if (G.is_rendering)
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index ed9bed19d20..9a6b733a5ff 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -1530,7 +1530,7 @@ void GRAPH_OT_clickselect(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name = "Mouse Select Keys";
+ ot->name = "Select Keyframes";
ot->idname = "GRAPH_OT_clickselect";
ot->description = "Select keyframes by clicking on them";
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index f55a5511e2d..4adb95677b0 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -44,17 +44,62 @@
#include "BKE_context.h"
#include "BKE_fcurve.h"
+#include "BKE_screen.h"
#include "WM_api.h"
#include "ED_anim_api.h"
+#include "ED_screen.h"
+#include "UI_interface.h"
#include "graph_intern.h" // own include
/* ************************************************************** */
+/* Set Up Drivers Editor */
+
+/* Set up UI configuration for Drivers Editor */
+/* NOTE: Currently called from windowmanager (new drivers editor window) and RNA (mode switching) */
+void ED_drivers_editor_init(bContext *C, ScrArea *sa)
+{
+ SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
+
+ /* Set mode */
+ sipo->mode = SIPO_MODE_DRIVERS;
+
+ /* Show Properties Region (or else the settings can't be edited) */
+ ARegion *ar_props = BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ if (ar_props) {
+ UI_panel_category_active_set(ar_props, "Drivers");
+
+ ar_props->flag &= ~RGN_FLAG_HIDDEN;
+ /* XXX: Adjust width of this too? */
+
+ ED_region_visibility_change_update(C, ar_props);
+ }
+ else {
+ printf("%s: Couldn't find properties region for Drivers Editor - %p\n", __func__, sa);
+ }
+
+ /* Adjust framing in graph region */
+ /* TODO: Have a way of not resetting this every time?
+ * (e.g. So that switching back and forth between editors doesn't keep jumping?)
+ */
+ ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (ar_main) {
+ /* XXX: Ideally we recenter based on the range instead... */
+ ar_main->v2d.tot.xmin = -2.0f;
+ ar_main->v2d.tot.ymin = -2.0f;
+ ar_main->v2d.tot.xmax = 2.0f;
+ ar_main->v2d.tot.ymax = 2.0f;
+
+ ar_main->v2d.cur = ar_main->v2d.tot;
+ }
+}
+
+/* ************************************************************** */
/* Active F-Curve */
/* Find 'active' F-Curve. It must be editable, since that's the purpose of these buttons (subject to change).
@@ -90,7 +135,7 @@ bAnimListElem *get_active_fcurve_channel(bAnimContext *ac)
/* Operator Polling Callbacks */
/* Check if there are any visible keyframes (for selection tools) */
-int graphop_visible_keyframes_poll(bContext *C)
+bool graphop_visible_keyframes_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -139,7 +184,7 @@ int graphop_visible_keyframes_poll(bContext *C)
}
/* Check if there are any visible + editable keyframes (for editing tools) */
-int graphop_editable_keyframes_poll(bContext *C)
+bool graphop_editable_keyframes_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -189,7 +234,7 @@ int graphop_editable_keyframes_poll(bContext *C)
}
/* has active F-Curve that's editable */
-int graphop_active_fcurve_poll(bContext *C)
+bool graphop_active_fcurve_poll(bContext *C)
{
bAnimContext ac;
bAnimListElem *ale;
@@ -229,7 +274,7 @@ int graphop_active_fcurve_poll(bContext *C)
}
/* has selected F-Curve that's editable */
-int graphop_selected_fcurve_poll(bContext *C)
+bool graphop_selected_fcurve_poll(bContext *C)
{
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index d208ead317b..878c4815f73 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -54,12 +54,16 @@
#include "ED_markers.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
+#include "GPU_framebuffer.h"
#include "WM_api.h"
#include "WM_types.h"
#include "WM_message.h"
#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "UI_resources.h"
#include "UI_view2d.h"
@@ -238,8 +242,8 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -285,15 +289,15 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* Draw a green line to indicate the cursor value */
immUniformThemeColorShadeAlpha(TH_CFRAME, -10, -50);
- glEnable(GL_BLEND);
- glLineWidth(2.0);
+ GPU_blend(true);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, v2d->cur.xmin, y);
immVertex2f(pos, v2d->cur.xmax, y);
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* current frame or vertical component of vertical component of the cursor */
@@ -303,15 +307,15 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
/* to help differentiate this from the current frame, draw slightly darker like the horizontal one */
immUniformThemeColorShadeAlpha(TH_CFRAME, -40, -50);
- glEnable(GL_BLEND);
- glLineWidth(2.0);
+ GPU_blend(true);
+ GPU_line_width(2.0);
immBegin(GWN_PRIM_LINES, 2);
immVertex2f(pos, x, v2d->cur.ymin);
immVertex2f(pos, x, v2d->cur.ymax);
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -379,8 +383,8 @@ static void graph_channel_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -799,6 +803,24 @@ static void graph_id_remap(ScrArea *UNUSED(sa), SpaceLink *slink, ID *old_id, ID
}
}
+static int graph_space_subtype_get(ScrArea *sa)
+{
+ SpaceIpo *sgraph = sa->spacedata.first;
+ return sgraph->mode;
+}
+
+static void graph_space_subtype_set(ScrArea *sa, int value)
+{
+ SpaceIpo *sgraph = sa->spacedata.first;
+ sgraph->mode = value;
+}
+
+static void graph_space_subtype_item_extend(
+ bContext *UNUSED(C), EnumPropertyItem **item, int *totitem)
+{
+ RNA_enum_items_add(item, totitem, rna_enum_space_graph_mode_items);
+}
+
/* only called once, from space/spacetypes.c */
void ED_spacetype_ipo(void)
{
@@ -817,6 +839,9 @@ void ED_spacetype_ipo(void)
st->listener = graph_listener;
st->refresh = graph_refresh;
st->id_remap = graph_id_remap;
+ st->space_subtype_item_extend = graph_space_subtype_item_extend;
+ st->space_subtype_get = graph_space_subtype_get;
+ st->space_subtype_set = graph_space_subtype_set;
/* regions: main window */
art = MEM_callocN(sizeof(ARegionType), "spacetype graphedit region");
@@ -867,4 +892,3 @@ void ED_spacetype_ipo(void)
BKE_spacetype_register(st);
}
-
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 7236a99ad80..191f57961c9 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -710,7 +710,7 @@ static void uiblock_layer_pass_buttons(
if (render_slot) {
char str[64];
RenderSlot *slot = BKE_image_get_renderslot(image, *render_slot);
- if (slot->name[0] != '\0') {
+ if (slot && slot->name[0] != '\0') {
BLI_strncpy(str, slot->name, sizeof(str));
}
else {
@@ -827,7 +827,7 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
RNA_property_update(C, &cb->ptr, cb->prop);
}
-void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, int compact, int multiview)
+void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, bool compact, bool multiview)
{
PropertyRNA *prop;
PointerRNA imaptr;
@@ -1063,7 +1063,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
MEM_freeN(cb);
}
-void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_management)
+void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_management)
{
ImageFormatData *imf = imfptr->data;
ID *id = imfptr->id.data;
@@ -1349,4 +1349,3 @@ void IMAGE_OT_toolshelf(wmOperatorType *ot)
/* flags */
ot->flag = 0;
}
-
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 1e2d668018f..f70efa00244 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -65,6 +65,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "BLF_api.h"
@@ -130,7 +131,7 @@ static void draw_render_info(const bContext *C,
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_FACE_SELECT);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
rcti *tile = tiles;
for (int i = 0; i < total_tiles; i++, tile++) {
@@ -170,8 +171,8 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0;
float col[4], finalcol[4];
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -182,7 +183,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi);
@@ -323,7 +324,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
copy_v4_v4(finalcol, col);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
dx += 0.25f * UI_UNIT_X;
BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), 0.15f * UI_UNIT_Y, 0.85f * UI_UNIT_Y);
@@ -354,10 +355,10 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
immRecti(pos, color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax);
immRecti(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor3fvAlpha(finalcol, fp ? fp[3] : (cp[3] / 255.0f));
immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
else {
immUniformColor3fv(finalcol);
@@ -503,8 +504,8 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
if (sima->flag & SI_USE_ALPHA) {
imm_draw_box_checker_2d(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
/* If RGBA display with color management */
@@ -544,7 +545,7 @@ static void draw_image_buffer(const bContext *C, SpaceImage *sima, ARegion *ar,
}
if (sima->flag & SI_USE_ALPHA)
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -578,10 +579,10 @@ void draw_image_sample_line(SpaceImage *sima)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 2); /* Advanced dashes. */
+ immUniform1i("colors_len", 2); /* Advanced dashes. */
immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2);
immUniform1f("dash_width", 2.0f);
@@ -618,13 +619,13 @@ static void draw_image_paint_helpers(const bContext *C, ARegion *ar, Scene *scen
return;
}
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex(&state, x, y, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, display_buffer, zoomx, zoomy, col);
- glDisable(GL_BLEND);
+ GPU_blend(false);
BKE_image_release_ibuf(brush->clone.image, ibuf, NULL);
IMB_display_buffer_release(cache_handle);
@@ -758,8 +759,8 @@ void draw_image_cache(const bContext *C, ARegion *ar)
mask = ED_space_image_get_mask(sima);
}
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* Draw cache background. */
ED_region_cache_draw_background(ar);
@@ -773,7 +774,7 @@ void draw_image_cache(const bContext *C, ARegion *ar)
ED_region_cache_draw_cached_segments(ar, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* Draw current frame. */
x = (cfra - sfra) / (efra - sfra + 1) * ar->winx;
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c
index f4ecd2e7d34..4388accc534 100644
--- a/source/blender/editors/space_image/image_edit.c
+++ b/source/blender/editors/space_image/image_edit.c
@@ -388,7 +388,7 @@ bool ED_space_image_check_show_maskedit(SpaceImage *sima, ViewLayer *view_layer)
return (sima->mode == SI_MODE_MASK);
}
-int ED_space_image_maskedit_poll(bContext *C)
+bool ED_space_image_maskedit_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
@@ -415,7 +415,7 @@ bool ED_space_image_paint_curve(const bContext *C)
}
-int ED_space_image_maskedit_mask_poll(bContext *C)
+bool ED_space_image_maskedit_mask_poll(bContext *C)
{
if (ED_space_image_maskedit_poll(C)) {
SpaceImage *sima = CTX_wm_space_image(C);
@@ -424,4 +424,3 @@ int ED_space_image_maskedit_mask_poll(bContext *C)
return false;
}
-
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 49c2690daaf..5d9c496d584 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -54,7 +54,7 @@ void draw_image_grease_pencil(struct bContext *C, bool onlyv2d);
void draw_image_sample_line(struct SpaceImage *sima);
/* image_ops.c */
-int space_image_main_region_poll(struct bContext *C);
+bool space_image_main_region_poll(struct bContext *C);
void IMAGE_OT_view_all(struct wmOperatorType *ot);
void IMAGE_OT_view_pan(struct wmOperatorType *ot);
@@ -104,4 +104,3 @@ void IMAGE_OT_properties(struct wmOperatorType *ot);
void IMAGE_OT_toolshelf(struct wmOperatorType *ot);
#endif /* __IMAGE_INTERN_H__ */
-
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index b2116b1a770..3efdce3ea6d 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -57,7 +57,6 @@
#include "BKE_colortools.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_icons.h"
#include "BKE_image.h"
#include "BKE_global.h"
@@ -180,13 +179,13 @@ static void sima_zoom_set_from_bounds(SpaceImage *sima, ARegion *ar, const rctf
}
#if 0 // currently unused
-static int image_poll(bContext *C)
+static bool image_poll(bContext *C)
{
return (CTX_data_edit_image(C) != NULL);
}
#endif
-static int space_image_buffer_exists_poll(bContext *C)
+static bool space_image_buffer_exists_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
if (sima && ED_space_image_has_buffer(sima)) {
@@ -195,7 +194,7 @@ static int space_image_buffer_exists_poll(bContext *C)
return false;
}
-static int image_not_packed_poll(bContext *C)
+static bool image_not_packed_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
@@ -214,7 +213,7 @@ static bool imbuf_format_writeable(const ImBuf *ibuf)
return (BKE_image_imtype_to_ftype(im_format.imtype, &options_dummy) == ibuf->ftype);
}
-static int space_image_file_exists_poll(bContext *C)
+static bool space_image_file_exists_poll(bContext *C)
{
if (space_image_buffer_exists_poll(C)) {
Main *bmain = CTX_data_main(C);
@@ -250,7 +249,7 @@ static int space_image_file_exists_poll(bContext *C)
}
#if 0 /* UNUSED */
-static int space_image_poll(bContext *C)
+static bool space_image_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
if (sima && sima->image) {
@@ -260,7 +259,7 @@ static int space_image_poll(bContext *C)
}
#endif
-int space_image_main_region_poll(bContext *C)
+bool space_image_main_region_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
/* XXX ARegion *ar = CTX_wm_region(C); */
@@ -272,7 +271,7 @@ int space_image_main_region_poll(bContext *C)
}
/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */
-static int space_image_main_area_not_uv_brush_poll(bContext *C)
+static bool space_image_main_area_not_uv_brush_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
@@ -285,7 +284,7 @@ static int space_image_main_area_not_uv_brush_poll(bContext *C)
return 0;
}
-static int image_sample_poll(bContext *C)
+static bool image_sample_poll(bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
if (sima) {
@@ -423,7 +422,7 @@ static void image_view_pan_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_view_pan(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "View Pan";
+ ot->name = "Pan View";
ot->idname = "IMAGE_OT_view_pan";
ot->description = "Pan the view";
@@ -639,7 +638,7 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name = "View Zoom";
+ ot->name = "Zoom View";
ot->idname = "IMAGE_OT_view_zoom";
ot->description = "Zoom in/out the image";
@@ -834,7 +833,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int image_view_selected_poll(bContext *C)
+static bool image_view_selected_poll(bContext *C)
{
return (space_image_main_region_poll(C) && (ED_operator_uvedit(C) || ED_operator_mask(C)));
}
@@ -2158,7 +2157,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op)
uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr);
}
-static int image_save_as_poll(bContext *C)
+static bool image_save_as_poll(bContext *C)
{
if (space_image_buffer_exists_poll(C)) {
if (G.is_rendering) {
@@ -2601,7 +2600,7 @@ void IMAGE_OT_new(wmOperatorType *ot)
/********************* invert operators *********************/
-static int image_invert_poll(bContext *C)
+static bool image_invert_poll(bContext *C)
{
Image *ima = CTX_data_edit_image(C);
@@ -3445,7 +3444,7 @@ void IMAGE_OT_record_composite(wmOperatorType *ot)
/********************* cycle render slot operator *********************/
-static int image_cycle_render_slot_poll(bContext *C)
+static bool image_cycle_render_slot_poll(bContext *C)
{
Image *ima = CTX_data_edit_image(C);
@@ -3581,7 +3580,7 @@ void IMAGE_OT_remove_render_slot(wmOperatorType *ot)
/********************** change frame operator *********************/
-static int change_frame_poll(bContext *C)
+static bool change_frame_poll(bContext *C)
{
/* prevent changes during render */
if (G.is_rendering)
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index e84b596530e..907b7e51c42 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -79,6 +79,7 @@
#include "UI_view2d.h"
#include "image_intern.h"
+#include "GPU_framebuffer.h"
/**************************** common state *****************************/
@@ -301,7 +302,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "IMAGE_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_read_viewlayers", RKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
- WM_keymap_add_item(keymap, "IMAGE_OT_save_as", F3KEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "IMAGE_OT_save_as", SKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_properties", NKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "IMAGE_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
@@ -386,7 +387,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
}
/* dropboxes */
-static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_PATH)
if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
@@ -722,8 +723,8 @@ static void image_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
image_user_refresh_scene(C, sima);
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index 9421567b6ba..ecd0b082df6 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -51,6 +51,7 @@
#include "info_intern.h"
#include "textview.h"
+#include "GPU_framebuffer.h"
/* complicates things a bit, so leaving in old simple code */
#define USE_INFO_NEWLINE
@@ -130,7 +131,7 @@ static int report_textview_begin(TextViewContext *tvc)
tvc->iter = reports->list.last;
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
#ifdef USE_INFO_NEWLINE
tvc->iter_tmp = 0;
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 481c9031a73..3830e6d2792 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -34,6 +34,7 @@
#include "DNA_curve_types.h"
#include "DNA_group_types.h"
#include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_scene_types.h"
@@ -48,7 +49,6 @@
#include "BKE_blender_version.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_key.h"
#include "BKE_layer.h"
#include "BKE_paint.h"
@@ -92,15 +92,15 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
switch (ob->type) {
case OB_MESH:
{
- /* we assume derivedmesh is already built, this strictly does stats now. */
- DerivedMesh *dm = ob->derivedFinal;
+ /* we assume evaluated mesh is already built, this strictly does stats now. */
+ Mesh *me_eval = ob->runtime.mesh_eval;
int totvert, totedge, totface, totloop;
- if (dm) {
- totvert = dm->getNumVerts(dm);
- totedge = dm->getNumEdges(dm);
- totface = dm->getNumPolys(dm);
- totloop = dm->getNumLoops(dm);
+ if (me_eval) {
+ totvert = me_eval->totvert;
+ totedge = me_eval->totedge;
+ totface = me_eval->totpoly;
+ totloop = me_eval->totloop;
stats->totvert += totvert * totob;
stats->totedge += totedge * totob;
@@ -387,7 +387,7 @@ static void stats_update(ViewLayer *view_layer)
else {
/* Objects */
for (base = view_layer->object_bases.first; base; base = base->next)
- if (base->flag & BASE_VISIBLED) {
+ if (base->flag & BASE_VISIBLE) {
stats_dupli_object(base, base->object, &stats);
}
}
@@ -471,7 +471,9 @@ static void stats_string(ViewLayer *view_layer)
s = stats->infostr;
ofs = 0;
- ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", versionstr);
+ if (ob) {
+ ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, "%s | ", ob->id.name + 2);
+ }
if (obedit) {
if (BKE_keyblock_from_object(obedit))
@@ -505,15 +507,13 @@ static void stats_string(ViewLayer *view_layer)
}
else {
ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs,
- IFACE_("Verts:%s | Faces:%s | Tris:%s | Objects:%s/%s | Lamps:%s/%s%s%s"),
+ IFACE_("Verts:%s | Faces:%s | Tris:%s | Objects:%s/%s%s%s"),
stats_fmt.totvert, stats_fmt.totface,
stats_fmt.tottri, stats_fmt.totobjsel,
- stats_fmt.totobj, stats_fmt.totlampsel,
- stats_fmt.totlamp, memstr, gpumemstr);
+ stats_fmt.totobj, memstr, gpumemstr);
}
- if (ob)
- BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", ob->id.name + 2);
+ ofs += BLI_snprintf(s + ofs, MAX_INFO_LEN - ofs, " | %s", versionstr);
#undef MAX_INFO_MEM_LEN
}
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 65b3c7bb9fd..5f9de037409 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -60,6 +60,7 @@
#include "info_intern.h" /* own include */
#include "BLO_readfile.h"
+#include "GPU_framebuffer.h"
/* ******************** default callbacks for info space ***************** */
@@ -157,7 +158,7 @@ static void info_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
/* quick way to avoid drawing if not bug enough */
if (ar->winy < 16)
@@ -220,8 +221,10 @@ static void info_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "INFO_OT_select_border", BKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "INFO_OT_report_replay", RKEY, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "INFO_OT_report_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "INFO_OT_report_delete", DELKEY, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0);
#ifdef __APPLE__
WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_OSKEY, 0);
@@ -263,7 +266,7 @@ static void info_header_listener(
/* context changes */
switch (wmn->category) {
case NC_SCREEN:
- if (ELEM(wmn->data, ND_LAYER, ND_SCREENCAST, ND_ANIMPLAY)) {
+ if (ELEM(wmn->data, ND_LAYER, ND_ANIMPLAY)) {
ED_region_tag_redraw(ar);
}
break;
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 85de70c020f..a1e3842f887 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -40,6 +40,7 @@
#include "BLI_string_utf8.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "BIF_gl.h"
@@ -81,8 +82,8 @@ static void console_draw_sel(const char *str, const int sel[2], const int xy[2],
const int sta = txt_utf8_offset_to_column(str, max_ii(sel[0], 0));
const int end = txt_utf8_offset_to_column(str, min_ii(sel[1], str_len_draw));
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
@@ -93,7 +94,7 @@ static void console_draw_sel(const char *str, const int sel[2], const int xy[2],
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index cafb40626ee..57464cbf092 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -184,31 +184,31 @@ bool nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA *nlt_p
}
#if 0
-static int nla_panel_poll(const bContext *C, PanelType *pt)
+static bool nla_panel_poll(const bContext *C, PanelType *pt)
{
return nla_panel_context(C, NULL, NULL);
}
#endif
-static int nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
return (nla_panel_context(C, &ptr, NULL, NULL) && (ptr.data != NULL));
}
-static int nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
return (nla_panel_context(C, NULL, &ptr, NULL) && (ptr.data != NULL));
}
-static int nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
return (nla_panel_context(C, NULL, NULL, &ptr) && (ptr.data != NULL));
}
-static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
NlaStrip *strip;
@@ -222,7 +222,7 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)
return (strip->type == NLASTRIP_TYPE_CLIP);
}
-static int nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
PointerRNA ptr;
NlaStrip *strip;
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index d782fe4d7ef..3368ad4fe8d 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -129,7 +129,7 @@ static int mouse_nla_channels(bContext *C, bAnimContext *ac, float x, int channe
Object *ob = base->object;
AnimData *adt = ob->adt;
- if (nlaedit_is_tweakmode_on(ac) == 0 && (base->flag & BASE_SELECTABLED)) {
+ if (nlaedit_is_tweakmode_on(ac) == 0 && (base->flag & BASE_SELECTABLE)) {
/* set selection status */
if (selectmode == SELECT_INVERT) {
/* swap select */
@@ -507,7 +507,7 @@ void NLA_OT_action_pushdown(wmOperatorType *ot)
/* ******************** Action Unlink ******************************** */
-static int nla_action_unlink_poll(bContext *C)
+static bool nla_action_unlink_poll(bContext *C)
{
if (ED_operator_nla_active(C)) {
return nla_panel_context(C, NULL, NULL, NULL);
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index 3f1ab059a91..a21a62dc8e8 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -58,6 +58,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_draw.h"
+#include "GPU_state.h"
#include "WM_types.h"
@@ -181,10 +182,10 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
}
@@ -212,7 +213,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax
/* Markers inside a NLA-Strip */
static void nla_strip_draw_markers(NlaStrip *strip, float yminc, float ymaxc)
{
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
if (strip->type == NLASTRIP_TYPE_CLIP) {
/* try not to be too conspicuous, while being visible enough when transforming */
@@ -232,7 +233,7 @@ static void nla_strip_draw_markers(NlaStrip *strip, float yminc, float ymaxc)
}
}
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
}
/* Strips (Proper) ---------------------- */
@@ -307,8 +308,8 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns
immUniformColor3f(0.7f, 0.7f, 0.7f);
/* draw with AA'd line */
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
+ GPU_line_smooth(true);
+ GPU_blend(true);
/* influence -------------------------- */
if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) {
@@ -357,8 +358,8 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uns
}
/* turn off AA'd lines */
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
}
/* helper call to setup dashed-lines for strip outlines */
@@ -369,10 +370,10 @@ static uint nla_draw_use_dashed_outlines(float color[4], bool muted)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* Simple dashes. */
+ immUniform1i("colors_len", 0); /* Simple dashes. */
immUniformColor3fv(color);
/* line style: dotted for muted */
@@ -380,12 +381,12 @@ static uint nla_draw_use_dashed_outlines(float color[4], bool muted)
/* dotted - and slightly thicker for readability of the dashes */
immUniform1f("dash_width", 5.0f);
immUniform1f("dash_factor", 0.4f);
- glLineWidth(1.5f);
+ GPU_line_width(1.5f);
}
else {
/* solid line */
immUniform1f("dash_factor", 2.0f);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
}
return shdr_pos;
@@ -410,8 +411,8 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
*/
if ((strip->extendmode != NLASTRIP_EXTEND_NOTHING) && (non_solo == 0)) {
/* enable transparency... */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
switch (strip->extendmode) {
/* since this does both sides, only do the 'before' side, and leave the rest to the next case */
@@ -442,7 +443,7 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
break;
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
@@ -462,9 +463,9 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri
/* strip is in disabled track - make less visible */
immUniformColor3fvAlpha(color, 0.1f);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immRectf(shdr_pos, strip->start, yminc, strip->end, ymaxc);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
@@ -711,8 +712,8 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* just draw a semi-shaded rect spanning the width of the viewable area if there's data,
* and a second darker rect within which we draw keyframe indicator dots if there's data
*/
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
/* get colors for drawing */
float color[4];
@@ -726,7 +727,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* draw 'embossed' lines above and below the strip for effect */
/* white base-lines */
- glLineWidth(2.0f);
+ GPU_line_width(2.0f);
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.3f);
immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP);
@@ -736,7 +737,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
immEnd();
/* black top-lines */
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immUniformColor3f(0.0f, 0.0f, 0.0f);
immBegin(GWN_PRIM_LINES, 4);
immVertex2f(pos, v2d->cur.xmin, yminc + NLACHANNEL_SKIP);
@@ -752,7 +753,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar)
/* draw keyframes in the action */
nla_action_draw_keyframes(adt, ale->data, y, yminc + NLACHANNEL_SKIP, ymaxc - NLACHANNEL_SKIP);
- glDisable(GL_BLEND);
+ GPU_blend(false);
break;
}
}
@@ -828,8 +829,8 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar)
y = (float)(-NLACHANNEL_HEIGHT(snla));
/* set blending again, as may not be set in previous step */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
/* loop through channels, and set up drawing depending on their type */
for (ale = anim_data.first; ale; ale = ale->next) {
@@ -852,7 +853,7 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *ar)
UI_block_end(C, block);
UI_block_draw(C, block);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* free temporary channels */
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 2e73c82ebb6..a00e71a192d 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -148,8 +148,8 @@ void NLA_OT_selected_objects_add(wmOperatorType *ot);
/* **************************************** */
/* nla_ops.c */
-int nlaop_poll_tweakmode_off(bContext *C);
-int nlaop_poll_tweakmode_on(bContext *C);
+bool nlaop_poll_tweakmode_off(bContext *C);
+bool nlaop_poll_tweakmode_on(bContext *C);
bool nlaedit_is_tweakmode_on(bAnimContext *ac);
@@ -159,4 +159,3 @@ void nla_operatortypes(void);
void nla_keymap(wmKeyConfig *keyconf);
#endif /* __NLA_INTERN_H__ */
-
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 0c087fa67b9..5bfd73b8163 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -52,7 +52,7 @@
/* ************************** poll callbacks for operators **********************************/
/* tweakmode is NOT enabled */
-int nlaop_poll_tweakmode_off(bContext *C)
+bool nlaop_poll_tweakmode_off(bContext *C)
{
Scene *scene;
@@ -74,7 +74,7 @@ int nlaop_poll_tweakmode_off(bContext *C)
}
/* tweakmode IS enabled */
-int nlaop_poll_tweakmode_on(bContext *C)
+bool nlaop_poll_tweakmode_on(bContext *C)
{
Scene *scene;
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 8c9372f0612..f22c211af64 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -653,7 +653,7 @@ void NLA_OT_click_select(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name = "Mouse Select";
+ ot->name = "Select";
ot->idname = "NLA_OT_click_select";
ot->description = "Handle clicks to select NLA Strips";
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 745cea37ea3..62144db0577 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -63,6 +63,7 @@
#include "UI_view2d.h"
#include "nla_intern.h" /* own include */
+#include "GPU_framebuffer.h"
/* ******************** manage regions ********************* */
@@ -232,7 +233,7 @@ static void nla_channel_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -278,7 +279,7 @@ static void nla_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index a162a863038..12da5086c52 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -56,6 +56,7 @@
#include "GPU_batch.h"
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -562,8 +563,8 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
/* outline active and selected emphasis */
if (node->flag & SELECT) {
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
+ GPU_blend(true);
+ GPU_line_smooth(true);
/* using different shades of TH_TEXT_HI for the empasis, like triangle */
if (node->flag & NODE_ACTIVE) {
UI_GetThemeColorShadeAlpha4fv(TH_TEXT_HI, 0, -40, debug_color);
@@ -573,8 +574,8 @@ static void node_draw_reroute(const bContext *C, ARegion *ar, SpaceNode *UNUSED(
}
UI_draw_roundbox_4fv(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size, debug_color);
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
}
#endif
@@ -3214,12 +3215,12 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b
GPU_shader_unbind();
}
else if (snode->flag & SNODE_USE_ALPHA) {
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST, snode->zoom, snode->zoom);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
else {
glaDrawImBuf_glsl_ctx(C, ibuf, x, y, GL_NEAREST, snode->zoom, snode->zoom);
@@ -3503,7 +3504,7 @@ static void nodelink_batch_draw(SpaceNode *snode)
if (g_batch_link.count == 0)
return;
- glEnable(GL_BLEND);
+ GPU_blend(true);
float colors[6][4] = {{0.0f}};
UI_GetThemeColor4fv(TH_WIRE_INNER, colors[nodelink_get_color_id(TH_WIRE_INNER)]);
@@ -3523,7 +3524,7 @@ static void nodelink_batch_draw(SpaceNode *snode)
nodelink_batch_reset();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
void nodelink_batch_start(SpaceNode *UNUSED(snode))
diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c
index 72b1a35973a..8f6a0f5c4e2 100644
--- a/source/blender/editors/space_node/node_add.c
+++ b/source/blender/editors/space_node/node_add.c
@@ -392,7 +392,7 @@ void NODE_OT_add_file(wmOperatorType *ot)
/* ****************** Add Mask Node Operator ******************* */
-static int node_add_mask_poll(bContext *C)
+static bool node_add_mask_poll(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -533,4 +533,3 @@ void NODE_OT_new_node_tree(wmOperatorType *ot)
RNA_def_enum_funcs(prop, new_node_tree_type_itemf);
RNA_def_string(ot->srna, "name", "NodeTree", MAX_ID_NAME - 2, "Name", "");
}
-
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 38183637750..c2efc548c30 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -59,7 +59,7 @@
#if 0
/* poll for active nodetree */
-static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -67,7 +67,7 @@ static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt))
}
#endif
-static int node_sockets_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool node_sockets_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -95,7 +95,7 @@ static void node_sockets_panel(const bContext *C, Panel *pa)
}
}
-static int node_tree_interface_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool node_tree_interface_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -216,7 +216,7 @@ static int node_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op))
}
/* non-standard poll operator which doesn't care if there are any nodes */
-static int node_properties_poll(bContext *C)
+static bool node_properties_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
return (sa && (sa->spacetype == SPACE_NODE));
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index 8089f47bce4..01e22ec5245 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -58,6 +58,8 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
+#include "GPU_framebuffer.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -620,12 +622,12 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
{
bNodeLink *link;
- glEnable(GL_BLEND);
+ GPU_blend(true);
for (link = node->internal_links.first; link; link = link->next)
node_draw_link_bezier(v2d, snode, link, TH_REDALERT, TH_REDALERT, -1);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void node_socket_circle_draw(const bContext *C, bNodeTree *ntree, PointerRNA node_ptr, bNodeSocket *sock, unsigned pos, unsigned col)
@@ -710,14 +712,14 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
node_draw_preview_background(BLI_rctf_size_x(prv) / 10.0f, &draw_rect);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); /* premul graphics */
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* premul graphics */
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex(&state, draw_rect.xmin, draw_rect.ymin, preview->xsize, preview->ysize, GL_RGBA, GL_UNSIGNED_BYTE, GL_LINEAR, preview->rect,
scale, scale, NULL);
- glDisable(GL_BLEND);
+ GPU_blend(false);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -773,7 +775,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
unsigned int col = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
- glEnable(GL_BLEND);
+ GPU_blend(true);
GPU_enable_program_point_size();
immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA);
@@ -864,7 +866,7 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
immUnbindProgram();
GPU_disable_program_point_size();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node, bNodeInstanceKey key)
@@ -903,7 +905,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
}
}
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
UI_draw_roundbox_aa(true, rct->xmin, rct->ymax - NODE_DY, rct->xmax, rct->ymax, BASIS_RAD, color);
@@ -1048,13 +1050,13 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
/* custom color inline */
if (node->flag & NODE_CUSTOM_COLOR) {
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
+ GPU_blend(true);
+ GPU_line_smooth(true);
UI_draw_roundbox_3fvAlpha(false, rct->xmin + 1, rct->ymin + 1, rct->xmax -1, rct->ymax - 1, hiddenrad, node->color, 1.0f);
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
}
/* title */
@@ -1239,14 +1241,14 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
}
/* node lines */
- glEnable(GL_BLEND);
+ GPU_blend(true);
nodelink_batch_start(snode);
for (link = ntree->links.first; link; link = link->next) {
if (!nodeLinkIsHidden(link))
node_draw_link(&ar->v2d, snode, link);
}
nodelink_batch_end(snode);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* draw foreground nodes, last nodes in front */
for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) {
@@ -1303,12 +1305,12 @@ static void draw_group_overlay(const bContext *C, ARegion *ar)
float color[4];
/* shade node groups to separate them visually */
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, -70, color);
UI_draw_roundbox_corner_set(UI_CNR_NONE);
UI_draw_roundbox_4fv(true, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0, color);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* set the block bounds to clip mouse events from underlying nodes */
block = UI_block_begin(C, ar, "node tree bounds block", UI_EMBOSS);
@@ -1325,7 +1327,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
View2D *v2d = &ar->v2d;
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1338,7 +1340,7 @@ void drawnodespace(const bContext *C, ARegion *ar)
ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
/* only set once */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
/* nodes */
snode_set_context(C);
@@ -1418,14 +1420,14 @@ void drawnodespace(const bContext *C, ARegion *ar)
}
/* temporary links */
- glEnable(GL_BLEND);
- glEnable(GL_LINE_SMOOTH);
+ GPU_blend(true);
+ GPU_line_smooth(true);
for (nldrag = snode->linkdrag.first; nldrag; nldrag = nldrag->next) {
for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next)
node_draw_link(v2d, snode, (bNodeLink *)linkdata->data);
}
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
if (snode->flag & SNODE_SHOW_GPENCIL) {
/* draw grease-pencil ('canvas' strokes) */
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index ff87dcf409a..cc32e5ef499 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -303,7 +303,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
/* ***************************************** */
/* operator poll callback */
-int composite_node_active(bContext *C)
+bool composite_node_active(bContext *C)
{
if (ED_operator_node_active(C)) {
SpaceNode *snode = CTX_wm_space_node(C);
@@ -314,7 +314,7 @@ int composite_node_active(bContext *C)
}
/* operator poll callback */
-int composite_node_editable(bContext *C)
+bool composite_node_editable(bContext *C)
{
if (ED_operator_node_editable(C)) {
SpaceNode *snode = CTX_wm_space_node(C);
@@ -719,7 +719,7 @@ void ED_node_post_apply_transform(bContext *UNUSED(C), bNodeTree *UNUSED(ntree))
#if 0 /* UNUSED */
-static int edit_node_poll(bContext *C)
+static bool edit_node_poll(bContext *C)
{
return ED_operator_node_active(C);
}
@@ -1617,7 +1617,7 @@ void NODE_OT_delete(wmOperatorType *ot)
/* ****************** Switch View ******************* */
-static int node_switch_view_poll(bContext *C)
+static bool node_switch_view_poll(bContext *C)
{
SpaceNode *snode = CTX_wm_space_node(C);
@@ -2290,7 +2290,7 @@ void NODE_OT_tree_socket_move(wmOperatorType *ot)
/* ********************** Shader Script Update ******************/
-static int node_shader_script_update_poll(bContext *C)
+static bool node_shader_script_update_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
RenderEngineType *type = RE_engines_find(scene->r.engine);
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c
index 926fff7a3b6..a3294211ff9 100644
--- a/source/blender/editors/space_node/node_group.c
+++ b/source/blender/editors/space_node/node_group.c
@@ -65,7 +65,7 @@
#include "node_intern.h" /* own include */
#include "NOD_common.h"
-static int node_group_operator_active(bContext *C)
+static bool node_group_operator_active(bContext *C)
{
if (ED_operator_node_active(C)) {
SpaceNode *snode = CTX_wm_space_node(C);
@@ -84,7 +84,7 @@ static int node_group_operator_active(bContext *C)
return false;
}
-static int node_group_operator_editable(bContext *C)
+static bool node_group_operator_editable(bContext *C)
{
if (ED_operator_node_editable(C)) {
SpaceNode *snode = CTX_wm_space_node(C);
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 2cc37a4e0fe..d7a43bda461 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -180,8 +180,8 @@ void snode_dag_update(struct bContext *C, struct SpaceNode *snode);
void snode_set_context(const struct bContext *C);
void snode_update(struct SpaceNode *snode, struct bNode *node);
-int composite_node_active(struct bContext *C);
-int composite_node_editable(struct bContext *C);
+bool composite_node_active(struct bContext *C);
+bool composite_node_editable(struct bContext *C);
int node_has_hidden_sockets(bNode *node);
void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set);
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 3b6cc8a89cf..069d8a500ca 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -306,7 +306,9 @@ void node_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "NODE_OT_delete", XKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "NODE_OT_delete", DELKEY, KM_PRESS, 0, 0);
+
WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", XKEY, KM_PRESS, KM_CTRL, 0);
+ WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", DELKEY, KM_PRESS, KM_CTRL, 0);
kmi = WM_keymap_add_item(keymap, "NODE_OT_select_all", AKEY, KM_PRESS, 0, 0);
RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c
index e4c59bc9508..c4cd59b65f4 100644
--- a/source/blender/editors/space_node/node_relationships.c
+++ b/source/blender/editors/space_node/node_relationships.c
@@ -532,7 +532,7 @@ static void node_link_update_header(bContext *C, bNodeLinkDrag *UNUSED(nldrag))
char header[UI_MAX_DRAW_STR];
BLI_strncpy(header, IFACE_("LMB: drag node link, RMB: cancel"), sizeof(header));
- ED_area_headerprint(CTX_wm_area(C), header);
+ ED_workspace_status_text(C, header);
}
static int node_count_links(bNodeTree *ntree, bNodeSocket *sock)
@@ -729,7 +729,7 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (event->val == KM_RELEASE) {
node_link_exit(C, op, true);
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 3ae542c48db..636ed755cb1 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -1064,5 +1064,3 @@ void NODE_OT_find_node(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "prev", 0, "Previous", "");
}
-
-
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 23fd793cdd3..b884db1ced4 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -769,4 +769,3 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
else
ui_node_draw_node(layout, C, ntree, node, 0);
}
-
diff --git a/source/blender/editors/space_node/node_toolbar.c b/source/blender/editors/space_node/node_toolbar.c
index 21278dd9fa5..b4e7e853330 100644
--- a/source/blender/editors/space_node/node_toolbar.c
+++ b/source/blender/editors/space_node/node_toolbar.c
@@ -63,7 +63,7 @@ static int node_toolbar_toggle_exec(bContext *C, wmOperator *UNUSED(op))
}
/* non-standard poll operator which doesn't care if there are any nodes */
-static int node_toolbar_poll(bContext *C)
+static bool node_toolbar_poll(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
return (sa && (sa->spacetype == SPACE_NODE));
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 441ab03cb28..fa6fa02cdc5 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -676,7 +676,7 @@ static void node_main_region_draw(const bContext *C, ARegion *ar)
/* ************* dropboxes ************* */
-static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID) {
ID *id = drag->poin;
@@ -690,7 +690,7 @@ static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *
return 0;
}
-static int node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID) {
ID *id = drag->poin;
@@ -772,7 +772,6 @@ static void node_region_listener(
WM_manipulatormap_tag_refresh(mmap);
}
switch (wmn->data) {
- case ND_SCREENCAST:
case ND_ANIMPLAY:
case ND_LAYER:
ED_region_tag_redraw(ar);
@@ -1045,4 +1044,3 @@ void ED_spacetype_node(void)
BKE_spacetype_register(st);
}
-
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index a700f8e20e0..ad94615a0d2 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -102,7 +102,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te)
/* -------------------------------------------------------------------- */
/* Poll functions. */
-int ED_outliner_collections_editor_poll(bContext *C)
+bool ED_outliner_collections_editor_poll(bContext *C)
{
SpaceOops *so = CTX_wm_space_outliner(C);
return (so != NULL) && ELEM(so->outlinevis, SO_VIEW_LAYER, SO_SCENES, SO_LIBRARIES);
@@ -164,8 +164,10 @@ static int collection_new_exec(bContext *C, wmOperator *op)
data.collection,
NULL);
- outliner_cleanup_tree(soops);
+ DEG_id_tag_update(&data.collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
+
+ outliner_cleanup_tree(soops);
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
}
@@ -236,18 +238,19 @@ static int collection_delete_exec(bContext *C, wmOperator *op)
/* Effectively delete the collections. */
GSetIterator collections_to_edit_iter;
GSET_ITER(collections_to_edit_iter, data.collections_to_edit) {
- /* TODO: what if collection was child and got deleted in the meantime? */
Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
- BKE_collection_delete(bmain, collection, hierarchy);
+
+ /* Test in case collection got deleted as part of another one. */
+ if (BLI_findindex(&bmain->collection, collection) != -1) {
+ BKE_collection_delete(bmain, collection, hierarchy);
+ }
}
BLI_gset_free(data.collections_to_edit, NULL);
+ DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
-
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
@@ -462,11 +465,9 @@ static int collection_link_exec(bContext *C, wmOperator *UNUSED(op))
BLI_gset_free(data.collections_to_edit, NULL);
+ DEG_id_tag_update(&active_collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
-
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
@@ -527,9 +528,6 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
-
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
@@ -576,7 +574,7 @@ static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, v
return TRAVERSE_CONTINUE;
}
-static int collections_view_layer_poll(bContext *C, bool include)
+static bool collections_view_layer_poll(bContext *C, bool include)
{
/* Poll function so the right click menu show current state of selected collections. */
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -607,12 +605,12 @@ static int collections_view_layer_poll(bContext *C, bool include)
return result;
}
-static int collections_exclude_poll(bContext *C)
+static bool collections_exclude_poll(bContext *C)
{
return collections_view_layer_poll(C, false);
}
-static int collections_include_poll(bContext *C)
+static bool collections_include_poll(bContext *C)
{
return collections_view_layer_poll(C, true);
}
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index a3f3acf1c32..75349ce99c5 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -51,6 +51,7 @@
#include "BKE_deform.h"
#include "BKE_fcurve.h"
#include "BKE_global.h"
+#include "BKE_idcode.h"
#include "BKE_layer.h"
#include "BKE_library.h"
#include "BKE_main.h"
@@ -71,6 +72,7 @@
#include "WM_types.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -286,11 +288,11 @@ static void hidebutton_base_flag_cb(bContext *C, void *poin, void *poin2)
bool extend = (CTX_wm_window(C)->eventstate->ctrl == 0);
/* Undo button toggle, let function do it. */
- base->flag ^= BASE_HIDE;
+ base->flag ^= BASE_HIDDEN;
BKE_base_set_visible(scene, view_layer, base, extend);
- if (!extend && (base->flag & BASE_VISIBLED)) {
+ if (!extend && (base->flag & BASE_VISIBLE)) {
/* Auto select solo-ed object. */
ED_object_base_select(base, BA_SELECT);
view_layer->basact = base;
@@ -515,7 +517,7 @@ static void outliner_draw_restrictbuts(
if (base) {
bt = uiDefIconButBitS(
- block, UI_BTYPE_ICON_TOGGLE, BASE_HIDE, 0, ICON_HIDE_OFF,
+ block, UI_BTYPE_ICON_TOGGLE, BASE_HIDDEN, 0, ICON_HIDE_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_HIDEX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &base->flag, 0, 0, 0, 0,
TIP_("Hide object in viewport (Ctrl to isolate)"));
@@ -738,7 +740,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex)
float miny = v2d->cur.ymin;
if (miny < v2d->tot.ymin) miny = v2d->tot.ymin;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -854,9 +856,9 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
{
/* restrict column clip... it has been coded by simply overdrawing, doesnt work for buttons */
if (arg->x >= arg->xmax) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_icon_draw_alpha(arg->x, arg->y, icon, arg->alpha);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
else {
uiBut *but = uiDefIconBut(
@@ -905,7 +907,7 @@ static void UNUSED_FUNCTION(tselem_draw_gp_icon_uibut)(struct DrawIconArg *arg,
static void tselem_draw_icon(
uiBlock *block, int xmax, float x, float y, TreeStoreElem *tselem, TreeElement *te,
- float alpha)
+ float alpha, const bool is_clickable)
{
struct DrawIconArg arg;
float aspect;
@@ -926,6 +928,7 @@ static void tselem_draw_icon(
arg.y = y;
#define ICON_DRAW(_icon) UI_icon_draw_alpha(x, y, _icon, alpha)
+#define ICON_CLICK_DRAW(_icon) if (!is_clickable) ICON_DRAW(_icon); else tselem_draw_icon_uibut(&arg, _icon)
if (tselem->type) {
switch (tselem->type) {
@@ -1198,33 +1201,33 @@ static void tselem_draw_icon(
Object *ob = (Object *)tselem->id;
switch (ob->type) {
case OB_LAMP:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LAMP); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_LAMP); break;
case OB_MESH:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_MESH); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_MESH); break;
case OB_CAMERA:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_CAMERA); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_CAMERA); break;
case OB_CURVE:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_CURVE); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_CURVE); break;
case OB_MBALL:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_META); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_META); break;
case OB_LATTICE:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LATTICE); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_LATTICE); break;
case OB_ARMATURE:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_ARMATURE); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_ARMATURE); break;
case OB_FONT:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_FONT); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_FONT); break;
case OB_SURF:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SURFACE); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_SURFACE); break;
case OB_SPEAKER:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SPEAKER); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_SPEAKER); break;
case OB_LIGHTPROBE:
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LIGHTPROBE); break;
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_LIGHTPROBE); break;
case OB_EMPTY:
if (ob->dup_group) {
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_GROUP_INSTANCE);
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_GROUP_INSTANCE);
}
else {
- tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_EMPTY);
+ ICON_CLICK_DRAW(ICON_OUTLINER_OB_EMPTY);
}
break;
}
@@ -1332,13 +1335,137 @@ static void tselem_draw_icon(
#undef ICON_DRAW
}
+/**
+ * For icon-only children of a collapsed tree,
+ * Draw small number over the icon to show how many items of this type are displayed.
+ */
+static void outliner_draw_iconrow_number(
+ const uiFontStyle *fstyle,
+ int offsx, int ys,
+ const eOLDrawState active,
+ const int num_elements)
+{
+ float color[4] = {0.4f, 0.4f, 0.4f, 0.9f};
+ copy_v3_fl(color, 0.2f);
+ if (active != OL_DRAWSEL_NONE) {
+ copy_v3_fl(color, 0.65f);
+ color[3] = 1.0f;
+ }
+
+ float ufac = 0.25f * UI_UNIT_X;
+ float offset_x = (float) offsx + UI_UNIT_X * 0.35f;
+
+ UI_draw_roundbox_corner_set(UI_CNR_ALL);
+ UI_draw_roundbox_aa(true,
+ offset_x + ufac,
+ (float)ys - UI_UNIT_Y * 0.2f + ufac,
+ offset_x + UI_UNIT_X - ufac,
+ (float)ys - UI_UNIT_Y * 0.2f + UI_UNIT_Y - ufac,
+ (float)UI_UNIT_Y / 2.0f - ufac,
+ color);
+
+ /* Now the numbers. */
+ unsigned char text_col[4];
+
+ UI_GetThemeColor4ubv(TH_TEXT_HI, text_col);
+ text_col[3] = 255;
+
+ uiFontStyle fstyle_small = *fstyle;
+ fstyle_small.points *= 0.8f;
+
+ /* We treat +99 as 4 digits to make sure the (eyeballed) alignment looks nice. */
+ int num_digits = 4;
+ char number_text[4] = "+99\0";
+ if (num_elements < 100) {
+ BLI_snprintf(number_text, sizeof(number_text), "%d", num_elements);
+ num_digits = num_elements < 10 ? 1 : 2;
+ }
+ UI_fontstyle_draw_simple(&fstyle_small,
+ (offset_x + ufac + UI_UNIT_X * (2 - num_digits) * 0.12f),
+ (float)ys - UI_UNIT_Y * 0.095f + ufac,
+ number_text, text_col);
+ UI_fontstyle_set(fstyle);
+ GPU_blend(true); /* Roundbox and text drawing disables. */
+}
+
+static void outliner_draw_iconrow_doit(
+ uiBlock *block, TreeElement *te,
+ const uiFontStyle *fstyle,
+ int xmax, int *offsx, int ys, float alpha_fac,
+ const eOLDrawState active,
+ const int num_elements)
+{
+ TreeStoreElem *tselem = TREESTORE(te);
+
+ if (active != OL_DRAWSEL_NONE) {
+ float ufac = UI_UNIT_X / 20.0f;
+ float color[4] = {1.0f, 1.0f, 1.0f, 0.4f};
+
+ UI_draw_roundbox_corner_set(UI_CNR_ALL);
+ color[3] *= alpha_fac;
+
+ UI_draw_roundbox_aa(true,
+ (float) *offsx + 1.0f * ufac,
+ (float)ys + 1.0f * ufac,
+ (float)*offsx + UI_UNIT_X - 1.0f * ufac,
+ (float)ys + UI_UNIT_Y - ufac,
+ (float)UI_UNIT_Y / 2.0f - ufac,
+ color);
+ GPU_blend(true); /* Roundbox disables. */
+ }
+
+ /* No inlined icon should be clickable. */
+ tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f * alpha_fac, false);
+ te->xs = *offsx;
+ te->ys = ys;
+ te->xend = (short)*offsx + UI_UNIT_X;
+
+ if (num_elements > 1) {
+ outliner_draw_iconrow_number(fstyle, *offsx, ys, active, num_elements);
+ }
+ (*offsx) += UI_UNIT_X;
+}
+
+/**
+ * Return the index to use based on the TreeElement ID and object type
+ *
+ * We use a continuum of indeces until we get to the object datablocks
+ * and we then make room for the object types.
+ */
+static int tree_element_id_type_to_index(TreeElement *te)
+{
+ TreeStoreElem *tselem = TREESTORE(te);
+
+ const int id_index = tselem->type == 0 ? BKE_idcode_to_index(te->idcode) : INDEX_ID_GR;
+ if (id_index < INDEX_ID_OB) {
+ return id_index;
+ }
+ else if (id_index == INDEX_ID_OB) {
+ const Object *ob = (Object *)tselem->id;
+ return INDEX_ID_OB + ob->type;
+ }
+ else {
+ return id_index + OB_TYPE_MAX;
+ }
+}
+
static void outliner_draw_iconrow(
- bContext *C, uiBlock *block, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
+ bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *view_layer, SpaceOops *soops,
ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac)
{
eOLDrawState active;
const Object *obact = OBACT(view_layer);
+ struct {
+ eOLDrawState active[INDEX_ID_MAX + OB_TYPE_MAX];
+ int num_elements[INDEX_ID_MAX + OB_TYPE_MAX];
+ TreeElement *tree_element[INDEX_ID_MAX + OB_TYPE_MAX];
+ } data = {
+ .active = {0},
+ .num_elements = {0},
+ .tree_element = {NULL},
+ };
+
for (TreeElement *te = lb->first; te; te = te->next) {
/* exit drawing early */
if ((*offsx) - UI_UNIT_X > xmax)
@@ -1364,41 +1491,48 @@ static void outliner_draw_iconrow(
active = tree_element_type_active(C, scene, view_layer, soops, te, tselem, OL_SETSEL_NONE, false);
}
- if (active != OL_DRAWSEL_NONE) {
- float ufac = UI_UNIT_X / 20.0f;
- float color[4] = {1.0f, 1.0f, 1.0f, 0.4f};
-
- UI_draw_roundbox_corner_set(UI_CNR_ALL);
- color[3] *= alpha_fac;
-
- UI_draw_roundbox_aa(
- true,
- (float) *offsx + 1.0f * ufac,
- (float)ys + 1.0f * ufac,
- (float)*offsx + UI_UNIT_X - 1.0f * ufac,
- (float)ys + UI_UNIT_Y - ufac,
- (float)UI_UNIT_Y / 2.0f - ufac,
- color);
- glEnable(GL_BLEND); /* roundbox disables */
+ if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION)) {
+ outliner_draw_iconrow_doit(block, te, fstyle, xmax, offsx, ys, alpha_fac, active, 1);
+ }
+ else {
+ const int index = tree_element_id_type_to_index(te);
+ data.num_elements[index]++;
+ if ((data.tree_element[index] == NULL) ||
+ (active > data.active[index]))
+ {
+ data.tree_element[index] = te;
+ }
+ data.active[index] = MAX2(active, data.active[index]);
}
-
- tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f * alpha_fac);
- te->xs = *offsx;
- te->ys = ys;
- te->xend = (short)*offsx + UI_UNIT_X;
- te->flag |= TE_ICONROW; // for click
-
- (*offsx) += UI_UNIT_X;
}
/* this tree element always has same amount of branches, so don't draw */
if (tselem->type != TSE_R_LAYER) {
outliner_draw_iconrow(
- C, block, scene, view_layer, soops,
+ C, block, fstyle, scene, view_layer, soops,
&te->subtree, level + 1, xmax, offsx, ys, alpha_fac);
}
}
+ for (int i = 0; i < INDEX_ID_MAX; i++) {
+ const int num_subtypes = (i == INDEX_ID_OB) ? OB_TYPE_MAX : 1;
+ /* See tree_element_id_type_to_index for the index logic. */
+ int index_base = i;
+ if (i > INDEX_ID_OB) {
+ index_base += OB_TYPE_MAX;
+ }
+ for (int j = 0; j < num_subtypes; j++) {
+ const int index = index_base + j;
+ if (data.num_elements[index] != 0) {
+ outliner_draw_iconrow_doit(block,
+ data.tree_element[index],
+ fstyle,
+ xmax, offsx, ys, alpha_fac,
+ data.active[index],
+ data.num_elements[index]);
+ }
+ }
+ }
}
/* closed tree element */
@@ -1447,7 +1581,7 @@ static void outliner_draw_tree_element(
if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
xmax -= OL_TOGW + UI_UNIT_X;
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* colors for active/selected data */
if (tselem->type == 0) {
@@ -1510,7 +1644,7 @@ static void outliner_draw_tree_element(
(float)startx + 2.0f * UI_UNIT_X - 1.0f * ufac,
(float)*starty + UI_UNIT_Y - 1.0f * ufac,
UI_UNIT_Y / 2.0f - 1.0f * ufac, color);
- glEnable(GL_BLEND); /* roundbox disables it */
+ GPU_blend(true); /* roundbox disables it */
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
}
@@ -1539,7 +1673,7 @@ static void outliner_draw_tree_element(
/* datatype icon */
if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM, TSE_ID_BASE))) {
- tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac);
+ tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac, true);
offsx += UI_UNIT_X + 2 * ufac;
}
else
@@ -1569,7 +1703,7 @@ static void outliner_draw_tree_element(
alpha_fac);
offsx += UI_UNIT_X + 2 * ufac;
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* name */
if ((tselem->flag & TSE_TEXTBUT) == 0) {
@@ -1602,7 +1736,7 @@ static void outliner_draw_tree_element(
else if (tselem->type != TSE_R_LAYER) {
int tempx = startx + offsx;
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* divider */
{
@@ -1623,10 +1757,10 @@ static void outliner_draw_tree_element(
}
outliner_draw_iconrow(
- C, block, scene, view_layer, soops, &te->subtree, 0, xmax, &tempx,
+ C, block, fstyle, scene, view_layer, soops, &te->subtree, 0, xmax, &tempx,
*starty, alpha_fac);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
}
@@ -1676,14 +1810,14 @@ static void outliner_draw_tree_element_floating(
UI_GetThemeColorShade4fv(TH_BACK, -40, col);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- glEnable(GL_BLEND);
+ GPU_blend(true);
if (ELEM(te_floating->drag_data->insert_type, TE_INSERT_BEFORE, TE_INSERT_AFTER)) {
if (te_floating->drag_data->insert_type == TE_INSERT_BEFORE) {
coord_y += UI_UNIT_Y;
}
immUniformColor4fv(col);
- glLineWidth(line_width);
+ GPU_line_width(line_width);
immBegin(GWN_PRIM_LINE_STRIP, 2);
immVertex2f(pos, coord_x, coord_y);
@@ -1702,7 +1836,7 @@ static void outliner_draw_tree_element_floating(
immEnd();
}
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUnbindProgram();
}
@@ -1776,9 +1910,9 @@ static void outliner_draw_hierarchy_lines(SpaceOops *soops, ListBase *lb, int st
UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.4f, col);
col[3] = 255;
- glEnable(GL_BLEND);
+ GPU_blend(true);
outliner_draw_hierarchy_lines_recursive(pos, soops, lb, startx, col, false, starty);
- glDisable(GL_BLEND);
+ GPU_blend(false);
immUnbindProgram();
}
@@ -1828,7 +1962,6 @@ static void outliner_draw_highlights_recursive(
const bool is_searching = (
SEARCHING_OUTLINER(soops) ||
(soops->outlinevis == SO_DATA_API &&
- (soops->filter & SO_FILTER_SEARCH) &&
soops->search_string[0] != 0));
for (TreeElement *te = lb->first; te; te = te->next) {
@@ -1874,7 +2007,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx,
UI_GetThemeColor4fv(TH_MATCH, col_searchmatch);
col_searchmatch[3] = 0.5f;
- glEnable(GL_BLEND);
+ GPU_blend(true);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1882,7 +2015,7 @@ static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx,
pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch,
startx, starty);
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void outliner_draw_tree(
@@ -1894,7 +2027,7 @@ static void outliner_draw_tree(
TreeElement *te_floating = NULL;
int starty, startx;
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); // only once
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); // only once
if (soops->outlinevis == SO_DATA_API) {
/* struct marks */
@@ -1908,13 +2041,13 @@ static void outliner_draw_tree(
outliner_draw_highlights(ar, soops, startx, &starty);
/* set scissor so tree elements or lines can't overlap restriction icons */
- GLfloat scissor[4] = {0};
+ float scissor[4] = {0};
if (has_restrict_icons) {
int mask_x = BLI_rcti_size_x(&ar->v2d.mask) - (int)OL_TOGW + 1;
CLAMP_MIN(mask_x, 0);
- glGetFloatv(GL_SCISSOR_BOX, scissor);
- glScissor(0, 0, mask_x, ar->winy);
+ GPU_scissor_get_f(scissor);
+ GPU_scissor(0, 0, mask_x, ar->winy);
}
// gray hierarchy lines
@@ -1938,7 +2071,7 @@ static void outliner_draw_tree(
if (has_restrict_icons) {
/* reset scissor */
- glScissor(UNPACK4(scissor));
+ GPU_scissor(UNPACK4(scissor));
}
}
@@ -1980,7 +2113,7 @@ static void outliner_back(ARegion *ar)
static void outliner_draw_restrictcols(ARegion *ar)
{
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -2097,13 +2230,13 @@ void draw_outliner(const bContext *C)
outliner_draw_restrictbuts(block, scene, view_layer, ar, soops, &soops->tree);
}
+ UI_block_emboss_set(block, UI_EMBOSS);
+
/* draw edit buttons if nessecery */
if (te_edit) {
outliner_buttons(C, block, ar, te_edit);
}
- UI_block_emboss_set(block, UI_EMBOSS);
-
UI_block_end(C, block);
UI_block_draw(C, block);
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index a455f8c076a..1c78931b449 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -242,7 +242,7 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, const wmEvent *e
void OUTLINER_OT_item_openclose(wmOperatorType *ot)
{
- ot->name = "Open/Close Item";
+ ot->name = "Open/Close";
ot->idname = "OUTLINER_OT_item_openclose";
ot->description = "Toggle whether item under cursor is enabled or closed";
@@ -399,7 +399,7 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even
void OUTLINER_OT_item_rename(wmOperatorType *ot)
{
- ot->name = "Rename Item";
+ ot->name = "Rename";
ot->idname = "OUTLINER_OT_item_rename";
ot->description = "Rename item under cursor";
@@ -542,7 +542,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
/* free gpu materials, some materials depend on existing objects, such as lamps so freeing correctly refreshes */
- GPU_materials_free();
+ GPU_materials_free(bmain);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -1385,7 +1385,7 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot)
/* KeyingSet and Driver Creation - Helper functions */
/* specialized poll callback for these operators to work in Datablocks view only */
-static int ed_operator_outliner_datablocks_active(bContext *C)
+static bool ed_operator_outliner_datablocks_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
@@ -1873,7 +1873,7 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
/* ************************************************************** */
/* ORPHANED DATABLOCKS */
-static int ed_operator_outliner_id_orphans_active(bContext *C)
+static bool ed_operator_outliner_id_orphans_active(bContext *C)
{
ScrArea *sa = CTX_wm_area(C);
if ((sa) && (sa->spacetype == SPACE_OUTLINER)) {
@@ -2110,7 +2110,7 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot)
RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", "");
}
-static int outliner_parenting_poll(bContext *C)
+static bool outliner_parenting_poll(bContext *C)
{
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -2366,6 +2366,7 @@ static int collection_drop_invoke(bContext *C, wmOperator *op, const wmEvent *ev
Object *ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, childname);
BKE_collection_object_add(bmain, collection, ob);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 1f8320f73a0..0ab22208841 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -182,7 +182,7 @@ typedef enum {
* - not searching into RNA items helps but isn't the complete solution
*/
-#define SEARCHING_OUTLINER(sov) ((sov->search_flags & SO_SEARCH_RECURSIVE) && (sov->filter & SO_FILTER_SEARCH))
+#define SEARCHING_OUTLINER(sov) (sov->search_flags & SO_SEARCH_RECURSIVE)
/* is the currrent element open? if so we also show children */
#define TSELEM_OPEN(telm, sv) ( (telm->flag & TSE_CLOSED) == 0 || (SEARCHING_OUTLINER(sv) && (telm->flag & TSE_CHILDSEARCH)) )
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 316caf0e239..4d8c0c5bd38 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -41,6 +41,7 @@
#include "BKE_main.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "RNA_access.h"
@@ -64,7 +65,7 @@ enum {
OUTLINER_ITEM_DRAG_CONFIRM,
};
-static int outliner_item_drag_drop_poll(bContext *C)
+static bool outliner_item_drag_drop_poll(bContext *C)
{
SpaceOops *soops = CTX_wm_space_outliner(C);
return ED_operator_outliner_active(C) &&
@@ -346,9 +347,9 @@ static void outliner_drag_drop_tooltip_cb(const wmWindow *win, void *vdata)
const float col_fg[4] = {1.0f, 1.0f, 1.0f, 1.0f};
const float col_bg[4] = {0.0f, 0.0f, 0.0f, 0.2f};
- glEnable(GL_BLEND);
+ GPU_blend(true);
UI_fontstyle_draw_simple_backdrop(fstyle, x, y, tooltip, col_fg, col_bg);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static int outliner_item_drag_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -388,7 +389,7 @@ static int outliner_item_drag_drop_invoke(bContext *C, wmOperator *op, const wmE
*/
static void OUTLINER_OT_item_drag_drop(wmOperatorType *ot)
{
- ot->name = "Drag and Drop Item";
+ ot->name = "Drag and Drop";
ot->idname = "OUTLINER_OT_item_drag_drop";
ot->description = "Change the hierarchical position of an item by repositioning it using drag and drop";
@@ -466,7 +467,7 @@ static wmKeyMap *outliner_item_drag_drop_modal_keymap(wmKeyConfig *keyconf)
{OUTLINER_ITEM_DRAG_CONFIRM, "CONFIRM", 0, "Confirm/Drop", ""},
{0, NULL, 0, NULL, NULL}
};
- const char *map_name = "Outliner Item Drap 'n Drop Modal Map";
+ const char *map_name = "Outliner Item Drap & Drop Modal Map";
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, map_name);
@@ -555,7 +556,9 @@ void outliner_keymap(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_delete_selected", DKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_new", CKEY, KM_PRESS, 0, 0);
+
WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_delete", XKEY, KM_PRESS, 0, 0);
+ WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_delete", DELKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_move_to_collection", MKEY, KM_PRESS, 0, 0);
WM_keymap_verify_item(keymap, "OBJECT_OT_link_to_collection", MKEY, KM_PRESS, KM_SHIFT, 0);
@@ -569,4 +572,3 @@ void outliner_keymap(wmKeyConfig *keyconf)
outliner_item_drag_drop_modal_keymap(keyconf);
}
-
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 38ae0683d4b..6668ea1faeb 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -206,7 +206,7 @@ static void do_outliner_object_select_recursive(ViewLayer *view_layer, Object *o
for (base = FIRSTBASE(view_layer); base; base = base->next) {
Object *ob = base->object;
- if ((((base->flag & BASE_VISIBLED) == 0) && BKE_object_is_child_recursive(ob_parent, ob))) {
+ if ((((base->flag & BASE_VISIBLE) == 0) && BKE_object_is_child_recursive(ob_parent, ob))) {
ED_object_base_select(base, select ? BA_SELECT : BA_DESELECT);
}
}
@@ -1000,7 +1000,7 @@ static void do_outliner_item_activate_tree_element(
Object *ob = (Object *)outliner_search_back(soops, te, ID_OB);
if ((ob != NULL) && (ob->data == tselem->id)) {
Base *base = BKE_view_layer_base_find(view_layer, ob);
- if ((base != NULL) && (base->flag & BASE_VISIBLED)) {
+ if ((base != NULL) && (base->flag & BASE_VISIBLE)) {
do_outliner_activate_obdata(C, scene, view_layer, base);
}
}
@@ -1142,9 +1142,9 @@ static int outliner_item_activate_invoke(bContext *C, wmOperator *op, const wmEv
void OUTLINER_OT_item_activate(wmOperatorType *ot)
{
- ot->name = "Activate Item";
+ ot->name = "Select";
ot->idname = "OUTLINER_OT_item_activate";
- ot->description = "Handle mouse clicks to activate/select items";
+ ot->description = "Handle mouse clicks to select and activate items";
ot->invoke = outliner_item_activate_invoke;
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 32918806765..9952db5e652 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -63,6 +63,7 @@
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_sequencer.h"
#include "DEG_depsgraph.h"
@@ -229,18 +230,22 @@ static void unlink_collection_cb(
if (GS(tsep->id->name) == ID_OB) {
Object *ob = (Object *)tsep->id;
ob->dup_group = NULL;
+ DEG_id_tag_update(&ob->id, OB_RECALC_OB);
DEG_relations_tag_update(bmain);
}
else if (GS(tsep->id->name) == ID_GR) {
Collection *parent = (Collection *)tsep->id;
id_fake_user_set(&collection->id);
BKE_collection_child_remove(bmain, parent, collection);
+ DEG_id_tag_update(&parent->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
else if (GS(tsep->id->name) == ID_SCE) {
- Collection *parent = BKE_collection_master((Scene *)tsep->id);
+ Scene *scene = (Scene *)tsep->id;
+ Collection *parent = BKE_collection_master(scene);
id_fake_user_set(&collection->id);
BKE_collection_child_remove(bmain, parent, collection);
+ DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
}
@@ -257,11 +262,14 @@ static void unlink_object_cb(
if (GS(tsep->id->name) == ID_GR) {
Collection *parent = (Collection *)tsep->id;
BKE_collection_object_remove(bmain, parent, ob, true);
+ DEG_id_tag_update(&parent->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
else if (GS(tsep->id->name) == ID_SCE) {
- Collection *parent = BKE_collection_master((Scene *)tsep->id);
+ Scene *scene = (Scene *)tsep->id;
+ Collection *parent = BKE_collection_master(scene);
BKE_collection_object_remove(bmain, parent, ob, true);
+ DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
}
}
@@ -394,7 +402,7 @@ static void object_select_cb(
Object *ob = (Object *)tselem->id;
Base *base = BKE_view_layer_base_find(view_layer, ob);
- if (base && ((base->flag & BASE_VISIBLED) != 0)) {
+ if (base && ((base->flag & BASE_VISIBLE) != 0)) {
base->flag |= BASE_SELECTED;
}
}
@@ -1776,6 +1784,26 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot)
/* ******************** */
+static int outliner_operator_menu(bContext *C, const char *opname)
+{
+ wmOperatorType *ot = WM_operatortype_find(opname, false);
+ uiPopupMenu *pup = UI_popup_menu_begin(C, RNA_struct_ui_name(ot->srna), ICON_NONE);
+ uiLayout *layout = UI_popup_menu_layout(pup);
+
+ /* set this so the default execution context is the same as submenus */
+ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
+ uiItemsEnumO(layout, ot->idname, RNA_property_identifier(ot->prop));
+
+ MenuType *mt = WM_menutype_find("OUTLINER_MT_context", false);
+ if (mt) {
+ uiItemS(layout);
+ UI_menutype_draw(C, mt, layout);
+ }
+
+ UI_popup_menu_end(C, pup);
+
+ return OPERATOR_INTERFACE;
+}
static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soops,
TreeElement *te, const float mval[2])
@@ -1804,28 +1832,32 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop
if (scenelevel) {
if (objectlevel || datalevel || idlevel) {
BKE_report(reports, RPT_WARNING, "Mixed selection");
+ return OPERATOR_CANCELLED;
}
else {
- WM_operator_name_call(C, "OUTLINER_OT_scene_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+ return outliner_operator_menu(C, "OUTLINER_OT_scene_operation");
}
}
else if (objectlevel) {
WM_menu_name_call(C, "OUTLINER_MT_object", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
}
else if (idlevel) {
if (idlevel == -1 || datalevel) {
BKE_report(reports, RPT_WARNING, "Mixed selection");
+ return OPERATOR_CANCELLED;
}
else {
switch (idlevel) {
case ID_GR:
WM_menu_name_call(C, "OUTLINER_MT_collection", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
break;
case ID_LI:
- WM_operator_name_call(C, "OUTLINER_OT_lib_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+ return outliner_operator_menu(C, "OUTLINER_OT_lib_operation");
break;
default:
- WM_operator_name_call(C, "OUTLINER_OT_id_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+ return outliner_operator_menu(C, "OUTLINER_OT_id_operation");
break;
}
}
@@ -1833,41 +1865,49 @@ static int do_outliner_operation_event(bContext *C, ARegion *ar, SpaceOops *soop
else if (datalevel) {
if (datalevel == -1) {
BKE_report(reports, RPT_WARNING, "Mixed selection");
+ return OPERATOR_CANCELLED;
}
else {
- if (datalevel == TSE_ANIM_DATA)
- WM_operator_name_call(C, "OUTLINER_OT_animdata_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+ if (datalevel == TSE_ANIM_DATA) {
+ return outliner_operator_menu(C, "OUTLINER_OT_animdata_operation");
+ }
else if (datalevel == TSE_DRIVER_BASE) {
/* do nothing... no special ops needed yet */
+ return OPERATOR_CANCELLED;
}
else if (datalevel == TSE_LAYER_COLLECTION) {
WM_menu_name_call(C, "OUTLINER_MT_collection", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
}
else if (ELEM(datalevel, TSE_SCENE_COLLECTION_BASE, TSE_VIEW_COLLECTION_BASE)) {
WM_menu_name_call(C, "OUTLINER_MT_collection_new", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
}
else if (datalevel == TSE_ID_BASE) {
/* do nothing... there are no ops needed here yet */
}
else if (datalevel == TSE_CONSTRAINT) {
- WM_operator_name_call(C, "OUTLINER_OT_constraint_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+ return outliner_operator_menu(C, "OUTLINER_OT_constraint_operation");
}
else if (datalevel == TSE_MODIFIER) {
- WM_operator_name_call(C, "OUTLINER_OT_modifier_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+ return outliner_operator_menu(C, "OUTLINER_OT_modifier_operation");
}
else {
- WM_operator_name_call(C, "OUTLINER_OT_data_operation", WM_OP_INVOKE_REGION_WIN, NULL);
+ return outliner_operator_menu(C, "OUTLINER_OT_data_operation");
}
}
}
- return 1;
+ return 0;
}
for (te = te->subtree.first; te; te = te->next) {
- if (do_outliner_operation_event(C, ar, soops, te, mval))
- return 1;
+ int retval = do_outliner_operation_event(C, ar, soops, te, mval);
+ if (retval) {
+ return retval;
+ }
}
+
return 0;
}
@@ -1879,7 +1919,6 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent
uiBut *but = UI_context_active_but_get(C);
TreeElement *te;
float fmval[2];
- bool found = false;
if (but) {
UI_but_tooltip_timer_remove(C, but);
@@ -1888,26 +1927,26 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
for (te = soops->tree.first; te; te = te->next) {
- if (do_outliner_operation_event(C, ar, soops, te, fmval)) {
- found = true;
- break;
+ int retval = do_outliner_operation_event(C, ar, soops, te, fmval);
+ if (retval) {
+ return retval;
}
}
- if (!found) {
- /* Menus for clicking in empty space. */
- if (soops->outlinevis == SO_VIEW_LAYER) {
- WM_menu_name_call(C, "OUTLINER_MT_collection_new", WM_OP_INVOKE_REGION_WIN);
- }
+ /* Menus for clicking in empty space. */
+ if (soops->outlinevis == SO_VIEW_LAYER) {
+ WM_menu_name_call(C, "OUTLINER_MT_collection_new", WM_OP_INVOKE_REGION_WIN);
+ return OPERATOR_FINISHED;
}
+ WM_menu_name_call(C, "OUTLINER_MT_context", WM_OP_INVOKE_REGION_WIN);
return OPERATOR_FINISHED;
}
/* Menu only! Calls other operators */
void OUTLINER_OT_operation(wmOperatorType *ot)
{
- ot->name = "Execute Operation";
+ ot->name = "Context Menu";
ot->idname = "OUTLINER_OT_operation";
ot->description = "Context menu for item operations";
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 13b62b766f5..9f6c944c914 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1470,7 +1470,7 @@ static void outliner_add_layer_collection_objects(
TreeElement *te_object = outliner_add_element(soops, tree, base->object, ten, 0, 0);
te_object->directdata = base;
- if (!(base->flag & BASE_VISIBLED)) {
+ if (!(base->flag & BASE_VISIBLE)) {
te_object->flag |= TE_DISABLED;
}
}
@@ -1493,7 +1493,8 @@ static void outliner_add_layer_collections_recursive(
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
if (exclude ||
((layer->runtime_flag & VIEW_LAYER_HAS_HIDE) &&
- !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS))) {
+ !(lc->runtime_flag & LAYER_COLLECTION_HAS_VISIBLE_OBJECTS)))
+ {
ten->flag |= TE_DISABLED;
}
@@ -1891,10 +1892,11 @@ static int outliner_exclude_filter_get(SpaceOops *soops)
{
int exclude_filter = soops->filter & ~SO_FILTER_OB_STATE;
- if (soops->filter & SO_FILTER_SEARCH) {
- if (soops->search_string[0] == 0) {
- exclude_filter &= ~SO_FILTER_SEARCH;
- }
+ if (soops->search_string[0] != 0) {
+ exclude_filter |= SO_FILTER_SEARCH;
+ }
+ else {
+ exclude_filter &= ~SO_FILTER_SEARCH;
}
/* Let's have this for the collection options at first. */
@@ -1982,7 +1984,7 @@ static bool outliner_element_visible_get(ViewLayer *view_layer, TreeElement *te,
}
if (exclude_filter & SO_FILTER_OB_STATE_VISIBLE) {
- if ((base->flag & BASE_VISIBLED) == 0) {
+ if ((base->flag & BASE_VISIBLE) == 0) {
return false;
}
}
@@ -2268,5 +2270,3 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
BKE_main_id_clear_newpoins(mainvar);
}
-
-
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 71ae7eeeb3d..e1baaf54163 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -63,6 +63,7 @@
#include "outliner_intern.h"
+#include "GPU_framebuffer.h"
static void outliner_main_region_init(wmWindowManager *wm, ARegion *ar)
{
@@ -92,7 +93,7 @@ static void outliner_main_region_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_dropbox_handler(&ar->handlers, lb);
}
-static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool outliner_parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -150,7 +151,7 @@ static void outliner_parent_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "child", id->name + 2);
}
-static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -196,7 +197,7 @@ static void outliner_parent_clear_copy(wmDrag *drag, wmDropBox *drop)
RNA_enum_set(drop->ptr, "type", 0);
}
-static int outliner_scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool outliner_scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -221,7 +222,7 @@ static void outliner_scene_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "object", id->name + 2);
}
-static int outliner_material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool outliner_material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -246,7 +247,7 @@ static void outliner_material_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "material", id->name + 2);
}
-static int outliner_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool outliner_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
@@ -289,7 +290,7 @@ static void outliner_main_region_draw(const bContext *C, ARegion *ar)
/* clear */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
draw_outliner(C);
@@ -610,4 +611,3 @@ void ED_spacetype_outliner(void)
BKE_spacetype_register(st);
}
-
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index a3fcbb34e7e..0e0936cf082 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -43,4 +43,3 @@ void SCRIPT_OT_python_file_run(struct wmOperatorType *ot);
void SCRIPT_OT_autoexec_warn_clear(struct wmOperatorType *ot);
#endif /* __SCRIPT_INTERN_H__ */
-
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index c8e5a4bdf87..8b6100cd9e0 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -55,6 +55,7 @@
#endif
#include "script_intern.h" // own include
+#include "GPU_framebuffer.h"
//static script_run_python(char *funcname, )
@@ -144,7 +145,7 @@ static void script_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -225,4 +226,3 @@ void ED_spacetype_script(void)
BKE_spacetype_register(st);
}
-
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index 72f78d4f466..a4bca555490 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -52,7 +52,7 @@
/* **************************** buttons ********************************* */
#if 0
-static int sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt))
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
@@ -102,4 +102,3 @@ void SEQUENCER_OT_properties(wmOperatorType *ot)
/* flags */
ot->flag = 0;
}
-
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index ffcb4329726..7da20131069 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -61,6 +61,8 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
+#include "GPU_framebuffer.h"
#include "ED_anim_api.h"
#include "ED_gpencil.h"
@@ -263,7 +265,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.5f);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immBegin(GWN_PRIM_TRI_STRIP, length * 2);
@@ -296,7 +298,7 @@ static void drawseqwave(View2D *v2d, const bContext *C, SpaceSeq *sseq, Scene *s
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, float x2, float y2)
@@ -328,8 +330,8 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
offset = 0;
}
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
for (seq = seqbase->first; seq; seq = seq->next) {
chan_min = min_ii(chan_min, seq->machine);
@@ -379,7 +381,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* clamp handles to defined size in pixel space */
@@ -432,9 +434,9 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
if (!(seq->type & SEQ_TYPE_EFFECT) ||
BKE_sequence_effect_get_num_inputs(seq->type) == 0)
{
- glEnable(GL_BLEND);
+ GPU_blend(true);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
if (seq->flag & whichsel) {
immUniformColor4ub(0, 0, 0, 80);
@@ -461,7 +463,7 @@ static void draw_seq_handle(View2D *v2d, Sequence *seq, const float handsize_cla
immVertex2fv(pos, v3);
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if ((G.moving & G_TRANSFORM_SEQ) || (seq->flag & whichsel)) {
@@ -618,8 +620,8 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
blendcol[0] = blendcol[1] = blendcol[2] = 120;
if (seq->startofs || seq->endofs) {
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
color3ubv_from_seq(scene, seq, col);
@@ -658,12 +660,12 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
}
if (seq->startofs || seq->endofs) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (seq->startstill || seq->endstill) {
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
color3ubv_from_seq(scene, seq, col);
UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5f, 60);
@@ -691,7 +693,7 @@ static void draw_sequence_extensions(Scene *scene, ARegion *ar, Sequence *seq, u
}
if (seq->startstill || seq->endstill) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -728,8 +730,8 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
if (seq->flag & SEQ_MUTE) {
background_col[3] = 128;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
else {
background_col[3] = 255;
@@ -751,7 +753,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
}
if (seq->flag & SEQ_MUTE) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (!is_single_image) {
@@ -777,7 +779,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
/* draw lock */
if (seq->flag & SEQ_LOCK) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES);
@@ -791,11 +793,11 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (!BKE_sequence_is_valid_check(seq)) {
- glEnable(GL_BLEND);
+ GPU_blend(true);
pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES);
@@ -809,7 +811,7 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
color3ubv_from_seq(scene, seq, col);
@@ -840,8 +842,8 @@ static void draw_seq_strip(const bContext *C, SpaceSeq *sseq, Scene *scene, AReg
if (seq->flag & SEQ_MUTE) {
col[3] = 96;
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
immUniformColor4ubv(col);
}
@@ -1035,7 +1037,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
float x2 = v2d->tot.xmax;
float y2 = v2d->tot.ymax;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
/* border */
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -1043,11 +1045,11 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
immUniformThemeColor(TH_BACK);
- immUniform1i("num_colors", 0); /* Simple dashes. */
+ immUniform1i("colors_len", 0); /* Simple dashes. */
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -1124,8 +1126,8 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
if ((!draw_overlay || sseq->overlay_type == SEQ_DRAW_OVERLAY_REFERENCE) && !draw_backdrop) {
UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
- glClearColor(col[0], col[1], col[2], 0.0);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(col[0], col[1], col[2], 0.0);
+ GPU_clear(GPU_COLOR_BIT);
}
/* only initialize the preview if a render is in progress */
@@ -1221,8 +1223,8 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
}
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
/* Format needs to be created prior to any immBindProgram call.
@@ -1418,7 +1420,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
}
if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
glDeleteTextures(1, &texid);
@@ -1589,7 +1591,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
/* draw highlight when previewing a single strip */
if (special_seq_update) {
const Sequence *seq = special_seq_update;
- glEnable(GL_BLEND);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1599,7 +1601,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -1609,7 +1611,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
const int frame_sta = PSFRA;
const int frame_end = PEFRA + 1;
- glEnable(GL_BLEND);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1660,7 +1662,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
/* Draw Timeline/Strip Editor Mode for Sequencer */
@@ -1677,10 +1679,10 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_BACK, col);
if (ed && ed->metastack.first)
- glClearColor(col[0], col[1], col[2] - 0.1f, 0.0f);
+ GPU_clear_color(col[0], col[1], col[2] - 0.1f, 0.0f);
else
- glClearColor(col[0], col[1], col[2], 0.0f);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear_color(col[0], col[1], col[2], 0.0f);
+ GPU_clear(GPU_COLOR_BIT);
UI_view2d_view_ortho(v2d);
@@ -1764,5 +1766,3 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
ANIM_draw_cfra_number(C, v2d, cfra_flag);
}
}
-
-
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index a78b3ee79c1..cefc6cdd814 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -476,7 +476,7 @@ void recurs_sel_seq(Sequence *seqm)
}
}
-int ED_space_sequencer_maskedit_mask_poll(bContext *C)
+bool ED_space_sequencer_maskedit_mask_poll(bContext *C)
{
/* in this case both funcs are the same, for clip editor not */
return ED_space_sequencer_maskedit_poll(C);
@@ -491,7 +491,7 @@ bool ED_space_sequencer_check_show_maskedit(SpaceSeq *sseq, Scene *scene)
return false;
}
-int ED_space_sequencer_maskedit_poll(bContext *C)
+bool ED_space_sequencer_maskedit_poll(bContext *C)
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
@@ -1149,27 +1149,27 @@ static int seq_get_snaplimit(View2D *v2d)
#endif
/* Operator functions */
-int sequencer_edit_poll(bContext *C)
+bool sequencer_edit_poll(bContext *C)
{
return (BKE_sequencer_editing_get(CTX_data_scene(C), false) != NULL);
}
#if 0 /* UNUSED */
-int sequencer_strip_poll(bContext *C)
+bool sequencer_strip_poll(bContext *C)
{
Editing *ed;
return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), false)) != NULL) && (ed->act_seq != NULL));
}
#endif
-int sequencer_strip_has_path_poll(bContext *C)
+bool sequencer_strip_has_path_poll(bContext *C)
{
Editing *ed;
Sequence *seq;
return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), false)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
}
-int sequencer_view_preview_poll(bContext *C)
+bool sequencer_view_preview_poll(bContext *C)
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
Editing *ed = BKE_sequencer_editing_get(CTX_data_scene(C), false);
@@ -1179,7 +1179,7 @@ int sequencer_view_preview_poll(bContext *C)
return 0;
}
-int sequencer_view_strips_poll(bContext *C)
+bool sequencer_view_strips_poll(bContext *C)
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
if (sseq && ED_space_sequencer_check_show_strip(sseq))
@@ -1534,7 +1534,7 @@ static void sequencer_slip_update_header(Scene *scene, ScrArea *sa, SlipData *da
}
}
- ED_area_headerprint(sa, msg);
+ ED_area_status_text(sa, msg);
}
static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1605,7 +1605,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
MEM_freeN(data);
op->customdata = NULL;
if (sa) {
- ED_area_headerprint(sa, NULL);
+ ED_area_status_text(sa, NULL);
}
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
@@ -1638,7 +1638,7 @@ static int sequencer_slip_modal(bContext *C, wmOperator *op, const wmEvent *even
BKE_sequencer_free_imbuf(scene, &ed->seqbase, false);
if (sa) {
- ED_area_headerprint(sa, NULL);
+ ED_area_status_text(sa, NULL);
}
return OPERATOR_CANCELLED;
@@ -1914,7 +1914,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot)
}
/* reload operator */
-static int sequencer_refresh_all_poll(bContext *C)
+static bool sequencer_refresh_all_poll(bContext *C)
{
if (G.is_rendering) {
return 0;
@@ -1976,7 +1976,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int sequencer_effect_poll(bContext *C)
+static bool sequencer_effect_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
@@ -2970,7 +2970,7 @@ static bool strip_jump_internal(Scene *scene,
return changed;
}
-static int sequencer_strip_jump_poll(bContext *C)
+static bool sequencer_strip_jump_poll(bContext *C)
{
/* prevent changes during render */
if (G.is_rendering)
@@ -3953,7 +3953,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int sequencer_strip_is_text_poll(bContext *C)
+static bool sequencer_strip_is_text_poll(bContext *C)
{
Editing *ed;
Sequence *seq;
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 41fc98fbe4e..ef1559ca940 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -75,12 +75,12 @@ void recurs_sel_seq(struct Sequence *seqm);
int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3, const char **error_str);
/* operator helpers */
-int sequencer_edit_poll(struct bContext *C);
+bool sequencer_edit_poll(struct bContext *C);
/* UNUSED */
-//int sequencer_strip_poll(struct bContext *C);
-int sequencer_strip_has_path_poll(struct bContext *C);
-int sequencer_view_preview_poll(struct bContext *C);
-int sequencer_view_strips_poll(struct bContext *C);
+//bool sequencer_strip_poll(struct bContext *C);
+bool sequencer_strip_has_path_poll(struct bContext *C);
+bool sequencer_view_preview_poll(struct bContext *C);
+bool sequencer_view_strips_poll(struct bContext *C);
/* externs */
extern EnumPropertyItem sequencer_prop_effect_types[];
@@ -212,4 +212,3 @@ int sequencer_image_seq_get_minmax_frame(struct wmOperator *op, int sfra, int *r
void sequencer_image_seq_reserve_frames(struct wmOperator *op, struct StripElem *se, int len, int minframe, int numdigits);
#endif /* __SEQUENCER_INTERN_H__ */
-
diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c
index 7ab9308f9a6..3c4481b32cb 100644
--- a/source/blender/editors/space_sequencer/sequencer_modifier.c
+++ b/source/blender/editors/space_sequencer/sequencer_modifier.c
@@ -50,7 +50,7 @@
/*********************** Add modifier operator *************************/
-static int strip_modifier_active_poll(bContext *C)
+static bool strip_modifier_active_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
Editing *ed = BKE_sequencer_editing_get(scene, false);
@@ -281,4 +281,3 @@ void SEQUENCER_OT_strip_modifier_copy(wmOperatorType *ot)
/* properties */
ot->prop = RNA_def_enum(ot->srna, "type", type_items, SEQ_MODIFIER_COPY_REPLACE, "Type", "");
}
-
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index d7206a6da4e..1ec9ea53e33 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -557,7 +557,7 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
};
/* identifiers */
- ot->name = "Activate/Select";
+ ot->name = "Select";
ot->idname = "SEQUENCER_OT_select";
ot->description = "Select a strip (last selected becomes the \"active strip\")";
@@ -1282,4 +1282,3 @@ void SEQUENCER_OT_select_grouped(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_active_channel", false, "Same Channel",
"Only consider strips on the same channel as the active one");
}
-
diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 88dcc3a8821..fb4ef3e51ab 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -220,7 +220,7 @@ static void sample_cancel(bContext *C, wmOperator *op)
sample_exit(C, op);
}
-static int sample_poll(bContext *C)
+static bool sample_poll(bContext *C)
{
SpaceSeq *sseq = CTX_wm_space_seq(C);
return sseq && BKE_sequencer_editing_get(CTX_data_scene(C), false) != NULL;
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index fc47934bc1e..04be1f82a60 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -367,7 +367,7 @@ static void sequencer_listener(
/* ************* dropboxes ************* */
-static int image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
@@ -381,7 +381,7 @@ static int image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
return 0;
}
-static int movie_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool movie_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
@@ -394,7 +394,7 @@ static int movie_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
return 0;
}
-static int sound_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool sound_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
@@ -529,7 +529,7 @@ static void sequencer_main_region_listener(
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
- if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
+ if (ELEM(wmn->data, ND_ANIMPLAY))
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c
index 4c6a2eea469..5ff32b98f90 100644
--- a/source/blender/editors/space_statusbar/space_statusbar.c
+++ b/source/blender/editors/space_statusbar/space_statusbar.c
@@ -56,21 +56,8 @@ static SpaceLink *statusbar_new(const ScrArea *UNUSED(area), const Scene *UNUSED
sstatusbar = MEM_callocN(sizeof(*sstatusbar), "init statusbar");
sstatusbar->spacetype = SPACE_STATUSBAR;
- /* header regions */
- /* *** NOTE: ***
- * Python layout code (space_statusbar.py) depends on the list order of
- * these! Not nice at all, but the only way to identify the correct header
- * to draw to is using alignment + list position. It can't use alignment
- * only since code below has to set two right aligned regions - XXX. */
- ar = MEM_callocN(sizeof(*ar), "right aligned header for statusbar");
- BLI_addtail(&sstatusbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = RGN_ALIGN_RIGHT;
- ar = MEM_callocN(sizeof(*ar), "center header for statusbar");
- BLI_addtail(&sstatusbar->regionbase, ar);
- ar->regiontype = RGN_TYPE_HEADER;
- ar->alignment = RGN_ALIGN_RIGHT; /* Right aligned too, so region layout code scales it correctly. */
- ar = MEM_callocN(sizeof(*ar), "left aligned header for statusbar");
+ /* header region */
+ ar = MEM_callocN(sizeof(*ar), "header for statusbar");
BLI_addtail(&sstatusbar->regionbase, ar);
ar->regiontype = RGN_TYPE_HEADER;
ar->alignment = RGN_ALIGN_NONE;
@@ -128,7 +115,7 @@ static void statusbar_header_region_listener(
/* context changes */
switch (wmn->category) {
case NC_SCREEN:
- if (ELEM(wmn->data, ND_LAYER, ND_SCREENCAST, ND_ANIMPLAY)) {
+ if (ELEM(wmn->data, ND_LAYER, ND_ANIMPLAY)) {
ED_region_tag_redraw(ar);
}
break;
@@ -186,7 +173,7 @@ void ED_spacetype_statusbar(void)
/* regions: header window */
art = MEM_callocN(sizeof(*art), "spacetype statusbar header region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey = HEADERY;
+ art->prefsizey = 0.8f * HEADERY;
art->prefsizex = UI_UNIT_X * 5; /* Mainly to avoid glitches */
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
art->init = statusbar_header_region_init;
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index e827f4f0149..c3e2945f3ff 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -59,6 +59,7 @@
#include "text_format.h"
#include "text_intern.h" /* own include */
+#include "GPU_framebuffer.h"
/* ******************** default callbacks for text space ***************** */
@@ -299,7 +300,11 @@ static void text_keymap(struct wmKeyConfig *keyconf)
RNA_string_set(kmi->ptr, "data_path", "space_data.font_size");
RNA_boolean_set(kmi->ptr, "reverse", true);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "TEXT_OT_new", NKEY, KM_PRESS, KM_CTRL, 0);
+#else
+ WM_keymap_add_item(keymap, "TEXT_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
+#endif
WM_keymap_add_item(keymap, "TEXT_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
@@ -441,7 +446,7 @@ static void text_main_region_draw(const bContext *C, ARegion *ar)
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT);
+ GPU_clear(GPU_COLOR_BIT);
// UI_view2d_view_ortho(v2d);
@@ -470,7 +475,7 @@ static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
/* ************* dropboxes ************* */
-static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool text_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_PATH) {
/* rule might not work? */
@@ -487,7 +492,7 @@ static void text_drop_copy(wmDrag *drag, wmDropBox *drop)
RNA_string_set(drop->ptr, "filepath", drag->path);
}
-static int text_drop_paste_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool text_drop_paste_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID)
return true;
@@ -640,4 +645,3 @@ void ED_spacetype_text(void)
ED_text_format_register_pov();
ED_text_format_register_pov_ini();
}
-
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index 9163831c333..4f6a3bc82ba 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -40,7 +40,10 @@
#include "WM_api.h"
#include "WM_types.h"
+#include "ED_text.h"
+#include "ED_undo.h"
#include "ED_screen.h"
+
#include "UI_interface.h"
#include "text_format.h"
@@ -284,10 +287,11 @@ static int text_autocomplete_invoke(bContext *C, wmOperator *op, const wmEvent *
ED_area_tag_redraw(CTX_wm_area(C));
if (texttool_suggest_first() == texttool_suggest_last()) {
- TextUndoBuf *utxt = NULL; // FIXME
+ TextUndoBuf *utxt = ED_text_undo_push_init(C);
confirm_suggestion(st->text, utxt);
text_update_line_edited(st->text->curl);
text_autocomplete_free(C, op);
+ ED_undo_push(C, op->type->name);
return OPERATOR_FINISHED;
}
else {
@@ -315,8 +319,6 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
(void)text;
- TextUndoBuf *utxt = NULL; // FIXME
-
if (st->doplugins && texttool_text_is_active(st->text)) {
if (texttool_suggest_first()) tools |= TOOL_SUGG_LIST;
if (texttool_docs_get()) tools |= TOOL_DOCUMENT;
@@ -343,8 +345,10 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
case MIDDLEMOUSE:
if (event->val == KM_PRESS) {
if (text_do_suggest_select(st, ar)) {
+ TextUndoBuf *utxt = ED_text_undo_push_init(C);
confirm_suggestion(st->text, utxt);
text_update_line_edited(st->text->curl);
+ ED_undo_push(C, op->type->name);
swallow = 1;
}
else {
@@ -378,8 +382,10 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
case PADENTER:
if (event->val == KM_PRESS) {
if (tools & TOOL_SUGG_LIST) {
+ TextUndoBuf *utxt = ED_text_undo_push_init(C);
confirm_suggestion(st->text, utxt);
text_update_line_edited(st->text->curl);
+ ED_undo_push(C, op->type->name);
swallow = 1;
draw = 1;
}
@@ -591,5 +597,6 @@ void TEXT_OT_autocomplete(wmOperatorType *ot)
ot->poll = text_space_edit_poll;
/* flags */
+ /* Undo is handled conditionally by this operator. */
ot->flag = OPTYPE_BLOCKING;
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index c1b49fbd32a..21cd24cf84c 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -50,6 +50,7 @@
#include "BIF_glutil.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -1207,10 +1208,10 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
immUniformColor4ub(255, 255, 255, 32);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
immRecti(pos, x1 - 4, y1, x2, y2);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
@@ -1506,10 +1507,10 @@ void draw_text_main(SpaceText *st, ARegion *ar)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformThemeColor(TH_GRID); /* same color as line number background */
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 3d964d07908..896b5444a85 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -72,7 +72,7 @@ static ARegion *text_has_properties_region(ScrArea *sa)
return arnew;
}
-static int text_properties_poll(bContext *C)
+static bool text_properties_poll(bContext *C)
{
return (CTX_wm_space_text(C) != NULL);
}
@@ -212,4 +212,3 @@ void TEXT_OT_start_find(wmOperatorType *ot)
UI_popup_menu_end(C, pup);
}
#endif
-
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index bc902135b50..02948d35623 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -142,7 +142,7 @@ void TEXT_OT_to_3d_object(struct wmOperatorType *ot);
void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
-int text_space_edit_poll(struct bContext *C);
+bool text_space_edit_poll(struct bContext *C);
/* text_autocomplete.c */
void TEXT_OT_autocomplete(struct wmOperatorType *ot);
@@ -151,4 +151,3 @@ void TEXT_OT_autocomplete(struct wmOperatorType *ot);
extern const char *text_context_dir[]; /* doc access */
#endif /* __TEXT_INTERN_H__ */
-
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index e34edc8908f..a8c14a3d4c1 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -80,12 +80,12 @@ BLI_INLINE int text_pixel_x_to_column(SpaceText *st, const int x)
return (x + (st->cwidth / 2)) / st->cwidth;
}
-static int text_new_poll(bContext *UNUSED(C))
+static bool text_new_poll(bContext *UNUSED(C))
{
return 1;
}
-static int text_edit_poll(bContext *C)
+static bool text_edit_poll(bContext *C)
{
Text *text = CTX_data_edit_text(C);
@@ -100,7 +100,7 @@ static int text_edit_poll(bContext *C)
return 1;
}
-int text_space_edit_poll(bContext *C)
+bool text_space_edit_poll(bContext *C)
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
@@ -116,7 +116,7 @@ int text_space_edit_poll(bContext *C)
return 1;
}
-static int text_region_edit_poll(bContext *C)
+static bool text_region_edit_poll(bContext *C)
{
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
@@ -361,7 +361,7 @@ void TEXT_OT_reload(wmOperatorType *ot)
/******************* delete operator *********************/
-static int text_unlink_poll(bContext *C)
+static bool text_unlink_poll(bContext *C)
{
/* it should be possible to unlink texts if they're lib-linked in... */
return CTX_data_edit_text(C) != NULL;
@@ -447,7 +447,7 @@ void TEXT_OT_make_internal(wmOperatorType *ot)
/******************* save operator *********************/
-static int text_save_poll(bContext *C)
+static bool text_save_poll(bContext *C)
{
Text *text = CTX_data_edit_text(C);
@@ -590,7 +590,7 @@ void TEXT_OT_save_as(wmOperatorType *ot)
/******************* run script operator *********************/
-static int text_run_script_poll(bContext *C)
+static bool text_run_script_poll(bContext *C)
{
return (CTX_data_edit_text(C) != NULL);
}
@@ -2142,7 +2142,7 @@ typedef struct TextScroll {
int zone;
} TextScroll;
-static int text_scroll_poll(bContext *C)
+static bool text_scroll_poll(bContext *C)
{
/* it should be possible to still scroll linked texts to read them, even if they can't be edited... */
return CTX_data_edit_text(C) != NULL;
@@ -2325,7 +2325,7 @@ void TEXT_OT_scroll(wmOperatorType *ot)
/******************** scroll bar operator *******************/
-static int text_region_scroll_poll(bContext *C)
+static bool text_region_scroll_poll(bContext *C)
{
/* same as text_region_edit_poll except it works on libdata too */
SpaceText *st = CTX_wm_space_text(C);
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 1d3c24c518a..fc5182fcb4f 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -196,4 +196,3 @@ void ED_spacetype_userpref(void)
BKE_spacetype_register(st);
}
-
diff --git a/source/blender/editors/space_userpref/userpref_intern.h b/source/blender/editors/space_userpref/userpref_intern.h
index d67ba32f68b..720b4da0f71 100644
--- a/source/blender/editors/space_userpref/userpref_intern.h
+++ b/source/blender/editors/space_userpref/userpref_intern.h
@@ -34,4 +34,3 @@
/* internal exports only */
#endif /* __USERPREF_INTERN_H__ */
-
diff --git a/source/blender/editors/space_userpref/userpref_ops.c b/source/blender/editors/space_userpref/userpref_ops.c
index c5a62f46c36..6666a6cfc16 100644
--- a/source/blender/editors/space_userpref/userpref_ops.c
+++ b/source/blender/editors/space_userpref/userpref_ops.c
@@ -31,5 +31,3 @@
#include <string.h>
#include <stdio.h>
-
-
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 1224c284d5f..bca5faa314a 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -100,6 +100,8 @@
#include "GPU_immediate_util.h"
#include "GPU_batch.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
+#include "GPU_framebuffer.h"
#include "ED_mesh.h"
#include "ED_particle.h"
@@ -289,7 +291,7 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
+ GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
immBeginAtMost(GWN_PRIM_POINTS, imm_len);
dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
@@ -332,7 +334,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
+ GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
immBeginAtMost(GWN_PRIM_POINTS, em->bm->totvert);
dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, &data, DM_FOREACH_NOP);
@@ -343,7 +345,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
#else
static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
{
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
+ GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE));
Mesh *me = em->ob->data;
Gwn_Batch *batch = DRW_mesh_batch_cache_get_verts_with_select_id(me, offset);
@@ -384,7 +386,7 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBeginAtMost(GWN_PRIM_LINES, imm_len);
dm->foreachMappedEdge(dm, bbs_mesh_wire__mapFunc, &data);
@@ -395,7 +397,7 @@ static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
#else
static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *UNUSED(dm), int offset)
{
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
Mesh *me = em->ob->data;
Gwn_Batch *batch = DRW_mesh_batch_cache_get_edges_with_select_id(me, offset);
@@ -503,7 +505,7 @@ static void bbs_mesh_face_dot(BMEditMesh *em, DerivedMesh *dm)
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR_U32);
- glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
+ GPU_point_size(UI_GetThemeValuef(TH_FACEDOT_SIZE));
immBeginAtMost(GWN_PRIM_POINTS, em->bm->totface);
dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, &data, DM_FOREACH_NOP);
@@ -621,8 +623,8 @@ void draw_object_backbufsel(
gpuMultMatrix(ob->obmat);
- glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT);
- glEnable(GL_DEPTH_TEST);
+ glClearDepth(1.0); GPU_clear(GPU_DEPTH_BIT);
+ GPU_depth_test(true);
switch (ob->type) {
case OB_MESH:
@@ -722,7 +724,7 @@ void ED_draw_object_facemap(
glColor4fv(col);
gpuPushAttrib(GL_ENABLE_BIT);
- glEnable(GL_BLEND);
+ GPU_blend(true);
glDisable(GL_LIGHTING);
/* always draw using backface culling */
@@ -752,8 +754,8 @@ void ED_draw_object_facemap(
immUniformColor4fv(col);
/* XXX, alpha isn't working yet, not sure why. */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
MVert *mvert;
@@ -810,10 +812,9 @@ void ED_draw_object_facemap(
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
#endif
dm->release(dm);
}
-
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 3b648e3b13a..c6874a663a5 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -1,4 +1,4 @@
-/*
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -40,8 +40,8 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_colorband.h"
+#include "BKE_deform.h"
#include "BKE_particle.h"
#include "smoke_API.h"
@@ -50,6 +50,7 @@
#include "GPU_shader.h"
#include "GPU_texture.h"
+#include "GPU_state.h"
#include "view3d_intern.h" // own include
@@ -632,11 +633,11 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth);
glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)&gl_depth_write);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
glDepthMask(GL_FALSE);
- glEnable(GL_BLEND);
+ GPU_blend(true);
- glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
draw_buffer(sds, shader, &slicer, ob_sizei, invsize, num_points, false);
/* Draw fire separately (T47639). */
@@ -655,11 +656,11 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
glDepthMask(gl_depth_write);
if (!gl_blend) {
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
if (gl_depth) {
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
@@ -684,7 +685,7 @@ static void add_needle(float (*verts)[3], float (*colors)[3], float center[3],
float len = len_v3(dir);
float rgb[3];
- weight_to_rgb(rgb, len);
+ BKE_defvert_weight_to_rgb(rgb, len);
if (len != 0.0f) {
mul_v3_fl(dir, 1.0f / len);
@@ -724,7 +725,7 @@ static void add_streamline(float (*verts)[3], float(*colors)[3], float center[3]
const float len = len_v3(dir);
float rgb[3];
- weight_to_rgb(rgb, len);
+ BKE_defvert_weight_to_rgb(rgb, len);
copy_v3_v3(colors[(*offset)], rgb);
copy_v3_v3(verts[(*offset)++], center);
@@ -831,7 +832,7 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, float viewnormal[3])
}
}
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, verts);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index d77b13630e3..4660255cc6c 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -335,6 +335,9 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene)
v3d->overlay.flag = V3D_OVERLAY_LOOK_DEV;
v3d->overlay.wireframe_threshold = 0.5f;
v3d->overlay.bone_selection_alpha = 0.5f;
+ v3d->overlay.texture_paint_mode_opacity = 0.8;
+ v3d->overlay.weight_paint_mode_opacity = 0.8;
+ v3d->overlay.vertex_paint_mode_opacity = 0.8;
v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR;
@@ -549,7 +552,7 @@ static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar)
}
}
-static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID) {
ID *id = drag->poin;
@@ -559,7 +562,7 @@ static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent
return 0;
}
-static int view3d_collection_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool view3d_collection_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID) {
ID *id = drag->poin;
@@ -569,7 +572,7 @@ static int view3d_collection_drop_poll(bContext *UNUSED(C), wmDrag *drag, const
return 0;
}
-static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID) {
ID *id = drag->poin;
@@ -579,7 +582,7 @@ static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent
return 0;
}
-static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
+static bool view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
{
if (drag->type == WM_DRAG_ID) {
ID *id = drag->poin;
@@ -593,7 +596,7 @@ static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent
return 0;
}
-static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
if (event->ctrl)
return false;
@@ -604,7 +607,7 @@ static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *eve
return 0;
}
-static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
@@ -618,7 +621,7 @@ static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *
return 0;
}
-static int view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
+static bool view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
@@ -1407,7 +1410,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
if (view_layer->basact) {
Object *ob = view_layer->basact->object;
/* if hidden but in edit mode, we still display, can happen with animation */
- if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (ob->mode & OB_MODE_EDIT)) {
+ if ((view_layer->basact->flag & BASE_VISIBLE) != 0 || (ob->mode & OB_MODE_EDIT)) {
CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, view_layer->basact);
}
}
@@ -1419,7 +1422,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
if (view_layer->basact) {
Object *ob = view_layer->basact->object;
/* if hidden but in edit mode, we still display, can happen with animation */
- if ((view_layer->basact->flag & BASE_VISIBLED) != 0 || (ob->mode & OB_MODE_EDIT) != 0) {
+ if ((view_layer->basact->flag & BASE_VISIBLE) != 0 || (ob->mode & OB_MODE_EDIT) != 0) {
CTX_data_id_pointer_set(result, &ob->id);
}
}
@@ -1538,11 +1541,6 @@ void ED_spacetype_view3d(void)
art->draw = view3d_tools_region_draw;
BLI_addhead(&st->regiontypes, art);
-#if 0
- /* unfinished still */
- view3d_toolshelf_register(art);
-#endif
-
/* regions: header */
art = MEM_callocN(sizeof(ARegionType), "spacetype view3d header region");
art->regionid = RGN_TYPE_HEADER;
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 6ebed88728e..f5e8bf10817 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.c
@@ -786,7 +786,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
}
}
-static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
{
ViewLayer *view_layer = CTX_data_view_layer(C);
Object *ob = OBACT(view_layer);
@@ -1120,7 +1120,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
}
-static int view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt))
{
ViewLayer *view_layer = CTX_data_view_layer(C);
return (view_layer->basact != NULL);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index fd2f604651b..0d5240d8e86 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -44,6 +44,7 @@
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_key.h"
+#include "BKE_main.h"
#include "BKE_scene.h"
#include "BKE_object.h"
#include "BKE_paint.h"
@@ -79,6 +80,8 @@
#include "GPU_immediate_util.h"
#include "GPU_material.h"
#include "GPU_viewport.h"
+#include "GPU_state.h"
+#include "GPU_framebuffer.h"
#include "MEM_guardedalloc.h"
@@ -449,7 +452,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
x2 = viewborder.xmax;
y2 = viewborder.ymax;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
/* apply offsets so the real 3D camera shows through */
@@ -477,8 +480,8 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
float alpha = 1.0f;
if (ca->passepartalpha != 1.0f) {
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
alpha = ca->passepartalpha;
}
@@ -493,7 +496,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
if (y2i > 0.0f)
immRectf(shdr_pos, x1i, y1i, x2i, 0.0f);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUniformThemeColor(TH_BACK);
@@ -515,10 +518,10 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View
{
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -672,15 +675,15 @@ static void drawrenderborder(ARegion *ar, View3D *v3d)
/* use the same program for everything */
uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniform4f("color", 1.0f, 0.25f, 0.25f, 1.0f);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -716,7 +719,7 @@ void ED_view3d_draw_depth(
ED_view3d_draw_setup_view(NULL, depsgraph, scene, ar, v3d, NULL, NULL, NULL);
- glClear(GL_DEPTH_BUFFER_BIT);
+ GPU_clear(GPU_DEPTH_BIT);
if (rv3d->rflag & RV3D_CLIPPING) {
ED_view3d_clipping_set(rv3d);
@@ -725,7 +728,7 @@ void ED_view3d_draw_depth(
rv3d->rflag |= RV3D_ZOFFSET_DISABLED;
v3d->zbuf = true;
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
DRW_draw_depth_loop(depsgraph, ar, v3d);
@@ -735,7 +738,7 @@ void ED_view3d_draw_depth(
rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED;
v3d->zbuf = zbuf;
- if (!v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (!v3d->zbuf) GPU_depth_test(false);
U.glalphaclip = glalphaclip;
v3d->flag = flag;
@@ -807,10 +810,10 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
}
/* draw axis lines */
- glLineWidth(2.0f);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_line_width(2.0f);
+ GPU_line_smooth(true);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
Gwn_VertFormat *format = immVertexFormat();
unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -830,7 +833,7 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect)
immEnd();
immUnbindProgram();
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
/* draw axis names */
for (int axis_i = 0; axis_i < 3; axis_i++) {
@@ -853,8 +856,8 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d)
negate_v3_v3(o, rv3d->ofs);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
glDepthMask(GL_FALSE); /* don't overwrite zbuf */
Gwn_VertFormat *format = immVertexFormat();
@@ -937,7 +940,7 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d)
/* -- draw rotation center -- */
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
- glPointSize(5.0f);
+ GPU_point_size(5.0f);
immBegin(GWN_PRIM_POINTS, 1);
immAttrib4ubv(col, color);
immVertex3fv(pos, o);
@@ -951,7 +954,7 @@ static void UNUSED_FUNCTION(draw_rotation_guide)(RegionView3D *rv3d)
/* ^^ just playing around, does not work */
#endif
- glDisable(GL_BLEND);
+ GPU_blend(false);
glDepthMask(GL_TRUE);
}
#endif /* WITH_INPUT_NDOF */
@@ -1182,7 +1185,7 @@ static void draw_selected_name(Scene *scene, Object *ob, rcti *rect)
/**
* Information drawn on top of the solid plates and composed data
*/
-void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset)
+void view3d_draw_region_info(const bContext *C, ARegion *ar, const int UNUSED(offset))
{
RegionView3D *rv3d = ar->regiondata;
View3D *v3d = CTX_wm_view3d(C);
@@ -1196,8 +1199,6 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar, const int offset)
rcti rect;
ED_region_visible_rect(ar, &rect);
- /* Leave room for previously drawn info. */
- rect.ymax -= offset;
view3d_draw_border(C, ar);
view3d_draw_grease_pencil(C);
@@ -1271,11 +1272,12 @@ RenderEngineType *ED_view3d_engine_type(Scene *scene, int drawtype)
void view3d_main_region_draw(const bContext *C, ARegion *ar)
{
+ Main *bmain = CTX_data_main(C);
View3D *v3d = CTX_wm_view3d(C);
view3d_draw_view(C, ar);
- GPU_free_images_old();
+ GPU_free_images_old(bmain);
GPU_pass_cache_garbage_collect();
/* XXX This is in order to draw UI batches with the DRW
@@ -1283,7 +1285,7 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar)
gpu_batch_presets_reset();
/* No depth test for drawing action zones afterwards. */
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
v3d->flag |= V3D_INVALID_BACKBUF;
}
@@ -1348,7 +1350,7 @@ void ED_view3d_draw_offscreen(
if ((v3d->flag2 & V3D_RENDER_SHADOW) == 0) {
/* free images which can have changed on frame-change
* warning! can be slow so only free animated images - campbell */
- GPU_free_images_anim();
+ GPU_free_images_anim(G.main); /* XXX :((( */
}
gpuPushProjectionMatrix();
diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c
index 3a89c910ea8..06cdba3f537 100644
--- a/source/blender/editors/space_view3d/view3d_draw_legacy.c
+++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c
@@ -57,7 +57,6 @@
#include "BKE_camera.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_layer.h"
@@ -105,6 +104,7 @@
#include "GPU_immediate_util.h"
#include "GPU_select.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "RE_engine.h"
@@ -246,16 +246,16 @@ static void backdrawview3d(
if (rv3d->gpuoffscreen)
GPU_offscreen_bind(rv3d->gpuoffscreen, true);
else
- glScissor(ar->winrct.xmin, ar->winrct.ymin, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct));
+ GPU_scissor(ar->winrct.xmin, ar->winrct.ymin, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct));
- glClearColor(0.0, 0.0, 0.0, 0.0);
+ GPU_clear_color(0.0, 0.0, 0.0, 0.0);
if (v3d->zbuf) {
- glEnable(GL_DEPTH_TEST);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+ GPU_depth_test(true);
+ GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT);
}
else {
- glClear(GL_COLOR_BUFFER_BIT);
- glDisable(GL_DEPTH_TEST);
+ GPU_clear(GPU_COLOR_BIT);
+ GPU_depth_test(false);
}
if (rv3d->rflag & RV3D_CLIPPING)
@@ -263,7 +263,7 @@ static void backdrawview3d(
G.f |= G_BACKBUFSEL;
- if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLED) != 0)) {
+ if (obact_eval && ((obact_eval->base_flag & BASE_VISIBLE) != 0)) {
draw_object_backbufsel(depsgraph, scene_eval, v3d, rv3d, obact_eval, select_mode);
}
@@ -274,7 +274,7 @@ static void backdrawview3d(
G.f &= ~G_BACKBUFSEL;
v3d->zbuf = false;
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
glEnable(GL_DITHER);
if (rv3d->rflag & RV3D_CLIPPING)
@@ -684,11 +684,11 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
ibuf = ibuf->mipmap[mip - 1];
}
- if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
+ if (v3d->zbuf) GPU_depth_test(false);
glDepthMask(GL_FALSE);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
gpuPushProjectionMatrix();
gpuPushMatrix();
@@ -715,10 +715,10 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph,
gpuPopProjectionMatrix();
gpuPopMatrix();
- glDisable(GL_BLEND);
+ GPU_blend(false);
glDepthMask(GL_TRUE);
- if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
+ if (v3d->zbuf) GPU_depth_test(true);
if (freeibuf)
IMB_freeImBuf(freeibuf);
@@ -883,17 +883,17 @@ void ED_view3d_draw_depth_gpencil(
/* Setup view matrix. */
ED_view3d_draw_setup_view(NULL, depsgraph, scene, ar, v3d, NULL, NULL, NULL);
- glClear(GL_DEPTH_BUFFER_BIT);
+ GPU_clear(GPU_DEPTH_BIT);
v3d->zbuf = true;
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
if (v3d->flag2 & V3D_SHOW_GPENCIL) {
ED_gpencil_draw_view3d(NULL, scene, view_layer, depsgraph, v3d, ar, true);
}
v3d->zbuf = zbuf;
- if (!zbuf) glDisable(GL_DEPTH_TEST);
+ if (!zbuf) GPU_depth_test(false);
}
/* *********************** customdata **************** */
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index bae186097a8..cc30375255d 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -940,7 +940,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
/* test for unlocked camera view in quad view */
-static int view3d_camera_user_poll(bContext *C)
+static bool view3d_camera_user_poll(bContext *C)
{
View3D *v3d;
ARegion *ar;
@@ -955,7 +955,7 @@ static int view3d_camera_user_poll(bContext *C)
return 0;
}
-static int view3d_lock_poll(bContext *C)
+static bool view3d_lock_poll(bContext *C)
{
View3D *v3d = CTX_wm_view3d(C);
if (v3d) {
@@ -1554,7 +1554,7 @@ static int ndof_all_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void VIEW3D_OT_ndof_all(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name = "NDOF Move View";
+ ot->name = "NDOF Pan View";
ot->description = "Pan and rotate the view with the 3D mouse";
ot->idname = "VIEW3D_OT_ndof_all";
@@ -1744,7 +1744,7 @@ void VIEW3D_OT_move(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Move View";
+ ot->name = "Pan View";
ot->description = "Move the view";
ot->idname = "VIEW3D_OT_move";
@@ -4255,8 +4255,8 @@ static int viewpan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void VIEW3D_OT_view_pan(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "View Pan";
- ot->description = "Pan the view";
+ ot->name = "Pan View Direction";
+ ot->description = "Pan the view in a given direction";
ot->idname = "VIEW3D_OT_view_pan";
/* api callbacks */
@@ -4553,7 +4553,7 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
/* cursor position in vec, result in vec, mval in region coords */
/* note: cannot use event->mval here (called by object_add() */
-void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
+void ED_view3d_cursor3d_position(bContext *C, const int mval[2], bool use_depth, float cursor_co[3])
{
ARegion *ar = CTX_wm_region(C);
View3D *v3d = CTX_wm_view3d(C);
@@ -4566,32 +4566,35 @@ void ED_view3d_cursor3d_position(bContext *C, float fp[3], const int mval[2])
if (rv3d == NULL)
return;
- ED_view3d_calc_zfac(rv3d, fp, &flip);
+ ED_view3d_calc_zfac(rv3d, cursor_co, &flip);
/* reset the depth based on the view offset (we _know_ the offset is infront of us) */
if (flip) {
- negate_v3_v3(fp, rv3d->ofs);
+ negate_v3_v3(cursor_co, rv3d->ofs);
/* re initialize, no need to check flip again */
- ED_view3d_calc_zfac(rv3d, fp, NULL /* &flip */ );
+ ED_view3d_calc_zfac(rv3d, cursor_co, NULL /* &flip */ );
}
- if (U.uiflag & USER_DEPTH_CURSOR) { /* maybe this should be accessed some other way */
+ if (use_depth) { /* maybe this should be accessed some other way */
struct Depsgraph *depsgraph = CTX_data_depsgraph(C);
view3d_operator_needs_opengl(C);
- if (ED_view3d_autodist(depsgraph, ar, v3d, mval, fp, true, NULL)) {
+ if (ED_view3d_autodist(depsgraph, ar, v3d, mval, cursor_co, true, NULL)) {
depth_used = true;
}
}
if (depth_used == false) {
float depth_pt[3];
- copy_v3_v3(depth_pt, fp);
- ED_view3d_win_to_3d_int(v3d, ar, depth_pt, mval, fp);
+ copy_v3_v3(depth_pt, cursor_co);
+ ED_view3d_win_to_3d_int(v3d, ar, depth_pt, mval, cursor_co);
}
}
-void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
+void ED_view3d_cursor3d_position_rotation(
+ bContext *C, const int mval[2],
+ const bool use_depth, enum eV3DCursorOrient orientation,
+ float cursor_co[3], float cursor_quat[4])
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -4599,16 +4602,26 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ar->regiondata;
- View3DCursor *cursor_curr = ED_view3d_cursor3d_get(scene, v3d);
- View3DCursor cursor_prev = *cursor_curr;
+ /* XXX, caller should check. */
+ if (rv3d == NULL)
+ return;
- ED_view3d_cursor3d_position(C, cursor_curr->location, mval);
- copy_qt_qt(cursor_curr->rotation, rv3d->viewquat);
- cursor_curr->rotation[0] *= -1.0f;
+ ED_view3d_cursor3d_position(C, mval, use_depth, cursor_co);
+
+ if (orientation == V3D_CURSOR_ORIENT_NONE) {
+ /* pass */
+ }
+ else if (orientation == V3D_CURSOR_ORIENT_VIEW) {
+ copy_qt_qt(cursor_quat, rv3d->viewquat);
+ cursor_quat[0] *= -1.0f;
+ }
+ else if (orientation == V3D_CURSOR_ORIENT_GEOM) {
+ copy_qt_qt(cursor_quat, rv3d->viewquat);
+ cursor_quat[0] *= -1.0f;
- {
const float mval_fl[2] = {UNPACK2(mval)};
float ray_no[3];
+ float ray_co[3];
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d(
bmain, scene, CTX_data_depsgraph(C), 0, ar, v3d);
@@ -4624,16 +4637,21 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
.use_object_edit_cage = false,
},
mval_fl, &dist_px,
- cursor_curr->location, ray_no, NULL,
+ ray_co, ray_no, NULL,
&ob_dummy, obmat))
{
+ if (use_depth) {
+ copy_v3_v3(cursor_co, ray_co);
+ }
+
float tquat[4];
+
/* Math normal (Z). */
{
float z_src[3] = {0, 0, 1};
- mul_qt_v3(cursor_curr->rotation, z_src);
+ mul_qt_v3(cursor_quat, z_src);
rotation_between_vecs_to_quat(tquat, z_src, ray_no);
- mul_qt_qtqt(cursor_curr->rotation, tquat, cursor_curr->rotation);
+ mul_qt_qtqt(cursor_quat, tquat, cursor_quat);
}
/* Match object matrix (X). */
@@ -4646,27 +4664,47 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
const int ortho_axis = axis_dominant_v3_ortho_single(ortho_axis_dot);
float x_src[3] = {1, 0, 0};
float x_dst[3];
- mul_qt_v3(cursor_curr->rotation, x_src);
+ mul_qt_v3(cursor_quat, x_src);
project_plane_v3_v3v3(x_dst, obmat[ortho_axis], ray_no);
normalize_v3(x_dst);
rotation_between_vecs_to_quat(tquat, x_src, x_dst);
- mul_qt_qtqt(cursor_curr->rotation, tquat, cursor_curr->rotation);
+ mul_qt_qtqt(cursor_quat, tquat, cursor_quat);
}
}
ED_transform_snap_object_context_destroy(snap_context);
}
+}
+
+void ED_view3d_cursor3d_update(
+ bContext *C, const int mval[2],
+ const bool use_depth, enum eV3DCursorOrient orientation)
+{
+ Scene *scene = CTX_data_scene(C);
+ View3D *v3d = CTX_wm_view3d(C);
+ ARegion *ar = CTX_wm_region(C);
+ RegionView3D *rv3d = ar->regiondata;
+
+ View3DCursor *cursor_curr = ED_view3d_cursor3d_get(scene, v3d);
+ View3DCursor cursor_prev = *cursor_curr;
+
+ ED_view3d_cursor3d_position_rotation(
+ C, mval,
+ use_depth, orientation,
+ cursor_curr->location, cursor_curr->rotation);
/* offset the cursor lock to avoid jumping to new offset */
if (v3d->ob_centre_cursor) {
if (U.uiflag & USER_LOCK_CURSOR_ADJUST) {
- float co_curr[2], co_prev[2];
+ float co_2d_curr[2], co_2d_prev[2];
- if ((ED_view3d_project_float_global(ar, cursor_prev.location, co_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
- (ED_view3d_project_float_global(ar, cursor_curr->location, co_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
+ if ((ED_view3d_project_float_global(
+ ar, cursor_prev.location, co_2d_prev, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
+ (ED_view3d_project_float_global(
+ ar, cursor_curr->location, co_2d_curr, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
{
- rv3d->ofs_lock[0] += (co_curr[0] - co_prev[0]) / (ar->winx * 0.5f);
- rv3d->ofs_lock[1] += (co_curr[1] - co_prev[1]) / (ar->winy * 0.5f);
+ rv3d->ofs_lock[0] += (co_2d_curr[0] - co_2d_prev[0]) / (ar->winx * 0.5f);
+ rv3d->ofs_lock[1] += (co_2d_curr[1] - co_2d_prev[1]) / (ar->winy * 0.5f);
}
}
else {
@@ -4689,9 +4727,20 @@ void ED_view3d_cursor3d_update(bContext *C, const int mval[2])
DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
}
-static int view3d_cursor3d_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
+static int view3d_cursor3d_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- ED_view3d_cursor3d_update(C, event->mval);
+ bool use_depth = (U.uiflag & USER_DEPTH_CURSOR);
+ {
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_depth");
+ if (RNA_property_is_set(op->ptr, prop)) {
+ use_depth = RNA_property_boolean_get(op->ptr, prop);
+ }
+ else {
+ RNA_property_boolean_set(op->ptr, prop, use_depth);
+ }
+ }
+ const enum eV3DCursorOrient orientation = RNA_enum_get(op->ptr, "orientation");
+ ED_view3d_cursor3d_update(C, event->mval, use_depth, orientation);
return OPERATOR_FINISHED;
}
@@ -4711,6 +4760,24 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
/* flags */
// ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ PropertyRNA *prop;
+ static const EnumPropertyItem orientation_items[] = {
+ {V3D_CURSOR_ORIENT_NONE, "NONE", 0, "None", "Leave orientation unchanged"},
+ {V3D_CURSOR_ORIENT_VIEW, "VIEW", 0, "View", "Orient to the viewport"},
+ {V3D_CURSOR_ORIENT_GEOM, "GEOM", 0, "Geometry", "Match the surface normal"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ prop = RNA_def_boolean(
+ ot->srna, "use_depth", true, "Surface Project",
+ "Project onto the surface");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ prop = RNA_def_enum(
+ ot->srna, "orientation", orientation_items, V3D_CURSOR_ORIENT_VIEW,
+ "Orientation", "Preset viewpoint to use");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/** \} */
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index d8cc9ab9828..f9fdf8c2cc0 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -333,7 +333,7 @@ static void fly_update_header(bContext *C, wmOperator *op, FlyInfo *fly)
#undef WM_MODALKEY
- ED_area_headerprint(CTX_wm_area(C), header);
+ ED_workspace_status_text(C, header);
}
/* FlyInfo->state */
@@ -1082,7 +1082,7 @@ static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED))
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
return exit_code;
}
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index 4f81fa7585c..eeddacee808 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -196,7 +196,7 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_FINISHED;
}
-static int view3d_layers_poll(bContext *C)
+static bool view3d_layers_poll(bContext *C)
{
return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd == NULL);
}
@@ -234,7 +234,7 @@ static int toggle_show_xray(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static int toggle_show_xray_poll(bContext *C)
+static bool toggle_show_xray_poll(bContext *C)
{
bool result = (ED_operator_view3d_active(C) && !ED_operator_posemode(C) && !ED_operator_editmesh(C));
if (result) {
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 017b31a0bf2..8263d1d892c 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -41,7 +41,6 @@ struct Base;
struct BoundBox;
struct Gwn_Batch;
struct Depsgraph;
-struct DerivedMesh;
struct Object;
struct SmokeDomainSettings;
struct bAnimVizSettings;
@@ -235,7 +234,6 @@ struct Object *ED_view3d_cameracontrol_object_get(
/* view3d_toolbar.c */
void VIEW3D_OT_toolshelf(struct wmOperatorType *ot);
-void view3d_toolshelf_register(struct ARegionType *art);
/* view3d_snap.c */
bool ED_view3d_minmax_verts(struct Object *obedit, float min[3], float max[3]);
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c b/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c
index 305085be370..b42f49e6d1c 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_forcefield.c
@@ -120,4 +120,3 @@ void VIEW3D_WGT_force_field(wmManipulatorGroupType *wgt)
}
/** \} */
-
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c b/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c
index b232be35462..996da2a1475 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_navigate_type.c
@@ -43,6 +43,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -64,7 +65,7 @@
static void axis_geom_draw(
const wmManipulator *mpr, const float color[4], const bool UNUSED(select))
{
- glLineWidth(mpr->line_width);
+ GPU_line_width(mpr->line_width);
Gwn_VertFormat *format = immVertexFormat();
const uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
@@ -128,15 +129,15 @@ static void axis_geom_draw(
zero_v3(center);
copy_v3_fl(size, HANDLE_SIZE);
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LEQUAL);
- glBlendFunc(GL_ONE, GL_ZERO);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend_set_func(GPU_ONE, GPU_ZERO);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glLineWidth(1.0f);
+ GPU_line_smooth(true);
+ GPU_blend(true);
+ GPU_line_width(1.0f);
/* Just draw depth values. */
immUniformColor4fv(axis_nop);
imm_draw_cube_fill_3d(pos_id, center, size);
@@ -150,9 +151,9 @@ static void axis_geom_draw(
},
0.08f);
imm_draw_cube_wire_3d(pos_id, center, size);
- glDisable(GL_BLEND);
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_DEPTH_TEST);
+ GPU_blend(false);
+ GPU_line_smooth(false);
+ GPU_depth_test(false);
}
draw_center_done = true;
@@ -216,9 +217,9 @@ static void axis3d_draw_intern(
gpuPushMatrix();
gpuMultMatrix(matrix_final);
- glEnable(GL_BLEND);
+ GPU_blend(true);
axis_geom_draw(mpr, color, select);
- glDisable(GL_BLEND);
+ GPU_blend(false);
gpuPopMatrix();
}
@@ -229,9 +230,9 @@ static void manipulator_axis_draw(const bContext *C, wmManipulator *mpr)
(void)is_modal;
- glEnable(GL_BLEND);
+ GPU_blend(true);
axis3d_draw_intern(C, mpr, false, is_highlight);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static int manipulator_axis_test_select(
diff --git a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c
index 8178c2f5be9..c33f15c0493 100644
--- a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c
@@ -63,6 +63,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_select.h"
+#include "GPU_state.h"
#include "BLF_api.h"
@@ -526,7 +527,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
float color_back[4] = {1.0f, 1.0f, 1.0f, 0.5f};
/* anti-aliased lines for more consistent appearance */
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
BLF_enable(blf_mono_font, BLF_ROTATION);
BLF_size(blf_mono_font, 14 * U.pixelsize, U.dpi);
@@ -545,7 +546,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
ED_view3d_project_float_global(ar, ruler_item->co[j], co_ss[j], V3D_PROJ_TEST_NOP);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -553,10 +554,10 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
const float *col = is_act ? color_act : color_base;
immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2);
immUniform1f("dash_width", 6.0f);
@@ -632,7 +633,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
rot_90_vec_b[1] = dir_ruler[0];
normalize_v2(rot_90_vec_b);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor3ubv(color_wire);
@@ -656,7 +657,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -693,10 +694,10 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
const float *col = is_act ? color_act : color_base;
immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2);
immUniform1f("dash_width", 6.0f);
@@ -721,7 +722,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
normalize_v2(rot_90_vec);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor3ubv(color_wire);
@@ -739,7 +740,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -775,7 +776,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr)
}
}
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
BLF_disable(blf_mono_font, BLF_ROTATION);
@@ -1031,7 +1032,7 @@ void VIEW3D_WGT_ruler(wmManipulatorGroupType *wgt)
/** \name Add Ruler Operator
* \{ */
-static int view3d_ruler_poll(bContext *C)
+static bool view3d_ruler_poll(bContext *C)
{
bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C);
if ((tref_rt == NULL) ||
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 267712b3339..b16327d2a4a 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -254,10 +254,12 @@ void view3d_keymap(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "use_all_regions", false);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_verify_item(keymap, "VIEW3D_OT_view_lock_to_active", PADPERIOD, KM_PRESS, KM_SHIFT, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_view_lock_clear", PADPERIOD, KM_PRESS, KM_ALT, 0);
WM_keymap_verify_item(keymap, "VIEW3D_OT_navigate", FKEY, KM_PRESS, KM_SHIFT, 0);
+#endif
WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0);
@@ -286,21 +288,27 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_dolly", EQUALKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "delta", 1);
RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_dolly", MINUSKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "delta", -1);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_camera_1_to_1", PADENTER, KM_PRESS, KM_SHIFT, 0);
+#endif
WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */
WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_lock", HOMEKEY, KM_PRESS, 0, 0); /* only with lock view */
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_cursor", HOMEKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_pick", FKEY, KM_PRESS, KM_ALT, 0);
+#endif
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
RNA_boolean_set(kmi->ptr, "center", false); /* only without camera view */
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "use_all_regions", true);
RNA_boolean_set(kmi->ptr, "center", false); /* only without camera view */
+#ifdef USE_WM_KEYMAP_27X
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "center", true);
+#endif
WM_keymap_add_menu_pie(keymap, "VIEW3D_MT_view_pie", ACCENTGRAVEKEY, KM_CLICK_DRAG, 0, 0);
@@ -328,6 +336,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(kmi->ptr, "type", V3D_VIEW_STEPRIGHT);
RNA_float_set(kmi->ptr, "angle", (float)M_PI);
+#ifdef USE_WM_KEYMAP_27X
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANUP);
@@ -340,6 +349,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", WHEELUPMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_roll", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
+#endif
/* active aligned, replaces '*' key in 2.4x */
kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
@@ -530,4 +540,3 @@ void view3d_keymap(wmKeyConfig *keyconf)
viewzoom_modal_keymap(keyconf);
viewdolly_modal_keymap(keyconf);
}
-
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index e001ed9112b..5911c8224be 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -46,6 +46,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
+#include "GPU_state.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -438,7 +439,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
float color_back[4] = {1.0f, 1.0f, 1.0f, 0.5f};
/* anti-aliased lines for more consistent appearance */
- glEnable(GL_LINE_SMOOTH);
+ GPU_line_smooth(true);
BLF_enable(blf_mono_font, BLF_ROTATION);
BLF_size(blf_mono_font, 14 * U.pixelsize, U.dpi);
@@ -458,7 +459,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
ED_view3d_project_float_global(ar, ruler_item->co[j], co_ss[j], V3D_PROJ_TEST_NOP);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -466,10 +467,10 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
const float *col = is_act ? color_act : color_base;
immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2);
immUniform1f("dash_width", 6.0f);
@@ -545,7 +546,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
rot_90_vec_b[1] = dir_ruler[0];
normalize_v2(rot_90_vec_b);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor3ubv(color_wire);
@@ -569,7 +570,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -605,10 +606,10 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
const float *col = is_act ? color_act : color_base;
immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2);
immUniform1f("dash_width", 6.0f);
@@ -633,7 +634,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
normalize_v2(rot_90_vec);
- glEnable(GL_BLEND);
+ GPU_blend(true);
immUniformColor3ubv(color_wire);
@@ -651,7 +652,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
immEnd();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
immUnbindProgram();
@@ -687,7 +688,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
}
}
- glDisable(GL_LINE_SMOOTH);
+ GPU_line_smooth(false);
BLF_disable(blf_mono_font, BLF_ROTATION);
@@ -811,7 +812,7 @@ static bool view3d_ruler_item_mousemove(
}
}
-static void view3d_ruler_header_update(ScrArea *sa)
+static void view3d_ruler_header_update(bContext *C)
{
const char *text = IFACE_("Ctrl+LMB: Add, "
"Del: Remove, "
@@ -821,7 +822,7 @@ static void view3d_ruler_header_update(ScrArea *sa)
"Enter: Store, "
"Esc: Cancel");
- ED_area_headerprint(sa, text);
+ ED_workspace_status_text(C, text);
}
/* -------------------------------------------------------------------- */
@@ -847,7 +848,7 @@ static int view3d_ruler_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
ruler_info->draw_handle_pixel = ED_region_draw_cb_activate(ar->type, ruler_info_draw_pixel,
ruler_info, REGION_DRAW_POST_PIXEL);
- view3d_ruler_header_update(sa);
+ view3d_ruler_header_update(C);
op->flag |= OP_IS_MODAL_CURSOR_REGION;
@@ -1079,7 +1080,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
if (do_draw) {
- view3d_ruler_header_update(sa);
+ view3d_ruler_header_update(C);
/* all 3d views draw rulers */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
@@ -1093,7 +1094,7 @@ exit:
view3d_ruler_free(ruler_info);
op->customdata = NULL;
- ED_area_headerprint(sa, NULL);
+ ED_workspace_status_text(C, NULL);
}
return exit_code;
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index b4f3be178aa..b7dbb09e1a4 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -265,7 +265,7 @@ static void view3d_userdata_lassoselect_init(
r_data->is_changed = false;
}
-static int view3d_selectable_data(bContext *C)
+static bool view3d_selectable_data(bContext *C)
{
Object *ob = CTX_data_active_object(C);
@@ -1326,7 +1326,7 @@ static Base *mouse_select_eval_buffer(
while (base) {
/* skip objects with select restriction, to prevent prematurely ending this loop
* with an un-selectable choice */
- if ((base->flag & BASE_SELECTABLED) == 0) {
+ if ((base->flag & BASE_SELECTABLE) == 0) {
base = base->next;
if (base == NULL) base = FIRSTBASE(view_layer);
if (base == startbase) break;
@@ -2518,8 +2518,8 @@ void VIEW3D_OT_select(wmOperatorType *ot)
PropertyRNA *prop;
/* identifiers */
- ot->name = "Activate/Select";
- ot->description = "Activate/select item(s)";
+ ot->name = "Select";
+ ot->description = "Select and activate item(s)";
ot->idname = "VIEW3D_OT_select";
/* api callbacks */
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index acceb40beaa..707e0e7a394 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -28,153 +28,24 @@
* \ingroup spview3d
*/
-
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
-#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
-
-#include "BLT_translation.h"
#include "BKE_context.h"
-#include "BKE_screen.h"
-
#include "WM_api.h"
#include "WM_types.h"
-#include "RNA_access.h"
-
#include "ED_screen.h"
-#include "ED_undo.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
#include "view3d_intern.h" /* own include */
-/* ******************* */
-
-typedef struct CustomTool {
- struct CustomTool *next, *prev;
- char opname[OP_MAX_TYPENAME];
- char context[OP_MAX_TYPENAME];
-} CustomTool;
-
-static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
-{
- wmOperatorType *ot = arg2;
-
- if (ot) {
- CustomTool *ct = MEM_callocN(sizeof(CustomTool), "CustomTool");
-
- BLI_addtail(arg_listbase, ct);
- BLI_strncpy(ct->opname, ot->idname, OP_MAX_TYPENAME);
- BLI_strncpy(ct->context, CTX_data_mode_string(C), OP_MAX_TYPENAME);
- }
-
-}
-
-static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
-{
- GHashIterator iter;
-
- for (WM_operatortype_iter(&iter); !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
- wmOperatorType *ot = BLI_ghashIterator_getValue(&iter);
-
- if (BLI_strcasestr(ot->name, str)) {
- if (WM_operator_poll((bContext *)C, ot)) {
-
- if (false == UI_search_item_add(items, ot->name, ot, 0))
- break;
- }
- }
- }
-}
-
-
-/* ID Search browse menu, open */
-static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase)
-{
- static char search[OP_MAX_TYPENAME];
- wmEvent event;
- wmWindow *win = CTX_wm_window(C);
- uiBlock *block;
- uiBut *but;
-
- /* clear initial search string, then all items show */
- search[0] = 0;
-
- block = UI_block_begin(C, ar, "_popup", UI_EMBOSS);
- UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_SEARCH_MENU);
-
- /* fake button, it holds space for search items */
- uiDefBut(block, UI_BTYPE_LABEL, 0, "", 10, 15, UI_searchbox_size_x(), UI_searchbox_size_y(), NULL, 0, 0, 0, 0, NULL);
-
- but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, 19, 0, 0, "");
- UI_but_func_search_set(but, NULL, operator_search_cb, arg_listbase, operator_call_cb, NULL);
-
- UI_block_bounds_set_normal(block, 6);
- UI_block_direction_set(block, UI_DIR_DOWN);
- UI_block_end(C, block);
-
- wm_event_init_from_window(win, &event);
- event.type = EVT_BUT_OPEN;
- event.val = KM_PRESS;
- event.customdata = but;
- event.customdatafree = false;
- wm_event_add(win, &event);
-
- return block;
-}
-
-
-static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
-{
- SpaceLink *sl = CTX_wm_space_data(C);
- SpaceType *st = NULL;
- uiLayout *col;
- const char *context = CTX_data_mode_string(C);
-
- if (sl)
- st = BKE_spacetype_from_id(sl->spacetype);
-
- if (st && st->toolshelf.first) {
- CustomTool *ct;
-
- for (ct = st->toolshelf.first; ct; ct = ct->next) {
- if (STREQLEN(context, ct->context, OP_MAX_TYPENAME)) {
- col = uiLayoutColumn(pa->layout, true);
- uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0, NULL);
- }
- }
- }
- col = uiLayoutColumn(pa->layout, true);
- uiDefBlockBut(uiLayoutGetBlock(pa->layout), tool_search_menu, &st->toolshelf, "Add Tool", 0, 0, UI_UNIT_X, UI_UNIT_Y, "Add Tool in shelf, gets saved in files");
-}
-
-
-void view3d_toolshelf_register(ARegionType *art)
-{
- PanelType *pt;
-
- pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel tools");
- strcpy(pt->idname, "VIEW3D_PT_tool_shelf");
- strcpy(pt->label, N_("Tool Shelf"));
- strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
- pt->draw = view3d_panel_tool_shelf;
- BLI_addtail(&art->paneltypes, pt);
-}
-
/* ********** operator to open/close toolshelf region */
static int view3d_toolshelf_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -200,4 +71,3 @@ void VIEW3D_OT_toolshelf(wmOperatorType *ot)
/* flags */
ot->flag = 0;
}
-
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index abb8c688e05..aad2ac7284f 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -55,6 +55,7 @@
#include "GPU_glew.h"
#include "GPU_select.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -463,7 +464,7 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
}
-static int view3d_camera_to_view_poll(bContext *C)
+static bool view3d_camera_to_view_poll(bContext *C)
{
View3D *v3d;
ARegion *ar;
@@ -509,7 +510,6 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
View3D *v3d = CTX_wm_view3d(C); /* can be NULL */
Object *camera_ob = v3d ? v3d->camera : scene->camera;
Object *camera_ob_eval = DEG_get_evaluated_object(depsgraph, camera_ob);
@@ -523,7 +523,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
}
/* this function does all the important stuff */
- if (BKE_camera_view_frame_fit_to_scene(depsgraph, scene, view_layer, camera_ob_eval, r_co, &r_scale)) {
+ if (BKE_camera_view_frame_fit_to_scene(depsgraph, scene, camera_ob_eval, r_co, &r_scale)) {
ObjectTfmProtectedChannels obtfm;
float obmat_new[4][4];
@@ -663,7 +663,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-int ED_operator_rv3d_user_region_poll(bContext *C)
+bool ED_operator_rv3d_user_region_poll(bContext *C)
{
View3D *v3d_dummy;
ARegion *ar_dummy;
@@ -1005,7 +1005,7 @@ int view3d_opengl_select(
if (v3d->drawtype > OB_WIRE) {
v3d->zbuf = true;
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
if (vc->rv3d->rflag & RV3D_CLIPPING)
@@ -1051,7 +1051,7 @@ int view3d_opengl_select(
if (v3d->drawtype > OB_WIRE) {
v3d->zbuf = 0;
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
}
if (vc->rv3d->rflag & RV3D_CLIPPING)
@@ -1076,7 +1076,7 @@ finally:
/** \name View Layer Utilities
* \{ */
-int ED_view3d_view_layer_set(int lay, const int *values, int *active)
+int ED_view3d_view_layer_set(int lay, const bool *values, int *active)
{
int i, tot = 0;
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 352e85703bc..e3e82e8b9c2 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -404,7 +404,7 @@ static void walk_update_header(bContext *C, wmOperator *op, WalkInfo *walk)
#undef WM_MODALKEY
- ED_area_headerprint(CTX_wm_area(C), header);
+ ED_workspace_status_text(C, header);
}
static void walk_navigation_mode_set(bContext *C, wmOperator *op, WalkInfo *walk, eWalkMethod mode)
@@ -1436,7 +1436,7 @@ static int walk_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED))
- ED_area_headerprint(CTX_wm_area(C), NULL);
+ ED_workspace_status_text(C, NULL);
return exit_code;
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index acb92b1606c..ba9430c46f7 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -76,6 +76,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_image.h"
#include "ED_keyframing.h"
@@ -658,7 +659,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
static void viewRedrawPost(bContext *C, TransInfo *t)
{
- ED_area_headerprint(t->sa, NULL);
+ ED_area_status_text(t->sa, NULL);
if (t->spacetype == SPACE_VIEW3D) {
/* if autokeying is enabled, send notifiers that keyframes were added */
@@ -1723,7 +1724,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
immEnd();
}
-static int helpline_poll(bContext *C)
+static bool helpline_poll(bContext *C)
{
ARegion *ar = CTX_wm_region(C);
@@ -1770,15 +1771,15 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
UNUSED_VARS_NDEBUG(shdr_pos); /* silence warning */
BLI_assert(shdr_pos == POS_INDEX);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformThemeColor(TH_VIEW_OVERLAY);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -1804,7 +1805,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3fv(mval);
gpuRotateAxis(-RAD2DEGF(atan2f(cent[0] - tmval[0], cent[1] - tmval[1])), 'Z');
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArrow(UP, 5, 10, 5);
drawArrow(DOWN, 5, 10, 5);
break;
@@ -1812,7 +1813,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
immUniformThemeColor(TH_VIEW_OVERLAY);
gpuTranslate3fv(mval);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArrow(RIGHT, 5, 10, 5);
drawArrow(LEFT, 5, 10, 5);
break;
@@ -1821,7 +1822,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3fv(mval);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArrow(UP, 5, 10, 5);
drawArrow(DOWN, 5, 10, 5);
break;
@@ -1837,7 +1838,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3f(cent[0] - tmval[0] + mval[0], cent[1] - tmval[1] + mval[1], 0);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
drawArc(dist, angle - delta_angle, angle - spacing_angle, 10);
drawArc(dist, angle + spacing_angle, angle + delta_angle, 10);
@@ -1863,16 +1864,16 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
gpuTranslate3fv(mval);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
UI_make_axis_color(col, col2, 'X');
- immUniformColor3ubv((GLubyte *)col2);
+ immUniformColor3ubv(col2);
drawArrow(RIGHT, 5, 10, 5);
drawArrow(LEFT, 5, 10, 5);
UI_make_axis_color(col, col2, 'Y');
- immUniformColor3ubv((GLubyte *)col2);
+ immUniformColor3ubv(col2);
drawArrow(UP, 5, 10, 5);
drawArrow(DOWN, 5, 10, 5);
@@ -1889,7 +1890,7 @@ static void drawTransformView(const struct bContext *C, ARegion *UNUSED(ar), voi
{
TransInfo *t = arg;
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
drawConstraint(t);
drawPropCircle(C, t);
@@ -1929,15 +1930,15 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
#endif
/* autokey recording icon... */
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
xco -= U.widget_unit;
yco -= (int)printable_size[1] / 2;
UI_icon_draw(xco, yco, ICON_REC);
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, void *arg)
@@ -1969,7 +1970,7 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
{
ToolSettings *ts = CTX_data_tool_settings(C);
- int constraint_axis[3] = {0, 0, 0};
+ bool constraint_axis[3] = {false, false, false};
int proportional = 0;
PropertyRNA *prop;
@@ -2091,13 +2092,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
if (t->con.mode & CON_APPLY) {
if (t->con.mode & CON_AXIS0) {
- constraint_axis[0] = 1;
+ constraint_axis[0] = true;
}
if (t->con.mode & CON_AXIS1) {
- constraint_axis[1] = 1;
+ constraint_axis[1] = true;
}
if (t->con.mode & CON_AXIS2) {
- constraint_axis[2] = 1;
+ constraint_axis[2] = true;
}
}
@@ -2287,7 +2288,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
/* Constraint init from operator */
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
- int constraint_axis[3];
+ bool constraint_axis[3];
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
@@ -3189,7 +3190,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3343,7 +3344,7 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3622,7 +3623,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3725,7 +3726,7 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -3823,7 +3824,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4190,7 +4191,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4307,7 +4308,7 @@ static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4757,7 +4758,7 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4859,7 +4860,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -4938,7 +4939,7 @@ static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5019,7 +5020,7 @@ static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5125,7 +5126,7 @@ static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5206,7 +5207,7 @@ static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5301,7 +5302,7 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5383,7 +5384,7 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5468,7 +5469,7 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5591,7 +5592,7 @@ static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -5668,7 +5669,7 @@ static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -7165,10 +7166,10 @@ static void drawEdgeSlide(TransInfo *t)
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
if (v3d && v3d->zbuf)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
gpuPushMatrix();
gpuMultMatrix(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
@@ -7188,7 +7189,7 @@ static void drawEdgeSlide(TransInfo *t)
add_v3_v3v3(co_a, curr_sv->v_co_orig, curr_sv->dir_side[0]);
add_v3_v3v3(co_b, curr_sv->v_co_orig, curr_sv->dir_side[1]);
- glLineWidth(line_size);
+ GPU_line_width(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
immBeginAtMost(GWN_PRIM_LINES, 4);
if (curr_sv->v_side[0]) {
@@ -7202,7 +7203,7 @@ static void drawEdgeSlide(TransInfo *t)
immEnd();
immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade);
- glPointSize(ctrl_size);
+ GPU_point_size(ctrl_size);
immBegin(GWN_PRIM_POINTS, 1);
if (slp->flipped) {
if (curr_sv->v_side[1]) immVertex3fv(pos, curr_sv->v_side[1]->co);
@@ -7213,7 +7214,7 @@ static void drawEdgeSlide(TransInfo *t)
immEnd();
immUniformThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade);
- glPointSize(guide_size);
+ GPU_point_size(guide_size);
immBegin(GWN_PRIM_POINTS, 1);
interp_line_v3_v3v3v3(co_mark, co_b, curr_sv->v_co_orig, co_a, fac);
immVertex3fv(pos, co_mark);
@@ -7226,7 +7227,7 @@ static void drawEdgeSlide(TransInfo *t)
int i;
const int alpha_shade = -160;
- glLineWidth(line_size);
+ GPU_line_width(line_size);
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
immBegin(GWN_PRIM_LINES, sld->totsv * 2);
@@ -7261,10 +7262,10 @@ static void drawEdgeSlide(TransInfo *t)
gpuPopMatrix();
- glDisable(GL_BLEND);
+ GPU_blend(false);
if (v3d && v3d->zbuf)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
}
@@ -7394,7 +7395,7 @@ static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -7801,15 +7802,15 @@ static void drawVertSlide(TransInfo *t)
int i;
if (v3d && v3d->zbuf)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
gpuPushMatrix();
gpuMultMatrix(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
- glLineWidth(line_size);
+ GPU_line_width(line_size);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
@@ -7840,7 +7841,7 @@ static void drawVertSlide(TransInfo *t)
}
immEnd();
- glPointSize(ctrl_size);
+ GPU_point_size(ctrl_size);
immBegin(GWN_PRIM_POINTS, 1);
immVertex3fv(shdr_pos, (slp->flipped && slp->use_even) ?
@@ -7872,15 +7873,15 @@ static void drawVertSlide(TransInfo *t)
add_v3_v3(co_dest_3d, curr_sv->co_orig_3d);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -7896,7 +7897,7 @@ static void drawVertSlide(TransInfo *t)
gpuPopMatrix();
if (v3d && v3d->zbuf)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
}
@@ -7993,7 +7994,7 @@ static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8067,7 +8068,7 @@ static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8158,7 +8159,7 @@ static void applyBakeTime(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8219,7 +8220,7 @@ static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
else {
size[0] = size[1] = size[2] = 1;
@@ -8242,9 +8243,9 @@ static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
if (t->flag & T_2D_EDIT)
- ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y)"));
+ ED_area_status_text(t->sa, IFACE_("Select a mirror axis (X, Y)"));
else
- ED_area_headerprint(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
+ ED_area_status_text(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
}
}
/** \} */
@@ -8306,7 +8307,7 @@ static void applyAlign(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, IFACE_("Align"));
+ ED_area_status_text(t->sa, IFACE_("Align"));
}
/** \} */
@@ -8405,7 +8406,7 @@ static void applySeqSlide(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8689,7 +8690,7 @@ static void applyTimeTranslate(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -8879,7 +8880,7 @@ static void applyTimeSlide(TransInfo *t, const int mval[2])
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
@@ -9000,12 +9001,12 @@ static void applyTimeScale(TransInfo *t, const int UNUSED(mval[2]))
recalcData(t);
- ED_area_headerprint(t->sa, str);
+ ED_area_status_text(t->sa, str);
}
/** \} */
-/* TODO, move to: transform_queries.c */
+/* TODO, move to: transform_query.c */
bool checkUseAxisMatrix(TransInfo *t)
{
/* currently only checks for editmode */
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index d72d311e0f6..b9fbb37722c 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -890,7 +890,7 @@ void freeVertSlideVerts(TransInfo *t, TransDataContainer *tc, TransCustomData *c
void projectVertSlideData(TransInfo *t, bool is_final);
-/* TODO. transform_queries.c */
+/* TODO. transform_query.c */
bool checkUseAxisMatrix(TransInfo *t);
#define TRANSFORM_SNAP_MAX_PX 100.0f
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 3c70eaae2d3..9df8264cc76 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -44,6 +44,7 @@
#include "GPU_immediate.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -559,7 +560,7 @@ static void applyObjectConstraintRot(
/* on setup call, use first object */
if (td == NULL) {
- td = tc->data;
+ td = TRANS_DATA_CONTAINER_FIRST_OK(t)->data;
}
if (t->flag & T_EDIT) {
@@ -742,19 +743,19 @@ void drawConstraint(TransInfo *t)
drawLine(t, t->center_global, tc->mtx[1], 'Y', 0);
drawLine(t, t->center_global, tc->mtx[2], 'Z', 0);
- depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
+ depth_test_enabled = GPU_depth_test_enabled();
if (depth_test_enabled)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_factor", 0.5f);
@@ -767,7 +768,7 @@ void drawConstraint(TransInfo *t)
immUnbindProgram();
if (depth_test_enabled)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
if (tc->mode & CON_AXIS0) {
@@ -818,9 +819,9 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
gpuScale2f(1.0f, (ysize / xsize) * (xmask / ymask));
}
- depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
+ depth_test_enabled = GPU_depth_test_enabled();
if (depth_test_enabled)
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
@@ -834,7 +835,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
immUnbindProgram();
if (depth_test_enabled)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
gpuPopMatrix();
}
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 8462004c549..c622a50ff11 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -61,7 +61,6 @@
#include "BLI_bitmap.h"
#include "BLI_rect.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_constraint.h"
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 053647cbfea..db8bbe05c69 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -2336,4 +2336,3 @@ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot)
copy_v3_v3(td->ext->rot, eul);
}
}
-
diff --git a/source/blender/editors/transform/transform_manipulator_2d.c b/source/blender/editors/transform/transform_manipulator_2d.c
index d2743f47000..fd6e7ed5442 100644
--- a/source/blender/editors/transform/transform_manipulator_2d.c
+++ b/source/blender/editors/transform/transform_manipulator_2d.c
@@ -223,7 +223,7 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator
/* assign operator */
PointerRNA *ptr = WM_manipulator_operator_set(axis, 0, ot_translate, NULL);
- int constraint[3] = {0};
+ bool constraint[3] = {0};
constraint[(axis_idx + 1) % 2] = 1;
if (RNA_struct_find_property(ptr, "constraint_axis"))
RNA_boolean_set_array(ptr, "constraint_axis", constraint);
@@ -240,8 +240,8 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator
ptr = WM_manipulator_operator_set(man->cage, 0, ot_translate, NULL);
RNA_boolean_set(ptr, "release_confirm", 1);
- int constraint_x[3] = {1, 0, 0};
- int constraint_y[3] = {0, 1, 0};
+ bool constraint_x[3] = {1, 0, 0};
+ bool constraint_y[3] = {0, 1, 0};
ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X, ot_resize, NULL);
PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c
index 75da0fc2d23..8f547fb7451 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -159,18 +159,15 @@ enum {
MAN_AXES_SCALE,
};
-/* naming from old blender we may combine. */
-enum {
- V3D_MANIP_TRANSLATE = 1,
- V3D_MANIP_ROTATE = 2,
- V3D_MANIP_SCALE = 4,
-};
-
-
typedef struct ManipulatorGroup {
bool all_hidden;
int twtype;
+ /* Users may change the twtype, detect changes to re-setup manipulator options. */
+ int twtype_init;
+ int twtype_prev;
+ int use_twtype_refresh;
+
struct wmManipulator *manipulators[MAN_AXIS_LAST];
} ManipulatorGroup;
@@ -269,9 +266,9 @@ static bool manipulator_is_axis_visible(
}
}
- if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & V3D_MANIP_TRANSLATE)) ||
- (axis_type == MAN_AXES_ROTATE && !(twtype & V3D_MANIP_ROTATE)) ||
- (axis_type == MAN_AXES_SCALE && !(twtype & V3D_MANIP_SCALE)))
+ if ((axis_type == MAN_AXES_TRANSLATE && !(twtype & SCE_MANIP_TRANSLATE)) ||
+ (axis_type == MAN_AXES_ROTATE && !(twtype & SCE_MANIP_ROTATE)) ||
+ (axis_type == MAN_AXES_SCALE && !(twtype & SCE_MANIP_SCALE)))
{
return false;
}
@@ -301,34 +298,34 @@ static bool manipulator_is_axis_visible(
case MAN_AXIS_SCALE_Z:
return (rv3d->twdrawflag & MAN_SCALE_Z);
case MAN_AXIS_SCALE_C:
- return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & V3D_MANIP_TRANSLATE) == 0);
+ return (rv3d->twdrawflag & MAN_SCALE_C && (twtype & SCE_MANIP_TRANSLATE) == 0);
case MAN_AXIS_TRANS_XY:
return (rv3d->twdrawflag & MAN_TRANS_X &&
rv3d->twdrawflag & MAN_TRANS_Y &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_TRANS_YZ:
return (rv3d->twdrawflag & MAN_TRANS_Y &&
rv3d->twdrawflag & MAN_TRANS_Z &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_TRANS_ZX:
return (rv3d->twdrawflag & MAN_TRANS_Z &&
rv3d->twdrawflag & MAN_TRANS_X &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_XY:
return (rv3d->twdrawflag & MAN_SCALE_X &&
rv3d->twdrawflag & MAN_SCALE_Y &&
- (twtype & V3D_MANIP_TRANSLATE) == 0 &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_TRANSLATE) == 0 &&
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_YZ:
return (rv3d->twdrawflag & MAN_SCALE_Y &&
rv3d->twdrawflag & MAN_SCALE_Z &&
- (twtype & V3D_MANIP_TRANSLATE) == 0 &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_TRANSLATE) == 0 &&
+ (twtype & SCE_MANIP_ROTATE) == 0);
case MAN_AXIS_SCALE_ZX:
return (rv3d->twdrawflag & MAN_SCALE_Z &&
rv3d->twdrawflag & MAN_SCALE_X &&
- (twtype & V3D_MANIP_TRANSLATE) == 0 &&
- (twtype & V3D_MANIP_ROTATE) == 0);
+ (twtype & SCE_MANIP_TRANSLATE) == 0 &&
+ (twtype & SCE_MANIP_ROTATE) == 0);
}
return false;
}
@@ -404,9 +401,9 @@ static void manipulator_get_axis_color(
r_col_hi[3] = alpha_hi * alpha_fac;
}
-static void manipulator_get_axis_constraint(const int axis_idx, int r_axis[3])
+static void manipulator_get_axis_constraint(const int axis_idx, bool r_axis[3])
{
- zero_v3_int(r_axis);
+ ARRAY_SET_ITEMS(r_axis, 0, 0, 0);
switch (axis_idx) {
case MAN_AXIS_TRANS_X:
@@ -1122,15 +1119,15 @@ static void manipulator_line_range(const int twtype, const short axis_type, floa
switch (axis_type) {
case MAN_AXES_TRANSLATE:
- if (twtype & V3D_MANIP_SCALE) {
+ if (twtype & SCE_MANIP_SCALE) {
*r_start = *r_len - ofs + 0.075f;
}
- if (twtype & V3D_MANIP_ROTATE) {
+ if (twtype & SCE_MANIP_ROTATE) {
*r_len += ofs;
}
break;
case MAN_AXES_SCALE:
- if (twtype & (V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE)) {
+ if (twtype & (SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE)) {
*r_len -= ofs + 0.025f;
}
break;
@@ -1172,8 +1169,10 @@ static void manipulator_xform_message_subscribe(
if (type_fn == TRANSFORM_WGT_manipulator) {
extern PropertyRNA rna_ToolSettings_transform_pivot_point;
+ extern PropertyRNA rna_ToolSettings_use_manipulator_mode;
const PropertyRNA *props[] = {
- &rna_ToolSettings_transform_pivot_point
+ &rna_ToolSettings_transform_pivot_point,
+ &rna_ToolSettings_use_manipulator_mode,
};
for (int i = 0; i < ARRAY_SIZE(props); i++) {
WM_msg_subscribe_rna(mbus, &toolsettings_ptr, props[i], &msg_sub_value_mpr_tag_refresh, __func__);
@@ -1285,45 +1284,16 @@ static int manipulator_modal(
return OPERATOR_RUNNING_MODAL;
}
-static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup *mgroup)
+static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgroup)
{
- ManipulatorGroup *man = manipulatorgroup_init(mgroup);
struct {
wmOperatorType *translate, *rotate, *trackball, *resize;
} ot_store = {NULL};
-
- mgroup->customdata = man;
-
- {
- /* TODO: support mixing modes again? - it's supported but tool system makes it unobvious. */
- man->twtype = 0;
- ScrArea *sa = CTX_wm_area(C);
- bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
- wmKeyMap *km = tref_rt ? WM_keymap_find_all(C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW) : NULL;
- /* Weak, check first event */
- wmKeyMapItem *kmi = km ? km->items.first : NULL;
-
- if (kmi == NULL) {
- man->twtype |= V3D_MANIP_TRANSLATE | V3D_MANIP_ROTATE | V3D_MANIP_SCALE;
- }
- else if (STREQ(kmi->idname, "TRANSFORM_OT_translate")) {
- man->twtype |= V3D_MANIP_TRANSLATE;
- }
- else if (STREQ(kmi->idname, "TRANSFORM_OT_rotate")) {
- man->twtype |= V3D_MANIP_ROTATE;
- }
- else if (STREQ(kmi->idname, "TRANSFORM_OT_resize")) {
- man->twtype |= V3D_MANIP_SCALE;
- }
- BLI_assert(man->twtype != 0);
- }
-
- /* *** set properties for axes *** */
-
+ ManipulatorGroup *man = mgroup->customdata;
MAN_ITER_AXES_BEGIN(axis, axis_idx)
{
const short axis_type = manipulator_get_axis_type(axis_idx);
- int constraint_axis[3] = {1, 0, 0};
+ bool constraint_axis[3] = {1, 0, 0};
PointerRNA *ptr;
manipulator_get_axis_constraint(axis_idx, constraint_axis);
@@ -1340,7 +1310,7 @@ static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup
case MAN_AXIS_SCALE_Z:
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
int draw_options = 0;
- if ((man->twtype & (V3D_MANIP_ROTATE | V3D_MANIP_SCALE)) == 0) {
+ if ((man->twtype & (SCE_MANIP_ROTATE | SCE_MANIP_SCALE)) == 0) {
draw_options |= ED_MANIPULATOR_ARROW_DRAW_FLAG_STEM;
}
RNA_enum_set(axis->ptr, "draw_options", draw_options);
@@ -1434,6 +1404,39 @@ static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup
MAN_ITER_AXES_END;
}
+static void WIDGETGROUP_manipulator_setup(const bContext *C, wmManipulatorGroup *mgroup)
+{
+ ManipulatorGroup *man = manipulatorgroup_init(mgroup);
+
+ mgroup->customdata = man;
+
+ {
+ man->twtype = 0;
+ ScrArea *sa = CTX_wm_area(C);
+ const bToolRef *tref = sa->runtime.tool;
+
+ if (tref == NULL || STREQ(tref->idname, "Transform")) {
+ /* Setup all manipulators, they can be toggled via 'ToolSettings.manipulator_flag' */
+ man->twtype = SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE;
+ man->use_twtype_refresh = true;
+ }
+ else if (STREQ(tref->idname, "Move")) {
+ man->twtype |= SCE_MANIP_TRANSLATE;
+ }
+ else if (STREQ(tref->idname, "Rotate")) {
+ man->twtype |= SCE_MANIP_ROTATE;
+ }
+ else if (STREQ(tref->idname, "Scale")) {
+ man->twtype |= SCE_MANIP_SCALE;
+ }
+ BLI_assert(man->twtype != 0);
+ man->twtype_init = man->twtype;
+ }
+
+ /* *** set properties for axes *** */
+ manipulatorgroup_init_properties_from_twtype(mgroup);
+}
+
static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGroup *mgroup)
{
ManipulatorGroup *man = mgroup->customdata;
@@ -1443,6 +1446,15 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
RegionView3D *rv3d = ar->regiondata;
struct TransformBounds tbounds;
+ if (man->use_twtype_refresh) {
+ Scene *scene = CTX_data_scene(C);
+ man->twtype = scene->toolsettings->manipulator_flag & man->twtype_init;
+ if (man->twtype != man->twtype_prev) {
+ man->twtype_prev = man->twtype;
+ manipulatorgroup_init_properties_from_twtype(mgroup);
+ }
+ }
+
/* skip, we don't draw anything anyway */
if ((man->all_hidden =
(ED_transform_calc_manipulator_stats(
@@ -1481,7 +1493,7 @@ static void WIDGETGROUP_manipulator_refresh(const bContext *C, wmManipulatorGrou
RNA_float_set(axis->ptr, "length", len);
if (axis_idx >= MAN_AXIS_RANGE_TRANS_START && axis_idx < MAN_AXIS_RANGE_TRANS_END) {
- if (man->twtype & V3D_MANIP_ROTATE) {
+ if (man->twtype & SCE_MANIP_ROTATE) {
/* Avoid rotate and translate arrows overlap. */
start_co[2] += 0.215f;
}
@@ -1653,7 +1665,7 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulato
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
- int constraint[3] = {x != 1, y != 1, z != 1};
+ bool constraint[3] = {x != 1, y != 1, z != 1};
ptr = WM_manipulator_operator_set(mpr, i, ot_resize, NULL);
if (prop_release_confirm == NULL) {
prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm");
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index d98e3e3261a..cfac908f976 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -226,7 +226,7 @@ static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent
return delete_orientation_exec(C, op);
}
-static int delete_orientation_poll(bContext *C)
+static bool delete_orientation_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
@@ -307,7 +307,7 @@ static void transformops_loopsel_hack(bContext *C, wmOperator *op)
if (op->opm && op->opm->opm && op->opm->opm->prev) {
wmOperator *op_prev = op->opm->opm->prev;
Scene *scene = CTX_data_scene(C);
- int mesh_select_mode[3];
+ bool mesh_select_mode[3];
PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init");
if (prop && RNA_property_is_set(op_prev->ptr, prop)) {
@@ -652,7 +652,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER);
}
-static int skin_resize_poll(bContext *C)
+static bool skin_resize_poll(bContext *C)
{
struct Object *obedit = CTX_data_edit_object(C);
if (obedit && obedit->type == OB_MESH) {
@@ -1148,11 +1148,13 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
/* Will fall-through to texture-space transform. */
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_transform_axis_target", TKEY, KM_PRESS, KM_SHIFT, 0);
+#ifdef USE_WM_KEYMAP_27X
kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "texture_space", true);
kmi = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
RNA_boolean_set(kmi->ptr, "texture_space", true);
+#endif
WM_keymap_add_item(keymap, OP_SKIN_RESIZE, AKEY, KM_PRESS, KM_CTRL, 0);
@@ -1264,4 +1266,3 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
break;
}
}
-
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 704582deaca..48ec664d634 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -50,8 +50,8 @@
#include "BLI_utildefines.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_object.h"
#include "BKE_anim.h" /* for duplis */
@@ -160,7 +160,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
float imat[4][4];
float size;
- glDisable(GL_DEPTH_TEST);
+ GPU_depth_test(false);
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
@@ -202,7 +202,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
immUnbindProgram();
if (v3d->zbuf)
- glEnable(GL_DEPTH_TEST);
+ GPU_depth_test(true);
}
}
else if (t->spacetype == SPACE_IMAGE) {
@@ -219,7 +219,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
- glEnable(GL_BLEND);
+ GPU_blend(true);
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -244,7 +244,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
}
}
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 478e004743d..c090414bc22 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -242,7 +242,7 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op))
return ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
-static int ed_undo_redo_poll(bContext *C)
+static bool ed_undo_redo_poll(bContext *C)
{
wmOperator *last_op = WM_operator_last_redo(C);
return last_op && ED_operator_screenactive(C) &&
diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c
index 494ae769cf3..3cd74f1266f 100644
--- a/source/blender/editors/util/ed_transverts.c
+++ b/source/blender/editors/util/ed_transverts.c
@@ -497,7 +497,7 @@ void ED_transverts_free(TransVertStore *tvs)
tvs->transverts_tot = 0;
}
-int ED_transverts_poll(bContext *C)
+bool ED_transverts_poll(bContext *C)
{
Object *obedit = CTX_data_edit_object(C);
if (obedit) {
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index 549b9b7de77..65147d53b5d 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -76,6 +76,7 @@
#include "ED_util.h"
#include "GPU_immediate.h"
+#include "GPU_state.h"
#include "UI_interface.h"
#include "UI_resources.h"
@@ -346,10 +347,10 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 0); /* "simple" mode */
+ immUniform1i("colors_len", 0); /* "simple" mode */
immUniformThemeColor(TH_VIEW_OVERLAY);
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index 5e867afd58e..60500f0211a 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -208,7 +208,7 @@ static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event)
/* Panels */
-static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt))
+static bool image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt))
{
Object *obedit = CTX_data_edit_object(C);
return ED_uvedit_test(obedit);
@@ -235,4 +235,3 @@ void ED_uvedit_buttons_register(ARegionType *art)
pt->poll = image_panel_uv_poll;
BLI_addtail(&art->paneltypes, pt);
}
-
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 4473922841f..411c4838252 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -48,7 +48,7 @@
#include "BLI_buffer.h"
#include "BLI_bitmap.h"
-#include "BKE_DerivedMesh.h"
+#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_material.h"
#include "BKE_layer.h"
@@ -64,6 +64,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
+#include "GPU_state.h"
#include "ED_image.h"
#include "ED_mesh.h"
@@ -87,7 +88,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
x_fac = zoom[0];
y_fac = zoom[1];
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
gpuTranslate2fv(cursor);
@@ -96,10 +97,10 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2])
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 8.0f);
@@ -276,7 +277,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME
else
areadiff = 1.0f - (area / uvarea);
- weight_to_rgb(col, areadiff);
+ BKE_defvert_weight_to_rgb(col, areadiff);
immUniformColor3fv(col);
/* TODO: use editmesh tessface */
@@ -356,7 +357,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, Object *obedit, BME
BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
a = fabsf(uvang[i] - ang[i]) / (float)M_PI;
- weight_to_rgb(col, 1.0f - pow2f(1.0f - a));
+ BKE_defvert_weight_to_rgb(col, 1.0f - pow2f(1.0f - a));
immAttrib3fv(color, col);
immVertex2fv(pos, luv->uv);
}
@@ -502,7 +503,7 @@ static void draw_uvs_other(ViewLayer *view_layer, Object *obedit, const Image *c
for (Base *base = view_layer->object_bases.first; base; base = base->next) {
if (((base->flag & BASE_SELECTED) != 0) &&
- ((base->flag & BASE_VISIBLED) != 0))
+ ((base->flag & BASE_VISIBLE) != 0))
{
Object *ob = base->object;
if ((ob->type == OB_MESH) && (ob != obedit) && ((Mesh *)ob->data)->mloopuv) {
@@ -654,8 +655,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* draw transparent faces */
UI_GetThemeColor4fv(TH_FACE, col1);
UI_GetThemeColor4fv(TH_FACE_SELECT, col2);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
+ GPU_blend(true);
Gwn_VertFormat *format = immVertexFormat();
pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -691,7 +692,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
immUnbindProgram();
- glDisable(GL_BLEND);
+ GPU_blend(false);
}
else {
if (efa_act && !uvedit_face_visible_test(scene, obedit, ima, efa_act)) {
@@ -706,9 +707,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* 4. draw edges */
if (sima->flag & SI_SMOOTH_UV) {
- glEnable(GL_LINE_SMOOTH);
- glEnable(GL_BLEND);
- glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ GPU_line_smooth(true);
+ GPU_blend(true);
+ GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -719,13 +720,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
float viewport_size[4];
- glGetFloatv(GL_VIEWPORT, viewport_size);
+ GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.56f, 0.56f, 0.56f, 1.0f}, {0.07f, 0.07f, 0.07f, 1.0f}}, 2);
immUniform1f("dash_width", 4.0f);
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
break;
}
@@ -738,13 +739,13 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
else {
immUniformColor3f(0.0f, 0.0f, 0.0f);
}
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
break;
case SI_UVDT_OUTLINE:
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
imm_cpack(0x0);
- glLineWidth(3.0f);
+ GPU_line_width(3.0f);
break;
}
@@ -780,7 +781,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
if (sima->dt_uv == SI_UVDT_OUTLINE) {
- glLineWidth(1.0f);
+ GPU_line_width(1.0f);
UI_GetThemeColor4fv(TH_WIRE_EDIT, col2);
if (me->drawflag & ME_DRAWEDGES) {
@@ -883,8 +884,8 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
GWN_batch_discard(loop_batch);
if (sima->flag & SI_SMOOTH_UV) {
- glDisable(GL_LINE_SMOOTH);
- glDisable(GL_BLEND);
+ GPU_line_smooth(false);
+ GPU_blend(false);
}
/* 5. draw face centers */
@@ -900,7 +901,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE);
- glPointSize(pointsize);
+ GPU_point_size(pointsize);
immBeginAtMost(GWN_PRIM_POINTS, bm->totface);
@@ -961,7 +962,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* unselected uvs */
immUniformThemeColor(TH_VERTEX);
pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
- glPointSize(pointsize);
+ GPU_point_size(pointsize);
immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
@@ -980,7 +981,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* pinned uvs */
/* give odd pointsizes odd pin pointsizes */
- glPointSize(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0));
+ GPU_point_size(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0));
imm_cpack(0xFF);
immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
@@ -1001,7 +1002,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje
/* selected uvs */
immUniformThemeColor(TH_VERTEX_SELECT);
- glPointSize(pointsize);
+ GPU_point_size(pointsize);
immBeginAtMost(GWN_PRIM_POINTS, bm->totloop);
@@ -1073,4 +1074,3 @@ void ED_uvedit_draw_main(
ED_image_draw_cursor(ar, sima->cursor);
}
}
-
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index e3d2537c040..8a00b542eed 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -118,7 +118,7 @@ bool ED_uvedit_test(Object *obedit)
return ret;
}
-static int ED_operator_uvedit_can_uv_sculpt(struct bContext *C)
+static bool ED_operator_uvedit_can_uv_sculpt(struct bContext *C)
{
SpaceImage *sima = CTX_wm_space_image(C);
ToolSettings *toolsettings = CTX_data_tool_settings(C);
@@ -4060,7 +4060,7 @@ static void UV_OT_reveal(wmOperatorType *ot)
/** \name Set 2D Cursor Operator
* \{ */
-static int uv_set_2d_cursor_poll(bContext *C)
+static bool uv_set_2d_cursor_poll(bContext *C)
{
return ED_operator_uvedit_space_image(C) ||
ED_space_image_maskedit_poll(C) ||
@@ -4397,9 +4397,11 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
keymap = WM_keymap_find(keyconf, "UV Editor", 0, 0);
keymap->poll = ED_operator_uvedit_can_uv_sculpt;
+#ifdef USE_WM_KEYMAP_27X
/* Uv sculpt toggle */
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_uv_sculpt");
+#endif
/* Mark edge seam */
WM_keymap_add_item(keymap, "UV_OT_mark_seam", EKEY, KM_PRESS, KM_CTRL, 0);
@@ -4460,9 +4462,11 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
/* unwrap */
WM_keymap_add_item(keymap, "UV_OT_unwrap", EKEY, KM_PRESS, 0, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "UV_OT_minimize_stretch", VKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_pack_islands", PKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "UV_OT_average_islands_scale", AKEY, KM_PRESS, KM_CTRL, 0);
+#endif
/* hide */
kmi = WM_keymap_add_item(keymap, "UV_OT_hide", HKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 1d2583cf9d4..79e804725e5 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -4702,4 +4702,3 @@ void param_flush_restore(ParamHandle *handle)
p_face_restore_uvs(f);
}
}
-
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 50b4ee66644..2714bc33769 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -120,4 +120,3 @@ void param_flush_restore(ParamHandle *handle);
#endif
#endif /*__UVEDIT_PARAMETRIZER_H__*/
-
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index f39498b08f3..9091f3eff0b 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -65,6 +65,7 @@
#include "ED_space_api.h"
#include "GPU_batch.h"
+#include "GPU_state.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -291,7 +292,7 @@ static void stitch_update_header(StitchState *state, bContext *C)
state->limit_dist,
WM_bool_as_string(state->use_limit));
- ED_area_headerprint(sa, msg);
+ ED_workspace_status_text(C, msg);
}
}
@@ -1570,7 +1571,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar
pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- glEnable(GL_BLEND);
+ GPU_blend(true);
/* Static Tris */
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_ACTIVE, col);
@@ -1623,12 +1624,12 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_EDGE, col);
stitch_draw_vbo(vbo_line, GWN_PRIM_LINES, col);
- glDisable(GL_BLEND);
+ GPU_blend(false);
/* draw stitch vert/lines preview */
if (state->mode == STITCH_VERT) {
- glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f);
+ GPU_point_size(UI_GetThemeValuef(TH_VERTEX_SIZE) * 2.0f);
UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col);
vbo = GWN_vertbuf_create_with_format(&format);
@@ -2089,7 +2090,7 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
}
if (sa)
- ED_area_headerprint(sa, NULL);
+ ED_workspace_status_text(C, NULL);
ED_region_draw_cb_exit(CTX_wm_region(C)->type, state->draw_handle);
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 78b412579e6..52409dc2a1f 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -496,7 +496,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
smd.subdivType = smd_real->subdivType;
initialDerived = CDDM_from_editbmesh(em, false, false);
- derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd,
+ derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd, scene,
NULL, SUBSURF_IN_EDIT_MODE);
initialDerived->release(initialDerived);
@@ -656,9 +656,9 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, bool interac
param_flush(ms->handle);
if (sa) {
- BLI_snprintf(str, sizeof(str),
- IFACE_("Minimize Stretch. Blend %.2f (Press + and -, or scroll wheel to set)"), ms->blend);
- ED_area_headerprint(sa, str);
+ BLI_snprintf(str, sizeof(str), IFACE_("Minimize Stretch. Blend %.2f"), ms->blend);
+ ED_area_status_text(sa, str);
+ ED_workspace_status_text(C, IFACE_("Press + and -, or scroll wheel to set blending"));
}
ms->lasttime = PIL_check_seconds_timer();
@@ -673,8 +673,9 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, bool cancel)
MinStretch *ms = op->customdata;
ScrArea *sa = CTX_wm_area(C);
- if (sa)
- ED_area_headerprint(sa, NULL);
+ ED_area_status_text(sa, NULL);
+ ED_workspace_status_text(C, NULL);
+
if (ms->timer)
WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), ms->timer);
@@ -1578,7 +1579,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
}
}
-static int uv_from_view_poll(bContext *C)
+static bool uv_from_view_poll(bContext *C)
{
RegionView3D *rv3d = CTX_wm_region_view3d(C);
diff --git a/source/blender/freestyle/intern/system/PythonInterpreter.h b/source/blender/freestyle/intern/system/PythonInterpreter.h
index 79ba9421cda..4f5e94ef7a0 100644
--- a/source/blender/freestyle/intern/system/PythonInterpreter.h
+++ b/source/blender/freestyle/intern/system/PythonInterpreter.h
@@ -81,7 +81,7 @@ public:
bool ok = BPY_execute_filepath(_context, fn, reports);
#else
bool ok;
- Text *text = BKE_text_load(&_freestyle_bmain, fn, G.main->name);
+ Text *text = BKE_text_load(&_freestyle_bmain, fn, G_MAIN->name);
if (text) {
ok = BPY_execute_text(_context, text, reports, false);
BKE_libblock_delete(&_freestyle_bmain, text);
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index 6829a8c0be2..27977c16b51 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -76,6 +76,7 @@ set(SRC
intern/gpu_select_pick.c
intern/gpu_select_sample_query.c
intern/gpu_shader.c
+ intern/gpu_state.c
intern/gpu_texture.c
intern/gpu_uniformbuffer.c
intern/gpu_viewport.c
@@ -117,6 +118,7 @@ set(SRC
GPU_matrix.h
GPU_select.h
GPU_shader.h
+ GPU_state.h
GPU_texture.h
GPU_uniformbuffer.h
GPU_viewport.h
@@ -254,4 +256,3 @@ if(WITH_OPENSUBDIV)
endif()
blender_add_lib(bf_gpu "${SRC}" "${INC}" "${INC_SYS}")
-
diff --git a/source/blender/gpu/GPU_basic_shader.h b/source/blender/gpu/GPU_basic_shader.h
index dc378927e79..89d31f57607 100644
--- a/source/blender/gpu/GPU_basic_shader.h
+++ b/source/blender/gpu/GPU_basic_shader.h
@@ -131,4 +131,3 @@ void GPU_basic_shader_line_width(float line_width);
#endif
#endif
-
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 613a07dc869..ebce83d2a5f 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -39,6 +39,7 @@ extern "C" {
struct ImBuf;
struct Image;
struct ImageUser;
+struct Main;
struct Object;
struct Scene;
struct ViewLayer;
@@ -68,19 +69,19 @@ void GPU_disable_program_point_size(void);
/* Mipmap settings
* - these will free textures on changes */
-void GPU_set_mipmap(bool mipmap);
+void GPU_set_mipmap(struct Main *bmain, bool mipmap);
bool GPU_get_mipmap(void);
void GPU_set_linear_mipmap(bool linear);
bool GPU_get_linear_mipmap(void);
-void GPU_paint_set_mipmap(bool mipmap);
+void GPU_paint_set_mipmap(struct Main *bmain, bool mipmap);
/* Anisotropic filtering settings
* - these will free textures on changes */
-void GPU_set_anisotropic(float value);
+void GPU_set_anisotropic(struct Main *bmain, float value);
float GPU_get_anisotropic(void);
/* enable gpu mipmapping */
-void GPU_set_gpu_mipmapping(int gpu_mipmap);
+void GPU_set_gpu_mipmapping(struct Main *bmain, int gpu_mipmap);
/* Image updates and free
* - these deal with images bound as opengl textures */
@@ -94,16 +95,16 @@ void GPU_create_gl_tex_compressed(
int textarget, struct Image *ima, struct ImBuf *ibuf);
bool GPU_upload_dxt_texture(struct ImBuf *ibuf);
void GPU_free_image(struct Image *ima);
-void GPU_free_images(void);
-void GPU_free_images_anim(void);
-void GPU_free_images_old(void);
+void GPU_free_images(struct Main *bmain);
+void GPU_free_images_anim(struct Main *bmain);
+void GPU_free_images_old(struct Main *bmain);
/* smoke drawing functions */
void GPU_free_smoke(struct SmokeModifierData *smd);
void GPU_create_smoke(struct SmokeModifierData *smd, int highres);
/* Delayed free of OpenGL buffers by main thread */
-void GPU_free_unused_buffers(void);
+void GPU_free_unused_buffers(struct Main *bmain);
/* utilities */
void GPU_select_index_set(int index);
@@ -127,4 +128,3 @@ void gpuPopAttrib(void);
#endif
#endif
-
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index 61dd899f3d9..084ee4c0459 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -194,6 +194,9 @@ void GPU_offscreen_viewport_data_get(
GPUOffScreen *ofs,
GPUFrameBuffer **r_fb, struct GPUTexture **r_color, struct GPUTexture **r_depth);
+void GPU_clear_color(float red, float green, float blue, float alpha);
+void GPU_clear(GPUFrameBufferBits flags);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index 0805cc25d04..a65c09152ee 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -44,6 +44,7 @@ extern "C" {
struct Image;
struct ImageUser;
struct ListBase;
+struct Main;
struct Material;
struct Object;
struct Scene;
@@ -251,7 +252,7 @@ GPUMaterial *GPU_material_from_nodetree(
void GPU_material_compile(GPUMaterial *mat);
void GPU_material_free(struct ListBase *gpumaterial);
-void GPU_materials_free(void);
+void GPU_materials_free(struct Main *bmain);
void GPU_material_orphans_init(void);
void GPU_material_orphans_exit(void);
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h
new file mode 100644
index 00000000000..2d7ab6cd54c
--- /dev/null
+++ b/source/blender/gpu/GPU_state.h
@@ -0,0 +1,63 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Ray Molenkamp
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file GPU_state.h
+ * \ingroup gpu
+ */
+
+#ifndef __GPU_STATE_H__
+#define __GPU_STATE_H__
+
+ /* These map directly to the GL_ blend functions, to minimize API add as needed*/
+typedef enum GPUBlendFunction {
+ GPU_ONE,
+ GPU_SRC_ALPHA,
+ GPU_ONE_MINUS_SRC_ALPHA,
+ GPU_DST_COLOR,
+ GPU_ZERO,
+} GPUBlendFunction;
+
+/* These map directly to the GL_ filter functions, to minimize API add as needed*/
+typedef enum GPUFilterFunction {
+ GPU_NEAREST,
+ GPU_LINEAR
+} GPUFilterFunction;
+
+void GPU_blend(bool enable);
+void GPU_blend_set_func(GPUBlendFunction sfactor, GPUBlendFunction dfactor);
+void GPU_blend_set_func_separate(
+ GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb,
+ GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha);
+void GPU_depth_test(bool enable);
+bool GPU_depth_test_enabled(void);
+void GPU_line_smooth(bool enable);
+void GPU_line_stipple(bool enable);
+void GPU_line_width(float width);
+void GPU_point_size(float size);
+void GPU_polygon_smooth(bool enable);
+void GPU_scissor(int x, int y, int width, int height);
+void GPU_scissor_get_f(float coords[4]);
+void GPU_scissor_get_i(int coords[4]);
+void GPU_viewport_size_get_f(float coords[4]);
+void GPU_viewport_size_get_i(int coords[4]);
+
+#endif /* __GPU_STATE_H__ */
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index e53693e7b40..341abeba72f 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -32,6 +32,8 @@
#ifndef __GPU_TEXTURE_H__
#define __GPU_TEXTURE_H__
+#include "GPU_state.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -166,7 +168,10 @@ GPUTexture *GPU_texture_from_blender(
struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time);
GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
-void GPU_texture_update(GPUTexture *tex, const float *pixels);
+void GPU_texture_update(GPUTexture *tex, const void *pixels);
+void GPU_texture_update_sub(
+ GPUTexture *tex, const void *pixels,
+ int offset_x, int offset_y, int offset_z, int width, int height, int depth);
void GPU_invalid_tex_init(void);
void GPU_invalid_tex_bind(int mode);
@@ -189,6 +194,7 @@ void GPU_texture_compare_mode(GPUTexture *tex, bool use_compare);
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter);
void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter);
void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat);
+void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter);
void GPU_texture_attach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb, int attachment);
int GPU_texture_detach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb);
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index df8dbb03284..688386810ea 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -791,11 +791,14 @@ void GPU_pbvh_bmesh_buffers_update(
tottri = gpu_bmesh_face_visible_count(bm_faces);
if (buffers->smooth) {
+ /* Smooth needs to recreate index buffer, so we have to invalidate the batch. */
+ GWN_BATCH_DISCARD_SAFE(buffers->triangles);
/* Count visible vertices */
totvert = gpu_bmesh_vert_visible_count(bm_unique_verts, bm_other_verts);
}
- else
+ else {
totvert = tottri * 3;
+ }
if (!tottri) {
buffers->tot_tri = 0;
@@ -905,13 +908,11 @@ void GPU_pbvh_bmesh_buffers_update(
BMFace *f = BLI_gsetIterator_getKey(&gs_iter);
if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
- BMLoop *l_iter;
- BMLoop *l_first;
+ BMVert *v[3];
- l_iter = l_first = BM_FACE_FIRST_LOOP(f);
- do {
- GWN_indexbuf_add_generic_vert(&elb, BM_elem_index_get(l_iter->v));
- } while ((l_iter = l_iter->next) != l_first);
+ BM_face_as_array_vert_tri(f, v);
+ GWN_indexbuf_add_tri_verts(
+ &elb, BM_elem_index_get(v[0]), BM_elem_index_get(v[1]), BM_elem_index_get(v[2]));
}
}
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 436f43d9c1e..a450b551d4a 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -80,11 +80,17 @@ static char *glsl_material_library = NULL;
static GPUPass *pass_cache = NULL;
static SpinLock pass_cache_spin;
-static uint32_t gpu_pass_hash(const char *frag_gen, const char *defs)
+static uint32_t gpu_pass_hash(const char *frag_gen, const char *defs, GPUVertexAttribs *attribs)
{
BLI_HashMurmur2A hm2a;
BLI_hash_mm2a_init(&hm2a, 0);
BLI_hash_mm2a_add(&hm2a, (unsigned char *)frag_gen, strlen(frag_gen));
+ if (attribs) {
+ for (int att_idx = 0; att_idx < attribs->totlayer; att_idx++) {
+ char *name = attribs->layer[att_idx].name;
+ BLI_hash_mm2a_add(&hm2a, (unsigned char *)name, strlen(name));
+ }
+ }
if (defs)
BLI_hash_mm2a_add(&hm2a, (unsigned char *)defs, strlen(defs));
@@ -1885,7 +1891,7 @@ GPUPass *GPU_generate_pass_new(
char *fragmentgen = code_generate_fragment(material, nodes, frag_outlink->output);
/* Cache lookup: Reuse shaders already compiled */
- uint32_t hash = gpu_pass_hash(fragmentgen, defines);
+ uint32_t hash = gpu_pass_hash(fragmentgen, defines, attribs);
pass_hash = gpu_pass_cache_lookup(hash);
if (pass_hash && (pass_hash->next == NULL || pass_hash->next->hash != hash)) {
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index a0f425e39d6..278843fc948 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -200,4 +200,3 @@ void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node);
int GPU_link_changed(struct GPUNodeLink *link);
#endif
-
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 83fd689e3b7..7383868843d 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -140,7 +140,7 @@ static struct GPUTextureState {
/* Mipmap settings */
-void GPU_set_gpu_mipmapping(int gpu_mipmap)
+void GPU_set_gpu_mipmapping(Main *bmain, int gpu_mipmap)
{
int old_value = GTS.gpu_mipmap;
@@ -148,14 +148,14 @@ void GPU_set_gpu_mipmapping(int gpu_mipmap)
GTS.gpu_mipmap = gpu_mipmap;
if (old_value != GTS.gpu_mipmap) {
- GPU_free_images();
+ GPU_free_images(bmain);
}
}
-void GPU_set_mipmap(bool mipmap)
+void GPU_set_mipmap(Main *bmain, bool mipmap)
{
if (GTS.domipmap != mipmap) {
- GPU_free_images();
+ GPU_free_images(bmain);
GTS.domipmap = mipmap;
}
}
@@ -203,10 +203,10 @@ static GLenum gpu_get_mipmap_filter(bool mag)
}
/* Anisotropic filtering settings */
-void GPU_set_anisotropic(float value)
+void GPU_set_anisotropic(Main *bmain, float value)
{
if (GTS.anisotropic != value) {
- GPU_free_images();
+ GPU_free_images(bmain);
/* Clamp value to the maximum value the graphics card supports */
const float max = GPU_max_texture_anisotropy();
@@ -682,7 +682,7 @@ void GPU_create_gl_tex_compressed(
* temporary disabling/enabling mipmapping on all images for quick texture
* updates with glTexSubImage2D. images that didn't change don't have to be
* re-uploaded to OpenGL */
-void GPU_paint_set_mipmap(bool mipmap)
+void GPU_paint_set_mipmap(Main *bmain, bool mipmap)
{
if (!GTS.domipmap)
return;
@@ -690,7 +690,7 @@ void GPU_paint_set_mipmap(bool mipmap)
GTS.texpaint = !mipmap;
if (mipmap) {
- for (Image *ima = G.main->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
if (BKE_image_has_opengl_texture(ima)) {
if (ima->tpageflag & IMA_MIPMAP_COMPLETE) {
if (ima->gputexture[TEXTARGET_TEXTURE_2D]) {
@@ -709,7 +709,7 @@ void GPU_paint_set_mipmap(bool mipmap)
}
else {
- for (Image *ima = G.main->image.first; ima; ima = ima->id.next) {
+ for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
if (BKE_image_has_opengl_texture(ima)) {
if (ima->gputexture[TEXTARGET_TEXTURE_2D]) {
GPU_texture_bind(ima->gputexture[TEXTARGET_TEXTURE_2D], 0);
@@ -980,7 +980,7 @@ static void gpu_queue_image_for_free(Image *ima)
BLI_thread_unlock(LOCK_OPENGL);
}
-void GPU_free_unused_buffers(void)
+void GPU_free_unused_buffers(Main *bmain)
{
if (!BLI_thread_is_main())
return;
@@ -992,7 +992,7 @@ void GPU_free_unused_buffers(void)
Image *ima = node->link;
/* check in case it was freed in the meantime */
- if (G.main && BLI_findindex(&G.main->image, ima) != -1)
+ if (bmain && BLI_findindex(&bmain->image, ima) != -1)
GPU_free_image(ima);
}
@@ -1020,24 +1020,29 @@ void GPU_free_image(Image *ima)
ima->tpageflag &= ~(IMA_MIPMAP_COMPLETE | IMA_GLBIND_IS_DATA);
}
-void GPU_free_images(void)
+void GPU_free_images(Main *bmain)
{
- if (G.main)
- for (Image *ima = G.main->image.first; ima; ima = ima->id.next)
+ if (bmain) {
+ for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
GPU_free_image(ima);
+ }
+ }
}
/* same as above but only free animated images */
-void GPU_free_images_anim(void)
+void GPU_free_images_anim(Main *bmain)
{
- if (G.main)
- for (Image *ima = G.main->image.first; ima; ima = ima->id.next)
- if (BKE_image_is_animated(ima))
+ if (bmain) {
+ for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
+ if (BKE_image_is_animated(ima)) {
GPU_free_image(ima);
+ }
+ }
+ }
}
-void GPU_free_images_old(void)
+void GPU_free_images_old(Main *bmain)
{
static int lasttime = 0;
int ctime = (int)PIL_check_seconds_timer();
@@ -1055,7 +1060,7 @@ void GPU_free_images_old(void)
lasttime = ctime;
- Image *ima = G.main->image.first;
+ Image *ima = bmain->image.first;
while (ima) {
if ((ima->flag & IMA_NOCOLLECT) == 0 && ctime - ima->lastused > U.textimeout) {
/* If it's in GL memory, deallocate and set time tag to current time
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index 226711e230f..dff6cfb74a8 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -306,4 +306,3 @@ void GPU_mem_stats_get(int *totalmem, int *freemem)
*freemem = 0;
}
}
-
diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c
index 18f8c33c3ca..eabd501f1d5 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.c
+++ b/source/blender/gpu/intern/gpu_framebuffer.c
@@ -834,3 +834,13 @@ void GPU_offscreen_viewport_data_get(
*r_color = ofs->color;
*r_depth = ofs->depth;
}
+
+void GPU_clear_color(float red, float green, float blue, float alpha)
+{
+ glClearColor(red, green, blue, alpha);
+}
+
+void GPU_clear(GPUFrameBufferBits flags)
+{
+ glClear(convert_buffer_bits_to_gl(flags));
+}
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 302ddc62188..9c776e64ba0 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -723,16 +723,16 @@ void GPU_material_compile(GPUMaterial *mat)
}
}
-void GPU_materials_free(void)
+void GPU_materials_free(Main *bmain)
{
Material *ma;
World *wo;
extern Material defmaterial;
- for (ma = G.main->mat.first; ma; ma = ma->id.next)
+ for (ma = bmain->mat.first; ma; ma = ma->id.next)
GPU_material_free(&ma->gpumaterial);
- for (wo = G.main->world.first; wo; wo = wo->id.next)
+ for (wo = bmain->world.first; wo; wo = wo->id.next)
GPU_material_free(&wo->gpumaterial);
GPU_material_free(&defmaterial.gpumaterial);
diff --git a/source/blender/gpu/intern/gpu_shader_private.h b/source/blender/gpu/intern/gpu_shader_private.h
index d8ec6b5d6d1..de5439c5638 100644
--- a/source/blender/gpu/intern/gpu_shader_private.h
+++ b/source/blender/gpu/intern/gpu_shader_private.h
@@ -41,4 +41,3 @@ struct GPUShader {
};
#endif /* __GPU_SHADER_PRIVATE_H__ */
-
diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c
new file mode 100644
index 00000000000..588d61640bd
--- /dev/null
+++ b/source/blender/gpu/intern/gpu_state.c
@@ -0,0 +1,153 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Ray Molenkamp
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/gpu/intern/gpu_state.c
+ * \ingroup gpu
+ *
+ */
+
+#include "GPU_glew.h"
+#include "GPU_state.h"
+
+static GLenum gpu_get_gl_blendfunction(GPUBlendFunction blend)
+{
+ switch (blend) {
+ case GPU_ONE:
+ return GL_ONE;
+ case GPU_SRC_ALPHA:
+ return GL_SRC_ALPHA;
+ case GPU_ONE_MINUS_SRC_ALPHA:
+ return GL_ONE_MINUS_SRC_ALPHA;
+ case GPU_DST_COLOR:
+ return GL_DST_COLOR;
+ case GPU_ZERO:
+ return GL_ZERO;
+ default:
+ BLI_assert(!"Unhandled blend mode");
+ return GL_ZERO;
+ }
+}
+
+void GPU_blend(bool enable)
+{
+ if (enable) {
+ glEnable(GL_BLEND);
+ }
+ else {
+ glDisable(GL_BLEND);
+ }
+}
+
+void GPU_blend_set_func(GPUBlendFunction sfactor, GPUBlendFunction dfactor)
+{
+ glBlendFunc(gpu_get_gl_blendfunction(sfactor), gpu_get_gl_blendfunction(dfactor));
+}
+
+void GPU_blend_set_func_separate(
+ GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb,
+ GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha)
+{
+ glBlendFuncSeparate(gpu_get_gl_blendfunction(src_rgb),
+ gpu_get_gl_blendfunction(dst_rgb),
+ gpu_get_gl_blendfunction(src_alpha),
+ gpu_get_gl_blendfunction(dst_alpha));
+}
+
+void GPU_depth_test(bool enable)
+{
+ if (enable) {
+ glEnable(GL_DEPTH_TEST);
+ }
+ else {
+ glDisable(GL_DEPTH_TEST);
+ }
+}
+
+bool GPU_depth_test_enabled()
+{
+ return glIsEnabled(GL_DEPTH_TEST);
+}
+
+void GPU_line_smooth(bool enable)
+{
+ if (enable) {
+ glEnable(GL_LINE_SMOOTH);
+ }
+ else {
+ glDisable(GL_LINE_SMOOTH);
+ }
+}
+
+void GPU_line_stipple(bool enable)
+{
+ if (enable) {
+ glEnable(GL_LINE_STIPPLE);
+ }
+ else {
+ glDisable(GL_LINE_STIPPLE);
+ }
+}
+
+void GPU_line_width(float width)
+{
+ glLineWidth(width);
+}
+
+void GPU_point_size(float size)
+{
+ glPointSize(size);
+}
+
+void GPU_polygon_smooth(bool enable)
+{
+ if (enable) {
+ glEnable(GL_POLYGON_SMOOTH);
+ }
+ else {
+ glDisable(GL_POLYGON_SMOOTH);
+ }
+}
+
+void GPU_scissor(int x, int y, int width, int height)
+{
+ glScissor(x, y, width, height);
+}
+
+void GPU_scissor_get_f(float coords[4])
+{
+ glGetFloatv(GL_SCISSOR_BOX, coords);
+}
+
+void GPU_scissor_get_i(int coords[4])
+{
+ glGetIntegerv(GL_SCISSOR_BOX, coords);
+}
+
+void GPU_viewport_size_get_f(float coords[4])
+{
+ glGetFloatv(GL_VIEWPORT, coords);
+}
+
+void GPU_viewport_size_get_i(int coords[4])
+{
+ glGetIntegerv(GL_VIEWPORT, coords);
+}
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index ee00a1381f4..ae037ca442e 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -171,6 +171,10 @@ static GLenum gpu_texture_get_format(
default: break;
}
}
+ else if (ELEM(data_type, GPU_R8)) {
+ *data_format = GL_UNSIGNED_BYTE;
+ *format = GL_RED;
+ }
else {
*data_format = GL_FLOAT;
*format_flag |= GPU_FORMAT_FLOAT;
@@ -882,37 +886,58 @@ GPUTexture *GPU_texture_create_from_vertbuf(Gwn_VertBuf *vert)
return GPU_texture_create_buffer(data_type, vert->vbo_id);
}
-void GPU_texture_update(GPUTexture *tex, const float *pixels)
+void GPU_texture_update_sub(
+ GPUTexture *tex, const void *pixels,
+ int offset_x, int offset_y, int offset_z, int width, int height, int depth)
{
- BLI_assert(tex->format > -1);
+ BLI_assert((int)tex->format > -1);
BLI_assert(tex->components > -1);
GLenum format, data_format;
+ GLint alignment;
gpu_texture_get_format(tex->components, tex->format, &format, &data_format,
- &tex->format_flag, &tex->bytesize);
+ &tex->format_flag, &tex->bytesize);
- glBindTexture(tex->target, tex->bindcode);
+ /* The default pack size for textures is 4, which won't work for byte based textures */
+ if (tex->bytesize == 1) {
+ glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ }
+ glBindTexture(tex->target, tex->bindcode);
switch (tex->target) {
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_1D_ARRAY:
- glTexSubImage2D(tex->target, 0, 0, 0, tex->w, tex->h, format, data_format, pixels);
+ glTexSubImage2D(
+ tex->target, 0, offset_x, offset_y,
+ width, height, format, data_format, pixels);
break;
case GL_TEXTURE_1D:
- glTexSubImage1D(tex->target, 0, 0, tex->w, format, data_format, pixels);
+ glTexSubImage1D(tex->target, 0, offset_x, width, format, data_format, pixels);
break;
case GL_TEXTURE_3D:
case GL_TEXTURE_2D_ARRAY:
- glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->d, format, data_format, pixels);
+ glTexSubImage3D(
+ tex->target, 0, offset_x, offset_y, offset_z,
+ width, height, depth, format, data_format, pixels);
break;
default:
BLI_assert(!"tex->target mode not supported");
}
+ if (tex->bytesize == 1) {
+ glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
+ }
+
glBindTexture(tex->target, 0);
}
+void GPU_texture_update(GPUTexture *tex, const void *pixels)
+{
+ GPU_texture_update_sub(tex, pixels, 0, 0, 0, tex->w, tex->h, tex->d);
+}
+
void GPU_invalid_tex_init(void)
{
memory_usage = 0;
@@ -1045,9 +1070,10 @@ void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter)
BLI_assert((!use_filter && !use_mipmap) || !(GPU_texture_stencil(tex) || GPU_texture_integer(tex)));
GLenum filter = (use_filter) ? GL_LINEAR : GL_NEAREST;
- GLenum mipmap = (use_filter)
- ? (use_mipmap) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR
- : (use_mipmap) ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST;
+ GLenum mipmap = (
+ (use_filter) ?
+ (use_mipmap) ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR :
+ (use_mipmap) ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST);
glActiveTexture(GL_TEXTURE0 + tex->number);
glTexParameteri(tex->target_base, GL_TEXTURE_MIN_FILTER, mipmap);
@@ -1068,6 +1094,33 @@ void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_R, repeat);
}
+static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter)
+{
+ switch (filter) {
+ case GPU_NEAREST:
+ return GL_NEAREST;
+ case GPU_LINEAR:
+ return GL_LINEAR;
+ default:
+ BLI_assert(!"Unhandled filter mode");
+ return GL_NEAREST;
+ }
+}
+
+void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter)
+{
+ WARN_NOT_BOUND(tex);
+
+ /* Stencil and integer format does not support filtering. */
+ BLI_assert(!(GPU_texture_stencil(tex) || GPU_texture_integer(tex)));
+ BLI_assert(mag_filter == GPU_NEAREST || mag_filter == GPU_LINEAR);
+
+ glActiveTexture(GL_TEXTURE0 + tex->number);
+ glTexParameteri(tex->target_base, GL_TEXTURE_MIN_FILTER, gpu_get_gl_filterfunction(min_filter));
+ glTexParameteri(tex->target_base, GL_TEXTURE_MAG_FILTER, gpu_get_gl_filterfunction(mag_filter));
+}
+
+
static void gpu_texture_delete(GPUTexture *tex)
{
if (tex->bindcode)
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
index 7caf00f58fd..3c5b0d1ca0a 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl
@@ -10,9 +10,9 @@ uniform float dash_width;
/* Simple mode, discarding non-dash parts (so no need for blending at all). */
uniform float dash_factor; /* if > 1.0, solid line. */
-/* More advanced mode, allowing for complex, multi-colored patterns. Enabled when num_colors > 0. */
+/* More advanced mode, allowing for complex, multi-colored patterns. Enabled when colors_len > 0. */
/* Note: max number of steps/colors in pattern is 32! */
-uniform int num_colors; /* Enabled if > 0, 1 for solid line. */
+uniform int colors_len; /* Enabled if > 0, 1 for solid line. */
uniform vec4 colors[32];
noperspective in float distance_along_line;
@@ -23,15 +23,15 @@ out vec4 fragColor;
void main()
{
/* Multi-color option. */
- if (num_colors > 0) {
+ if (colors_len > 0) {
/* Solid line case, simple. */
- if (num_colors == 1) {
+ if (colors_len == 1) {
fragColor = colors[0];
}
/* Actually dashed line... */
else {
float normalized_distance = fract(distance_along_line / dash_width);
- fragColor = colors[int(normalized_distance * num_colors)];
+ fragColor = colors[int(normalized_distance * colors_len)];
}
}
/* Single color option. */
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl
index db4bdf0a9f0..8fa19f94b39 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl
@@ -12,7 +12,7 @@ uniform vec2 viewport_size;
/* Uniforms from fragment shader, used here to optimize out useless computation in case of solid line. */
uniform float dash_factor; /* if > 1.0, solid line. */
-uniform int num_colors; /* Enabled if > 0, 1 for solid line. */
+uniform int colors_len; /* Enabled if > 0, 1 for solid line. */
layout(lines) in;
@@ -34,7 +34,7 @@ void main()
gl_Position = v2;
color_geom = color_vert[1];
- if ((num_colors == 1) || (dash_factor >= 1.0f)) {
+ if ((colors_len == 1) || (dash_factor >= 1.0f)) {
/* Solid line, optimize out distance computation! */
distance_along_line = 0.0f;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl
index 20c72f4407d..5a4da5cc9d4 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl
@@ -10,7 +10,7 @@ uniform float width; /* in pixels, screen space. */
/* Uniforms from fragment shader, used here to optimize out useless computation in case of solid line. */
uniform float dash_factor; /* if > 1.0, solid line. */
-uniform int num_colors; /* Enabled if > 0, 1 for solid line. */
+uniform int colors_len; /* Enabled if > 0, 1 for solid line. */
layout(lines) in;
@@ -36,7 +36,7 @@ void main()
gl_Position = v1 - (wdir * w1);
EmitVertex();
- if ((num_colors == 1) || (dash_factor >= 1.0f)) {
+ if ((colors_len == 1) || (dash_factor >= 1.0f)) {
/* Solid line, optimize out distance computation! */
distance_along_line = 0.0f;
}
diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
index 931ea426fbd..9b63952db5c 100644
--- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_vert.glsl
@@ -65,8 +65,8 @@ const vec2 triavec[43] = vec2[43](
vec2(0.000000, -1.000000),
/* ROUNDBOX_TRIA_MENU - menu arrows */
- vec2(-0.66, 0.08), vec2(-0.56, 0.20), vec2(-0.2, -0.39),
- vec2(-0.2, -0.18), vec2(0.26, 0.08), vec2(0.15, 0.20),
+ vec2(-0.51, 0.08), vec2(-0.41, 0.20), vec2(-0.05, -0.39),
+ vec2(-0.05, -0.18), vec2(0.41, 0.08), vec2(0.3, 0.20),
/* ROUNDBOX_TRIA_CHECK - check mark */
diff --git a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
index 5f7455582cd..c4657bb7f66 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
@@ -263,4 +263,3 @@ void main()
#endif
}
-
diff --git a/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl b/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
index bc940222f85..4fdaf809cd1 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
@@ -73,4 +73,3 @@ void main()
varying_texture_coord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
#endif
}
-
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
index 0fcab6302e4..b4576f75d19 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
@@ -72,4 +72,3 @@ void main()
vert_generic();
#endif
}
-
diff --git a/source/blender/gpu/shaders/gpu_shader_vertex_world.glsl b/source/blender/gpu/shaders/gpu_shader_vertex_world.glsl
index af2e4ba19a2..6f97ef8abef 100644
--- a/source/blender/gpu/shaders/gpu_shader_vertex_world.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_vertex_world.glsl
@@ -73,4 +73,3 @@ void main()
varposition = gl_Vertex.xyz;
varnormal = normalize(-varposition);
-
diff --git a/source/blender/ikplugin/intern/ikplugin_api.c b/source/blender/ikplugin/intern/ikplugin_api.c
index 791b74e4bc9..d2681440177 100644
--- a/source/blender/ikplugin/intern/ikplugin_api.c
+++ b/source/blender/ikplugin/intern/ikplugin_api.c
@@ -144,4 +144,3 @@ void BIK_test_constraint(struct Object *ob, struct bConstraint *cons)
if (plugin && plugin->test_constraint)
plugin->test_constraint(ob, cons);
}
-
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 8ad07d85639..9248d85c809 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -582,4 +582,3 @@ void iksolver_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, Obj
free_posetree(tree);
}
}
-
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 9ad98755be1..4a71b36bfef 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -1845,4 +1845,3 @@ void itasc_test_constraint(struct Object *ob, struct bConstraint *cons)
break;
}
}
-
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 44ff53cc020..8d932c5e79d 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -139,7 +139,7 @@ if(WITH_CODEC_FFMPEG)
)
add_definitions(-DWITH_FFMPEG)
- remove_strict_flags_file(
+ remove_strict_c_flags_file(
intern/indexer.c
intern/util.c
intern/anim_movie.c
diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h
index cedd9fb4d9f..f86bfa23692 100644
--- a/source/blender/imbuf/IMB_thumbs.h
+++ b/source/blender/imbuf/IMB_thumbs.h
@@ -102,4 +102,3 @@ void IMB_thumb_path_unlock(const char *path);
#endif /* __cplusplus */
#endif /* __IMB_THUMBS_H__ */
-
diff --git a/source/blender/imbuf/intern/IMB_allocimbuf.h b/source/blender/imbuf/intern/IMB_allocimbuf.h
index a754a4919eb..75854926d30 100644
--- a/source/blender/imbuf/intern/IMB_allocimbuf.h
+++ b/source/blender/imbuf/intern/IMB_allocimbuf.h
@@ -54,4 +54,3 @@ bool imb_addencodedbufferImBuf(struct ImBuf *ibuf);
bool imb_enlargeencodedbufferImBuf(struct ImBuf *ibuf);
#endif
-
diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h
index 2bd7cbcf6eb..31ebc3e54de 100644
--- a/source/blender/imbuf/intern/IMB_filetype.h
+++ b/source/blender/imbuf/intern/IMB_filetype.h
@@ -119,4 +119,3 @@ void imb_loadtiletiff(struct ImBuf *ibuf, const unsigned char *mem, size_t size,
int imb_savetiff(struct ImBuf *ibuf, const char *name, int flags);
#endif /* __IMB_FILETYPE_H__ */
-
diff --git a/source/blender/imbuf/intern/IMB_filter.h b/source/blender/imbuf/intern/IMB_filter.h
index 65656103435..36a2dc31021 100644
--- a/source/blender/imbuf/intern/IMB_filter.h
+++ b/source/blender/imbuf/intern/IMB_filter.h
@@ -47,4 +47,3 @@ void IMB_unpremultiply_rect_float(float *rect_float, int channels, int w, int h)
void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1);
#endif
-
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c
index a36d82be7c7..e8beaa9d68f 100644
--- a/source/blender/imbuf/intern/cache.c
+++ b/source/blender/imbuf/intern/cache.c
@@ -450,4 +450,3 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
}
}
}
-
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 170cf620701..7273ec1659c 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -665,4 +665,3 @@ void mem_read(Stream & mem, BlockCTX1 & block)
mem_read(mem, block.col1[1]);
mem_read(mem, block.indices);
}
-
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index 2cee4c984dd..d0db912f4dc 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -456,4 +456,3 @@ float ColorBlock::volume() const
return bounds.volume();
}
*/
-
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index 97ce5b90fa0..df9182c2c1e 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -1551,4 +1551,3 @@ void DirectDrawSurface::printInfo() const
printf("User Version: %u\n", header.reserved[8]);
}
}
-
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp
index 604796d1705..336d891fa3a 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.cpp
+++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp
@@ -252,4 +252,3 @@ int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels,
return 1;
}
-
diff --git a/source/blender/imbuf/intern/dds/FlipDXT.h b/source/blender/imbuf/intern/dds/FlipDXT.h
index 892c49bc5d2..6d4b2390255 100644
--- a/source/blender/imbuf/intern/dds/FlipDXT.h
+++ b/source/blender/imbuf/intern/dds/FlipDXT.h
@@ -29,4 +29,3 @@
int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data);
#endif
-
diff --git a/source/blender/imbuf/intern/dds/Image.cpp b/source/blender/imbuf/intern/dds/Image.cpp
index 363af61b907..fd3ca1c35e6 100644
--- a/source/blender/imbuf/intern/dds/Image.cpp
+++ b/source/blender/imbuf/intern/dds/Image.cpp
@@ -129,5 +129,3 @@ void Image::setFormat(Image::Format f)
{
m_format = f;
}
-
-
diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp
index d8387b92530..1af10905e64 100644
--- a/source/blender/imbuf/intern/dds/Stream.cpp
+++ b/source/blender/imbuf/intern/dds/Stream.cpp
@@ -99,4 +99,3 @@ unsigned int mem_read(Stream & mem, unsigned char *i, unsigned int cnt)
mem.pos += cnt;
return(cnt);
}
-
diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c
index 7ed5c8ffbcb..5dcd9c1c68a 100644
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@ -107,4 +107,3 @@ void imb_filetypes_exit(void)
if (type->exit)
type->exit();
}
-
diff --git a/source/blender/imbuf/intern/imbuf.h b/source/blender/imbuf/intern/imbuf.h
index 7c455edd916..05162290538 100644
--- a/source/blender/imbuf/intern/imbuf.h
+++ b/source/blender/imbuf/intern/imbuf.h
@@ -70,4 +70,3 @@
#define IMB_DPI_DEFAULT 72.0f
#endif /* __IMBUF_H__ */
-
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 61326218d4a..ba48feb01e8 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -951,4 +951,3 @@ int imb_saveiris(struct ImBuf *ibuf, const char *name, int flags)
return(ret);
}
-
diff --git a/source/blender/imbuf/intern/module.c b/source/blender/imbuf/intern/module.c
index 777fe77f032..3f2e9e04212 100644
--- a/source/blender/imbuf/intern/module.c
+++ b/source/blender/imbuf/intern/module.c
@@ -51,4 +51,3 @@ void IMB_exit(void)
imb_mmap_lock_exit();
imb_refcounter_lock_exit();
}
-
diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
index ab8824fdf85..f018bfc09d7 100644
--- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp
+++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp
@@ -291,5 +291,3 @@ int OIIO_getVersionHex(void)
}
} // export "C"
-
-
diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c
index 71b7cb2f567..47a2a8d40fb 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -780,4 +780,3 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors
return(ibuf);
}
-
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 62f8f1395c5..fa97fd53f32 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -576,6 +576,7 @@ enum {
INDEX_ID_WM,
INDEX_ID_MSK,
INDEX_ID_NULL,
+ INDEX_ID_MAX,
};
#ifdef __cplusplus
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index dac96b6ce5a..0546dcb1a6c 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -598,8 +598,8 @@ typedef struct bDopeSheet {
ID *source; /* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */
ListBase chanbase; /* cache for channels (only initialized when pinned) */ // XXX not used!
- struct Collection *filter_grp; /* object group for ADS_FILTER_ONLYOBGROUP filtering option */
- char searchstr[64]; /* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */
+ struct Collection *filter_grp; /* object group for option to only include objects that belong to this Collection */
+ char searchstr[64]; /* string to search for in displayed names of F-Curves, or NlaTracks/GP Layers/etc. */
int filterflag; /* flags to use for filtering data */
int flag; /* standard flags */
@@ -621,7 +621,6 @@ typedef enum eDopeSheet_FilterFlag {
/* general filtering */
ADS_FILTER_SUMMARY = (1 << 4), /* for 'DopeSheet' Editors - include 'summary' line */
- ADS_FILTER_ONLYOBGROUP = (1 << 5), /* only the objects in the specified object group get used */
/* datatype-based filtering */
ADS_FILTER_NOSHAPEKEYS = (1 << 6),
@@ -650,7 +649,6 @@ typedef enum eDopeSheet_FilterFlag {
/* general filtering 3 */
ADS_FILTER_INCL_HIDDEN = (1 << 26), /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
- ADS_FILTER_BY_FCU_NAME = (1 << 27), /* for F-Curves, filter by the displayed name (i.e. to isolate all Location curves only) */
ADS_FILTER_ONLY_ERRORS = (1 << 28), /* show only F-Curves which are disabled/have errors - for debugging drivers */
/* GPencil Mode */
@@ -687,12 +685,16 @@ typedef struct SpaceAction {
bAction *action; /* the currently active action */
bDopeSheet ads; /* the currently active context (when not showing action) */
- char mode, autosnap; /* mode: editing context; autosnap: automatic keyframe snapping mode */
- short flag; /* flag: bitmapped settings; */
float timeslide; /* for Time-Slide transform mode drawing - current frame? */
- int cache_display; /* (eTimeline_Cache_Flag) */
- int pad;
+ short flag;
+ /* Editing context */
+ char mode;
+ /* Storage for sub-space types. */
+ char mode_prev;
+ char autosnap; /* automatic keyframe snapping mode */
+ char cache_display; /* (eTimeline_Cache_Flag) */
+ char _pad1[6];
} SpaceAction;
/* SpaceAction flag */
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index e590780f1ff..6e3573b9f80 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -470,4 +470,3 @@ enum {
#define SURF_SEEN 4
#endif
-
diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h
index 964b330a452..373b1584c77 100644
--- a/source/blender/makesdna/DNA_effect_types.h
+++ b/source/blender/makesdna/DNA_effect_types.h
@@ -139,4 +139,3 @@ typedef struct WaveEff {
} WaveEff;
#endif
-
diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h
index ed9640c365f..24fb1c86627 100644
--- a/source/blender/makesdna/DNA_fileglobal_types.h
+++ b/source/blender/makesdna/DNA_fileglobal_types.h
@@ -62,4 +62,3 @@ typedef struct FileGlobal {
#endif
-
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index f97935a09a1..5f6ca277615 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -507,6 +507,3 @@ typedef struct Ipo {
#define IPO_DRIVER_FLAG_INVALID (1<<0)
#endif
-
-
-
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index e1ab56a0206..ff649f3ffe3 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -152,4 +152,3 @@ typedef struct Lamp {
#define LA_AREA_ELLIPSE 5
#endif /* __DNA_LAMP_TYPES_H__ */
-
diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h
index e329743cce7..71d6b3bbb0e 100644
--- a/source/blender/makesdna/DNA_lattice_types.h
+++ b/source/blender/makesdna/DNA_lattice_types.h
@@ -83,4 +83,3 @@ typedef struct Lattice {
#define LT_ACTBP_NONE -1
#endif
-
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index 6b4dcc39005..bfdd21807b8 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -91,15 +91,19 @@ typedef struct ViewLayer {
/* Base->flag */
enum {
+ /* User controlled flags. */
BASE_SELECTED = (1 << 0), /* Object is selected. */
- BASE_VISIBLED = (1 << 1), /* Object is visible. */
- BASE_SELECTABLED = (1 << 2), /* Object can be selected. */
+ BASE_HIDDEN = (1 << 8), /* Object is hidden for editing. */
+
+ /* Runtime evaluated flags. */
+ BASE_VISIBLE = (1 << 1), /* Object is enabled and visible. */
+ BASE_SELECTABLE = (1 << 2), /* Object can be selected. */
BASE_FROMDUPLI = (1 << 3), /* Object comes from duplicator. */
/* BASE_DEPRECATED = (1 << 4), */
- BASE_FROM_SET = (1 << 5), /* To be set only by the depsgraph */
- BASE_VISIBLE_VIEWPORT = (1 << 6), /* Object is visible in viewport. */
- BASE_VISIBLE_RENDER = (1 << 7), /* Object is visible in final render */
- BASE_HIDE = (1 << 8), /* Object is hidden for editing. */
+ BASE_FROM_SET = (1 << 5), /* Object comes from set. */
+ BASE_ENABLED_VIEWPORT = (1 << 6), /* Object is enabled in viewport. */
+ BASE_ENABLED_RENDER = (1 << 7), /* Object is enabled in final render */
+ BASE_ENABLED = (1 << 9), /* Object is enabled. */
};
/* LayerCollection->flag */
@@ -152,4 +156,3 @@ typedef struct SceneCollection {
#endif
#endif /* __DNA_LAYER_TYPES_H__ */
-
diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h
index f6035cd6653..ad359efa4d5 100644
--- a/source/blender/makesdna/DNA_listBase.h
+++ b/source/blender/makesdna/DNA_listBase.h
@@ -67,4 +67,3 @@ typedef struct ListBase {
#endif
#endif
-
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index 9401f591b66..eb469895fd7 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -230,4 +230,3 @@ enum {
};
#endif
-
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 33381be0ef5..5e8ead09d91 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -33,6 +33,7 @@
*/
struct Mesh;
+struct Scene;
typedef enum ModifierType {
eModifierType_None = 0,
@@ -113,9 +114,6 @@ typedef struct ModifierData {
short pad;
char name[64]; /* MAX_NAME */
- /* XXX for timing info set by caller... solve later? (ton) */
- struct Scene *scene;
-
char *error;
} ModifierData;
@@ -631,7 +629,6 @@ typedef struct SoftbodyModifierData {
typedef struct ClothModifierData {
ModifierData modifier;
- struct Scene *scene; /* the context is here */
struct Cloth *clothObject; /* The internal data structure for cloth. */
struct ClothSimSettings *sim_parms; /* definition is in DNA_cloth_types.h */
struct ClothCollSettings *coll_parms; /* definition is in DNA_cloth_types.h */
diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h
index c5e14374fb3..72db244c1fe 100644
--- a/source/blender/makesdna/DNA_nla_types.h
+++ b/source/blender/makesdna/DNA_nla_types.h
@@ -102,4 +102,3 @@ typedef enum eActStrip_Flag {
} eActStrip_Flag;
#endif
-
diff --git a/source/blender/makesdna/DNA_object_fluidsim_types.h b/source/blender/makesdna/DNA_object_fluidsim_types.h
index b8927613a59..0b0c1c40ef4 100644
--- a/source/blender/makesdna/DNA_object_fluidsim_types.h
+++ b/source/blender/makesdna/DNA_object_fluidsim_types.h
@@ -190,4 +190,3 @@ typedef struct FluidsimSettings {
#endif
#endif /* __DNA_OBJECT_FLUIDSIM_TYPES_H__ */
-
diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h
index 6d38e56f19a..ac7c969a810 100644
--- a/source/blender/makesdna/DNA_object_force_types.h
+++ b/source/blender/makesdna/DNA_object_force_types.h
@@ -407,4 +407,3 @@ typedef struct SoftBody {
#endif
#endif /* __DNA_OBJECT_FORCE_TYPES_H__ */
-
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 45029e8d412..3bcc0fb6dcc 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -367,6 +367,7 @@ enum {
/* 23 and 24 are for life and sector (old file compat.) */
OB_ARMATURE = 25,
+ OB_TYPE_MAX,
};
/* ObjectDisplay.flag */
@@ -603,4 +604,3 @@ enum {
#endif
#endif
-
diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h
index d775061d85a..449f71905f0 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -117,4 +117,3 @@ enum {
#endif
-
diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h
index 00a54c2db7f..d2e0dd92cbc 100644
--- a/source/blender/makesdna/DNA_packedFile_types.h
+++ b/source/blender/makesdna/DNA_packedFile_types.h
@@ -57,5 +57,3 @@ enum ePF_FileStatus {
};
#endif /* PACKEDFILE_TYPES_H */
-
-
diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h
index 5a7e7c92380..693707b8b7a 100644
--- a/source/blender/makesdna/DNA_rigidbody_types.h
+++ b/source/blender/makesdna/DNA_rigidbody_types.h
@@ -42,6 +42,16 @@ struct EffectorWeights;
/* ******************************** */
/* RigidBody World */
+/* Container for data shared by original and evaluated copies of RigidBodyWorld */
+typedef struct RigidBodyWorld_Shared {
+ /* cache */
+ struct PointCache *pointcache;
+ struct ListBase ptcaches;
+
+ /* References to Physics Sim objects. Exist at runtime only ---------------------- */
+ void *physics_world; /* Physics sim world (i.e. btDiscreteDynamicsWorld) */
+} RigidBodyWorld_Shared;
+
/* RigidBodyWorld (rbw)
*
* Represents a "simulation scene" existing within the parent scene.
@@ -58,9 +68,9 @@ typedef struct RigidBodyWorld {
int pad;
float ltime; /* last frame world was evaluated for (internal) */
- /* cache */
- struct PointCache *pointcache;
- struct ListBase ptcaches;
+ struct RigidBodyWorld_Shared *shared; /* This pointer is shared between all evaluated copies */
+ struct PointCache *pointcache DNA_DEPRECATED; /* Moved to shared->pointcache */
+ struct ListBase ptcaches DNA_DEPRECATED; /* Moved to shared->ptcaches */
int numbodies; /* number of objects in rigid body group */
short steps_per_second; /* number of simulation steps thaken per second */
@@ -68,9 +78,6 @@ typedef struct RigidBodyWorld {
int flag; /* (eRigidBodyWorld_Flag) settings for this RigidBodyWorld */
float time_scale; /* used to speed up or slow down the simulation */
-
- /* References to Physics Sim objects. Exist at runtime only ---------------------- */
- void *physics_world; /* Physics sim world (i.e. btDiscreteDynamicsWorld) */
} RigidBodyWorld;
/* Flags for RigidBodyWorld */
@@ -86,6 +93,18 @@ typedef enum eRigidBodyWorld_Flag {
/* ******************************** */
/* RigidBody Object */
+/* Container for data that is shared among CoW copies.
+ *
+ * This is placed in a separate struct so that, for example, the physics_shape
+ * pointer can be replaced without having to update all CoW copies. */
+#
+#
+typedef struct RigidBodyOb_Shared {
+ /* References to Physics Sim objects. Exist at runtime only */
+ void *physics_object; /* Physics object representation (i.e. btRigidBody) */
+ void *physics_shape; /* Collision shape used by physics sim (i.e. btCollisionShape) */
+} RigidBodyOb_Shared;
+
/* RigidBodyObject (rbo)
*
* Represents an object participating in a RigidBody sim.
@@ -93,10 +112,6 @@ typedef enum eRigidBodyWorld_Flag {
* participating in a sim.
*/
typedef struct RigidBodyOb {
- /* References to Physics Sim objects. Exist at runtime only */
- void *physics_object; /* Physics object representation (i.e. btRigidBody) */
- void *physics_shape; /* Collision shape used by physics sim (i.e. btCollisionShape) */
-
/* General Settings for this RigidBodyOb */
short type; /* (eRigidBodyOb_Type) role of RigidBody in sim */
short shape; /* (eRigidBody_Shape) collision shape to use */
@@ -123,6 +138,8 @@ typedef struct RigidBodyOb {
float orn[4]; /* rigid body orientation */
float pos[3]; /* rigid body position */
float pad1;
+
+ struct RigidBodyOb_Shared *shared; /* This pointer is shared between all evaluated copies */
} RigidBodyOb;
@@ -311,4 +328,3 @@ typedef enum eRigidBodyCon_Flag {
/* ******************************** */
#endif /* __DNA_RIGIDBODY_TYPES_H__ */
-
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 6113a7bb0f9..0b8f8ee5ed1 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1236,6 +1236,9 @@ typedef struct ToolSettings {
/* Auto-IK */
short autoik_chainlen; /* runtime only */
+ /* SCE_MPR_LOC/SCAL */
+ char manipulator_flag;
+
/* Grease Pencil */
char gpencil_flags; /* flags/options for how the tool works */
char gpencil_src; /* for main 3D view Grease Pencil, where data comes from */
@@ -1245,7 +1248,7 @@ typedef struct ToolSettings {
char gpencil_seq_align; /* : Sequencer Preview */
char gpencil_ima_align; /* : Image Editor */
- char _pad3[4];
+ char _pad3[3];
/* Grease Pencil Sculpt */
struct GP_BrushEdit_Settings gp_sculpt;
@@ -1724,22 +1727,22 @@ extern const char *RE_engine_id_CYCLES;
/* deprecate this! */
#define TESTBASE(base) ( \
(((base)->flag & BASE_SELECTED) != 0) && \
- (((base)->flag & BASE_VISIBLED) != 0))
+ (((base)->flag & BASE_VISIBLE) != 0))
#define TESTBASELIB(base) ( \
(((base)->flag & BASE_SELECTED) != 0) && \
((base)->object->id.lib == NULL) && \
- (((base)->flag & BASE_VISIBLED) != 0))
+ (((base)->flag & BASE_VISIBLE) != 0))
#define TESTBASELIB_BGMODE(base) ( \
(((base)->flag & BASE_SELECTED) != 0) && \
((base)->object->id.lib == NULL) && \
- (((base)->flag & BASE_VISIBLED) != 0))
+ (((base)->flag & BASE_VISIBLE) != 0))
#define BASE_EDITABLE_BGMODE(base) ( \
((base)->object->id.lib == NULL) && \
- (((base)->flag & BASE_VISIBLED) != 0))
+ (((base)->flag & BASE_VISIBLE) != 0))
#define BASE_SELECTABLE(base) \
- (((base)->flag & BASE_SELECTABLED) != 0)
+ (((base)->flag & BASE_SELECTABLE) != 0)
#define BASE_VISIBLE(base) ( \
- ((base)->flag & BASE_VISIBLED) != 0)
+ ((base)->flag & BASE_VISIBLE) != 0)
#define FIRSTBASE(_view_layer) ((_view_layer)->object_bases.first)
#define LASTBASE(_view_layer) ((_view_layer)->object_bases.last)
@@ -2011,6 +2014,11 @@ typedef enum eImagePaintMode {
#define EDGE_MODE_TAG_BEVEL 4
#define EDGE_MODE_TAG_FREESTYLE 5
+/* ToolSettings.manipulator_flag */
+#define SCE_MANIP_TRANSLATE 1
+#define SCE_MANIP_ROTATE 2
+#define SCE_MANIP_SCALE 4
+
/* ToolSettings.gpencil_flags */
typedef enum eGPencil_Flags {
/* "Continuous Drawing" - The drawing operator enters a mode where multiple strokes can be drawn */
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 500d198fa74..3ee6bc38644 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -501,4 +501,3 @@ enum {
#define RGN_DRAW_REFRESH_UI 8 /* re-create uiBlock's where possible */
#define RGN_DRAW_NO_REBUILD 16
#endif
-
diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h
index bd8f23f30c1..27d18e49634 100644
--- a/source/blender/makesdna/DNA_sdna_types.h
+++ b/source/blender/makesdna/DNA_sdna_types.h
@@ -82,4 +82,3 @@ typedef struct BHead8 {
} BHead8;
#endif
-
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 4f07a30ed70..bbfbf660774 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -274,7 +274,7 @@ typedef enum eSpaceOutliner_Flag {
/* SpaceOops.filter */
typedef enum eSpaceOutliner_Filter {
- SO_FILTER_SEARCH = (1 << 0),
+ SO_FILTER_SEARCH = (1 << 0), /* Run-time flag. */
/* SO_FILTER_ENABLE = (1 << 1), */ /* Deprecated */
SO_FILTER_NO_OBJECT = (1 << 2),
SO_FILTER_NO_OB_CONTENT = (1 << 3), /* Not only mesh, but modifiers, constraints, ... */
diff --git a/source/blender/makesdna/DNA_speaker_types.h b/source/blender/makesdna/DNA_speaker_types.h
index f7bc3b41e55..a7408293131 100644
--- a/source/blender/makesdna/DNA_speaker_types.h
+++ b/source/blender/makesdna/DNA_speaker_types.h
@@ -65,4 +65,3 @@ typedef struct Speaker {
#define SPK_RELATIVE (1<<2)
#endif /* __DNA_SPEAKER_TYPES_H__ */
-
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index bc0b3609a09..ca420195b99 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -549,4 +549,3 @@ enum {
#endif
#endif
-
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index f4e8d5e0000..d2782dee9ff 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -48,6 +48,11 @@ struct ColorBand;
#define MAX_STYLE_NAME 64
+#define GPU_VIEWPORT_QUALITY_FXAA 0.10f
+#define GPU_VIEWPORT_QUALITY_TAA8 0.25f
+#define GPU_VIEWPORT_QUALITY_TAA16 0.6f
+#define GPU_VIEWPORT_QUALITY_TAA32 0.8f
+
/* default offered by Blender.
* uiFont.uifont_id */
typedef enum eUIFont_ID {
@@ -430,6 +435,51 @@ typedef struct bPathCompare {
char flag, pad[7];
} bPathCompare;
+typedef struct bUserMenu {
+ struct bUserMenu *next, *prev;
+ char space_type;
+ char _pad0[7];
+ char context[64];
+ /* bUserMenuItem */
+ ListBase items;
+} bUserMenu;
+
+/* May be part of bUserMenu or other list. */
+typedef struct bUserMenuItem {
+ struct bUserMenuItem *next, *prev;
+ char ui_name[64];
+ char type;
+ char _pad0[7];
+} bUserMenuItem;
+
+typedef struct bUserMenuItem_Op {
+ bUserMenuItem item;
+ char op_idname[64];
+ struct IDProperty *prop;
+ char opcontext;
+ char _pad0[7];
+} bUserMenuItem_Op;
+
+typedef struct bUserMenuItem_Menu {
+ bUserMenuItem item;
+ char mt_idname[64];
+} bUserMenuItem_Menu;
+
+typedef struct bUserMenuItem_Prop {
+ bUserMenuItem item;
+ char context_data_path[256];
+ char prop_id[64];
+ int prop_index;
+ char _pad0[4];
+} bUserMenuItem_Prop;
+
+enum {
+ USER_MENU_TYPE_SEP = 1,
+ USER_MENU_TYPE_OPERATOR = 2,
+ USER_MENU_TYPE_MENU = 3,
+ USER_MENU_TYPE_PROP = 4,
+};
+
typedef struct SolidLight {
int flag, pad;
float col[4], spec[4], vec[4];
@@ -511,12 +561,14 @@ typedef struct UserDef {
struct ListBase user_keymaps;
struct ListBase addons;
struct ListBase autoexec_paths;
+ struct ListBase user_menus; /* bUserMenu */
+
char keyconfigstr[64];
short undosteps;
short pad1;
int undomemory;
- int pad3;
+ float gpu_viewport_quality;
short gp_manhattendist, gp_euclideandist, gp_eraser;
short gp_settings; /* eGP_UserdefSettings */
short tb_leftmouse, tb_rightmouse;
@@ -541,14 +593,13 @@ typedef struct UserDef {
char keyhandles_new; /* handle types for newly added keyframes */
char gpu_select_method;
char gpu_select_pick_deph;
- char gpu_viewport_antialias;
+ char pad0;
char view_frame_type; /* eZoomFrame_Mode */
int view_frame_keyframes; /* number of keyframes to zoom around current frame */
float view_frame_seconds; /* seconds to zoom around current frame */
- short scrcastfps; /* frame rate for screencast to be played back */
- short scrcastwait; /* milliseconds between screencast snapshots */
+ char _pad1[4];
short widget_unit; /* private, defaults to 20 for 72 DPI setting */
short anisotropic_filter;
@@ -632,7 +683,7 @@ typedef enum eUserPref_Flag {
USER_FLAG_DEPRECATED_7 = (1 << 7), /* cleared */
USER_MAT_ON_OB = (1 << 8),
USER_FLAG_DEPRECATED_9 = (1 << 9), /* cleared */
- USER_FLAG_DEPRECATED_10 = (1 << 10), /* cleared */
+ USER_DEVELOPER_UI = (1 << 10),
USER_TOOLTIPS = (1 << 11),
USER_TWOBUTTONMOUSE = (1 << 12),
USER_NONUMPAD = (1 << 13),
@@ -804,8 +855,9 @@ typedef enum eOpenGL_SelectOptions {
/* max anti alias draw method UserDef.gpu_viewport_antialias */
typedef enum eOpenGL_AntiAliasMethod {
- USER_AA_NONE = 0,
- USER_AA_FXAA = 1,
+ USER_AA_NONE = 0,
+ USER_AA_FXAA = 1,
+ USER_AA_TAA8 = 2,
} eOpenGL_AntiAliasMethod;
/* text draw options
diff --git a/source/blender/makesdna/DNA_vec_types.h b/source/blender/makesdna/DNA_vec_types.h
index 7ec259370b5..4a7aaaaa940 100644
--- a/source/blender/makesdna/DNA_vec_types.h
+++ b/source/blender/makesdna/DNA_vec_types.h
@@ -95,4 +95,3 @@ typedef struct rctf {
} rctf;
#endif
-
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index dce78638328..ebeb639e8aa 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -169,4 +169,3 @@ enum {
};
#endif
-
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index b7ad9f7d921..6dbed4d5d6f 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -167,12 +167,19 @@ typedef struct View3DOverlay {
/* Paint mode settings */
int paint_flag;
+ /* Alpha for texture, weight, vertex paint overlay */
+ float texture_paint_mode_opacity;
+ float vertex_paint_mode_opacity;
+ float weight_paint_mode_opacity;
+
/* Armature edit/pose mode settings */
int arm_flag;
float bone_selection_alpha;
/* Other settings */
float wireframe_threshold;
+
+ int pad;
} View3DOverlay;
/* 3D ViewPort Struct */
@@ -331,7 +338,7 @@ typedef struct View3D {
#define V3D_SOLID_MATCAP (1 << 12) /* user flag */
#define V3D_SHOW_SOLID_MATCAP (1 << 13) /* runtime flag */
#define V3D_OCCLUDE_WIRE (1 << 14)
-#define V3D_SHOW_MODE_SHADE_OVERRIDE (1 << 15)
+#define V3D_SHOW_MODE_SHADE_OVERRIDE (1 << 15) /* XXX: DNA deprecated */
/* View3d->flag3 (short) */
@@ -355,11 +362,12 @@ enum {
V3D_SHADING_MATCAP_FLIP_X = (1 << 6),
};
-/* View3DShading->single_color_type */
+/* View3DShading->color_type */
enum {
V3D_SHADING_MATERIAL_COLOR = 0,
V3D_SHADING_RANDOM_COLOR = 1,
V3D_SHADING_SINGLE_COLOR = 2,
+ V3D_SHADING_TEXTURE_COLOR = 3,
};
/* View3DOverlay->flag */
@@ -447,4 +455,3 @@ enum {
#define RV3D_CAMZOOM_MAX_FACTOR 44.9852813742385702928f
#endif
-
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 19d4ab10165..c6ad1470561 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -232,6 +232,9 @@ typedef struct wmWindow {
/* custom drawing callbacks */
ListBase drawcalls;
+
+ /* Private runtime info to show text in the status bar. */
+ void *cursor_keymap_status;
} wmWindow;
#ifdef ime_data
@@ -324,7 +327,7 @@ typedef struct wmKeyMap {
/* runtime */
/** Verify if enabled in the current context, use #WM_keymap_poll instead of direct calls. */
- int (*poll)(struct bContext *);
+ bool (*poll)(struct bContext *);
/** For modal, #EnumPropertyItem for now. */
const void *modal_items;
} wmKeyMap;
diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h
index b29e1f808c0..585794fbe97 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -145,6 +145,9 @@ typedef struct WorkSpace {
char _pad[2];
int flags DNA_PRIVATE_WORKSPACE; /* enum eWorkSpaceFlags */
+
+ /* Info text from modal operators (runtime). */
+ char *status_text;
} WorkSpace;
/* internal struct, but exported for read/write */
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index 38bfb20581b..2e38a402abb 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -120,4 +120,3 @@ enum {
#define WO_DS_SHOW_TEXS (1<<2)
#endif
-
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 257c57e5a9a..cf059c08cd5 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -977,10 +977,47 @@ static int elem_strcmp(const char *name, const char *oname)
}
/**
+ * Returns whether the specified field exists according to the struct format
+ * pointed to by old.
+ *
+ * \param sdna Old SDNA
+ * \param type Current field type name
+ * \param name Current field name
+ * \param old Pointer to struct information in sdna
+ * \return true when existsing, false otherwise.
+ */
+static bool elem_exists(
+ const SDNA *sdna,
+ const char *type,
+ const char *name,
+ const short *old)
+{
+ int a, elemcount;
+ const char *otype, *oname;
+
+ /* in old is the old struct */
+ elemcount = old[1];
+ old += 2;
+ for (a = 0; a < elemcount; a++, old += 2) {
+ otype = sdna->types[old[0]];
+ oname = sdna->names[old[1]];
+
+ if (elem_strcmp(name, oname) == 0) { /* name equal */
+ return strcmp(type, otype) == 0; /* type equal */
+ }
+ }
+ return false;
+}
+
+/**
* Returns the address of the data for the specified field within olddata
* according to the struct format pointed to by old, or NULL if no such
* field can be found.
*
+ * Passing olddata=NULL doesn't work reliably for existence checks; it will
+ * return NULL both when the field is found at offset 0 and when it is not
+ * found at all. For field existence checks, use elem_exists() instead.
+ *
* \param sdna Old SDNA
* \param type Current field type name
* \param name Current field name
@@ -1390,9 +1427,9 @@ bool DNA_struct_elem_find(const SDNA *sdna, const char *stype, const char *varty
if (SDNAnr != -1) {
const short * const spo = sdna->structs[SDNAnr];
- const char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL);
+ const bool found = elem_exists(sdna, vartype, name, spo);
- if (cp) {
+ if (found) {
return true;
}
}
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 75d1a328977..6c5562d9bdd 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -875,7 +875,7 @@ bool RNA_property_enum_item_from_value_gettexted(
int RNA_property_enum_bitflag_identifiers(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier);
StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop);
-int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value);
+bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value);
bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop);
bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info);
@@ -899,15 +899,15 @@ void RNA_property_update_cache_free(void);
/* Property Data */
-int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop);
-void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value);
-void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values);
-int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index);
-void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values);
-void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
-int RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop);
-void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int *values);
-int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index);
+bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop);
+void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value);
+void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values);
+bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index);
+void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values);
+void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value);
+bool RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop);
+void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, bool *values);
+bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index);
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop);
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value);
@@ -978,7 +978,7 @@ void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop);
bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos);
/* copy/reset */
-bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index);
+bool RNA_property_copy(struct Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index);
bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index);
/* Path
@@ -1008,6 +1008,16 @@ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path,
bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path,
PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index);
+/* path_resolve_property_and_item_pointer() variants ensure that pointer + property both exist,
+ * and resolve last Pointer value if possible (Pointer prop or item of a Collection prop). */
+bool RNA_path_resolve_property_and_item_pointer(
+ PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop,
+ PointerRNA *r_item_ptr);
+
+bool RNA_path_resolve_property_and_item_pointer_full(
+ PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index,
+ PointerRNA *r_item_ptr);
+
typedef struct PropertyElemRNA PropertyElemRNA;
struct PropertyElemRNA {
PropertyElemRNA *next, *prev;
@@ -1041,10 +1051,10 @@ char *RNA_path_property_py(struct PointerRNA *ptr, struct PropertyRNA *prop, int
* There is no support for pointers and collections here yet, these can be
* added when ID properties support them. */
-int RNA_boolean_get(PointerRNA *ptr, const char *name);
-void RNA_boolean_set(PointerRNA *ptr, const char *name, int value);
-void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values);
-void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values);
+bool RNA_boolean_get(PointerRNA *ptr, const char *name);
+void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value);
+void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values);
+void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values);
int RNA_int_get(PointerRNA *ptr, const char *name);
void RNA_int_set(PointerRNA *ptr, const char *name, int value);
@@ -1242,8 +1252,12 @@ typedef enum eRNACompareMode {
RNA_EQ_COMPARE,
} eRNACompareMode;
-bool RNA_property_equals(struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, struct PropertyRNA *prop, eRNACompareMode mode);
-bool RNA_struct_equals(struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, eRNACompareMode mode);
+bool RNA_property_equals(
+ struct Main *bmain,
+ struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, struct PropertyRNA *prop, eRNACompareMode mode);
+bool RNA_struct_equals(
+ struct Main *bmain,
+ struct PointerRNA *ptr_a, struct PointerRNA *ptr_b, eRNACompareMode mode);
/* Override. */
@@ -1275,15 +1289,18 @@ typedef enum eRNAOverrideStatus {
} eRNAOverrideStatus;
bool RNA_struct_override_matches(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, const char *root_path,
struct IDOverrideStatic *override, const eRNAOverrideMatch flags,
eRNAOverrideMatchResult *r_report_flags);
bool RNA_struct_override_store(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, PointerRNA *ptr_storage,
struct IDOverrideStatic *override);
void RNA_struct_override_apply(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_override, struct PointerRNA *ptr_storage,
struct IDOverrideStatic *override);
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index d56ccbcfa01..97a8a4a5546 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -84,11 +84,11 @@ void RNA_def_struct_translation_context(StructRNA *srna, const char *context);
typedef void StructOrFunctionRNA;
-PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, const char *identifier, int default_value, const char *ui_name, const char *ui_description);
-PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description);
-PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description);
-PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description);
-PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description);
+PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, const char *identifier, bool default_value, const char *ui_name, const char *ui_description);
+PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description);
+PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description);
+PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description);
+PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax);
PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax);
@@ -162,8 +162,8 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength);
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type);
void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type);
-void RNA_def_property_boolean_default(PropertyRNA *prop, int value);
-void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array);
+void RNA_def_property_boolean_default(PropertyRNA *prop, bool value);
+void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array);
void RNA_def_property_int_default(PropertyRNA *prop, int value);
void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array);
void RNA_def_property_float_default(PropertyRNA *prop, float value);
@@ -259,4 +259,3 @@ extern const int rna_matrix_dimsize_4x2[];
#endif
#endif /* __RNA_DEFINE_H__ */
-
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index da2705d4660..ce1edba75fd 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -55,8 +55,10 @@ extern const EnumPropertyItem rna_enum_snap_node_element_items[];
extern const EnumPropertyItem rna_enum_curve_fit_method_items[];
extern const EnumPropertyItem rna_enum_mesh_select_mode_items[];
extern const EnumPropertyItem rna_enum_mesh_delimit_mode_items[];
+extern const EnumPropertyItem rna_enum_space_graph_mode_items[];
extern const EnumPropertyItem rna_enum_space_type_items[];
extern const EnumPropertyItem rna_enum_space_image_mode_items[];
+extern const EnumPropertyItem rna_enum_space_action_mode_items[];
extern const EnumPropertyItem rna_enum_region_type_items[];
extern const EnumPropertyItem rna_enum_object_modifier_type_items[];
extern const EnumPropertyItem rna_enum_constraint_type_items[];
@@ -209,18 +211,18 @@ int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo);
int rna_node_tree_idname_to_enum(const char *idname);
struct bNodeTreeType *rna_node_tree_type_from_enum(int value);
const EnumPropertyItem *rna_node_tree_type_itemf(
- void *data, int (*poll)(void *data, struct bNodeTreeType *), bool *r_free);
+ void *data, bool (*poll)(void *data, struct bNodeTreeType *), bool *r_free);
int rna_node_type_to_enum(struct bNodeType *typeinfo);
int rna_node_idname_to_enum(const char *idname);
struct bNodeType *rna_node_type_from_enum(int value);
-const EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, struct bNodeType *), bool *r_free);
+const EnumPropertyItem *rna_node_type_itemf(void *data, bool (*poll)(void *data, struct bNodeType *), bool *r_free);
int rna_node_socket_type_to_enum(struct bNodeSocketType *typeinfo);
int rna_node_socket_idname_to_enum(const char *idname);
struct bNodeSocketType *rna_node_socket_type_from_enum(int value);
const EnumPropertyItem *rna_node_socket_type_itemf(
- void *data, int (*poll)(void *data, struct bNodeSocketType *), bool *r_free);
+ void *data, bool (*poll)(void *data, struct bNodeSocketType *), bool *r_free);
struct bContext;
struct PointerRNA;
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 9d304018990..ccf9affa1f8 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -337,6 +337,7 @@ typedef enum RawPropertyType {
PROP_RAW_INT, // XXX - abused for types that are not set, eg. MFace.verts, needs fixing.
PROP_RAW_SHORT,
PROP_RAW_CHAR,
+ PROP_RAW_BOOLEAN,
PROP_RAW_DOUBLE,
PROP_RAW_FLOAT
} RawPropertyType;
@@ -371,10 +372,10 @@ typedef struct EnumPropertyItem {
} EnumPropertyItem;
/* extended versions with PropertyRNA argument */
-typedef int (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
-typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
-typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
-typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values);
+typedef bool (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
+typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value);
+typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values);
+typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values);
typedef int (*IntPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop);
typedef void (*IntPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
typedef void (*IntArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index fe063a8e335..1dd4535610c 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -418,6 +418,7 @@ static const char *rna_type_type_name(PropertyRNA *prop)
{
switch (prop->type) {
case PROP_BOOLEAN:
+ return "bool";
case PROP_INT:
case PROP_ENUM:
return "int";
@@ -1617,6 +1618,21 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
switch (prop->type) {
case PROP_BOOLEAN:
+ {
+ if (!prop->arraydimension) {
+ fprintf(f, "bool %sget(PointerRNA *ptr);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, bool value);\n", func);
+ }
+ else if (prop->arraydimension && prop->totarraylength) {
+ fprintf(f, "void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->totarraylength);
+ fprintf(f, "void %sset(PointerRNA *ptr, const bool values[%u]);\n", func, prop->totarraylength);
+ }
+ else {
+ fprintf(f, "void %sget(PointerRNA *ptr, bool values[]);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, const bool values[]);\n", func);
+ }
+ break;
+ }
case PROP_INT:
{
if (!prop->arraydimension) {
@@ -1749,15 +1765,15 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
{
if (!prop->arraydimension) {
fprintf(f, "\tinline bool %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(int value);", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(bool value);", rna_safe_id(prop->identifier));
}
else if (prop->totarraylength) {
- fprintf(f, "\tinline Array<int, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(int values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
+ fprintf(f, "\tinline Array<bool, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(bool values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
}
else if (prop->getlength) {
- fprintf(f, "\tinline DynamicArray<int> %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(int values[]);", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline DynamicArray<bool> %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(bool values[]);", rna_safe_id(prop->identifier));
}
break;
}
@@ -2959,7 +2975,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
unsigned int i;
if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+ fprintf(f, "static bool rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
prop->identifier, prop->totarraylength);
for (i = 0; i < prop->totarraylength; i++) {
@@ -3589,22 +3605,22 @@ static const char *cpp_classes = ""
"\n"
"#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
" inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: false; } \\\n"
-" inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
+" inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n"
"\n"
"#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
-" inline Array<int, size> sname::identifier(void) \\\n"
-" { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
-" inline void sname::identifier(int values[size]) \\\n"
+" inline Array<bool, size> sname::identifier(void) \\\n"
+" { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+" inline void sname::identifier(bool values[size]) \\\n"
" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
-" inline DynamicArray<int> sname::identifier(void) { \\\n"
+" inline DynamicArray<bool> sname::identifier(void) { \\\n"
" int arraylen[3]; \\\n"
" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
-" DynamicArray<int> ar(len); \\\n"
+" DynamicArray<bool> ar(len); \\\n"
" sname##_##identifier##_get(&ptr, ar.data); \\\n"
" return ar; } \\\n"
-" inline void sname::identifier(int values[]) \\\n"
+" inline void sname::identifier(bool values[]) \\\n"
" { sname##_##identifier##_set(&ptr, values); } \\\n"
"\n"
"#define INT_PROPERTY(sname, identifier) \\\n"
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 11e45bc688d..43535d6f498 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -150,7 +150,8 @@ void rna_ID_name_set(PointerRNA *ptr, const char *value)
{
ID *id = (ID *)ptr->data;
BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2);
- BLI_libblock_ensure_unique_name(G.main, id->name);
+ BLI_assert(BKE_id_is_in_gobal_main(id));
+ BLI_libblock_ensure_unique_name(G_MAIN, id->name);
}
static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info))
@@ -401,7 +402,7 @@ static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
}
}
-static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, int clear_proxy)
+static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool clear_proxy)
{
/* Special case, as we can't rely on id_make_local(); it clears proxies. */
if (!clear_proxy && GS(self->name) == ID_OB) {
@@ -456,7 +457,9 @@ int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assig
short *totcol = give_totcolp_id(id);
Material *mat_id = assign_ptr->id.data;
if (totcol && (key >= 0 && key < *totcol)) {
- assign_material_id(G.main, id, mat_id, key + 1);
+ BLI_assert(BKE_id_is_in_gobal_main(id));
+ BLI_assert(BKE_id_is_in_gobal_main(&mat_id->id));
+ assign_material_id(G_MAIN, id, mat_id, key + 1);
return 1;
}
else {
@@ -472,7 +475,8 @@ static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma)
WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
}
-static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports, int index_i, int remove_material_slot)
+static Material *rna_IDMaterials_pop_id(
+ ID *id, Main *bmain, ReportList *reports, int index_i, bool remove_material_slot)
{
Material *ma;
short *totcol = give_totcolp_id(id);
@@ -500,7 +504,7 @@ static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports
return ma;
}
-static void rna_IDMaterials_clear_id(ID *id, Main *bmain, int remove_material_slot)
+static void rna_IDMaterials_clear_id(ID *id, Main *bmain, bool remove_material_slot)
{
BKE_material_clear_id(bmain, id, remove_material_slot);
@@ -512,7 +516,8 @@ static void rna_IDMaterials_clear_id(ID *id, Main *bmain, int remove_material_sl
static void rna_Library_filepath_set(PointerRNA *ptr, const char *value)
{
Library *lib = (Library *)ptr->data;
- BKE_library_filepath_set(G.main, lib, value);
+ BLI_assert(BKE_id_is_in_gobal_main(&lib->id));
+ BKE_library_filepath_set(G_MAIN, lib, value);
}
/* ***** ImagePreview ***** */
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 0532aac1bc3..638589c104a 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1390,7 +1390,7 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
return &RNA_UnknownType;
}
-int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value)
+bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value)
{
prop = rna_ensure_property(prop);
@@ -2238,17 +2238,17 @@ void RNA_property_update_cache_free(void)
/* Property Data */
-int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
+bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
{
BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
IDProperty *idprop;
- int value;
+ bool value;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) == false);
if ((idprop = rna_idproperty_check(&prop, ptr)))
- value = IDP_Int(idprop);
+ value = IDP_Int(idprop) != 0;
else if (bprop->get)
value = bprop->get(ptr);
else if (bprop->get_ex)
@@ -2261,7 +2261,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
return value;
}
-void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
+void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
{
BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
IDProperty *idprop;
@@ -2271,10 +2271,10 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
BLI_assert(ELEM(value, false, true));
/* just in case other values are passed */
- if (value) value = 1;
+ BLI_assert(ELEM(value, true, false));
if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDP_Int(idprop) = value;
+ IDP_Int(idprop) = (int)value;
rna_idproperty_touch(idprop);
}
else if (bprop->set) {
@@ -2295,7 +2295,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
}
}
-void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
+void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
{
BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
IDProperty *idprop;
@@ -2304,10 +2304,15 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val
BLI_assert(RNA_property_array_check(prop) != false);
if ((idprop = rna_idproperty_check(&prop, ptr))) {
- if (prop->arraydimension == 0)
+ if (prop->arraydimension == 0) {
values[0] = RNA_property_boolean_get(ptr, prop);
- else
- memcpy(values, IDP_Array(idprop), sizeof(int) * idprop->len);
+ }
+ else {
+ int *values_src = IDP_Array(idprop);
+ for (uint i = 0; i < idprop->len; i++) {
+ values[i] = (bool)values_src[i];
+ }
+ }
}
else if (prop->arraydimension == 0)
values[0] = RNA_property_boolean_get(ptr, prop);
@@ -2316,16 +2321,16 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val
else if (bprop->getarray_ex)
bprop->getarray_ex(ptr, prop, values);
else if (bprop->defaultarray)
- memcpy(values, bprop->defaultarray, sizeof(int) * prop->totarraylength);
+ memcpy(values, bprop->defaultarray, sizeof(bool) * prop->totarraylength);
else
- memset(values, 0, sizeof(int) * prop->totarraylength);
+ memset(values, 0, sizeof(bool) * prop->totarraylength);
}
-int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
+bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- int tmp[RNA_MAX_ARRAY_LENGTH];
+ bool tmp[RNA_MAX_ARRAY_LENGTH];
int len = rna_ensure_property_array_length(ptr, prop);
- int value;
+ bool value;
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
BLI_assert(RNA_property_array_check(prop) != false);
@@ -2337,9 +2342,9 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
value = tmp[index];
}
else {
- int *tmparray;
+ bool *tmparray;
- tmparray = MEM_mallocN(sizeof(int) * len, __func__);
+ tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
RNA_property_boolean_get_array(ptr, prop, tmparray);
value = tmparray[index];
MEM_freeN(tmparray);
@@ -2350,7 +2355,7 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
return value;
}
-void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
+void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
{
BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
IDProperty *idprop;
@@ -2359,11 +2364,15 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in
BLI_assert(RNA_property_array_check(prop) != false);
if ((idprop = rna_idproperty_check(&prop, ptr))) {
- if (prop->arraydimension == 0)
+ if (prop->arraydimension == 0) {
IDP_Int(idprop) = values[0];
- else
- memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len);
-
+ }
+ else {
+ int *values_dst = IDP_Array(idprop);
+ for (uint i = 0; i < idprop->len; i++) {
+ values_dst[i] = (int)values[i];
+ }
+ }
rna_idproperty_touch(idprop);
}
else if (prop->arraydimension == 0)
@@ -2383,14 +2392,17 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in
if (group) {
idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
IDP_AddToGroup(group, idprop);
- memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len);
+ int *values_dst = IDP_Array(idprop);
+ for (uint i = 0; i < idprop->len; i++) {
+ values_dst[i] = (int)values[i];
+ }
}
}
}
-void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
+void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value)
{
- int tmp[RNA_MAX_ARRAY_LENGTH];
+ bool tmp[RNA_MAX_ARRAY_LENGTH];
int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
@@ -2405,9 +2417,9 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
RNA_property_boolean_set_array(ptr, prop, tmp);
}
else {
- int *tmparray;
+ bool *tmparray;
- tmparray = MEM_mallocN(sizeof(int) * len, __func__);
+ tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
RNA_property_boolean_get_array(ptr, prop, tmparray);
tmparray[index] = value;
RNA_property_boolean_set_array(ptr, prop, tmparray);
@@ -2415,7 +2427,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
}
}
-int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
+bool RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop);
@@ -2426,7 +2438,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
return bprop->defaultvalue;
}
-void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
+void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, bool *values)
{
BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop);
@@ -2436,14 +2448,14 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA
if (prop->arraydimension == 0)
values[0] = bprop->defaultvalue;
else if (bprop->defaultarray)
- memcpy(values, bprop->defaultarray, sizeof(int) * prop->totarraylength);
+ memcpy(values, bprop->defaultarray, sizeof(bool) * prop->totarraylength);
else
- memset(values, 0, sizeof(int) * prop->totarraylength);
+ memset(values, 0, sizeof(bool) * prop->totarraylength);
}
-int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
+bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- int tmp[RNA_MAX_ARRAY_LENGTH];
+ bool tmp[RNA_MAX_ARRAY_LENGTH];
int len = rna_ensure_property_array_length(ptr, prop);
BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
@@ -2456,9 +2468,9 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
return tmp[index];
}
else {
- int *tmparray, value;
+ bool *tmparray, value;
- tmparray = MEM_mallocN(sizeof(int) * len, __func__);
+ tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
RNA_property_boolean_get_default_array(ptr, prop, tmparray);
value = tmparray[index];
MEM_freeN(tmparray);
@@ -3849,6 +3861,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
case PROP_RAW_CHAR: var = (dtype)((char *)raw.array)[a]; break; \
case PROP_RAW_SHORT: var = (dtype)((short *)raw.array)[a]; break; \
case PROP_RAW_INT: var = (dtype)((int *)raw.array)[a]; break; \
+ case PROP_RAW_BOOLEAN: var = (dtype)((bool *)raw.array)[a]; break; \
case PROP_RAW_FLOAT: var = (dtype)((float *)raw.array)[a]; break; \
case PROP_RAW_DOUBLE: var = (dtype)((double *)raw.array)[a]; break; \
default: var = (dtype)0; \
@@ -3861,6 +3874,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
case PROP_RAW_CHAR: ((char *)raw.array)[a] = (char)var; break; \
case PROP_RAW_SHORT: ((short *)raw.array)[a] = (short)var; break; \
case PROP_RAW_INT: ((int *)raw.array)[a] = (int)var; break; \
+ case PROP_RAW_BOOLEAN: ((bool *)raw.array)[a] = (bool)var; break; \
case PROP_RAW_FLOAT: ((float *)raw.array)[a] = (float)var; break; \
case PROP_RAW_DOUBLE: ((double *)raw.array)[a] = (double)var; break; \
default: break; \
@@ -3873,6 +3887,7 @@ int RNA_raw_type_sizeof(RawPropertyType type)
case PROP_RAW_CHAR: return sizeof(char);
case PROP_RAW_SHORT: return sizeof(short);
case PROP_RAW_INT: return sizeof(int);
+ case PROP_RAW_BOOLEAN: return sizeof(bool);
case PROP_RAW_FLOAT: return sizeof(float);
case PROP_RAW_DOUBLE: return sizeof(double);
default: return 0;
@@ -3974,8 +3989,9 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
int err = 0, j, a = 0;
int needconv = 1;
- if (((itemtype == PROP_BOOLEAN || itemtype == PROP_INT) && in.type == PROP_RAW_INT) ||
- (itemtype == PROP_FLOAT && in.type == PROP_RAW_FLOAT))
+ if (((itemtype == PROP_INT) && (in.type == PROP_RAW_INT)) ||
+ ((itemtype == PROP_BOOLEAN) && (in.type == PROP_RAW_BOOLEAN)) ||
+ ((itemtype == PROP_FLOAT) && (in.type == PROP_RAW_FLOAT)))
{
/* avoid creating temporary buffer if the data type match */
needconv = 0;
@@ -4025,7 +4041,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
case PROP_BOOLEAN:
{
int b;
- RAW_GET(int, b, in, a);
+ RAW_GET(bool, b, in, a);
RNA_property_boolean_set(&itemptr, iprop, b);
break;
}
@@ -4052,7 +4068,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
case PROP_BOOLEAN:
{
int b = RNA_property_boolean_get(&itemptr, iprop);
- RAW_SET(int, in, a, b);
+ RAW_SET(bool, in, a, b);
break;
}
case PROP_INT:
@@ -4090,7 +4106,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
case PROP_BOOLEAN:
{
for (j = 0; j < itemlen; j++, a++)
- RAW_GET(int, ((int *)tmparray)[j], in, a);
+ RAW_GET(bool, ((bool *)tmparray)[j], in, a);
RNA_property_boolean_set_array(&itemptr, iprop, tmparray);
break;
}
@@ -4118,7 +4134,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
{
RNA_property_boolean_get_array(&itemptr, iprop, tmparray);
for (j = 0; j < itemlen; j++, a++)
- RAW_SET(int, in, a, ((int *)tmparray)[j]);
+ RAW_SET(int, in, a, ((bool *)tmparray)[j]);
break;
}
case PROP_INT:
@@ -4145,7 +4161,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
switch (itemtype) {
case PROP_BOOLEAN:
{
- RNA_property_boolean_set_array(&itemptr, iprop, &((int *)in.array)[a]);
+ RNA_property_boolean_set_array(&itemptr, iprop, &((bool *)in.array)[a]);
a += itemlen;
break;
}
@@ -4169,7 +4185,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
switch (itemtype) {
case PROP_BOOLEAN:
{
- RNA_property_boolean_get_array(&itemptr, iprop, &((int *)in.array)[a]);
+ RNA_property_boolean_get_array(&itemptr, iprop, &((bool *)in.array)[a]);
a += itemlen;
break;
}
@@ -4208,7 +4224,7 @@ RawPropertyType RNA_property_raw_type(PropertyRNA *prop)
/* this property has no raw access, yet we try to provide a raw type to help building the array */
switch (prop->type) {
case PROP_BOOLEAN:
- return PROP_RAW_INT;
+ return PROP_RAW_BOOLEAN;
case PROP_INT:
return PROP_RAW_INT;
case PROP_FLOAT:
@@ -4608,17 +4624,42 @@ static bool rna_path_parse_array_index(const char **path, PointerRNA *ptr, Prope
return true;
}
+/**
+ * Generic rna path parser.
+ *
+ * \note All parameters besides \a ptr and \a path are optional.
+ *
+ * \param ptr The root of given RNA path.
+ * \param path The RNA path.
+ * \param r_ptr The final RNA data holding the last property in \a path.
+ * \param r_prop The final property of \a r_ptr, from \a path.
+ * \param r_index The final index in the \a r_prop, if defined by \a path.
+ * \param r_item_ptr Only valid for Pointer and Collection, return the actual value of the pointer,
+ * or of the collection item. Mutually exclusive with \a eval_pointer option.
+ * \param r_elements A list of \a PropertyElemRNA items
+ * (pairs of \a PointerRNA, \a PropertyRNA that represent the whole given \a path).
+ * \param eval_pointer If \a true, and \a path leads to a Pointer property, or an item in a Collection property,
+ * \a r_ptr will be set to the value of that property, and \a r_prop will be NULL.
+ * Mutually exclusive with \a r_item_ptr.
+ * \return \a true on success, \a false if the path is somehow invalid.
+ */
static bool rna_path_parse(PointerRNA *ptr, const char *path,
PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index,
- ListBase *r_elements,
+ PointerRNA *r_item_ptr, ListBase *r_elements,
const bool eval_pointer)
{
+ BLI_assert(r_item_ptr == NULL || !eval_pointer);
PropertyRNA *prop;
- PointerRNA curptr;
+ PointerRNA curptr, nextptr;
PropertyElemRNA *prop_elem = NULL;
int index = -1;
char fixedbuf[256];
int type;
+ const bool do_item_ptr = r_item_ptr != NULL && !eval_pointer;
+
+ if (do_item_ptr) {
+ RNA_POINTER_INVALIDATE(&nextptr);
+ }
prop = NULL;
curptr = *ptr;
@@ -4627,20 +4668,26 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path,
return false;
while (*path) {
+ if (do_item_ptr) {
+ RNA_POINTER_INVALIDATE(&nextptr);
+ }
+
int use_id_prop = (*path == '[') ? 1 : 0;
char *token;
/* custom property lookup ?
* C.object["someprop"]
*/
- if (!curptr.data)
+ if (!curptr.data) {
return false;
+ }
/* look up property name in current struct */
token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop);
- if (!token)
+ if (!token) {
return false;
+ }
prop = NULL;
if (use_id_prop) { /* look up property name in current struct */
@@ -4652,11 +4699,13 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path,
prop = RNA_struct_find_property(&curptr, token);
}
- if (token != fixedbuf)
+ if (token != fixedbuf) {
MEM_freeN(token);
+ }
- if (!prop)
+ if (!prop) {
return false;
+ }
if (r_elements) {
prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__);
@@ -4676,9 +4725,11 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path,
/* resolve pointer if further path elements follow
* or explicitly requested
*/
- if (eval_pointer || *path) {
- PointerRNA nextptr = RNA_property_pointer_get(&curptr, prop);
+ if (do_item_ptr || eval_pointer || *path != '\0') {
+ nextptr = RNA_property_pointer_get(&curptr, prop);
+ }
+ if (eval_pointer || *path != '\0') {
curptr = nextptr;
prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
index = -1;
@@ -4688,17 +4739,18 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path,
case PROP_COLLECTION: {
/* Resolve pointer if further path elements follow.
* Note that if path is empty, rna_path_parse_collection_key will do nothing anyway,
- * so eval_pointer is of no use here (esp. as in this case, we want to keep found prop,
- * erasing it breaks operators - e.g. bpy.types.Operator.bl_rna.foobar errors...).
+ * so do_item_ptr is of no use in that case.
*/
if (*path) {
- PointerRNA nextptr;
- if (!rna_path_parse_collection_key(&path, &curptr, prop, &nextptr))
+ if (!rna_path_parse_collection_key(&path, &curptr, prop, &nextptr)) {
return false;
+ }
- curptr = nextptr;
- prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
- index = -1;
+ if (eval_pointer || *path != '\0') {
+ curptr = nextptr;
+ prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ index = -1;
+ }
}
break;
}
@@ -4716,12 +4768,18 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path,
}
}
- if (r_ptr)
+ if (r_ptr) {
*r_ptr = curptr;
- if (r_prop)
+ }
+ if (r_prop) {
*r_prop = prop;
- if (r_index)
+ }
+ if (r_index) {
*r_index = index;
+ }
+ if (r_item_ptr && do_item_ptr) {
+ *r_item_ptr = nextptr;
+ }
if (prop_elem && (prop_elem->ptr.data != curptr.data || prop_elem->prop != prop || prop_elem->index != index)) {
prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__);
@@ -4742,7 +4800,7 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path,
*/
bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, true))
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, true))
return false;
return r_ptr->data != NULL;
@@ -4756,7 +4814,7 @@ bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prop
*/
bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, true))
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, true))
return false;
return r_ptr->data != NULL;
@@ -4771,8 +4829,9 @@ bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
*/
bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, false))
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, false)) {
return false;
+ }
return r_ptr->data != NULL && *r_prop != NULL;
}
@@ -4787,13 +4846,51 @@ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, PointerRNA *r_
*/
bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, false))
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, false))
return false;
return r_ptr->data != NULL && *r_prop != NULL;
}
/**
+ * Resolve the given RNA Path to find both the pointer AND property indicated by fully resolving the path,
+ * and get the value of the Pointer property (or item of the collection).
+ *
+ * This is a convenience method to avoid logic errors and ugly syntax, it combines both \a RNA_path_resolve and
+ * \a RNA_path_resolve_property in a single call.
+ * \note Assumes all pointers provided are valid.
+ * \param r_item_pointer The final Pointer or Collection item value. You must check for its validity before use!
+ * \return True only if both a valid pointer and property are found after resolving the path
+ */
+bool RNA_path_resolve_property_and_item_pointer(
+ PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, PointerRNA *r_item_ptr)
+{
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, r_item_ptr, NULL, false)) {
+ return false;
+ }
+
+ return r_ptr->data != NULL && *r_prop != NULL;
+}
+
+/**
+ * Resolve the given RNA Path to find both the pointer AND property (as well as the array index)
+ * indicated by fully resolving the path, and get the value of the Pointer property (or item of the collection).
+ *
+ * This is a convenience method to avoid logic errors and ugly syntax, it combines both \a RNA_path_resolve_full and
+ * \a RNA_path_resolve_property_full in a single call.
+ * \note Assumes all pointers provided are valid.
+ * \param r_item_pointer The final Pointer or Collection item value. You must check for its validity before use!
+ * \return True only if both a valid pointer and property are found after resolving the path
+ */
+bool RNA_path_resolve_property_and_item_pointer_full(
+ PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index, PointerRNA *r_item_ptr)
+{
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, r_item_ptr, NULL, false))
+ return false;
+
+ return r_ptr->data != NULL && *r_prop != NULL;
+}
+/**
* Resolve the given RNA Path into a linked list of PropertyElemRNA's.
*
* To be used when complex operations over path are needed, like e.g. get relative paths, to avoid too much
@@ -4804,7 +4901,7 @@ bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, PointerRN
*/
bool RNA_path_resolve_elements(PointerRNA *ptr, const char *path, ListBase *r_elements)
{
- return rna_path_parse(ptr, path, NULL, NULL, NULL, r_elements, false);
+ return rna_path_parse(ptr, path, NULL, NULL, NULL, NULL, r_elements, false);
}
char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *prop, int intkey, const char *strkey)
@@ -5398,7 +5495,7 @@ char *RNA_path_property_py(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index
/* Quick name based property access */
-int RNA_boolean_get(PointerRNA *ptr, const char *name)
+bool RNA_boolean_get(PointerRNA *ptr, const char *name)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, name);
@@ -5411,7 +5508,7 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name)
}
}
-void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
+void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, name);
@@ -5421,7 +5518,7 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
-void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
+void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, name);
@@ -5431,7 +5528,7 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
-void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values)
+void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, name);
@@ -6059,8 +6156,8 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in
BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index)));
}
else {
- int fixedbuf[RNA_MAX_ARRAY_LENGTH];
- int *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__);
+ bool fixedbuf[RNA_MAX_ARRAY_LENGTH];
+ bool *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__);
RNA_property_boolean_get_array(ptr, prop, buf);
BLI_dynstr_append(dynstr, "(");
@@ -6681,9 +6778,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
}
if (len == 0)
- *((int *)dest) = *((int *)src);
+ *((bool *)dest) = *((bool *)src);
else
- memcpy(dest, src, len * sizeof(int));
+ memcpy(dest, src, len * sizeof(bool));
break;
}
@@ -7031,7 +7128,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
case PROP_BOOLEAN:
if (len) {
if (index == -1) {
- int *tmparray = MEM_callocN(sizeof(int) * len, "reset_defaults - boolean");
+ bool *tmparray = MEM_callocN(sizeof(bool) * len, "reset_defaults - boolean");
RNA_property_boolean_get_default_array(ptr, prop, tmparray);
RNA_property_boolean_set_array(ptr, prop, tmparray);
@@ -7117,11 +7214,13 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
}
static bool rna_property_override_operation_apply(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
+ PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
IDOverrideStaticPropertyOperation *opop);
-bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
+bool RNA_property_copy(Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
{
if (!RNA_property_editable(ptr, prop)) {
return false;
@@ -7156,7 +7255,12 @@ bool RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop,
.subitem_reference_index = index,
.subitem_local_index = index
};
- return rna_property_override_operation_apply(ptr, fromptr, NULL, prop_dst, prop_src, NULL, &opop);
+ return rna_property_override_operation_apply(
+ bmain,
+ ptr, fromptr, NULL,
+ prop_dst, prop_src, NULL,
+ NULL, NULL, NULL,
+ &opop);
}
/* use RNA_warning macro which includes __func__ suffix */
@@ -7182,17 +7286,18 @@ void _RNA_warning(const char *format, ...)
}
static int rna_property_override_diff(
+ Main *bmain,
PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, PropertyRNA *prop_a, PropertyRNA *prop_b, const char *rna_path,
eRNACompareMode mode, IDOverrideStatic *override, const int flags, eRNAOverrideMatchResult *r_report_flags);
-bool RNA_property_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
+bool RNA_property_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
{
BLI_assert(ELEM(mode, RNA_EQ_STRICT, RNA_EQ_UNSET_MATCH_ANY, RNA_EQ_UNSET_MATCH_NONE));
- return (rna_property_override_diff(ptr_a, ptr_b, prop, NULL, NULL, NULL, mode, NULL, 0, NULL) == 0);
+ return (rna_property_override_diff(bmain, ptr_a, ptr_b, prop, NULL, NULL, NULL, mode, NULL, 0, NULL) == 0);
}
-bool RNA_struct_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mode)
+bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mode)
{
CollectionPropertyIterator iter;
PropertyRNA *iterprop;
@@ -7211,7 +7316,7 @@ bool RNA_struct_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mod
for (; iter.valid; RNA_property_collection_next(&iter)) {
PropertyRNA *prop = iter.ptr.data;
- if (!RNA_property_equals(ptr_a, ptr_b, prop, mode)) {
+ if (!RNA_property_equals(bmain, ptr_a, ptr_b, prop, mode)) {
equals = false;
break;
}
@@ -7234,6 +7339,7 @@ bool RNA_struct_equals(PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mod
* \note When there is no equality, but we cannot determine an order (greater than/lesser than), we return 1.
*/
static int rna_property_override_diff(
+ Main *bmain,
PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, PropertyRNA *prop_a, PropertyRNA *prop_b,
const char *rna_path, eRNACompareMode mode,
IDOverrideStatic *override, const int flags, eRNAOverrideMatchResult *r_report_flags)
@@ -7333,6 +7439,7 @@ static int rna_property_override_diff(
diff_flags &= ~RNA_OVERRIDE_COMPARE_CREATE;
}
const int diff = override_diff(
+ bmain,
ptr_a, ptr_b, prop_a, prop_b, len_a, len_b,
mode, override, rna_path, diff_flags, &override_changed);
if (override_changed && r_report_flags) {
@@ -7345,6 +7452,7 @@ static int rna_property_override_diff(
/* Modify local data-block to make it ready for override application (only needed for diff operations, where we use
* the local data-block's data as second operand). */
static bool rna_property_override_operation_store(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage,
IDOverrideStaticProperty *op)
@@ -7379,8 +7487,11 @@ static bool rna_property_override_operation_store(
}
if (prop_local->override_store(
- ptr_local, ptr_reference, ptr_storage, prop_local, prop_reference, prop_storage,
- len_local, len_reference, len_storage, opop))
+ bmain,
+ ptr_local, ptr_reference, ptr_storage,
+ prop_local, prop_reference, prop_storage,
+ len_local, len_reference, len_storage,
+ opop))
{
changed = true;
}
@@ -7390,8 +7501,10 @@ static bool rna_property_override_operation_store(
}
static bool rna_property_override_operation_apply(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
+ PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
IDOverrideStaticPropertyOperation *opop)
{
int len_local, len_reference, len_storage = 0;
@@ -7460,9 +7573,11 @@ static bool rna_property_override_operation_apply(
/* get and set the default values as appropriate for the various types */
return override_apply(
+ bmain,
ptr_local, ptr_override, ptr_storage,
prop_local, prop_override, prop_storage,
len_local, len_reference, len_storage,
+ ptr_item_local, ptr_item_override, ptr_item_storage,
opop);
}
@@ -7476,6 +7591,7 @@ static bool rna_property_override_operation_apply(
* \return True if _resulting_ \a ptr_local does match \a ptr_reference.
*/
bool RNA_struct_override_matches(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_reference, const char *root_path,
IDOverrideStatic *override, const eRNAOverrideMatch flags,
eRNAOverrideMatchResult *r_report_flags)
@@ -7580,6 +7696,7 @@ bool RNA_struct_override_matches(
eRNAOverrideMatchResult report_flags = 0;
const int diff = rna_property_override_diff(
+ bmain,
ptr_local, ptr_reference, NULL, prop_local, prop_reference, rna_path,
RNA_EQ_STRICT, override, flags, &report_flags);
@@ -7611,8 +7728,12 @@ bool RNA_struct_override_matches(
.subitem_reference_index = -1,
.subitem_local_index = -1
};
- rna_property_override_operation_apply(ptr_local, ptr_reference, NULL,
- prop_local, prop_reference, NULL, &opop_tmp);
+ rna_property_override_operation_apply(
+ bmain,
+ ptr_local, ptr_reference, NULL,
+ prop_local, prop_reference, NULL,
+ NULL, NULL, NULL,
+ &opop_tmp);
if (r_report_flags) {
*r_report_flags |= RNA_OVERRIDE_MATCH_RESULT_RESTORED;
}
@@ -7666,6 +7787,7 @@ bool RNA_struct_override_matches(
/** Store needed second operands into \a storage data-block for differential override operations. */
bool RNA_struct_override_store(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, IDOverrideStatic *override)
{
bool changed = false;
@@ -7689,8 +7811,11 @@ bool RNA_struct_override_store(
RNA_path_resolve_property(ptr_storage, op->rna_path, &data_storage, &prop_storage);
}
- if (rna_property_override_operation_store(&data_local, &data_reference, &data_storage,
- prop_reference, prop_local, prop_storage, op))
+ if (rna_property_override_operation_store(
+ bmain,
+ &data_local, &data_reference, &data_storage,
+ prop_reference, prop_local, prop_storage,
+ op))
{
changed = true;
}
@@ -7704,8 +7829,10 @@ bool RNA_struct_override_store(
}
static void rna_property_override_apply_ex(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
+ PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
IDOverrideStaticProperty *op, const bool do_insert)
{
for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
@@ -7715,8 +7842,12 @@ static void rna_property_override_apply_ex(
}
continue;
}
- if (!rna_property_override_operation_apply(ptr_local, ptr_override, ptr_storage,
- prop_local, prop_override, prop_storage, opop))
+ if (!rna_property_override_operation_apply(
+ bmain,
+ ptr_local, ptr_override, ptr_storage,
+ prop_local, prop_override, prop_storage,
+ ptr_item_local, ptr_item_override, ptr_item_storage,
+ opop))
{
/* TODO No assert here, would be much much better to just report as warning,
* failing override applications will probably be fairly common! */
@@ -7728,6 +7859,7 @@ static void rna_property_override_apply_ex(
/** Apply given \a override operations on \a ptr_local, using \a ptr_override
* (and \a ptr_storage form differential ops) as source. */
void RNA_struct_override_apply(
+ Main *bmain,
PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage, IDOverrideStatic *override)
{
#ifdef DEBUG_OVERRIDE_TIMEIT
@@ -7741,27 +7873,37 @@ void RNA_struct_override_apply(
for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) {
/* Simplified for now! */
PointerRNA data_override, data_local;
+ PointerRNA data_item_override, data_item_local;
PropertyRNA *prop_override, *prop_local;
- if (RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local) &&
- RNA_path_resolve_property(ptr_override, op->rna_path, &data_override, &prop_override))
+ if (RNA_path_resolve_property_and_item_pointer(
+ ptr_local, op->rna_path, &data_local, &prop_local, &data_item_local) &&
+ RNA_path_resolve_property_and_item_pointer(
+ ptr_override, op->rna_path, &data_override, &prop_override, &data_item_override))
{
- PointerRNA data_storage;
+ PointerRNA data_storage, data_item_storage;
PropertyRNA *prop_storage = NULL;
/* It is totally OK if this does not success, only a subset of override operations actually need storage. */
if (ptr_storage && (ptr_storage->id.data != NULL)) {
- RNA_path_resolve_property(ptr_storage, op->rna_path, &data_storage, &prop_storage);
+ RNA_path_resolve_property_and_item_pointer(
+ ptr_storage, op->rna_path, &data_storage, &prop_storage, &data_item_storage);
}
rna_property_override_apply_ex(
+ bmain,
&data_local, &data_override, prop_storage ? &data_storage : NULL,
- prop_local, prop_override, prop_storage, op, do_insert);
+ prop_local, prop_override, prop_storage,
+ &data_item_local, &data_item_override, prop_storage ? &data_item_storage : NULL,
+ op, do_insert);
}
#ifndef NDEBUG
else {
- printf("Failed to apply static override operation to '%s.%s' (could not resolve some properties)\n",
- ((ID *)ptr_override->id.data)->name, op->rna_path);
+ printf("Failed to apply static override operation to '%s.%s' "
+ "(could not resolve some properties, local: %d, override: %d)\n",
+ ((ID *)ptr_override->id.data)->name, op->rna_path,
+ RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local),
+ RNA_path_resolve_property(ptr_override, op->rna_path, &data_override, &prop_override));
}
#endif
}
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 5b225b18a78..97c9d5a9866 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -223,7 +223,7 @@ static void rna_Action_frame_range_get(PointerRNA *ptr, float *values)
/* used to check if an action (value pointer) is suitable to be assigned to the ID-block that is ptr */
-int rna_Action_id_poll(PointerRNA *ptr, PointerRNA value)
+bool rna_Action_id_poll(PointerRNA *ptr, PointerRNA value)
{
ID *srcId = (ID *)ptr->id.data;
bAction *act = (bAction *)value.id.data;
@@ -243,7 +243,7 @@ int rna_Action_id_poll(PointerRNA *ptr, PointerRNA value)
}
/* used to check if an action (value pointer) can be assigned to Action Editor given current mode */
-int rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value)
+bool rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value)
{
SpaceAction *saction = (SpaceAction *)ptr->data;
bAction *act = (bAction *)value.id.data;
@@ -326,13 +326,6 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
/* Object Collection Filtering Settings */
- prop = RNA_def_property(srna, "show_only_collection_objects", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP);
- RNA_def_property_ui_text(prop, "Only Objects in Collection",
- "Only include channels from objects in the specified collection");
- RNA_def_property_ui_icon(prop, ICON_GROUP, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
prop = RNA_def_property(srna, "filter_collection", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "filter_grp");
RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -340,31 +333,19 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
/* FCurve Display Name Search Settings */
- prop = RNA_def_property(srna, "show_only_matching_fcurves", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME);
- RNA_def_property_ui_text(prop, "Only Matching F-Curves",
- "Only include F-Curves with names containing search text");
- RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
prop = RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "searchstr");
RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string");
+ RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
/* NLA Name Search Settings (Shared with FCurve setting, but with different labels) */
- prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME);
- RNA_def_property_ui_text(prop, "Only Matching Channels",
- "Only include channels with names containing search text");
- RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "searchstr");
RNA_def_property_ui_text(prop, "Name Filter", "Live filtering string");
RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
/* Multi-word fuzzy search option for name/text filters */
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index d89e3e68492..3faf8710d6e 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -139,7 +139,7 @@ static void rna_AnimData_tweakmode_set(PointerRNA *ptr, const int value)
/* ****************************** */
/* wrapper for poll callback */
-static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
+static bool RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
{
extern FunctionRNA rna_KeyingSetInfo_poll_func;
@@ -163,7 +163,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
/* read the result */
RNA_parameter_get_lookup(&list, "ok", &ret);
- ok = *(int *)ret;
+ ok = *(bool *)ret;
}
RNA_parameter_list_free(&list);
@@ -586,9 +586,11 @@ static FCurve *rna_Driver_find(AnimData *adt, ReportList *reports, const char *d
}
bool rna_AnimaData_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *UNUSED(prop_storage),
const int len_dst, const int len_src, const int len_storage,
+ PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
IDOverrideStaticPropertyOperation *opop)
{
BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 44a21e797f1..596667a0afd 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -259,7 +259,7 @@ static void rna_Armature_layer_used_refresh(bArmature *arm, ListBase *bones)
}
}
-static void rna_bone_layer_set(int *layer, const int *values)
+static void rna_bone_layer_set(int *layer, const bool *values)
{
int i, tot = 0;
@@ -277,7 +277,7 @@ static void rna_bone_layer_set(int *layer, const int *values)
}
}
-static void rna_Bone_layer_set(PointerRNA *ptr, const int *values)
+static void rna_Bone_layer_set(PointerRNA *ptr, const bool *values)
{
bArmature *arm = (bArmature *)ptr->id.data;
Bone *bone = (Bone *)ptr->data;
@@ -288,7 +288,7 @@ static void rna_Bone_layer_set(PointerRNA *ptr, const int *values)
rna_Armature_layer_used_refresh(arm, &arm->bonebase);
}
-static void rna_Armature_layer_set(PointerRNA *ptr, const int *values)
+static void rna_Armature_layer_set(PointerRNA *ptr, const bool *values)
{
bArmature *arm = (bArmature *)ptr->data;
int i, tot = 0;
@@ -341,7 +341,8 @@ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy_utf8(newname, value, sizeof(ebone->name));
BLI_strncpy(oldname, ebone->name, sizeof(ebone->name));
- ED_armature_bone_rename(G.main, arm, oldname, newname);
+ BLI_assert(BKE_id_is_in_gobal_main(&arm->id));
+ ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
}
static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
@@ -354,10 +355,11 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy_utf8(newname, value, sizeof(bone->name));
BLI_strncpy(oldname, bone->name, sizeof(bone->name));
- ED_armature_bone_rename(G.main, arm, oldname, newname);
+ BLI_assert(BKE_id_is_in_gobal_main(&arm->id));
+ ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
}
-static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[])
+static void rna_EditBone_layer_set(PointerRNA *ptr, const bool values[])
{
EditBone *data = (EditBone *)(ptr->data);
rna_bone_layer_set(&data->layer, values);
diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c
index ae15c58dd29..d1b25239cbe 100644
--- a/source/blender/makesrna/intern/rna_camera_api.c
+++ b/source/blender/makesrna/intern/rna_camera_api.c
@@ -85,4 +85,3 @@ void RNA_api_camera(StructRNA *srna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index a01f2afa26e..1a0dc6dfea6 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -396,7 +396,7 @@ static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const flo
memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
}
-static int rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
+static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
{
Object *ob = (Object *)value.data;
@@ -443,7 +443,7 @@ static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerR
}
}
-static int rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
+static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
{
Object *ob = (Object *)value.data;
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 706dc6a3cd7..6e07976a3c6 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -313,4 +313,3 @@ void RNA_def_context(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 0681a449aa2..2feeba668ce 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -395,7 +395,7 @@ static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value)
}
}
-static int rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value)
+static bool rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value)
{
Curve *cu = (Curve *)ptr->id.data;
Object *ob = (Object *)value.data;
diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c
index b518b0cb5b0..b0c07465958 100644
--- a/source/blender/makesrna/intern/rna_curve_api.c
+++ b/source/blender/makesrna/intern/rna_curve_api.c
@@ -43,7 +43,7 @@
#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-static void rna_Curve_transform(Curve *cu, float *mat, int shape_keys)
+static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys)
{
BKE_curve_transform(cu, (float (*)[4])mat, shape_keys, true);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 5b91a3e43d2..c84ce56c58b 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1651,7 +1651,7 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
}
}
-void RNA_def_property_boolean_default(PropertyRNA *prop, int value)
+void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
{
StructRNA *srna = DefRNA.laststruct;
@@ -1670,7 +1670,7 @@ void RNA_def_property_boolean_default(PropertyRNA *prop, int value)
}
}
-void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array)
+void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array)
{
StructRNA *srna = DefRNA.laststruct;
@@ -2665,7 +2665,7 @@ void RNA_def_py_data(PropertyRNA *prop, void *py_data)
/* Compact definitions */
-PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value,
+PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value,
const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
@@ -2678,7 +2678,7 @@ PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier,
return prop;
}
-PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value,
const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
@@ -2692,7 +2692,7 @@ PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *ident
return prop;
}
-PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value,
const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
@@ -2707,7 +2707,7 @@ PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *ident
}
PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len,
- int *default_value, const char *ui_name, const char *ui_description)
+ bool *default_value, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
@@ -2720,7 +2720,7 @@ PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char
return prop;
}
-PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value,
const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
@@ -3259,6 +3259,7 @@ int rna_parameter_size(PropertyRNA *parm)
if (len > 0) {
switch (ptype) {
case PROP_BOOLEAN:
+ return sizeof(bool) * len;
case PROP_INT:
return sizeof(int) * len;
case PROP_FLOAT:
@@ -3270,6 +3271,7 @@ int rna_parameter_size(PropertyRNA *parm)
else {
switch (ptype) {
case PROP_BOOLEAN:
+ return sizeof(bool);
case PROP_INT:
case PROP_ENUM:
return sizeof(int);
@@ -3430,9 +3432,6 @@ void RNA_def_func_free_pointers(FunctionRNA *func)
void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop)
{
ContainerRNA *cont = cont_;
- EnumPropertyItem *earray;
- float *farray;
- int *iarray;
int a;
/* annoying since we just added this to a hash, could make this add the correct key to the hash
@@ -3447,8 +3446,12 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
}
}
- if (prop->name) prop->name = BLI_strdup(prop->name);
- if (prop->description) prop->description = BLI_strdup(prop->description);
+ if (prop->name) {
+ prop->name = BLI_strdup(prop->name);
+ }
+ if (prop->description) {
+ prop->description = BLI_strdup(prop->description);
+ }
switch (prop->type) {
case PROP_BOOLEAN:
@@ -3456,9 +3459,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
if (bprop->defaultarray) {
- iarray = MEM_callocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store");
- memcpy(iarray, bprop->defaultarray, sizeof(int) * prop->totarraylength);
- bprop->defaultarray = iarray;
+ bool *array = MEM_mallocN(sizeof(bool) * prop->totarraylength, "RNA_def_property_store");
+ memcpy(array, bprop->defaultarray, sizeof(bool) * prop->totarraylength);
+ bprop->defaultarray = array;
}
break;
}
@@ -3467,9 +3470,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
if (iprop->defaultarray) {
- iarray = MEM_callocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store");
- memcpy(iarray, iprop->defaultarray, sizeof(int) * prop->totarraylength);
- iprop->defaultarray = iarray;
+ int *array = MEM_mallocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store");
+ memcpy(array, iprop->defaultarray, sizeof(int) * prop->totarraylength);
+ iprop->defaultarray = array;
}
break;
}
@@ -3478,17 +3481,20 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
if (eprop->item) {
- earray = MEM_callocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store");
- memcpy(earray, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1));
- eprop->item = earray;
+ EnumPropertyItem *array = MEM_mallocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store");
+ memcpy(array, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1));
+ eprop->item = array;
for (a = 0; a < eprop->totitem; a++) {
- if (earray[a].identifier)
- earray[a].identifier = BLI_strdup(earray[a].identifier);
- if (earray[a].name)
- earray[a].name = BLI_strdup(earray[a].name);
- if (earray[a].description)
- earray[a].description = BLI_strdup(earray[a].description);
+ if (array[a].identifier) {
+ array[a].identifier = BLI_strdup(array[a].identifier);
+ }
+ if (array[a].name) {
+ array[a].name = BLI_strdup(array[a].name);
+ }
+ if (array[a].description) {
+ array[a].description = BLI_strdup(array[a].description);
+ }
}
}
break;
@@ -3498,9 +3504,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
if (fprop->defaultarray) {
- farray = MEM_callocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store");
- memcpy(farray, fprop->defaultarray, sizeof(float) * prop->totarraylength);
- fprop->defaultarray = farray;
+ float *array = MEM_mallocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store");
+ memcpy(array, fprop->defaultarray, sizeof(float) * prop->totarraylength);
+ fprop->defaultarray = array;
}
break;
}
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index 3e85e225d27..eb069b5e069 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -338,7 +338,7 @@ static ID *rna_Depsgraph_id_eval_get(Depsgraph *depsgraph, ID *id_orig)
return DEG_get_evaluated_id(depsgraph, id_orig);
}
-static int rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type)
+static bool rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type)
{
return DEG_id_type_updated(depsgraph, id_type);
}
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index 509265c04df..2801b292df6 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -240,7 +240,7 @@ static int rna_DynamicPaint_use_color_preview_get(PointerRNA *ptr)
}
/* does output layer exist*/
-static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index)
+static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index)
{
return dynamicPaint_outputLayerExists(surface, ob, index);
}
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 64d6960d0ff..f70ce67f1b0 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -853,7 +853,7 @@ static void rna_FKeyframe_points_add(FCurve *fcu, int tot)
}
}
-static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, int do_fast)
+static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, bool do_fast)
{
BezTriple *bezt = bezt_ptr->data;
int index = (int)(bezt - fcu->bezt);
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index cd7081d07a8..2418102d94c 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -591,7 +591,7 @@ static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src)
return frame;
}
-static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, int setactive)
+static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, bool setactive)
{
bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0);
@@ -636,7 +636,7 @@ static void rna_GPencil_clear(bGPdata *gpd)
}
/* Palettes */
-static bGPDpalette *rna_GPencil_palette_new(bGPdata *gpd, const char *name, int setactive)
+static bGPDpalette *rna_GPencil_palette_new(bGPdata *gpd, const char *name, bool setactive)
{
bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, name, setactive != 0);
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index 7266c7578c8..b3afba36a9f 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -45,10 +45,14 @@
#include "DEG_depsgraph_build.h"
#include "BKE_collection.h"
+#include "BKE_global.h"
#include "BKE_layer.h"
+#include "BKE_library.h"
#include "WM_api.h"
+#include "RNA_access.h"
+
static void rna_Collection_all_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Collection *collection = (Collection *)ptr->data;
@@ -87,6 +91,7 @@ static void rna_Collection_objects_link(Collection *collection, Main *bmain, Rep
return;
}
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
}
@@ -98,10 +103,55 @@ static void rna_Collection_objects_unlink(Collection *collection, Main *bmain, R
return;
}
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
}
+static bool rna_Collection_objects_override_apply(
+ Main *bmain,
+ PointerRNA *ptr_dst, PointerRNA *UNUSED(ptr_src), PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
+ PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
+{
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE &&
+ "Unsupported RNA override operation on collections' objects");
+
+ Collection *coll_dst = ptr_dst->id.data;
+
+ if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
+ BLI_assert(0 && "invalid source or destination object.");
+ return false;
+ }
+
+ Object *ob_dst = ptr_item_dst->data;
+ Object *ob_src = ptr_item_src->data;
+
+ CollectionObject *cob_dst = BLI_findptr(&coll_dst->gobject, ob_dst, offsetof(CollectionObject, ob));
+
+ if (cob_dst == NULL) {
+ BLI_assert(0 && "Could not find destination object in destination collection!");
+ return false;
+ }
+
+ /* XXX TODO We most certainly rather want to have a 'swap object pointer in collection' util in BKE_collection...
+ * This is only temp auick dirty test! */
+ id_us_min(&cob_dst->ob->id);
+ cob_dst->ob = ob_src;
+ id_us_plus(&cob_dst->ob->id);
+
+ if (BKE_collection_is_in_scene(coll_dst)) {
+ BKE_main_collection_sync(bmain);
+ }
+
+ return true;
+}
+
+
+
+
static void rna_Collection_children_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Collection *collection = (Collection *)ptr->data;
@@ -124,6 +174,7 @@ static void rna_Collection_children_link(Collection *collection, Main *bmain, Re
return;
}
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
}
@@ -135,18 +186,62 @@ static void rna_Collection_children_unlink(Collection *collection, Main *bmain,
return;
}
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
}
+static bool rna_Collection_children_override_apply(
+ Main *bmain,
+ PointerRNA *ptr_dst, PointerRNA *UNUSED(ptr_src), PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
+ PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
+{
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE &&
+ "Unsupported RNA override operation on collections' objects");
+
+ Collection *coll_dst = ptr_dst->id.data;
+
+ if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
+ BLI_assert(0 && "invalid source or destination sub-collection.");
+ return false;
+ }
+
+ Collection *subcoll_dst = ptr_item_dst->data;
+ Collection *subcoll_src = ptr_item_src->data;
+
+ CollectionChild *collchild_dst = BLI_findptr(&coll_dst->children, subcoll_dst, offsetof(CollectionChild, collection));
+
+ if (collchild_dst == NULL) {
+ BLI_assert(0 && "Could not find destination sub-collection in destination collection!");
+ return false;
+ }
+
+ /* XXX TODO We most certainly rather want to have a 'swap object pointer in collection' util in BKE_collection...
+ * This is only temp auick dirty test! */
+ id_us_min(&collchild_dst->collection->id);
+ collchild_dst->collection = subcoll_src;
+ id_us_plus(&collchild_dst->collection->id);
+
+ BKE_collection_object_cache_free(coll_dst);
+ BKE_main_collection_sync(bmain);
+
+ return true;
+}
+
+
+
+
static void rna_Collection_flag_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Collection *collection = (Collection *)ptr->data;
BKE_collection_object_cache_free(collection);
BKE_main_collection_sync(bmain);
+ DEG_id_tag_update(&collection->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
- DEG_id_tag_update(&collection->id, 0);
WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
}
@@ -228,6 +323,7 @@ void RNA_def_collections(BlenderRNA *brna)
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_objects_override_apply");
RNA_def_property_ui_text(prop, "Objects", "Objects that are directly in this collection");
RNA_def_property_collection_funcs(prop, "rna_Collection_objects_begin",
"rna_iterator_listbase_next",
@@ -247,6 +343,8 @@ void RNA_def_collections(BlenderRNA *brna)
prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_children_override_apply");
RNA_def_property_ui_text(prop, "Children", "Collections that are immediate children of this collection");
RNA_def_property_collection_funcs(prop, "rna_Collection_children_begin",
"rna_iterator_listbase_next",
@@ -260,21 +358,21 @@ void RNA_def_collections(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
- RNA_def_property_ui_text(prop, "Restrict Select", "Disable collection for viewport selection");
+ RNA_def_property_ui_text(prop, "Disable Select", "Disable collection for viewport selection");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEW);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
- RNA_def_property_ui_text(prop, "Restrict Viewport", "Disable collection in viewport");
+ RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
- RNA_def_property_ui_text(prop, "Restrict Render", "Disable collection in renders");
+ RNA_def_property_ui_text(prop, "Disable Render", "Disable collection in renders");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
}
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index e71bd52593e..2570f88d09f 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -93,7 +93,8 @@ static void rna_Image_source_set(PointerRNA *ptr, int value)
if (value != ima->source) {
ima->source = value;
- BKE_image_signal(G.main, ima, NULL, IMA_SIGNAL_SRC_CHANGE);
+ BLI_assert(BKE_id_is_in_gobal_main(&ima->id));
+ BKE_image_signal(G_MAIN, ima, NULL, IMA_SIGNAL_SRC_CHANGE);
DEG_id_tag_update(&ima->id, 0);
}
}
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index d839995d15e..70b75efdb36 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -148,7 +148,7 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r
static void rna_Image_pack(
Image *image, Main *bmain, bContext *C, ReportList *reports,
- int as_png, const char *data, int data_len)
+ bool as_png, const char *data, int data_len)
{
ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
@@ -397,4 +397,3 @@ void RNA_api_image(StructRNA *srna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index a1b4e0a7006..5784b2a489a 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -205,9 +205,11 @@ void RNA_def_mask(struct BlenderRNA *brna);
void rna_def_animdata_common(struct StructRNA *srna);
bool rna_AnimaData_override_apply(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
+ struct PointerRNA *ptr_item_local, struct PointerRNA *ptr_item_reference, struct PointerRNA *ptr_item_storage,
struct IDOverrideStaticPropertyOperation *opop);
void rna_def_animviz_common(struct StructRNA *srna);
@@ -278,16 +280,16 @@ void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct Pointe
void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr);
/* basic poll functions for object types */
-int rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
-int rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
-int rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
-int rna_Lamp_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
-int rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
-int rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Lamp_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value);
/* basic poll functions for actions (to prevent actions getting set in wrong places) */
-int rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value);
-int rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value);
+bool rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value);
char *rna_TextureSlot_path(struct PointerRNA *ptr);
char *rna_Node_ImageUser_path(struct PointerRNA *ptr);
@@ -410,6 +412,7 @@ struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, stru
* Not obvious though, those are fairly more complicated than basic SDNA access.
*/
int rna_property_override_diff_default(
+ struct Main *bmain,
struct PointerRNA *ptr_a, struct PointerRNA *ptr_b,
struct PropertyRNA *prop_a, struct PropertyRNA *prop_b,
const int len_a, const int len_b,
@@ -418,15 +421,18 @@ int rna_property_override_diff_default(
const int flags, bool *r_override_changed);
bool rna_property_override_store_default(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
struct IDOverrideStaticPropertyOperation *opop);
bool rna_property_override_apply_default(
+ struct Main *bmain,
struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
const int len_dst, const int len_src, const int len_storage,
+ struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage,
struct IDOverrideStaticPropertyOperation *opop);
@@ -476,7 +482,7 @@ int rna_parameter_size(struct PropertyRNA *parm);
struct Mesh *rna_Main_meshes_new_from_object(
struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph,
- struct Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed);
+ struct Object *ob, bool apply_modifiers, bool calc_tessface, bool calc_undeformed);
/* XXX, these should not need to be defined here~! */
struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports);
@@ -487,7 +493,7 @@ void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct Re
int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr);
const char *rna_translate_ui_text(
- const char *text, const char *text_ctxt, struct StructRNA *type, struct PropertyRNA *prop, int translate);
+ const char *text, const char *text_ctxt, struct StructRNA *type, struct PropertyRNA *prop, bool translate);
/* Internal functions that cycles uses so we need to declare (tsk tsk) */
void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values);
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 4536b970f91..f03752968c9 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -63,10 +63,10 @@ typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr);
typedef char *(*StructPathFunc)(struct PointerRNA *ptr);
typedef int (*PropArrayLengthGetFunc)(struct PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]);
-typedef int (*PropBooleanGetFunc)(struct PointerRNA *ptr);
-typedef void (*PropBooleanSetFunc)(struct PointerRNA *ptr, int value);
-typedef void (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, int *values);
-typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, const int *values);
+typedef bool (*PropBooleanGetFunc)(struct PointerRNA *ptr);
+typedef void (*PropBooleanSetFunc)(struct PointerRNA *ptr, bool value);
+typedef void (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, bool *values);
+typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, const bool *values);
typedef int (*PropIntGetFunc)(struct PointerRNA *ptr);
typedef void (*PropIntSetFunc)(struct PointerRNA *ptr, int value);
typedef void (*PropIntArrayGetFunc)(struct PointerRNA *ptr, int *values);
@@ -88,8 +88,8 @@ typedef const EnumPropertyItem *(*PropEnumItemFunc)(
typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr);
typedef StructRNA *(*PropPointerTypeFunc)(struct PointerRNA *ptr);
typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value);
-typedef int (*PropPointerPollFunc)(struct PointerRNA *ptr, const PointerRNA value);
-typedef int (*PropPointerPollFuncPy)(struct PointerRNA *ptr, const PointerRNA value, const PropertyRNA *prop);
+typedef bool (*PropPointerPollFunc)(struct PointerRNA *ptr, const PointerRNA value);
+typedef bool (*PropPointerPollFuncPy)(struct PointerRNA *ptr, const PointerRNA value, const PropertyRNA *prop);
typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr);
typedef void (*PropCollectionNextFunc)(struct CollectionPropertyIterator *iter);
typedef void (*PropCollectionEndFunc)(struct CollectionPropertyIterator *iter);
@@ -100,10 +100,10 @@ typedef int (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char
typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr);
/* extended versions with PropertyRNA argument */
-typedef int (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
-typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
-typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
-typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values);
+typedef bool (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
+typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value);
+typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values);
+typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values);
typedef int (*PropIntGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
typedef void (*PropIntSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
typedef void (*PropIntArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
@@ -133,6 +133,7 @@ typedef void (*PropEnumSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *pr
* \note \a override, \a rna_path and \a r_override_changed may be NULL pointers.
*/
typedef int (*RNAPropOverrideDiff)(
+ struct Main *bmain,
struct PointerRNA *ptr_a, struct PointerRNA *ptr_b,
struct PropertyRNA *prop_a, struct PropertyRNA *prop_b,
const int len_a, const int len_b,
@@ -150,6 +151,7 @@ typedef int (*RNAPropOverrideDiff)(
* is out of range (or even change it to basic 'set' operation if nothing else works).
*/
typedef bool (*RNAPropOverrideStore)(
+ struct Main *bmain,
struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
@@ -163,9 +165,11 @@ typedef bool (*RNAPropOverrideStore)(
* \note In non-array cases, \a len values are 0.
*/
typedef bool (*RNAPropOverrideApply)(
+ struct Main *bmain,
struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
const int len_dst, const int len_src, const int len_storage,
+ struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage,
struct IDOverrideStaticPropertyOperation *opop);
/* Container - generic abstracted container of RNA properties */
@@ -290,8 +294,8 @@ typedef struct BoolPropertyRNA {
PropBooleanArrayGetFuncEx getarray_ex;
PropBooleanArraySetFuncEx setarray_ex;
- int defaultvalue;
- const int *defaultarray;
+ bool defaultvalue;
+ const bool *defaultarray;
} BoolPropertyRNA;
typedef struct IntPropertyRNA {
diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c
index 5637f8d9248..231c5ce0c36 100644
--- a/source/blender/makesrna/intern/rna_lattice_api.c
+++ b/source/blender/makesrna/intern/rna_lattice_api.c
@@ -41,7 +41,7 @@
#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-static void rna_Lattice_transform(Lattice *lt, float *mat, int shape_keys)
+static void rna_Lattice_transform(Lattice *lt, float *mat, bool shape_keys)
{
BKE_lattice_transform(lt, (float (*)[4])mat, shape_keys);
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 060b075cb29..7d770a99c0c 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -198,8 +198,7 @@ static void rna_LayerCollection_use_update(Main *bmain, Scene *UNUSED(scene), Po
BKE_layer_collection_sync(scene, view_layer);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
+ DEG_id_tag_update(&scene->id, DEG_TAG_BASE_FLAGS_UPDATE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_lightprobe.c b/source/blender/makesrna/intern/rna_lightprobe.c
index f3091ae5ee1..a14699691a6 100644
--- a/source/blender/makesrna/intern/rna_lightprobe.c
+++ b/source/blender/makesrna/intern/rna_lightprobe.c
@@ -222,4 +222,3 @@ void RNA_def_lightprobe(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 6ff3849e295..fff53aafcc7 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -53,7 +53,6 @@
#include "BKE_camera.h"
#include "BKE_collection.h"
#include "BKE_curve.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
#include "BKE_mesh.h"
#include "BKE_armature.h"
@@ -130,8 +129,9 @@ static void rna_idname_validate(const char *name, char *r_name)
}
-static void rna_Main_ID_remove(Main *bmain, ReportList *reports, PointerRNA *id_ptr,
- int do_unlink, int do_id_user, int do_ui_user)
+static void rna_Main_ID_remove(
+ Main *bmain, ReportList *reports, PointerRNA *id_ptr,
+ bool do_unlink, bool do_id_user, bool do_ui_user)
{
ID *id = id_ptr->data;
if (do_unlink) {
@@ -167,7 +167,7 @@ static Scene *rna_Main_scenes_new(Main *bmain, const char *name)
return BKE_scene_add(bmain, safe_name);
}
-static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, int do_unlink)
+static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink)
{
/* don't call BKE_libblock_free(...) directly */
Scene *scene = scene_ptr->data;
@@ -300,7 +300,7 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
/* copied from Mesh_getFromObject and adapted to RNA interface */
Mesh *rna_Main_meshes_new_from_object(
Main *bmain, ReportList *reports, Depsgraph *depsgraph,
- Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed)
+ Object *ob, bool apply_modifiers, bool calc_tessface, bool calc_undeformed)
{
Scene *sce = DEG_get_evaluated_scene(depsgraph);
@@ -330,7 +330,7 @@ static Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type)
return lamp;
}
-static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer, int stereo3d)
+static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, bool alpha, bool float_buffer, bool stereo3d)
{
char safe_name[MAX_ID_NAME - 2];
rna_idname_validate(name, safe_name);
@@ -340,7 +340,7 @@ static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int
id_us_min(&image->id);
return image;
}
-static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing)
+static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing)
{
Image *ima;
@@ -391,7 +391,7 @@ static MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name)
return mb;
}
-static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing)
+static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing)
{
VFont *font;
errno = 0;
@@ -461,7 +461,7 @@ static Speaker *rna_Main_speakers_new(Main *bmain, const char *name)
return speaker;
}
-static bSound *rna_Main_sounds_load(Main *bmain, const char *name, int check_existing)
+static bSound *rna_Main_sounds_load(Main *bmain, const char *name, bool check_existing)
{
bSound *sound;
@@ -484,7 +484,7 @@ static Text *rna_Main_texts_new(Main *bmain, const char *name)
return BKE_text_add(bmain, safe_name);
}
-static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, int is_internal)
+static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, bool is_internal)
{
Text *txt;
@@ -538,7 +538,7 @@ static Palette *rna_Main_palettes_new(Main *bmain, const char *name)
return (Palette *)palette;
}
-static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing)
+static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing)
{
MovieClip *clip;
@@ -593,7 +593,7 @@ static LightProbe *rna_Main_lightprobe_new(Main *bmain, const char *name)
/* tag functions, all the same */
#define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \
- static void rna_Main_##_func_name##_tag(Main *bmain, int value) { \
+ static void rna_Main_##_func_name##_tag(Main *bmain, bool value) { \
BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \
} \
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 858dd0ec972..26c281ad9e1 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -180,6 +180,7 @@ static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
if (ma->use_nodes && ma->nodetree == NULL)
ED_node_shader_default(C, &ma->id);
+ DEG_id_tag_update(&ma->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
rna_Material_draw_update(bmain, CTX_data_scene(C), ptr);
}
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index c7441f92c33..268655d77bf 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -50,4 +50,3 @@ void RNA_api_material(StructRNA *UNUSED(srna))
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index ed19877ec0f..0087a154f88 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -101,12 +101,12 @@ static void rna_Mesh_free_tangents(Mesh *mesh)
CustomData_free_layers(&mesh->ldata, CD_MLOOPTANGENT, mesh->totloop);
}
-static void rna_Mesh_calc_tessface(Mesh *mesh, int free_mpoly)
+static void rna_Mesh_calc_tessface(Mesh *mesh, bool free_mpoly)
{
ED_mesh_calc_tessface(mesh, free_mpoly != 0);
}
-static void rna_Mesh_calc_smooth_groups(Mesh *mesh, int use_bitflags, int *r_poly_group_len,
+static void rna_Mesh_calc_smooth_groups(Mesh *mesh, bool use_bitflags, int *r_poly_group_len,
int **r_poly_group, int *r_group_total)
{
*r_poly_group_len = mesh->totpoly;
@@ -194,7 +194,7 @@ static void rna_Mesh_normals_split_custom_set_from_vertices(
DEG_id_tag_update(&mesh->id, 0);
}
-static void rna_Mesh_transform(Mesh *mesh, float *mat, int shape_keys)
+static void rna_Mesh_transform(Mesh *mesh, float *mat, bool shape_keys)
{
BKE_mesh_transform(mesh, (float (*)[4])mat, shape_keys);
@@ -210,7 +210,7 @@ static void rna_Mesh_flip_normals(Mesh *mesh)
DEG_id_tag_update(&mesh->id, 0);
}
-static void rna_Mesh_split_faces(Mesh *mesh, int free_loop_normals)
+static void rna_Mesh_split_faces(Mesh *mesh, bool free_loop_normals)
{
BKE_mesh_split_faces(mesh, free_loop_normals != 0);
}
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 87c28115325..c1b271e9214 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -905,7 +905,7 @@ static const EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(
return rna_enum_dt_layers_select_src_items;
}
- Depsgraph *depsgraph= CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene = CTX_data_scene(C);
/* No active here! */
@@ -1156,7 +1156,7 @@ static void rna_MeshSequenceCache_object_path_update(Main *bmain, Scene *scene,
rna_Modifier_update(bmain, scene, ptr);
}
-static int rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, const PointerRNA value)
+static bool rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, const PointerRNA value)
{
ParticleInstanceModifierData *psmd = ptr->data;
ParticleSystem *psys = value.data;
@@ -1165,7 +1165,7 @@ static int rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, co
return false;
/* make sure psys is in the object */
- return BLI_findindex(&psmd->ob->particlesystem, psys) >= 0;
+ return BLI_findindex(&psmd->ob->particlesystem, psys) != -1;
}
static PointerRNA rna_ParticleInstanceModifier_particle_system_get(PointerRNA *ptr)
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 56065df45bb..492335d4d25 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -249,7 +249,7 @@ bNodeTreeType *rna_node_tree_type_from_enum(int value)
return result;
}
-const EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, bNodeTreeType *), bool *r_free)
+const EnumPropertyItem *rna_node_tree_type_itemf(void *data, bool (*poll)(void *data, bNodeTreeType *), bool *r_free)
{
EnumPropertyItem tmp = {0};
EnumPropertyItem *item = NULL;
@@ -325,7 +325,7 @@ bNodeType *rna_node_type_from_enum(int value)
return result;
}
-const EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, bNodeType *), bool *r_free)
+const EnumPropertyItem *rna_node_type_itemf(void *data, bool (*poll)(void *data, bNodeType *), bool *r_free)
{
EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0};
@@ -400,7 +400,7 @@ bNodeSocketType *rna_node_socket_type_from_enum(int value)
}
const EnumPropertyItem *rna_node_socket_type_itemf(
- void *data, int (*poll)(void *data, bNodeSocketType *), bool *r_free)
+ void *data, bool (*poll)(void *data, bNodeSocketType *), bool *r_free)
{
EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0};
@@ -532,7 +532,7 @@ static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr)
return &RNA_NodeTree;
}
-static int rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype)
+static bool rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype)
{
extern FunctionRNA rna_NodeTree_poll_func;
@@ -550,7 +550,7 @@ static int rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype)
ntreetype->ext.call((bContext *)C, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(int *)ret;
+ visible = *(bool *)ret;
RNA_parameter_list_free(&list);
@@ -794,7 +794,7 @@ static void rna_NodeTree_active_node_set(PointerRNA *ptr, const PointerRNA value
static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, Main *bmain, ReportList *reports,
bNodeSocket *fromsock, bNodeSocket *tosock,
- int verify_limits)
+ bool verify_limits)
{
bNodeLink *ret;
bNode *fromnode = NULL, *tonode = NULL;
@@ -1146,7 +1146,7 @@ char *rna_Node_ImageUser_path(PointerRNA *ptr)
return NULL;
}
-static int rna_Node_poll(bNodeType *ntype, bNodeTree *ntree)
+static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree)
{
extern FunctionRNA rna_Node_poll_func;
@@ -1154,7 +1154,7 @@ static int rna_Node_poll(bNodeType *ntype, bNodeTree *ntree)
ParameterList list;
FunctionRNA *func;
void *ret;
- int visible;
+ bool visible;
RNA_pointer_create(NULL, ntype->ext.srna, NULL, &ptr); /* dummy */
func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
@@ -1164,14 +1164,14 @@ static int rna_Node_poll(bNodeType *ntype, bNodeTree *ntree)
ntype->ext.call(NULL, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(int *)ret;
+ visible = *(bool *)ret;
RNA_parameter_list_free(&list);
return visible;
}
-static int rna_Node_poll_instance(bNode *node, bNodeTree *ntree)
+static bool rna_Node_poll_instance(bNode *node, bNodeTree *ntree)
{
extern FunctionRNA rna_Node_poll_instance_func;
@@ -1179,7 +1179,7 @@ static int rna_Node_poll_instance(bNode *node, bNodeTree *ntree)
ParameterList list;
FunctionRNA *func;
void *ret;
- int visible;
+ bool visible;
RNA_pointer_create(NULL, node->typeinfo->ext.srna, node, &ptr); /* dummy */
func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */
@@ -1189,14 +1189,14 @@ static int rna_Node_poll_instance(bNode *node, bNodeTree *ntree)
node->typeinfo->ext.call(NULL, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(int *)ret;
+ visible = *(bool *)ret;
RNA_parameter_list_free(&list);
return visible;
}
-static int rna_Node_poll_instance_default(bNode *node, bNodeTree *ntree)
+static bool rna_Node_poll_instance_default(bNode *node, bNodeTree *ntree)
{
/* use the basic poll function */
return rna_Node_poll(node->typeinfo, ntree);
@@ -1345,7 +1345,7 @@ static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int
RNA_parameter_list_free(&list);
}
-static int rna_Node_is_registered_node_type(StructRNA *type)
+static bool rna_Node_is_registered_node_type(StructRNA *type)
{
return (RNA_struct_blender_type_get(type) != NULL);
}
@@ -1562,7 +1562,7 @@ static void rna_Node_parent_set(PointerRNA *ptr, PointerRNA value)
}
}
-static int rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
+static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
{
bNode *node = ptr->data;
bNode *parent = value.data;
@@ -2397,13 +2397,13 @@ static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index)
return PointerRNA_NULL;
}
-static int rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree)
+static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree)
{
bNodeType *ntype = RNA_struct_blender_type_get(srna);
return ntype && (!ntype->poll || ntype->poll(ntype, ntree));
}
-static int rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree)
+static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree)
{
bNodeType *ntype = node->typeinfo;
if (ntype->poll_instance) {
@@ -2506,7 +2506,7 @@ static void rna_NodeGroup_node_tree_set(PointerRNA *ptr, const PointerRNA value)
}
}
-static int rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
+static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
{
bNodeTree *ntree = ptr->id.data;
bNodeTree *ngroup = value.data;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 73a2b293c22..04f4c41659d 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -224,6 +224,7 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
{
Object *ob = ptr->id.data;
BKE_main_collection_sync(bmain);
+ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
}
@@ -326,6 +327,9 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
return;
}
+ BLI_assert(BKE_id_is_in_gobal_main(&ob->id));
+ BLI_assert(BKE_id_is_in_gobal_main(id));
+
if (ob->type == OB_EMPTY) {
if (ob->data) {
id_us_min((ID *)ob->data);
@@ -338,7 +342,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
}
}
else if (ob->type == OB_MESH) {
- BKE_mesh_assign_object(G.main, ob, (Mesh *)id);
+ BKE_mesh_assign_object(G_MAIN, ob, (Mesh *)id);
}
else {
if (ob->data) {
@@ -350,7 +354,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
id_us_plus(id);
ob->data = id;
- test_object_materials(G.main, ob, id);
+ test_object_materials(G_MAIN, ob, id);
if (GS(id->name) == ID_CU)
BKE_curve_type_test(ob);
@@ -737,7 +741,9 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
Object *ob = (Object *)ptr->id.data;
DEG_id_tag_update(value.data, 0);
- assign_material(G.main, ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
+ BLI_assert(BKE_id_is_in_gobal_main(&ob->id));
+ BLI_assert(BKE_id_is_in_gobal_main(value.data));
+ assign_material(G_MAIN, ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
}
static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
@@ -929,7 +935,9 @@ static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
Object *ob = (Object *)ptr->id.data;
int index = (Material **)ptr->data - ob->mat;
- assign_material(G.main, ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
+ BLI_assert(BKE_id_is_in_gobal_main(&ob->id));
+ BLI_assert(BKE_id_is_in_gobal_main(value.data));
+ assign_material(G_MAIN, ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
}
static int rna_MaterialSlot_link_get(PointerRNA *ptr)
@@ -1139,9 +1147,11 @@ static void rna_Object_constraints_clear(Object *object, Main *bmain)
}
bool rna_Object_constraints_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
+ PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
IDOverrideStaticPropertyOperation *opop)
{
BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
@@ -1213,9 +1223,11 @@ static void rna_Object_modifier_clear(Object *object, bContext *C)
}
bool rna_Object_modifiers_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
+ PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
IDOverrideStaticPropertyOperation *opop)
{
BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
@@ -1409,32 +1421,32 @@ static void rna_FaceMap_face_remove(ID *id, bFaceMap *fmap, ReportList *reports,
}
/* generic poll functions */
-int rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+bool rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_LATTICE;
}
-int rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+bool rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_CURVE;
}
-int rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+bool rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_ARMATURE;
}
-int rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+bool rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_MESH;
}
-int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+bool rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_CAMERA;
}
-int rna_Lamp_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+bool rna_Lamp_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
return ((Object *)value.id.data)->type == OB_LAMP;
}
@@ -2299,19 +2311,19 @@ static void rna_def_object(BlenderRNA *brna)
/* restrict */
prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
- RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
+ RNA_def_property_ui_text(prop, "Disable View", "Disable object in the viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
- RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
+ RNA_def_property_ui_text(prop, "Disable Select", "Disable object selection in the viewport");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
- RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
+ RNA_def_property_ui_text(prop, "Disable Render", "Disable object in renders");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index f86a3d8236a..b902fa73334 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -68,7 +68,6 @@ static const EnumPropertyItem space_items[] = {
#include "BKE_anim.h"
#include "BKE_bvhutils.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
@@ -123,7 +122,7 @@ static void rna_Object_select_set(Object *ob, bContext *C, ReportList *reports,
}
}
-static int rna_Object_select_get(Object *ob, bContext *C, ReportList *reports)
+static bool rna_Object_select_get(Object *ob, bContext *C, ReportList *reports)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BKE_view_layer_base_find(view_layer, ob);
@@ -136,7 +135,7 @@ static int rna_Object_select_get(Object *ob, bContext *C, ReportList *reports)
return ((base->flag & BASE_SELECTED) != 0) ? 1 : 0;
}
-static int rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports)
+static bool rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports)
{
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = BKE_view_layer_base_find(view_layer, ob);
@@ -146,7 +145,7 @@ static int rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports)
return -1;
}
- return ((base->flag & BASE_VISIBLED) != 0) ? 1 : 0;
+ return ((base->flag & BASE_VISIBLE) != 0) ? 1 : 0;
}
/* Convert a given matrix from a space to another (using the object and/or a bone as reference). */
@@ -201,7 +200,7 @@ static void rna_Object_camera_fit_coords(
/* settings: 0 - preview, 1 - render */
static Mesh *rna_Object_to_mesh(
Object *ob, bContext *C, ReportList *reports, Depsgraph *depsgraph,
- int apply_modifiers, int calc_tessface, int calc_undeformed)
+ bool apply_modifiers, bool calc_tessface, bool calc_undeformed)
{
Main *bmain = CTX_data_main(C);
@@ -209,7 +208,7 @@ static Mesh *rna_Object_to_mesh(
}
static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports,
- const char *name, int from_mix)
+ const char *name, bool from_mix)
{
Main *bmain = CTX_data_main(C);
KeyBlock *kb = NULL;
@@ -289,20 +288,20 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
#endif
/* don't call inside a loop */
-static int dm_looptri_to_poly_index(DerivedMesh *dm, const MLoopTri *lt)
+static int mesh_looptri_to_poly_index(Mesh *me_eval, const MLoopTri *lt)
{
- const int *index_mp_to_orig = dm->getPolyDataArray(dm, CD_ORIGINDEX);
+ const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
return index_mp_to_orig ? index_mp_to_orig[lt->poly] : lt->poly;
}
static void rna_Object_ray_cast(
Object *ob, ReportList *reports,
float origin[3], float direction[3], float distance,
- int *r_success, float r_location[3], float r_normal[3], int *r_index)
+ bool *r_success, float r_location[3], float r_normal[3], int *r_index)
{
bool success = false;
- if (ob->derivedFinal == NULL) {
+ if (ob->runtime.mesh_eval == NULL) {
BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for ray casting", ob->id.name + 2);
return;
}
@@ -315,7 +314,7 @@ static void rna_Object_ray_cast(
BVHTreeFromMesh treeData = {NULL};
/* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
- bvhtree_from_mesh_get(&treeData, ob->derivedFinal, BVHTREE_FROM_LOOPTRI, 4);
+ BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
/* may fail if the mesh has no faces, in that case the ray-cast misses */
if (treeData.tree != NULL) {
@@ -335,7 +334,7 @@ static void rna_Object_ray_cast(
copy_v3_v3(r_location, hit.co);
copy_v3_v3(r_normal, hit.no);
- *r_index = dm_looptri_to_poly_index(ob->derivedFinal, &treeData.looptri[hit.index]);
+ *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, &treeData.looptri[hit.index]);
}
}
@@ -353,18 +352,18 @@ static void rna_Object_ray_cast(
static void rna_Object_closest_point_on_mesh(
Object *ob, ReportList *reports, float origin[3], float distance,
- int *r_success, float r_location[3], float r_normal[3], int *r_index)
+ bool *r_success, float r_location[3], float r_normal[3], int *r_index)
{
BVHTreeFromMesh treeData = {NULL};
- if (ob->derivedFinal == NULL) {
+ if (ob->runtime.mesh_eval == NULL) {
BKE_reportf(reports, RPT_ERROR, "Object '%s' has no mesh data to be used for finding nearest point",
ob->id.name + 2);
return;
}
/* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
- bvhtree_from_mesh_get(&treeData, ob->derivedFinal, BVHTREE_FROM_LOOPTRI, 4);
+ BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
if (treeData.tree == NULL) {
BKE_reportf(reports, RPT_ERROR, "Object '%s' could not create internal data for finding nearest point",
@@ -382,7 +381,7 @@ static void rna_Object_closest_point_on_mesh(
copy_v3_v3(r_location, nearest.co);
copy_v3_v3(r_normal, nearest.no);
- *r_index = dm_looptri_to_poly_index(ob->derivedFinal, &treeData.looptri[nearest.index]);
+ *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, &treeData.looptri[nearest.index]);
goto finally;
}
@@ -398,21 +397,23 @@ finally:
free_bvhtree_from_mesh(&treeData);
}
-static int rna_Object_is_modified(Object *ob, Scene *scene, int settings)
+static bool rna_Object_is_modified(Object *ob, Scene *scene, int settings)
{
return BKE_object_is_modified(scene, ob) & settings;
}
-static int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
+static bool rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
{
return BKE_object_is_deform_modified(scene, ob) & settings;
}
#ifndef NDEBUG
-void rna_Object_dm_info(struct Object *ob, int type, char *result)
+
+#include "BKE_mesh_runtime.h"
+
+void rna_Object_me_eval_info(struct Object *ob, int type, char *result)
{
- DerivedMesh *dm = NULL;
- bool dm_release = false;
+ Mesh *me_eval = NULL;
char *ret = NULL;
result[0] = '\0';
@@ -420,24 +421,19 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result)
switch (type) {
case 0:
if (ob->type == OB_MESH) {
- dm = CDDM_from_mesh(ob->data);
- ret = DM_debug_info(dm);
- dm_release = true;
+ me_eval = ob->data;
}
break;
case 1:
- dm = ob->derivedDeform;
+ me_eval = ob->runtime.mesh_deform_eval;
break;
case 2:
- dm = ob->derivedFinal;
+ me_eval = ob->runtime.mesh_eval;
break;
}
- if (dm) {
- ret = DM_debug_info(dm);
- if (dm_release) {
- dm->release(dm);
- }
+ if (me_eval) {
+ ret = BKE_mesh_runtime_debug_info(me_eval);
if (ret) {
strcpy(result, ret);
MEM_freeN(ret);
@@ -446,7 +442,7 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result)
}
#endif /* NDEBUG */
-static int rna_Object_update_from_editmode(Object *ob, Main *bmain)
+static bool rna_Object_update_from_editmode(Object *ob, Main *bmain)
{
/* fail gracefully if we aren't in edit-mode. */
return ED_object_editmode_load(bmain, ob);
@@ -664,7 +660,7 @@ void RNA_api_object(StructRNA *srna)
#ifndef NDEBUG
/* mesh */
- func = RNA_def_function(srna, "dm_info", "rna_Object_dm_info");
+ func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info");
RNA_def_function_ui_description(func, "Returns a string for derived mesh data");
parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c
index c7891680adb..51199af011b 100644
--- a/source/blender/makesrna/intern/rna_packedfile.c
+++ b/source/blender/makesrna/intern/rna_packedfile.c
@@ -79,4 +79,3 @@ void RNA_def_packedfile(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 573bbb5345b..b33bf9a47b7 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -139,8 +139,6 @@ static const EnumPropertyItem part_hair_ren_as_items[] = {
#include "BKE_cloth.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_effect.h"
#include "BKE_material.h"
#include "BKE_modifier.h"
@@ -609,6 +607,14 @@ static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *
rna_Particle_redo(bmain, scene, ptr);
}
+static void rna_Particle_redo_count(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+ DEG_relations_tag_update(bmain);
+ psys_check_group_weights(part);
+ particle_recalc(bmain, scene, ptr, PSYS_RECALC_REDO);
+}
+
static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET);
@@ -2322,8 +2328,8 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
- RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
+ RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same collecton");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
prop = RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
@@ -3087,7 +3093,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Dupli Collection", "Show Objects in this collection in place of particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
prop = RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 6a5f6485029..05eb2117990 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -292,7 +292,9 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
BLI_strncpy_utf8(newname, value, sizeof(pchan->name));
BLI_strncpy(oldname, pchan->name, sizeof(pchan->name));
- ED_armature_bone_rename(G.main, ob->data, oldname, newname);
+ BLI_assert(BKE_id_is_in_gobal_main(&ob->id));
+ BLI_assert(BKE_id_is_in_gobal_main(ob->data));
+ ED_armature_bone_rename(G_MAIN, ob->data, oldname, newname);
}
static int rna_PoseChannel_has_ik_get(PointerRNA *ptr)
@@ -568,9 +570,11 @@ static void rna_PoseChannel_constraints_remove(
}
bool rna_PoseChannel_constraints_override_apply(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
+ PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
IDOverrideStaticPropertyOperation *opop)
{
BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c
index f523b725b18..04ecdd497f6 100644
--- a/source/blender/makesrna/intern/rna_pose_api.c
+++ b/source/blender/makesrna/intern/rna_pose_api.c
@@ -84,4 +84,3 @@ void RNA_api_pose_channel(StructRNA *srna)
#endif
-
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 0dd33944dda..47933ff4b43 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -127,7 +127,7 @@ static void engine_tag_update(RenderEngine *engine)
engine->flag |= RE_ENGINE_DO_UPDATE;
}
-static int engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene)
+static bool engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene)
{
return IMB_colormanagement_support_glsl_draw(&scene->view_settings);
}
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index 60a1783f118..aa90ba28e23 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -124,8 +124,8 @@ static void rna_RigidBodyWorld_num_solver_iterations_set(PointerRNA *ptr, int va
rbw->num_solver_iterations = value;
#ifdef WITH_BULLET
- if (rbw->physics_world) {
- RB_dworld_set_solver_iterations(rbw->physics_world, value);
+ if (rbw->shared->physics_world) {
+ RB_dworld_set_solver_iterations(rbw->shared->physics_world, value);
}
#endif
}
@@ -137,8 +137,8 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, int value)
RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
#ifdef WITH_BULLET
- if (rbw->physics_world) {
- RB_dworld_set_split_impulse(rbw->physics_world, value);
+ if (rbw->shared->physics_world) {
+ RB_dworld_set_split_impulse(rbw->shared->physics_world, value);
}
#endif
}
@@ -167,7 +167,7 @@ static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, Point
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
BKE_rigidbody_cache_reset(rbw);
- if (rbo->physics_shape)
+ if (rbo->shared->physics_shape)
rbo->flag |= RBO_FLAG_NEEDS_RESHAPE;
}
@@ -201,9 +201,9 @@ static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
#ifdef WITH_BULLET
/* update kinematic state if necessary - only needed for active bodies */
- if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
- RB_body_set_kinematic_state(rbo->physics_object, !value);
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->shared->physics_object, !value);
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
#endif
@@ -217,8 +217,8 @@ static void rna_RigidBodyOb_mass_set(PointerRNA *ptr, float value)
#ifdef WITH_BULLET
/* only active bodies need mass update */
- if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
}
#endif
}
@@ -230,8 +230,8 @@ static void rna_RigidBodyOb_friction_set(PointerRNA *ptr, float value)
rbo->friction = value;
#ifdef WITH_BULLET
- if (rbo->physics_object) {
- RB_body_set_friction(rbo->physics_object, value);
+ if (rbo->shared->physics_object) {
+ RB_body_set_friction(rbo->shared->physics_object, value);
}
#endif
}
@@ -242,8 +242,8 @@ static void rna_RigidBodyOb_restitution_set(PointerRNA *ptr, float value)
rbo->restitution = value;
#ifdef WITH_BULLET
- if (rbo->physics_object) {
- RB_body_set_restitution(rbo->physics_object, value);
+ if (rbo->shared->physics_object) {
+ RB_body_set_restitution(rbo->shared->physics_object, value);
}
#endif
}
@@ -255,13 +255,13 @@ static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value)
rbo->margin = value;
#ifdef WITH_BULLET
- if (rbo->physics_shape) {
- RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo));
+ if (rbo->shared->physics_shape) {
+ RB_shape_set_margin(rbo->shared->physics_shape, RBO_GET_MARGIN(rbo));
}
#endif
}
-static void rna_RigidBodyOb_collision_groups_set(PointerRNA *ptr, const int *values)
+static void rna_RigidBodyOb_collision_groups_set(PointerRNA *ptr, const bool *values)
{
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
int i;
@@ -283,9 +283,9 @@ static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, int value)
#ifdef WITH_BULLET
/* update kinematic state if necessary */
- if (rbo->physics_object) {
- RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
- RB_body_set_kinematic_state(rbo->physics_object, value);
+ if (rbo->shared->physics_object) {
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->shared->physics_object, value);
rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
#endif
@@ -299,8 +299,8 @@ static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, int value)
#ifdef WITH_BULLET
/* update activation state if necessary - only active bodies can be deactivated */
- if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_activation_state(rbo->physics_object, value);
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_activation_state(rbo->shared->physics_object, value);
}
#endif
}
@@ -313,8 +313,8 @@ static void rna_RigidBodyOb_linear_sleepThresh_set(PointerRNA *ptr, float value)
#ifdef WITH_BULLET
/* only active bodies need sleep threshold update */
- if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_linear_sleep_thresh(rbo->physics_object, value);
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_linear_sleep_thresh(rbo->shared->physics_object, value);
}
#endif
}
@@ -327,8 +327,8 @@ static void rna_RigidBodyOb_angular_sleepThresh_set(PointerRNA *ptr, float value
#ifdef WITH_BULLET
/* only active bodies need sleep threshold update */
- if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_angular_sleep_thresh(rbo->physics_object, value);
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_angular_sleep_thresh(rbo->shared->physics_object, value);
}
#endif
}
@@ -341,8 +341,8 @@ static void rna_RigidBodyOb_linear_damping_set(PointerRNA *ptr, float value)
#ifdef WITH_BULLET
/* only active bodies need damping update */
- if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_linear_damping(rbo->physics_object, value);
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_linear_damping(rbo->shared->physics_object, value);
}
#endif
}
@@ -355,8 +355,8 @@ static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value)
#ifdef WITH_BULLET
/* only active bodies need damping update */
- if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_angular_damping(rbo->physics_object, value);
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_angular_damping(rbo->shared->physics_object, value);
}
#endif
}
@@ -706,8 +706,8 @@ static void rna_RigidBodyWorld_convex_sweep_test(
#ifdef WITH_BULLET
RigidBodyOb *rob = object->rigidbody_object;
- if (rbw->physics_world != NULL && rob->physics_object != NULL) {
- RB_world_convex_sweep_test(rbw->physics_world, rob->physics_object, ray_start, ray_end,
+ if (rbw->shared->physics_world != NULL && rob->shared->physics_object != NULL) {
+ RB_world_convex_sweep_test(rbw->shared->physics_world, rob->shared->physics_object, ray_start, ray_end,
r_location, r_hitpoint, r_normal, r_hit);
if (*r_hit == -2) {
BKE_report(reports, RPT_ERROR,
@@ -723,6 +723,13 @@ static void rna_RigidBodyWorld_convex_sweep_test(
#endif
}
+static PointerRNA rna_RigidBodyWorld_PointCache_get(PointerRNA *ptr)
+{
+ RigidBodyWorld *rbw = ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_PointCache, rbw->shared->pointcache);
+}
+
+
#else
static void rna_def_rigidbody_world(BlenderRNA *brna)
@@ -801,7 +808,7 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* cache */
prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
+ RNA_def_property_pointer_funcs(prop, "rna_RigidBodyWorld_PointCache_get", NULL, NULL, NULL);
RNA_def_property_struct_type(prop, "PointCache");
RNA_def_property_ui_text(prop, "Point Cache", "");
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 53b98928c31..874f3a8049d 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -762,14 +762,14 @@ static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values)
values[i] = nprop->defaultvalue;
}
}
-static void rna_BoolProperty_default_array_get(PointerRNA *ptr, int *values)
+static void rna_BoolProperty_default_array_get(PointerRNA *ptr, bool *values)
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
BoolPropertyRNA *nprop = (BoolPropertyRNA *)prop;
rna_idproperty_check(&prop, ptr);
if (nprop->defaultarray) {
- memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(int));
+ memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(bool));
}
else {
int i;
@@ -1222,6 +1222,7 @@ static bool rna_property_override_diff_propptr_validate_diffing(
/* Used for both Pointer and Collection properties. */
static int rna_property_override_diff_propptr(
+ Main *bmain,
PointerRNA *propptr_a, PointerRNA *propptr_b,
eRNACompareMode mode, const bool no_ownership, const bool no_prop_name,
IDOverrideStatic *override, const char *rna_path, const int flags, bool *r_override_changed)
@@ -1264,7 +1265,8 @@ static int rna_property_override_diff_propptr(
}
else {
eRNAOverrideMatchResult report_flags = 0;
- const bool match = RNA_struct_override_matches(propptr_a, propptr_b, rna_path, override, flags, &report_flags);
+ const bool match = RNA_struct_override_matches(
+ bmain, propptr_a, propptr_b, rna_path, override, flags, &report_flags);
if (r_override_changed && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) != 0) {
*r_override_changed = true;
}
@@ -1274,7 +1276,7 @@ static int rna_property_override_diff_propptr(
else {
/* We could also use is_diff_pointer, but then we potentially lose the gt/lt info -
* and don't think performances are critical here for now anyway... */
- return !RNA_struct_equals(propptr_a, propptr_b, mode);
+ return !RNA_struct_equals(bmain, propptr_a, propptr_b, mode);
}
}
@@ -1287,7 +1289,9 @@ static int rna_property_override_diff_propptr(
(is_array ? RNA_property_##_typename##_set_index((_ptr), (_prop), (_index), (_value)) : \
RNA_property_##_typename##_set((_ptr), (_prop), (_value)))
-int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
+int rna_property_override_diff_default(
+ Main *bmain,
+ PointerRNA *ptr_a, PointerRNA *ptr_b,
PropertyRNA *prop_a, PropertyRNA *prop_b,
const int len_a, const int len_b,
const int mode,
@@ -1304,16 +1308,16 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
case PROP_BOOLEAN:
{
if (len_a) {
- int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- int *array_a, *array_b;
+ bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ bool *array_a, *array_b;
- array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_a, "RNA equals") : array_stack_a;
- array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_b, "RNA equals") : array_stack_b;
+ array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_a, "RNA equals") : array_stack_a;
+ array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_b, "RNA equals") : array_stack_b;
RNA_property_boolean_get_array(ptr_a, prop_a, array_a);
RNA_property_boolean_get_array(ptr_b, prop_b, array_b);
- const int comp = memcmp(array_a, array_b, sizeof(int) * len_a);
+ const int comp = memcmp(array_a, array_b, sizeof(bool) * len_a);
if (do_create && comp != 0) {
/* XXX TODO this will have to be refined to handle array items */
@@ -1338,8 +1342,8 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
return comp;
}
else {
- const int value_a = RNA_property_boolean_get(ptr_a, prop_a);
- const int value_b = RNA_property_boolean_get(ptr_b, prop_b);
+ const bool value_a = RNA_property_boolean_get(ptr_a, prop_a);
+ const bool value_b = RNA_property_boolean_get(ptr_b, prop_b);
const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0;
if (do_create && comp != 0) {
@@ -1541,6 +1545,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
const bool no_prop_name = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_NO_PROP_NAME) != 0;
return rna_property_override_diff_propptr(
+ bmain,
&propptr_a, &propptr_b, mode, no_ownership, no_prop_name,
override, rna_path, flags, r_override_changed);
}
@@ -1617,14 +1622,15 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
#if 0
if (rna_path) {
- printf("Checking %s, %s [%d] vs %s [%d]; diffing: %d; insert: %d (could be used: %d, do_create: %d)\n",
+ printf("Checking %s, %s [%d] vs %s [%d]; is_id: %d, diffing: %d; "
+ "insert: %d (could be used: %d, do_create: %d)\n",
rna_path, propname_a ? propname_a : "", idx_a, propname_b ? propname_b : "", idx_b,
- is_valid_for_diffing, is_valid_for_insertion,
+ is_id, is_valid_for_diffing, is_valid_for_insertion,
(RNA_property_override_flag(prop_a) & PROPOVERRIDE_STATIC_INSERTION) != 0, do_create);
}
#endif
- if (!(is_valid_for_diffing || is_valid_for_insertion)) {
+ if (!(is_id || is_valid_for_diffing || is_valid_for_insertion)) {
/* Differences we cannot handle, we can break here
* (we do not support replacing ID pointers in collections e.g.). */
equals = false;
@@ -1635,7 +1641,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
/* There may be a propname defined in some cases, while no actual name set
* (e.g. happens with point cache), in that case too we want to fall back to index.
* Note that we do not need the RNA path for insertion operations. */
- if (is_valid_for_diffing) {
+ if (is_id || is_valid_for_diffing) {
if ((propname_a != NULL && propname_a[0] != '\0') &&
(propname_b != NULL && propname_b[0] != '\0'))
{
@@ -1686,12 +1692,13 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
NULL, prev_propname_a, -1, idx_a - 1, true, NULL, NULL);
// printf("%s: Adding insertion op override after '%s'/%d\n", rna_path, prev_propname_a, idx_a - 1);
}
- else if (is_valid_for_diffing) {
+ else if (is_id || is_valid_for_diffing) {
if (equals || do_create) {
const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
const int eq = rna_property_override_diff_propptr(
- &iter_a.ptr, &iter_b.ptr, mode, no_ownership, no_prop_name,
- override, extended_rna_path, flags, r_override_changed);
+ bmain,
+ &iter_a.ptr, &iter_b.ptr, mode, no_ownership, no_prop_name,
+ override, extended_rna_path, flags, r_override_changed);
equals = equals && eq;
}
}
@@ -1723,7 +1730,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
break;
}
- if (!(use_insertion && !is_valid_for_diffing)) {
+ if (!(use_insertion && !(is_id || is_valid_for_diffing))) {
break;
}
@@ -1762,6 +1769,7 @@ int rna_property_override_diff_default(PointerRNA *ptr_a, PointerRNA *ptr_b,
}
bool rna_property_override_store_default(
+ Main *UNUSED(bmain),
PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage,
const int len_local, const int len_reference, const int len_storage,
@@ -2005,9 +2013,11 @@ bool rna_property_override_store_default(
}
bool rna_property_override_apply_default(
+ Main *UNUSED(bmain),
PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *prop_storage,
const int len_dst, const int len_src, const int len_storage,
+ PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
IDOverrideStaticPropertyOperation *opop)
{
BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage));
@@ -2020,8 +2030,8 @@ bool rna_property_override_apply_default(
switch (RNA_property_type(prop_dst)) {
case PROP_BOOLEAN:
if (is_array && index == -1) {
- int array_stack_a[RNA_STACK_ARRAY];
- int *array_a;
+ bool array_stack_a[RNA_STACK_ARRAY];
+ bool *array_a;
array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : array_stack_a;
@@ -2039,7 +2049,7 @@ bool rna_property_override_apply_default(
if (array_a != array_stack_a) MEM_freeN(array_a);
}
else {
- const int value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index);
+ const bool value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index);
switch (override_op) {
case IDOVERRIDESTATIC_OP_REPLACE:
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index e89898863be..1ab7fdbecf0 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -413,6 +413,13 @@ const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
{0, NULL, 0, NULL, NULL}
};
+static const EnumPropertyItem rna_enum_manipulator_items[] = {
+ {SCE_MANIP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
+ {SCE_MANIP_ROTATE, "ROTATE", 0, "Rotate", ""},
+ {SCE_MANIP_SCALE, "SCALE", 0, "Scale", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
#ifndef RNA_RUNTIME
static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
/* interpolation */
@@ -539,7 +546,7 @@ static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
}
/* Grease pencil Drawing Brushes */
-static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, int setactive)
+static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, bool setactive)
{
bGPDbrush *brush = BKE_gpencil_brush_addnew(ts, name, setactive != 0);
@@ -640,6 +647,14 @@ static void rna_GPencilBrush_name_set(PointerRNA *ptr, const char *value)
/* ----------------- end of Grease pencil drawing brushes ------------*/
+static void rna_ToolSettings_manipulator_flag_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+{
+ ToolSettings *ts = scene->toolsettings;
+ if ((ts->manipulator_flag & (SCE_MANIP_TRANSLATE | SCE_MANIP_ROTATE | SCE_MANIP_SCALE)) == 0) {
+ ts->manipulator_flag |= SCE_MANIP_TRANSLATE;
+ }
+}
+
static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
{
ED_space_image_uv_sculpt_update(bmain, bmain->wm.first, scene);
@@ -710,7 +725,7 @@ void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
}
}
-static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
+static void rna_Scene_layer_set(PointerRNA *ptr, const bool *values)
{
Scene *scene = (Scene *)ptr->data;
@@ -1485,7 +1500,8 @@ void rna_ViewLayer_name_set(PointerRNA *ptr, const char *value)
{
Scene *scene = (Scene *)ptr->id.data;
ViewLayer *view_layer = (ViewLayer *)ptr->data;
- BKE_view_layer_rename(G.main, scene, view_layer, value);
+ BLI_assert(BKE_id_is_in_gobal_main(&scene->id));
+ BKE_view_layer_rename(G_MAIN, scene, view_layer, value);
}
static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
@@ -1532,7 +1548,7 @@ static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe
DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE);
}
-static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
+static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *value)
{
ToolSettings *ts = (ToolSettings *)ptr->data;
int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
@@ -1541,7 +1557,7 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value
ts->selectmode = flag;
/* Update select mode in all the workspaces in mesh edit mode. */
- wmWindowManager *wm = G.main->wm.first;
+ wmWindowManager *wm = G_MAIN->wm.first;
for (wmWindow *win = wm->windows.first; win; win = win->next) {
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
@@ -2677,6 +2693,13 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+ prop = RNA_def_property(srna, "use_manipulator_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "manipulator_flag");
+ RNA_def_property_enum_items(prop, rna_enum_manipulator_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Manipulator", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ToolSettings_manipulator_flag_update");
+
/* Grease Pencil */
prop = RNA_def_property(srna, "use_gpencil_continuous_drawing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 003e2561a22..5a8c9646b0b 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -145,7 +145,7 @@ static void rna_Scene_update_tagged(Scene *scene, Main *bmain)
}
static void rna_SceneRender_get_frame_path(
- RenderData *rd, Main *bmain, int frame, int preview, const char *view, char *name)
+ RenderData *rd, Main *bmain, int frame, bool preview, const char *view, char *name)
{
const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view);
@@ -166,7 +166,7 @@ static void rna_SceneRender_get_frame_path(
static void rna_Scene_ray_cast(
Scene *scene, Main *bmain, ViewLayer *view_layer,
float origin[3], float direction[3], float ray_dist,
- int *r_success, float r_location[3], float r_normal[3], int *r_index,
+ bool *r_success, float r_location[3], float r_normal[3], int *r_index,
Object **r_ob, float r_obmat[16])
{
normalize_v3(direction);
@@ -214,22 +214,22 @@ static void rna_Scene_alembic_export(
int geom_samples,
float shutter_open,
float shutter_close,
- int selected_only,
- int uvs,
- int normals,
- int vcolors,
- int apply_subdiv,
- int flatten_hierarchy,
- int visible_layers_only,
- int renderable_only,
- int face_sets,
- int use_subdiv_schema,
- int export_hair,
- int export_particles,
+ bool selected_only,
+ bool uvs,
+ bool normals,
+ bool vcolors,
+ bool apply_subdiv,
+ bool flatten_hierarchy,
+ bool visible_layers_only,
+ bool renderable_only,
+ bool face_sets,
+ bool use_subdiv_schema,
+ bool export_hair,
+ bool export_particles,
int compression_type,
- int packuv,
+ bool packuv,
float scale,
- int triangulate,
+ bool triangulate,
int quad_method,
int ngon_method)
{
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index e30b75b27bd..d41d04a4f11 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -82,7 +82,7 @@ static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
static int rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr))
{
/* can be NULL on file load, T42619 */
- wmWindowManager *wm = G.main->wm.first;
+ wmWindowManager *wm = G_MAIN->wm.first;
return wm ? (ED_screen_animation_playing(wm) != NULL) : 0;
}
@@ -95,7 +95,7 @@ static int rna_region_alignment_get(PointerRNA *ptr)
static void rna_Screen_layout_name_get(PointerRNA *ptr, char *value)
{
const bScreen *screen = ptr->data;
- const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G.main, screen, NULL);
+ const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, NULL);
if (layout) {
const char *name = BKE_workspace_layout_name_get(layout);
@@ -109,7 +109,7 @@ static void rna_Screen_layout_name_get(PointerRNA *ptr, char *value)
static int rna_Screen_layout_name_length(PointerRNA *ptr)
{
const bScreen *screen = ptr->data;
- const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G.main, screen, NULL);
+ const WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, NULL);
if (layout) {
const char *name = BKE_workspace_layout_name_get(layout);
@@ -123,7 +123,7 @@ static void rna_Screen_layout_name_set(PointerRNA *ptr, const char *value)
{
bScreen *screen = ptr->data;
WorkSpace *workspace;
- WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G.main, screen, &workspace);
+ WorkSpaceLayout *layout = BKE_workspace_layout_find_global(G_MAIN, screen, &workspace);
if (layout) {
BKE_workspace_layout_name_set(workspace, layout, value);
@@ -289,7 +289,7 @@ static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float re
UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]);
}
-static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, int clip, int result[2])
+static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, bool clip, int result[2])
{
if (clip)
UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]);
@@ -385,8 +385,8 @@ static void rna_def_area(BlenderRNA *brna)
RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
- func = RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
- RNA_def_function_ui_description(func, "Set the header text");
+ func = RNA_def_function(srna, "header_text_set", "ED_area_status_text");
+ RNA_def_function_ui_description(func, "Set the header status text");
RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
}
@@ -586,4 +586,3 @@ void RNA_def_screen(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index b89b2185a38..e68c4c284c6 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -104,7 +104,6 @@ const EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
#include "MEM_guardedalloc.h"
#include "BKE_context.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_particle.h"
#include "BKE_pbvh.h"
#include "BKE_pointcache.h"
@@ -248,7 +247,7 @@ static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr))
return BLI_strdup("tool_settings.particle_edit");
}
-static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
+static bool rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
{
Scene *scene = (Scene *)ptr->id.data;
ToolSettings *ts = scene->toolsettings;
@@ -425,7 +424,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
}
}
-static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint)
+static bool rna_ImaPaint_detect_data(ImagePaintSettings *imapaint)
{
return imapaint->missing_data == 0;
}
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 0dbec5b5355..6417e48efdb 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1046,7 +1046,7 @@ static void rna_SequenceModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene
BKE_sequence_invalidate_cache_for_modifier(scene, seq);
}
-static int rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value)
+static bool rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value)
{
Scene *scene = (Scene *) ptr->id.data;
Editing *ed = BKE_sequencer_editing_get(scene, false);
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index da8b19a1ff6..509b6da2048 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -61,7 +61,7 @@
#include "WM_api.h"
-static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, int do_data)
+static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, bool do_data)
{
if (do_data) {
BKE_sequencer_update_changed_seq_and_deps((Scene *)id, self, true, true);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 34d393c7b62..dfad4c07cb3 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -79,9 +79,9 @@ const EnumPropertyItem rna_enum_space_type_items[] = {
/* Animation */
{0, "", ICON_NONE, "Animation", ""},
//{SPACE_ACTION, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls (NOTE: Switch to 'Timeline' mode)"}, /* XXX */
- {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", "Edit drivers and keyframe interpolation"},
{SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", "Adjust timing of keyframes"},
- {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "NLA Editor", "Combine and layer Actions"},
+ {SPACE_IPO, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", "Edit drivers and keyframe interpolation"},
+ {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", "Combine and layer Actions"},
/* Scripting */
{0, "", ICON_NONE, "Scripting", ""},
@@ -106,6 +106,65 @@ const EnumPropertyItem rna_enum_space_type_items[] = {
{0, NULL, 0, NULL, NULL}
};
+const EnumPropertyItem rna_enum_space_graph_mode_items[] = {
+ {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "Graph Editor",
+ "Edit animation/keyframes displayed as 2D curves"},
+ {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
+ {0, NULL, 0, NULL, NULL}
+};
+
+#define SACT_ITEM_DOPESHEET \
+ {SACTCONT_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dope Sheet", "Edit all keyframes in scene"}
+#define SACT_ITEM_TIMELINE \
+ {SACTCONT_TIMELINE, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls"}
+#define SACT_ITEM_ACTION \
+ {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Edit keyframes in active object's Object-level action"}
+#define SACT_ITEM_SHAPEKEY \
+ {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "Shape Key Editor", "Edit keyframes in active object's Shape Keys action"}
+#define SACT_ITEM_GPENCIL \
+ {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Edit timings for all Grease Pencil sketches in file"}
+#define SACT_ITEM_MASK \
+ {SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Edit timings for Mask Editor splines"}
+#define SACT_ITEM_CACHEFILE \
+ {SACTCONT_CACHEFILE, "CACHEFILE", ICON_FILE, "Cache File", "Edit timings for Cache File data-blocks"}
+
+#ifndef RNA_RUNTIME
+/* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */
+static EnumPropertyItem rna_enum_space_action_mode_all_items[] = {
+ SACT_ITEM_DOPESHEET,
+ SACT_ITEM_TIMELINE,
+ SACT_ITEM_ACTION,
+ SACT_ITEM_SHAPEKEY,
+ SACT_ITEM_GPENCIL,
+ SACT_ITEM_MASK,
+ SACT_ITEM_CACHEFILE,
+ {0, NULL, 0, NULL, NULL}
+};
+static EnumPropertyItem rna_enum_space_action_ui_mode_items[] = {
+ SACT_ITEM_DOPESHEET,
+ /* SACT_ITEM_TIMELINE, */
+ SACT_ITEM_ACTION,
+ SACT_ITEM_SHAPEKEY,
+ SACT_ITEM_GPENCIL,
+ SACT_ITEM_MASK,
+ SACT_ITEM_CACHEFILE,
+ {0, NULL, 0, NULL, NULL}
+};
+#endif
+/* expose as ui_mode */
+const EnumPropertyItem rna_enum_space_action_mode_items[] = {
+ SACT_ITEM_DOPESHEET,
+ SACT_ITEM_TIMELINE,
+ {0, NULL, 0, NULL, NULL}
+};
+
+#undef SACT_ITEM_DOPESHEET
+#undef SACT_ITEM_TIMELINE
+#undef SACT_ITEM_ACTION
+#undef SACT_ITEM_SHAPEKEY
+#undef SACT_ITEM_GPENCIL
+#undef SACT_ITEM_MASK
+#undef SACT_ITEM_CACHEFILE
const EnumPropertyItem rna_enum_space_image_mode_items[] = {
{SI_MODE_VIEW, "VIEW", ICON_FILE_IMAGE, "View", "View the image and UV edit in mesh editmode"},
@@ -178,11 +237,9 @@ static const EnumPropertyItem autosnap_items[] = {
#endif
const EnumPropertyItem rna_enum_shading_type_items[] = {
- {OB_WIRE, "WIREFRAME", ICON_WIRE, "Wireframe", "Display the object as wire edges"},
- {OB_SOLID, "SOLID", ICON_SOLID, "Single Color", "Display the object or material in a single color"},
- {OB_TEXTURE, "TEXTURED", ICON_POTATO, "Texture", "Display the object solid, with a texture"},
- {OB_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Display objects solid, with GLSL material"},
- {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"},
+ {OB_SOLID, "SOLID", ICON_SOLID, "Solid", "Display in solid mode"},
+ {OB_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "LookDev", "Display in LookDev mode"},
+ {OB_RENDER, "RENDERED", ICON_SMOOTH, "Rendered", "Display render preview"},
{0, NULL, 0, NULL, NULL}
};
@@ -193,6 +250,15 @@ const EnumPropertyItem rna_enum_viewport_lighting_items[] = {
{0, NULL, 0, NULL, NULL}
};
+static const EnumPropertyItem rna_enum_shading_color_type_items[] = {
+ {V3D_SHADING_SINGLE_COLOR, "SINGLE", 0, "Single", "Show scene in a single color"},
+ {V3D_SHADING_MATERIAL_COLOR, "MATERIAL", 0, "Material", "Show material color"},
+ {V3D_SHADING_RANDOM_COLOR, "RANDOM", 0, "Random", "Show random object color"},
+ {V3D_SHADING_TEXTURE_COLOR, "TEXTURE", 0, "Texture", "Show texture"},
+ {0, NULL, 0, NULL, NULL}
+};
+
+
static const EnumPropertyItem rna_enum_studio_light_items[] = {
{0, "DEFAULT", 0, "Default", ""},
{0, NULL, 0, NULL, NULL}
@@ -268,6 +334,7 @@ const EnumPropertyItem rna_enum_file_sort_items[] = {
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "ED_anim_api.h"
#include "ED_buttons.h"
#include "ED_fileselect.h"
#include "ED_image.h"
@@ -428,7 +495,7 @@ static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int valu
v3d->scenelock = value;
if (value) {
- Scene *scene = ED_screen_scene_find(sc, G.main->wm.first);
+ Scene *scene = ED_screen_scene_find(sc, G_MAIN->wm.first);
int bit;
v3d->lay = scene->lay;
@@ -450,7 +517,7 @@ static View3DCursor *rna_View3D_Cursor_get_from_scene_or_localview(PointerRNA *p
{
View3D *v3d = (View3D *)(ptr->data);
bScreen *screen = ptr->id.data;
- Scene *scene = ED_screen_scene_find(screen, G.main->wm.first);
+ Scene *scene = ED_screen_scene_find(screen, G_MAIN->wm.first);
return ED_view3d_cursor3d_get(scene, v3d);
}
@@ -482,12 +549,12 @@ static float rna_View3DOverlay_GridScaleUnit_get(PointerRNA *ptr)
{
View3D *v3d = (View3D *)(ptr->data);
bScreen *screen = ptr->id.data;
- Scene *scene = ED_screen_scene_find(screen, G.main->wm.first);
+ Scene *scene = ED_screen_scene_find(screen, G_MAIN->wm.first);
return ED_view3d_grid_scale(scene, v3d, NULL);
}
-static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
+static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const bool *values)
{
View3D *v3d = (View3D *)(ptr->data);
@@ -613,7 +680,7 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value
static int rna_3DViewShading_type_get(PointerRNA *ptr)
{
bScreen *screen = ptr->id.data;
- Scene *scene = WM_windows_scene_get_from_screen(G.main->wm.first, screen);
+ Scene *scene = WM_windows_scene_get_from_screen(G_MAIN->wm.first, screen);
RenderEngineType *type = RE_engines_find(scene->r.engine);
View3D *v3d = (View3D *)ptr->data;
@@ -632,9 +699,6 @@ static void rna_3DViewShading_type_set(PointerRNA *ptr, int value)
if (value != v3d->drawtype && value == OB_RENDER) {
v3d->prev_drawtype = v3d->drawtype;
}
- if (value == OB_TEXTURE && v3d->shading.light == V3D_LIGHTING_MATCAP) {
- v3d->shading.light = V3D_LIGHTING_STUDIO;
- }
v3d->drawtype = value;
}
@@ -650,7 +714,6 @@ static const EnumPropertyItem *rna_3DViewShading_type_itemf(
int totitem = 0;
RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_SOLID);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_TEXTURE);
if (BKE_scene_uses_blender_eevee(scene)) {
RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_MATERIAL);
@@ -693,10 +756,13 @@ static int rna_View3DShading_light_get(PointerRNA *ptr)
static void rna_View3DShading_light_set(PointerRNA *ptr, int value)
{
View3D *v3d = (View3D *)ptr->data;
+ if (value == V3D_LIGHTING_MATCAP && v3d->shading.color_type == V3D_SHADING_TEXTURE_COLOR) {
+ v3d->shading.color_type = V3D_SHADING_MATERIAL_COLOR;
+ }
v3d->shading.light = value;
}
-static const EnumPropertyItem *rna_View3DShading_light_itemf(
+static const EnumPropertyItem *rna_View3DShading_color_type_itemf(
bContext *UNUSED(C), PointerRNA *ptr,
PropertyRNA *UNUSED(prop), bool *r_free)
{
@@ -705,14 +771,15 @@ static const EnumPropertyItem *rna_View3DShading_light_itemf(
int totitem = 0;
EnumPropertyItem *item = NULL;
- if (v3d->drawtype == OB_SOLID || v3d->drawtype == OB_TEXTURE) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_viewport_lighting_items, V3D_LIGHTING_FLAT);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_viewport_lighting_items, V3D_LIGHTING_STUDIO);
- }
-
if (v3d->drawtype == OB_SOLID) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_viewport_lighting_items, V3D_LIGHTING_MATCAP);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_SINGLE_COLOR);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_MATERIAL_COLOR);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_RANDOM_COLOR);
+ if (v3d->shading.light != V3D_LIGHTING_MATCAP) {
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_TEXTURE_COLOR);
+ }
}
+
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
@@ -900,7 +967,7 @@ static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
{
SpaceImage *sima = (SpaceImage *)(ptr->data);
bScreen *sc = (bScreen *)ptr->id.data;
- wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
+ wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
return ED_space_image_show_uvedit(sima, obedit);
@@ -910,7 +977,7 @@ static int rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr)
{
SpaceImage *sima = (SpaceImage *)(ptr->data);
bScreen *sc = (bScreen *)ptr->id.data;
- wmWindow *win = ED_screen_window_find(sc, G.main->wm.first);
+ wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
return ED_space_image_check_show_maskedit(sima, view_layer);
}
@@ -920,10 +987,12 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
SpaceImage *sima = (SpaceImage *)(ptr->data);
bScreen *sc = (bScreen *)ptr->id.data;
wmWindow *win;
- Scene *scene = ED_screen_scene_find_with_window(sc, G.main->wm.first, &win);
+ Scene *scene = ED_screen_scene_find_with_window(sc, G_MAIN->wm.first, &win);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
- ED_space_image_set(G.main, sima, scene, obedit, (Image *)value.data);
+
+ BLI_assert(BKE_id_is_in_gobal_main(value.data));
+ ED_space_image_set(G_MAIN, sima, scene, obedit, (Image *)value.data);
}
static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value)
@@ -1440,9 +1509,10 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
saction->action = NULL;
}
- /* Collapse summary channel and hide channel list for timeline */
+ /* Collapse (and show) summary channel and hide channel list for timeline */
if (saction->mode == SACTCONT_TIMELINE) {
saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
+ saction->ads.filterflag |= ADS_FILTER_SUMMARY;
}
if (sa && sa->spacedata.first == saction) {
@@ -1460,13 +1530,25 @@ static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
/* recalculate extents of channel list */
saction->flag |= SACTION_TEMP_NEEDCHANSYNC;
+
+ /* store current mode as "old mode", so that returning from other editors doesn't always reset to "Action Editor" */
+ if (saction->mode != SACTCONT_TIMELINE) {
+ saction->mode_prev = saction->mode;
+ }
}
/* Space Graph Editor */
-static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *ptr)
{
ScrArea *sa = rna_area_from_space(ptr);
+ SpaceIpo *sipo = (SpaceIpo *)ptr->data;
+
+ /* for "Drivers" mode, enable all the necessary bits and pieces */
+ if (sipo->mode == SIPO_MODE_DRIVERS) {
+ ED_drivers_editor_init(C, sa);
+ ED_area_tag_redraw(sa);
+ }
/* after changing view mode, must force recalculation of F-Curve colors
* which can only be achieved using refresh as opposed to redraw
@@ -1500,7 +1582,7 @@ static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA
ED_node_tree_start(snode, (bNodeTree *)value.data, NULL, NULL);
}
-static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
+static bool rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
{
SpaceNode *snode = (SpaceNode *)ptr->data;
bNodeTree *ntree = (bNodeTree *)value.data;
@@ -1524,7 +1606,7 @@ static void rna_SpaceNodeEditor_tree_type_set(PointerRNA *ptr, int value)
SpaceNode *snode = (SpaceNode *)ptr->data;
ED_node_set_tree_type(snode, rna_node_tree_type_from_enum(value));
}
-static int rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type)
+static bool rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type)
{
bContext *C = (bContext *)Cv;
if (type->poll)
@@ -2155,12 +2237,12 @@ static void rna_def_space_outliner(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem display_mode_items[] = {
- {SO_SCENES, "SCENES", 0, "Scenes", "Display scenes and their view layers, collections and objects"},
- {SO_VIEW_LAYER, "VIEW_LAYER", 0, "View Layer", "Display collections and objects in the view layer"},
- {SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence data-blocks"},
- {SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"},
- {SO_DATA_API, "DATA_API", 0, "Data API", "Display low level Blender data and its properties"},
- {SO_ID_ORPHANS, "ORPHAN_DATA", 0, "Orphan Data",
+ {SO_SCENES, "SCENES", ICON_SCENE_DATA, "Scenes", "Display scenes and their view layers, collections and objects"},
+ {SO_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "View Layer", "Display collections and objects in the view layer"},
+ {SO_SEQUENCE, "SEQUENCE", ICON_SEQUENCE, "Sequence", "Display sequence data-blocks"},
+ {SO_LIBRARIES, "LIBRARIES", ICON_FILE_BLEND, "Blender File", "Display data of current file and linked libraries"},
+ {SO_DATA_API, "DATA_API", ICON_RNA, "Data API", "Display low level Blender data and its properties"},
+ {SO_ID_ORPHANS, "ORPHAN_DATA", ICON_EXTERNAL_DATA, "Orphan Data",
"Display data-blocks which are unused and/or will be lost when the file is reloaded"},
{0, NULL, 0, NULL, NULL}
};
@@ -2213,12 +2295,6 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
/* Filters. */
- prop = RNA_def_property(srna, "use_filter_search", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_SEARCH);
- RNA_def_property_ui_text(prop, "Search Name", "Filter searched elements");
- RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
prop = RNA_def_property(srna, "use_filter_object", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OBJECT);
RNA_def_property_ui_text(prop, "Filter Objects", "Show objects");
@@ -2294,13 +2370,6 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static const EnumPropertyItem color_type_items[] = {
- {V3D_SHADING_SINGLE_COLOR, "SINGLE", 0, "Single", "Show scene in a single color"},
- {V3D_SHADING_MATERIAL_COLOR, "MATERIAL", 0, "Material", "Show material color"},
- {V3D_SHADING_RANDOM_COLOR, "RANDOM", 0, "Random", "Show random object color"},
- {0, NULL, 0, NULL, NULL}
- };
-
srna = RNA_def_struct(brna, "View3DShading", NULL);
RNA_def_struct_sdna(srna, "View3D");
RNA_def_struct_nested(brna, srna, "SpaceView3D");
@@ -2318,7 +2387,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
prop = RNA_def_property(srna, "light", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shading.light");
RNA_def_property_enum_items(prop, rna_enum_viewport_lighting_items);
- RNA_def_property_enum_funcs(prop, "rna_View3DShading_light_get", "rna_View3DShading_light_set", "rna_View3DShading_light_itemf");
+ RNA_def_property_enum_funcs(prop, "rna_View3DShading_light_get", "rna_View3DShading_light_set", NULL);
RNA_def_property_ui_text(prop, "Lighting", "Lighting Method for Solid/Texture Viewport Shading");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
@@ -2367,7 +2436,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
RNA_define_verify_sdna(1);
- prop = RNA_def_property(srna, "studiolight_rot_z", PROP_FLOAT, PROP_ANGLE);
+ prop = RNA_def_property(srna, "studiolight_rotate_z", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "shading.studiolight_rot_z");
RNA_def_property_float_default(prop, 0.0);
RNA_def_property_ui_text(prop, "Studiolight Rotation", "Rotation of the studiolight around the Z-Axis");
@@ -2377,7 +2446,8 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna)
prop = RNA_def_property(srna, "color_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shading.color_type");
- RNA_def_property_enum_items(prop, color_type_items);
+ RNA_def_property_enum_items(prop, rna_enum_shading_color_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_View3DShading_color_type_itemf");
RNA_def_property_ui_text(prop, "Color", "Color Type");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
@@ -2642,6 +2712,27 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "overlay.arm_flag", V3D_OVERLAY_ARM_TRANSP_BONES);
RNA_def_property_ui_text(prop, "Transparent Bones", "Display bones as transparent");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "texture_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.texture_paint_mode_opacity");
+ RNA_def_property_float_default(prop, 0.8f);
+ RNA_def_property_ui_text(prop, "Texture Opacity", "Opacity of the texture paint mode overlay");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "vertex_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.vertex_paint_mode_opacity");
+ RNA_def_property_float_default(prop, 0.8f);
+ RNA_def_property_ui_text(prop, "Vertex Paint Opacity", "Opacity of the vertex paint mode overlay");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "weight_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.weight_paint_mode_opacity");
+ RNA_def_property_float_default(prop, 0.8f);
+ RNA_def_property_ui_text(prop, "Weight Paint Opacity", "Opacity of the weight paint mode overlay");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
static void rna_def_space_view3d(BlenderRNA *brna)
@@ -2779,11 +2870,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "show_mode_shade_override", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_MODE_SHADE_OVERRIDE);
- RNA_def_property_ui_text(prop, "Full Shading", "Use full shading for mode drawing (to view final result)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_OCCLUDE_WIRE);
RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
@@ -3536,19 +3622,6 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- /* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */
- static EnumPropertyItem mode_items[] = {
- {SACTCONT_TIMELINE, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls"},
- {SACTCONT_DOPESHEET, "DOPESHEET", ICON_OOPS, "Dope Sheet", "Edit all keyframes in scene"},
- {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Edit keyframes in active object's Object-level action"},
- {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "Shape Key Editor", "Edit keyframes in active object's Shape Keys action"},
- {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Edit timings for all Grease Pencil sketches in file"},
- {SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Edit timings for Mask Editor splines"},
- {SACTCONT_CACHEFILE, "CACHEFILE", ICON_FILE, "Cache File", "Edit timings for Cache File data-blocks"},
- {0, NULL, 0, NULL, NULL}
- };
-
-
srna = RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space");
RNA_def_struct_sdna(srna, "SpaceAction");
RNA_def_struct_ui_text(srna, "Space Dope Sheet Editor", "Dope Sheet space data");
@@ -3562,10 +3635,17 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_SpaceDopeSheetEditor_action_update");
- /* mode */
+ /* mode (hidden in the UI, see 'ui_mode') */
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_enum_items(prop, rna_enum_space_action_mode_all_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
+
+ prop = RNA_def_property(srna, "ui_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_space_action_ui_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
@@ -3672,13 +3752,6 @@ static void rna_def_space_graph(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static const EnumPropertyItem mode_items[] = {
- {SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve",
- "Edit animation/keyframes displayed as 2D curves"},
- {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
- {0, NULL, 0, NULL, NULL}
- };
-
/* this is basically the same as the one for the 3D-View, but with some entries omitted */
static const EnumPropertyItem gpivot_items[] = {
{V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
@@ -3697,8 +3770,9 @@ static void rna_def_space_graph(BlenderRNA *brna)
/* mode */
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_enum_items(prop, rna_enum_space_graph_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, "rna_SpaceGraphEditor_display_mode_update");
/* display */
diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c
index f37b75b3db2..41f22929143 100644
--- a/source/blender/makesrna/intern/rna_speaker.c
+++ b/source/blender/makesrna/intern/rna_speaker.c
@@ -163,4 +163,3 @@ void RNA_def_speaker(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index ccc118edfb6..4831f36d20a 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -665,7 +665,7 @@ static void rna_trackingObject_remove(MovieTracking *tracking, ReportList *repor
WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
}
-static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr, int exact)
+static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr, bool exact)
{
if (exact)
return BKE_tracking_marker_get_exact(track, framenr);
@@ -707,7 +707,7 @@ static void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int fram
}
static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(MovieTrackingPlaneTrack *plane_track,
- int framenr, int exact)
+ int framenr, bool exact)
{
if (exact)
return BKE_tracking_plane_marker_get_exact(plane_track, framenr);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 70aa4709d8c..bb7af5f327d 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -105,7 +105,7 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re
/* Panel */
-static int panel_poll(const bContext *C, PanelType *pt)
+static bool panel_poll(const bContext *C, PanelType *pt)
{
extern FunctionRNA rna_Panel_poll_func;
@@ -123,7 +123,7 @@ static int panel_poll(const bContext *C, PanelType *pt)
pt->ext.call((bContext *)C, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(int *)ret;
+ visible = *(bool *)ret;
RNA_parameter_list_free(&list);
@@ -690,7 +690,7 @@ static StructRNA *rna_Header_refine(PointerRNA *htr)
/* Menu */
-static int menu_poll(const bContext *C, MenuType *pt)
+static bool menu_poll(const bContext *C, MenuType *pt)
{
extern FunctionRNA rna_Menu_poll_func;
@@ -698,7 +698,7 @@ static int menu_poll(const bContext *C, MenuType *pt)
ParameterList list;
FunctionRNA *func;
void *ret;
- int visible;
+ bool visible;
RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
func = &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
@@ -708,7 +708,7 @@ static int menu_poll(const bContext *C, MenuType *pt)
pt->ext.call((bContext *)C, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(int *)ret;
+ visible = *(bool *)ret;
RNA_parameter_list_free(&list);
@@ -1437,4 +1437,3 @@ void RNA_def_ui(BlenderRNA *brna)
}
#endif /* RNA_RUNTIME */
-
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 9377ef8a925..be8bce61910 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -61,7 +61,7 @@ const EnumPropertyItem rna_enum_icon_items[] = {
#ifdef RNA_RUNTIME
const char *rna_translate_ui_text(
- const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, int translate)
+ const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate)
{
/* Also return text if UI labels translation is disabled. */
if (!text || !text[0] || !translate || !BLT_translate_iface()) {
@@ -97,8 +97,8 @@ const char *rna_translate_ui_text(
static void rna_uiItemR(
uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,
- int translate, int icon, int expand, int slider, int toggle, int icon_only, int event,
- int full_event, int emboss, int index, int icon_value)
+ bool translate, int icon, bool expand, bool slider, bool toggle, bool icon_only, bool event,
+ bool full_event, bool emboss, int index, int icon_value)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
int flag = 0;
@@ -128,7 +128,7 @@ static void rna_uiItemR(
static void rna_uiItemMenuEnumR(
uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
- const char *text_ctxt, int translate, int icon)
+ const char *text_ctxt, bool translate, int icon)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -144,7 +144,7 @@ static void rna_uiItemMenuEnumR(
static void rna_uiItemEnumR_string(
uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value,
- const char *name, const char *text_ctxt, int translate, int icon)
+ const char *name, const char *text_ctxt, bool translate, int icon)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -163,7 +163,7 @@ static void rna_uiItemEnumR_string(
static void rna_uiItemPointerR(
uiLayout *layout, struct PointerRNA *ptr, const char *propname,
struct PointerRNA *searchptr, const char *searchpropname,
- const char *name, const char *text_ctxt, int translate, int icon)
+ const char *name, const char *text_ctxt, bool translate, int icon)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -181,7 +181,7 @@ static void rna_uiItemPointerR(
static PointerRNA rna_uiItemO(
uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
- int translate, int icon, int emboss, int depress, int icon_value)
+ bool translate, int icon, bool emboss, bool depress, int icon_value)
{
wmOperatorType *ot;
@@ -207,7 +207,7 @@ static PointerRNA rna_uiItemO(
static PointerRNA rna_uiItemOMenuHold(
uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
- int translate, int icon, int emboss, int depress, int icon_value,
+ bool translate, int icon, bool emboss, bool depress, int icon_value,
const char *menu)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
@@ -232,7 +232,7 @@ static PointerRNA rna_uiItemOMenuHold(
static void rna_uiItemMenuEnumO(
uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name,
- const char *text_ctxt, int translate, int icon)
+ const char *text_ctxt, bool translate, int icon)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
@@ -248,7 +248,7 @@ static void rna_uiItemMenuEnumO(
}
static void rna_uiItemL(
- uiLayout *layout, const char *name, const char *text_ctxt, int translate,
+ uiLayout *layout, const char *name, const char *text_ctxt, bool translate,
int icon, int icon_value)
{
/* Get translated name (label). */
@@ -262,8 +262,8 @@ static void rna_uiItemL(
}
static void rna_uiItemM(
- uiLayout *layout, bContext *C, const char *menuname, const char *name, const char *text_ctxt,
- int translate, int icon, int icon_value)
+ uiLayout *layout, const char *menuname, const char *name, const char *text_ctxt,
+ bool translate, int icon, int icon_value)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
@@ -272,14 +272,14 @@ static void rna_uiItemM(
icon = icon_value;
}
- uiItemM(layout, C, menuname, name, icon);
+ uiItemM(layout, menuname, name, icon);
}
static void rna_uiItemPopoverPanel(
uiLayout *layout, bContext *C,
int space_type, int region_type, const char *panel_type,
const char *name, const char *text_ctxt,
- int translate, int icon, int icon_value)
+ bool translate, int icon, int icon_value)
{
/* Get translated name (label). */
name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
@@ -300,7 +300,7 @@ static void rna_uiItemPopoverPanelFromGroup(
static void rna_uiTemplateAnyID(
uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
- const char *name, const char *text_ctxt, int translate)
+ const char *name, const char *text_ctxt, bool translate)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -318,7 +318,7 @@ static void rna_uiTemplateAnyID(
static void rna_uiTemplatePathBuilder(
uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr,
- const char *name, const char *text_ctxt, int translate)
+ const char *name, const char *text_ctxt, bool translate)
{
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
@@ -520,7 +520,7 @@ void RNA_api_ui_layout(StructRNA *srna)
func = RNA_def_function(srna, "grid_flow", "uiLayoutGridFlow");
RNA_def_boolean(func, "row_major", false, "", "Fill row by row, instead of column by column");
- RNA_def_int(func, "num_columns", 0, INT_MIN, INT_MAX, "",
+ RNA_def_int(func, "columns", 0, INT_MIN, INT_MAX, "",
"Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are "
"automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. "
"columns for row major layout, and 2, 4, 6 etc. rows for column major layout)",
@@ -709,7 +709,6 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
func = RNA_def_function(srna, "menu", "rna_uiItemM");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
api_ui_item_common(func);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
@@ -1021,6 +1020,9 @@ void RNA_api_ui_layout(StructRNA *srna)
func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ func = RNA_def_function(srna, "template_input_status", "uiTemplateInputStatus");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 2dbdb1bbb1c..347283cd529 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -36,9 +36,9 @@
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
+#include "BLI_math_vector.h"
#include "BKE_appdir.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_sound.h"
#include "BKE_addon.h"
#include "BKE_studiolight.h"
@@ -86,15 +86,25 @@ static const EnumPropertyItem rna_enum_language_default_items[] = {
};
#endif
+static const EnumPropertyItem rna_enum_studio_light_orientation_items[] = {
+ {STUDIOLIGHT_ORIENTATION_CAMERA, "CAMERA", 0, "Camera", ""},
+ {STUDIOLIGHT_ORIENTATION_WORLD, "WORLD", 0, "World", ""},
+ {STUDIOLIGHT_ORIENTATION_VIEWNORMAL, "MATCAP", 0, "MatCap", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+
#ifdef RNA_RUNTIME
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "BKE_blender.h"
+#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
-#include "BKE_main.h"
#include "BKE_idprop.h"
+#include "BKE_main.h"
+#include "BKE_mesh_runtime.h"
#include "BKE_pbvh.h"
#include "BKE_paint.h"
@@ -207,25 +217,25 @@ static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- GPU_set_anisotropic(U.anisotropic_filter);
+ GPU_set_anisotropic(bmain, U.anisotropic_filter);
rna_userdef_update(bmain, scene, ptr);
}
static void rna_userdef_gl_gpu_mipmaps(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
+ GPU_set_gpu_mipmapping(bmain, U.use_gpu_mipmap);
rna_userdef_update(bmain, scene, ptr);
}
static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- GPU_free_images();
+ GPU_free_images(bmain);
rna_userdef_update(bmain, scene, ptr);
}
static void rna_userdef_gl_use_16bit_textures(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- GPU_free_images();
+ GPU_free_images(bmain);
rna_userdef_update(bmain, scene, ptr);
}
@@ -356,7 +366,7 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN
Object *ob;
bTheme *btheme = UI_GetTheme();
- vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, btheme->tv3d.vertex_unreferenced);
+ BKE_mesh_runtime_color_band_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL, btheme->tv3d.vertex_unreferenced);
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (ob->mode & OB_MODE_WEIGHT_PAINT)
@@ -661,11 +671,21 @@ static void rna_UserDef_studiolight_begin(CollectionPropertyIterator *iter, Poin
rna_iterator_listbase_begin(iter, BKE_studiolight_listbase(), NULL);
}
-static void rna_UserDef_studiolight_refresh(UserDef *UNUSED(userdef))
+static void rna_StudioLights_refresh(UserDef *UNUSED(userdef))
{
BKE_studiolight_refresh();
}
+static void rna_StudioLights_remove(UserDef *UNUSED(userdef), StudioLight *studio_light)
+{
+ BKE_studiolight_remove(studio_light);
+}
+
+static StudioLight *rna_StudioLights_new(UserDef *UNUSED(userdef), const char *path, int orientation)
+{
+ return BKE_studiolight_new(path, orientation);
+}
+
/* StudioLight.name */
static void rna_UserDef_studiolight_name_get(PointerRNA *ptr, char *value)
{
@@ -692,6 +712,44 @@ static int rna_UserDef_studiolight_path_length(PointerRNA *ptr)
return strlen(sl->path);
}
+/* StudioLight.path_irr_cache */
+static void rna_UserDef_studiolight_path_irr_cache_get(PointerRNA *ptr, char *value)
+{
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_irr_cache) {
+ BLI_strncpy(value, sl->path_irr_cache, FILE_MAX);
+ }
+ value[0] = 0x00;
+}
+
+static int rna_UserDef_studiolight_path_irr_cache_length(PointerRNA *ptr)
+{
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_irr_cache) {
+ return strlen(sl->path_irr_cache);
+ }
+ return 0;
+}
+
+/* StudioLight.path_sh_cache */
+static void rna_UserDef_studiolight_path_sh_cache_get(PointerRNA *ptr, char *value)
+{
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_sh_cache) {
+ BLI_strncpy(value, sl->path_sh_cache, FILE_MAX);
+ }
+ value[0] = 0x00;
+}
+
+static int rna_UserDef_studiolight_path_sh_cache_length(PointerRNA *ptr)
+{
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_sh_cache) {
+ return strlen(sl->path_sh_cache);
+ }
+ return 0;
+}
+
/* StudioLight.index */
static int rna_UserDef_studiolight_index_get(PointerRNA *ptr)
{
@@ -714,11 +772,16 @@ static int rna_UserDef_studiolight_orientation_get(PointerRNA *ptr)
return sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS;
}
-static void rna_UserDef_studiolight_orientation_set(PointerRNA *UNUSED(ptr), const int UNUSED(value))
+static void rna_UserDef_studiolight_spherical_harmonics_coefficients_get(PointerRNA *ptr, float *values)
{
+ StudioLight *sl = (StudioLight *)ptr->data;
+ float *value = values;
+ for (int i = 0; i < STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS; i++) {
+ copy_v3_v3(value, sl->spherical_harmonics_coefs[i]);
+ value += 3;
+ }
}
-
#else
/* TODO(sergey): This technically belongs to blenlib, but we don't link
@@ -2788,7 +2851,7 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ThemeNLAEditor", NULL);
RNA_def_struct_sdna(srna, "ThemeSpace");
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme NLA Editor", "Theme settings for the NLA Editor");
+ RNA_def_struct_ui_text(srna, "Theme Nonlinear Animation", "Theme settings for the NLA Editor");
rna_def_userdef_theme_spaces_main(srna);
rna_def_userdef_theme_spaces_list_main(srna);
@@ -3058,7 +3121,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
{1, "VIEW_3D", ICON_VIEW3D, "3D View", ""},
{3, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""},
{4, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", ""},
- {5, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""},
+ {5, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", ""},
{6, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", ""},
{7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""},
{8, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""},
@@ -3120,7 +3183,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "tnla");
RNA_def_property_struct_type(prop, "ThemeNLAEditor");
- RNA_def_property_ui_text(prop, "NLA Editor", "");
+ RNA_def_property_ui_text(prop, "Nonlinear Animation", "");
prop = RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
@@ -3227,18 +3290,39 @@ static void rna_def_userdef_addon(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_Addon_preferences_get", NULL, NULL, NULL);
}
+static void rna_def_userdef_studiolights(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "StudioLights", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_ui_text(srna, "Studio Lights", "Collection of studio lights");
+
+ func = RNA_def_function(srna, "new", "rna_StudioLights_new");
+ RNA_def_function_ui_description(func, "Create a new studiolight");
+ parm = RNA_def_string(func, "path", NULL, 0, "File Path", "File path where the studio light file can be found");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "orientation", rna_enum_studio_light_orientation_items, STUDIOLIGHT_ORIENTATION_WORLD, "Orientation", "The orientation for the new studio light");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "Newly created StudioLight");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_StudioLights_remove");
+ RNA_def_function_ui_description(func, "Remove a studio light");
+ parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "The studio light to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "refresh", "rna_StudioLights_refresh");
+ RNA_def_function_ui_description(func, "Refresh Studio Lights from disk");
+}
+
static void rna_def_userdef_studiolight(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- static const EnumPropertyItem rna_enum_studio_light_orientation_items[] = {
- {STUDIOLIGHT_ORIENTATION_CAMERA, "CAMERA", 0, "Camera", ""},
- {STUDIOLIGHT_ORIENTATION_WORLD, "WORLD", 0, "World", ""},
- {STUDIOLIGHT_ORIENTATION_VIEWNORMAL, "MATCAP", 0, "MatCap", ""},
- {0, NULL, 0, NULL, NULL}
- };
-
RNA_define_verify_sdna(false);
srna = RNA_def_struct(brna, "StudioLight", NULL);
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
@@ -3256,7 +3340,8 @@ static void rna_def_userdef_studiolight(BlenderRNA *brna)
prop = RNA_def_property(srna, "orientation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_studio_light_orientation_items);
- RNA_def_property_enum_funcs(prop, "rna_UserDef_studiolight_orientation_get", "rna_UserDef_studiolight_orientation_set", NULL);
+ RNA_def_property_enum_funcs(prop, "rna_UserDef_studiolight_orientation_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Orientation", "");
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
@@ -3270,8 +3355,23 @@ static void rna_def_userdef_studiolight(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Path", "");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_define_verify_sdna(true);
+ prop = RNA_def_property(srna, "path_irr_cache", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_path_irr_cache_get", "rna_UserDef_studiolight_path_irr_cache_length", NULL);
+ RNA_def_property_ui_text(prop, "Irradiance Cache Path", "Path where the irradiance cache is stored");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "path_sh_cache", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_path_sh_cache_get", "rna_UserDef_studiolight_path_sh_cache_length", NULL);
+ RNA_def_property_ui_text(prop, "SH Cache Path", "Path where the spherical harmonics cache is stored");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ const int spherical_harmonics_dim[] = {STUDIOLIGHT_SPHERICAL_HARMONICS_COMPONENTS, 3};
+ prop = RNA_def_property(srna, "spherical_harmonics_coefficients", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_multi_array(prop, 2, spherical_harmonics_dim);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_UserDef_studiolight_spherical_harmonics_coefficients_get", NULL, NULL);
+ RNA_define_verify_sdna(true);
}
static void rna_def_userdef_pathcompare(BlenderRNA *brna)
@@ -3492,6 +3592,12 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS_PYTHON);
RNA_def_property_ui_text(prop, "Python Tooltips", "Show Python references in tooltips");
+ prop = RNA_def_property(srna, "show_developer_ui", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DEVELOPER_UI);
+ RNA_def_property_ui_text(
+ prop, "Developer Extras",
+ "Show options for developers (edit source in context menu, geometry indices)");
+
prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO);
RNA_def_property_ui_text(prop, "Display Object Info", "Display objects name and frame number in 3D view");
@@ -4067,12 +4173,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
- static const EnumPropertyItem gpu_antialias_method_items[] = {
- {USER_AA_NONE, "OFF", 0, "Off", "Disable Anti Alias in viewport"},
- {USER_AA_FXAA, "FXAA", 0, "FXAA", "Use FXAA, a fast screenspace Anti Alias method"},
- {0, NULL, 0, NULL, NULL}
- };
-
srna = RNA_def_struct(brna, "UserPreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");
RNA_def_struct_nested(brna, srna, "UserPreferences");
@@ -4291,17 +4391,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
- prop = RNA_def_property(srna, "screencast_fps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "scrcastfps");
- RNA_def_property_range(prop, 10, 100);
- RNA_def_property_ui_text(prop, "FPS", "Frame rate for the screencast to be played back");
-
- prop = RNA_def_property(srna, "screencast_wait_time", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "scrcastwait");
- RNA_def_property_range(prop, 10, 1000);
- RNA_def_property_ui_text(prop, "Wait Timer (ms)",
- "Time in milliseconds between each frame recorded for screencast");
-
prop = RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA);
RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
@@ -4331,13 +4420,14 @@ static void rna_def_userdef_system(BlenderRNA *brna)
"Draw tool/property regions over the main region, when using Triple Buffer");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
- prop = RNA_def_property(srna, "max_anti_alias_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gpu_viewport_antialias");
- RNA_def_property_enum_items(prop, gpu_antialias_method_items);
- RNA_def_property_ui_text(prop, "Viewport Anti-aliasing",
- "Method to draw the Anti-Aliasing in the viewport");
+ prop = RNA_def_property(srna, "gpu_viewport_quality", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gpu_viewport_quality");
+ RNA_def_property_float_default(prop, 0.6f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Viewport Quality", "Quality setting for Solid mode rendering in the 3d viewport");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
#ifdef WITH_OPENSUBDIV
prop = RNA_def_property(srna, "opensubdiv_compute_type", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
@@ -4791,7 +4881,6 @@ void RNA_def_userdef(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- FunctionRNA *func;
static const EnumPropertyItem user_pref_sections[] = {
{USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
@@ -4885,16 +4974,14 @@ void RNA_def_userdef(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_flag(prop, PROP_THICK_WRAP);
+ /* StudioLight Collection */
prop = RNA_def_property(srna, "studio_lights", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "StudioLight");
+ RNA_def_property_srna(prop, "StudioLights");
RNA_def_property_collection_funcs(
prop, "rna_UserDef_studiolight_begin", "rna_iterator_listbase_next",
"rna_iterator_listbase_end", "rna_iterator_listbase_get",
NULL, NULL, NULL, NULL);
-
- func = RNA_def_function(srna, "studio_lights_refresh", "rna_UserDef_studiolight_refresh");
- RNA_def_function_ui_description(func, "Refresh Studio Lights");
-
RNA_def_property_ui_text(prop, "Studio Lights", "");
rna_def_userdef_view(brna);
@@ -4904,6 +4991,7 @@ void RNA_def_userdef(BlenderRNA *brna)
rna_def_userdef_system(brna);
rna_def_userdef_addon(brna);
rna_def_userdef_addon_pref(brna);
+ rna_def_userdef_studiolights(brna);
rna_def_userdef_studiolight(brna);
rna_def_userdef_pathcompare(brna);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index c4e15174c88..1c94582c57e 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -751,7 +751,7 @@ static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value)
win->workspace_hook->temp_layout_store = layout_new;
}
-static int rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
+static bool rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
bScreen *screen = value.id.data;
return !screen->temp;
@@ -1073,7 +1073,7 @@ static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value)
#ifdef WITH_PYTHON
-static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot)
+static bool rna_operator_poll_cb(bContext *C, wmOperatorType *ot)
{
extern FunctionRNA rna_Operator_poll_func;
@@ -1081,7 +1081,7 @@ static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot)
ParameterList list;
FunctionRNA *func;
void *ret;
- int visible;
+ bool visible;
RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
@@ -1091,7 +1091,7 @@ static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot)
ot->ext.call(C, &ptr, func, &list);
RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(int *)ret;
+ visible = *(bool *)ret;
RNA_parameter_list_free(&list);
@@ -1142,7 +1142,7 @@ static bool rna_operator_check_cb(bContext *C, wmOperator *op)
op->type->ext.call(C, &opr, func, &list);
RNA_parameter_get_lookup(&list, "result", &ret);
- result = (*(int *)ret) != 0;
+ result = (*(bool *)ret) != 0;
RNA_parameter_list_free(&list);
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index aff696696af..afb12f48e28 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -89,7 +89,7 @@ static void rna_Operator_report(wmOperator *op, int type, const char *msg)
BKE_report(op->reports, type, msg);
}
-static int rna_Operator_is_repeat(wmOperator *op, bContext *C)
+static bool rna_Operator_is_repeat(wmOperator *op, bContext *C)
{
return WM_operator_is_repeat(C, op);
}
@@ -101,7 +101,7 @@ static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
}
-static int rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator)
+static bool rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator)
{
return WM_event_add_modal_handler(C, operator) != NULL;
}
@@ -204,7 +204,7 @@ static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
static wmKeyMapItem *rna_KeyMap_item_new(
wmKeyMap *km, ReportList *reports, const char *idname, int type, int value,
- int any, int shift, int ctrl, int alt, int oskey, int keymodifier, int head)
+ bool any, bool shift, bool ctrl, bool alt, bool oskey, int keymodifier, bool head)
{
/* wmWindowManager *wm = CTX_wm_manager(C); */
wmKeyMapItem *kmi = NULL;
@@ -242,8 +242,8 @@ static wmKeyMapItem *rna_KeyMap_item_new(
static wmKeyMapItem *rna_KeyMap_item_new_modal(
wmKeyMap *km, ReportList *reports, const char *propvalue_str,
- int type, int value, int any, int shift, int ctrl, int alt,
- int oskey, int keymodifier)
+ int type, int value, bool any, bool shift, bool ctrl, bool alt,
+ bool oskey, int keymodifier)
{
int modifier = 0;
int propvalue = 0;
@@ -283,7 +283,7 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA
RNA_POINTER_INVALIDATE(kmi_ptr);
}
-static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal)
+static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal)
{
if (modal == 0) {
return WM_keymap_find(keyconf, idname, spaceid, regionid);
@@ -338,7 +338,7 @@ static PointerRNA rna_KeyConfig_find_item_from_operator(
const char *idname,
int opcontext,
PointerRNA *properties,
- int is_hotkey,
+ bool is_hotkey,
PointerRNA *km_ptr)
{
char idname_bl[OP_MAX_TYPENAME];
diff --git a/source/blender/makesrna/intern/rna_wm_manipulator.c b/source/blender/makesrna/intern/rna_wm_manipulator.c
index 4ae1e107e28..6cfee512ff7 100644
--- a/source/blender/makesrna/intern/rna_wm_manipulator.c
+++ b/source/blender/makesrna/intern/rna_wm_manipulator.c
@@ -261,7 +261,7 @@ static wmManipulator *rna_ManipulatorProperties_find_operator(PointerRNA *ptr)
#endif
/* We could try workaruond this lookup, but not trivial. */
- for (bScreen *screen = G.main->screen.first; screen; screen = screen->id.next) {
+ for (bScreen *screen = G_MAIN->screen.first; screen; screen = screen->id.next) {
IDProperty *properties = ptr->data;
for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
diff --git a/source/blender/makesrna/intern/rna_wm_manipulator_api.c b/source/blender/makesrna/intern/rna_wm_manipulator_api.c
index c948f84e087..16804042608 100644
--- a/source/blender/makesrna/intern/rna_wm_manipulator_api.c
+++ b/source/blender/makesrna/intern/rna_wm_manipulator_api.c
@@ -166,7 +166,7 @@ static PointerRNA rna_manipulator_target_set_operator(
/** \name Manipulator Property Access
* \{ */
-static int rna_manipulator_target_is_valid(
+static bool rna_manipulator_target_is_valid(
wmManipulator *mpr, ReportList *reports, const char *target_propname)
{
wmManipulatorProperty *mpr_prop =
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index 041b2b9157f..166d71689d1 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -121,13 +121,13 @@ static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace, const bTool
}
static bToolRef *rna_WorkSpace_tools_from_space_view3d_mode(
- WorkSpace *workspace, int mode, int create)
+ WorkSpace *workspace, int mode, bool create)
{
return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_VIEW3D, .mode = mode}, create);
}
static bToolRef *rna_WorkSpace_tools_from_space_image_mode(
- WorkSpace *workspace, int mode, int create)
+ WorkSpace *workspace, int mode, bool create)
{
return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_IMAGE, .mode = mode}, create);
}
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index 81606dfba4a..0db192e8347 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -41,6 +41,8 @@
#ifdef RNA_RUNTIME
+#include "ED_screen.h"
+
static void rna_WorkspaceTool_setup(
ID *id,
bToolRef *tref,
@@ -80,10 +82,14 @@ static PointerRNA rna_WorkspaceTool_operator_properties(
#else
-void RNA_api_workspace(StructRNA *UNUSED(srna))
+void RNA_api_workspace(StructRNA *srna)
{
- /* FunctionRNA *func; */
- /* PropertyRNA *parm; */
+ FunctionRNA *func;
+
+ func = RNA_def_function(srna, "status_text_set", "ED_workspace_status_text");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Set the status bar text, typically key shortcuts for modal operators");
+ RNA_def_string(func, "text", NULL, 0, "Text", "New string for the status bar, no argument clears the text");
}
void RNA_api_workspace_tool(StructRNA *srna)
diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
index 0b80a711c3b..f1cd46f3d57 100755
--- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py
+++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py
@@ -318,4 +318,3 @@ if __name__=='__main__':
print("Incorrect python version, use python 3!")
else:
main()
-
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 40d568537a0..09ba865cce3 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -85,7 +85,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(
return dataMask;
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
@@ -119,7 +119,7 @@ static void deformVerts(
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
- modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
+ MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */
armature_deform_verts(amd->object, ctx->object, mesh, vertexCos, NULL,
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
@@ -136,9 +136,9 @@ static void deformVertsEM(
Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
- Mesh *mesh_src = get_mesh(ctx->object, em, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, em, mesh, NULL, false, false);
- modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
+ MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */
armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, NULL,
numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
@@ -160,7 +160,7 @@ static void deformMatricesEM(
float (*defMats)[3][3], int numVerts)
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
- Mesh *mesh_src = get_mesh(ctx->object, em, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, em, mesh, NULL, false, false);
armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, defMats, numVerts,
amd->deformflag, NULL, amd->defgrp_name);
@@ -175,7 +175,7 @@ static void deformMatrices(
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
{
ArmatureModifierData *amd = (ArmatureModifierData *) md;
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
armature_deform_verts(amd->object, ctx->object, mesh_src, vertexCos, defMats, numVerts,
amd->deformflag, NULL, amd->defgrp_name);
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index c1268157d58..5ae0013aab0 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -46,7 +46,6 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_displist.h"
#include "BKE_curve.h"
#include "BKE_library.h"
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index b30d6c2e669..aa12093b505 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -34,8 +34,9 @@
#include "MEM_guardedalloc.h"
-#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
@@ -43,7 +44,6 @@
#include "BLI_math.h"
#include "BLI_string.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
@@ -300,7 +300,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
});
if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0])
- modifier_get_vgroup_mesh(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup);
+ MOD_get_vgroup(ctx->object, mesh, bmd->defgrp_name, &dvert, &vgroup);
if (vertex_only) {
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index f7b16431c48..6cea7b8fece 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -76,7 +76,7 @@ static void initData(ModifierData *md)
bmd->double_threshold = 1e-6f;
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
BooleanModifierData *bmd = (BooleanModifierData *) md;
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index 9b491d4333f..902a9e7f14f 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -46,7 +46,6 @@
#include "DEG_depsgraph_query.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_particle.h"
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 4441af57c93..cd6cd709b1d 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -63,7 +63,7 @@ static void initData(ModifierData *md)
cmd->object = NULL;
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
CastModifierData *cmd = (CastModifierData *) md;
short flag;
@@ -153,7 +153,7 @@ static void sphere_do(
/* 3) if we were given a vertex group name,
* only those vertices should be affected */
- modifier_get_vgroup_mesh(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index);
if (flag & MOD_CAST_SIZE_FROM_RADIUS) {
len = cmd->radius;
@@ -255,7 +255,7 @@ static void cuboid_do(
/* 3) if we were given a vertex group name,
* only those vertices should be affected */
- modifier_get_vgroup_mesh(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, cmd->defgrp_name, &dvert, &defgrp_index);
if (ctrl_ob) {
if (flag & MOD_CAST_USE_OB_TRANSFORM) {
@@ -429,7 +429,7 @@ static void deformVerts(
int numVerts)
{
CastModifierData *cmd = (CastModifierData *)md;
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
BLI_assert(mesh_src->totvert == numVerts);
@@ -451,7 +451,7 @@ static void deformVertsEM(
Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
CastModifierData *cmd = (CastModifierData *)md;
- Mesh *mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
BLI_assert(mesh_src->totvert == numVerts);
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 19afe30acae..58979fa201b 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -54,6 +54,9 @@
#include "BKE_modifier.h"
#include "BKE_pointcache.h"
+#include "DEG_depsgraph_physics.h"
+#include "DEG_depsgraph_query.h"
+
#include "MOD_util.h"
static void initData(ModifierData *md)
@@ -78,6 +81,7 @@ static void deformVerts(
{
Mesh *mesh_src;
ClothModifierData *clmd = (ClothModifierData *) md;
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
/* check for alloc failing */
if (!clmd->sim_parms || !clmd->coll_parms) {
@@ -88,7 +92,7 @@ static void deformVerts(
}
if (mesh == NULL) {
- mesh_src = get_mesh(ctx->object, NULL, NULL, NULL, false, false);
+ mesh_src = MOD_get_mesh_eval(ctx->object, NULL, NULL, NULL, false, false);
}
else {
/* Not possible to use get_mesh() in this case as we'll modify its vertices
@@ -123,7 +127,7 @@ static void deformVerts(
BKE_mesh_apply_vert_coords(mesh_src, vertexCos);
- clothModifier_do(clmd, ctx->depsgraph, md->scene, ctx->object, mesh_src, vertexCos);
+ clothModifier_do(clmd, ctx->depsgraph, scene, ctx->object, mesh_src, vertexCos);
BKE_id_free(NULL, mesh_src);
}
@@ -132,10 +136,8 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
{
ClothModifierData *clmd = (ClothModifierData *)md;
if (clmd != NULL) {
- /* Actual code uses get_collisionobjects */
- DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, clmd->coll_parms->group, eModifierType_Collision, NULL, true, "Cloth Collision");
-
- DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, clmd->sim_parms->effector_weights, true, 0, "Cloth Field");
+ DEG_add_collision_relations(ctx->node, ctx->object, clmd->coll_parms->group, eModifierType_Collision, NULL, "Cloth Collision");
+ DEG_add_forcefield_relations(ctx->node, ctx->object, clmd->sim_parms->effector_weights, true, 0, "Cloth Field");
}
}
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index 7f02bbf0453..5a73d62433b 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -113,7 +113,7 @@ static void deformVerts(
Object *ob = ctx->object;
if (mesh == NULL) {
- mesh_src = get_mesh(ob, NULL, NULL, NULL, false, false);
+ mesh_src = MOD_get_mesh_eval(ob, NULL, NULL, NULL, false, false);
}
else {
/* Not possible to use get_mesh() in this case as we'll modify its vertices
diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.c
index df5cd956000..879b07de6d9 100644
--- a/source/blender/modifiers/intern/MOD_correctivesmooth.c
+++ b/source/blender/modifiers/intern/MOD_correctivesmooth.c
@@ -581,7 +581,7 @@ static void correctivesmooth_modifier_do(
MDeformVert *dvert = NULL;
int defgrp_index;
- modifier_get_vgroup_mesh(ob, mesh, csmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, csmd->defgrp_name, &dvert, &defgrp_index);
/* if rest bind_coords not are defined, set them (only run during bind) */
if ((csmd->rest_source == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) &&
@@ -717,7 +717,7 @@ static void deformVerts(
ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh,
float (*vertexCos)[3], int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
correctivesmooth_modifier_do(md, ctx->object, mesh_src, vertexCos, (unsigned int)numVerts, NULL);
@@ -731,7 +731,7 @@ static void deformVertsEM(
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
correctivesmooth_modifier_do(md, ctx->object, mesh_src, vertexCos, (unsigned int)numVerts, editData);
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index deda8213a65..e90ff939b68 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -71,7 +71,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
return dataMask;
}
-static bool isDisabled(ModifierData *md, int UNUSED(userRenderParams))
+static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, int UNUSED(userRenderParams))
{
CurveModifierData *cmd = (CurveModifierData *) md;
@@ -113,7 +113,7 @@ static void deformVerts(
int numVerts)
{
CurveModifierData *cmd = (CurveModifierData *) md;
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
BLI_assert(mesh_src->totvert == numVerts);
@@ -134,7 +134,7 @@ static void deformVertsEM(
float (*vertexCos)[3],
int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, em, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, em, mesh, NULL, false, false);
BLI_assert(mesh_src->totvert == numVerts);
diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c
index 21d1a6a865d..8e025059d6c 100644
--- a/source/blender/modifiers/intern/MOD_datatransfer.c
+++ b/source/blender/modifiers/intern/MOD_datatransfer.c
@@ -37,9 +37,7 @@
#include "DNA_object_types.h"
#include "BKE_customdata.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_data_transfer.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_mesh_mapping.h"
@@ -47,6 +45,8 @@
#include "BKE_modifier.h"
#include "BKE_report.h"
+#include "DEG_depsgraph_query.h"
+
#include "MEM_guardedalloc.h"
#include "MOD_util.h"
@@ -133,7 +133,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
/* If no source object, bypass. */
@@ -148,10 +148,11 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
DT_TYPE_SHARP_FACE \
)
-static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData)
+static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *me_mod)
{
DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
- DerivedMesh *dm = derivedData;
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+ Mesh *result = me_mod;
ReportList reports;
/* Only used to check wehther we are operating on org data or not... */
@@ -168,18 +169,24 @@ static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *c
BLI_SPACE_TRANSFORM_SETUP(space_transform, ctx->object, dtmd->ob_source);
}
- MVert *mvert = dm->getVertArray(dm);
- MEdge *medge = dm->getEdgeArray(dm);
- if (((me->mvert == mvert) || (me->medge == medge)) && (dtmd->data_types & DT_TYPES_AFFECT_MESH)) {
+ if ((result == me_mod || (me->mvert == result->mvert) || (me->medge == result->medge)) &&
+ (dtmd->data_types & DT_TYPES_AFFECT_MESH))
+ {
/* We need to duplicate data here, otherwise setting custom normals, edges' shaprness, etc., could
* modify org mesh, see T43671. */
- dm = CDDM_copy(dm);
+ BKE_id_copy_ex(
+ NULL, &me_mod->id, (ID **)&result,
+ LIB_ID_CREATE_NO_MAIN |
+ LIB_ID_CREATE_NO_USER_REFCOUNT |
+ LIB_ID_CREATE_NO_DEG_TAG |
+ LIB_ID_COPY_NO_PREVIEW,
+ false);
}
BKE_reports_init(&reports, RPT_STORE);
/* Note: no islands precision for now here. */
- BKE_object_data_transfer_dm(ctx->depsgraph, md->scene, dtmd->ob_source, ctx->object, dm, dtmd->data_types, false,
+ BKE_object_data_transfer_ex(ctx->depsgraph, scene, dtmd->ob_source, ctx->object, result, dtmd->data_types, false,
dtmd->vmap_mode, dtmd->emap_mode, dtmd->lmap_mode, dtmd->pmap_mode,
space_transform, false, max_dist, dtmd->map_ray_radius, 0.0f,
dtmd->layers_select_src, dtmd->layers_select_dst,
@@ -191,11 +198,11 @@ static DerivedMesh *applyModifier(ModifierData *md, const ModifierEvalContext *c
else if ((dtmd->data_types & DT_TYPE_LNOR) && !(me->flag & ME_AUTOSMOOTH)) {
modifier_setError((ModifierData *)dtmd, "Enable 'Auto Smooth' option in mesh settings");
}
- else if (dm->getNumVerts(dm) > HIGH_POLY_WARNING || ((Mesh *)(dtmd->ob_source->data))->totvert > HIGH_POLY_WARNING) {
+ else if (result->totvert > HIGH_POLY_WARNING || ((Mesh *)(dtmd->ob_source->data))->totvert > HIGH_POLY_WARNING) {
modifier_setError(md, "You are using a rather high poly as source or destination, computation might be slow");
}
- return dm;
+ return result;
}
#undef HIGH_POLY_WARNING
@@ -217,14 +224,14 @@ ModifierTypeInfo modifierType_DataTransfer = {
/* deformMatrices_DM */ NULL,
/* deformVertsEM_DM */ NULL,
/* deformMatricesEM_DM*/NULL,
- /* applyModifier_DM */ applyModifier,
+ /* applyModifier_DM */ NULL,
/* applyModifierEM_DM */NULL,
/* deformVerts */ NULL,
/* deformMatrices */ NULL,
/* deformVertsEM */ NULL,
/* deformMatricesEM */ NULL,
- /* applyModifier */ NULL,
+ /* applyModifier */ applyModifier,
/* applyModifierEM */ NULL,
/* initData */ initData,
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index 89ed8d627f1..9e35746c0a3 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -129,7 +129,7 @@ static Mesh *applyModifier(
MDeformVert *dvert;
int defgrp_index;
- modifier_get_vgroup_mesh(ctx->object, mesh, dmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ctx->object, mesh, dmd->defgrp_name, &dvert, &defgrp_index);
if (dvert) {
const unsigned int vert_tot = mesh->totvert;
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index ef15b5fbf7a..ac8fb91bc8d 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -53,6 +53,7 @@
#include "BKE_object.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
#include "MEM_guardedalloc.h"
@@ -137,7 +138,7 @@ static void foreachTexLink(
walk(userData, ob, md, "texture");
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
DisplaceModifierData *dmd = (DisplaceModifierData *) md;
return ((!dmd->texture && dmd->direction == MOD_DISP_DIR_RGB_XYZ) || dmd->strength == 0.0f);
@@ -159,6 +160,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
typedef struct DisplaceUserdata {
/*const*/ DisplaceModifierData *dmd;
+ struct Scene *scene;
struct ImagePool *pool;
MDeformVert *dvert;
float weight;
@@ -205,7 +207,7 @@ static void displaceModifier_do_task(
if (dmd->texture) {
texres.nor = NULL;
- BKE_texture_get_value_ex(dmd->modifier.scene, dmd->texture, tex_co[iter], &texres, data->pool, false);
+ BKE_texture_get_value_ex(data->scene, dmd->texture, tex_co[iter], &texres, data->pool, false);
delta = texres.tin - dmd->midlevel;
}
else {
@@ -291,14 +293,14 @@ static void displaceModifier_do(
if (dmd->strength == 0.0f) return;
mvert = mesh->mvert;
- modifier_get_vgroup_mesh(ob, mesh, dmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, dmd->defgrp_name, &dvert, &defgrp_index);
if (dmd->texture) {
tex_co = MEM_calloc_arrayN((size_t)numVerts, sizeof(*tex_co),
"displaceModifier_do tex_co");
- get_texture_coords_mesh((MappingInfoModifierData *)dmd, ob, mesh, vertexCos, tex_co);
+ MOD_get_texture_coords((MappingInfoModifierData *)dmd, ob, mesh, vertexCos, tex_co);
- modifier_init_texture(depsgraph, dmd->texture);
+ MOD_init_texture(depsgraph, dmd->texture);
}
else {
tex_co = NULL;
@@ -330,6 +332,7 @@ static void displaceModifier_do(
}
DisplaceUserdata data = {NULL};
+ data.scene = DEG_get_evaluated_scene(ctx->depsgraph);
data.dmd = dmd;
data.dvert = dvert;
data.weight = weight;
@@ -373,7 +376,7 @@ static void deformVerts(
float (*vertexCos)[3],
int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
BLI_assert(mesh_src->totvert == numVerts);
@@ -388,7 +391,7 @@ static void deformVertsEM(
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
BLI_assert(mesh_src->totvert == numVerts);
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index 5ca367e342a..9131bc0659f 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -42,8 +42,9 @@
#include "BKE_modifier.h"
#include "DEG_depsgraph.h"
-
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_physics.h"
+#include "DEG_depsgraph_query.h"
#include "MOD_modifiertypes.h"
@@ -107,7 +108,8 @@ static DerivedMesh *applyModifier(
/* dont apply dynamic paint on orco dm stack */
if (!(ctx->flag & MOD_APPLY_ORCO)) {
- return dynamicPaint_Modifier_do(pmd, ctx->depsgraph, md->scene, ctx->object, dm);
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+ return dynamicPaint_Modifier_do(pmd, ctx->depsgraph, scene, ctx->object, dm);
}
return dm;
}
@@ -124,11 +126,11 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
if (pmd->canvas != NULL) {
for (DynamicPaintSurface *surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) {
- DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, surface->effector_weights, true, 0, "Dynamic Paint Field");
+ DEG_add_forcefield_relations(ctx->node, ctx->object, surface->effector_weights, true, 0, "Dynamic Paint Field");
}
/* Actual code uses custom loop over group/scene without layer checks in dynamicPaint_doStep */
- DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, surface->brush_group, eModifierType_DynamicPaint, is_brush_cb, false, "Dynamic Paint Brush");
+ DEG_add_collision_relations(ctx->node, ctx->object, surface->brush_group, eModifierType_DynamicPaint, is_brush_cb, "Dynamic Paint Brush");
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index e1806dc8283..a8d4d55c5d3 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -40,7 +40,6 @@
#include "BLI_utildefines.h"
#include "BLI_math.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_library.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index cbb15665bef..948aaf0751e 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -51,6 +51,8 @@
#include "BKE_particle.h"
#include "BKE_scene.h"
+#include "DEG_depsgraph_query.h"
+
#include "MEM_guardedalloc.h"
#include "MOD_modifiertypes.h"
@@ -1028,18 +1030,20 @@ static DerivedMesh *applyModifier(
createFacepa(emd, psmd, derivedData);
}
/* 2. create new mesh */
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
if (emd->flag & eExplodeFlag_EdgeCut) {
int *facepa = emd->facepa;
DerivedMesh *splitdm = cutEdges(emd, dm);
- DerivedMesh *explode = explodeMesh(emd, psmd, ctx, md->scene, splitdm);
+ DerivedMesh *explode = explodeMesh(emd, psmd, ctx, scene, splitdm);
MEM_freeN(emd->facepa);
emd->facepa = facepa;
splitdm->release(splitdm);
return explode;
}
- else
- return explodeMesh(emd, psmd, ctx, md->scene, derivedData);
+ else {
+ return explodeMesh(emd, psmd, ctx, scene, derivedData);
+ }
}
return derivedData;
}
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h
index 3329e6dbebe..0a0c8419a99 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.h
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h
@@ -49,4 +49,3 @@ struct DerivedMesh *fluidsimModifier_do(
struct DerivedMesh *dm);
#endif
-
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 76df31823a7..a5013bb38c6 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -96,7 +96,7 @@ static void freeData(ModifierData *md)
MEM_SAFE_FREE(hmd->indexar);
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
HookModifierData *hmd = (HookModifierData *) md;
@@ -271,7 +271,7 @@ static void deformVerts_do(
/* Generic data needed for applying per-vertex calculations (initialize all members) */
hd.vertexCos = vertexCos;
- modifier_get_vgroup_mesh(ob, mesh, hmd->name, &hd.dvert, &hd.defgrp_index);
+ MOD_get_vgroup(ob, mesh, hmd->name, &hd.dvert, &hd.defgrp_index);
hd.curfalloff = hmd->curfalloff;
@@ -354,7 +354,7 @@ static void deformVerts(
float (*vertexCos)[3], int numVerts)
{
HookModifierData *hmd = (HookModifierData *)md;
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
deformVerts_do(hmd, ctx->object, mesh_src, vertexCos, numVerts);
@@ -369,7 +369,7 @@ static void deformVertsEM(
struct Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
HookModifierData *hmd = (HookModifierData *)md;
- Mesh *mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
deformVerts_do(hmd, ctx->object, mesh_src, vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index 63b4e950697..e5b96c633f7 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -509,7 +509,7 @@ static bool isValidVertexGroup(LaplacianDeformModifierData *lmd, Object *ob, Mes
int defgrp_index;
MDeformVert *dvert = NULL;
- modifier_get_vgroup_mesh(ob, mesh, lmd->anchor_grp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, lmd->anchor_grp_name, &dvert, &defgrp_index);
return (dvert != NULL);
}
@@ -535,7 +535,7 @@ static void initSystem(
STACK_INIT(index_anchors, numVerts);
- modifier_get_vgroup_mesh(ob, mesh, lmd->anchor_grp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, lmd->anchor_grp_name, &dvert, &defgrp_index);
BLI_assert(dvert != NULL);
dv = dvert;
for (i = 0; i < numVerts; i++) {
@@ -595,7 +595,7 @@ static int isSystemDifferent(LaplacianDeformModifierData *lmd, Object *ob, Mesh
if (!STREQ(lmd->anchor_grp_name, sys->anchor_grp_name)) {
return LAPDEFORM_SYSTEM_ONLY_CHANGE_GROUP;
}
- modifier_get_vgroup_mesh(ob, mesh, lmd->anchor_grp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, lmd->anchor_grp_name, &dvert, &defgrp_index);
if (!dvert) {
return LAPDEFORM_SYSTEM_CHANGE_NOT_VALID_GROUP;
}
@@ -715,7 +715,7 @@ static void copyData(const ModifierData *md, ModifierData *target)
tlmd->cache_system = NULL;
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)md;
if (lmd->anchor_grp_name[0]) return 0;
@@ -734,7 +734,7 @@ static void deformVerts(
ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh,
float (*vertexCos)[3], int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
if (mesh_src != mesh) {
@@ -746,7 +746,7 @@ static void deformVertsEM(
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *editData,
Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
LaplacianDeformModifier_do((LaplacianDeformModifierData *)md, ctx->object, mesh_src,
vertexCos, numVerts);
if (mesh_src != mesh) {
diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
index 59e4faee633..580de4b1572 100644
--- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c
+++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c
@@ -81,7 +81,7 @@ struct BLaplacianSystem {
typedef struct BLaplacianSystem LaplacianSystem;
static CustomDataMask required_data_mask(Object *ob, ModifierData *md);
-static bool is_disabled(ModifierData *md, int useRenderParams);
+static bool is_disabled(const struct Scene *UNUSED(scene), ModifierData *md, int useRenderParams);
static float compute_volume(const float center[3], float (*vertexCos)[3], const MPoly *mpoly, int numPolys, const MLoop *mloop);
static LaplacianSystem *init_laplacian_system(int a_numEdges, int a_numPolys, int a_numLoops, int a_numVerts);
static void delete_laplacian_system(LaplacianSystem *sys);
@@ -379,7 +379,7 @@ static void laplaciansmoothModifier_do(
sys->medges = mesh->medge;
sys->vertexCos = vertexCos;
sys->min_area = 0.00001f;
- modifier_get_vgroup_mesh(ob, mesh, smd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, smd->defgrp_name, &dvert, &defgrp_index);
sys->vert_centroid[0] = 0.0f;
sys->vert_centroid[1] = 0.0f;
@@ -474,7 +474,7 @@ static void init_data(ModifierData *md)
smd->defgrp_name[0] = '\0';
}
-static bool is_disabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool is_disabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
LaplacianSmoothModifierData *smd = (LaplacianSmoothModifierData *) md;
short flag;
@@ -507,7 +507,7 @@ static void deformVerts(
if (numVerts == 0)
return;
- mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ctx->object, mesh_src,
vertexCos, numVerts);
@@ -525,7 +525,7 @@ static void deformVertsEM(
if (numVerts == 0)
return;
- mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ctx->object, mesh_src,
vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 219d08fc0f6..540876ac339 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -67,7 +67,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
return dataMask;
}
-static bool isDisabled(ModifierData *md, int UNUSED(userRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(userRenderParams))
{
LatticeModifierData *lmd = (LatticeModifierData *) md;
@@ -100,9 +100,9 @@ static void deformVerts(
int numVerts)
{
LatticeModifierData *lmd = (LatticeModifierData *) md;
- struct Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ struct Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
- modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
+ MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */
lattice_deform_verts(lmd->object, ctx->object, mesh_src,
vertexCos, numVerts, lmd->name, lmd->strength);
@@ -115,7 +115,7 @@ static void deformVertsEM(
ModifierData *md, const ModifierEvalContext *ctx, struct BMEditMesh *em,
struct Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
- struct Mesh *mesh_src = get_mesh(ctx->object, em, mesh, NULL, false, false);
+ struct Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, em, mesh, NULL, false, false);
deformVerts(md, ctx, mesh_src, vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c
index 50765079785..9d6dfc0e1eb 100644
--- a/source/blender/modifiers/intern/MOD_meshcache.c
+++ b/source/blender/modifiers/intern/MOD_meshcache.c
@@ -42,6 +42,8 @@
#include "BKE_mesh.h"
#include "BKE_main.h"
+#include "DEG_depsgraph_query.h"
+
#include "MEM_guardedalloc.h"
#include "MOD_meshcache_util.h" /* utility functions */
@@ -70,7 +72,7 @@ static bool dependsOnTime(ModifierData *md)
return (mcmd->play_mode == MOD_MESHCACHE_PLAY_CFEA);
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
MeshCacheModifierData *mcmd = (MeshCacheModifierData *) md;
@@ -80,7 +82,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
static void meshcache_do(
- MeshCacheModifierData *mcmd, Object *ob, DerivedMesh *UNUSED(dm),
+ MeshCacheModifierData *mcmd, Scene *scene, Object *ob, DerivedMesh *UNUSED(dm),
float (*vertexCos_Real)[3], int numVerts)
{
const bool use_factor = mcmd->factor < 1.0f;
@@ -88,7 +90,6 @@ static void meshcache_do(
MEM_malloc_arrayN(numVerts, sizeof(*vertexCos_Store), __func__) : NULL;
float (*vertexCos)[3] = vertexCos_Store ? vertexCos_Store : vertexCos_Real;
- Scene *scene = mcmd->modifier.scene;
const float fps = FPS;
char filepath[FILE_MAX];
@@ -270,8 +271,9 @@ static void deformVerts(
int numVerts)
{
MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
- meshcache_do(mcmd, ctx->object, derivedData, vertexCos, numVerts);
+ meshcache_do(mcmd, scene, ctx->object, derivedData, vertexCos, numVerts);
}
static void deformVertsEM(
@@ -279,8 +281,9 @@ static void deformVertsEM(
DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
{
MeshCacheModifierData *mcmd = (MeshCacheModifierData *)md;
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
- meshcache_do(mcmd, ctx->object, derivedData, vertexCos, numVerts);
+ meshcache_do(mcmd, scene, ctx->object, derivedData, vertexCos, numVerts);
}
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index b50672e4160..af37b30b7aa 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -52,6 +52,7 @@
#include "MEM_guardedalloc.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
#include "MOD_util.h"
@@ -108,7 +109,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
return dataMask;
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
MeshDeformModifierData *mmd = (MeshDeformModifierData *) md;
@@ -294,7 +295,7 @@ static void meshdeformModifier_do(
if (!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc))
return;
- /* Get cage derivedmesh.
+ /* Get cage mesh.
*
* Only do this is the target object is in edit mode by itself, meaning
* we don't allow linked edit meshes here.
@@ -324,8 +325,9 @@ static void meshdeformModifier_do(
/* progress bar redraw can make this recursive .. */
if (!recursive) {
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
recursive = 1;
- mmd->bindfunc(md->scene, mmd, cagemesh, (float *)vertexCos, numVerts, cagemat);
+ mmd->bindfunc(scene, mmd, cagemesh, (float *)vertexCos, numVerts, cagemat);
recursive = 0;
}
}
@@ -372,7 +374,7 @@ static void meshdeformModifier_do(
copy_v3_v3(dco[a], co);
}
- modifier_get_vgroup_mesh(ob, mesh, mmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, mmd->defgrp_name, &dvert, &defgrp_index);
/* Initialize data to be pass to the for body function. */
data.mmd = mmd;
@@ -392,7 +394,7 @@ static void meshdeformModifier_do(
meshdeform_vert_task,
&settings);
- /* release cage derivedmesh */
+ /* release cage mesh */
MEM_freeN(dco);
MEM_freeN(cagecos);
if (cagemesh != NULL && free_cagemesh) {
@@ -406,9 +408,9 @@ static void deformVerts(
float (*vertexCos)[3],
int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
- modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
+ MOD_previous_vcos_store(md, vertexCos); /* if next modifier needs original vertices */
meshdeformModifier_do(md, ctx, mesh_src, vertexCos, numVerts);
@@ -424,7 +426,7 @@ static void deformVertsEM(
float (*vertexCos)[3],
int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
meshdeformModifier_do(md, ctx, mesh_src, vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index abd84799457..a6c9f865e4c 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -26,12 +26,12 @@
#include "DNA_cachefile_types.h"
#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_cachefile.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_scene.h"
@@ -79,7 +79,7 @@ static void freeData(ModifierData *md)
}
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
@@ -98,7 +98,7 @@ static Mesh *applyModifier(
Mesh *me = (ctx->object->type == OB_MESH) ? ctx->object->data : NULL;
Mesh *org_mesh = mesh;
- Scene *scene = md->scene; /* for FPS macro */
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
const float frame = DEG_get_ctime(ctx->depsgraph);
const float time = BKE_cachefile_time_offset(mcmd->cache_file, frame, FPS);
const char *err_str = NULL;
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index a23511ff87a..aa9bc0dbc20 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -46,6 +46,8 @@
#include "BKE_modifier.h"
#include "BKE_subsurf.h"
+#include "DEG_depsgraph_query.h"
+
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md)
@@ -63,6 +65,7 @@ static DerivedMesh *applyModifier(
DerivedMesh *dm)
{
MultiresModifierData *mmd = (MultiresModifierData *)md;
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
DerivedMesh *result;
Mesh *me = (Mesh *)ctx->object->data;
const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
@@ -86,7 +89,7 @@ static DerivedMesh *applyModifier(
if (ignore_simplify)
flags |= MULTIRES_IGNORE_SIMPLIFY;
- result = multires_make_derived_from_derived(dm, mmd, ctx->object, flags);
+ result = multires_make_derived_from_derived(dm, mmd, scene, ctx->object, flags);
if (result == dm)
return dm;
diff --git a/source/blender/modifiers/intern/MOD_none.c b/source/blender/modifiers/intern/MOD_none.c
index b22b1768515..c973bd18830 100644
--- a/source/blender/modifiers/intern/MOD_none.c
+++ b/source/blender/modifiers/intern/MOD_none.c
@@ -43,7 +43,7 @@
* no other functions will be called
*/
-static bool isDisabled(ModifierData *UNUSED(md), int UNUSED(userRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *UNUSED(md), int UNUSED(userRenderParams))
{
return true;
}
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c
index 935d99e4a21..ae67296dda7 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.c
+++ b/source/blender/modifiers/intern/MOD_normal_edit.c
@@ -37,7 +37,6 @@
#include "BLI_utildefines.h"
#include "BLI_bitmap.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_mesh.h"
@@ -471,7 +470,7 @@ static Mesh *normalEditModifier_do(NormalEditModifierData *enmd, Object *ob, Mes
clnors = CustomData_add_layer(ldata, CD_CUSTOMLOOPNORMAL, CD_CALLOC, NULL, num_loops);
}
- modifier_get_vgroup_mesh(ob, result, enmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, result, enmd->defgrp_name, &dvert, &defgrp_index);
if (enmd->mode == MOD_NORMALEDIT_MODE_RADIAL) {
normalEditModifier_do_radial(
@@ -525,7 +524,7 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
walk(userData, ob, &enmd->target, IDWALK_CB_NOP);
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
NormalEditModifierData *enmd = (NormalEditModifierData *)md;
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index af5b537ca52..702e557ccb1 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -46,6 +46,8 @@
#include "BKE_modifier.h"
#include "BKE_ocean.h"
+#include "DEG_depsgraph_query.h"
+
#include "MOD_modifiertypes.h"
#ifdef WITH_OCEANSIM
@@ -406,7 +408,7 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
}
static DerivedMesh *doOcean(
- ModifierData *md, Object *ob,
+ ModifierData *md, Scene *scene, Object *ob,
DerivedMesh *derivedData,
int UNUSED(useRenderParams))
{
@@ -450,7 +452,7 @@ static DerivedMesh *doOcean(
if (!omd->oceancache) {
init_cache_data(ob, omd);
}
- BKE_ocean_simulate_cache(omd->oceancache, md->scene->r.cfra);
+ BKE_ocean_simulate_cache(omd->oceancache, scene->r.cfra);
}
else {
simulate_ocean_modifier(omd);
@@ -464,7 +466,7 @@ static DerivedMesh *doOcean(
dm = CDDM_copy(derivedData);
}
- cfra = md->scene->r.cfra;
+ cfra = scene->r.cfra;
CLAMP(cfra, omd->bakestart, omd->bakeend);
cfra -= omd->bakestart; /* shift to 0 based */
@@ -547,12 +549,11 @@ static DerivedMesh *doOcean(
}
#else /* WITH_OCEANSIM */
static DerivedMesh *doOcean(
- ModifierData *md, Object *UNUSED(ob),
+ ModifierData *UNUSED(md), Scene *UNUSED(scene), Object *UNUSED(ob),
DerivedMesh *derivedData,
int UNUSED(useRenderParams))
{
/* unused */
- (void)md;
return derivedData;
}
#endif /* WITH_OCEANSIM */
@@ -562,8 +563,10 @@ static DerivedMesh *applyModifier(
DerivedMesh *derivedData)
{
DerivedMesh *result;
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+
- result = doOcean(md, ctx->object, derivedData, 0);
+ result = doOcean(md, scene, ctx->object, derivedData, 0);
if (result != derivedData)
result->dirty |= DM_DIRTY_NORMALS;
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 0aafcf33202..bb6ed8e8344 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -54,6 +54,7 @@
#include "BKE_pointcache.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
static void initData(ModifierData *md)
{
@@ -87,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
}
-static bool isDisabled(ModifierData *md, int useRenderParams)
+static bool isDisabled(const struct Scene *scene, ModifierData *md, int useRenderParams)
{
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
ParticleSystem *psys;
@@ -112,7 +113,7 @@ static bool isDisabled(ModifierData *md, int useRenderParams)
if (useRenderParams) required_mode = eModifierMode_Render;
else required_mode = eModifierMode_Realtime;
- if (!modifier_isEnabled(md->scene, ob_md, required_mode))
+ if (!modifier_isEnabled(scene, ob_md, required_mode))
return true;
break;
@@ -202,6 +203,7 @@ static Mesh *applyModifier(
{
Mesh *result;
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
ParticleSimulationData sim;
ParticleSystem *psys = NULL;
ParticleData *pa = NULL;
@@ -247,7 +249,7 @@ static Mesh *applyModifier(
return mesh;
sim.depsgraph = ctx->depsgraph;
- sim.scene = md->scene;
+ sim.scene = scene;
sim.ob = pimd->ob;
sim.psys = psys;
sim.psmd = psys_get_modifier(pimd->ob, psys);
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index cbdeeebaa04..1821a0fced0 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -41,15 +41,15 @@
#include "BLI_utildefines.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_editmesh.h"
#include "BKE_mesh.h"
#include "BKE_library.h"
#include "BKE_modifier.h"
#include "BKE_particle.h"
-#include "MOD_util.h"
+#include "DEG_depsgraph_query.h"
+#include "MOD_util.h"
static void initData(ModifierData *md)
{
@@ -120,7 +120,7 @@ static void deformVerts(
return;
if (mesh_src == NULL) {
- mesh_src = get_mesh(ctx->object, NULL, NULL, vertexCos, false, true);
+ mesh_src = MOD_get_mesh_eval(ctx->object, NULL, NULL, vertexCos, false, true);
if (mesh_src == NULL) {
return;
}
@@ -210,26 +210,31 @@ static void deformVerts(
}
if (!(ctx->object->transflag & OB_NO_PSYS_UPDATE)) {
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
psmd->flag &= ~eParticleSystemFlag_psys_updated;
- particle_system_update(ctx->depsgraph, md->scene, ctx->object, psys, (ctx->flag & MOD_APPLY_RENDER) != 0);
+ particle_system_update(ctx->depsgraph, scene, ctx->object, psys, (ctx->flag & MOD_APPLY_RENDER) != 0);
psmd->flag |= eParticleSystemFlag_psys_updated;
}
}
-/* disabled particles in editmode for now, until support for proper derivedmesh
+/* disabled particles in editmode for now, until support for proper evaluated mesh
* updates is coded */
#if 0
static void deformVertsEM(
- ModifierData *md, Object *ob, EditMesh *editData,
- DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+ ModifierData *md, Object *ob, BMEditMesh *editData,
+ Mesh *mesh, float (*vertexCos)[3], int numVerts)
{
- DerivedMesh *dm = derivedData;
-
- if (!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
+ const bool do_temp_mesh = (mesh == NULL);
+ if (do_temp_mesh) {
+ mesh = BKE_id_new_nomain(ID_ME, ((ID *)ob->data)->name);
+ BM_mesh_bm_to_me(NULL, editData->bm, mesh, &((BMeshToMeshParams){0}));
+ }
- deformVerts(md, ob, dm, vertexCos, numVerts);
+ deformVerts(md, ob, mesh, vertexCos, numVerts);
- if (!derivedData) dm->release(dm);
+ if (derivedData) {
+ BKE_id_free(NULL, mesh);
+ }
}
#endif
diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c
index 90c339361b7..a6c7419da49 100644
--- a/source/blender/modifiers/intern/MOD_shapekey.c
+++ b/source/blender/modifiers/intern/MOD_shapekey.c
@@ -34,11 +34,11 @@
#include "BLI_math.h"
+#include "DNA_mesh_types.h"
#include "DNA_key_types.h"
#include "BLI_utildefines.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_key.h"
#include "BKE_particle.h"
@@ -46,7 +46,7 @@
static void deformVerts(
ModifierData *UNUSED(md), const ModifierEvalContext *ctx,
- DerivedMesh *UNUSED(derivedData),
+ Mesh *UNUSED(mesh),
float (*vertexCos)[3],
int numVerts)
{
@@ -62,7 +62,7 @@ static void deformVerts(
}
static void deformMatrices(
- ModifierData *md, const ModifierEvalContext *ctx, DerivedMesh *derivedData,
+ ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh,
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
{
Key *key = BKE_key_from_object(ctx->object);
@@ -81,26 +81,26 @@ static void deformMatrices(
copy_m3_m3(defMats[a], scale);
}
- deformVerts(md, ctx, derivedData, vertexCos, numVerts);
+ deformVerts(md, ctx, mesh, vertexCos, numVerts);
}
static void deformVertsEM(
ModifierData *md, const ModifierEvalContext *ctx,
struct BMEditMesh *UNUSED(editData),
- DerivedMesh *derivedData,
+ Mesh *mesh,
float (*vertexCos)[3],
int numVerts)
{
Key *key = BKE_key_from_object(ctx->object);
if (key && key->type == KEY_RELATIVE)
- deformVerts(md, ctx, derivedData, vertexCos, numVerts);
+ deformVerts(md, ctx, mesh, vertexCos, numVerts);
}
static void deformMatricesEM(
ModifierData *UNUSED(md), const ModifierEvalContext *ctx,
struct BMEditMesh *UNUSED(editData),
- DerivedMesh *UNUSED(derivedData),
+ Mesh *UNUSED(mesh),
float (*vertexCos)[3],
float (*defMats)[3][3],
int numVerts)
@@ -132,17 +132,17 @@ ModifierTypeInfo modifierType_ShapeKey = {
/* copyData */ NULL,
- /* deformVerts_DM */ deformVerts,
- /* deformMatrices_DM */ deformMatrices,
- /* deformVertsEM_DM */ deformVertsEM,
- /* deformMatricesEM_DM*/deformMatricesEM,
+ /* deformVerts_DM */ NULL,
+ /* deformMatrices_DM */ NULL,
+ /* deformVertsEM_DM */ NULL,
+ /* deformMatricesEM_DM*/NULL,
/* applyModifier_DM */ NULL,
/* applyModifierEM_DM */NULL,
- /* deformVerts */ NULL,
- /* deformMatrices */ NULL,
- /* deformVertsEM */ NULL,
- /* deformMatricesEM */ NULL,
+ /* deformVerts */ deformVerts,
+ /* deformMatrices */ deformMatrices,
+ /* deformVertsEM */ deformVertsEM,
+ /* deformMatricesEM */ deformMatricesEM,
/* applyModifier */ NULL,
/* applyModifierEM */ NULL,
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index da31de911e4..72c1c1552c7 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -48,6 +48,8 @@
#include "BKE_modifier.h"
#include "BKE_shrinkwrap.h"
+#include "DEG_depsgraph_query.h"
+
#include "MOD_util.h"
static bool dependsOnNormals(ModifierData *md);
@@ -82,7 +84,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
return dataMask;
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *) md;
return !smd->target;
@@ -103,6 +105,7 @@ static void deformVerts(
float (*vertexCos)[3],
int numVerts)
{
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
Mesh *mesh_src = mesh;
if (mesh_src == NULL) {
@@ -111,7 +114,7 @@ static void deformVerts(
BLI_assert(mesh_src->totvert == numVerts);
- shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
+ shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, scene, ctx->object, mesh_src, vertexCos, numVerts);
}
static void deformVertsEM(
@@ -119,6 +122,7 @@ static void deformVertsEM(
struct BMEditMesh *editData, Mesh *mesh,
float (*vertexCos)[3], int numVerts)
{
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
Mesh *mesh_src = mesh;
if (mesh_src == NULL) {
@@ -127,7 +131,7 @@ static void deformVertsEM(
BLI_assert(mesh_src->totvert == numVerts);
- shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
+ shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, scene, ctx->object, mesh_src, vertexCos, numVerts);
if (!mesh) {
BKE_id_free(NULL, mesh_src);
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 3f62351bceb..756ce3c83a9 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -39,7 +39,6 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_editmesh.h"
#include "BKE_mesh.h"
#include "BKE_library.h"
@@ -287,7 +286,7 @@ static void SimpleDeformModifier_do(
}
}
- modifier_get_vgroup_mesh(ob, mesh, smd->vgroup_name, &dvert, &vgroup);
+ MOD_get_vgroup(ob, mesh, smd->vgroup_name, &dvert, &vgroup);
const bool invert_vgroup = (smd->flag & MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP) != 0;
const uint *axis_map = axis_map_table[(smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) ? deform_axis : 2];
@@ -386,7 +385,7 @@ static void deformVerts(
float (*vertexCos)[3],
int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
SimpleDeformModifier_do((SimpleDeformModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
@@ -402,7 +401,7 @@ static void deformVertsEM(
float (*vertexCos)[3],
int numVerts)
{
- Mesh *mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ Mesh *mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
SimpleDeformModifier_do((SimpleDeformModifierData *)md, ctx->object, mesh_src, vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 323994e6738..31d556292f8 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -864,7 +864,7 @@ static Mesh *subdivide_base(Mesh *orig)
MEM_freeN(degree);
- /* Allocate output derivedmesh */
+ /* Allocate output mesh */
result = BKE_mesh_new_nomain_from_template(
orig,
totorigvert + totsubd,
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index 4c10df71f92..e81c760ed67 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -55,6 +55,8 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_physics.h"
+#include "DEG_depsgraph_query.h"
#include "MOD_modifiertypes.h"
@@ -108,10 +110,12 @@ static DerivedMesh *applyModifier(
{
SmokeModifierData *smd = (SmokeModifierData *) md;
- if (ctx->flag & MOD_APPLY_ORCO)
+ if (ctx->flag & MOD_APPLY_ORCO) {
return dm;
+ }
- return smokeModifier_do(smd, ctx->depsgraph, md->scene, ctx->object, dm);
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+ return smokeModifier_do(smd, ctx->depsgraph, scene, ctx->object, dm);
}
static bool dependsOnTime(ModifierData *UNUSED(md))
@@ -136,11 +140,9 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
SmokeModifierData *smd = (SmokeModifierData *)md;
if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
- /* Actual code uses get_collisionobjects */
- DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, smd->domain->fluid_group, eModifierType_Smoke, is_flow_cb, true, "Smoke Flow");
- DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, smd->domain->coll_group, eModifierType_Smoke, is_coll_cb, true, "Smoke Coll");
-
- DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, smd->domain->effector_weights, true, PFIELD_SMOKEFLOW, "Smoke Force Field");
+ DEG_add_collision_relations(ctx->node, ctx->object, smd->domain->fluid_group, eModifierType_Smoke, is_flow_cb, "Smoke Flow");
+ DEG_add_collision_relations(ctx->node, ctx->object, smd->domain->coll_group, eModifierType_Smoke, is_coll_cb, "Smoke Coll");
+ DEG_add_forcefield_relations(ctx->node, ctx->object, smd->domain->effector_weights, true, PFIELD_SMOKEFLOW, "Smoke Force Field");
}
}
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index e44ead73ced..280a795fae8 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -61,7 +61,7 @@ static void initData(ModifierData *md)
smd->defgrp_name[0] = '\0';
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
SmoothModifierData *smd = (SmoothModifierData *) md;
short flag;
@@ -118,7 +118,7 @@ static void smoothModifier_do(
numDMEdges = 0;
}
- modifier_get_vgroup_mesh(ob, mesh, smd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, smd->defgrp_name, &dvert, &defgrp_index);
/* NOTICE: this can be optimized a little bit by moving the
* if (dvert) out of the loop, if needed */
diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c
index 30f9829ae20..55df32b0e18 100644
--- a/source/blender/modifiers/intern/MOD_softbody.c
+++ b/source/blender/modifiers/intern/MOD_softbody.c
@@ -46,17 +46,19 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_physics.h"
#include "DEG_depsgraph_query.h"
#include "MOD_modifiertypes.h"
static void deformVerts(
- ModifierData *md, const ModifierEvalContext *ctx,
+ ModifierData *UNUSED(md), const ModifierEvalContext *ctx,
Mesh *UNUSED(derivedData),
float (*vertexCos)[3],
int numVerts)
{
- sbObjectStep(ctx->depsgraph, md->scene, ctx->object, DEG_get_ctime(ctx->depsgraph), vertexCos, numVerts);
+ Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
+ sbObjectStep(ctx->depsgraph, scene, ctx->object, DEG_get_ctime(ctx->depsgraph), vertexCos, numVerts);
}
static bool dependsOnTime(ModifierData *UNUSED(md))
@@ -68,9 +70,8 @@ static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgr
{
if (ctx->object->soft) {
/* Actual code uses ccd_build_deflector_hash */
- DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, ctx->object->soft->collision_group, eModifierType_Collision, NULL, false, "Softbody Collision");
-
- DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, ctx->object->soft->effector_weights, true, 0, "Softbody Field");
+ DEG_add_collision_relations(ctx->node, ctx->object, ctx->object->soft->collision_group, eModifierType_Collision, NULL, "Softbody Collision");
+ DEG_add_forcefield_relations(ctx->node, ctx->object, ctx->object->soft->effector_weights, true, 0, "Softbody Field");
}
}
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index b99b35bbb8e..3a1fe1513af 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -40,7 +40,6 @@
#include "BLI_bitmap.h"
#include "BLI_math.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
#include "BKE_particle.h"
#include "BKE_deform.h"
@@ -251,7 +250,7 @@ static Mesh *applyModifier(
/* array size is doubled in case of using a shell */
const unsigned int stride = do_shell ? 2 : 1;
- modifier_get_vgroup_mesh(ctx->object, mesh, smd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ctx->object, mesh, smd->defgrp_name, &dvert, &defgrp_index);
orig_mvert = mesh->mvert;
orig_medge = mesh->medge;
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index c4eb99840fb..3de04e878ac 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -91,12 +91,12 @@ static void freeData(ModifierData *md)
}
}
-static bool isDisabled(ModifierData *md, int useRenderParams)
+static bool isDisabled(const Scene *scene, ModifierData *md, int useRenderParams)
{
SubsurfModifierData *smd = (SubsurfModifierData *) md;
int levels = (useRenderParams) ? smd->renderLevels : smd->levels;
- return get_render_subsurf_level(&md->scene->r, levels, useRenderParams != 0) == 0;
+ return get_render_subsurf_level(&scene->r, levels, useRenderParams != 0) == 0;
}
static DerivedMesh *applyModifier(
@@ -104,6 +104,7 @@ static DerivedMesh *applyModifier(
DerivedMesh *derivedData)
{
SubsurfModifierData *smd = (SubsurfModifierData *) md;
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
SubsurfFlags subsurf_flags = 0;
DerivedMesh *result;
const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
@@ -146,7 +147,7 @@ static DerivedMesh *applyModifier(
}
#endif
- result = subsurf_make_derived_from_derived(derivedData, smd, NULL, subsurf_flags);
+ result = subsurf_make_derived_from_derived(derivedData, smd, scene, NULL, subsurf_flags);
result->cd_flag = derivedData->cd_flag;
{
@@ -168,6 +169,7 @@ static DerivedMesh *applyModifierEM(
DerivedMesh *derivedData)
{
SubsurfModifierData *smd = (SubsurfModifierData *) md;
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
DerivedMesh *result;
/* 'orco' using editmode flags would cause cache to be used twice in editbmesh_calc_modifiers */
SubsurfFlags ss_flags = (ctx->flag & MOD_APPLY_ORCO) ? 0 : (SUBSURF_FOR_EDIT_MODE | SUBSURF_IN_EDIT_MODE);
@@ -178,7 +180,7 @@ static DerivedMesh *applyModifierEM(
}
#endif
- result = subsurf_make_derived_from_derived(derivedData, smd, NULL, ss_flags);
+ result = subsurf_make_derived_from_derived(derivedData, smd, scene, NULL, ss_flags);
return result;
}
@@ -234,4 +236,3 @@ ModifierTypeInfo modifierType_Subsurf = {
/* foreachIDLink */ NULL,
/* foreachTexLink */ NULL,
};
-
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index d6e78c6f19b..33a6fbe6c78 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -111,7 +111,7 @@ static void deformVerts(
LIB_ID_COPY_NO_PREVIEW,
false);
}
- else surmd->mesh = get_mesh(ctx->object, NULL, NULL, NULL, false, false);
+ else surmd->mesh = MOD_get_mesh_eval(ctx->object, NULL, NULL, NULL, false, false);
if (!ctx->object->pd) {
printf("SurfaceModifier deformVerts: Should not happen!\n");
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index e964da0a8d1..a3ab2d74602 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -1195,7 +1195,7 @@ static void deformVertsEM(
surfacedeformModifier_do(md, ctx, vertexCos, numVerts, ctx->object);
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index c72cf41737e..721474a62f3 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -40,10 +40,10 @@
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
+#include "BLI_bitmap.h"
#include "BLI_math_vector.h"
#include "BLI_math_matrix.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_image.h"
@@ -63,7 +63,7 @@
#include "bmesh.h"
-void modifier_init_texture(const Depsgraph *depsgraph, Tex *tex)
+void MOD_init_texture(const Depsgraph *depsgraph, Tex *tex)
{
if (!tex)
return;
@@ -75,7 +75,7 @@ void modifier_init_texture(const Depsgraph *depsgraph, Tex *tex)
/* TODO to be renamed to get_texture_coords once we are done with moving modifiers to Mesh. */
/** \param cos may be NULL, in which case we use directly mesh vertices' coordinates. */
-void get_texture_coords_mesh(
+void MOD_get_texture_coords(
MappingInfoModifierData *dmd,
Object *ob,
Mesh *mesh,
@@ -155,80 +155,7 @@ void get_texture_coords_mesh(
}
}
-void get_texture_coords(
- MappingInfoModifierData *dmd, Object *ob,
- DerivedMesh *dm,
- float (*co)[3], float (*texco)[3],
- int numVerts)
-{
- int i;
- int texmapping = dmd->texmapping;
- float mapob_imat[4][4];
-
- if (texmapping == MOD_DISP_MAP_OBJECT) {
- if (dmd->map_object)
- invert_m4_m4(mapob_imat, dmd->map_object->obmat);
- else /* if there is no map object, default to local */
- texmapping = MOD_DISP_MAP_LOCAL;
- }
-
- /* UVs need special handling, since they come from faces */
- if (texmapping == MOD_DISP_MAP_UV) {
- if (CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
- MPoly *mpoly = dm->getPolyArray(dm);
- MPoly *mp;
- MLoop *mloop = dm->getLoopArray(dm);
- char *done = MEM_calloc_arrayN(numVerts, sizeof(*done),
- "get_texture_coords done");
- int numPolys = dm->getNumPolys(dm);
- char uvname[MAX_CUSTOMDATA_LAYER_NAME];
- MLoopUV *mloop_uv;
-
- CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, dmd->uvlayer_name, uvname);
- mloop_uv = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV, uvname);
-
- /* verts are given the UV from the first face that uses them */
- for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp) {
- unsigned int fidx = mp->totloop - 1;
-
- do {
- unsigned int lidx = mp->loopstart + fidx;
- unsigned int vidx = mloop[lidx].v;
-
- if (done[vidx] == 0) {
- /* remap UVs from [0, 1] to [-1, 1] */
- texco[vidx][0] = (mloop_uv[lidx].uv[0] * 2.0f) - 1.0f;
- texco[vidx][1] = (mloop_uv[lidx].uv[1] * 2.0f) - 1.0f;
- done[vidx] = 1;
- }
-
- } while (fidx--);
- }
-
- MEM_freeN(done);
- return;
- }
- else /* if there are no UVs, default to local */
- texmapping = MOD_DISP_MAP_LOCAL;
- }
-
- for (i = 0; i < numVerts; ++i, ++co, ++texco) {
- switch (texmapping) {
- case MOD_DISP_MAP_LOCAL:
- copy_v3_v3(*texco, *co);
- break;
- case MOD_DISP_MAP_GLOBAL:
- mul_v3_m4v3(*texco, ob->obmat, *co);
- break;
- case MOD_DISP_MAP_OBJECT:
- mul_v3_m4v3(*texco, ob->obmat, *co);
- mul_m4_v3(mapob_imat, *texco);
- break;
- }
- }
-}
-
-void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
+void MOD_previous_vcos_store(ModifierData *md, float (*vertexCos)[3])
{
while ((md = md->next) && md->type == eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData *) md;
@@ -240,62 +167,8 @@ void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
/* lattice/mesh modifier too */
}
-/* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */
-DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], bool use_normals)
-{
- if (dm) {
- if (dm->type != DM_TYPE_CDDM) {
- dm = CDDM_copy(dm);
- }
- CDDM_apply_vert_coords(dm, vertexCos);
-
- if (use_normals) {
- DM_ensure_normals(dm);
- }
- }
- else {
- dm = get_dm(ob, em, dm, vertexCos, use_normals, false);
- }
-
- return dm;
-}
-
-/* returns a derived mesh if dm == NULL, for deforming modifiers that need it */
-DerivedMesh *get_dm(
- Object *ob, struct BMEditMesh *em, DerivedMesh *dm,
- float (*vertexCos)[3], bool use_normals, bool use_orco)
-{
- if (dm) {
- /* pass */
- }
- else if (ob->type == OB_MESH) {
- if (em) dm = CDDM_from_editbmesh(em, false, false);
- else dm = CDDM_from_mesh((struct Mesh *)(ob->data));
-
- if (vertexCos) {
- CDDM_apply_vert_coords(dm, vertexCos);
- dm->dirty |= DM_DIRTY_NORMALS;
- }
-
- if (use_orco) {
- DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob));
- }
- }
- else if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
- dm = CDDM_from_curve(ob);
- }
-
- if (use_normals) {
- if (LIKELY(dm)) {
- DM_ensure_normals(dm);
- }
- }
-
- return dm;
-}
-
/* returns a mesh if mesh == NULL, for deforming modifiers that need it */
-Mesh *get_mesh(
+Mesh *MOD_get_mesh_eval(
Object *ob, struct BMEditMesh *em, Mesh *mesh,
float (*vertexCos)[3], bool use_normals, bool use_orco)
{
@@ -345,35 +218,7 @@ Mesh *get_mesh(
return mesh;
}
-/* Get derived mesh for other object, which is used as an operand for the modifier,
- * i.e. second operand for boolean modifier.
- */
-DerivedMesh *get_dm_for_modifier(Object *ob, ModifierApplyFlag flag)
-{
- if (flag & MOD_APPLY_RENDER) {
- /* TODO(sergey): Use proper derived render in the future. */
- return ob->derivedFinal;
- }
- else {
- return ob->derivedFinal;
- }
-}
-
-void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformVert **dvert, int *defgrp_index)
-{
- *defgrp_index = defgroup_name_index(ob, name);
- *dvert = NULL;
-
- if (*defgrp_index != -1) {
- if (ob->type == OB_LATTICE)
- *dvert = BKE_lattice_deform_verts_get(ob);
- else if (dm)
- *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
- }
-}
-
-/* TODO(sybren): replace the above function with this one, once we got rid of DerivedMesh for modifiers. */
-void modifier_get_vgroup_mesh(Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index)
+void MOD_get_vgroup(Object *ob, struct Mesh *mesh, const char *name, MDeformVert **dvert, int *defgrp_index)
{
*defgrp_index = defgroup_name_index(ob, name);
*dvert = NULL;
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index 0b3452b22b8..bb15fc32b6b 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -33,7 +33,6 @@
#include "DEG_depsgraph_build.h"
-struct DerivedMesh;
struct Depsgraph;
struct MDeformVert;
struct Mesh;
@@ -42,32 +41,21 @@ struct Object;
struct Scene;
struct Tex;
-void modifier_init_texture(const struct Depsgraph *depsgraph, struct Tex *texture);
-void get_texture_coords(
- struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm,
- float (*co)[3], float (*texco)[3], int numVerts);
-void get_texture_coords_mesh(
+void MOD_init_texture(const struct Depsgraph *depsgraph, struct Tex *texture);
+void MOD_get_texture_coords(
struct MappingInfoModifierData *dmd,
struct Object *ob,
struct Mesh *mesh,
float (*cos)[3],
float (*r_texco)[3]);
-void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);
-struct DerivedMesh *get_cddm(
- struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm,
- float (*vertexCos)[3], bool use_normals);
-struct DerivedMesh *get_dm(
- struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm,
- float (*vertexCos)[3], bool use_normals, bool use_orco);
-struct Mesh *get_mesh(
+
+void MOD_previous_vcos_store(struct ModifierData *md, float (*vertexCos)[3]);
+
+struct Mesh *MOD_get_mesh_eval(
struct Object *ob, struct BMEditMesh *em, struct Mesh *mesh,
float (*vertexCos)[3], bool use_normals, bool use_orco);
-struct DerivedMesh *get_dm_for_modifier(struct Object *ob, ModifierApplyFlag flag);
-void modifier_get_vgroup(
- struct Object *ob, struct DerivedMesh *dm,
- const char *name, struct MDeformVert **dvert, int *defgrp_index);
-void modifier_get_vgroup_mesh(
+void MOD_get_vgroup(
struct Object *ob, struct Mesh *mesh,
const char *name, struct MDeformVert **dvert, int *defgrp_index);
diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c
index c650ae995db..4046e0c2142 100644
--- a/source/blender/modifiers/intern/MOD_uvwarp.c
+++ b/source/blender/modifiers/intern/MOD_uvwarp.c
@@ -27,6 +27,7 @@
#include <string.h>
+#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
@@ -35,7 +36,6 @@
#include "BLI_utildefines.h"
#include "BKE_action.h" /* BKE_pose_channel_find_name */
-#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_library_query.h"
#include "BKE_modifier.h"
@@ -138,9 +138,9 @@ static void uv_warp_compute(
}
}
-static DerivedMesh *applyModifier(
+static Mesh *applyModifier(
ModifierData *md, const ModifierEvalContext *ctx,
- DerivedMesh *dm)
+ Mesh *mesh)
{
UVWarpModifierData *umd = (UVWarpModifierData *) md;
int numPolys, numLoops;
@@ -158,12 +158,12 @@ static DerivedMesh *applyModifier(
const int axis_v = umd->axis_v;
/* make sure there are UV Maps available */
- if (!CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
- return dm;
+ if (!CustomData_has_layer(&mesh->ldata, CD_MLOOPUV)) {
+ return mesh;
}
else if (ELEM(NULL, umd->object_src, umd->object_dst)) {
modifier_setError(md, "From/To objects must be set");
- return dm;
+ return mesh;
}
/* make sure anything moving UVs is available */
@@ -189,16 +189,16 @@ static DerivedMesh *applyModifier(
}
/* make sure we're using an existing layer */
- CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, umd->uvlayer_name, uvname);
+ CustomData_validate_layer_name(&mesh->ldata, CD_MLOOPUV, umd->uvlayer_name, uvname);
- numPolys = dm->getNumPolys(dm);
- numLoops = dm->getNumLoops(dm);
+ numPolys = mesh->totpoly;
+ numLoops = mesh->totloop;
- mpoly = dm->getPolyArray(dm);
- mloop = dm->getLoopArray(dm);
+ mpoly = mesh->mpoly;
+ mloop = mesh->mloop;
/* make sure we are not modifying the original UV map */
- mloopuv = CustomData_duplicate_referenced_layer_named(&dm->loopData, CD_MLOOPUV, uvname, numLoops);
- modifier_get_vgroup(ctx->object, dm, umd->vgroup_name, &dvert, &defgrp_index);
+ mloopuv = CustomData_duplicate_referenced_layer_named(&mesh->ldata, CD_MLOOPUV, uvname, numLoops);
+ MOD_get_vgroup(ctx->object, mesh, umd->vgroup_name, &dvert, &defgrp_index);
UVWarpData data = {.mpoly = mpoly, .mloop = mloop, .mloopuv = mloopuv,
.dvert = dvert, .defgrp_index = defgrp_index,
@@ -211,9 +211,10 @@ static DerivedMesh *applyModifier(
uv_warp_compute,
&settings);
- dm->dirty |= DM_DIRTY_TESS_CDLAYERS;
+ /* XXX TODO is this still needed? */
+// me_eval->dirty |= DM_DIRTY_TESS_CDLAYERS;
- return dm;
+ return mesh;
}
static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk, void *userData)
@@ -260,14 +261,14 @@ ModifierTypeInfo modifierType_UVWarp = {
/* deformMatrices_DM */ NULL,
/* deformVertsEM_DM */ NULL,
/* deformMatricesEM_DM*/NULL,
- /* applyModifier_DM */ applyModifier,
+ /* applyModifier_DM */ NULL,
/* applyModifierEM_DM */NULL,
/* deformVerts */ NULL,
/* deformMatrices */ NULL,
/* deformVertsEM */ NULL,
/* deformMatricesEM */ NULL,
- /* applyModifier */ NULL,
+ /* applyModifier */ applyModifier,
/* applyModifierEM */ NULL,
/* initData */ initData,
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 4df71d91e3e..54f8ce8c515 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -46,6 +46,7 @@
#include "BKE_colortools.h"
#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
#include "RE_shader_ext.h"
@@ -108,7 +109,7 @@ static void freeData(ModifierData *md)
}
-static bool isDisabled(ModifierData *md, int UNUSED(userRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(userRenderParams))
{
WarpModifierData *wmd = (WarpModifierData *) md;
@@ -177,7 +178,7 @@ static void warpModifier_do(
if (!(wmd->object_from && wmd->object_to))
return;
- modifier_get_vgroup_mesh(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index);
if (dvert == NULL) {
defgrp_index = -1;
}
@@ -215,9 +216,9 @@ static void warpModifier_do(
if (wmd->texture) {
tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co), "warpModifier_do tex_co");
- get_texture_coords_mesh((MappingInfoModifierData *)wmd, ob, mesh, vertexCos, tex_co);
+ MOD_get_texture_coords((MappingInfoModifierData *)wmd, ob, mesh, vertexCos, tex_co);
- modifier_init_texture(depsgraph, wmd->texture);
+ MOD_init_texture(depsgraph, wmd->texture);
}
for (i = 0; i < numVerts; i++) {
@@ -271,9 +272,10 @@ static void warpModifier_do(
fac *= weight;
if (tex_co) {
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
TexResult texres;
texres.nor = NULL;
- BKE_texture_get_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false);
+ BKE_texture_get_value(scene, wmd->texture, tex_co[i], &texres, false);
fac *= texres.tin;
}
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 552746634c5..c569ef1554e 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -174,7 +174,7 @@ static void waveModifier_do(
}
/* get the index of the deform group */
- modifier_get_vgroup_mesh(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index);
+ MOD_get_vgroup(ob, mesh, wmd->defgrp_name, &dvert, &defgrp_index);
if (wmd->damp == 0) wmd->damp = 10.0f;
@@ -192,9 +192,9 @@ static void waveModifier_do(
if (wmd->texture) {
tex_co = MEM_malloc_arrayN(numVerts, sizeof(*tex_co),
"waveModifier_do tex_co");
- get_texture_coords_mesh((MappingInfoModifierData *)wmd, ob, mesh, vertexCos, tex_co);
+ MOD_get_texture_coords((MappingInfoModifierData *)wmd, ob, mesh, vertexCos, tex_co);
- modifier_init_texture(depsgraph, wmd->texture);
+ MOD_init_texture(depsgraph, wmd->texture);
}
if (lifefac != 0.0f) {
@@ -265,9 +265,10 @@ static void waveModifier_do(
/*apply texture*/
if (wmd->texture) {
+ Scene *scene = DEG_get_evaluated_scene(depsgraph);
TexResult texres;
texres.nor = NULL;
- BKE_texture_get_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false);
+ BKE_texture_get_value(scene, wmd->texture, tex_co[i], &texres, false);
amplit *= texres.tin;
}
@@ -307,9 +308,9 @@ static void deformVerts(
WaveModifierData *wmd = (WaveModifierData *)md;
if (wmd->flag & MOD_WAVE_NORM)
- mesh_src = get_mesh(ctx->object, NULL, mesh, vertexCos, true, false);
+ mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, vertexCos, true, false);
else if (wmd->texture || wmd->defgrp_name[0])
- mesh_src = get_mesh(ctx->object, NULL, mesh, NULL, false, false);
+ mesh_src = MOD_get_mesh_eval(ctx->object, NULL, mesh, NULL, false, false);
waveModifier_do(wmd, ctx->depsgraph, ctx->object, mesh_src, vertexCos, numVerts);
@@ -326,9 +327,9 @@ static void deformVertsEM(
WaveModifierData *wmd = (WaveModifierData *)md;
if (wmd->flag & MOD_WAVE_NORM)
- mesh_src = get_mesh(ctx->object, editData, mesh, vertexCos, true, false);
+ mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, vertexCos, true, false);
else if (wmd->texture || wmd->defgrp_name[0])
- mesh_src = get_mesh(ctx->object, editData, mesh, NULL, false, false);
+ mesh_src = MOD_get_mesh_eval(ctx->object, editData, mesh, NULL, false, false);
waveModifier_do(wmd, ctx->depsgraph, ctx->object, mesh_src, vertexCos, numVerts);
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index a18e12e06ec..eed0c41e374 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -150,9 +150,9 @@ void weightvg_do_mask(
t_map.texmapping = tex_mapping;
tex_co = MEM_calloc_arrayN(numVerts, sizeof(*tex_co), "WeightVG Modifier, TEX mode, tex_co");
- get_texture_coords_mesh(&t_map, ob, mesh, NULL, tex_co);
+ MOD_get_texture_coords(&t_map, ob, mesh, NULL, tex_co);
- modifier_init_texture(depsgraph, texture);
+ MOD_init_texture(depsgraph, texture);
/* For each weight (vertex), make the mix between org and new weights. */
for (i = 0; i < num; ++i) {
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index f69659e46a3..93594fd8b29 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -44,7 +44,7 @@ struct RNG;
/*
* XXX I'd like to make modified weights visible in WeightPaint mode,
* but couldn't figure a way to do this...
- * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)?
+ * Maybe this will need changes in mesh_calc_modifiers?
* Or the WeightPaint mode code itself?
*/
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 00bc8a05cee..a26cb73d823 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -47,6 +47,7 @@
#include "BKE_texture.h" /* Texture masking. */
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "MEM_guardedalloc.h"
@@ -147,7 +148,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md;
/* If no vertex group, bypass. */
@@ -247,8 +248,9 @@ static Mesh *applyModifier(
}
/* Do masking. */
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
weightvg_do_mask(ctx, numVerts, NULL, org_w, new_w, ctx->object, result, wmd->mask_constant,
- wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
+ wmd->mask_defgrp_name, scene, wmd->mask_texture,
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 2b0f90008cf..90bd5acff62 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -45,13 +45,13 @@
#include "BKE_texture.h" /* Texture masking. */
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "MEM_guardedalloc.h"
#include "MOD_weightvg_util.h"
#include "MOD_modifiertypes.h"
-
/**
* This mixes the old weight with the new weight factor.
*/
@@ -185,7 +185,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md;
/* If no vertex group, bypass. */
@@ -359,8 +359,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
}
/* Do masking. */
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
weightvg_do_mask(ctx, numIdx, indices, org_w, new_w, ctx->object, result, wmd->mask_constant,
- wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
+ wmd->mask_defgrp_name, scene, wmd->mask_texture,
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 1a69ae13120..88e33f28eaf 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -40,7 +40,7 @@
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
-#include "BKE_cdderivedmesh.h"
+#include "BKE_bvhutils.h"
#include "BKE_curve.h"
#include "BKE_customdata.h"
#include "BKE_deform.h"
@@ -51,6 +51,7 @@
#include "BKE_texture.h" /* Texture masking. */
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "MEM_guardedalloc.h"
@@ -357,7 +358,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
-static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
+static bool isDisabled(const struct Scene *UNUSED(scene), ModifierData *md, int UNUSED(useRenderParams))
{
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md;
/* If no vertex group, bypass. */
@@ -542,8 +543,9 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
do_map(ob, new_w, numIdx, wmd->min_dist, wmd->max_dist, wmd->falloff_type);
/* Do masking. */
+ struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
weightvg_do_mask(ctx, numIdx, indices, org_w, new_w, ob, result, wmd->mask_constant,
- wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
+ wmd->mask_defgrp_name, scene, wmd->mask_texture,
wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
diff --git a/source/blender/modifiers/intern/MOD_wireframe.c b/source/blender/modifiers/intern/MOD_wireframe.c
index 9dfc23fbf5f..cc846d08040 100644
--- a/source/blender/modifiers/intern/MOD_wireframe.c
+++ b/source/blender/modifiers/intern/MOD_wireframe.c
@@ -28,7 +28,6 @@
#include "BLI_utildefines.h"
-#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_mesh.h"
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index 158d20a5c19..83a5f5c5bf1 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -139,5 +139,3 @@ void register_node_type_sh_bump(void);
void register_node_type_sh_tex_ies(void);
#endif
-
-
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 43beb1656a2..4f796da58dc 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -280,7 +280,10 @@ void ntreeCompositTagRender(Scene *curscene)
{
Scene *sce;
- for (sce = G.main->scene.first; sce; sce = sce->id.next) {
+ /* XXX Think using G_MAIN here is valid, since you want to update current file's scene nodes,
+ * not the ones in temp main generated for rendering?
+ * This is still rather weak though, ideally render struct would store own main AND original G_MAIN... */
+ for (sce = G_MAIN->scene.first; sce; sce = sce->id.next) {
if (sce->nodetree) {
bNode *node;
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 022794e8d42..3f67804685c 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -32,7 +32,7 @@
#include "node_composite_util.h"
-int cmp_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
+bool cmp_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
{
return STREQ(ntree->idname, "CompositorNodeTree");
}
diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h
index 25827d914f4..3f05d7d1bef 100644
--- a/source/blender/nodes/composite/node_composite_util.h
+++ b/source/blender/nodes/composite/node_composite_util.h
@@ -60,9 +60,8 @@
#define CMP_SCALE_MAX 12000
-int cmp_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
+bool cmp_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
void cmp_node_update_default(struct bNodeTree *UNUSED(ntree), struct bNode *node);
void cmp_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
#endif /* __NODE_COMPOSITE_UTIL_H__ */
-
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.c b/source/blender/nodes/composite/nodes/node_composite_common.c
index de97a5beac3..8efa44e2e5d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.c
+++ b/source/blender/nodes/composite/nodes/node_composite_common.c
@@ -64,4 +64,3 @@ void register_node_type_cmp_group(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 124b2fa72b9..8bdaa39f3b7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -390,7 +390,7 @@ static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr)
}
}
-static int node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree)
+static bool node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree)
{
if (STREQ(ntree->idname, "CompositorNodeTree")) {
Scene *scene;
diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.c b/source/blender/nodes/composite/nodes/node_composite_switch.c
index d7de26730d0..60d8a13d8d7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_switch.c
+++ b/source/blender/nodes/composite/nodes/node_composite_switch.c
@@ -53,4 +53,3 @@ void register_node_type_cmp_switch(void)
node_type_size_preset(&ntype, NODE_SIZE_SMALL);
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index 4a47bf7035c..cb04b341c26 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -81,7 +81,7 @@ void node_group_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int ma
BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Data-Block"), maxlen);
}
-int node_group_poll_instance(bNode *node, bNodeTree *nodetree)
+bool node_group_poll_instance(bNode *node, bNodeTree *nodetree)
{
if (node->typeinfo->poll(node->typeinfo, nodetree)) {
bNodeTree *grouptree = (bNodeTree *)node->id;
diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h
index edc1f19f554..737489474f9 100644
--- a/source/blender/nodes/intern/node_common.h
+++ b/source/blender/nodes/intern/node_common.h
@@ -38,7 +38,7 @@
struct bNodeTree;
void node_group_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
-int node_group_poll_instance(struct bNode *node, struct bNodeTree *nodetree);
+bool node_group_poll_instance(struct bNode *node, struct bNodeTree *nodetree);
void ntree_update_reroute_nodes(struct bNodeTree *ntree);
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 3708a7663ed..09c06e00382 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -163,6 +163,8 @@ bNodeTreeExec *ntree_exec_begin(bNodeExecContext *context, bNodeTree *ntree, bNo
/* XXX texnodes have threading issues with muting, have to disable it there ... */
/* ensure all sock->link pointers and node levels are correct */
+ /* Using global main here is likely totally wrong, not sure what to do about that one though...
+ * We cannot even check ntree is in global main, since most of the time it won't be (thanks to ntree design)!!! */
ntreeUpdateTree(G.main, ntree);
/* get a dependency-sorted list of nodes */
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index 9d77d45dedf..301fd3c35a8 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -65,7 +65,7 @@
#include "node_util.h"
#include "node_shader_util.h"
-static int shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype))
+static bool shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype))
{
Scene *scene = CTX_data_scene(C);
const char *engine_id = scene->r.engine;
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index a4b2c155675..5cc7d14bc8b 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -37,7 +37,7 @@
#include "node_exec.h"
-int sh_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
+bool sh_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
{
return STREQ(ntree->idname, "ShaderNodeTree");
}
@@ -266,4 +266,3 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in
GPU_link(mat, "texco_norm", in[0].link, &in[0].link);
}
}
-
diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h
index 46f99d98026..4fb18b1a9d8 100644
--- a/source/blender/nodes/shader/node_shader_util.h
+++ b/source/blender/nodes/shader/node_shader_util.h
@@ -81,7 +81,7 @@
#include "GPU_uniformbuffer.h"
-int sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
+bool sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
index eae35b4cd22..4c770984717 100644
--- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
+++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.c
@@ -30,14 +30,14 @@
/* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_ambient_occlusion_in[] = {
- { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("Distance"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
{ -1, 0, "" }
};
static bNodeSocketTemplate sh_node_ambient_occlusion_out[] = {
- { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
+ { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 0, N_("AO"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" }
};
@@ -52,8 +52,8 @@ static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, bNode *node, bNod
static void node_shader_init_ambient_occlusion(bNodeTree *UNUSED(ntree), bNode *node)
{
- node->custom1 = 8; /* samples */
- node->custom2 = SHD_AO_LOCAL;
+ node->custom1 = 16; /* samples */
+ node->custom2 = 0;
}
/* node type definition */
@@ -70,4 +70,3 @@ void register_node_type_sh_ambient_occlusion(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.c b/source/blender/nodes/shader/nodes/node_shader_attribute.c
index 0ea1348df05..05091a2709a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_attribute.c
+++ b/source/blender/nodes/shader/nodes/node_shader_attribute.c
@@ -84,4 +84,3 @@ void register_node_type_sh_attribute(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
index 56b790b3835..1dd7a945259 100644
--- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
+++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.c
@@ -64,4 +64,3 @@ void register_node_type_sh_light_falloff(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/shader/nodes/node_shader_object_info.c b/source/blender/nodes/shader/nodes/node_shader_object_info.c
index cba4f2854f8..623df319690 100644
--- a/source/blender/nodes/shader/nodes/node_shader_object_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_object_info.c
@@ -61,4 +61,3 @@ void register_node_type_sh_object_info(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
index 46cb513a6d9..73c95fa2ba7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c
@@ -69,4 +69,3 @@ void register_node_type_sh_particle_info(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
index 7bf44792e7f..60442a46da1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
+++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.c
@@ -100,4 +100,3 @@ void register_node_type_sh_subsurface_scattering(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c
index 4fbd9af1b58..40d24df6845 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.c
@@ -162,4 +162,3 @@ void register_node_type_sh_volume_principled(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c
index 80cc5a467a1..34ba179b4a3 100644
--- a/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c
+++ b/source/blender/nodes/shader/nodes/node_shader_volume_scatter.c
@@ -60,4 +60,3 @@ void register_node_type_sh_volume_scatter(void)
nodeRegisterType(&ntype);
}
-
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index a6b0d060d93..ff2e3d20155 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -50,7 +50,7 @@
#include "node_texture_util.h"
-int tex_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
+bool tex_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
{
return STREQ(ntree->idname, "TextureNodeTree");
}
diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h
index 8662a8a0e82..63418248b71 100644
--- a/source/blender/nodes/texture/node_texture_util.h
+++ b/source/blender/nodes/texture/node_texture_util.h
@@ -114,7 +114,7 @@ typedef struct TexDelegate {
} TexDelegate;
-int tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
+bool tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread);
diff --git a/source/blender/physics/BPH_mass_spring.h b/source/blender/physics/BPH_mass_spring.h
index e89aec1456e..f1eb049dd52 100644
--- a/source/blender/physics/BPH_mass_spring.h
+++ b/source/blender/physics/BPH_mass_spring.h
@@ -40,6 +40,7 @@ struct Implicit_Data;
struct Object;
struct ClothModifierData;
struct ListBase;
+struct Depsgraph;
struct VoxelData;
typedef enum eMassSpringSolverStatus {
@@ -55,7 +56,7 @@ int BPH_mass_spring_solver_numvert(struct Implicit_Data *id);
int BPH_cloth_solver_init(struct Object *ob, struct ClothModifierData *clmd);
void BPH_cloth_solver_free(struct ClothModifierData *clmd);
-int BPH_cloth_solve(struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors);
+int BPH_cloth_solve(struct Depsgraph *depsgraph, struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors);
void BKE_cloth_solver_set_positions(struct ClothModifierData *clmd);
#ifdef __cplusplus
diff --git a/source/blender/physics/CMakeLists.txt b/source/blender/physics/CMakeLists.txt
index 0a4ff3fe0f0..b8663a384a7 100644
--- a/source/blender/physics/CMakeLists.txt
+++ b/source/blender/physics/CMakeLists.txt
@@ -28,6 +28,7 @@ set(INC
intern
../blenlib
../blenkernel
+ ../depsgraph
../imbuf
../makesdna
../../../intern/guardedalloc
diff --git a/source/blender/physics/intern/BPH_mass_spring.cpp b/source/blender/physics/intern/BPH_mass_spring.cpp
index c8932045c52..2f24231f992 100644
--- a/source/blender/physics/intern/BPH_mass_spring.cpp
+++ b/source/blender/physics/intern/BPH_mass_spring.cpp
@@ -51,6 +51,9 @@ extern "C" {
#include "BPH_mass_spring.h"
#include "implicit.h"
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
static float I3[3][3] = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}};
/* Number of off-diagonal non-zero matrix blocks.
@@ -433,7 +436,7 @@ static void hair_get_boundbox(ClothModifierData *clmd, float gmin[3], float gmax
}
}
-static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), ListBase *effectors, float time)
+static void cloth_calc_force(Scene *scene, ClothModifierData *clmd, float UNUSED(frame), ListBase *effectors, float time)
{
/* Collect forces and derivatives: F, dFdX, dFdV */
Cloth *cloth = clmd->clothObject;
@@ -447,9 +450,9 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), ListB
#ifdef CLOTH_FORCE_GRAVITY
/* global acceleration (gravitation) */
- if (clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
+ if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
/* scale gravity force */
- mul_v3_v3fl(gravity, clmd->scene->physics_settings.gravity, 0.001f * clmd->sim_parms->effector_weights->global_gravity);
+ mul_v3_v3fl(gravity, scene->physics_settings.gravity, 0.001f * clmd->sim_parms->effector_weights->global_gravity);
}
vert = cloth->verts;
@@ -487,8 +490,8 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), ListB
EffectedPoint epoint;
BPH_mass_spring_get_motion_state(data, i, x, v);
- pd_point_from_loc(clmd->scene, x, v, i, &epoint);
- pdDoEffectors(effectors, NULL, clmd->sim_parms->effector_weights, &epoint, winvec[i], NULL);
+ pd_point_from_loc(scene, x, v, i, &epoint);
+ BKE_effectors_apply(effectors, NULL, clmd->sim_parms->effector_weights, &epoint, winvec[i], NULL);
}
for (i = 0; i < cloth->tri_num; i++) {
@@ -847,7 +850,9 @@ static void cloth_calc_volume_force(ClothModifierData *clmd)
/* old collision stuff for cloth, use for continuity
* until a good replacement is ready
*/
-static void cloth_collision_solve_extra(Object *ob, ClothModifierData *clmd, ListBase *effectors, float frame, float step, float dt)
+static void cloth_collision_solve_extra(
+ Depsgraph *depsgraph, Scene *scene, Object *ob, ClothModifierData *clmd, ListBase *effectors,
+ float frame, float step, float dt)
{
Cloth *cloth = clmd->clothObject;
Implicit_Data *id = cloth->implicit;
@@ -879,7 +884,8 @@ static void cloth_collision_solve_extra(Object *ob, ClothModifierData *clmd, Lis
// call collision function
// TODO: check if "step" or "step+dt" is correct - dg
- do_extra_solve = cloth_bvh_objcollision(ob, clmd, step / clmd->sim_parms->timescale, dt / clmd->sim_parms->timescale);
+ do_extra_solve = cloth_bvh_objcollision(
+ depsgraph, ob, clmd, step / clmd->sim_parms->timescale, dt / clmd->sim_parms->timescale);
// copy corrected positions back to simulation
for (i = 0; i < mvert_num; i++) {
@@ -915,7 +921,7 @@ static void cloth_collision_solve_extra(Object *ob, ClothModifierData *clmd, Lis
BPH_mass_spring_clear_forces(id);
// calculate forces
- cloth_calc_force(clmd, frame, effectors, step);
+ cloth_calc_force(scene, clmd, frame, effectors, step);
// calculate new velocity and position
BPH_mass_spring_solve_velocities(id, dt, &result);
@@ -967,12 +973,13 @@ static void cloth_record_result(ClothModifierData *clmd, ImplicitSolverResult *r
sres->status |= result->status;
}
-int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors)
+int BPH_cloth_solve(Depsgraph *depsgraph, Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors)
{
/* Hair currently is a cloth sim in disguise ...
* Collision detection and volumetrics work differently then.
* Bad design, TODO
*/
+ Scene *scene = DEG_get_evaluated_scene(depsgraph);
const bool is_hair = (clmd->hairdata != NULL);
unsigned int i=0;
@@ -1017,7 +1024,7 @@ int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *
if (is_hair) {
/* determine contact points */
if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED) {
- cloth_find_point_contacts(ob, clmd, 0.0f, tf, &contacts, &totcolliders);
+ cloth_find_point_contacts(depsgraph, ob, clmd, 0.0f, tf, &contacts, &totcolliders);
}
/* setup vertex constraints for pinned vertices and contacts */
@@ -1043,7 +1050,7 @@ int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *
}
// calculate forces
- cloth_calc_force(clmd, frame, effectors, step);
+ cloth_calc_force(scene, clmd, frame, effectors, step);
// calculate new velocity and position
BPH_mass_spring_solve_velocities(id, dt, &result);
@@ -1056,7 +1063,7 @@ int BPH_cloth_solve(Object *ob, float frame, ClothModifierData *clmd, ListBase *
BPH_mass_spring_solve_positions(id, dt);
if (!is_hair) {
- cloth_collision_solve_extra(ob, clmd, effectors, frame, step, dt);
+ cloth_collision_solve_extra(depsgraph, scene, ob, clmd, effectors, frame, step, dt);
}
BPH_mass_spring_apply_result(id);
diff --git a/source/blender/physics/intern/hair_volume.cpp b/source/blender/physics/intern/hair_volume.cpp
index b59ac46abbc..d2d43882a2d 100644
--- a/source/blender/physics/intern/hair_volume.cpp
+++ b/source/blender/physics/intern/hair_volume.cpp
@@ -1054,7 +1054,7 @@ static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd,
}
/* gather colliders */
- colliders = get_collider_cache(clmd->scene, NULL, NULL);
+ colliders = BKE_collider_cache_create(depsgraph, NULL, NULL);
if (colliders && collfac > 0.0f) {
for (col = colliders->first; col; col = col->next) {
MVert *loc0 = col->collmd->x;
@@ -1087,7 +1087,7 @@ static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd,
}
}
}
- free_collider_cache(&colliders);
+ BKE_collider_cache_free(&colliders);
/* divide velocity with density */
for (i = 0; i < size; i++) {
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index d32b8696c9c..394adb1dd3b 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -37,6 +37,7 @@
#include "BKE_customdata.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "DEG_depsgraph.h"
@@ -903,8 +904,9 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
bm = self->bm;
+ BLI_assert(BKE_id_is_in_gobal_main(&me->id));
BM_mesh_bm_to_me(
- G.main, /* XXX UGLY! */
+ G_MAIN, /* XXX UGLY! */
bm, me,
(&(struct BMeshToMeshParams){
.calc_object_remap = true,
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index bc96ce606a9..4e55495a0cd 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -713,4 +713,3 @@ void BPy_BM_init_types_meshdata(void)
bm_init_types_bmdvert();
bm_init_types_bmvertskin();
}
-
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 2305d448e04..d0f708b7e3c 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -114,6 +114,40 @@ static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
}
+PyDoc_STRVAR(py_blf_color_doc,
+".. function:: color(fontid, level, r, g, b, a)\n"
+"\n"
+" Set the color for drawing text.\n"
+"\n"
+" :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
+" :type fontid: int\n"
+" :arg r: red channel 0.0 - 1.0.\n"
+" :type r: float\n"
+" :arg g: green channel 0.0 - 1.0.\n"
+" :type g: float\n"
+" :arg b: blue channel 0.0 - 1.0.\n"
+" :type b: float\n"
+" :arg a: alpha channel 0.0 - 1.0.\n"
+" :type a: float\n"
+);
+static PyObject *py_blf_color(PyObject *UNUSED(self), PyObject *args)
+{
+ int fontid;
+ float rgba[4];
+
+ if (!PyArg_ParseTuple(
+ args, "iffff:blf.color",
+ &fontid, &rgba[0], &rgba[1], &rgba[2], &rgba[3]))
+ {
+ return NULL;
+ }
+
+ BLF_color4fv(fontid, rgba);
+
+ Py_RETURN_NONE;
+}
+
+
#if BLF_BLUR_ENABLE
PyDoc_STRVAR(py_blf_blur_doc,
".. function:: blur(fontid, radius)\n"
@@ -434,6 +468,7 @@ static PyMethodDef BLF_methods[] = {
{"shadow", (PyCFunction) py_blf_shadow, METH_VARARGS, py_blf_shadow_doc},
{"shadow_offset", (PyCFunction) py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
{"size", (PyCFunction) py_blf_size, METH_VARARGS, py_blf_size_doc},
+ {"color", (PyCFunction) py_blf_color, METH_VARARGS, py_blf_color_doc},
{"load", (PyCFunction) py_blf_load, METH_VARARGS, py_blf_load_doc},
{"unload", (PyCFunction) py_blf_unload, METH_VARARGS, py_blf_unload_doc},
{NULL, NULL, 0, NULL}
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 0211e7bd880..c1e5f947110 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -175,7 +175,7 @@ PyObject *bpy_text_import_name(const char *name, int *found)
Text *text;
char txtname[MAX_ID_NAME - 2];
int namelen = strlen(name);
-//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+//XXX Main *maggie = bpy_import_main ? bpy_import_main : G_MAIN;
Main *maggie = bpy_import_main;
*found = 0;
@@ -224,7 +224,7 @@ PyObject *bpy_text_reimport(PyObject *module, int *found)
Text *text;
const char *name;
const char *filepath;
-//XXX Main *maggie = bpy_import_main ? bpy_import_main:G.main;
+//XXX Main *maggie = bpy_import_main ? bpy_import_main : G_MAIN;
Main *maggie = bpy_import_main;
if (!maggie) {
diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c
index 2e32829bf6c..dfe4007e404 100644
--- a/source/blender/python/generic/imbuf_py_api.c
+++ b/source/blender/python/generic/imbuf_py_api.c
@@ -45,6 +45,8 @@
#include <errno.h>
#include "BLI_fileops.h"
+static PyObject *Py_ImBuf_CreatePyObject(ImBuf *ibuf);
+
/* -------------------------------------------------------------------- */
/** \name Type & Utilities
* \{ */
@@ -109,6 +111,27 @@ static PyObject *py_imbuf_resize(Py_ImBuf *self, PyObject *args, PyObject *kw)
Py_RETURN_NONE;
}
+PyDoc_STRVAR(py_imbuf_copy_doc,
+".. method:: copy()\n"
+"\n"
+" :return: A copy of the image.\n"
+" :rtype: :class:`ImBuf`\n"
+);
+static PyObject *py_imbuf_copy(Py_ImBuf *self)
+{
+ PY_IMBUF_CHECK_OBJ(self);
+ return Py_ImBuf_CreatePyObject(self->ibuf);
+}
+
+static PyObject *py_imbuf_deepcopy(Py_ImBuf *self, PyObject *args)
+{
+ if (!PyC_CheckArgs_DeepCopy(args)) {
+ return NULL;
+ }
+ return py_imbuf_copy(self);
+}
+
+
PyDoc_STRVAR(py_imbuf_free_doc,
".. method:: free()\n"
"\n"
@@ -126,6 +149,9 @@ static PyObject *py_imbuf_free(Py_ImBuf *self)
static struct PyMethodDef Py_ImBuf_methods[] = {
{"resize", (PyCFunction)py_imbuf_resize, METH_VARARGS | METH_KEYWORDS, (char *)py_imbuf_resize_doc},
{"free", (PyCFunction)py_imbuf_free, METH_NOARGS, (char *)py_imbuf_free_doc},
+ {"copy", (PyCFunction)py_imbuf_copy, METH_NOARGS, (char *)py_imbuf_copy_doc},
+ {"__copy__", (PyCFunction)py_imbuf_copy, METH_NOARGS, (char *)py_imbuf_copy_doc},
+ {"__deepcopy__", (PyCFunction)py_imbuf_deepcopy, METH_VARARGS, (char *)py_imbuf_copy_doc},
{NULL, NULL, 0, NULL}
};
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 22646462163..d2d78167fae 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -91,7 +91,7 @@ int PyC_AsArray_FAST(
}
}
else if (type == &PyBool_Type) {
- int *array_bool = array;
+ bool *array_bool = array;
for (i = 0; i < length; i++) {
array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0);
}
@@ -230,6 +230,12 @@ int PyC_ParseBool(PyObject *o, void *p)
return 1;
}
+/* silly function, we dont use arg. just check its compatible with __deepcopy__ */
+int PyC_CheckArgs_DeepCopy(PyObject *args)
+{
+ PyObject *dummy_pydict;
+ return PyArg_ParseTuple(args, "|O!:__deepcopy__", &PyDict_Type, &dummy_pydict) != 0;
+}
#ifndef MATH_STANDALONE
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 9f3c10bfd67..fef9171b4d4 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -106,6 +106,7 @@ bool PyC_RunString_AsString(const char *expr, const char *filename, char **r_val
int PyC_ParseBool(PyObject *o, void *p);
+int PyC_CheckArgs_DeepCopy(PyObject *args);
/* Integer parsing (with overflow checks), -1 on error. */
int PyC_Long_AsBool(PyObject *value);
diff --git a/source/blender/python/generic/python_utildefines.h b/source/blender/python/generic/python_utildefines.h
index 2d2d19c05f5..83880d82973 100644
--- a/source/blender/python/generic/python_utildefines.h
+++ b/source/blender/python/generic/python_utildefines.h
@@ -57,4 +57,3 @@ Py_LOCAL_INLINE(int) PyList_APPEND(PyObject *op, PyObject *v)
#endif
#endif /* __PYTHON_UTILDEFINES_H__ */
-
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index a0461ed945d..751625e378b 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -34,7 +34,7 @@
#include "BLI_string.h"
#include "BKE_appdir.h"
-#include "BKE_global.h" /* XXX, G.main only */
+#include "BKE_global.h" /* XXX, G_MAIN only */
#include "BKE_blender_version.h"
#include "BKE_bpath.h"
@@ -138,7 +138,7 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec
list = PyList_New(0);
- BKE_bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list);
+ BKE_bpath_traverse_main(G_MAIN, bpy_blend_paths_visit_cb, flag, (void *)list);
return list;
}
diff --git a/source/blender/python/intern/bpy_app_alembic.h b/source/blender/python/intern/bpy_app_alembic.h
index 8cc647a77df..773bb2fd3bf 100644
--- a/source/blender/python/intern/bpy_app_alembic.h
+++ b/source/blender/python/intern/bpy_app_alembic.h
@@ -35,4 +35,3 @@
PyObject *BPY_app_alembic_struct(void);
#endif /* __BPY_APP_ALEMBIC_H__ */
-
diff --git a/source/blender/python/intern/bpy_app_openvdb.h b/source/blender/python/intern/bpy_app_openvdb.h
index 12fa54ea7a3..ef712982695 100644
--- a/source/blender/python/intern/bpy_app_openvdb.h
+++ b/source/blender/python/intern/bpy_app_openvdb.h
@@ -35,4 +35,3 @@
PyObject *BPY_app_openvdb_struct(void);
#endif /* __BPY_APP_OPENVDB_H__ */
-
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
index 6ba858f0228..ffc54969d8c 100644
--- a/source/blender/python/intern/bpy_app_translations.c
+++ b/source/blender/python/intern/bpy_app_translations.c
@@ -824,4 +824,3 @@ void BPY_app_translations_end(void)
_clear_translations_cache();
#endif
}
-
diff --git a/source/blender/python/intern/bpy_library_write.c b/source/blender/python/intern/bpy_library_write.c
index ead10efb212..76b7ccf72fa 100644
--- a/source/blender/python/intern/bpy_library_write.c
+++ b/source/blender/python/intern/bpy_library_write.c
@@ -95,7 +95,7 @@ static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject
return NULL;
}
- Main *bmain_src = G.main;
+ Main *bmain_src = G_MAIN;
int write_flags = 0;
if (use_relative_remap) {
diff --git a/source/blender/python/intern/bpy_manipulator_wrap.c b/source/blender/python/intern/bpy_manipulator_wrap.c
index 9df4e81ec55..3703ea92fa7 100644
--- a/source/blender/python/intern/bpy_manipulator_wrap.c
+++ b/source/blender/python/intern/bpy_manipulator_wrap.c
@@ -233,4 +233,3 @@ void BPY_RNA_manipulatorgroup_wrapper(wmManipulatorGroupType *wgt, void *userdat
}
/** \} */
-
diff --git a/source/blender/python/intern/bpy_manipulator_wrap.h b/source/blender/python/intern/bpy_manipulator_wrap.h
index 3f739e26059..3e415350228 100644
--- a/source/blender/python/intern/bpy_manipulator_wrap.h
+++ b/source/blender/python/intern/bpy_manipulator_wrap.h
@@ -33,4 +33,3 @@ void BPY_RNA_manipulator_wrapper(struct wmManipulatorType *wt, void *userdata);
void BPY_RNA_manipulatorgroup_wrapper(struct wmManipulatorGroupType *wgt, void *userdata);
#endif /* __BPY_MANIPULATOR_WRAP_H__ */
-
diff --git a/source/blender/python/intern/bpy_msgbus.c b/source/blender/python/intern/bpy_msgbus.c
index 941d6b760dc..b76ecafe6f0 100644
--- a/source/blender/python/intern/bpy_msgbus.c
+++ b/source/blender/python/intern/bpy_msgbus.c
@@ -397,4 +397,3 @@ PyObject *BPY_msgbus_module(void)
}
/** \} */
-
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 9d57adca946..ae84d83b431 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -200,4 +200,3 @@ PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args)
return pyrna_struct_CreatePyObject(&ptr_otmacro);
}
-
diff --git a/source/blender/python/intern/bpy_path.c b/source/blender/python/intern/bpy_path.c
index 1d554b60bbe..f182972ba9c 100644
--- a/source/blender/python/intern/bpy_path.c
+++ b/source/blender/python/intern/bpy_path.c
@@ -64,4 +64,3 @@ PyObject *BPyInit__bpy_path(void)
return submodule;
}
-
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index d0b0331430d..edcc2bef0c5 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -263,7 +263,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc
}
}
-static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop)
+static bool bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop)
{
PyObject **py_data = RNA_property_py_data_get(prop);
PyObject *py_func;
@@ -273,7 +273,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
PyGILState_STATE gilstate;
bool use_gil;
const bool is_write_ok = pyrna_write_check();
- int value;
+ bool value;
BLI_assert(py_data != NULL);
@@ -301,12 +301,15 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
value = false;
}
else {
- value = PyC_Long_AsI32(ret);
+ int value_i = PyC_Long_AsBool(ret);
- if (value == -1 && PyErr_Occurred()) {
+ if (value_i == -1 && PyErr_Occurred()) {
PyC_Err_PrintWithFunc(py_func);
value = false;
}
+ else {
+ value = (bool)value_i;
+ }
Py_DECREF(ret);
}
@@ -321,7 +324,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p
return value;
}
-static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, int value)
+static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value)
{
PyObject **py_data = RNA_property_py_data_get(prop);
PyObject *py_func;
@@ -375,7 +378,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *
}
}
-static int bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, struct PropertyRNA *prop)
+static bool bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, struct PropertyRNA *prop)
{
PyObject *py_self;
PyObject *py_candidate;
@@ -420,7 +423,7 @@ static int bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, struc
return result;
}
-static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values)
+static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values)
{
PyObject **py_data = RNA_property_py_data_get(prop);
PyObject *py_func;
@@ -481,7 +484,7 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert
}
}
-static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values)
+static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values)
{
PyObject **py_data = RNA_property_py_data_get(prop);
PyObject *py_func;
@@ -511,7 +514,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert
self = pyrna_struct_as_instance(ptr);
PyTuple_SET_ITEM(args, 0, self);
- py_values = PyC_Tuple_PackArray_I32FromBool(values, len);
+ py_values = PyC_Tuple_PackArray_Bool(values, len);
PyTuple_SET_ITEM(args, 1, py_values);
ret = PyObject_CallObject(py_func, args);
@@ -2097,7 +2100,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
if (srna) {
const char *id = NULL, *name = NULL, *description = "";
int id_len;
- int def[PYRNA_STACK_ARRAY] = {0};
+ bool def[PYRNA_STACK_ARRAY] = {0};
int size = 3;
PropertyRNA *prop;
PyObject *pydef = NULL;
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index aa808118613..3e1c85d7f9f 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1667,7 +1667,7 @@ static int pyrna_py_to_prop(
return -1;
}
else {
- if (data) *((int *)data) = param;
+ if (data) *((bool *)data) = param;
else RNA_property_boolean_set(ptr, prop, param);
}
break;
@@ -2486,9 +2486,9 @@ static PyObject *pyrna_prop_array_subscript_slice(
}
case PROP_BOOLEAN:
{
- int values_stack[PYRNA_STACK_ARRAY];
- int *values;
- if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); }
+ bool values_stack[PYRNA_STACK_ARRAY];
+ bool *values;
+ if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(bool) * length); }
else { values = values_stack; }
RNA_property_boolean_get_array(ptr, prop, values);
@@ -2869,7 +2869,7 @@ static int prop_subscript_ass_array_slice__int_recursive(
}
static int prop_subscript_ass_array_slice__bool_recursive(
- PyObject **value_items, int *value,
+ PyObject **value_items, bool *value,
int totdim, const int dimsize[])
{
const int length = dimsize[0];
@@ -2992,9 +2992,9 @@ static int prop_subscript_ass_array_slice(
}
case PROP_BOOLEAN:
{
- int values_stack[PYRNA_STACK_ARRAY];
- int *values = (length_flat > PYRNA_STACK_ARRAY) ?
- (values_alloc = PyMem_MALLOC(sizeof(*values) * length_flat)) : values_stack;
+ bool values_stack[PYRNA_STACK_ARRAY];
+ bool *values = (length_flat > PYRNA_STACK_ARRAY) ?
+ (values_alloc = PyMem_MALLOC(sizeof(bool) * length_flat)) : values_stack;
if (start != 0 || stop != length) {
/* partial assignment? - need to get the array */
@@ -4986,6 +4986,8 @@ static bool foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, con
case PROP_RAW_INT:
if (attr_signed) return (f == 'i') ? 1 : 0;
else return (f == 'I') ? 1 : 0;
+ case PROP_RAW_BOOLEAN:
+ return (f == '?') ? 1 : 0;
case PROP_RAW_FLOAT:
return (f == 'f') ? 1 : 0;
case PROP_RAW_DOUBLE:
@@ -5052,6 +5054,9 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
case PROP_RAW_INT:
((int *)array)[i] = (int)PyLong_AsLong(item);
break;
+ case PROP_RAW_BOOLEAN:
+ ((bool *)array)[i] = (int)PyLong_AsLong(item) != 0;
+ break;
case PROP_RAW_FLOAT:
((float *)array)[i] = (float)PyFloat_AsDouble(item);
break;
@@ -5386,7 +5391,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
case PROP_BOOLEAN:
ret = PyTuple_New(len);
for (a = 0; a < len; a++)
- PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int *)data)[a]));
+ PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((bool *)data)[a]));
break;
case PROP_INT:
ret = PyTuple_New(len);
@@ -5429,7 +5434,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
/* see if we can coerce into a python type - PropertyType */
switch (type) {
case PROP_BOOLEAN:
- ret = PyBool_FromLong(*(int *)data);
+ ret = PyBool_FromLong(*(bool *)data);
break;
case PROP_INT:
ret = PyLong_FromLong(*(int *)data);
@@ -7090,7 +7095,7 @@ PyObject *BPY_rna_module(void)
PointerRNA ptr;
/* for now, return the base RNA type rather than a real module */
- RNA_main_pointer_create(G.main, &ptr);
+ RNA_main_pointer_create(G_MAIN, &ptr);
pyrna = (BPy_StructRNA *)pyrna_struct_CreatePyObject(&ptr);
rna_module_ptr = &pyrna->ptr;
@@ -7101,9 +7106,9 @@ void BPY_update_rna_module(void)
{
if (rna_module_ptr) {
#if 0
- RNA_main_pointer_create(G.main, rna_module_ptr);
+ RNA_main_pointer_create(G_MAIN, rna_module_ptr);
#else
- rna_module_ptr->data = G.main; /* just set data is enough */
+ rna_module_ptr->data = G_MAIN; /* just set data is enough */
#endif
}
}
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 7903f92265b..7012e04628c 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -45,6 +45,7 @@
#include "BKE_fcurve.h"
#include "BKE_global.h"
#include "BKE_idcode.h"
+#include "BKE_library.h"
#include "BKE_report.h"
#include "RNA_access.h"
@@ -267,13 +268,15 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
return PyBool_FromLong(result);
}
else {
+ ID *id = self->ptr.id.data;
struct Depsgraph *depsgraph = CTX_data_depsgraph(BPy_GetContext());
ReportList reports;
short result;
BKE_reports_init(&reports, RPT_STORE);
- result = insert_keyframe(G.main, depsgraph, &reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, keytype, options);
+ BLI_assert(BKE_id_is_in_gobal_main(id));
+ result = insert_keyframe(G_MAIN, depsgraph, &reports, id, NULL, group_name, path_full, index, cfra, keytype, options);
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index 571ee0edea2..9a184df8054 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -564,7 +564,7 @@ static void py_to_int(const struct ItemConvertArgData *arg, PyObject *py, char *
static void py_to_bool(const struct ItemConvertArgData *UNUSED(arg), PyObject *py, char *data)
{
- *(int *)data = (int)PyObject_IsTrue(py);
+ *(bool *)data = (bool)PyObject_IsTrue(py);
}
static int py_float_check(PyObject *py)
@@ -596,7 +596,7 @@ static void int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *v
static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value)
{
- RNA_property_boolean_set_index(ptr, prop, index, *(int *)value);
+ RNA_property_boolean_set_index(ptr, prop, index, *(bool *)value);
}
static void convert_item_init_float(
@@ -655,7 +655,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data,
convert_item_init_bool(ptr, prop, &convert_item);
ret = py_to_array(
- py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
+ py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(bool),
&convert_item, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
break;
}
@@ -885,10 +885,9 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
}
break;
}
- case PROP_BOOLEAN:
case PROP_INT:
{
- int value_i = PyLong_AsLong(value);
+ int value_i = PyC_Long_AsI32(value);
if (value_i == -1 && PyErr_Occurred()) {
PyErr_Clear();
return 0;
@@ -904,10 +903,40 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
tmp_arr = tmp;
}
- if (type == PROP_BOOLEAN)
- RNA_property_boolean_get_array(ptr, prop, tmp_arr);
- else
- RNA_property_int_get_array(ptr, prop, tmp_arr);
+ RNA_property_int_get_array(ptr, prop, tmp_arr);
+
+ for (i = 0; i < len; i++) {
+ if (tmp_arr[i] == value_i) {
+ break;
+ }
+ }
+
+ if (tmp_arr != tmp)
+ PyMem_FREE(tmp_arr);
+
+ return i < len ? 1 : 0;
+ }
+ break;
+ }
+ case PROP_BOOLEAN:
+ {
+ int value_i = PyC_Long_AsBool(value);
+ if (value_i == -1 && PyErr_Occurred()) {
+ PyErr_Clear();
+ return 0;
+ }
+ else {
+ bool tmp[32];
+ bool *tmp_arr;
+
+ if (len * sizeof(bool) > sizeof(tmp)) {
+ tmp_arr = PyMem_MALLOC(len * sizeof(bool));
+ }
+ else {
+ tmp_arr = tmp;
+ }
+
+ RNA_property_boolean_get_array(ptr, prop, tmp_arr);
for (i = 0; i < len; i++) {
if (tmp_arr[i] == value_i) {
diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c
index ee40d30d73b..4806c2266ba 100644
--- a/source/blender/python/intern/bpy_rna_id_collection.c
+++ b/source/blender/python/intern/bpy_rna_id_collection.c
@@ -160,7 +160,7 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
BPy_StructRNA *pyrna = (BPy_StructRNA *)self;
Main *bmain = pyrna->ptr.data;
#else
- Main *bmain = G.main; /* XXX Ugly, but should work! */
+ Main *bmain = G_MAIN; /* XXX Ugly, but should work! */
#endif
PyObject *subset = NULL;
@@ -230,7 +230,6 @@ static PyObject *bpy_user_map(PyObject *UNUSED(self), PyObject *args, PyObject *
lb_index = set_listbasepointers(bmain, lb_array);
while (lb_index--) {
-
if (val_types_bitmap && lb_array[lb_index]->first) {
if (!id_check_type(lb_array[lb_index]->first, val_types_bitmap)) {
continue;
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index e77470c070e..a3de9a3a7fd 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -105,4 +105,3 @@ PyObject *GPU_initPython(void)
PyDict_SetItem(PyImport_GetModuleDict(), PyModule_GetNameObject(module), module);
return module;
}
-
diff --git a/source/blender/python/intern/gpu_offscreen.c b/source/blender/python/intern/gpu_offscreen.c
index a65469ea739..f0bc4b79296 100644
--- a/source/blender/python/intern/gpu_offscreen.c
+++ b/source/blender/python/intern/gpu_offscreen.c
@@ -36,6 +36,7 @@
#include "WM_types.h"
#include "BKE_global.h"
+#include "BKE_library.h"
#include "ED_screen.h"
@@ -195,6 +196,8 @@ static PyObject *pygpu_offscreen_draw_view3d(BPy_GPUOffScreen *self, PyObject *a
return NULL;
}
+ BLI_assert(BKE_id_is_in_gobal_main(&scene->id));
+
fx = GPU_fx_compositor_create();
fx_settings = v3d->fx_settings; /* full copy */
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index 96ae0a9e50f..0c365ad192c 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -419,13 +419,6 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
}
#endif
-/* silly function, we dont use arg. just check its compatible with __deepcopy__ */
-int mathutils_deepcopy_args_check(PyObject *args)
-{
- PyObject *dummy_pydict;
- return PyArg_ParseTuple(args, "|O!:__deepcopy__", &PyDict_Type, &dummy_pydict) != 0;
-}
-
/* Mathutils Callbacks */
/* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index 01d2350d7fd..31ad75b3906 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -174,6 +174,4 @@ int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject
PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
#endif
-int mathutils_deepcopy_args_check(PyObject *args);
-
#endif /* __MATHUTILS_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 9997cd9c1f5..4c1163a6181 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -33,6 +33,7 @@
#include "BLI_utildefines.h"
#include "../generic/python_utildefines.h"
+#include "../generic/py_capi_utils.h"
#ifndef MATH_STANDALONE
# include "BLI_dynstr.h"
@@ -113,8 +114,9 @@ static PyObject *Color_copy(ColorObject *self)
}
static PyObject *Color_deepcopy(ColorObject *self, PyObject *args)
{
- if (!mathutils_deepcopy_args_check(args))
+ if (!PyC_CheckArgs_DeepCopy(args)) {
return NULL;
+ }
return Color_copy(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 026384743bd..8be3de42226 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -32,6 +32,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "../generic/python_utildefines.h"
+#include "../generic/py_capi_utils.h"
#ifndef MATH_STANDALONE
# include "BLI_dynstr.h"
@@ -312,8 +313,9 @@ static PyObject *Euler_copy(EulerObject *self)
}
static PyObject *Euler_deepcopy(EulerObject *self, PyObject *args)
{
- if (!mathutils_deepcopy_args_check(args))
+ if (!PyC_CheckArgs_DeepCopy(args)) {
return NULL;
+ }
return Euler_copy(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index cc6a5367895..70c400f99b8 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -33,6 +33,7 @@
#include "BLI_utildefines.h"
#include "../generic/python_utildefines.h"
+#include "../generic/py_capi_utils.h"
#ifndef MATH_STANDALONE
# include "BLI_string.h"
@@ -1945,8 +1946,9 @@ static PyObject *Matrix_copy(MatrixObject *self)
}
static PyObject *Matrix_deepcopy(MatrixObject *self, PyObject *args)
{
- if (!mathutils_deepcopy_args_check(args))
+ if (!PyC_CheckArgs_DeepCopy(args)) {
return NULL;
+ }
return Matrix_copy(self);
}
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index d283c717a46..1a6fd0ee86f 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -33,6 +33,7 @@
#include "BLI_utildefines.h"
#include "../generic/python_utildefines.h"
+#include "../generic/py_capi_utils.h"
#ifndef MATH_STANDALONE
# include "BLI_dynstr.h"
@@ -496,8 +497,9 @@ static PyObject *Quaternion_copy(QuaternionObject *self)
}
static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args)
{
- if (!mathutils_deepcopy_args_check(args))
+ if (!PyC_CheckArgs_DeepCopy(args)) {
return NULL;
+ }
return Quaternion_copy(self);
}
@@ -1393,4 +1395,3 @@ PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
return (PyObject *)self;
}
-
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 65450505e08..a06a63c8067 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -1331,8 +1331,9 @@ static PyObject *Vector_copy(VectorObject *self)
}
static PyObject *Vector_deepcopy(VectorObject *self, PyObject *args)
{
- if (!mathutils_deepcopy_args_check(args))
+ if (!PyC_CheckArgs_DeepCopy(args)) {
return NULL;
+ }
return Vector_copy(self);
}
diff --git a/source/blender/python/simple_enum_gen.py b/source/blender/python/simple_enum_gen.py
index eef19b6c5f1..95052ccae0c 100644
--- a/source/blender/python/simple_enum_gen.py
+++ b/source/blender/python/simple_enum_gen.py
@@ -59,7 +59,3 @@ for d in defs.split('\n'):
py_val = w[0]
print '\tPyModule_AddObject(mod, "%s", PyLong_FromSize_t(%s));' % (val, py_val)
-
-
-
-
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 2de355b92a5..1ca889f2347 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -153,16 +153,16 @@ void RE_result_load_from_file(struct RenderResult *result, struct ReportList *re
struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h, const char *layername, const char *viewname);
void RE_engine_update_result(RenderEngine *engine, struct RenderResult *result);
void RE_engine_add_pass(RenderEngine *engine, const char *name, int channels, const char *chan_id, const char *layername);
-void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, int cancel, int highlight, int merge_results);
+void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, bool cancel, bool highlight, bool merge_results);
struct RenderResult *RE_engine_get_result(struct RenderEngine *engine);
const char *RE_engine_active_view_get(RenderEngine *engine);
void RE_engine_active_view_set(RenderEngine *engine, const char *viewname);
-float RE_engine_get_camera_shift_x(RenderEngine *engine, struct Object *camera, int use_spherical_stereo);
-void RE_engine_get_camera_model_matrix(RenderEngine *engine, struct Object *camera, int use_spherical_stereo, float *r_modelmat);
-int RE_engine_get_spherical_stereo(RenderEngine *engine, struct Object *camera);
+float RE_engine_get_camera_shift_x(RenderEngine *engine, struct Object *camera, bool use_spherical_stereo);
+void RE_engine_get_camera_model_matrix(RenderEngine *engine, struct Object *camera, bool use_spherical_stereo, float *r_modelmat);
+bool RE_engine_get_spherical_stereo(RenderEngine *engine, struct Object *camera);
-int RE_engine_test_break(RenderEngine *engine);
+bool RE_engine_test_break(RenderEngine *engine);
void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info);
void RE_engine_update_progress(RenderEngine *engine, float progress);
void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float mem_peak);
@@ -194,4 +194,3 @@ void RE_bake_engine_set_engine_parameters(
struct Render *re, struct Main *bmain, struct Scene *scene);
#endif /* __RE_ENGINE_H__ */
-
diff --git a/source/blender/render/extern/include/RE_multires_bake.h b/source/blender/render/extern/include/RE_multires_bake.h
index 25a87969b58..983e95639b4 100644
--- a/source/blender/render/extern/include/RE_multires_bake.h
+++ b/source/blender/render/extern/include/RE_multires_bake.h
@@ -34,8 +34,10 @@
#define __RE_MULTIRES_BAKE_H__
struct MultiresBakeRender;
+struct Scene;
typedef struct MultiresBakeRender {
+ Scene *scene;
DerivedMesh *lores_dm, *hires_dm;
bool simple;
int bake_filter; /* Bake-filter, aka margin */
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index bde3c1c8cb3..cb32efb0b0f 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -312,10 +312,8 @@ void RE_draw_lock_cb (struct Render *re, void *handle, void (*f)(void *handle,
void RE_test_break_cb (struct Render *re, void *handle, int (*f)(void *handle));
void RE_current_scene_update_cb(struct Render *re, void *handle, void (*f)(void *handle, struct Scene *scene));
-/* TODO replace by a simple set and get draw manager. */
void RE_gl_context_create(Render *re);
void RE_gl_context_destroy(Render *re);
-void RE_gl_context_set(Render *re, void *gl_context);
void *RE_gl_context_get(Render *re);
void *RE_gwn_context_get(Render *re);
@@ -354,4 +352,3 @@ struct RenderView *RE_RenderViewGetByName(struct RenderResult *res, const char *
RenderResult *RE_DuplicateRenderResult(RenderResult *rr);
#endif /* __RE_PIPELINE_H__ */
-
diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h
index b8732e7cc5c..22a2176e16c 100644
--- a/source/blender/render/intern/include/initrender.h
+++ b/source/blender/render/intern/include/initrender.h
@@ -40,4 +40,3 @@ void RE_parts_free(Render *re);
void RE_parts_clamp(Render *re);
#endif /* __INITRENDER_H__ */
-
diff --git a/source/blender/render/intern/include/render_result.h b/source/blender/render/intern/include/render_result.h
index eebecc53101..3096949b49f 100644
--- a/source/blender/render/intern/include/render_result.h
+++ b/source/blender/render/intern/include/render_result.h
@@ -139,4 +139,3 @@ bool render_result_has_views(struct RenderResult *rr);
} ((void)0)
#endif /* __RENDER_RESULT_H__ */
-
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index 134fa56f01c..117b82570e7 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -161,7 +161,6 @@ struct Render {
/* TODO replace by a whole draw manager. */
void *gl_context;
void *gwn_context;
- bool gl_context_ownership;
};
/* **************** defines ********************* */
@@ -170,4 +169,3 @@ struct Render {
#define R_ANIMATION 1
#endif /* __RENDER_TYPES_H__ */
-
diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/include/renderpipeline.h
index 7a409d2dc1c..ef7094633a1 100644
--- a/source/blender/render/intern/include/renderpipeline.h
+++ b/source/blender/render/intern/include/renderpipeline.h
@@ -44,4 +44,3 @@ void render_update_anim_renderdata(struct Render *re, struct RenderData *rd, str
void render_copy_renderdata(struct RenderData *to, struct RenderData *from);
#endif /* __RENDERPIPELINE_H__ */
-
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h
index 71000e38960..04a456c0850 100644
--- a/source/blender/render/intern/include/texture.h
+++ b/source/blender/render/intern/include/texture.h
@@ -76,4 +76,3 @@ int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const floa
void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float result[4], struct ImagePool *pool);
#endif /* __TEXTURE_H__ */
-
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index 0654a4f8df6..0acc7d091e3 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -49,4 +49,3 @@ void zspan_scanconvert(struct ZSpan *zpan, void *handle, float *v1, float *v2, f
void (*func)(void *, int, int, float, float) );
#endif
-
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 7a9be04d8f6..5c3f510ffca 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -263,7 +263,7 @@ void RE_engine_add_pass(RenderEngine *engine, const char *name, int channels, co
render_result_add_pass(re->result, name, channels, chan_id, layername, NULL);
}
-void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel, int highlight, int merge_results)
+void RE_engine_end_result(RenderEngine *engine, RenderResult *result, bool cancel, bool highlight, bool merge_results)
{
Render *re = engine->re;
@@ -314,7 +314,7 @@ RenderResult *RE_engine_get_result(RenderEngine *engine)
/* Cancel */
-int RE_engine_test_break(RenderEngine *engine)
+bool RE_engine_test_break(RenderEngine *engine)
{
Render *re = engine->re;
@@ -407,7 +407,7 @@ void RE_engine_active_view_set(RenderEngine *engine, const char *viewname)
RE_SetActiveRenderView(re, viewname);
}
-float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, int use_spherical_stereo)
+float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, bool use_spherical_stereo)
{
Render *re = engine->re;
@@ -419,7 +419,7 @@ float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, int use
}
void RE_engine_get_camera_model_matrix(
- RenderEngine *engine, Object *camera, int use_spherical_stereo, float *r_modelmat)
+ RenderEngine *engine, Object *camera, bool use_spherical_stereo, float *r_modelmat)
{
Render *re = engine->re;
@@ -430,7 +430,7 @@ void RE_engine_get_camera_model_matrix(
BKE_camera_multiview_model_matrix(re ? &re->r : NULL, camera, re->viewname, (float (*)[4])r_modelmat);
}
-int RE_engine_get_spherical_stereo(RenderEngine *engine, Object *camera)
+bool RE_engine_get_spherical_stereo(RenderEngine *engine, Object *camera)
{
Render *re = engine->re;
return BKE_camera_multiview_spherical_stereo(re ? &re->r : NULL, camera) ? 1 : 0;
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 9611a8a7452..45caac4a37b 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -284,6 +284,3 @@ void RE_parts_init(Render *re)
}
}
}
-
-
-
diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/source/multires_bake.c
index d506028e306..0cb9fd7324b 100644
--- a/source/blender/render/intern/source/multires_bake.c
+++ b/source/blender/render/intern/source/multires_bake.c
@@ -688,7 +688,7 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
if (bkr->simple)
smd.subdivType = ME_SIMPLE_SUBSURF;
- height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
+ height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, bkr->scene, NULL, 0);
init_ccgdm_arrays(height_data->ssdm);
}
}
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 14ef7a3cb94..361324bf07c 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -1030,13 +1030,10 @@ void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle))
/* ********* GL Context ******** */
-/* Create the gl context of the Render.
- * It will be free by the render itself. */
void RE_gl_context_create(Render *re)
{
/* Needs to be created in the main ogl thread. */
re->gl_context = WM_opengl_context_create();
- re->gl_context_ownership = true;
}
void RE_gl_context_destroy(Render *re)
@@ -1048,22 +1045,11 @@ void RE_gl_context_destroy(Render *re)
re->gwn_context = NULL;
}
if (re->gl_context) {
- if (re->gl_context_ownership) {
- WM_opengl_context_dispose(re->gl_context);
- }
+ WM_opengl_context_dispose(re->gl_context);
re->gl_context = NULL;
}
}
-/* Manually set the gl context of the Render.
- * It won't be free by the render itself. */
-void RE_gl_context_set(Render *re, void *gl_context)
-{
- BLI_assert(gl_context); /* Cannot set NULL */
- re->gl_context = gl_context;
- re->gl_context_ownership = false;
-}
-
void *RE_gl_context_get(Render *re)
{
return re->gl_context;
@@ -2646,9 +2632,6 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)
RE_SetCamera(re, camera);
do_render_3d(re);
-
- /* Destroy the opengl context in the correct thread. */
- RE_gl_context_destroy(re);
}
/* note; repeated win/disprect calc... solve that nicer, also in compo */
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index c025a1fdef7..f51c472da8f 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -963,4 +963,3 @@ void RE_point_density_free(struct PointDensity *pd)
void RE_point_density_fix_linking(void)
{
}
-
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 99da5b3ca01..2841d96025e 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -1507,4 +1507,3 @@ int externtex(const MTex *mtex,
return (rgb != 0);
}
-
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index a2142b2d569..3d1ee273108 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -96,7 +96,7 @@ void WM_main (struct bContext *C) ATTR_NORETURN;
void WM_init_splash (struct bContext *C);
-void WM_init_opengl (void);
+void WM_init_opengl (struct Main *bmain);
void WM_check (struct bContext *C);
@@ -165,10 +165,11 @@ void WM_cursor_grab_enable(struct wmWindow *win, bool wrap, bool hide, int boun
void WM_cursor_grab_disable(struct wmWindow *win, const int mouse_ungrab_xy[2]);
void WM_cursor_time (struct wmWindow *win, int nr);
-void *WM_paint_cursor_activate(struct wmWindowManager *wm,
- int (*poll)(struct bContext *C),
- void (*draw)(struct bContext *C, int, int, void *customdata),
- void *customdata);
+void *WM_paint_cursor_activate(
+ struct wmWindowManager *wm,
+ bool (*poll)(struct bContext *C),
+ void (*draw)(struct bContext *C, int, int, void *customdata),
+ void *customdata);
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar);
@@ -283,7 +284,7 @@ int WM_operator_confirm (struct bContext *C, struct wmOperator *op, const str
int WM_operator_filesel (struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format);
/* poll callback, context checks */
-int WM_operator_winactive (struct bContext *C);
+bool WM_operator_winactive (struct bContext *C);
/* invoke callback, exec + redo popup */
int WM_operator_props_popup_confirm(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
int WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, const struct wmEvent *event);
@@ -326,8 +327,8 @@ struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const ch
struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname);
-int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot);
-int WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, short context);
+bool WM_operator_poll (struct bContext *C, struct wmOperatorType *ot);
+bool WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, short context);
int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, const bool store);
int WM_operator_call (struct bContext *C, struct wmOperator *op);
int WM_operator_call_notest(struct bContext *C, struct wmOperator *op);
@@ -422,6 +423,7 @@ char *WM_prop_pystring_assign(struct bContext *C, struct PointerRNA *ptr, struc
void WM_operator_bl_idname(char *to, const char *from);
void WM_operator_py_idname(char *to, const char *from);
bool WM_operator_py_idname_ok_or_report(struct ReportList *reports, const char *classname, const char *idname);
+const char *WM_context_member_from_ptr(struct bContext *C, const struct PointerRNA *ptr);
/* *************** uilist types ******************** */
void WM_uilisttype_init(void);
@@ -474,8 +476,9 @@ void WM_event_drag_image(struct wmDrag *, struct ImBuf *, float scale, int sx
void WM_drag_free(struct wmDrag *drag);
void WM_drag_free_list(struct ListBase *lb);
-struct wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event),
- void (*copy)(struct wmDrag *, struct wmDropBox *));
+struct wmDropBox *WM_dropbox_add(
+ ListBase *lb, const char *idname, bool (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event),
+ void (*copy)(struct wmDrag *, struct wmDropBox *));
ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid);
/* Set OpenGL viewport and scissor */
@@ -504,7 +507,6 @@ enum {
WM_JOB_TYPE_COMPOSITE,
WM_JOB_TYPE_RENDER,
WM_JOB_TYPE_RENDER_PREVIEW, /* UI preview */
- WM_JOB_TYPE_SCREENCAST,
WM_JOB_TYPE_OBJECT_SIM_OCEAN,
WM_JOB_TYPE_OBJECT_SIM_FLUID,
WM_JOB_TYPE_OBJECT_BAKE_TEXTURE,
@@ -602,6 +604,9 @@ bool WM_event_is_tablet(const struct wmEvent *event);
bool WM_event_is_ime_switch(const struct wmEvent *event);
#endif
+const char *WM_window_cursor_keymap_status_get(const struct wmWindow *win, int button_index, int type_index);
+void WM_window_cursor_keymap_status_refresh(struct bContext *C, struct wmWindow *win);
+
/* wm_tooltip.c */
typedef struct ARegion *(*wmTooltipInitFn)(struct bContext *, struct ARegion *, bool *);
@@ -618,4 +623,3 @@ void WM_tooltip_refresh(struct bContext *C, struct wmWindow *win);
#endif
#endif /* __WM_API_H__ */
-
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index 9390db400d2..d1f6d268835 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -81,7 +81,7 @@ bool WM_keymap_remove(struct wmKeyConfig *keyconfig, struct wmKeyMap *keymap);
bool WM_keymap_poll(struct bContext *C, struct wmKeyMap *keymap);
wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id);
-int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
+bool WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
/* Modal Keymap */
@@ -127,9 +127,14 @@ char *WM_key_event_operator_string(
const char *WM_bool_as_string(bool test);
+/* Minimal keymap, see: T55666, will eventually remove.
+ * Keep this until final design is settled on. */
+#if 0
+#define USE_WM_KEYMAP_27X
+#endif
+
#ifdef __cplusplus
}
#endif
#endif /* __WM_KEYMAP_H__ */
-
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 929617aab04..8e05822dd55 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -272,7 +272,6 @@ typedef struct wmNotifier {
/* NC_SCREEN */
#define ND_LAYOUTBROWSE (1<<16)
#define ND_LAYOUTDELETE (2<<16)
-#define ND_SCREENCAST (3<<16)
#define ND_ANIMPLAY (4<<16)
#define ND_GPENCIL (5<<16)
#define ND_EDITOR_CHANGED (6<<16) /*sent to new editors after switching to them*/
@@ -583,7 +582,7 @@ typedef struct wmOperatorType {
/* verify if the operator can be executed in the current context, note
* that the operator might still fail to execute even if this return true */
- int (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT;
+ bool (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT;
/* optional panel for redo and repeat, autogenerated if not set */
void (*ui)(struct bContext *, struct wmOperator *);
@@ -605,7 +604,7 @@ typedef struct wmOperatorType {
struct wmKeyMap *modalkeymap;
/* python needs the operator type as well */
- int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT;
+ bool (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT;
/* RNA integration */
ExtensionRNA ext;
@@ -675,7 +674,7 @@ typedef struct wmDropBox {
struct wmDropBox *next, *prev;
/* test if the dropbox is active, then can print optype name */
- int (*poll)(struct bContext *, struct wmDrag *, const wmEvent *);
+ bool (*poll)(struct bContext *, struct wmDrag *, const wmEvent *);
/* before exec, this copies drag info to wmDrop properties */
void (*copy)(struct wmDrag *, struct wmDropBox *);
@@ -731,4 +730,3 @@ extern struct CLG_LogRef *WM_LOG_MSGBUS_SUB;
#endif
#endif /* __WM_TYPES_H__ */
-
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 7eeea0f64ee..701ad49b520 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -549,5 +549,3 @@ void WM_main(bContext *C)
wm_draw_update(C);
}
}
-
-
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 16ed51cbd80..eca3a838c0f 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -97,8 +97,9 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
-wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext *, wmDrag *, const wmEvent *),
- void (*copy)(wmDrag *, wmDropBox *))
+wmDropBox *WM_dropbox_add(
+ ListBase *lb, const char *idname, bool (*poll)(bContext *, wmDrag *, const wmEvent *),
+ void (*copy)(wmDrag *, wmDropBox *))
{
wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox");
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 5efe9330f52..5b88268f416 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -782,6 +782,7 @@ void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(ar))
void wm_draw_update(bContext *C)
{
+ Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);
wmWindow *win;
@@ -789,7 +790,7 @@ void wm_draw_update(bContext *C)
BKE_subsurf_free_unused_buffers();
#endif
- GPU_free_unused_buffers();
+ GPU_free_unused_buffers(bmain);
for (win = wm->windows.first; win; win = win->next) {
#ifdef WIN32
@@ -852,4 +853,3 @@ void WM_redraw_windows(bContext *C)
CTX_wm_area_set(C, area_prev);
CTX_wm_region_set(C, ar_prev);
}
-
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e700a17b1ca..2a92eedf456 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -499,6 +499,14 @@ void wm_event_do_notifiers(bContext *C)
}
wm_event_do_refresh_wm_and_depsgraph(C);
+
+ /* Status bar */
+ if (wm->winactive) {
+ win = wm->winactive;
+ CTX_wm_window_set(C, win);
+ WM_window_cursor_keymap_status_refresh(C, win);
+ CTX_wm_window_set(C, NULL);
+ }
}
static int wm_event_always_pass(const wmEvent *event)
@@ -521,7 +529,7 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, const wmEven
/* UI code doesn't handle return values - it just always returns break.
* to make the DBL_CLICK conversion work, we just don't send this to UI, except mouse clicks */
if (((handler->flag & WM_HANDLER_ACCEPT_DBL_CLICK) == 0) &&
- (event->type != LEFTMOUSE) &&
+ !ISMOUSE_BUTTON(event->type) &&
(event->val == KM_DBL_CLICK))
{
return WM_HANDLER_CONTINUE;
@@ -590,7 +598,7 @@ static void wm_handler_ui_cancel(bContext *C)
/* ********************* operators ******************* */
-int WM_operator_poll(bContext *C, wmOperatorType *ot)
+bool WM_operator_poll(bContext *C, wmOperatorType *ot)
{
wmOperatorTypeMacro *otmacro;
@@ -611,7 +619,7 @@ int WM_operator_poll(bContext *C, wmOperatorType *ot)
}
/* sets up the new context and calls 'wm_operator_invoke()' with poll_only */
-int WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context)
+bool WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context)
{
return wm_operator_call_internal(C, ot, NULL, NULL, context, true);
}
@@ -2622,6 +2630,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
}
}
else if (event->val == KM_DBL_CLICK) {
+ /* The underlying event is a press, so try and handle this. */
event->val = KM_PRESS;
action |= wm_handlers_do_intern(C, event, handlers);
@@ -2772,6 +2781,40 @@ static bool wm_event_pie_filter(wmWindow *win, const wmEvent *event)
}
}
+#ifdef USE_WORKSPACE_TOOL
+static void wm_event_manipulator_temp_handler_apply(
+ bContext *C, ScrArea *sa, ARegion *ar, wmEventHandler *sneaky_handler)
+{
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
+ if (tref_rt && tref_rt->keymap[0]) {
+ wmKeyMap *km = WM_keymap_find_all(
+ C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW);
+ if (km != NULL) {
+ sneaky_handler->keymap = km;
+ sneaky_handler->keymap_tool = sa->runtime.tool;
+
+ /* Handle widgets first. */
+ wmEventHandler *handler_last = ar->handlers.last;
+ while (handler_last && handler_last->manipulator_map == NULL) {
+ handler_last = handler_last->prev;
+ }
+ /* Head of list or after last manipulator. */
+ BLI_insertlinkafter(&ar->handlers, handler_last, sneaky_handler);
+ }
+ }
+ }
+}
+
+static void wm_event_manipulator_temp_handler_clear(
+ bContext *UNUSED(C), ScrArea *UNUSED(sa), ARegion *ar, wmEventHandler *sneaky_handler)
+{
+ if (sneaky_handler->keymap) {
+ BLI_remlink(&ar->handlers, sneaky_handler);
+ }
+}
+#endif /* USE_WORKSPACE_TOOL */
+
/* called in main loop */
/* goes over entire hierarchy: events -> window -> screen -> area -> region */
void wm_event_do_handlers(bContext *C)
@@ -2956,33 +2999,13 @@ void wm_event_do_handlers(bContext *C)
* to fetch its current keymap.
*/
wmEventHandler sneaky_handler = {NULL};
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- bToolRef_Runtime *tref_rt = sa->runtime.tool ? sa->runtime.tool->runtime : NULL;
- if (tref_rt && tref_rt->keymap[0]) {
- wmKeyMap *km = WM_keymap_find_all(
- C, tref_rt->keymap, sa->spacetype, RGN_TYPE_WINDOW);
- if (km != NULL) {
- sneaky_handler.keymap = km;
- sneaky_handler.keymap_tool = sa->runtime.tool;
-
- /* Handle widgets first. */
- wmEventHandler *handler_last = ar->handlers.last;
- while (handler_last && handler_last->manipulator_map == NULL) {
- handler_last = handler_last->prev;
- }
- /* Head of list or after last manipulator. */
- BLI_insertlinkafter(&ar->handlers, handler_last, &sneaky_handler);
- }
- }
- }
+ wm_event_manipulator_temp_handler_apply(C, sa, ar, &sneaky_handler);
#endif /* USE_WORKSPACE_TOOL */
action |= wm_handlers_do(C, event, &ar->handlers);
#ifdef USE_WORKSPACE_TOOL
- if (sneaky_handler.keymap) {
- BLI_remlink(&ar->handlers, &sneaky_handler);
- }
+ wm_event_manipulator_temp_handler_clear(C, sa, ar, &sneaky_handler);
#endif /* USE_WORKSPACE_TOOL */
/* fileread case (python), [#29489] */
@@ -3946,7 +3969,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
/* if previous event was same type, and previous was release, and now it presses... */
if (wm_event_is_double_click(&event, evt)) {
CLOG_INFO(WM_LOG_HANDLERS, 1, "Send double click");
- evt->val = event.val = KM_DBL_CLICK;
+ event.val = KM_DBL_CLICK;
}
/* this case happens on holding a key pressed, it should not generate
@@ -4205,3 +4228,244 @@ bool WM_event_is_ime_switch(const struct wmEvent *event)
#endif
/** \} */
+
+
+static wmKeyMapItem *wm_kmi_from_event(
+ bContext *C, wmWindowManager *wm,
+ ListBase *handlers, const wmEvent *event)
+{
+ for (wmEventHandler *handler = handlers->first; handler; handler = handler->next) {
+ /* during this loop, ui handlers for nested menus can tag multiple handlers free */
+ if (handler->flag & WM_HANDLER_DO_FREE) {
+ /* pass */
+ }
+ else if (handler_boundbox_test(handler, event)) { /* optional boundbox */
+ if (handler->keymap) {
+ wmKeyMap *keymap = WM_keymap_active(wm, handler->keymap);
+ if (WM_keymap_poll(C, keymap)) {
+ for (wmKeyMapItem *kmi = keymap->items.first; kmi; kmi = kmi->next) {
+ if (wm_eventmatch(event, kmi)) {
+ wmOperatorType *ot = WM_operatortype_find(kmi->idname, 0);
+ if (WM_operator_poll_context(C, ot, WM_OP_INVOKE_DEFAULT)) {
+ return kmi;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
+/* -------------------------------------------------------------------- */
+/** \name Cursor Keymap Status
+ *
+ * Show cursor keys in the status bar.
+ * This is done by detecting changes to the state - full keymap lookups are expensive
+ * so only perform this on changing tools, space types, pressing different modifier keys... etc.
+ * \{ */
+
+/** State storage to detect changes between calls to refresh the information. */
+struct CursorKeymapInfo_State {
+ struct {
+ short shift, ctrl, alt, oskey;
+ } modifiers;
+ short space_type;
+ short region_type;
+ /* Never use, just compare memory for changes. */
+ bToolRef tref;
+};
+
+struct CursorKeymapInfo {
+ /* 0: mouse button index
+ * 1: event type (click/press, drag)
+ * 2: text.
+ */
+ char text[3][2][128];
+ wmEvent state_event;
+ struct CursorKeymapInfo_State state;
+};
+
+static void wm_event_cursor_store(
+ struct CursorKeymapInfo_State *state,
+ const wmEvent *event,
+ short space_type, short region_type,
+ const bToolRef *tref)
+{
+ state->modifiers.shift = event->shift;
+ state->modifiers.ctrl = event->ctrl;
+ state->modifiers.alt = event->alt;
+ state->modifiers.oskey = event->oskey;
+ state->space_type = space_type;
+ state->region_type = region_type;
+ state->tref = tref ? *tref : (bToolRef){0};
+}
+
+const char *WM_window_cursor_keymap_status_get(const wmWindow *win, int button_index, int type_index)
+{
+ if (win->cursor_keymap_status != NULL) {
+ struct CursorKeymapInfo *cd = win->cursor_keymap_status;
+ const char *msg = cd->text[button_index][type_index];
+ if (*msg) {
+ return msg;
+ }
+ }
+ return NULL;
+}
+
+void WM_window_cursor_keymap_status_refresh(bContext *C, struct wmWindow *win)
+{
+ bScreen *screen = WM_window_get_active_screen(win);
+ if (screen->state == SCREENFULL) {
+ return;
+ }
+ ScrArea *sa_statusbar = NULL;
+ for (ScrArea *sa = win->global_areas.areabase.first; sa; sa = sa->next) {
+ if (sa->spacetype == SPACE_STATUSBAR) {
+ sa_statusbar = sa;
+ break;
+ }
+ }
+ if (sa_statusbar == NULL) {
+ return;
+ }
+
+ struct CursorKeymapInfo *cd;
+ if (UNLIKELY(win->cursor_keymap_status == NULL)) {
+ win->cursor_keymap_status = MEM_callocN(sizeof(struct CursorKeymapInfo), __func__);
+ }
+ cd = win->cursor_keymap_status;
+
+ /* Detect unchanged state (early exit). */
+ if (memcmp(&cd->state_event, win->eventstate, sizeof(wmEvent)) == 0) {
+ return;
+ }
+
+ /* Now perform more comprehensive check,
+ * still keep this fast since it happens on mouse-move. */
+ struct CursorKeymapInfo cd_prev = *((struct CursorKeymapInfo *)win->cursor_keymap_status);
+ cd->state_event = *win->eventstate;
+
+ /* Find active region and associated area. */
+ ARegion *ar = screen->active_region;
+ if (ar == NULL) {
+ return;
+ }
+
+ ScrArea *sa = NULL;
+ ED_screen_areas_iter(win, screen, sa_iter) {
+ if (BLI_findindex(&sa_iter->regionbase, ar) != -1) {
+ sa = sa_iter;
+ break;
+ }
+ }
+ if (sa == NULL) {
+ return;
+ }
+
+ /* Keep as-is. */
+ if (ELEM(sa->spacetype, SPACE_STATUSBAR, SPACE_TOPBAR)) {
+ return;
+ }
+ if (ELEM(ar->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TEMPORARY, RGN_TYPE_HUD)) {
+ return;
+ }
+ /* Fallback to window. */
+ if (ELEM(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS)) {
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ }
+
+ /* Detect changes to the state. */
+ {
+ bToolRef *tref = NULL;
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ Scene *scene = WM_window_get_active_scene(win);
+ WorkSpace *workspace = WM_window_get_active_workspace(win);
+ const bToolKey tkey = {
+ .space_type = sa->spacetype,
+ .mode = WM_toolsystem_mode_from_spacetype(workspace, scene, sa, sa->spacetype),
+ };
+ tref = WM_toolsystem_ref_find(workspace, &tkey);
+ }
+ wm_event_cursor_store(&cd->state, win->eventstate, sa->spacetype, ar->regiontype, tref);
+ if (memcmp(&cd->state, &cd_prev.state, sizeof(cd->state)) == 0) {
+ return;
+ }
+ }
+
+ /* Changed context found, detect changes to keymap and refresh the status bar. */
+ const struct {
+ int button_index;
+ int type_index; /* 0: press or click, 1: drag. */
+ int event_type;
+ int event_value;
+ } event_data[] = {
+ {0, 0, LEFTMOUSE, KM_PRESS},
+ {0, 0, LEFTMOUSE, KM_CLICK},
+ {0, 1, EVT_TWEAK_L, KM_ANY},
+
+ {1, 0, MIDDLEMOUSE, KM_PRESS},
+ {1, 0, MIDDLEMOUSE, KM_CLICK},
+ {1, 1, EVT_TWEAK_M, KM_ANY},
+
+ {2, 0, RIGHTMOUSE, KM_PRESS},
+ {2, 0, RIGHTMOUSE, KM_CLICK},
+ {2, 1, EVT_TWEAK_R, KM_ANY},
+ };
+
+ for (int button_index = 0; button_index < 3; button_index++) {
+ cd->text[button_index][0][0] = '\0';
+ cd->text[button_index][1][0] = '\0';
+ }
+
+ CTX_wm_window_set(C, win);
+ CTX_wm_area_set(C, sa);
+ CTX_wm_region_set(C, ar);
+
+#ifdef USE_WORKSPACE_TOOL
+ wmEventHandler sneaky_handler = {NULL};
+ wm_event_manipulator_temp_handler_apply(C, sa, ar, &sneaky_handler);
+#endif
+
+ ListBase *handlers[] = {
+ &ar->handlers,
+ &sa->handlers,
+ &win->handlers,
+ };
+
+ wmWindowManager *wm = CTX_wm_manager(C);
+ for (int data_index = 0; data_index < ARRAY_SIZE(event_data); data_index++) {
+ const int button_index = event_data[data_index].button_index;
+ const int type_index = event_data[data_index].type_index;
+ if (cd->text[button_index][type_index][0] != 0) {
+ continue;
+ }
+ wmEvent test_event = *win->eventstate;
+ test_event.type = event_data[data_index].event_type;
+ test_event.val = event_data[data_index].event_value;
+ wmKeyMapItem *kmi = NULL;
+ for (int handler_index = 0; handler_index < ARRAY_SIZE(handlers); handler_index++) {
+ kmi = wm_kmi_from_event(C, wm, handlers[handler_index], &test_event);
+ if (kmi) {
+ break;
+ }
+ }
+ if (kmi) {
+ wmOperatorType *ot = WM_operatortype_find(kmi->idname, 0);
+ STRNCPY(cd->text[button_index][type_index], ot ? ot->name : kmi->idname);
+ }
+ }
+
+#ifdef USE_WORKSPACE_TOOL
+ wm_event_manipulator_temp_handler_clear(C, sa, ar, &sneaky_handler);
+#endif
+
+ if (memcmp(&cd_prev.text, &cd->text, sizeof(cd_prev.text)) != 0) {
+ ED_area_tag_redraw(sa_statusbar);
+ }
+
+ CTX_wm_window_set(C, NULL);
+}
+
+/** \} */
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index be805fa7b1f..f00ec500bc0 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1930,7 +1930,7 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
}
}
-static int wm_revert_mainfile_poll(bContext *UNUSED(C))
+static bool wm_revert_mainfile_poll(bContext *UNUSED(C))
{
return G.relbase_valid;
}
diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c
index c7d55b290f5..903795d6943 100644
--- a/source/blender/windowmanager/intern/wm_files_link.c
+++ b/source/blender/windowmanager/intern/wm_files_link.c
@@ -87,7 +87,7 @@
/* **************** link/append *************** */
-static int wm_link_append_poll(bContext *C)
+static bool wm_link_append_poll(bContext *C)
{
if (WM_operator_winactive(C)) {
/* linking changes active object which is pretty useful in general,
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 144bb38ae76..4366013084c 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -174,7 +174,7 @@ static void wm_gesture_draw_line(wmGesture *gt)
glGetFloatv(GL_VIEWPORT, viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 8.0f);
@@ -214,7 +214,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
glGetFloatv(GL_VIEWPORT, viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 8.0f);
@@ -248,7 +248,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
glGetFloatv(GL_VIEWPORT, viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 4.0f);
@@ -354,7 +354,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled)
glGetFloatv(GL_VIEWPORT, viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 2.0f);
@@ -385,7 +385,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
glGetFloatv(GL_VIEWPORT, viewport_size);
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
- immUniform1i("num_colors", 2); /* "advanced" mode */
+ immUniform1i("colors_len", 2); /* "advanced" mode */
immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2);
immUniform1f("dash_width", 8.0f);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index a14cbed6381..c1af7153b62 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -61,7 +61,6 @@
#include "BKE_blender_undo.h"
#include "BKE_context.h"
#include "BKE_screen.h"
-#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_library.h"
@@ -167,7 +166,7 @@ bool wm_start_with_console = false; /* used in creator.c */
**/
static bool opengl_is_init = false;
-void WM_init_opengl(void)
+void WM_init_opengl(Main *bmain)
{
/* must be called only once */
BLI_assert(opengl_is_init == false);
@@ -181,10 +180,10 @@ void WM_init_opengl(void)
DRW_opengl_context_create();
GPU_init();
- GPU_set_mipmap(true);
+ GPU_set_mipmap(bmain, true);
GPU_set_linear_mipmap(true);
- GPU_set_anisotropic(U.anisotropic_filter);
- GPU_set_gpu_mipmapping(U.use_gpu_mipmap);
+ GPU_set_anisotropic(bmain, U.anisotropic_filter);
+ GPU_set_gpu_mipmapping(bmain, U.use_gpu_mipmap);
GPU_pass_cache_init();
@@ -250,7 +249,7 @@ void WM_init(bContext *C, int argc, const char **argv)
/* sets 3D mouse deadzone */
WM_ndof_deadzone_set(U.ndof_deadzone);
#endif
- WM_init_opengl();
+ WM_init_opengl(G_MAIN);
UI_init();
BKE_studiolight_init();
@@ -491,7 +490,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
BKE_subsurf_osd_cleanup();
#endif
- GPU_free_unused_buffers();
+ GPU_free_unused_buffers(G_MAIN);
GPU_exit();
}
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index bcb4fffea87..9c435297069 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -166,7 +166,8 @@ static void wm_keyconfig_properties_update_ot(ListBase *km_lb)
static bool wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
{
return (STREQ(a->idname, b->idname) &&
- RNA_struct_equals(a->ptr, b->ptr, RNA_EQ_UNSET_MATCH_NONE) &&
+ /* We do not really care about which Main we pass here, tbh. */
+ RNA_struct_equals(G_MAIN, a->ptr, b->ptr, RNA_EQ_UNSET_MATCH_NONE) &&
(a->flag & KMI_INACTIVE) == (b->flag & KMI_INACTIVE) &&
a->propvalue == b->propvalue);
}
@@ -1366,7 +1367,7 @@ wmKeyMapItem *WM_key_event_operator(
return wm_keymap_item_find(C, opname, opcontext, properties, is_hotkey, true, r_keymap);
}
-int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
+bool WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
{
int k1type, k2type;
diff --git a/source/blender/windowmanager/intern/wm_operator_props.c b/source/blender/windowmanager/intern/wm_operator_props.c
index fa7ff85c874..d4fb7279abc 100644
--- a/source/blender/windowmanager/intern/wm_operator_props.c
+++ b/source/blender/windowmanager/intern/wm_operator_props.c
@@ -358,9 +358,9 @@ void WM_operator_properties_checker_interval(wmOperatorType *ot, bool nth_can_di
{
const int nth_default = nth_can_disable ? 1 : 2;
const int nth_min = min_ii(nth_default, 2);
- RNA_def_int(ot->srna, "nth", nth_default, nth_min, INT_MAX, "Nth Selection", "", nth_min, 100);
- RNA_def_int(ot->srna, "skip", 1, 1, INT_MAX, "Skip", "", 1, 100);
- RNA_def_int(ot->srna, "offset", 0, INT_MIN, INT_MAX, "Offset", "", -100, 100);
+ RNA_def_int(ot->srna, "nth", nth_default, nth_min, INT_MAX, "Nth Element", "Skip every Nth element", nth_min, 100);
+ RNA_def_int(ot->srna, "skip", 1, 1, INT_MAX, "Skip", "Number of elements to skip at once", 1, 100);
+ RNA_def_int(ot->srna, "offset", 0, INT_MIN, INT_MAX, "Offset", "Offset from the starting point", -100, 100);
}
void WM_operator_properties_checker_interval_from_op(
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 20c4d2700aa..fb4ff4ddb28 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -805,9 +805,8 @@ bool WM_operator_pystring_abbreviate(char *str, int str_len_max)
/* return NULL if no match is found */
#if 0
-static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
+static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr)
{
-
/* loop over all context items and do 2 checks
*
* - see if the pointer is in the context.
@@ -821,13 +820,9 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert
const char *member_found = NULL;
const char *member_id = NULL;
- char *prop_str = NULL;
- char *ret = NULL;
-
-
for (link = lb.first; link; link = link->next) {
const char *identifier = link->data;
- PointerRNA ctx_item_ptr = {{0}} // CTX_data_pointer_get(C, identifier); // XXX, this isnt working
+ PointerRNA ctx_item_ptr = {{0}}; // CTX_data_pointer_get(C, identifier); // XXX, this isnt working
if (ctx_item_ptr.type == NULL) {
continue;
@@ -848,36 +843,27 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert
}
}
}
+ BLI_freelistN(&lb);
if (member_found) {
- prop_str = RNA_path_property_py(ptr, prop, index);
- if (prop_str) {
- ret = BLI_sprintfN("bpy.context.%s.%s", member_found, prop_str);
- MEM_freeN(prop_str);
- }
+ return member_found;
}
else if (member_id) {
- prop_str = RNA_path_struct_property_py(ptr, prop, index);
- if (prop_str) {
- ret = BLI_sprintfN("bpy.context.%s.%s", member_id, prop_str);
- MEM_freeN(prop_str);
- }
+ return member_id;
+ }
+ else {
+ return NULL;
}
-
- BLI_freelistN(&lb);
-
- return ret;
}
+
#else
/* use hard coded checks for now */
-static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
+
+static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr)
{
const char *member_id = NULL;
- char *prop_str = NULL;
- char *ret = NULL;
-
if (ptr->id.data) {
#define CTX_TEST_PTR_ID(C, member, idptr) \
@@ -960,6 +946,8 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert
SpaceLink *space_data = CTX_wm_space_data(C);
CTX_TEST_PTR_DATA_TYPE(C, "space_data", RNA_Space, ptr, space_data);
+ CTX_TEST_PTR_DATA_TYPE(C, "space_data", RNA_View3DOverlay, ptr, space_data);
+ CTX_TEST_PTR_DATA_TYPE(C, "space_data", RNA_View3DShading, ptr, space_data);
CTX_TEST_PTR_DATA_TYPE(C, "area", RNA_Area, ptr, CTX_wm_area(C));
CTX_TEST_PTR_DATA_TYPE(C, "region", RNA_Region, ptr, CTX_wm_region(C));
@@ -974,23 +962,34 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert
default:
break;
}
-
- if (member_id) {
- prop_str = RNA_path_struct_property_py(ptr, prop, index);
- if (prop_str) {
- ret = BLI_sprintfN("bpy.context.%s.%s", member_id, prop_str);
- MEM_freeN(prop_str);
- }
- }
#undef CTX_TEST_PTR_ID
#undef CTX_TEST_PTR_ID_CAST
#undef CTX_TEST_SPACE_TYPE
}
- return ret;
+ return member_id;
}
#endif
+static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
+{
+ const char *member_id = wm_context_member_from_ptr(C, ptr);
+ char *ret = NULL;
+ if (member_id != NULL) {
+ char *prop_str = RNA_path_struct_property_py(ptr, prop, index);
+ if (prop_str) {
+ ret = BLI_sprintfN("bpy.context.%s.%s", member_id, prop_str);
+ MEM_freeN(prop_str);
+ }
+ }
+ return ret;
+}
+
+const char *WM_context_member_from_ptr(bContext *C, const PointerRNA *ptr)
+{
+ return wm_context_member_from_ptr(C, ptr);
+}
+
char *WM_prop_pystring_assign(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
{
char *lhs, *rhs, *ret;
@@ -1360,7 +1359,7 @@ bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFor
}
/* op->poll */
-int WM_operator_winactive(bContext *C)
+bool WM_operator_winactive(bContext *C)
{
if (CTX_wm_window(C) == NULL) return 0;
return 1;
@@ -2019,8 +2018,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
if (mt) {
UI_menutype_draw(C, mt, layout);
-// wmWindowManager *wm = CTX_wm_manager(C);
-// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, ICON_NONE);
+// uiItemM(layout, "USERPREF_MT_keyconfigs", U.keyconfigstr, ICON_NONE);
}
UI_block_emboss_set(block, UI_EMBOSS_PULLDOWN);
@@ -2157,7 +2155,7 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv
}
/* op->poll */
-static int wm_search_menu_poll(bContext *C)
+static bool wm_search_menu_poll(bContext *C)
{
if (CTX_wm_window(C) == NULL) {
return 0;
@@ -2278,7 +2276,7 @@ static void WM_OT_call_panel(wmOperatorType *ot)
/* this poll functions is needed in place of WM_operator_winactive
* while it crashes on full screen */
-static int wm_operator_winactive_normal(bContext *C)
+static bool wm_operator_winactive_normal(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
bScreen *screen;
@@ -2304,20 +2302,12 @@ static void WM_OT_window_close(wmOperatorType *ot)
static void WM_OT_window_new(wmOperatorType *ot)
{
- PropertyRNA *prop;
-
ot->name = "New Window";
ot->idname = "WM_OT_window_new";
ot->description = "Create a new Blender window";
ot->exec = wm_window_new_exec;
- ot->invoke = wm_window_new_invoke;
ot->poll = wm_operator_winactive_normal;
-
- prop = RNA_def_enum(ot->srna, "screen", DummyRNA_NULL_items, 0, "Screen", "");
- RNA_def_enum_funcs(prop, wm_window_new_screen_itemf);
- RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
- ot->prop = prop;
}
static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
@@ -2386,8 +2376,9 @@ static void WM_OT_console_toggle(wmOperatorType *ot)
* - draw(bContext): drawing callback for paint cursor
*/
-void *WM_paint_cursor_activate(wmWindowManager *wm, int (*poll)(bContext *C),
- wmPaintCursorDraw draw, void *customdata)
+void *WM_paint_cursor_activate(
+ wmWindowManager *wm, bool (*poll)(bContext *C),
+ wmPaintCursorDraw draw, void *customdata)
{
wmPaintCursor *pc = MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
@@ -2447,38 +2438,37 @@ static void radial_control_update_header(wmOperator *op, bContext *C)
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
- if (sa) {
- if (hasNumInput(&rc->num_input)) {
- char num_str[NUM_STR_REP_LEN];
- outputNumInput(&rc->num_input, num_str, &scene->unit);
- BLI_snprintf(msg, sizeof(msg), "%s: %s", RNA_property_ui_name(rc->prop), num_str);
- }
- else {
- const char *ui_name = RNA_property_ui_name(rc->prop);
- switch (rc->subtype) {
- case PROP_NONE:
- case PROP_DISTANCE:
- BLI_snprintf(msg, sizeof(msg), "%s: %0.4f", ui_name, rc->current_value);
- break;
- case PROP_PIXEL:
- BLI_snprintf(msg, sizeof(msg), "%s: %d", ui_name, (int)rc->current_value); /* XXX: round to nearest? */
- break;
- case PROP_PERCENTAGE:
- BLI_snprintf(msg, sizeof(msg), "%s: %3.1f%%", ui_name, rc->current_value);
- break;
- case PROP_FACTOR:
- BLI_snprintf(msg, sizeof(msg), "%s: %1.3f", ui_name, rc->current_value);
- break;
- case PROP_ANGLE:
- BLI_snprintf(msg, sizeof(msg), "%s: %3.2f", ui_name, RAD2DEGF(rc->current_value));
- break;
- default:
- BLI_snprintf(msg, sizeof(msg), "%s", ui_name); /* XXX: No value? */
- break;
- }
+ if (hasNumInput(&rc->num_input)) {
+ char num_str[NUM_STR_REP_LEN];
+ outputNumInput(&rc->num_input, num_str, &scene->unit);
+ BLI_snprintf(msg, sizeof(msg), "%s: %s", RNA_property_ui_name(rc->prop), num_str);
+ }
+ else {
+ const char *ui_name = RNA_property_ui_name(rc->prop);
+ switch (rc->subtype) {
+ case PROP_NONE:
+ case PROP_DISTANCE:
+ BLI_snprintf(msg, sizeof(msg), "%s: %0.4f", ui_name, rc->current_value);
+ break;
+ case PROP_PIXEL:
+ BLI_snprintf(msg, sizeof(msg), "%s: %d", ui_name, (int)rc->current_value); /* XXX: round to nearest? */
+ break;
+ case PROP_PERCENTAGE:
+ BLI_snprintf(msg, sizeof(msg), "%s: %3.1f%%", ui_name, rc->current_value);
+ break;
+ case PROP_FACTOR:
+ BLI_snprintf(msg, sizeof(msg), "%s: %1.3f", ui_name, rc->current_value);
+ break;
+ case PROP_ANGLE:
+ BLI_snprintf(msg, sizeof(msg), "%s: %3.2f", ui_name, RAD2DEGF(rc->current_value));
+ break;
+ default:
+ BLI_snprintf(msg, sizeof(msg), "%s", ui_name); /* XXX: No value? */
+ break;
}
- ED_area_headerprint(sa, msg);
}
+
+ ED_area_status_text(sa, msg);
}
static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *event)
@@ -3012,9 +3002,7 @@ static void radial_control_cancel(bContext *C, wmOperator *op)
rc->dial = NULL;
}
- if (sa) {
- ED_area_headerprint(sa, NULL);
- }
+ ED_area_status_text(sa, NULL);
WM_paint_cursor_end(wm, rc->cursor);
@@ -3954,7 +3942,10 @@ void wm_window_keymap(wmKeyConfig *keyconf)
wmKeyMapItem *kmi;
/* note, this doesn't replace existing keymap items */
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_verify_item(keymap, "WM_OT_window_new", WKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+#endif
+
#ifdef __APPLE__
WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_OSKEY, 0);
WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
@@ -3964,32 +3955,49 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0);
#endif
WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
+#endif
WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "WM_OT_link", OKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_add_item(keymap, "WM_OT_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
+#endif
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);
+#endif
WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", F2KEY, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "copy", true);
WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0);
+#endif
+
WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
+#ifdef USE_WM_KEYMAP_27X
WM_keymap_add_item(keymap, "WM_OT_doc_view_manual_ui_context", F1KEY, KM_PRESS, KM_ALT, 0);
/* debug/testing */
WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
+#else
+ WM_keymap_add_item(keymap, "WM_OT_doc_view_manual_ui_context", F1KEY, KM_PRESS, 0, 0);
+ WM_keymap_add_menu(keymap, "TOPBAR_MT_file_specials", F2KEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "WM_OT_search_menu", F3KEY, KM_PRESS, 0, 0);
+ WM_keymap_add_menu(keymap, "TOPBAR_MT_window_specials", F4KEY, KM_PRESS, 0, 0);
+#endif
/* menus that can be accessed anywhere in blender */
+ WM_keymap_add_item(keymap, "WM_OT_search_menu", ACCENTGRAVEKEY, KM_CLICK, 0, 0);
- WM_keymap_verify_item(keymap, "WM_OT_search_menu", ACCENTGRAVEKEY, KM_RELEASE, 0, 0);
+ WM_keymap_add_menu(keymap, "SCREEN_MT_user_menu", QKEY, KM_PRESS, 0, 0);
#ifdef WITH_INPUT_NDOF
WM_keymap_add_menu(keymap, "USERPREF_MT_ndof_settings", NDOF_BUTTON_MENU, KM_PRESS, 0, 0);
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 30b1d6237c4..8c062be2a00 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -67,6 +67,7 @@
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_batch.h"
+#include "GPU_init_exit.h"
#include "DNA_scene_types.h"
#include "ED_datafiles.h" /* for fonts */
@@ -1266,7 +1267,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
/* initialize OpenGL immediate mode */
g_WS.gwn_context = GWN_context_create();
- immInit();
+ GPU_init();
/* initialize the font */
BLF_init();
@@ -1540,7 +1541,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
GPU_shader_free_builtin_shaders();
- immDestroy();
+ GPU_exit();
if (g_WS.gwn_context) {
GWN_context_active_set(g_WS.gwn_context);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 076514cd73f..43231855162 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -70,6 +70,7 @@
#include "wm_window.h"
#include "wm_event_system.h"
+#include "ED_anim_api.h"
#include "ED_scene.h"
#include "ED_screen.h"
#include "ED_fileselect.h"
@@ -228,6 +229,10 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
if (win->eventstate) MEM_freeN(win->eventstate);
+ if (win->cursor_keymap_status) {
+ MEM_freeN(win->cursor_keymap_status);
+ }
+
wm_event_free_all(win);
wm_ghostwindow_destroy(wm, win);
@@ -266,26 +271,6 @@ wmWindow *wm_window_new(bContext *C)
return win;
}
-/**
- * A higher level version of copy that tests the new window can be added.
- */
-static wmWindow *wm_window_new_test(bContext *C)
-{
- wmWindow *win = wm_window_new(C);
-
- WM_check(C);
-
- if (win->ghostwin) {
- WM_event_add_notifier(C, NC_WINDOW | NA_ADDED, NULL);
- return win;
- }
- else {
- wmWindowManager *wm = CTX_wm_manager(C);
- wm_window_close(C, wm, win);
- return NULL;
- }
-}
-
/* part of wm_window.c api */
wmWindow *wm_window_copy(bContext *C, wmWindow *win_src, const bool duplicate_layout)
{
@@ -953,30 +938,7 @@ wmWindow *WM_window_open_temp(bContext *C, int x, int y, int sizex, int sizey, i
/* do additional setup for specific editor type */
if (type == WM_WINDOW_DRIVERS) {
- /* Configure editor - mode, tabs, framing */
- SpaceIpo *sipo = (SpaceIpo *)sa->spacedata.first;
- sipo->mode = SIPO_MODE_DRIVERS;
-
- ARegion *ar_props = BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if (ar_props) {
- UI_panel_category_active_set(ar_props, "Drivers");
-
- ar_props->flag &= ~RGN_FLAG_HIDDEN;
- /* XXX: Adjust width of this too? */
-
- ED_region_visibility_change_update(C, ar_props);
- }
-
- ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar_main) {
- /* XXX: Ideally we recenter based on the range instead... */
- ar_main->v2d.tot.xmin = -2.0f;
- ar_main->v2d.tot.ymin = -2.0f;
- ar_main->v2d.tot.xmax = 2.0f;
- ar_main->v2d.tot.ymax = 2.0f;
-
- ar_main->v2d.cur = ar_main->v2d.tot;
- }
+ ED_drivers_editor_init(C, sa);
}
if (sa->spacetype == SPACE_IMAGE)
@@ -1014,109 +976,17 @@ int wm_window_close_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
-static WorkSpaceLayout *wm_window_new_find_layout(wmOperator *op, WorkSpace *workspace)
+/* operator callback */
+int wm_window_new_exec(bContext *C, wmOperator *UNUSED(op))
{
- ListBase *listbase = BKE_workspace_layouts_get(workspace);
- const int layout_id = RNA_enum_get(op->ptr, "screen");
- int i = 0;
-
- for (WorkSpaceLayout *layout = listbase->first; layout; layout = layout->next) {
- if (i++ == layout_id) {
- return layout;
- }
- }
-
- BLI_assert(0);
- return NULL;
-}
-
-/* new window operator callback */
-int wm_window_new_exec(bContext *C, wmOperator *op)
-{
- Main *bmain = CTX_data_main(C);
wmWindow *win_src = CTX_wm_window(C);
- WorkSpace *workspace = WM_window_get_active_workspace(win_src);
- WorkSpaceLayout *layout_new = wm_window_new_find_layout(op, workspace);
- bScreen *screen_new = BKE_workspace_layout_screen_get(layout_new);
- wmWindow *win_dst;
+ bool ok;
- if ((win_dst = wm_window_new_test(C))) {
- if (screen_new->winid) {
- /* layout/screen is already used, duplicate it */
- layout_new = ED_workspace_layout_duplicate(bmain, workspace, layout_new, win_dst);
- screen_new = BKE_workspace_layout_screen_get(layout_new);
- }
- /* New window with a different screen but same workspace */
- WM_window_set_active_workspace(win_dst, workspace);
- WM_window_set_active_screen(win_dst, workspace, screen_new);
- win_dst->scene = win_src->scene;
- screen_new->winid = win_dst->winid;
- CTX_wm_window_set(C, win_dst);
-
- ED_screen_refresh(CTX_wm_manager(C), win_dst);
- }
+ ok = (wm_window_copy_test(C, win_src, true) != NULL);
- return (win_dst != NULL) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+ return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
-int wm_window_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
-{
- wmWindow *win = CTX_wm_window(C);
- WorkSpace *workspace = WM_window_get_active_workspace(win);
- ListBase *listbase = BKE_workspace_layouts_get(workspace);
-
- if (BLI_listbase_count_at_most(listbase, 2) == 1) {
- RNA_enum_set(op->ptr, "screen", 0);
- return wm_window_new_exec(C, op);
- }
- else {
- return WM_enum_search_invoke_previews(C, op, 6, 2);
- }
-}
-
-const EnumPropertyItem *wm_window_new_screen_itemf(
- bContext *C, struct PointerRNA *UNUSED(ptr), struct PropertyRNA *UNUSED(prop), bool *r_free)
-{
- if (C == NULL) {
- return DummyRNA_NULL_items;
- }
- wmWindow *win = CTX_wm_window(C);
- WorkSpace *workspace = WM_window_get_active_workspace(win);
- ListBase *listbase = BKE_workspace_layouts_get(workspace);
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- int value = 0, totitem = 0;
- int count_act_screens = 0;
- /* XXX setting max number of windows to 20. We'd need support
- * for dynamic strings in EnumPropertyItem.name to avoid this. */
- static char active_screens[20][MAX_NAME + 12];
-
- for (WorkSpaceLayout *layout = listbase->first; layout; layout = layout->next) {
- bScreen *screen = BKE_workspace_layout_screen_get(layout);
- const char *layout_name = BKE_workspace_layout_name_get(layout);
-
- if (screen->winid) {
- BLI_snprintf(active_screens[count_act_screens], sizeof(*active_screens), "%s (Duplicate)", layout_name);
- tmp.name = active_screens[count_act_screens++];
- }
- else {
- tmp.name = layout_name;
- }
-
- tmp.value = value;
- tmp.identifier = layout_name;
- UI_id_icon_render(C, CTX_data_scene(C), &screen->id, true, false);
- tmp.icon = BKE_icon_id_ensure(&screen->id);
-
- RNA_enum_item_add(&item, &totitem, &tmp);
- value++;
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
-}
/* fullscreen operator callback */
int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1444,11 +1314,6 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
state = GHOST_GetWindowState(win->ghostwin);
win->windowstate = state;
- /* stop screencast if resize */
- if (type == GHOST_kEventWindowSize) {
- WM_jobs_stop(wm, WM_window_get_active_screen(win), NULL);
- }
-
WM_window_set_dpi(win);
/* win32: gives undefined window size when minimized */
@@ -2148,22 +2013,37 @@ void WM_window_rect_calc(const wmWindow *win, rcti *r_rect)
*/
void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
{
- rcti rect;
+ rcti window_rect, screen_rect;
- BLI_rcti_init(&rect, 0, WM_window_pixels_x(win), 0, WM_window_pixels_y(win));
+ WM_window_rect_calc(win, &window_rect);
+ screen_rect = window_rect;
/* Substract global areas from screen rectangle. */
for (ScrArea *global_area = win->global_areas.areabase.first; global_area; global_area = global_area->next) {
+ int height = ED_area_global_size_y(global_area) - 1;
+
if (global_area->global->flag & GLOBAL_AREA_IS_HIDDEN) {
continue;
}
switch (global_area->global->align) {
case GLOBAL_AREA_ALIGN_TOP:
- rect.ymax -= ED_area_global_size_y(global_area);
+ if ((screen_rect.ymax - height) > window_rect.ymin) {
+ height += U.pixelsize;
+ }
+ if (screen_rect.ymax < (window_rect.ymax - 1)) {
+ height += U.pixelsize;
+ }
+ screen_rect.ymax -= height;
break;
case GLOBAL_AREA_ALIGN_BOTTOM:
- rect.ymin += ED_area_global_size_y(global_area);
+ if (screen_rect.ymin > window_rect.ymin) {
+ height += U.pixelsize;
+ }
+ if ((screen_rect.ymin + height) < (window_rect.ymax - 1)) {
+ height += U.pixelsize;
+ }
+ screen_rect.ymin += height;
break;
default:
BLI_assert(0);
@@ -2171,9 +2051,9 @@ void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
}
}
- BLI_assert(rect.xmin < rect.xmax);
- BLI_assert(rect.ymin < rect.ymax);
- *r_rect = rect;
+ BLI_assert(screen_rect.xmin < screen_rect.xmax);
+ BLI_assert(screen_rect.ymin < screen_rect.ymax);
+ *r_rect = screen_rect;
}
bool WM_window_is_fullscreen(wmWindow *win)
@@ -2318,14 +2198,13 @@ void *WM_opengl_context_create(void)
* So we should call this function only on the main thread.
*/
BLI_assert(BLI_thread_is_main());
- // BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_current_get() == 0);
return GHOST_CreateOpenGLContext(g_system);
}
void WM_opengl_context_dispose(void *context)
{
- // BLI_assert(BLI_thread_is_main());
- // BLI_assert(GPU_framebuffer_current_get() == 0);
+ BLI_assert(GPU_framebuffer_current_get() == 0);
GHOST_DisposeOpenGLContext(g_system, (GHOST_ContextHandle)context);
}
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group_type.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group_type.c
index 1b5225a2f04..b32eb84e289 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_group_type.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_group_type.c
@@ -195,4 +195,3 @@ void wm_manipulatorgrouptype_init(void)
}
/** \} */
-
diff --git a/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h b/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
index 7b294b9320f..a470c5c28ea 100644
--- a/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
+++ b/source/blender/windowmanager/manipulators/wm_manipulator_wmapi.h
@@ -95,4 +95,3 @@ struct ListBase *wm_manipulatormap_groups_get(wmManipulatorMap *mmap);
void wm_manipulatormaptypes_free(void);
#endif /* __WM_MANIPULATOR_WMAPI_H__ */
-
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index c92691eb65e..3605e57be36 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -42,7 +42,7 @@ typedef struct wmPaintCursor {
void *customdata;
- int (*poll)(struct bContext *C);
+ bool (*poll)(struct bContext *C);
void (*draw)(bContext *C, int, int, void *customdata);
} wmPaintCursor;
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
index 939409f9511..f863d8bfdd9 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -115,4 +115,3 @@ bool wm_cursor_arrow_move(struct wmWindow *win, const struct wmEvent *event);
#endif /* __WM_CURSORS_H__ */
-
diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h
index 3761cd043a2..1e0f3cd6b35 100644
--- a/source/blender/windowmanager/wm_draw.h
+++ b/source/blender/windowmanager/wm_draw.h
@@ -57,4 +57,3 @@ void wm_draw_region_blend(struct ARegion *ar, int view, bool blend);
struct GPUTexture *wm_draw_region_texture(struct ARegion *ar, int view);
#endif /* __WM_DRAW_H__ */
-
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index be648628079..3f98b6ef512 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -460,4 +460,3 @@ enum {
#endif /* __WM_EVENT_TYPES_H__ */
-
diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h
index 5b6022658db..e1725156012 100644
--- a/source/blender/windowmanager/wm_files.h
+++ b/source/blender/windowmanager/wm_files.h
@@ -68,4 +68,3 @@ void WM_OT_lib_relocate(struct wmOperatorType *ot);
void WM_OT_lib_reload(struct wmOperatorType *ot);
#endif /* __WM_FILES_H__ */
-
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index 436cf66df85..952ffe5c117 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -84,10 +84,7 @@ int wm_window_close_exec(bContext *C, struct wmOperator *op);
int wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op);
void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win) ATTR_NONNULL();
-const struct EnumPropertyItem *wm_window_new_screen_itemf(
- bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
int wm_window_new_exec(bContext *C, struct wmOperator *op);
-int wm_window_new_invoke(bContext *C, struct wmOperator *op, const struct wmEvent *event);
/* Initial (unmaximized) size to start with for
* systems that can't find it for themselves (X11).
@@ -97,4 +94,3 @@ int wm_window_new_invoke(bContext *C, struct wmOperator *op, const struct wmEv
#define WM_WIN_INIT_PAD 40
#endif /* __WM_WINDOW_H__ */
-
diff --git a/source/creator/creator.c b/source/creator/creator.c
index bda97fba863..6fd5771434c 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -236,6 +236,11 @@ int main(
struct CreatorAtExitData app_init_data = {NULL};
BKE_blender_atexit_register(callback_main_atexit, &app_init_data);
+ /* Unbuffered stdout makes stdout and stderr better synchronised, and helps
+ * when stepping through code in a debugger (prints are immediately
+ * visible). */
+ setvbuf(stdout, NULL, _IONBF, 0);
+
#ifdef WIN32
/* We delay loading of openmp so we can set the policy here. */
# if defined(_MSC_VER)
diff --git a/tests/gtests/blenlib/BLI_array_utils_test.cc b/tests/gtests/blenlib/BLI_array_utils_test.cc
index c4601e00fbd..6daa400a478 100644
--- a/tests/gtests/blenlib/BLI_array_utils_test.cc
+++ b/tests/gtests/blenlib/BLI_array_utils_test.cc
@@ -187,4 +187,3 @@ TEST(array_utils, BinaryOrInt4Mix)
BINARY_OR_TEST(data_cmp, data_a, data_b, data_combine, ARRAY_SIZE(data_cmp));
}
#undef BINARY_OR_TEST
-
diff --git a/tests/gtests/guardedalloc/guardedalloc_overflow_test.cc b/tests/gtests/guardedalloc/guardedalloc_overflow_test.cc
index 18cf57bd6ea..6f4df4fd047 100644
--- a/tests/gtests/guardedalloc/guardedalloc_overflow_test.cc
+++ b/tests/gtests/guardedalloc/guardedalloc_overflow_test.cc
@@ -58,4 +58,3 @@ TEST(guardedalloc, GuardedIntegerOverflow)
EXPECT_EXIT(MallocArray(SIZE_MAX, 12345567), ABORT_PREDICATE, "");
EXPECT_EXIT(CallocArray(SIZE_MAX, SIZE_MAX), ABORT_PREDICATE, "");
}
-
diff --git a/tests/gtests/testing/testing_main.cc b/tests/gtests/testing/testing_main.cc
index e8104a2a026..6f506d1a0cf 100644
--- a/tests/gtests/testing/testing_main.cc
+++ b/tests/gtests/testing/testing_main.cc
@@ -33,4 +33,3 @@ int main(int argc, char **argv) {
return RUN_ALL_TESTS();
}
-
diff --git a/tests/python/modules/render_report.py b/tests/python/modules/render_report.py
index 2e7a092b3d8..425e6d59fa0 100755
--- a/tests/python/modules/render_report.py
+++ b/tests/python/modules/render_report.py
@@ -444,4 +444,3 @@ class Report:
print_message("{}" . format(test), 'FAILURE', "FAILED")
return not bool(failed_tests)
-
diff --git a/tests/python/modules/test_utils.py b/tests/python/modules/test_utils.py
index c4496c3e3ac..2b762b4122c 100755
--- a/tests/python/modules/test_utils.py
+++ b/tests/python/modules/test_utils.py
@@ -102,4 +102,3 @@ class AbstractBlenderRunnerTest(unittest.TestCase):
self.fail('Error %d running Blender:\n%s' % (proc.returncode, output))
return output
-
diff --git a/tests/python/rna_array.py b/tests/python/rna_array.py
index dda13d2c3ae..0f6c0ce0a57 100644
--- a/tests/python/rna_array.py
+++ b/tests/python/rna_array.py
@@ -278,4 +278,3 @@ def suite():
if __name__ == "__main__":
unittest.TextTestRunner(verbosity=2).run(suite())
-