diff --git a/build_files/buildbot/buildbot_utils.py b/build_files/buildbot/buildbot_utils.py index 369bb28006d0..2dc1526c5e86 100644 --- a/build_files/buildbot/buildbot_utils.py +++ b/build_files/buildbot/buildbot_utils.py @@ -78,27 +78,26 @@ def __init__(self, builder): blender_h = os.path.join(builder.blender_dir, "source", "blender", "blenkernel", "BKE_blender_version.h") version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION')) - self.version = "%d.%d" % (version_number // 100, version_number % 100) - self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR') + version_number_patch = int(self._parse_header_file(blender_h, 'BLENDER_VERSION_PATCH')) + version_numbers = (version_number // 100, version_number % 100, version_number_patch) + self.short_version = "%d.%02d" % (version_numbers[0], version_numbers[1]) + self.version = "%d.%02d.%d" % version_numbers self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE') self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER') self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1] if self.version_cycle == "release": # Final release - self.full_version = self.version + self.version_char + self.full_version = self.version self.is_development_build = False elif self.version_cycle == "rc": # Release candidate version_cycle = self.version_cycle + self.version_cycle_number - if len(self.version_char) == 0: - self.full_version = self.version + version_cycle - else: - self.full_version = self.version + self.version_char + '-' + version_cycle + self.full_version = self.version + version_cycle self.is_development_build = False else: # Development build - self.full_version = self.version + self.version_char + '-' + self.hash + self.full_version = self.version + '-' + self.hash self.is_development_build = True def _parse_header_file(self, filename, define): diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py index 3cefe2d5ec63..8549a7881e6f 100644 --- a/build_files/buildbot/slave_pack.py +++ b/build_files/buildbot/slave_pack.py @@ -167,7 +167,7 @@ def pack_linux(builder): buildbot_utils.call(builder.command_prefix + ['strip', '--strip-all', blender_executable]) print("Stripping python...") - py_target = os.path.join(builder.install_dir, info.version) + py_target = os.path.join(builder.install_dir, info.short_version) buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';']) # Construct package name diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index d99e46ce76e7..a906dbc0bf4b 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -756,8 +756,7 @@ function(get_blender_version) # - BLENDER_VERSION (major.minor) # - BLENDER_VERSION_MAJOR # - BLENDER_VERSION_MINOR - # - BLENDER_SUBVERSION (used for internal versioning mainly) - # - BLENDER_VERSION_CHAR (a, b, c, ...or empty string) + # - BLENDER_VERSION_PATCH # - BLENDER_VERSION_CYCLE (alpha, beta, rc, release) # So cmake depends on BKE_blender.h, beware of inf-loops! @@ -767,25 +766,15 @@ function(get_blender_version) file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender_version.h _contents REGEX "^#define[ \t]+BLENDER_.*$") string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}") - string(REGEX REPLACE ".*#define[ \t]+BLENDER_SUBVERSION[ \t]+([0-9]+).*" "\\1" _out_subversion "${_contents}") - string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CHAR[ \t]+([a-z]+).*" "\\1" _out_version_char "${_contents}") + string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_PATCH[ \t]+([0-9]+).*" "\\1" _out_version_patch "${_contents}") string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}") if(NOT ${_out_version} MATCHES "[0-9]+") message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION") endif() - if(NOT ${_out_subversion} MATCHES "[0-9]+") - message(FATAL_ERROR "Version parsing failed for BLENDER_SUBVERSION") - endif() - - # clumsy regex, only single char are ok but it could be unset - - string(LENGTH "${_out_version_char}" _out_version_char_len) - if(NOT _out_version_char_len EQUAL 1) - set(_out_version_char "") - elseif(NOT ${_out_version_char} MATCHES "[a-z]+") - message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR") + if(NOT ${_out_version_patch} MATCHES "[0-9]+") + message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_PATCH") endif() if(NOT ${_out_version_cycle} MATCHES "[a-z]+") @@ -795,23 +784,11 @@ function(get_blender_version) math(EXPR _out_version_major "${_out_version} / 100") math(EXPR _out_version_minor "${_out_version} % 100") - # for packaging, alpha to numbers - string(COMPARE EQUAL "${_out_version_char}" "" _out_version_char_empty) - if(${_out_version_char_empty}) - set(_out_version_char_index "0") - else() - set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z) - list(FIND _char_ls ${_out_version_char} _out_version_char_index) - math(EXPR _out_version_char_index "${_out_version_char_index} + 1") - endif() - # output vars set(BLENDER_VERSION "${_out_version_major}.${_out_version_minor}" PARENT_SCOPE) set(BLENDER_VERSION_MAJOR "${_out_version_major}" PARENT_SCOPE) set(BLENDER_VERSION_MINOR "${_out_version_minor}" PARENT_SCOPE) - set(BLENDER_SUBVERSION "${_out_subversion}" PARENT_SCOPE) - set(BLENDER_VERSION_CHAR "${_out_version_char}" PARENT_SCOPE) - set(BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index}" PARENT_SCOPE) + set(BLENDER_VERSION_PATCH "${_out_version_patch}" PARENT_SCOPE) set(BLENDER_VERSION_CYCLE "${_out_version_cycle}" PARENT_SCOPE) endfunction() diff --git a/build_files/cmake/packaging.cmake b/build_files/cmake/packaging.cmake index 0e530463659d..de27d31323d5 100644 --- a/build_files/cmake/packaging.cmake +++ b/build_files/cmake/packaging.cmake @@ -7,7 +7,7 @@ set(PROJECT_VENDOR "Blender Foundation") set(MAJOR_VERSION ${BLENDER_VERSION_MAJOR}) set(MINOR_VERSION ${BLENDER_VERSION_MINOR}) -set(PATCH_VERSION ${BLENDER_VERSION_CHAR_INDEX}) +set(PATCH_VERSION ${BLENDER_VERSION_PATCH}) set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) set(CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION}) diff --git a/build_files/utils/make_source_archive.sh b/build_files/utils/make_source_archive.sh index cafd1c31486d..5d9096f32359 100644 --- a/build_files/utils/make_source_archive.sh +++ b/build_files/utils/make_source_archive.sh @@ -7,15 +7,14 @@ BASE_DIR="$PWD" blender_srcdir=$(dirname -- $0)/../.. blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') -blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') +blender_version_patch=$(grep "BLENDER_VERSION_PATCH\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') -blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') +VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100).$blender_version_patch if [ "$blender_version_cycle" = "release" ] ; then - VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)$blender_version_char SUBMODULE_EXCLUDE="^\(release/scripts/addons_contrib\)$" else - VERSION=$(expr $blender_version / 100).$(expr $blender_version % 100)_$blender_subversion + VERSION=$VERSION-$blender_version_cycle SUBMODULE_EXCLUDE="^$" # dummy regex fi diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 4780fe389cf1..9e81760a794b 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -403,32 +403,21 @@ def handle_args(): # -------------------------------BLENDER---------------------------------------- -blender_version_strings = [str(v) for v in bpy.app.version] -is_release = bpy.app.version_cycle in {"rc", "release"} - # converting bytes to strings, due to T30154 BLENDER_REVISION = str(bpy.app.build_hash, 'utf_8') -if is_release: - # '2.62a' - BLENDER_VERSION_DOTS = ".".join(blender_version_strings[:2]) + bpy.app.version_char -else: - # '2.62.1' - BLENDER_VERSION_DOTS = ".".join(blender_version_strings) +# '2.83.0 Beta' or '2.83.0' or '2.83.1' +BLENDER_VERSION_DOTS = bpy.app.version_string if BLENDER_REVISION != "Unknown": - # '2.62a SHA1' (release) or '2.62.1 SHA1' (non-release) + # SHA1 Git hash BLENDER_VERSION_HASH = BLENDER_REVISION else: # Fallback: Should not be used BLENDER_VERSION_HASH = "Hash Unknown" -if is_release: - # '2_62a_release' - BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char) -else: - # '2_62_1' - BLENDER_VERSION_PATH = "_".join(blender_version_strings) +# '2_83' +BLENDER_VERSION_PATH = "%d_%d" % (bpy.app.version[0], bpy.app.version[1]) # --------------------------DOWNLOADABLE FILES---------------------------------- diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 45cd6a229e57..1c5b9ec0b610 100644 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -36,16 +36,10 @@ fi blender_srcdir=$(dirname -- $0)/../.. blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}') -blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}') blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}') -blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}') unset blender_version_header -if [ "$blender_version_cycle" = "release" ] ; then - BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release" -else - BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)_$blender_subversion -fi +BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100) SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION diff --git a/doc/python_api/sphinx_doc_update.py b/doc/python_api/sphinx_doc_update.py index d3f42b1d26fa..6b24f4c4c091 100644 --- a/doc/python_api/sphinx_doc_update.py +++ b/doc/python_api/sphinx_doc_update.py @@ -127,11 +127,10 @@ def main(): " f.write('%d\\n' % is_release)\n" " f.write('%d\\n' % is_beta)\n" " f.write('%s\\n' % branch)\n" - " f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char))\n" - " f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" + " f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n" + " f.write('%d.%d\\n' % (bpy.app.version[0], bpy.app.version[1]))\n" " if (is_release or is_beta) else '%s\\n' % branch)\n" - " f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" - " if is_release else '%d_%d_%d' % bpy.app.version)\n" + " f.write('%d_%d' % (bpy.app.version[0], bpy.app.version[1]))\n" ) get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1", "--python-expr", getver_script, "--", getver_file) diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 31b096956325..dbe87ce2b13c 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -168,9 +168,13 @@ void BlenderSession::create_session() void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsgraph) { + /* Update data, scene and depsgraph pointers. These can change after undo. */ this->b_data = b_data; this->b_depsgraph = b_depsgraph; this->b_scene = b_depsgraph.scene_eval(); + if (sync) { + sync->reset(this->b_data, this->b_scene); + } if (preview_osl) { PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index f16305e737d1..2605799f5933 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -78,6 +78,14 @@ BlenderSync::~BlenderSync() { } +void BlenderSync::reset(BL::BlendData &b_data, BL::Scene &b_scene) +{ + /* Update data and scene pointers in case they change in session reset, + * for example after undo. */ + this->b_data = b_data; + this->b_scene = b_scene; +} + /* Sync */ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d) diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index 650b4f5bb4e0..f0ea5194c290 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -61,6 +61,8 @@ class BlenderSync { Progress &progress); ~BlenderSync(); + void reset(BL::BlendData &b_data, BL::Scene &b_scene); + /* sync */ void sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d); void sync_data(BL::RenderSettings &b_render, diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 75527d50c6af..c7737392e7bc 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -435,7 +435,7 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, ***************************************************************************************/ /** - * Returns the state of a modifier key (ouside the message queue). + * Returns the state of a modifier key (outside the message queue). * \param systemhandle The handle to the system * \param mask The modifier key state to retrieve. * \param isDown Pointer to return modifier state in. @@ -446,7 +446,7 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle, int *isDown); /** - * Returns the state of a mouse button (ouside the message queue). + * Returns the state of a mouse button (outside the message queue). * \param systemhandle The handle to the system * \param mask The button state to retrieve. * \param isDown Pointer to return button state in. diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 9b619f5c6844..33600fd1219a 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -382,7 +382,7 @@ class GHOST_ISystem { ***************************************************************************************/ /** - * Returns the state of a modifier key (ouside the message queue). + * Returns the state of a modifier key (outside the message queue). * \param mask The modifier key state to retrieve. * \param isDown The state of a modifier key (true == pressed). * \return Indication of success. @@ -390,7 +390,7 @@ class GHOST_ISystem { virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const = 0; /** - * Returns the state of a mouse button (ouside the message queue). + * Returns the state of a mouse button (outside the message queue). * \param mask The button state to retrieve. * \param isDown Button state. * \return Indication of success. diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index 0f58be49dfff..c2d712c11cd6 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -219,7 +219,7 @@ class GHOST_System : public GHOST_ISystem { ***************************************************************************************/ /** - * Returns the state of a modifier key (ouside the message queue). + * Returns the state of a modifier key (outside the message queue). * \param mask The modifier key state to retrieve. * \param isDown The state of a modifier key (true == pressed). * \return Indication of success. @@ -227,7 +227,7 @@ class GHOST_System : public GHOST_ISystem { GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const; /** - * Returns the state of a mouse button (ouside the message queue). + * Returns the state of a mouse button (outside the message queue). * \param mask The button state to retrieve. * \param isDown Button state. * \return Indication of success. @@ -247,8 +247,8 @@ class GHOST_System : public GHOST_ISystem { ***************************************************************************************/ /** - * Sets 3D mouse deadzone - * \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range + * Sets 3D mouse dead-zone + * \param deadzone: Dead-zone of the 3D mouse (both for rotation and pan) relative to full range. */ void setNDOFDeadZone(float deadzone); #endif @@ -295,7 +295,7 @@ class GHOST_System : public GHOST_ISystem { virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const = 0; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index d058697470a8..bbd6f1d89957 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -198,7 +198,7 @@ class GHOST_SystemCocoa : public GHOST_System { GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 633451feb856..31110694ea65 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -1527,7 +1527,7 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings, const bool exclusive, - const bool /*is_dialog*/, + const bool is_dialog, const GHOST_IWindow *parentWindow) { GHOST_WindowWayland *window = new GHOST_WindowWayland( @@ -1540,6 +1540,7 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title, state, parentWindow, type, + is_dialog, ((glSettings.flags & GHOST_glStereoVisual) != 0), exclusive); diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index b23f907608cb..6b7901c2ade1 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -212,7 +212,7 @@ class GHOST_SystemWin32 : public GHOST_System { GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index bb01ef7e0cc2..5888605ec95e 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -182,7 +182,7 @@ class GHOST_SystemX11 : public GHOST_System { GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ @@ -211,7 +211,7 @@ class GHOST_SystemX11 : public GHOST_System { } #endif - /* Helped function for get data from the clipboard. */ + /** Helped function for get data from the clipboard. */ void getClipboard_xcout(const XEvent *evt, Atom sel, Atom target, @@ -337,7 +337,7 @@ class GHOST_SystemX11 : public GHOST_System { private: Display *m_display; - /* Use for scancode lookups. */ + /** Use for scan-code look-ups. */ XkbDescRec *m_xkb_descr; #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) @@ -349,20 +349,22 @@ class GHOST_SystemX11 : public GHOST_System { std::vector m_xtablets; #endif - /// The vector of windows that need to be updated. + /** The vector of windows that need to be updated. */ std::vector m_dirty_windows; - /// Start time at initialization. + /** Start time at initialization. */ GHOST_TUns64 m_start_time; - /// A vector of keyboard key masks + /** A vector of keyboard key masks. */ char m_keyboard_vector[32]; - /* to prevent multiple warp, we store the time of the last warp event - * and stop accumulating all events generated before that */ + /** + * To prevent multiple warp, we store the time of the last warp event + * and stop accumulating all events generated before that. + */ Time m_last_warp; - /* detect autorepeat glitch */ + /* Detect auto-repeat glitch. */ unsigned int m_last_release_keycode; Time m_last_release_time; diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp index 0ea6f5f8ecba..ef02db7abc3f 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cpp +++ b/intern/ghost/intern/GHOST_WindowWayland.cpp @@ -39,6 +39,7 @@ struct window_t { bool is_maximised; bool is_fullscreen; bool is_active; + bool is_dialog; int32_t width, height; }; @@ -144,6 +145,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system, GHOST_TWindowState state, const GHOST_IWindow *parentWindow, GHOST_TDrawingContextType type, + const bool is_dialog, const bool stereoVisual, const bool exclusive) : GHOST_Window(width, height, state, stereoVisual, exclusive), @@ -155,6 +157,8 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system, w->width = int32_t(width); w->height = int32_t(height); + w->is_dialog = is_dialog; + /* Window surfaces. */ w->surface = wl_compositor_create_surface(m_system->compositor()); w->egl_window = wl_egl_window_create(w->surface, int(width), int(height)); @@ -376,6 +380,11 @@ GHOST_TSuccess GHOST_WindowWayland::endFullScreen() const return GHOST_kSuccess; } +bool GHOST_WindowWayland::isDialog() const +{ + return w->is_dialog; +} + /** * \param type The type of rendering context create. * \return Indication of success. diff --git a/intern/ghost/intern/GHOST_WindowWayland.h b/intern/ghost/intern/GHOST_WindowWayland.h index 39c35f77d7d7..23e55fcd6e4c 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.h +++ b/intern/ghost/intern/GHOST_WindowWayland.h @@ -42,6 +42,7 @@ class GHOST_WindowWayland : public GHOST_Window { GHOST_TWindowState state, const GHOST_IWindow *parentWindow, GHOST_TDrawingContextType type, + const bool is_dialog, const bool stereoVisual, const bool exclusive); @@ -106,6 +107,8 @@ class GHOST_WindowWayland : public GHOST_Window { GHOST_TSuccess endFullScreen() const override; + bool isDialog() const override; + private: GHOST_SystemWayland *m_system; struct window_t *w; diff --git a/release/datafiles/alert_icons.png b/release/datafiles/alert_icons.png index 5b6385b2325c..5ef8d6061761 100644 Binary files a/release/datafiles/alert_icons.png and b/release/datafiles/alert_icons.png differ diff --git a/release/datafiles/alert_icons.svg b/release/datafiles/alert_icons.svg index 0f30b4ad47b5..50a51afa5297 100644 --- a/release/datafiles/alert_icons.svg +++ b/release/datafiles/alert_icons.svg @@ -5,13 +5,14 @@ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="1280" height="256" id="svg2" sodipodi:version="0.32" - inkscape:version="0.92.3 (2405546, 2018-03-11)" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" version="1.0" sodipodi:docname="alert_icons.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" @@ -45,9 +46,9 @@ id="namedview5321" showgrid="true" inkscape:zoom="1" - inkscape:cx="935.85776" + inkscape:cx="677.60821" inkscape:cy="91.379624" - inkscape:window-x="1912" + inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:current-layer="layer2" @@ -112,37 +113,15 @@ id="rect6452" inkscape:connector-curvature="0" sodipodi:nodetypes="sssccsssssssccssssssssccccccccccccssssscscccccccccccccccccccccc" /> - - - - - - - + -# for full docs see... -# https://docs.blender.org/manual/en/latest/editors/uv_image/uv/editing/unwrapping/mapping_types.html#follow-active-quads - import bpy from bpy.types import Operator diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 0deae7c17317..db12ae19502e 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1106,8 +1106,8 @@ class WM_OT_doc_view(Operator): doc_id: doc_id if bpy.app.version_cycle in {"release", "rc", "beta"}: - _prefix = ("https://docs.blender.org/api/%d.%d%s" % - (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)) + _prefix = ("https://docs.blender.org/api/%d.%d" % + (bpy.app.version[0], bpy.app.version[1])) else: _prefix = ("https://docs.blender.org/api/master") @@ -2612,7 +2612,7 @@ def draw(self, context): layout = self.layout layout.operator_context = 'EXEC_DEFAULT' - layout.label(text="Blender is free software") + layout.label(text="UPBGE is free software") layout.label(text="Licensed under the GNU General Public License") layout.separator() layout.separator() @@ -2623,13 +2623,13 @@ def draw(self, context): col1 = split.column() - col1.operator("wm.url_open_preset", text="Release Notes", icon='URL').type = 'RELEASE_NOTES' + col1.operator("wm.url_open", text="Release Notes", icon='URL').url = "https://github.com/UPBGE/upbge/wiki/Release-notes" col1.operator("wm.url_open_preset", text="Credits", icon='URL').type = 'CREDITS' col1.operator("wm.url_open", text="License", icon='URL').url = "https://www.blender.org/about/license/" col2 = split.column() - col2.operator("wm.url_open_preset", text="Blender Website", icon='URL').type = 'BLENDER' + col2.operator("wm.url_open", text="UPBGE Website", icon='URL').url = "https://upbge.org" col2.operator("wm.url_open", text="Blender Store", icon='URL').url = "https://store.blender.org" col2.operator("wm.url_open_preset", text="Development Fund", icon='FUND').type = 'FUND' diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 71c6817abe9a..d58dec211be0 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -1449,7 +1449,9 @@ def VERTEX_WEIGHT_MIX(self, layout, ob, md): col = split.column() col.label(text="Vertex Group A:") - col.prop_search(md, "vertex_group_a", ob, "vertex_groups", text="") + row = col.row(align=True) + row.prop_search(md, "vertex_group_a", ob, "vertex_groups", text="") + row.prop(md, "invert_vertex_group_a", text="", icon='ARROW_LEFTRIGHT') col.label(text="Default Weight A:") col.prop(md, "default_weight_a", text="") @@ -1458,7 +1460,9 @@ def VERTEX_WEIGHT_MIX(self, layout, ob, md): col = split.column() col.label(text="Vertex Group B:") - col.prop_search(md, "vertex_group_b", ob, "vertex_groups", text="") + row = col.row(align=True) + row.prop_search(md, "vertex_group_b", ob, "vertex_groups", text="") + row.prop(md, "invert_vertex_group_b", text="", icon='ARROW_LEFTRIGHT') col.label(text="Default Weight B:") col.prop(md, "default_weight_b", text="") diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index dbe3ced04b38..5fadb31c83f8 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -125,7 +125,7 @@ def prop_unified( if unified_name and not header: # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 - row.prop(ups, unified_name, text="", icon="BRUSHES_ALL") + row.prop(ups, unified_name, text="", icon='BRUSHES_ALL') return row diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index ca25c29960c9..41c220f7ee42 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -307,12 +307,15 @@ def draw(self, context): layout.separator() layout.operator_context = 'INVOKE_DEFAULT' - layout.prop(st, "show_seconds") layout.prop(st, "show_locked_time") + + layout.separator() + layout.prop(st, "show_seconds") layout.prop(st, "show_strip_offset") layout.prop(st, "show_fcurves") - layout.separator() layout.prop(st, "show_markers") + layout.menu("SEQUENCER_MT_view_cache", text="Show Cache") + layout.prop_menu_enum(st, "waveform_display_type", text="Show Waveforms") if is_preview: layout.separator() @@ -324,12 +327,6 @@ def draw(self, context): elif st.display_mode == 'WAVEFORM': layout.prop(st, "show_separate_color", text="Show Separate Color Channels") - if is_sequencer_view: - layout.separator() - - layout.menu("SEQUENCER_MT_view_cache") - layout.prop_menu_enum(st, "waveform_display_type") - layout.separator() layout.operator("render.opengl", text="Sequence Render Image", icon='RENDER_STILL').sequencer = True @@ -338,7 +335,7 @@ def draw(self, context): props.sequencer = True layout.separator() - layout.operator("sequencer.export_subtitles", text="Export Subtitles", icon="EXPORT") + layout.operator("sequencer.export_subtitles", text="Export Subtitles", icon='EXPORT') layout.separator() @@ -1033,10 +1030,14 @@ def draw(self, context): if strip.input_count > 0: col = layout.column() - col.enabled = False - col.prop(strip, "input_1") + row = col.row() + row.prop(strip, "input_1") + if strip.input_count > 1: - col.prop(strip, "input_2") + row.operator("sequencer.swap_inputs", text="", icon='SORT_ASC') + row = col.row() + row.prop(strip, "input_2") + row.operator("sequencer.swap_inputs", text="", icon='SORT_DESC') strip_type = strip.type @@ -1195,31 +1196,14 @@ def draw(self, context): col.prop(strip, "font_size") col.prop(strip, "color") - -class SEQUENCER_PT_effect_text_style_shadow(SequencerButtonsPanel, Panel): - bl_label = "Shadow" - bl_parent_id = "SEQUENCER_PT_effect_text_style" - bl_options = {'DEFAULT_CLOSED'} - bl_category = "Strip" - - @classmethod - def poll(cls, context): - strip = act_strip(context) - return strip.type != 'SOUND' - - def draw_header(self, context): - strip = act_strip(context) - self.layout.prop(strip, "use_shadow", text="") - - def draw(self, context): - strip = act_strip(context) - layout = self.layout - layout.use_property_split = True - - layout.active = strip.use_shadow and (not strip.mute) - - col = layout.column(align=True) - col.prop(strip, "shadow_color", text="Color") + row = layout.row(align=True, heading="Shadow") + row.use_property_decorate = False + sub = row.row(align=True) + sub.prop(strip, "use_shadow", text="") + subsub = sub.row(align=True) + subsub.active = strip.use_shadow and (not strip.mute) + subsub.prop(strip, "shadow_color", text="") + row.prop_decorator(strip, "shadow_color") class SEQUENCER_PT_source(SequencerButtonsPanel, Panel): @@ -1931,7 +1915,7 @@ def draw(self, context): class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): - bl_label = "Scene Preview/Render" + bl_label = "Scene Strip Display" bl_space_type = 'SEQUENCE_EDITOR' bl_region_type = 'UI' bl_options = {'DEFAULT_CLOSED'} @@ -1945,7 +1929,7 @@ def draw(self, context): render = context.scene.render col = layout.column() - col.prop(render, "sequencer_gl_preview", text="Preview Shading") + col.prop(render, "sequencer_gl_preview", text="Shading") if render.sequencer_gl_preview in {'SOLID', 'WIREFRAME'}: col.prop(render, "use_sequencer_override_scene_strip") @@ -2232,10 +2216,16 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): SEQUENCER_MT_strip_input, SEQUENCER_MT_strip_lock_mute, SEQUENCER_MT_context_menu, + SEQUENCER_PT_active_tool, SEQUENCER_PT_strip, SEQUENCER_PT_effect, + SEQUENCER_PT_scene, + SEQUENCER_PT_mask, + SEQUENCER_PT_effect_text_style, + SEQUENCER_PT_effect_text_layout, + SEQUENCER_PT_adjust, SEQUENCER_PT_adjust_comp, SEQUENCER_PT_adjust_transform, @@ -2245,12 +2235,6 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): SEQUENCER_PT_adjust_color, SEQUENCER_PT_adjust_sound, - SEQUENCER_PT_scene, - SEQUENCER_PT_mask, - SEQUENCER_PT_effect_text_style, - SEQUENCER_PT_effect_text_layout, - SEQUENCER_PT_effect_text_style_shadow, - SEQUENCER_PT_time, SEQUENCER_PT_source, @@ -2263,11 +2247,11 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): SEQUENCER_PT_custom_props, - SEQUENCER_PT_preview, SEQUENCER_PT_view, SEQUENCER_PT_frame_overlay, SEQUENCER_PT_view_safe_areas, SEQUENCER_PT_view_safe_areas_center_cut, + SEQUENCER_PT_preview, SEQUENCER_PT_annotation, SEQUENCER_PT_annotation_onion, diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 5a36f6bb0813..63fc44aed389 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -222,7 +222,7 @@ def draw_centered(self, context, layout): flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) - flow.prop(view, "use_text_antialiasing", text="Anti-aliasing") + flow.prop(view, "use_text_antialiasing", text="Anti-Aliasing") sub = flow.column() sub.active = view.use_text_antialiasing sub.prop(view, "text_hinting", text="Hinting") diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4e389e847098..83f216873ff3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -736,7 +736,12 @@ def draw(self, context): row.prop(tool_settings, "use_gpencil_vertex_select_mask_stroke", text="") row.prop(tool_settings, "use_gpencil_vertex_select_mask_segment", text="") - if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or gpd.is_stroke_weight_mode or gpd.is_stroke_vertex_mode: + if ( + gpd.use_stroke_edit_mode or + gpd.is_stroke_sculpt_mode or + gpd.is_stroke_weight_mode or + gpd.is_stroke_vertex_mode + ): row = layout.row(align=True) row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING') diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 5cd7bb192060..3feba4b3a66a 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -34,19 +34,6 @@ void BKE_blender_free(void); void BKE_blender_globals_init(void); void BKE_blender_globals_clear(void); -void BKE_blender_version_string(char *version_str, - size_t maxncpy, - short version, - short subversion, - bool v_prefix, - bool include_subversion); - -void BKE_upbge_version_string(char *version_str, - size_t maxncpy, - short version, - short subversion, - bool v_prefix, - bool include_subversion); void BKE_blender_userdef_data_swap(struct UserDef *userdef_dst, struct UserDef *userdef_src); void BKE_blender_userdef_data_set(struct UserDef *userdef); diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 2173df7cdc78..3036d7db44bd 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -30,30 +30,37 @@ extern "C" { * * \note Use #STRINGIFY() rather than defining with quotes. */ -#define BLENDER_VERSION 290 -#define BLENDER_SUBVERSION 4 -/** Several breakages with 280, e.g. collections vs layers. */ -#define BLENDER_MINVERSION 280 -#define BLENDER_MINSUBVERSION 0 -#define UPBGE_VERSION 3 -#define UPBGE_SUBVERSION 0 +/* Blender major and minor version. */ +#define BLENDER_VERSION 290 +#define UPBGE_VERSION 30 -/** Used by packaging tools. */ -/** Can be left blank, otherwise a,b,c... etc with no quotes. */ -#define BLENDER_VERSION_CHAR -/** alpha/beta/rc/release, docs use this. */ +/* Blender patch version for bugfix releases. */ +#define BLENDER_VERSION_PATCH 0 +/** Blender release cycle stage: alpha/beta/rc/release. */ #define BLENDER_VERSION_CYCLE alpha -/** Optionally set to 1,2,... for example to get alpha1 or rc2. */ -#define BLENDER_VERSION_CYCLE_NUMBER -#define UPBGE_VERSION_CHAR +#define UPBGE_VERSION_PATCH 0 /** alpha/beta/rc/release, docs use this. */ #define UPBGE_VERSION_CYCLE alpha -/** Defined in from blender.c */ -extern char versionstr[]; -extern char upbge_versionstr[]; +/* Blender file format version. */ +#define BLENDER_FILE_VERSION BLENDER_VERSION +#define BLENDER_FILE_SUBVERSION 4 + +/* UPBGE file format version. */ +#define UPBGE_FILE_VERSION UPBGE_VERSION +#define UPBGE_FILE_SUBVERSION 0 + +/* Minimum Blender version that supports reading file written with the current + * version. Older Blender versions will test this and show a warning if the file + * was written with too new a version. */ +#define BLENDER_FILE_MIN_VERSION 280 +#define BLENDER_FILE_MIN_SUBVERSION 0 + +/** User readable version string. */ +const char *BKE_blender_version_string(void); +const char *BKE_upbge_version_string(void); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 3f07461bb49e..a48f2a5a8c4e 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -87,8 +87,8 @@ enum { typedef struct Main { struct Main *next, *prev; char name[1024]; /* 1024 = FILE_MAX */ - short versionfile, subversionfile; /* see BLENDER_VERSION, BLENDER_SUBVERSION */ - short upbgeversionfile, upbgesubversionfile; + short versionfile, subversionfile; /* see BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION */ + short upbgeversionfile, upbgesubversionfile; /* see UPBGE_FILE_VERSION, UPBGE_FILE_SUBVERSION */ short minversionfile, minsubversionfile; uint64_t build_commit_timestamp; /* commit's timestamp from buildinfo */ char build_hash[16]; /* hash from buildinfo */ diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index eceb161c4bed..8ea84327f030 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -236,17 +236,17 @@ typedef struct PanelType { /** Reorder function, called when drag and drop finishes. */ void (*reorder)(struct bContext *C, struct Panel *pa, int new_index); /** - * Get the panel and subpanel's expansion state from the expansion flag in the corresponding data - * item. Called on draw updates. - * \note Subpanels are indexed in depth first order, the visualorder you would see if all panels - * were expanded. + * Get the panel and sub-panel's expansion state from the expansion flag in the corresponding + * data item. Called on draw updates. + * \note Sub-panels are indexed in depth first order, + * the visual order you would see if all panels were expanded. */ short (*get_list_data_expand_flag)(const struct bContext *C, struct Panel *pa); /** - * Set the expansion bitfield from the closed / open state of this panel and its subpanels. + * Set the expansion bit-field from the closed / open state of this panel and its sub-panels. * Called when the expansion state of the panel changes with user input. - * \note Subpanels are indexed in depth first order, the visual order you would see if all panels - * were expanded. + * \note Sub-panels are indexed in depth first order, + * the visual order you would see if all panels were expanded. */ void (*set_list_data_expand_flag)(const struct bContext *C, struct Panel *pa, short expand_flag); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index ff688281587e..2f295c8d36a0 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -66,8 +66,8 @@ Global G; UserDef U; -char versionstr[48] = ""; -char upbge_versionstr[48] = ""; +static char blender_version_string[48] = ""; +static char upbge_version_string[48] = ""; /* ********** free ********** */ @@ -103,43 +103,80 @@ void BKE_blender_free(void) free_nodesystem(); } -void BKE_blender_version_string(char *version_str, - size_t maxncpy, - short version, - short subversion, - bool v_prefix, - bool include_subversion) +static void blender_version_init() { - const char *prefix = v_prefix ? "v" : ""; - - if (include_subversion && subversion > 0) { - BLI_snprintf( - version_str, maxncpy, "%s%d.%02d.%d", prefix, version / 100, version % 100, subversion); + const char *version_cycle = ""; + if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "alpha")) { + version_cycle = " Alpha"; + } + else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "beta")) { + version_cycle = " Beta"; + } + else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "rc")) { + version_cycle = " Release Candidate"; + } + else if (STREQ(STRINGIFY(BLENDER_VERSION_CYCLE), "release")) { + version_cycle = ""; } else { - BLI_snprintf(version_str, maxncpy, "%s%d.%02d", prefix, version / 100, version % 100); + BLI_assert(!"Invalid Blender version cycle"); } + + BLI_snprintf(blender_version_string, + ARRAY_SIZE(blender_version_string), + "%d.%02d.%d%s", + BLENDER_VERSION / 100, + BLENDER_VERSION % 100, + BLENDER_VERSION_PATCH, + version_cycle); +} + + +const char *BKE_blender_version_string() +{ + return blender_version_string; } -void BKE_upbge_version_string(char *version_str, - size_t maxncpy, - short version, - short subversion, - bool v_prefix, - bool include_subversion) +static void upbge_version_init() { - const char *prefix = v_prefix ? "v" : ""; + /* Version number. */ + const char *version_cycle = NULL; - if (include_subversion && subversion > 0) { - BLI_snprintf(version_str, maxncpy, "%s0.%d.%d", prefix, version, subversion); + if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "alpha")) { + version_cycle = " Alpha"; + } + else if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "beta")) { + version_cycle = " Beta"; + } + else if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "rc")) { + version_cycle = " Release Candidate"; + } + else if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "release")) { + version_cycle = ""; } else { - BLI_snprintf(version_str, maxncpy, "%s0.%d", prefix, version); + BLI_assert(!"Invalid UPBGE version cycle"); } + + BLI_snprintf(upbge_version_string, + ARRAY_SIZE(upbge_version_string), + "UPBGE %d.%d.%d%s", + UPBGE_VERSION / 100, + UPBGE_VERSION % 100, + UPBGE_VERSION_PATCH, + version_cycle); +} + +const char *BKE_upbge_version_string() +{ + return upbge_version_string; } void BKE_blender_globals_init(void) { + blender_version_init(); + upbge_version_init(); + memset(&G, 0, sizeof(Global)); U.savetime = 1; @@ -148,11 +185,6 @@ void BKE_blender_globals_init(void) strcpy(G.ima, "//"); - BKE_blender_version_string( - versionstr, sizeof(versionstr), BLENDER_VERSION, BLENDER_SUBVERSION, true, true); - BKE_upbge_version_string( - upbge_versionstr, sizeof(versionstr), UPBGE_VERSION, UPBGE_SUBVERSION, true, true); - #ifndef WITH_PYTHON_SECURITY /* default */ G.f |= G_FLAG_SCRIPT_AUTOEXEC; #else diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index b85b6f8be256..9553b930f140 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -415,8 +415,9 @@ static void setup_app_blend_file_data(bContext *C, static int handle_subversion_warning(Main *main, ReportList *reports) { - if (main->minversionfile > BLENDER_VERSION || - (main->minversionfile == BLENDER_VERSION && main->minsubversionfile > BLENDER_SUBVERSION)) { + if (main->minversionfile > BLENDER_FILE_VERSION || + (main->minversionfile == BLENDER_FILE_VERSION && + main->minsubversionfile > BLENDER_FILE_SUBVERSION)) { BKE_reportf(reports, RPT_ERROR, "File written by newer Blender binary (%d.%d), expect loss of data!", diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 9a56e817f0e8..b0007c2a5980 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1782,7 +1782,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { {sizeof(HairMapping), "HairMapping", 1, NULL, NULL, NULL, NULL, NULL, NULL}, /* 47: CD_PROP_COL */ {sizeof(MPropCol), - "PropCol", + "MPropCol", 1, N_("Col"), NULL, diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index f3cc17f46f64..dae8a59fe430 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2704,15 +2704,16 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa } } + const int final_tri_index = tempPoints[final_index].tri_index; /* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */ - if (tempPoints[final_index].tri_index != target_tri) { + if (final_tri_index != target_tri && final_tri_index != -1) { /* Check if it's close enough to likely touch the intended triangle. Any triangle * becomes thinner than a pixel at its vertices, so robustness requires some margin. */ const float final_pt[2] = {((final_index % w) + 0.5f) / w, ((final_index / w) + 0.5f) / h}; const float threshold = square_f(0.7f) / (w * h); - if (dist_squared_to_looptri_uv_edges( - mlooptri, mloopuv, tempPoints[final_index].tri_index, final_pt) > threshold) { + if (dist_squared_to_looptri_uv_edges(mlooptri, mloopuv, final_tri_index, final_pt) > + threshold) { continue; } } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 0eaf7cf2f416..f03bf60817fe 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -694,14 +694,14 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection * in at least one layer collection. That list is also synchronized here, and * stores state like selection. */ -static short layer_collection_sync(ViewLayer *view_layer, - const ListBase *lb_scene, - ListBase *lb_layer, - ListBase *new_object_bases, - short parent_exclude, - short parent_restrict, - short parent_layer_restrict, - unsigned short parent_local_collections_bits) +static void layer_collection_sync(ViewLayer *view_layer, + const ListBase *lb_scene, + ListBase *lb_layer, + ListBase *new_object_bases, + short parent_exclude, + short parent_restrict, + short parent_layer_restrict, + unsigned short parent_local_collections_bits) { /* TODO: support recovery after removal of intermediate collections, reordering, .. * For local edits we can make editing operating do the appropriate thing, but for @@ -732,7 +732,6 @@ static short layer_collection_sync(ViewLayer *view_layer, /* Add layer collections for any new scene collections, and ensure order is the same. */ ListBase new_lb_layer = {NULL, NULL}; - short runtime_flag = 0; LISTBASE_FOREACH (const CollectionChild *, child, lb_scene) { Collection *collection = child->collection; @@ -763,23 +762,20 @@ static short layer_collection_sync(ViewLayer *view_layer, } /* Sync child collections. */ - short child_runtime_flag = layer_collection_sync(view_layer, - &collection->children, - &lc->layer_collections, - new_object_bases, - lc->flag, - child_restrict, - child_layer_restrict, - local_collections_bits); + layer_collection_sync(view_layer, + &collection->children, + &lc->layer_collections, + new_object_bases, + lc->flag, + child_restrict, + child_layer_restrict, + local_collections_bits); /* Layer collection exclude is not inherited. */ + lc->runtime_flag = 0; if (lc->flag & LAYER_COLLECTION_EXCLUDE) { - lc->runtime_flag = 0; continue; } - else { - lc->runtime_flag = child_runtime_flag; - } /* We separate restrict viewport and visible view layer because a layer collection can be * hidden in the view layer yet (locally) visible in a viewport (if it is not restricted).*/ @@ -846,15 +842,11 @@ static short layer_collection_sync(ViewLayer *view_layer, lc->runtime_flag |= LAYER_COLLECTION_HAS_OBJECTS; } - - runtime_flag |= lc->runtime_flag; } /* Replace layer collection list with new one. */ *lb_layer = new_lb_layer; BLI_assert(BLI_listbase_count(lb_scene) == BLI_listbase_count(lb_layer)); - - return runtime_flag; } /** diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index f25747c56b01..afd1c78ee273 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -159,7 +159,7 @@ static void scene_init_data(ID *id) scene->unit.mass_unit = (uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_MASS); scene->unit.time_unit = (uchar)bUnit_GetBaseUnitOfType(USER_UNIT_METRIC, B_UNIT_TIME); - /* Anti-aliasing threshold. */ + /* Anti-Aliasing threshold. */ scene->grease_pencil_settings.smaa_threshold = 1.0f; { diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index 4e2cf7e7bdea..a92f033f054e 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -548,6 +548,9 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template) /* Reset all grease pencil brushes. */ Scene *scene = bmain->scenes.first; BKE_brush_gpencil_paint_presets(bmain, scene->toolsettings, true); + BKE_brush_gpencil_sculpt_presets(bmain, scene->toolsettings, true); + BKE_brush_gpencil_vertex_presets(bmain, scene->toolsettings, true); + BKE_brush_gpencil_weight_presets(bmain, scene->toolsettings, true); /* Ensure new Paint modes. */ BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_VERTEX_GPENCIL); diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 2002b60bb3cd..2f333473d36d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -4230,14 +4230,14 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar) fg.globalf = G.f; BLI_strncpy(fg.filename, mainvar->name, sizeof(fg.filename)); - sprintf(subvstr, "%4d", BLENDER_SUBVERSION); + sprintf(subvstr, "%4d", BLENDER_FILE_SUBVERSION); memcpy(fg.subvstr, subvstr, 4); - fg.subversion = BLENDER_SUBVERSION; - fg.upbgeversion = UPBGE_VERSION; - fg.upbgesubversion = UPBGE_SUBVERSION; - fg.minversion = BLENDER_MINVERSION; - fg.minsubversion = BLENDER_MINSUBVERSION; + fg.subversion = BLENDER_FILE_SUBVERSION; + fg.minversion = BLENDER_FILE_MIN_VERSION; + fg.minsubversion = BLENDER_FILE_MIN_SUBVERSION; + fg.upbgesubversion = UPBGE_FILE_SUBVERSION; + #ifdef WITH_BUILDINFO { extern unsigned long build_commit_timestamp; @@ -4291,7 +4291,7 @@ static bool write_file_handle(Main *mainvar, "BLENDER%c%c%.3d", (sizeof(void *) == 8) ? '-' : '_', (ENDIAN_ORDER == B_ENDIAN) ? 'V' : 'v', - BLENDER_VERSION); + BLENDER_FILE_VERSION); mywrite(wd, buf, 12); @@ -4366,6 +4366,11 @@ static bool write_file_handle(Main *mainvar, memcpy(id_buffer, id, idtype_struct_size); ((ID *)id_buffer)->tag = 0; + /* Those listbase data change everytime we add/remove an ID, and also often when renaming + * one (due to re-sorting). This avoids generating a lot of false 'is changed' detections + * between undo steps. */ + ((ID *)id_buffer)->prev = NULL; + ((ID *)id_buffer)->next = NULL; switch ((ID_Type)GS(id->name)) { case ID_WM: diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 5690fcec35a4..30b08bb57e87 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -403,7 +403,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_texture_ref(grp, "probeCubes", &lcache->cube_tx.tex); DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2); + DRW_shgroup_uniform_vec3(grp, "screen_vecs", DRW_viewport_screenvecs_get(), 2); DRW_shgroup_uniform_float_copy( grp, "sphere_size", scene_eval->eevee.gi_cubemap_draw_size * 0.5f); /* TODO (fclem) get rid of those UBO. */ @@ -428,7 +428,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_vec3(shgrp, "increment_x", egrid->increment_x, 1); DRW_shgroup_uniform_vec3(shgrp, "increment_y", egrid->increment_y, 1); DRW_shgroup_uniform_vec3(shgrp, "increment_z", egrid->increment_z, 1); - DRW_shgroup_uniform_vec3(shgrp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2); + DRW_shgroup_uniform_vec3(shgrp, "screen_vecs", DRW_viewport_screenvecs_get(), 2); DRW_shgroup_uniform_texture_ref(shgrp, "irradianceGrid", &lcache->grid_tx.tex); DRW_shgroup_uniform_float_copy( shgrp, "sphere_size", scene_eval->eevee.gi_irradiance_draw_size * 0.5f); diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c index 3f4008eb8b9a..4f334812a8e6 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.c +++ b/source/blender/draw/engines/eevee/eevee_subsurface.c @@ -145,7 +145,7 @@ void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) } else { GPU_FRAMEBUFFER_FREE_SAFE(fbl->sss_accum_fb); - txl->sss_accum = NULL; + DRW_TEXTURE_FREE_SAFE(txl->sss_accum); } } else { @@ -154,11 +154,11 @@ void EEVEE_subsurface_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) GPU_FRAMEBUFFER_FREE_SAFE(fbl->sss_resolve_fb); GPU_FRAMEBUFFER_FREE_SAFE(fbl->sss_clear_fb); GPU_FRAMEBUFFER_FREE_SAFE(fbl->sss_accum_fb); + DRW_TEXTURE_FREE_SAFE(txl->sss_accum); effects->sss_stencil = NULL; effects->sss_blur = NULL; effects->sss_irradiance = NULL; effects->sss_radius = NULL; - txl->sss_accum = NULL; } } diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 50e4e8d2ec4d..4f586a1e9f3a 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -292,7 +292,7 @@ void GPENCIL_cache_init(void *ved) grp = DRW_shgroup_create(sh, psl->merge_depth_ps); DRW_shgroup_uniform_texture_ref(grp, "depthBuf", &pd->depth_tx); DRW_shgroup_uniform_bool(grp, "strokeOrder3d", &pd->is_stroke_order_3d, 1); - DRW_shgroup_uniform_vec4(grp, "gpModelMatrix[0]", pd->object_bound_mat[0], 4); + DRW_shgroup_uniform_vec4(grp, "gpModelMatrix", pd->object_bound_mat[0], 4); DRW_shgroup_call_procedural_triangles(grp, NULL, 1); } { diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl index fb5073b3dc74..1e75f6dd5bb3 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl @@ -317,7 +317,7 @@ vec2 safe_normalize_len(vec2 v, out float len) } } -float stroke_thickness_modulate(float thickness) +float stroke_thickness_modulate(float thickness, out float opacity) { /* Modify stroke thickness by object and layer factors.-*/ thickness *= thicknessScale; @@ -333,6 +333,11 @@ float stroke_thickness_modulate(float thickness) /* World space point size. */ thickness *= thicknessWorldScale * ProjectionMatrix[1][1] * sizeViewport.y; } + /* To avoid aliasing artifact, we clamp the line thickness and reduce its opacity. */ + float min_thickness = gl_Position.w * 1.3; + opacity = smoothstep(0.0, gl_Position.w * 1.0, thickness); + thickness = max(min_thickness, thickness); + return thickness; } @@ -414,8 +419,9 @@ void stroke_vertex() vec2 line = safe_normalize_len(ss2 - ss1, line_len); vec2 line_adj = safe_normalize((use_curr) ? (ss1 - ss_adj) : (ss_adj - ss2)); + float small_line_opacity; float thickness = abs((use_curr) ? thickness1 : thickness2); - thickness = stroke_thickness_modulate(thickness); + thickness = stroke_thickness_modulate(thickness, small_line_opacity); finalUvs = vec2(x, y) * 0.5 + 0.5; strokeHardeness = decode_hardness(use_curr ? hardness1 : hardness2); @@ -505,7 +511,7 @@ void stroke_vertex() vec4 stroke_col = MATERIAL(m).stroke_color; float mix_tex = MATERIAL(m).stroke_texture_mix; - color_output(stroke_col, vert_col, vert_strength, mix_tex); + color_output(stroke_col, vert_col, vert_strength * small_line_opacity, mix_tex); matFlag = MATERIAL(m).flag & ~GP_FILL_FLAGS; # endif diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index 1edc36da6d57..cd603c6bd358 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -65,6 +65,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata) OVERLAY_PassList *psl = vedata->psl; OVERLAY_TextureList *txl = vedata->txl; OVERLAY_PrivateData *pd = vedata->stl->pd; + const bool is_select = DRW_state_is_select(); DRWState state_blend = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA; DRW_PASS_CREATE(psl->extra_blend_ps, state_blend | pd->clipping_state); @@ -108,7 +109,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata) /* Sorted by shader to avoid state changes during render. */ { format = formats->instance_extra; - sh = OVERLAY_shader_extra(); + sh = OVERLAY_shader_extra(is_select); grp = DRW_shgroup_create(sh, extra_ps); DRW_shgroup_uniform_block_persistent(grp, "globalsBlock", G_draw.block_ubo); @@ -179,7 +180,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata) cb->groundline = BUF_INSTANCE(grp, format, DRW_cache_groundline_get()); } { - sh = OVERLAY_shader_extra_wire(false); + sh = OVERLAY_shader_extra_wire(false, is_select); grp = DRW_shgroup_create(sh, extra_ps); DRW_shgroup_uniform_block_persistent(grp, "globalsBlock", G_draw.block_ubo); @@ -188,7 +189,7 @@ void OVERLAY_extra_cache_init(OVERLAY_Data *vedata) cb->extra_lines = BUF_LINE(grp, formats->wire_extra); } { - sh = OVERLAY_shader_extra_wire(true); + sh = OVERLAY_shader_extra_wire(true, is_select); cb->extra_wire = grp = DRW_shgroup_create(sh, extra_ps); DRW_shgroup_uniform_block_persistent(grp, "globalsBlock", G_draw.block_ubo); @@ -788,10 +789,7 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob) uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y * prb->grid_resolution_z; DRWShadingGroup *grp = DRW_shgroup_create_sub(vedata->stl->pd->extra_grid_grp); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[0]", instdata.mat[0]); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[1]", instdata.mat[1]); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[2]", instdata.mat[2]); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[3]", instdata.mat[3]); + DRW_shgroup_uniform_vec4_array_copy(grp, "gridModelMatrix", instdata.mat, 4); DRW_shgroup_call_procedural_points(grp, NULL, cell_count); } break; diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h index 8afa562c937b..ed0a9cf6981d 100644 --- a/source/blender/draw/engines/overlay/overlay_private.h +++ b/source/blender/draw/engines/overlay/overlay_private.h @@ -590,9 +590,9 @@ GPUShader *OVERLAY_shader_edit_mesh_skin_root(void); GPUShader *OVERLAY_shader_edit_mesh_vert(void); GPUShader *OVERLAY_shader_edit_particle_strand(void); GPUShader *OVERLAY_shader_edit_particle_point(void); -GPUShader *OVERLAY_shader_extra(void); +GPUShader *OVERLAY_shader_extra(bool is_select); GPUShader *OVERLAY_shader_extra_groundline(void); -GPUShader *OVERLAY_shader_extra_wire(bool use_object); +GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select); GPUShader *OVERLAY_shader_extra_loose_point(void); GPUShader *OVERLAY_shader_extra_point(void); GPUShader *OVERLAY_shader_facing(void); diff --git a/source/blender/draw/engines/overlay/overlay_shader.c b/source/blender/draw/engines/overlay/overlay_shader.c index 59f388df4e3c..0610b8397a10 100644 --- a/source/blender/draw/engines/overlay/overlay_shader.c +++ b/source/blender/draw/engines/overlay/overlay_shader.c @@ -164,8 +164,10 @@ typedef struct OVERLAY_Shaders { GPUShader *edit_particle_strand; GPUShader *edit_particle_point; GPUShader *extra; + GPUShader *extra_select; GPUShader *extra_groundline; GPUShader *extra_wire[2]; + GPUShader *extra_wire_select; GPUShader *extra_point; GPUShader *extra_lightprobe_grid; GPUShader *extra_loose_point; @@ -797,23 +799,24 @@ GPUShader *OVERLAY_shader_edit_particle_point(void) return sh_data->edit_particle_point; } -GPUShader *OVERLAY_shader_extra(void) +GPUShader *OVERLAY_shader_extra(bool is_select) { const DRWContextState *draw_ctx = DRW_context_state_get(); const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; - if (!sh_data->extra) { - sh_data->extra = GPU_shader_create_from_arrays({ + GPUShader **sh = (is_select) ? &sh_data->extra_select : &sh_data->extra; + if (!*sh) { + *sh = GPU_shader_create_from_arrays({ .vert = (const char *[]){sh_cfg->lib, datatoc_common_globals_lib_glsl, datatoc_common_view_lib_glsl, datatoc_extra_vert_glsl, NULL}, .frag = (const char *[]){datatoc_common_view_lib_glsl, datatoc_extra_frag_glsl, NULL}, - .defs = (const char *[]){sh_cfg->def, NULL}, + .defs = (const char *[]){sh_cfg->def, (is_select) ? "#define SELECT_EDGES\n" : NULL, NULL}, }); } - return sh_data->extra; + return *sh; } GPUShader *OVERLAY_shader_extra_grid(void) @@ -855,12 +858,13 @@ GPUShader *OVERLAY_shader_extra_groundline(void) return sh_data->extra_groundline; } -GPUShader *OVERLAY_shader_extra_wire(bool use_object) +GPUShader *OVERLAY_shader_extra_wire(bool use_object, bool is_select) { const DRWContextState *draw_ctx = DRW_context_state_get(); const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg]; OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg]; - if (!sh_data->extra_wire[use_object]) { + GPUShader **sh = (is_select) ? &sh_data->extra_wire_select : &sh_data->extra_wire[use_object]; + if (!*sh) { char colorids[1024]; /* NOTE: define all ids we need here. */ BLI_snprintf(colorids, @@ -875,7 +879,7 @@ GPUShader *OVERLAY_shader_extra_wire(bool use_object) TH_TRANSFORM, TH_WIRE, TH_CAMERA_PATH); - sh_data->extra_wire[use_object] = GPU_shader_create_from_arrays({ + *sh = GPU_shader_create_from_arrays({ .vert = (const char *[]){sh_cfg->lib, datatoc_common_globals_lib_glsl, datatoc_common_view_lib_glsl, @@ -884,11 +888,12 @@ GPUShader *OVERLAY_shader_extra_wire(bool use_object) .frag = (const char *[]){datatoc_common_view_lib_glsl, datatoc_extra_wire_frag_glsl, NULL}, .defs = (const char *[]){sh_cfg->def, colorids, + (is_select) ? "#define SELECT_EDGES\n" : "", (use_object) ? "#define OBJECT_WIRE \n" : NULL, NULL}, }); } - return sh_data->extra_wire[use_object]; + return *sh; } GPUShader *OVERLAY_shader_extra_loose_point(void) diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c index 309c7c1021a0..cb36f0ed3267 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.c +++ b/source/blender/draw/engines/overlay/overlay_wireframe.c @@ -157,10 +157,7 @@ static void wireframe_hair_cache_populate(OVERLAY_Data *vedata, Object *ob, Part const bool use_coloring = true; DRWShadingGroup *shgrp = DRW_shgroup_create_sub(pd->wires_hair_grp[is_xray][use_coloring]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[0]", dupli_mat[0]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[1]", dupli_mat[1]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[2]", dupli_mat[2]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[3]", dupli_mat[3]); + DRW_shgroup_uniform_vec4_array_copy(shgrp, "hairDupliMatrix", dupli_mat, 4); DRW_shgroup_call_no_cull(shgrp, hairs, ob); } diff --git a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl index 1662e6519c7a..2168d8065fcd 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl @@ -221,10 +221,12 @@ void main() /* Convert to screen position [0..sizeVp]. */ edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy; +#ifdef SELECT_EDGES /* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the * wire to at least create one fragment that will pass the occlusion query. */ /* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */ gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); +#endif #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); diff --git a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl index 9598f8b28144..0fbf9ba81374 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_wire_vert.glsl @@ -17,10 +17,12 @@ void main() vec3 world_pos = point_object_to_world(pos); gl_Position = point_world_to_ndc(world_pos); +#ifdef SELECT_EDGES /* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the * wire to at least create one fragment that will pass the occlusion query. */ /* TODO(fclem) Limit this workaround to selection. It's not very noticeable but still... */ gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0); +#endif stipple_coord = stipple_start = screen_position(gl_Position); @@ -39,6 +41,10 @@ void main() } #endif +#ifdef SELECT_EDGES + finalColor.a = 0.0; /* No Stipple */ +#endif + #ifdef USE_WORLD_CLIP_PLANES world_clip_planes_calc_clip_distance(world_pos); #endif diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c index d2bd653a6563..cb8eb7d1e925 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c +++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c @@ -19,7 +19,7 @@ /** \file * \ingroup draw_engine * - * Anti-aliasing: + * Anti-Aliasing: * * We use SMAA (Smart Morphological Anti-Aliasing) as a fast antialiasing solution. * diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index cb4940f70dd4..2e7cd1203d2f 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -527,6 +527,10 @@ void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, const float *value); void DRW_shgroup_uniform_vec3_copy(DRWShadingGroup *shgroup, const char *name, const float *value); void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value); +void DRW_shgroup_uniform_vec4_array_copy(DRWShadingGroup *shgroup, + const char *name, + const float (*value)[4], + int arraysize); bool DRW_shgroup_is_empty(DRWShadingGroup *shgroup); diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index ed7c72ac1167..27de7cc1c7cd 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -240,10 +240,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object, DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &hair_cache->final[subdiv].strands_res, 1); DRW_shgroup_uniform_int_copy(shgrp, "hairThicknessRes", thickness_res); DRW_shgroup_uniform_float_copy(shgrp, "hairRadShape", hair_rad_shape); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[0]", dupli_mat[0]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[1]", dupli_mat[1]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[2]", dupli_mat[2]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[3]", dupli_mat[3]); + DRW_shgroup_uniform_vec4_array_copy(shgrp, "hairDupliMatrix", dupli_mat, 4); DRW_shgroup_uniform_float_copy(shgrp, "hairRadRoot", hair_rad_root); DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", hair_rad_tip); DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", hair_close_tip); diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index ff27fa958ef6..aa401bcffa5e 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -436,6 +436,24 @@ void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, c drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_FLOAT_COPY, value, 4, 1); } +void DRW_shgroup_uniform_vec4_array_copy(DRWShadingGroup *shgroup, + const char *name, + const float (*value)[4], + int arraysize) +{ + int location = GPU_shader_get_uniform_ensure(shgroup->shader, name); + + if (location == -1) { + /* Nice to enable eventually, for now eevee uses uniforms that might not exist. */ + // BLI_assert(0); + return; + } + + for (int i = 0; i < arraysize; i++) { + drw_shgroup_uniform_create_ex(shgroup, location + i, DRW_UNIFORM_FLOAT_COPY, &value[i], 4, 1); + } +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c index 19370f345fd8..1ed02bd6cb94 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -67,7 +67,6 @@ typedef struct SnapGizmo3D { /* We could have other snap contexts, for now only support 3D view. */ SnapObjectContext *snap_context_v3d; int mval[2]; - short snap_elem; #ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK wmKeyMap *keymap; @@ -75,6 +74,7 @@ typedef struct SnapGizmo3D { bool invert_snap; #endif int use_snap_override; + short snap_elem; } SnapGizmo3D; #ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK @@ -82,11 +82,8 @@ static bool invert_snap(const wmGizmo *gz, const wmWindowManager *wm, const wmEv { SnapGizmo3D *gizmo_snap = (SnapGizmo3D *)gz; wmKeyMap *keymap = WM_keymap_active(wm, gizmo_snap->keymap); - if (!keymap) { - return false; - } - int snap_on = gizmo_snap->snap_on; + const int snap_on = gizmo_snap->snap_on; for (wmKeyMapItem *kmi = keymap->items.first; kmi; kmi = kmi->next) { if (kmi->flag & KMI_INACTIVE) { continue; @@ -253,7 +250,7 @@ short ED_gizmotypes_snap_3d_update(wmGizmo *gz, } #ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK - if (wm) { + if (wm && wm->winactive) { gizmo_snap->invert_snap = invert_snap(gz, wm, wm->winactive->eventstate); } @@ -408,14 +405,21 @@ static void gizmo_snap_draw(const bContext *C, wmGizmo *gz) static int gizmo_snap_test_select(bContext *C, wmGizmo *gz, const int mval[2]) { SnapGizmo3D *gizmo_snap = (SnapGizmo3D *)gz; + #ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK wmWindowManager *wm = CTX_wm_manager(C); + if (gizmo_snap->keymap == NULL) { + gizmo_snap->keymap = WM_modalkeymap_find(wm->defaultconf, "Generic Gizmo Tweak Modal Map"); + RNA_enum_value_from_id(gizmo_snap->keymap->modal_items, "SNAP_ON", &gizmo_snap->snap_on); + } + const bool invert = invert_snap(gz, wm, wm->winactive->eventstate); if (gizmo_snap->invert_snap == invert && gizmo_snap->mval[0] == mval[0] && gizmo_snap->mval[1] == mval[1]) { /* Performance, do not update. */ return gizmo_snap->snap_elem ? 0 : -1; } + gizmo_snap->invert_snap = invert; #else if (gizmo_snap->mval[0] == mval[0] && gizmo_snap->mval[1] == mval[1]) { @@ -425,14 +429,6 @@ static int gizmo_snap_test_select(bContext *C, wmGizmo *gz, const int mval[2]) #endif copy_v2_v2_int(gizmo_snap->mval, mval); -#ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK - if (gizmo_snap->keymap == NULL) { - gizmo_snap->keymap = WM_modalkeymap_find(wm->defaultconf, "Generic Gizmo Tweak Modal Map"); - gizmo_snap->snap_on = -1; - RNA_enum_value_from_id(gizmo_snap->keymap->modal_items, "SNAP_ON", &gizmo_snap->snap_on); - } -#endif - ARegion *region = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); const float mval_fl[2] = {UNPACK2(mval)}; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 4330a07057e3..8771fcb0c8dd 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -370,7 +370,7 @@ static int gpencil_paintmode_toggle_exec(bContext *C, wmOperator *op) if (mode == OB_MODE_PAINT_GPENCIL) { /* Be sure we have brushes and Paint settings. - * Need Draw and Vertex (used fro Tint). */ + * Need Draw and Vertex (used for Tint). */ BKE_paint_ensure(ts, (Paint **)&ts->gp_paint); BKE_paint_ensure(ts, (Paint **)&ts->gp_vertexpaint); @@ -485,11 +485,13 @@ static int gpencil_sculptmode_toggle_exec(bContext *C, wmOperator *op) } if (mode == OB_MODE_SCULPT_GPENCIL) { - /* be sure we have brushes */ + /* Be sure we have brushes. */ BKE_paint_ensure(ts, (Paint **)&ts->gp_sculptpaint); - BKE_paint_toolslots_brush_validate(bmain, &ts->gp_sculptpaint->paint); - BKE_brush_gpencil_sculpt_presets(bmain, ts, false); + const bool reset_mode = (ts->gp_sculptpaint->paint.brush == NULL); + BKE_brush_gpencil_sculpt_presets(bmain, ts, reset_mode); + + BKE_paint_toolslots_brush_validate(bmain, &ts->gp_sculptpaint->paint); } /* setup other modes */ @@ -592,11 +594,13 @@ static int gpencil_weightmode_toggle_exec(bContext *C, wmOperator *op) } if (mode == OB_MODE_WEIGHT_GPENCIL) { - /* be sure we have brushes */ + /* Be sure we have brushes. */ BKE_paint_ensure(ts, (Paint **)&ts->gp_weightpaint); - BKE_paint_toolslots_brush_validate(bmain, &ts->gp_weightpaint->paint); - BKE_brush_gpencil_weight_presets(bmain, ts, false); + const bool reset_mode = (ts->gp_weightpaint->paint.brush == NULL); + BKE_brush_gpencil_weight_presets(bmain, ts, reset_mode); + + BKE_paint_toolslots_brush_validate(bmain, &ts->gp_weightpaint->paint); } /* setup other modes */ @@ -696,11 +700,13 @@ static int gpencil_vertexmode_toggle_exec(bContext *C, wmOperator *op) } if (mode == OB_MODE_VERTEX_GPENCIL) { - /* be sure we have brushes */ + /* Be sure we have brushes. */ BKE_paint_ensure(ts, (Paint **)&ts->gp_vertexpaint); - BKE_paint_toolslots_brush_validate(bmain, &ts->gp_vertexpaint->paint); - BKE_brush_gpencil_vertex_presets(bmain, ts, false); + const bool reset_mode = (ts->gp_vertexpaint->paint.brush == NULL); + BKE_brush_gpencil_vertex_presets(bmain, ts, reset_mode); + + BKE_paint_toolslots_brush_validate(bmain, &ts->gp_vertexpaint->paint); /* Ensure Palette by default. */ BKE_gpencil_palette_ensure(bmain, CTX_data_scene(C)); diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 9969acd04b7f..a62deb9d69f3 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -162,6 +162,19 @@ int BIF_countTransformOrientation(const struct bContext *C); void Transform_Properties(struct wmOperatorType *ot, int flags); +/* *** transform_orientations.c *** */ +void ED_transform_calc_orientation_from_type(const struct bContext *C, float r_mat[3][3]); +short ED_transform_calc_orientation_from_type_ex(const struct bContext *C, + float r_mat[3][3], + /* extra args */ + struct Scene *scene, + struct RegionView3D *rv3d, + struct Object *ob, + struct Object *obedit, + const short orientation_type, + int orientation_index_custom, + const int pivot_point); + /* transform gizmos */ void VIEW3D_GGT_xform_gizmo(struct wmGizmoGroupType *gzgt); @@ -180,18 +193,6 @@ void ED_widgetgroup_gizmo2d_rotate_callbacks_set(struct wmGizmoGroupType *gzgt); #define SNAP_INCREMENTAL_ANGLE DEG2RAD(5.0) -void ED_transform_calc_orientation_from_type(const struct bContext *C, float r_mat[3][3]); -void ED_transform_calc_orientation_from_type_ex(const struct bContext *C, - float r_mat[3][3], - /* extra args */ - struct Scene *scene, - struct RegionView3D *rv3d, - struct Object *ob, - struct Object *obedit, - const short orientation_type, - int orientation_index_custom, - const int pivot_point); - struct TransformBounds { float center[3]; /* Center for transform widget. */ float min[3], max[3]; /* Boundbox of selection for transform widget. */ diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 2d7b230258bf..0b1ba01cc7eb 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2077,7 +2077,7 @@ void ED_object_single_users(Main *bmain, /* Duplicating obdata and other IDs may require another update of the collections and objects * pointers, especially regarding drivers and custom props, see T66641. - * Note that this whole scene duplication code and 'make single user' functions have te be + * Note that this whole scene duplication code and 'make single user' functions have to be * rewritten at some point to make use of proper modern ID management code, * but that is no small task. * For now we are doomed to that kind of band-aid to try to cover most of remapping cases. */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 77f68eed883e..6f0042385224 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -305,30 +305,28 @@ int area_getorientation(ScrArea *area, ScrArea *sb) ScrVert *sbTR = sb->v3; ScrVert *sbBR = sb->v4; - int tolerance = U.pixelsize * 4; - if (saBL->vec.x == sbBR->vec.x && saTL->vec.x == sbTR->vec.x) { /* area to right of sb = W */ - if ((abs(saBL->vec.y - sbBR->vec.y) <= tolerance) && - (abs(saTL->vec.y - sbTR->vec.y) <= tolerance)) { + if ((abs(saBL->vec.y - sbBR->vec.y) <= AREAJOINTOLERANCE) && + (abs(saTL->vec.y - sbTR->vec.y) <= AREAJOINTOLERANCE)) { return 0; } } else if (saTL->vec.y == sbBL->vec.y && saTR->vec.y == sbBR->vec.y) { /* area to bottom of sb = N */ - if ((abs(saTL->vec.x - sbBL->vec.x) <= tolerance) && - (abs(saTR->vec.x - sbBR->vec.x) <= tolerance)) { + if ((abs(saTL->vec.x - sbBL->vec.x) <= AREAJOINTOLERANCE) && + (abs(saTR->vec.x - sbBR->vec.x) <= AREAJOINTOLERANCE)) { return 1; } } else if (saTR->vec.x == sbTL->vec.x && saBR->vec.x == sbBL->vec.x) { /* area to left of sb = E */ - if ((abs(saTR->vec.y - sbTL->vec.y) <= tolerance) && - (abs(saBR->vec.y - sbBL->vec.y) <= tolerance)) { + if ((abs(saTR->vec.y - sbTL->vec.y) <= AREAJOINTOLERANCE) && + (abs(saBR->vec.y - sbBL->vec.y) <= AREAJOINTOLERANCE)) { return 2; } } else if (saBL->vec.y == sbTL->vec.y && saBR->vec.y == sbTR->vec.y) { /* area on top of sb = S*/ - if ((abs(saBL->vec.x - sbTL->vec.x) <= tolerance) && - (abs(saBR->vec.x - sbTR->vec.x) <= tolerance)) { + if ((abs(saBL->vec.x - sbTL->vec.x) <= AREAJOINTOLERANCE) && + (abs(saBR->vec.x - sbTR->vec.x) <= AREAJOINTOLERANCE)) { return 3; } } @@ -336,6 +334,69 @@ int area_getorientation(ScrArea *area, ScrArea *sb) return -1; } +/* Screen verts with horizontal position equal to from_x are moved to to_x. */ +static void screen_verts_halign(const wmWindow *win, + const bScreen *screen, + const short from_x, + const short to_x) +{ + ED_screen_verts_iter(win, screen, v1) + { + if (v1->vec.x == from_x) { + v1->vec.x = to_x; + } + } +} + +/* Screen verts with vertical position equal to from_y are moved to to_y. */ +static void screen_verts_valign(const wmWindow *win, + const bScreen *screen, + const short from_y, + const short to_y) +{ + ED_screen_verts_iter(win, screen, v1) + { + if (v1->vec.y == from_y) { + v1->vec.y = to_y; + } + } +} + +/* Adjust all screen edges to allow joining two areas. 'dir' value is like area_getorientation(). + */ +static void screen_areas_align( + bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2, const int dir) +{ + wmWindow *win = CTX_wm_window(C); + + if (dir == 0 || dir == 2) { + /* horizontal join, use average for new top and bottom. */ + int top = (sa1->v2->vec.y + sa2->v2->vec.y) / 2; + int bottom = (sa1->v4->vec.y + sa2->v4->vec.y) / 2; + + /* Move edges exactly matching source top and bottom. */ + screen_verts_valign(win, screen, sa1->v2->vec.y, top); + screen_verts_valign(win, screen, sa1->v4->vec.y, bottom); + + /* Move edges exactly matching target top and bottom. */ + screen_verts_valign(win, screen, sa2->v2->vec.y, top); + screen_verts_valign(win, screen, sa2->v4->vec.y, bottom); + } + else { + /* Vertical join, use averages for new left and right. */ + int left = (sa1->v1->vec.x + sa2->v1->vec.x) / 2; + int right = (sa1->v3->vec.x + sa2->v3->vec.x) / 2; + + /* Move edges exactly matching source left and right. */ + screen_verts_halign(win, screen, sa1->v1->vec.x, left); + screen_verts_halign(win, screen, sa1->v3->vec.x, right); + + /* Move edges exactly matching target left and right */ + screen_verts_halign(win, screen, sa2->v1->vec.x, left); + screen_verts_halign(win, screen, sa2->v3->vec.x, right); + } +} + /* Helper function to join 2 areas, it has a return value, 0=failed 1=success * used by the split, join operators */ @@ -348,21 +409,7 @@ int screen_area_join(bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2) } /* Align areas if they are not. Do sanity checking before getting here. */ - - if (dir == 0 || dir == 2) { - /* horizontal join, so vertically align source vert to target */ - sa2->v1->vec.y = sa1->v1->vec.y; /* vertical align sa1 BL */ - sa2->v2->vec.y = sa1->v2->vec.y; /* vertical align sa1 TL */ - sa2->v3->vec.y = sa1->v3->vec.y; /* vertical align sa1 TR */ - sa2->v4->vec.y = sa1->v4->vec.y; /* vertical align sa1 BR */ - } - else { - /* vertical join, so horizontally align source verts to target */ - sa2->v1->vec.x = sa1->v1->vec.x; /* vertical align sa1 BL */ - sa2->v2->vec.x = sa1->v2->vec.x; /* vertical align sa1 TL */ - sa2->v3->vec.x = sa1->v3->vec.x; /* vertical align sa1 TR */ - sa2->v4->vec.x = sa1->v4->vec.x; /* vertical align sa1 BR */ - } + screen_areas_align(C, screen, sa1, sa2, dir); if (dir == 0) { /* sa1 to right of sa2 = W */ sa1->v1 = sa2->v1; /* BL */ diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index a5e0263104d8..2d42313d528b 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -35,6 +35,8 @@ struct bContextDataResult; #define AZONEFADEIN (5.0f * U.widget_unit) /* when azone is totally visible */ #define AZONEFADEOUT (6.5f * U.widget_unit) /* when we start seeing the azone */ +#define AREAJOINTOLERANCE (1.0f * U.widget_unit) /* Edges must be close to allow joining. */ + /* Expanded interaction influence of area borders. */ #define BORDERPADDING (U.dpi_fac + U.pixelsize) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index a18a0145faa2..6172b77de077 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2694,19 +2694,19 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot) /* Implementation notes: * * Operator->invoke() - * - validate context (add mcol) - * - create customdata storage - * - call paint once (mouse click) - * - add modal handler + * - Validate context (add #Mesh.mloopcol). + * - Create custom-data storage. + * - Call paint once (mouse click). + * - Add modal handler. * * Operator->modal() - * - for every mousemove, apply vertex paint - * - exit on mouse release, free customdata + * - For every mouse-move, apply vertex paint. + * - Exit on mouse release, free custom-data. * (return OPERATOR_FINISHED also removes handler and operator) * * For future: - * - implement a stroke event (or mousemove with past positions) - * - revise whether op->customdata should be added in object, in set_vpaint + * - implement a stroke event (or mouse-move with past positions). + * - revise whether op->customdata should be added in object, in set_vpaint. */ struct VPaintData { @@ -2718,8 +2718,10 @@ struct VPaintData { struct VertProjHandle *vp_handle; struct CoNo *vertexcosnos; - /* modify 'me->mcol' directly, since the derived mesh is drawing from this - * array, otherwise we need to refresh the modifier stack */ + /** + * Modify #Mesh.mloopcol directly, since the derived mesh is drawing from this + * array, otherwise we need to refresh the modifier stack. + */ bool use_fast_update; /* loops tagged as having been painted, to apply shared vertex color diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index dc258157afdd..b03df01a02be 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -418,7 +418,7 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu, else { /* if we're bookmarking this, file should come * before the last separator, only automatically added - * current dir go after the last sep. */ + * current dir go after the last separator. */ if (flag & FS_INSERT_SAVE) { break; } diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index 38a51aa6bb52..d299958d1a3f 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -435,12 +435,11 @@ static const char *footer_string(ViewLayer *view_layer) BLI_snprintf(view_layer->footer_str, sizeof(view_layer->footer_str), - "%s%s | UPBGE %s %s (based on Blender %s)", + "%s%s | %s (based on Blender %s)", memstr, gpumemstr, - upbge_versionstr, - "Alpha", // Remove alpha when release - versionstr); + BKE_upbge_version_string(), + BKE_blender_version_string()); return view_layer->footer_str; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c910f1d23820..232bb1d66e85 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1652,10 +1652,10 @@ static void sequencer_slip_update_header(Scene *scene, ScrArea *area, SlipData * if (hasNumInput(&data->num_input)) { char num_str[NUM_STR_REP_LEN]; outputNumInput(&data->num_input, num_str, &scene->unit); - BLI_snprintf(msg, sizeof(msg), TIP_("Trim offset: %s"), num_str); + BLI_snprintf(msg, sizeof(msg), TIP_("Slip offset: %s"), num_str); } else { - BLI_snprintf(msg, sizeof(msg), TIP_("Trim offset: %d"), offset); + BLI_snprintf(msg, sizeof(msg), TIP_("Slip offset: %d"), offset); } } @@ -2508,7 +2508,7 @@ static int sequencer_delete_invoke(bContext *C, wmOperator *op, const wmEvent *e } } - return WM_operator_confirm(C, op, event); + return sequencer_delete_exec(C, op); } void SEQUENCER_OT_delete(wmOperatorType *ot) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 0a6e0d6b7f53..228e8d581620 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -829,11 +829,7 @@ static void drawObjectConstraint(TransInfo *t) } } - if (t->flag & T_OBJECT) { - copy_v3_v3(co, td->ob->obmat[3]); - axismtx = td->axismtx; - } - else if (t->flag & T_EDIT) { + if (t->flag & T_EDIT) { mul_v3_m4v3(co, tc->mat, td->center); mul_m3_m3m3(tmp_axismtx, tc->mat3_unit, td->axismtx); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index b1e69dde0ace..a16bc0389020 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1649,13 +1649,17 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } { - TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; short orient_type_set = -1; short orient_type_matrix_set = -1; - short orient_type_scene = orient_slot->type; - if (orient_type_scene == V3D_ORIENT_CUSTOM) { - const int index_custom = orient_slot->index_custom; - orient_type_scene += index_custom; + short orient_type_scene = V3D_ORIENT_GLOBAL; + + if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { + TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; + orient_type_scene = orient_slot->type; + if (orient_type_scene == V3D_ORIENT_CUSTOM) { + const int index_custom = orient_slot->index_custom; + orient_type_scene += index_custom; + } } short orient_types[3]; diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 04be7048791a..ebc021cd983c 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -635,101 +635,6 @@ bool gimbal_axis(Object *ob, float gmat[3][3]) return 0; } -void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3]) -{ - ARegion *region = CTX_wm_region(C); - Scene *scene = CTX_data_scene(C); - ViewLayer *view_layer = CTX_data_view_layer(C); - Object *obedit = CTX_data_edit_object(C); - RegionView3D *rv3d = region->regiondata; - Object *ob = OBACT(view_layer); - const short orientation_type = scene->orientation_slots[SCE_ORIENT_DEFAULT].type; - const short orientation_index_custom = scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom; - const int pivot_point = scene->toolsettings->transform_pivot_point; - - ED_transform_calc_orientation_from_type_ex( - C, r_mat, scene, rv3d, ob, obedit, orientation_type, orientation_index_custom, pivot_point); -} - -void ED_transform_calc_orientation_from_type_ex(const bContext *C, - float r_mat[3][3], - /* extra args (can be accessed from context) */ - Scene *scene, - RegionView3D *rv3d, - Object *ob, - Object *obedit, - const short orientation_type, - int orientation_index_custom, - const int pivot_point) -{ - bool ok = false; - - switch (orientation_type) { - case V3D_ORIENT_GLOBAL: { - break; /* nothing to do */ - } - case V3D_ORIENT_GIMBAL: { - if (gimbal_axis(ob, r_mat)) { - ok = true; - break; - } - /* if not gimbal, fall through to normal */ - ATTR_FALLTHROUGH; - } - case V3D_ORIENT_NORMAL: { - if (obedit || ob->mode & OB_MODE_POSE) { - ED_getTransformOrientationMatrix(C, r_mat, pivot_point); - ok = true; - break; - } - /* no break we define 'normal' as 'local' in Object mode */ - ATTR_FALLTHROUGH; - } - case V3D_ORIENT_LOCAL: { - if (ob->mode & OB_MODE_POSE) { - /* each bone moves on its own local axis, but to avoid confusion, - * use the active pones axis for display [#33575], this works as expected on a single bone - * and users who select many bones will understand what's going on and what local means - * when they start transforming */ - ED_getTransformOrientationMatrix(C, r_mat, pivot_point); - ok = true; - break; - } - copy_m3_m4(r_mat, ob->obmat); - normalize_m3(r_mat); - ok = true; - break; - } - case V3D_ORIENT_VIEW: { - if (rv3d != NULL) { - copy_m3_m4(r_mat, rv3d->viewinv); - normalize_m3(r_mat); - ok = true; - } - break; - } - case V3D_ORIENT_CURSOR: { - BKE_scene_cursor_rot_to_mat3(&scene->cursor, r_mat); - ok = true; - break; - } - case V3D_ORIENT_CUSTOM: - default: { - BLI_assert(orientation_type >= V3D_ORIENT_CUSTOM); - TransformOrientation *custom_orientation = BKE_scene_transform_orientation_find( - scene, orientation_index_custom); - if (applyTransformOrientation(custom_orientation, r_mat, NULL)) { - ok = true; - } - break; - } - } - - if (!ok) { - unit_m3(r_mat); - } -} - /* centroid, boundbox, of selection */ /* returns total items selected */ int ED_transform_calc_gizmo_stats(const bContext *C, diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 32269e1bacca..70060b5812b8 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -438,82 +438,144 @@ static int armature_bone_transflags_update_recursive(bArmature *arm, return total; } -/* Sets the matrix of the specified space orientation. - * If the matrix cannot be obtained, an orientation different from the one - * informed is returned */ -short transform_orientation_matrix_get(bContext *C, - TransInfo *t, - const short orientation, - const float custom[3][3], - float r_spacemtx[3][3]) +void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3]) { - Object *ob = CTX_data_active_object(C); - Object *obedit = CTX_data_active_object(C); + ARegion *region = CTX_wm_region(C); + Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *obedit = CTX_data_edit_object(C); + RegionView3D *rv3d = region->regiondata; + Object *ob = OBACT(view_layer); + const short orientation_type = scene->orientation_slots[SCE_ORIENT_DEFAULT].type; + const short orientation_index_custom = scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom; + const int pivot_point = scene->toolsettings->transform_pivot_point; - switch (orientation) { - case V3D_ORIENT_GLOBAL: - unit_m3(r_spacemtx); - return V3D_ORIENT_GLOBAL; + ED_transform_calc_orientation_from_type_ex( + C, r_mat, scene, rv3d, ob, obedit, orientation_type, orientation_index_custom, pivot_point); +} - case V3D_ORIENT_GIMBAL: - unit_m3(r_spacemtx); - if (ob && gimbal_axis(ob, r_spacemtx)) { +short ED_transform_calc_orientation_from_type_ex(const bContext *C, + float r_mat[3][3], + /* extra args (can be accessed from context) */ + Scene *scene, + RegionView3D *rv3d, + Object *ob, + Object *obedit, + const short orientation_type, + int orientation_index_custom, + const int pivot_point) +{ + bool ok = false; + + switch (orientation_type) { + case V3D_ORIENT_GLOBAL: { + unit_m3(r_mat); + return V3D_ORIENT_GLOBAL; + } + case V3D_ORIENT_GIMBAL: { + if (gimbal_axis(ob, r_mat)) { return V3D_ORIENT_GIMBAL; } - ATTR_FALLTHROUGH; /* no gimbal fallthrough to normal */ - - case V3D_ORIENT_NORMAL: - if (obedit || (ob && ob->mode & OB_MODE_POSE)) { - ED_getTransformOrientationMatrix(C, r_spacemtx, t->around); + /* if not gimbal, fall through to normal */ + ATTR_FALLTHROUGH; + } + case V3D_ORIENT_NORMAL: { + if (obedit || ob->mode & OB_MODE_POSE) { + ED_getTransformOrientationMatrix(C, r_mat, pivot_point); return V3D_ORIENT_NORMAL; } - ATTR_FALLTHROUGH; /* we define 'normal' as 'local' in Object mode */ - - case V3D_ORIENT_LOCAL: + /* no break we define 'normal' as 'local' in Object mode */ + ATTR_FALLTHROUGH; + } + case V3D_ORIENT_LOCAL: { if (ob) { - copy_m3_m4(r_spacemtx, ob->obmat); - normalize_m3(r_spacemtx); + if (ob->mode & OB_MODE_POSE) { + /* each bone moves on its own local axis, but to avoid confusion, + * use the active pones axis for display [#33575], this works as expected on a single + * bone and users who select many bones will understand what's going on and what local + * means when they start transforming */ + ED_getTransformOrientationMatrix(C, r_mat, pivot_point); + } + else { + copy_m3_m4(r_mat, ob->obmat); + normalize_m3(r_mat); + } return V3D_ORIENT_LOCAL; } - unit_m3(r_spacemtx); + unit_m3(r_mat); return V3D_ORIENT_GLOBAL; - + } case V3D_ORIENT_VIEW: { - float mat[3][3]; - if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { - RegionView3D *rv3d = t->region->regiondata; - copy_m3_m4(mat, rv3d->viewinv); - normalize_m3(mat); + if (rv3d != NULL) { + copy_m3_m4(r_mat, rv3d->viewinv); + normalize_m3(r_mat); } else { - unit_m3(mat); + unit_m3(r_mat); } - copy_m3_m3(r_spacemtx, mat); return V3D_ORIENT_VIEW; } - case V3D_ORIENT_CURSOR: - BKE_scene_cursor_rot_to_mat3(&t->scene->cursor, r_spacemtx); + case V3D_ORIENT_CURSOR: { + BKE_scene_cursor_rot_to_mat3(&scene->cursor, r_mat); return V3D_ORIENT_CURSOR; - - case V3D_ORIENT_CUSTOM_MATRIX: - copy_m3_m3(r_spacemtx, custom); - return V3D_ORIENT_CUSTOM_MATRIX; - + } + case V3D_ORIENT_CUSTOM_MATRIX: { + /* Do nothing. */; + break; + } case V3D_ORIENT_CUSTOM: - default: - BLI_assert(orientation >= V3D_ORIENT_CUSTOM); - TransformOrientation *ts = BKE_scene_transform_orientation_find( - t->scene, orientation - V3D_ORIENT_CUSTOM); - if (applyTransformOrientation(ts, r_spacemtx, t->spacename)) { - /* pass */ - } - else { - unit_m3(r_spacemtx); + default: { + BLI_assert(orientation_type >= V3D_ORIENT_CUSTOM); + TransformOrientation *custom_orientation = BKE_scene_transform_orientation_find( + scene, orientation_index_custom); + if (applyTransformOrientation(custom_orientation, r_mat, NULL)) { + ok = true; } break; + } } - return orientation; + return orientation_type; +} + +/* Sets the matrix of the specified space orientation. + * If the matrix cannot be obtained, an orientation different from the one + * informed is returned */ +short transform_orientation_matrix_get(bContext *C, + TransInfo *t, + const short orientation, + const float custom[3][3], + float r_spacemtx[3][3]) +{ + if (orientation == V3D_ORIENT_CUSTOM_MATRIX) { + copy_m3_m3(r_spacemtx, custom); + return V3D_ORIENT_CUSTOM_MATRIX; + } + + if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) { + Object *ob = CTX_data_active_object(C); + Object *obedit = CTX_data_active_object(C); + RegionView3D *rv3d = t->region->regiondata; + int orientation_index_custom = 0; + + if (orientation >= V3D_ORIENT_CUSTOM) { + orientation_index_custom = orientation - V3D_ORIENT_CUSTOM; + } + + return ED_transform_calc_orientation_from_type_ex(C, + r_spacemtx, + /* extra args (can be accessed from context) */ + t->scene, + rv3d, + ob, + obedit, + orientation, + orientation_index_custom, + t->around); + } + + unit_m3(r_spacemtx); + return V3D_ORIENT_GLOBAL; } const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type) @@ -545,37 +607,7 @@ const char *transform_orientations_spacename_get(TransInfo *t, const short orien void transform_orientations_current_set(TransInfo *t, const short orient_index) { const short orientation = t->orient[orient_index].type; - const char *spacename; - switch (orientation) { - case V3D_ORIENT_GLOBAL: - spacename = TIP_("global"); - break; - case V3D_ORIENT_GIMBAL: - spacename = TIP_("gimbal"); - break; - case V3D_ORIENT_NORMAL: - spacename = TIP_("normal"); - break; - case V3D_ORIENT_LOCAL: - spacename = TIP_("local"); - break; - case V3D_ORIENT_VIEW: - spacename = TIP_("view"); - break; - case V3D_ORIENT_CURSOR: - spacename = TIP_("cursor"); - break; - case V3D_ORIENT_CUSTOM_MATRIX: - spacename = TIP_("custom"); - break; - case V3D_ORIENT_CUSTOM: - default: - BLI_assert(orientation >= V3D_ORIENT_CUSTOM); - TransformOrientation *ts = BKE_scene_transform_orientation_find( - t->scene, orientation - V3D_ORIENT_CUSTOM); - spacename = ts->name; - break; - } + const char *spacename = transform_orientations_spacename_get(t, orientation); BLI_strncpy(t->spacename, spacename, sizeof(t->spacename)); copy_m3_m3(t->spacemtx, t->orient[orient_index].matrix); diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 56eac6f77c84..6eacdfaffec6 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -1637,6 +1637,7 @@ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat gpu_data_format, const vo } default: BLI_assert(!"Unhandled data format"); + depth = 0.0f; break; } glClearDepth(depth); @@ -1671,6 +1672,7 @@ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat gpu_data_format, const vo } default: BLI_assert(!"Unhandled data format"); + r = g = b = a = 0.0f; break; } glClearColor(r, g, b, a); diff --git a/source/blender/io/alembic/intern/abc_writer_archive.cc b/source/blender/io/alembic/intern/abc_writer_archive.cc index 5aae1f05f4b8..e7dee536cb99 100644 --- a/source/blender/io/alembic/intern/abc_writer_archive.cc +++ b/source/blender/io/alembic/intern/abc_writer_archive.cc @@ -52,7 +52,7 @@ static OArchive create_archive(std::ostream *ostream, abc_metadata.set(Alembic::Abc::kApplicationNameKey, "Blender"); abc_metadata.set(Alembic::Abc::kUserDescriptionKey, scene_name); - abc_metadata.set("blender_version", versionstr); + abc_metadata.set("blender_version", std::string("v") + BKE_blender_version_string()); abc_metadata.set("FramesPerTimeUnit", std::to_string(scene_fps)); time_t raw_time; diff --git a/source/blender/io/collada/DocumentExporter.cpp b/source/blender/io/collada/DocumentExporter.cpp index b890d4cf018b..0578bf45f042 100644 --- a/source/blender/io/collada/DocumentExporter.cpp +++ b/source/blender/io/collada/DocumentExporter.cpp @@ -243,20 +243,13 @@ int DocumentExporter::exportCurrentScene() #ifdef WITH_BUILDINFO BLI_snprintf(version_buf, sizeof(version_buf), - "Blender %d.%02d.%d commit date:%s, commit time:%s, hash:%s", - BLENDER_VERSION / 100, - BLENDER_VERSION % 100, - BLENDER_SUBVERSION, + "Blender %s commit date:%s, commit time:%s, hash:%s", + BKE_blender_version_string(), build_commit_date, build_commit_time, build_hash); #else - BLI_snprintf(version_buf, - sizeof(version_buf), - "Blender %d.%02d.%d", - BLENDER_VERSION / 100, - BLENDER_VERSION % 100, - BLENDER_SUBVERSION); + BLI_snprintf(version_buf, sizeof(version_buf), "Blender %s", BKE_blender_version_string()); #endif asset.getContributor().mAuthoringTool = version_buf; asset.add(); diff --git a/source/blender/io/usd/intern/usd_capi.cc b/source/blender/io/usd/intern/usd_capi.cc index 890e2fd205fe..cf962446d040 100644 --- a/source/blender/io/usd/intern/usd_capi.cc +++ b/source/blender/io/usd/intern/usd_capi.cc @@ -91,7 +91,8 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, pxr::VtValue(pxr::UsdGeomTokens->z)); usd_stage->SetMetadata(pxr::UsdGeomTokens->metersPerUnit, pxr::VtValue(scene->unit.scale_length)); - usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender ") + versionstr); + usd_stage->GetRootLayer()->SetDocumentation(std::string("Blender v") + + BKE_blender_version_string()); // Set up the stage for animated data. if (data->params.export_animation) { diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 39f22fb9555c..4f2bbc4ee731 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -327,7 +327,7 @@ typedef struct Library { /* Temp data needed by read/write code. */ int temp_index; - /** See BLENDER_VERSION, BLENDER_SUBVERSION, needed for do_versions. */ + /** See BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION, needed for do_versions. */ short versionfile, subversionfile; } Library; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index e74f42f5c103..13972ae032d2 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -1505,6 +1505,8 @@ enum { enum { MOD_WVG_MIX_INVERT_VGROUP_MASK = (1 << 0), MOD_WVG_MIX_WEIGHTS_NORMALIZE = (1 << 1), + MOD_WVG_MIX_INVERT_VGROUP_A = (1 << 2), + MOD_WVG_MIX_INVERT_VGROUP_B = (1 << 3), }; typedef struct WeightVGProximityModifierData { diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 0dd93242a172..7d3631888c3a 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -75,6 +75,7 @@ extern StructRNA RNA_BackgroundImage; extern StructRNA RNA_BevelModifier; extern StructRNA RNA_BezierSplinePoint; extern StructRNA RNA_BlendData; +extern StructRNA RNA_BlendDataLibraries; extern StructRNA RNA_BlendTexture; extern StructRNA RNA_BlenderRNA; extern StructRNA RNA_BoidRule; diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index cd7875d84e30..8454d5c125fa 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -1327,7 +1327,7 @@ static void rna_def_edit_bone(BlenderRNA *brna) prop, "Editbone Matrix", "Matrix combining loc/rot of the bone (head position, direction and roll), " - "in armature space (WARNING: does not include/support bone's length/size)"); + "in armature space (does not include/support bone's length/size)"); RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", NULL); RNA_api_armature_edit_bone(srna); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 885d65e50ada..f5a437b78922 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -2813,7 +2813,7 @@ static void rna_def_modifier_array(BlenderRNA *brna) prop, NULL, "rna_ArrayModifier_start_cap_set", NULL, "rna_Mesh_object_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); + RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); prop = RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap"); @@ -5012,6 +5012,16 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_defgrp_name_b_set"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "invert_vertex_group_a", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WVG_MIX_INVERT_VGROUP_A); + RNA_def_property_ui_text(prop, "Invert Weights A", "Invert the influence of vertex group A"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "invert_vertex_group_b", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WVG_MIX_INVERT_VGROUP_B); + RNA_def_property_ui_text(prop, "Invert Weights B", "Invert the influence of vertex group B"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); + prop = RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_FACTOR); RNA_def_property_range(prop, 0.0, 1.0f); RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index e0b872050c69..007c4f461b1b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -4739,7 +4739,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) 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"); + RNA_def_property_ui_text(prop, "Text Anti-Aliasing", "Draw user interface text anti-aliased"); RNA_def_property_update(prop, 0, "rna_userdef_text_update"); prop = RNA_def_property(srna, "text_hinting", PROP_ENUM, PROP_NONE); diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 57156aec5ec3..a71b1d9d0e8c 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -225,6 +225,16 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * int i; const bool invert_vgroup_mask = (wmd->flag & MOD_WVG_MIX_INVERT_VGROUP_MASK) != 0; const bool do_normalize = (wmd->flag & MOD_WVG_MIX_WEIGHTS_NORMALIZE) != 0; + + /* + * Note that we only invert the weight values within provided vgroups, the selection based on + * which vertice is affected because it belongs or not to a group remains unchanged. + * In other words, vertices not belonging to a group won't be affected, even though their + * inverted 'virtual' weight would be 1.0f. + */ + const bool invert_vgroup_a = (wmd->flag & MOD_WVG_MIX_INVERT_VGROUP_A) != 0; + const bool invert_vgroup_b = (wmd->flag & MOD_WVG_MIX_INVERT_VGROUP_B) != 0; + /* Flags. */ #if 0 const bool do_prev = (wmd->modifier.mode & eModifierMode_DoWeightPreview) != 0; @@ -379,8 +389,18 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* Mix weights. */ for (i = 0; i < numIdx; i++) { float weight2; - org_w[i] = dw1[i] ? dw1[i]->weight : wmd->default_weight_a; - weight2 = dw2[i] ? dw2[i]->weight : wmd->default_weight_b; + if (invert_vgroup_a) { + org_w[i] = 1.0f - (dw1[i] ? dw1[i]->weight : wmd->default_weight_a); + } + else { + org_w[i] = dw1[i] ? dw1[i]->weight : wmd->default_weight_a; + } + if (invert_vgroup_b) { + weight2 = 1.0f - (dw2[i] ? dw2[i]->weight : wmd->default_weight_b); + } + else { + weight2 = dw2[i] ? dw2[i]->weight : wmd->default_weight_b; + } new_w[i] = mix_weight(org_w[i], weight2, wmd->mix_mode); } diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 0f204e8d1bcc..bcd0c3a14857 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -380,10 +380,7 @@ void BPy_init_modules(void) PyModule_AddObject(mod, "types", BPY_rna_types()); /* needs to be first so bpy_types can run */ - BPY_library_load_module(mod); - BPY_library_write_module(mod); - - BPY_rna_id_collection_module(mod); + BPY_library_load_type_ready(); BPY_rna_gizmo_module(mod); diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index a9bdef1c3e4c..957d49eb04e3 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -82,10 +82,10 @@ extern char build_system[]; static PyTypeObject BlenderAppType; static PyStructSequence_Field app_info_fields[] = { - {"version", "The Blender version as a tuple of 3 numbers. eg. (2, 50, 11)"}, + {"version", "The Blender version as a tuple of 3 numbers. eg. (2, 83, 1)"}, {"version_string", "The Blender version formatted as a string"}, - {"version_char", "The Blender version character (for minor releases)"}, {"version_cycle", "The release status of this build alpha/beta/rc/release"}, + {"version_char", "Deprecated, always an empty string"}, {"binary_path", "The location of Blender's executable, useful for utilities that open new instances"}, {"background", @@ -160,12 +160,12 @@ static PyObject *make_app_info(void) #define SetBytesItem(str) PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str)) #define SetObjItem(obj) PyStructSequence_SET_ITEM(app_info, pos++, obj) - SetObjItem(PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION)); - SetObjItem(PyUnicode_FromFormat( - "%d.%02d (sub %d)", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION)); + SetObjItem( + PyC_Tuple_Pack_I32(BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH)); + SetStrItem(BKE_blender_version_string()); - SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR)); SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE)); + SetStrItem(""); SetStrItem(BKE_appdir_program_path()); SetObjItem(PyBool_FromLong(G.background)); SetObjItem(PyBool_FromLong(G.factory_startup)); diff --git a/source/blender/python/intern/bpy_library.h b/source/blender/python/intern/bpy_library.h index 3fd116d70285..6840807d2b0f 100644 --- a/source/blender/python/intern/bpy_library.h +++ b/source/blender/python/intern/bpy_library.h @@ -21,7 +21,9 @@ #ifndef __BPY_LIBRARY_H__ #define __BPY_LIBRARY_H__ -int BPY_library_load_module(PyObject *mod_par); -int BPY_library_write_module(PyObject *mod_par); +int BPY_library_load_type_ready(void); +extern PyMethodDef BPY_library_load_method_def; + +extern PyMethodDef BPY_library_write_method_def; #endif /* __BPY_LIBRARY_H__ */ diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c index 989b79314445..05cbc9af6013 100644 --- a/source/blender/python/intern/bpy_library_load.c +++ b/source/blender/python/intern/bpy_library_load.c @@ -459,15 +459,15 @@ static PyObject *bpy_lib_dir(BPy_Library *self) return PyDict_Keys(self->dict); } -int BPY_library_load_module(PyObject *mod_par) +PyMethodDef BPY_library_load_method_def = { + "load", + (PyCFunction)bpy_lib_load, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_lib_load_doc, +}; + +int BPY_library_load_type_ready(void) { - static PyMethodDef load_meth = { - "load", - (PyCFunction)bpy_lib_load, - METH_STATIC | METH_VARARGS | METH_KEYWORDS, - bpy_lib_load_doc, - }; - PyModule_AddObject(mod_par, "_library_load", PyCFunction_New(&load_meth, NULL)); /* some compilers don't like accessing this directly, delay assignment */ bpy_lib_Type.tp_getattro = PyObject_GenericGetAttr; diff --git a/source/blender/python/intern/bpy_library_write.c b/source/blender/python/intern/bpy_library_write.c index 6c8f1deb1267..fec0cef7b05f 100644 --- a/source/blender/python/intern/bpy_library_write.c +++ b/source/blender/python/intern/bpy_library_write.c @@ -204,16 +204,9 @@ static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject return ret; } -int BPY_library_write_module(PyObject *mod_par) -{ - static PyMethodDef write_meth = { - "write", - (PyCFunction)bpy_lib_write, - METH_STATIC | METH_VARARGS | METH_KEYWORDS, - bpy_lib_write_doc, - }; - - PyModule_AddObject(mod_par, "_library_write", PyCFunction_New(&write_meth, NULL)); - - return 0; -} +PyMethodDef BPY_library_write_method_def = { + "write", + (PyCFunction)bpy_lib_write, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_lib_write_doc, +}; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 39485f322d41..179daad2f603 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -9040,32 +9040,41 @@ void pyrna_struct_type_extend_capi(struct StructRNA *srna, struct PyMethodDef *method, struct PyGetSetDef *getset) { - PyObject *cls = pyrna_srna_Subtype(srna); + /* See 'add_methods' in Python's 'typeobject.c'. */ + PyTypeObject *type = (PyTypeObject *)pyrna_srna_Subtype(srna); + PyObject *dict = type->tp_dict; if (method != NULL) { for (; method->ml_name != NULL; method++) { - PyObject *func = PyCFunction_New(method, NULL); - PyObject *args = PyTuple_New(1); - PyTuple_SET_ITEM(args, 0, func); - PyObject *classmethod = PyObject_CallObject((PyObject *)&PyClassMethod_Type, args); + PyObject *py_method; - PyObject_SetAttrString(cls, method->ml_name, classmethod); + if (method->ml_flags & METH_CLASS) { + PyObject *cfunc = PyCFunction_New(method, (PyObject *)type); + py_method = PyClassMethod_New(cfunc); + Py_DECREF(cfunc); + } + else { + /* Currently only static and class methods are used. */ + BLI_assert(method->ml_flags & METH_STATIC); + py_method = PyCFunction_New(method, NULL); + } - Py_DECREF(classmethod); - Py_DECREF(args); /* Clears 'func' too. */ + int err = PyDict_SetItemString(dict, method->ml_name, py_method); + Py_DECREF(py_method); + BLI_assert(!(err < 0)); + UNUSED_VARS_NDEBUG(err); } } if (getset != NULL) { - PyObject *dict = ((PyTypeObject *)cls)->tp_dict; for (; getset->name != NULL; getset++) { - PyObject *descr = PyDescr_NewGetSet((PyTypeObject *)cls, getset); + PyObject *descr = PyDescr_NewGetSet(type, getset); /* Ensure we're not overwriting anything that already exists. */ BLI_assert(PyDict_GetItem(dict, PyDescr_NAME(descr)) == NULL); PyDict_SetItem(dict, PyDescr_NAME(descr), descr); Py_DECREF(descr); } } - Py_DECREF(cls); + Py_DECREF(type); } /* Access to 'owner_id' internal global. */ diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index 6b6ffa979951..b607f1635e63 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -385,32 +385,21 @@ static PyObject *bpy_orphans_purge(PyObject *UNUSED(self), return Py_None; } -int BPY_rna_id_collection_module(PyObject *mod_par) -{ - static PyMethodDef user_map = { - "user_map", (PyCFunction)bpy_user_map, METH_VARARGS | METH_KEYWORDS, bpy_user_map_doc}; - - PyModule_AddObject(mod_par, "_rna_id_collection_user_map", PyCFunction_New(&user_map, NULL)); - - static PyMethodDef batch_remove = { - "batch_remove", - (PyCFunction)bpy_batch_remove, - METH_VARARGS | METH_KEYWORDS, - bpy_batch_remove_doc, - }; - - PyModule_AddObject( - mod_par, "_rna_id_collection_batch_remove", PyCFunction_New(&batch_remove, NULL)); - - static PyMethodDef orphans_purge = { - "orphans_purge", - (PyCFunction)bpy_orphans_purge, - METH_VARARGS | METH_KEYWORDS, - bpy_orphans_purge_doc, - }; - - PyModule_AddObject( - mod_par, "_rna_id_collection_orphans_purge", PyCFunction_New(&orphans_purge, NULL)); - - return 0; -} +PyMethodDef BPY_rna_id_collection_user_map_method_def = { + "user_map", + (PyCFunction)bpy_user_map, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_user_map_doc, +}; +PyMethodDef BPY_rna_id_collection_batch_remove_method_def = { + "batch_remove", + (PyCFunction)bpy_batch_remove, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_batch_remove_doc, +}; +PyMethodDef BPY_rna_id_collection_orphans_purge_method_def = { + "orphans_purge", + (PyCFunction)bpy_orphans_purge, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_orphans_purge_doc, +}; diff --git a/source/blender/python/intern/bpy_rna_id_collection.h b/source/blender/python/intern/bpy_rna_id_collection.h index 8cb375960a9a..ee8f4c666a83 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.h +++ b/source/blender/python/intern/bpy_rna_id_collection.h @@ -21,6 +21,8 @@ #ifndef __BPY_RNA_ID_COLLECTION_H__ #define __BPY_RNA_ID_COLLECTION_H__ -int BPY_rna_id_collection_module(PyObject *); +extern PyMethodDef BPY_rna_id_collection_user_map_method_def; +extern PyMethodDef BPY_rna_id_collection_batch_remove_method_def; +extern PyMethodDef BPY_rna_id_collection_orphans_purge_method_def; #endif /* __BPY_RNA_ID_COLLECTION_H__ */ diff --git a/source/blender/python/intern/bpy_rna_types_capi.c b/source/blender/python/intern/bpy_rna_types_capi.c index cfd6b7f54a82..5a2ba4a5cdb4 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.c +++ b/source/blender/python/intern/bpy_rna_types_capi.c @@ -33,8 +33,10 @@ #include "BLI_utildefines.h" +#include "bpy_library.h" #include "bpy_rna.h" #include "bpy_rna_callback.h" +#include "bpy_rna_id_collection.h" #include "bpy_rna_types_capi.h" #include "../generic/py_capi_utils.h" @@ -45,6 +47,31 @@ #include "WM_api.h" +/* -------------------------------------------------------------------- */ +/** \name Blend Data + * \{ */ + +static struct PyMethodDef pyrna_blenddata_methods[] = { + {NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_user_map_method_def */ + {NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_batch_remove_method_def */ + {NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_orphans_purge_method_def */ + {NULL, NULL, 0, NULL}, +}; + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Blend Data Libraries + * \{ */ + +static struct PyMethodDef pyrna_blenddatalibraries_methods[] = { + {NULL, NULL, 0, NULL}, /* #BPY_library_load_method_def */ + {NULL, NULL, 0, NULL}, /* #BPY_library_write_method_def */ + {NULL, NULL, 0, NULL}, +}; + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Window Manager Clipboard Property * @@ -86,11 +113,11 @@ static int pyrna_WindowManager_clipboard_set(PyObject *UNUSED(self), static struct PyMethodDef pyrna_windowmanager_methods[] = { {"draw_cursor_add", (PyCFunction)pyrna_callback_classmethod_add, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, ""}, {"draw_cursor_remove", (PyCFunction)pyrna_callback_classmethod_remove, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, ""}, {NULL, NULL, 0, NULL}, }; @@ -147,11 +174,11 @@ PyDoc_STRVAR(pyrna_draw_handler_remove_doc, static struct PyMethodDef pyrna_space_methods[] = { {"draw_handler_add", (PyCFunction)pyrna_callback_classmethod_add, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, pyrna_draw_handler_add_doc}, {"draw_handler_remove", (PyCFunction)pyrna_callback_classmethod_remove, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, pyrna_draw_handler_remove_doc}, {NULL, NULL, 0, NULL}, }; @@ -164,7 +191,24 @@ static struct PyMethodDef pyrna_space_methods[] = { void BPY_rna_types_extend_capi(void) { + /* BlendData */ + ARRAY_SET_ITEMS(pyrna_blenddata_methods, + BPY_rna_id_collection_user_map_method_def, + BPY_rna_id_collection_batch_remove_method_def, + BPY_rna_id_collection_orphans_purge_method_def); + BLI_assert(ARRAY_SIZE(pyrna_blenddata_methods) == 4); + pyrna_struct_type_extend_capi(&RNA_BlendData, pyrna_blenddata_methods, NULL); + + /* BlendDataLibraries */ + ARRAY_SET_ITEMS( + pyrna_blenddatalibraries_methods, BPY_library_load_method_def, BPY_library_write_method_def); + BLI_assert(ARRAY_SIZE(pyrna_blenddatalibraries_methods) == 3); + pyrna_struct_type_extend_capi(&RNA_BlendDataLibraries, pyrna_blenddatalibraries_methods, NULL); + + /* Space */ pyrna_struct_type_extend_capi(&RNA_Space, pyrna_space_methods, NULL); + + /* WindowManager */ pyrna_struct_type_extend_capi( &RNA_WindowManager, pyrna_windowmanager_methods, pyrna_windowmanager_getset); } diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index 569f5634e917..242d9516afdd 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -96,37 +96,6 @@ static void wm_block_splash_add_label(uiBlock *block, const char *label, int x, UI_block_emboss_set(block, UI_EMBOSS); } -static void get_version_string(char *ver, const int max_length) -{ - /* Version number. */ - const char *version_cycle = NULL; - - if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "alpha")) { - version_cycle = " Alpha"; - } - else if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "beta")) { - version_cycle = " Beta"; - } - else if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "rc")) { - version_cycle = " Release Candidate"; - } - else if (STREQ(STRINGIFY(UPBGE_VERSION_CYCLE), "release")) { - version_cycle = STRINGIFY(UPBGE_VERSION_CHAR); - } - - /*const char *version_cycle_number = ""; - if (strlen(STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER))) { - version_cycle_number = " " STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER); - }*/ - - BLI_snprintf(ver, - max_length, - "UPBGE %d.%d.%d%s", - UPBGE_VERSION / 10, - UPBGE_VERSION % 10, - UPBGE_SUBVERSION, - version_cycle); -} #ifndef WITH_HEADLESS static void wm_block_splash_image_roundcorners_add(ImBuf *ibuf) @@ -251,9 +220,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE UI_but_func_set(but, wm_block_close, block, NULL); UI_block_func_set(block, wm_block_splash_refreshmenu, block, NULL); - char version_buf[256] = "\0"; - get_version_string(version_buf, sizeof(version_buf)); - wm_block_splash_add_label(block, version_buf, splash_width, splash_height - 13.0 * U.dpi_fac); + wm_block_splash_add_label( + block, BKE_upbge_version_string(), splash_width, splash_height - 13.0 * U.dpi_fac); const int layout_margin_x = U.dpi_fac * 26; uiLayout *layout = UI_block_layout(block, @@ -316,7 +284,7 @@ static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED /* Split layout to put Blender logo on left side. */ uiLayout *split_block = uiLayoutSplit(block_layout, split_factor, false); - /* Blender Logo. */ + /* UPBGE Logo. */ uiLayout *layout = uiLayoutColumn(split_block, false); uiDefButAlert(block, ALERT_ICON_BLENDER, 0, 0, 0, logo_size); @@ -328,12 +296,10 @@ static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED uiItemS_ex(layout, 1.0f); /* Title. */ - uiItemL_ex(layout, "Blender", ICON_NONE, true, false); + uiItemL_ex(layout, "UPBGE", ICON_NONE, true, false); /* Version. */ - char str_buf[256] = "\0"; - get_version_string(str_buf, sizeof(str_buf)); - uiItemL(layout, str_buf, ICON_NONE); + uiItemL(layout, BKE_upbge_version_string(), ICON_NONE); uiItemS_ex(layout, 3.0f); @@ -341,6 +307,7 @@ static uiBlock *wm_block_create_about(bContext *C, ARegion *region, void *UNUSED extern char build_hash[], build_commit_date[], build_commit_time[], build_branch[]; + char str_buf[256] = "\0"; BLI_snprintf(str_buf, sizeof(str_buf), "Date: %s %s", build_commit_date, build_commit_time); uiItemL(layout, str_buf, ICON_NONE); @@ -375,9 +342,9 @@ static int wm_about_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *U void WM_OT_splash_about(wmOperatorType *ot) { - ot->name = "About Blender"; + ot->name = "About UPBGE"; ot->idname = "WM_OT_splash_about"; - ot->description = "Open a window with information about Blender"; + ot->description = "Open a window with information about UPBGE"; ot->invoke = wm_about_invoke; ot->poll = WM_operator_winactive; diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index bb6edd28adba..92c407840dad 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -965,8 +965,8 @@ elseif(APPLE) set_target_properties(blender PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist - MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR}" - MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}${BLENDER_VERSION_CHAR} ${BLENDER_DATE}") + MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH}" + MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH} ${BLENDER_DATE}") # Gather the date in finder-style execute_process(COMMAND date "+%m/%d/%Y/%H:%M" diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index c3f4bdc561b5..56e571d570ca 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -467,7 +467,7 @@ static void arg_py_context_restore(bContext *C, struct BlendePyContextStore *c_p static void print_version_full(void) { - printf(BLEND_VERSION_STRING_FMT); + printf("Blender %s\n", BKE_blender_version_string()); # ifdef BUILD_DATE printf("\tbuild date: %s\n", build_date); printf("\tbuild time: %s\n", build_time); @@ -488,13 +488,13 @@ static void print_version_short(void) # ifdef BUILD_DATE /* NOTE: We include built time since sometimes we need to tell broken from * working built of the same hash. */ - printf(BLEND_VERSION_FMT " (hash %s built %s %s)\n", - BLEND_VERSION_ARG, + printf("Blender %s (hash %s built %s %s)\n", + BKE_blender_version_string(), build_hash, build_date, build_time); # else - printf(BLEND_VERSION_STRING_FMT); + printf("Blender %s\n", BKE_blender_version_string()); # endif } @@ -520,7 +520,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo { bArgs *ba = (bArgs *)data; - printf(BLEND_VERSION_STRING_FMT); + printf("Blender %s\n", BKE_blender_version_string()); printf("Usage: blender [args ...] [file] [args ...]\n\n"); printf("Render Options:\n"); @@ -918,7 +918,7 @@ static const char arg_handle_debug_mode_set_doc[] = static int arg_handle_debug_mode_set(int UNUSED(argc), const char **UNUSED(argv), void *data) { G.debug |= G_DEBUG; /* std output printf's */ - printf(BLEND_VERSION_STRING_FMT); + printf("Blender %s\n", BKE_blender_version_string()); MEM_set_memory_debug(); # ifndef NDEBUG BLI_mempool_set_memory_debug(); diff --git a/source/creator/creator_intern.h b/source/creator/creator_intern.h index 12344c82d99c..528a13830cc9 100644 --- a/source/creator/creator_intern.h +++ b/source/creator/creator_intern.h @@ -55,10 +55,8 @@ extern struct ApplicationState app_state; /* creator.c */ /* for the callbacks: */ #ifndef WITH_PYTHON_MODULE -# define BLEND_VERSION_FMT "Blender %d.%02d (sub %d)" -# define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION -/* pass directly to printf */ -# define BLEND_VERSION_STRING_FMT BLEND_VERSION_FMT "\n", BLEND_VERSION_ARG +# define BLEND_VERSION_FMT "Blender %d.%02d.%d" +# define BLEND_VERSION_ARG BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH #endif #ifdef WITH_BUILDINFO_HEADER diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 1df7e012a53c..0ec7f71f047c 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -2717,13 +2717,12 @@ PyMODINIT_FUNC initApplicationPythonBinding() PyDict_SetItemString( d, "version", - Py_BuildValue("(iii)", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION)); + Py_BuildValue("(iii)", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH)); PyDict_SetItemString( d, - "version_string", - PyUnicode_FromFormat( - "%d.%02d (sub %d)", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION)); - PyDict_SetItemString(d, "version_char", PyUnicode_FromString(STRINGIFY(BLENDER_VERSION_CHAR))); + "version_string", + PyUnicode_FromFormat( + "%d.%02d (sub %d)", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_VERSION_PATCH)); PyDict_SetItemString(d, "has_texture_ffmpeg",