[Bf-blender-cvs] [3e292404d27] master: Build: fix/workaround for the opencollada.diff not applying on Linux
Commit: 3e292404d27dc5aaddc2fcca67ceedf7e30d2cbc Author: Campbell Barton Date: Tue Oct 25 17:49:14 2022 +1100 Branches: master https://developer.blender.org/rB3e292404d27dc5aaddc2fcca67ceedf7e30d2cbc Build: fix/workaround for the opencollada.diff not applying on Linux === M build_files/build_environment/cmake/opencollada.cmake === diff --git a/build_files/build_environment/cmake/opencollada.cmake b/build_files/build_environment/cmake/opencollada.cmake index 9473aafbe88..b1a3028debd 100644 --- a/build_files/build_environment/cmake/opencollada.cmake +++ b/build_files/build_environment/cmake/opencollada.cmake @@ -4,6 +4,18 @@ if(UNIX) set(OPENCOLLADA_EXTRA_ARGS -DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2 -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2.a) + + # WARNING: the patch contains mixed UNIX and DOS line endings + # as does the OPENCOLLADA package, if this can be corrected upstream that would be better. + # For now use `sed` to force UNIX line endings so the patch applies. + # Needed as neither ignoring white-space or applying as a binary resolve this problem. + set(PATCH_MAYBE_DOS2UNIX_CMD +sed -i "s/\\r//" +${PATCH_DIR}/opencollada.diff +${BUILD_DIR}/opencollada/src/external_opencollada/CMakeLists.txt + ${BUILD_DIR}/opencollada/src/external_opencollada/Externals/LibXML/CMakeLists.txt && + ) + else() set(OPENCOLLADA_EXTRA_ARGS -DCMAKE_DEBUG_POSTFIX=_d @@ -14,6 +26,7 @@ else() else() list(APPEND OPENCOLLADA_EXTRA_ARGS -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2sd.lib) endif() + set(PATCH_MAYBE_DOS2UNIX_CMD) endif() ExternalProject_Add(external_opencollada @@ -21,11 +34,14 @@ ExternalProject_Add(external_opencollada DOWNLOAD_DIR ${DOWNLOAD_DIR} URL_HASH ${OPENCOLLADA_HASH_TYPE}=${OPENCOLLADA_HASH} PREFIX ${BUILD_DIR}/opencollada - PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencollada/src/external_opencollada < ${PATCH_DIR}/opencollada.diff + PATCH_COMMAND +${PATCH_MAYBE_DOS2UNIX_CMD} +${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencollada/src/external_opencollada < ${PATCH_DIR}/opencollada.diff CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencollada ${DEFAULT_CMAKE_FLAGS} ${OPENCOLLADA_EXTRA_ARGS} INSTALL_DIR ${LIBDIR}/opencollada ) +unset(PATCH_MAYBE_DOS2UNIX_CMD) add_dependencies( external_opencollada ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [059d9631924] master: GHOST/Wayland: store fractional scaling in each window instead of DPI
Commit: 059d9631924366ba66b0cacf50cb5dad95889fe2 Author: Campbell Barton Date: Tue Oct 25 15:25:26 2022 +1100 Branches: master https://developer.blender.org/rB059d9631924366ba66b0cacf50cb5dad95889fe2 GHOST/Wayland: store fractional scaling in each window instead of DPI This makes it possible to access the fractional scaling for a window, there is no need to store the DPI which can be returned by getDPIHint(). === M intern/ghost/intern/GHOST_WindowWayland.cpp M intern/ghost/intern/GHOST_WindowWayland.h === diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp index f9d7f5c25e2..edcbcc14a37 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cpp +++ b/intern/ghost/intern/GHOST_WindowWayland.cpp @@ -90,13 +90,8 @@ struct GWL_Window { /** The scale value written to #wl_surface_set_buffer_scale. */ int scale = 0; - /** - * The DPI, either: - * - `scale * base_dpi` - * - `wl_fixed_to_int(scale_fractional * base_dpi)` - * When fractional scaling is available. - */ - uint32_t dpi = 0; + /** The fractional scale used to calculate the DPI. */ + wl_fixed_t scale_fractional = 0; #ifdef WITH_GHOST_WAYLAND_LIBDECOR WGL_LibDecor_Window *libdecor = nullptr; @@ -147,7 +142,7 @@ static int output_scale_cmp(const GWL_Output *output_a, const GWL_Output *output static int outputs_max_scale_or_default(const std::vector &outputs, const int32_t scale_default, -uint32_t *r_dpi) +wl_fixed_t *r_scale_fractional) { const GWL_Output *output_max = nullptr; for (const GWL_Output *reg_output : outputs) { @@ -157,18 +152,16 @@ static int outputs_max_scale_or_default(const std::vector &outputs } if (output_max) { -if (r_dpi) { - *r_dpi = output_max->has_scale_fractional ? - /* Fractional DPI. */ - wl_fixed_to_int(output_max->scale_fractional * base_dpi) : - /* Simple non-fractional DPI. */ - (output_max->scale * base_dpi); +if (r_scale_fractional) { + *r_scale_fractional = output_max->has_scale_fractional ? +output_max->scale_fractional : +wl_fixed_from_int(output_max->scale); } return output_max->scale; } - if (r_dpi) { -*r_dpi = scale_default * base_dpi; + if (r_scale_fractional) { +*r_scale_fractional = wl_fixed_from_int(scale_default); } return scale_default; } @@ -479,7 +472,7 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system, * * Using the maximum scale is best as it results in the window first being smaller, * avoiding a large window flashing before it's made smaller. */ - window_->scale = outputs_max_scale_or_default(system_->outputs(), 1, &window_->dpi); + window_->scale = outputs_max_scale_or_default(system_->outputs(), 1, &window_->scale_fractional); /* Window surfaces. */ window_->wl_surface = wl_compositor_create_surface(system_->wl_compositor()); @@ -751,7 +744,9 @@ GHOST_WindowWayland::~GHOST_WindowWayland() uint16_t GHOST_WindowWayland::getDPIHint() { - return window_->dpi; + /* Using the physical DPI will cause wrong scaling of the UI + * use a multiplier for the default DPI as a workaround. */ + return wl_fixed_to_int(window_->scale_fractional * base_dpi); } GHOST_TSuccess GHOST_WindowWayland::setWindowCursorVisibility(bool visible) @@ -962,14 +957,14 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType * Expose some members via methods. * \{ */ -uint16_t GHOST_WindowWayland::dpi() const +int GHOST_WindowWayland::scale() const { - return window_->dpi; + return window_->scale; } -int GHOST_WindowWayland::scale() const +wl_fixed_t GHOST_WindowWayland::scale_fractional() const { - return window_->scale; + return window_->scale_fractional; } wl_surface *GHOST_WindowWayland::wl_surface() const @@ -1035,13 +1030,13 @@ GHOST_TSuccess GHOST_WindowWayland::notify_size() */ bool GHOST_WindowWayland::outputs_changed_update_scale() { - uint32_t dpi_next; - const int scale_next = outputs_max_scale_or_default(outputs(), 0, &dpi_next); + wl_fixed_t scale_fractional_next = 0; + const int scale_next = outputs_max_scale_or_default(outputs(), 0, &scale_fractional_next); if (UNLIKELY(scale_next == 0)) { return false; } - const uint32_t dpi_curr = window_->dpi; + const wl_fixed_t scale_fractional_curr = window_->scale_fractional; const int scale_curr = window_->scale; bool changed = false; @@ -1055,10 +1050,8 @@ bool GHOST_WindowWayland::outputs_changed_update_scale() changed = true; } - if (dpi_next != dpi_curr) { -/* Using the real DPI will
[Bf-blender-cvs] [71079d49e2f] master: Cleanup: move ghost/wayland local methods after type declarations
Commit: 71079d49e2f0e6a649e32ad3b2651eb27da75be7 Author: Campbell Barton Date: Tue Oct 25 15:00:02 2022 +1100 Branches: master https://developer.blender.org/rB71079d49e2f0e6a649e32ad3b2651eb27da75be7 Cleanup: move ghost/wayland local methods after type declarations Also correct prefix naming. === M intern/ghost/intern/GHOST_SystemWayland.cpp M intern/ghost/intern/GHOST_WindowWayland.cpp === diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index ea2975d1c19..f565dad3284 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -92,6 +92,7 @@ static void gwl_seat_capability_touch_disable(GWL_Seat *seat); static bool gwl_registry_entry_remove_by_name(GWL_Display *display, uint32_t name, int *r_interface_slot); +static void gwl_registry_entry_remove_all(GWL_Display *display); struct GWL_RegistryHandler; static int gwl_registry_handler_interface_slot_max(); @@ -718,6 +719,30 @@ struct GWL_Seat { uint32_t data_source_serial = 0; }; +static GWL_SeatStatePointer *gwl_seat_state_pointer_active(GWL_Seat *seat) +{ + if (seat->pointer.serial == seat->cursor_source_serial) { +return &seat->pointer; + } + if (seat->tablet.serial == seat->cursor_source_serial) { +return &seat->tablet; + } + return nullptr; +} + +static GWL_SeatStatePointer *gwl_seat_state_pointer_from_cursor_surface( +GWL_Seat *seat, const wl_surface *wl_surface) +{ + if (ghost_wl_surface_own_cursor_pointer(wl_surface)) { +return &seat->pointer; + } + if (ghost_wl_surface_own_cursor_tablet(wl_surface)) { +return &seat->tablet; + } + GHOST_ASSERT(0, "Surface found without pointer/tablet tag"); + return nullptr; +} + /** \} */ /* */ @@ -726,6 +751,9 @@ struct GWL_Seat { struct GWL_RegistryEntry; +/** Check this lock before accessing #GHOST_SystemWayland::clipboard_ from a thread. */ +static std::mutex system_clipboard_mutex; + struct GWL_Display { GHOST_SystemWayland *system = nullptr; @@ -757,6 +785,44 @@ struct GWL_Display { GWL_SimpleBuffer clipboard_primary; }; +static void gwl_display_destroy(GWL_Display *display) +{ + /* Unregister items in reverse order. */ + gwl_registry_entry_remove_all(display); + +#ifdef WITH_GHOST_WAYLAND_LIBDECOR + if (use_libdecor) { +if (display->libdecor) { + gwl_libdecor_system_destroy(display->libdecor); + display->libdecor = nullptr; +} + } + else +#endif + { +if (display->xdg_decor) { + gwl_xdg_decor_system_destroy(display, display->xdg_decor); + display->xdg_decor = nullptr; +} + } + + if (eglGetDisplay) { +::eglTerminate(eglGetDisplay(EGLNativeDisplayType(display->wl_display))); + } + + if (display->wl_display) { +wl_display_disconnect(display->wl_display); + } + + { +std::lock_guard lock{system_clipboard_mutex}; +gwl_simple_buffer_free_data(&display->clipboard); +gwl_simple_buffer_free_data(&display->clipboard_primary); + } + + delete display; +} + /** \} */ /* */ @@ -937,9 +1003,6 @@ static void gwl_registry_entry_remove_all(GWL_Display *display) static GHOST_WindowManager *window_manager = nullptr; -/** Check this lock before accessing #GHOST_SystemWayland::clipboard_ from a thread. */ -static std::mutex system_clipboard_mutex; - /** * Callback for WAYLAND to run when there is an error. * @@ -957,68 +1020,6 @@ static void ghost_wayland_log_handler(const char *msg, va_list arg) } } -static GWL_SeatStatePointer *seat_state_pointer_active(GWL_Seat *seat) -{ - if (seat->pointer.serial == seat->cursor_source_serial) { -return &seat->pointer; - } - if (seat->tablet.serial == seat->cursor_source_serial) { -return &seat->tablet; - } - return nullptr; -} - -static GWL_SeatStatePointer *seat_state_pointer_from_cursor_surface(GWL_Seat *seat, -const wl_surface *wl_surface) -{ - if (ghost_wl_surface_own_cursor_pointer(wl_surface)) { -return &seat->pointer; - } - if (ghost_wl_surface_own_cursor_tablet(wl_surface)) { -return &seat->tablet; - } - GHOST_ASSERT(0, "Surface found without pointer/tablet tag"); - return nullptr; -} - -static void display_destroy(GWL_Display *display) -{ - /* Unregister items in reverse order. */ - gwl_registry_entry_remove_all(display); - -#ifdef WITH_GHOST_WAYLAND_LIBDECOR - if (use_libdecor) { -if (display->libdecor) { - gwl_libdecor_system_destroy(display->libdecor); - display->libdecor = nullptr; -} - } - else -#endif - { -if (display->xdg_deco
[Bf-blender-cvs] [dd08b490afc] master: Cleanup: move singleton pointers into the system
Commit: dd08b490afc9224d700eb08c39a4a1a5aa2317a9 Author: Campbell Barton Date: Tue Oct 25 15:00:03 2022 +1100 Branches: master https://developer.blender.org/rBdd08b490afc9224d700eb08c39a4a1a5aa2317a9 Cleanup: move singleton pointers into the system Avoid top level global pointers, remove the window_manager pointer and move the clipboard mutex along side the clipboard data. Also skip updating window DPI if the window doesn't use the output that changed it's scale. === M intern/ghost/intern/GHOST_SystemWayland.cpp M intern/ghost/intern/GHOST_SystemWayland.h === diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index f565dad3284..60247660a9c 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -751,9 +751,6 @@ static GWL_SeatStatePointer *gwl_seat_state_pointer_from_cursor_surface( struct GWL_RegistryEntry; -/** Check this lock before accessing #GHOST_SystemWayland::clipboard_ from a thread. */ -static std::mutex system_clipboard_mutex; - struct GWL_Display { GHOST_SystemWayland *system = nullptr; @@ -783,6 +780,7 @@ struct GWL_Display { GWL_SimpleBuffer clipboard; GWL_SimpleBuffer clipboard_primary; + std::mutex clipboard_mutex; }; static void gwl_display_destroy(GWL_Display *display) @@ -815,7 +813,7 @@ static void gwl_display_destroy(GWL_Display *display) } { -std::lock_guard lock{system_clipboard_mutex}; +std::lock_guard lock{display->clipboard_mutex}; gwl_simple_buffer_free_data(&display->clipboard); gwl_simple_buffer_free_data(&display->clipboard_primary); } @@ -1001,8 +999,6 @@ static void gwl_registry_entry_remove_all(GWL_Display *display) /** \name Private Utility Functions * \{ */ -static GHOST_WindowManager *window_manager = nullptr; - /** * Callback for WAYLAND to run when there is an error. * @@ -2004,7 +2000,8 @@ static void data_device_handle_selection(void *data, data_offer, mime_receive.c_str(), &seat->data_offer_copy_paste_mutex, &data_len); { - std::lock_guard lock{system_clipboard_mutex}; + std::mutex &clipboard_mutex = system->clipboard_mutex(); + std::lock_guard lock{clipboard_mutex}; GWL_SimpleBuffer *buf = system->clipboard_data(false); gwl_simple_buffer_set_and_take_ownership(buf, data, data_len); } @@ -3581,7 +3578,8 @@ static void primary_selection_device_handle_selection( data_offer, mime_receive.c_str(), &primary->data_offer_mutex, &data_len); { - std::lock_guard lock{system_clipboard_mutex}; + std::mutex &clipboard_mutex = system->clipboard_mutex(); + std::lock_guard lock{clipboard_mutex}; GWL_SimpleBuffer *buf = system->clipboard_data(true); gwl_simple_buffer_set_and_take_ownership(buf, data, data_len); } @@ -4052,11 +4050,17 @@ static void output_handle_done(void *data, struct wl_output * /*wl_output*/) static void output_handle_scale(void *data, struct wl_output * /*wl_output*/, const int32_t factor) { CLOG_INFO(LOG, 2, "scale"); - static_cast(data)->scale = factor; + GWL_Output *output = static_cast(data); + output->scale = factor; + GHOST_WindowManager *window_manager = output->system->getWindowManager(); if (window_manager) { for (GHOST_IWindow *iwin : window_manager->getWindows()) { GHOST_WindowWayland *win = static_cast(iwin); + const std::vector &outputs = win->outputs(); + if (std::find(outputs.begin(), outputs.end(), output) == outputs.cend()) { +continue; + } win->outputs_changed_update_scale(); } } @@ -4235,6 +4239,7 @@ static void gwl_registry_xdg_output_manager_remove(GWL_Display *display, static void gwl_registry_wl_output_add(GWL_Display *display, const GWL_RegisteryAdd_Params *params) { GWL_Output *output = new GWL_Output; + output->system = display->system; output->wl_output = static_cast( wl_registry_bind(params->wl_registry, params->name, &wl_output_interface, 2)); ghost_wl_output_tag(output->wl_output); @@ -5226,10 +5231,6 @@ GHOST_IWindow *GHOST_SystemWayland::createWindow(const char *title, const GHOST_IWindow *parentWindow) { /* Globally store pointer to window manager. */ - if (!window_manager) { -window_manager = getWindowManager(); - } - GHOST_WindowWayland *window = new GHOST_WindowWayland( this, title, @@ -6020,6 +6021,11 @@ struct GWL_SimpleBuffer *GHOST_SystemWayland::clipboard_data(bool selection) con return selection ? &display_->clipboard_primary : &display_->clipboard; } +struct std::mutex &GHOST_SystemWayland::clipboard_mutex() const +{ + return display_->clipboard_mutex; +} + #ifdef WITH_GHOST_WAYLAND_LIBDECOR bool GHOST_SystemWayland::use_libdecor
[Bf-blender-cvs] [bf0ae05d25e] master: Fix T82412: Space-mouse not registering (WIN32)
Commit: bf0ae05d25eab9e937b2b56ef5a931eb57e09d9d Author: Campbell Barton Date: Thu Oct 13 11:28:10 2022 +1100 Branches: master https://developer.blender.org/rBbf0ae05d25eab9e937b2b56ef5a931eb57e09d9d Fix T82412: Space-mouse not registering (WIN32) Using the 3DConnexion Universal Wireless Receiver on MS-Windows caused a different ID to be reported. While I'm not sure of the cause of this, adding the ID doesn't conflict with other devices and fixes the problem. === M intern/ghost/intern/GHOST_NDOFManager.cpp === diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp index 9e9b9f14c43..5484da82a18 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.cpp +++ b/intern/ghost/intern/GHOST_NDOFManager.cpp @@ -302,6 +302,7 @@ bool GHOST_NDOFManager::setDevice(ushort vendor_id, ushort product_id) switch (product_id) { case 0xC62E: /* Plugged in. */ case 0xC62F: /* Wireless. */ +case 0xC658: /* Wireless (3DConnexion Universal Wireless Receiver in WIN32), see T82412. */ { device_type_ = NDOF_SpaceMouseWireless; hid_map_button_num_ = 2; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c1768507a9b] master: Correct naming in 97414fb484fe37b8da69a2b570a659535bbf2a0f
Commit: c1768507a9b5cd1606f4d8b9f61a46f0015761a4 Author: Campbell Barton Date: Tue Oct 25 13:24:56 2022 +1100 Branches: master https://developer.blender.org/rBc1768507a9b5cd1606f4d8b9f61a46f0015761a4 Correct naming in 97414fb484fe37b8da69a2b570a659535bbf2a0f === M intern/ghost/intern/GHOST_SystemWayland.cpp === diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 65b4e890d88..ea2975d1c19 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -790,14 +790,14 @@ using GWL_RegistryHandler_AddFn = void (*)(GWL_Display *display, * Otherwise it can be assumed that all objects will be freed and none will be used again, * so there is no need to ensure a valid state. */ -using GWL_RegistryEntry_FreeFn = void (*)(GWL_Display *display, void *user_data, bool on_exit); +using GWL_RegistryEntry_RemoveFn = void (*)(GWL_Display *display, void *user_data, bool on_exit); struct GWL_RegistryHandler { /** Pointer to the name (not the name it's self), needed as the values aren't set on startup. */ const char *const *interface_p = nullptr; GWL_RegistryHandler_AddFn add_fn = nullptr; - GWL_RegistryEntry_FreeFn remove_fn = nullptr; + GWL_RegistryEntry_RemoveFn remove_fn = nullptr; }; /** \} */ ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [97414fb484f] master: GHOST/Wayland: support adding/removing global objects at runtime
Commit: 97414fb484fe37b8da69a2b570a659535bbf2a0f Author: Campbell Barton Date: Mon Oct 24 20:33:33 2022 +1100 Branches: master https://developer.blender.org/rB97414fb484fe37b8da69a2b570a659535bbf2a0f GHOST/Wayland: support adding/removing global objects at runtime Share logic for adding/removing global objects and freeing them on exit. Refactor object registration add/remove into an array of callbacks to localize logic into generic functions for each kind of interface. Also corrects own error where the primary clipboard manager wasn't being destroyed on exit. === M intern/ghost/intern/GHOST_SystemWayland.cpp === diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 67f475a2963..65b4e890d88 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -89,6 +89,15 @@ static void gwl_seat_capability_pointer_disable(GWL_Seat *seat); static void gwl_seat_capability_keyboard_disable(GWL_Seat *seat); static void gwl_seat_capability_touch_disable(GWL_Seat *seat); +static bool gwl_registry_entry_remove_by_name(GWL_Display *display, + uint32_t name, + int *r_interface_slot); + +struct GWL_RegistryHandler; +static int gwl_registry_handler_interface_slot_max(); +static const struct GWL_RegistryHandler *gwl_registry_handler_from_interface_slot( +int interface_slot); + /* */ /** \name Local Defines * @@ -138,6 +147,8 @@ static bool use_gnome_confine_hack = false; # define USE_GNOME_NEEDS_LIBDECOR_HACK #endif +#define WL_NAME_UNSET uint32_t(-1) + /** \} */ /* */ @@ -527,6 +538,7 @@ static void gwl_libdecor_system_destroy(GWL_LibDecor_System *decor) { if (decor->context) { libdecor_unref(decor->context); +decor->context = nullptr; } delete decor; } @@ -534,16 +546,21 @@ static void gwl_libdecor_system_destroy(GWL_LibDecor_System *decor) struct GWL_XDG_Decor_System { struct xdg_wm_base *shell = nullptr; + uint32_t shell_name = WL_NAME_UNSET; + struct zxdg_decoration_manager_v1 *manager = nullptr; + uint32_t manager_name = WL_NAME_UNSET; }; -static void gwl_xdg_decor_system_destroy(GWL_XDG_Decor_System *decor) +static void gwl_xdg_decor_system_destroy(struct GWL_Display *display, GWL_XDG_Decor_System *decor) { if (decor->manager) { -zxdg_decoration_manager_v1_destroy(decor->manager); +gwl_registry_entry_remove_by_name(display, decor->manager_name, nullptr); +GHOST_ASSERT(decor->manager == nullptr, "Internal registry error"); } if (decor->shell) { -xdg_wm_base_destroy(decor->shell); +gwl_registry_entry_remove_by_name(display, decor->shell_name, nullptr); +GHOST_ASSERT(decor->shell == nullptr, "Internal registry error"); } delete decor; } @@ -707,9 +724,13 @@ struct GWL_Seat { /** \name Internal #GWL_Display Type (#wl_display & #wl_compositor wrapper) * \{ */ +struct GWL_RegistryEntry; + struct GWL_Display { GHOST_SystemWayland *system = nullptr; + struct GWL_RegistryEntry *registry_entry = nullptr; + struct wl_display *wl_display = nullptr; struct wl_compositor *wl_compositor = nullptr; @@ -738,6 +759,178 @@ struct GWL_Display { /** \} */ +/* */ +/** \name Internal #GWL_RegistryHandler + * \{ */ + +struct GWL_RegisteryAdd_Params { + struct GWL_Display *display = nullptr; + struct wl_registry *wl_registry = nullptr; + uint32_t name = 0; + uint32_t version = 0; + /** Index within `gwl_registry_handlers`. */ + int interface_slot = 0; +}; + +/** + * Add callback for object registry. + * \param display: The display which holes a reference to the global object. + * \param params: Various arguments needed for registration. + */ +using GWL_RegistryHandler_AddFn = void (*)(GWL_Display *display, + const GWL_RegisteryAdd_Params *params); + +/** + * Remove callback for object registry. + * \param display: The display which holes a reference to the global object. + * \param user_data: Optional reference to a sub element of `display`, + * use for outputs or seats for e.g. when the display may hold multiple references. + * \param on_exit: Enabled when freeing on exit. + * When true the consistency of references between objects should be kept valid. + * Otherwise it can be assumed that all objects will be freed and none will be used again, + * so there is no need to ensure a valid state. + */ +using GWL_RegistryEntry_FreeFn = void (*)(GWL_Display *display, void *user_data, bool on_exit); + +struct GWL_RegistryHandler { + /** Poi
[Bf-blender-cvs] [784ea87375c] universal-scene-description: Merge branch 'master' into universal-scene-description
Commit: 784ea87375cebd7c12faada555f65c741895bca0 Author: Michael Kowalski Date: Mon Oct 24 15:28:20 2022 -0400 Branches: universal-scene-description https://developer.blender.org/rB784ea87375cebd7c12faada555f65c741895bca0 Merge branch 'master' into universal-scene-description === === diff --cc source/blender/io/usd/intern/usd_reader_mesh.cc index 7a12258df0a,01db6baeb5c..9c0c76a50c1 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@@ -861,11 -804,10 +861,11 @@@ void USDMeshReader::readFaceSetsSample( std::map mat_map; bke::MutableAttributeAccessor attributes = mesh->attributes_for_write(); - bke::SpanAttributeWriter material_indices = - attributes.lookup_or_add_for_write_only_span("material_index", ATTR_DOMAIN_FACE); + bke::SpanAttributeWriter material_indices = attributes.lookup_or_add_for_write_span( + "material_index", ATTR_DOMAIN_FACE); this->assign_facesets_to_material_indices(motionSampleTime, material_indices.span, &mat_map); material_indices.finish(); + /* Build material name map if it's not built yet. */ if (this->settings_->mat_name_to_mat.empty()) { utils::build_mat_map(bmain, &this->settings_->mat_name_to_mat); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [954b834053f] master: Fix T102015: AV1 - No valid formats found
Commit: 954b834053f17f1c0ff1f3096030b81d0d9ea7ec Author: Ray Molenkamp Date: Mon Oct 24 11:59:24 2022 -0600 Branches: master https://developer.blender.org/rB954b834053f17f1c0ff1f3096030b81d0d9ea7ec Fix T102015: AV1 - No valid formats found I did a poor master merge in D14920 before landing and AV_CODEC_ID_AV1 accidentally ended up in `ffmpeg_format_items` rather than `ffmpeg_codec_items` === M source/blender/makesrna/intern/rna_scene.c === diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 58455ff7de5..fde8fcf651c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -5928,7 +5928,6 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {FFMPEG_MKV, "MKV", 0, "Matroska", ""}, {FFMPEG_FLV, "FLASH", 0, "Flash", ""}, {FFMPEG_WEBM, "WEBM", 0, "WebM", ""}, - {AV_CODEC_ID_AV1, "AV1", 0, "AV1", ""}, {0, NULL, 0, NULL, NULL}, }; @@ -5947,6 +5946,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) {AV_CODEC_ID_QTRLE, "QTRLE", 0, "QT rle / QT Animation", ""}, {AV_CODEC_ID_THEORA, "THEORA", 0, "Theora", ""}, {AV_CODEC_ID_VP9, "WEBM", 0, "WebM / VP9", ""}, + {AV_CODEC_ID_AV1, "AV1", 0, "AV1", ""}, {0, NULL, 0, NULL, NULL}, }; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [583ae0caaa4] master: VSE: Don't use timecodes if not explicitly enabled
Commit: 583ae0caaa495adcc4af2494a4a87d19ae4eb645 Author: Richard Antalik Date: Mon Oct 24 19:57:53 2022 +0200 Branches: master https://developer.blender.org/rB583ae0caaa495adcc4af2494a4a87d19ae4eb645 VSE: Don't use timecodes if not explicitly enabled UI panel may suggest, that disabling "Proxy & timecode" would cause timecodes not being used, but this was not the case. Now timecodes will be used only if the checkbox is checked. === M source/blender/sequencer/intern/render.c === diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index dbbece73695..e3fd9216842 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -1026,6 +1026,15 @@ static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *cont return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } +static IMB_Timecode_Type seq_render_movie_strip_timecode_get(Sequence *seq) +{ + bool use_timecodes = (seq->flag & SEQ_USE_PROXY) != 0; + if (!use_timecodes) { +return IMB_TC_NONE; + } + return seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_NONE; +} + /** * Render individual view for multi-view or single (default view) for mono-view. */ @@ -1049,7 +1058,7 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, else { ibuf = IMB_anim_absolute(sanim->anim, frame_index + seq->anim_startofs, - seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, + seq_render_movie_strip_timecode_get(seq), psize); } @@ -1062,7 +1071,7 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, if (ibuf == NULL) { ibuf = IMB_anim_absolute(sanim->anim, frame_index + seq->anim_startofs, - seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, + seq_render_movie_strip_timecode_get(seq), IMB_PROXY_NONE); } if (ibuf == NULL) { ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [4e9a8109b22] master: Fix T100571: Subdivision disabled with Orbit Around Selection
Commit: 4e9a8109b2219a9cddc3943d13a1d3ae231fdd50 Author: Germano Cavalcante Date: Mon Oct 24 14:51:07 2022 -0300 Branches: master https://developer.blender.org/rB4e9a8109b2219a9cddc3943d13a1d3ae231fdd50 Fix T100571: Subdivision disabled with Orbit Around Selection The bug has existed since crasy space was implemented. rBbf8a26b7453d made the error even worse as the `modifiers_disable_subsurf_temporary` function, which works like a toggle, did not temporarily re-enable subsurf. The main problem is that the derived mesh is modified but not marked as dirty at the end. === M source/blender/blenkernel/intern/crazyspace.cc === diff --git a/source/blender/blenkernel/intern/crazyspace.cc b/source/blender/blenkernel/intern/crazyspace.cc index 190e2d3bb7e..f83c321c4ae 100644 --- a/source/blender/blenkernel/intern/crazyspace.cc +++ b/source/blender/blenkernel/intern/crazyspace.cc @@ -70,47 +70,48 @@ static void set_crazy_vertex_quat(float r_quat[4], sub_qt_qtqt(r_quat, q2, q1); } -static bool modifiers_disable_subsurf_temporary(struct Scene *scene, Object *ob) +static bool modifiers_disable_subsurf_temporary(Object *ob, const int cageIndex) { - bool disabled = false; - int cageIndex = BKE_modifiers_get_cage_index(scene, ob, nullptr, true); + bool changed = false; ModifierData *md = static_cast(ob->modifiers.first); for (int i = 0; md && i <= cageIndex; i++, md = md->next) { if (md->type == eModifierType_Subsurf) { md->mode ^= eModifierMode_DisableTemporary; - disabled = true; + changed = true; } } - return disabled; + return changed; } float (*BKE_crazyspace_get_mapped_editverts(struct Depsgraph *depsgraph, Object *obedit))[3] { - Scene *scene = DEG_get_input_scene(depsgraph); Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); Object *obedit_eval = DEG_get_evaluated_object(depsgraph, obedit); - Mesh *mesh_eval = static_cast(obedit_eval->data); - BMEditMesh *editmesh_eval = mesh_eval->edit_mesh; + const int cageIndex = BKE_modifiers_get_cage_index(scene_eval, obedit_eval, nullptr, true); - /* disable subsurf temporal, get mapped cos, and enable it */ - if (modifiers_disable_subsurf_temporary(scene_eval, obedit_eval)) { -/* Need to make new derived-mesh. */ + /* Disable subsurf temporal, get mapped cos, and enable it. */ + if (modifiers_disable_subsurf_temporary(obedit_eval, cageIndex)) { +/* Need to make new cage. + * TODO: Avoid losing original evaluated geometry. */ makeDerivedMesh(depsgraph, scene_eval, obedit_eval, &CD_MASK_BAREMESH); } - /* now get the cage */ - Mesh *mesh_eval_cage = editbmesh_get_eval_cage_from_orig( - depsgraph, scene, obedit, &CD_MASK_BAREMESH); + /* Now get the cage. */ + BMEditMesh *em_eval = BKE_editmesh_from_object(obedit_eval); + Mesh *mesh_eval_cage = editbmesh_get_eval_cage( + depsgraph, scene_eval, obedit_eval, em_eval, &CD_MASK_BAREMESH); - const int nverts = editmesh_eval->bm->totvert; + const int nverts = em_eval->bm->totvert; float(*vertexcos)[3] = static_cast( MEM_mallocN(sizeof(*vertexcos) * nverts, "vertexcos map")); mesh_get_mapped_verts_coords(mesh_eval_cage, vertexcos, nverts); - /* set back the flag, no new cage needs to be built, transform does it */ - modifiers_disable_subsurf_temporary(scene_eval, obedit_eval); + /* Set back the flag, and ensure new cage needs to be built. */ + if (modifiers_disable_subsurf_temporary(obedit_eval, cageIndex)) { +DEG_id_tag_update(&obedit->id, ID_RECALC_GEOMETRY); + } return vertexcos; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [a67876103a6] master: Fix T101981: Incorrect playback of AVI files
Commit: a67876103a6bb4554317f09ebd57c1997a45ed89 Author: Richard Antalik Date: Mon Oct 24 19:40:39 2022 +0200 Branches: master https://developer.blender.org/rBa67876103a6bb4554317f09ebd57c1997a45ed89 Fix T101981: Incorrect playback of AVI files Commit bcc56253e26e introduced 3 frame negative offset for seeking. This can result in negative seek values. Ensure, that seek value is always positive. === M source/blender/imbuf/intern/anim_movie.c === diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 71e0d0fe11e..94c0555dcf0 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -1100,7 +1100,12 @@ static int64_t ffmpeg_get_seek_pts(struct anim *anim, int64_t pts_to_search) * experimentally. Note: Too big offset can impact performance. Current 3 frame offset has no * measurable impact. */ - return pts_to_search - (ffmpeg_steps_per_frame_get(anim) * 3); + int64_t seek_pts = pts_to_search - (ffmpeg_steps_per_frame_get(anim) * 3); + + if (seek_pts < 0) { +seek_pts = 0; + } + return seek_pts; } /* This gives us an estimate of which pts our requested frame will have. ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [fc8f9e42042] bevelv2: Refactored vertex data structures.
Commit: fc8f9e420426570dcb3e026ecbe8145cd0fae5ca Author: Howard Trickey Date: Mon Oct 24 19:25:22 2022 +0200 Branches: bevelv2 https://developer.blender.org/rBfc8f9e420426570dcb3e026ecbe8145cd0fae5ca Refactored vertex data structures. === M source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc === diff --git a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc index ab6b24515e6..9f0a54ea9c3 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_bevel_mesh.cc @@ -9,6 +9,8 @@ #include "BKE_mesh_runtime.h" #include "BLI_array.hh" +#include "BLI_hash.hh" +#include "BLI_map.hh" #include "BLI_math_vec_types.hh" #include "BLI_math_vector.hh" #include "BLI_mesh_inset.hh" @@ -245,1246 +247,1286 @@ float3 MeshTopology::edge_dir_from_vert_normalized(int e, int v) const return math::normalize(edge_dir_from_vert(e, v)); } -/** A Vertex Cap consists of a vertex in a mesh and an CCW ordering of - * alternating edges and faces around it, as viewed from the face's - * normal side. Some faces may be missing (i.e., gaps). - * (If there are other edges and faces attached to the vertex that - * don't fit into this pattern, they need to go into other Vertex Caps - * or ignored, for the sake of beveling.) +/** Canon + * CanonVertPair is a pair of vertex indices in canonical order (first index <= second index). + * This is suitable for a key to look up edges by. */ -class VertexCap { - Array edges_; - Array faces_; // face_[i] is between edges i and i+1 - +class CanonVertPair { public: - /* The vertex (as index into a mesh) that the cap is around. */ - int vert; + int v1; + int v2; - VertexCap() : vert(-1) + CanonVertPair(int a, int b) { +if (a < b) { + v1 = a; + v2 = b; +} +else { + v1 = b; + v2 = a; +} } - VertexCap(int vert, Span edges, Span faces) : edges_(edges), faces_(faces), vert(vert) + + uint64_t hash() const { +return get_default_hash_2(v1, v2); } - /* Initialize for vertex v, given a mesh topo. */ - void init_from_topo(const int vert, const MeshTopology &topo); + friend bool operator==(const CanonVertPair a, const CanonVertPair b); +}; - /* The number of edges around the cap. */ - int size() const - { -return edges_.size(); - } +bool operator==(const CanonVertPair a, const CanonVertPair b){ + return a.v1 == b.v1 && a.v2 == b.v2; +} - /* Edges in CCW order (viewed from top) around the cap. */ - Span edges() const - { -return edges_.as_span(); - } +/** IndexAlloc allocates sequential integers, starting from a given start value. */ +class IndexAlloc { + int start_; + int first_free_; - /* Faces in CCW order (viewed from top) around the cap. -1 means a gap. */ - Span faces() const + public: + IndexAlloc(int start) : start_(start), first_free_(start) { -return faces_.as_span(); } - /* The ith edge. */ - int edge(int i) const + int alloc() { -return edges_[i]; +return first_free_++; } - /* The edge after the ith edge (with wraparound). */ - int next_edge(int i) const + int start() const { -return i < edges_.size() - 1 ? edges_[i + 1] : edges_[0]; +return start_; } - /* The edge before the ith edge (with wraparound). */ - int prev_edge(int i) const + int allocated_size() const { -return i > 1 ? edges_[i - 1] : edges_.last(); +return first_free_ - start_; } +}; - /* The face returned may be -1, meaning "gap". */ - /* The face betwen edge(i) and next_edge(i). */ - int face(int i) const +/** MeshDelta represents a delta to a Mesh: additions and deletions + * of Mesh elements. + * New elements will get index numbers starting at the end of the current + * range of the elements in the base mesh, `mesh_`. + * There is also a fast method for finding an edge, if any, joining two + * vertices (either in the base mesh, or in the added vertices, or mixed). + */ +class MeshDelta { + const Mesh &mesh_; + const MeshTopology &topo_; + IndexAlloc vert_alloc_; + IndexAlloc edge_alloc_; + IndexAlloc poly_alloc_; + IndexAlloc loop_alloc_; + Set vert_deletes_; + Set edge_deletes_; + Set poly_deletes_; + Set loop_deletes_; + Vector new_verts_; + Vector new_edges_; + Vector new_polys_; + Vector new_loops_; + Vector new_vert_rep_; + Vector new_edge_rep_; + Vector new_poly_rep_; + Vector new_loop_rep_; + /* Lookup map for added edges. */ + Map new_edge_map_; + + public: + MeshDelta(const Mesh &mesh, const MeshTopology &topo); + + /* In the following, `rep` is the index of the old mesh element to base attributes on. */ + int new_vert(const float3 &co, int rep); + int new_edge(int v1, int v2, int rep); + int new_loop(int v, int e, int rep); + int new_face(int lo
[Bf-blender-cvs] [a41a1bfc494] bevelv2: Merge branch 'master' into bevelv2
Commit: a41a1bfc494e4015406549e137114ef5a450aaf0 Author: Howard Trickey Date: Mon Oct 24 19:33:11 2022 +0200 Branches: bevelv2 https://developer.blender.org/rBa41a1bfc494e4015406549e137114ef5a450aaf0 Merge branch 'master' into bevelv2 === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [53795877727] master: Fix T101210: invalid internal node links lead to crash
Commit: 53795877727d67185de858a480c8090ca7eb8e36 Author: Jacques Lucke Date: Mon Oct 24 19:00:27 2022 +0200 Branches: master https://developer.blender.org/rB53795877727d67185de858a480c8090ca7eb8e36 Fix T101210: invalid internal node links lead to crash Internal links are run-time/derived data. Therefore it is not necessary to load them from .blend files where invalid internal links may be stored. They will be regenerated after a node tree is loaded anyway. === M source/blender/blenkernel/intern/node.cc === diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 8028f990c42..3e3a8355f98 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -516,10 +516,6 @@ void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree) write_node_socket(writer, sock); } -LISTBASE_FOREACH (bNodeLink *, link, &node->internal_links) { - BLO_write_struct(writer, bNodeLink, link); -} - if (node->storage) { if (ELEM(ntree->type, NTREE_SHADER, NTREE_GEOMETRY) && ELEM(node->type, SH_NODE_CURVE_VEC, SH_NODE_CURVE_RGB, SH_NODE_CURVE_FLOAT)) { @@ -703,13 +699,7 @@ void ntreeBlendReadData(BlendDataReader *reader, ID *owner_id, bNodeTree *ntree) BLO_read_data_address(reader, &node->prop); IDP_BlendDataRead(reader, &node->prop); -BLO_read_list(reader, &node->internal_links); -LISTBASE_FOREACH (bNodeLink *, link, &node->internal_links) { - BLO_read_data_address(reader, &link->fromnode); - BLO_read_data_address(reader, &link->fromsock); - BLO_read_data_address(reader, &link->tonode); - BLO_read_data_address(reader, &link->tosock); -} +BLI_listbase_clear(&node->internal_links); if (node->type == CMP_NODE_MOVIEDISTORTION) { /* Do nothing, this is runtime cache and hence handled by generic code using ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [8dd7b5b26b3] master: Cycles: Metal integrator state size tuning
Commit: 8dd7b5b26b394207b5941d49750f7e3abadaf82a Author: Michael Jones Date: Mon Oct 24 10:23:56 2022 +0100 Branches: master https://developer.blender.org/rB8dd7b5b26b394207b5941d49750f7e3abadaf82a Cycles: Metal integrator state size tuning This patch tunes the integrator state sizing for Metal (`num_concurrent_states` and `num_concurrent_busy_states`). On all GPUs architecture, we adjust the busy:total states ratio to be 1:4 which gives better rendering performance than the previous 1:16 ratio (independent of total state count). This gives a small performance uplift (e.g. 2-3% on M1 Ultra). Additionally for M2 architectures, we double the overall state size if there is available headroom. Inclusive of the first change, we can expect uplift of close to 10% in future, as this results in larger dispatch sizes and minimises work submission overheads. In order to make an accurate determination of available headroom, we defer the calculation of `num_concurrent_states` and `num_concurrent_busy_states` until the time of integrator state allocation (i.e. after all of the scene data h [...] Reviewed By: brecht Differential Revision: https://developer.blender.org/D16313 === M intern/cycles/device/cuda/queue.cpp M intern/cycles/device/cuda/queue.h M intern/cycles/device/hip/queue.cpp M intern/cycles/device/hip/queue.h M intern/cycles/device/metal/device_impl.mm M intern/cycles/device/metal/kernel.mm M intern/cycles/device/metal/queue.h M intern/cycles/device/metal/queue.mm M intern/cycles/device/oneapi/queue.cpp M intern/cycles/device/oneapi/queue.h M intern/cycles/device/queue.h M intern/cycles/integrator/path_trace_work_gpu.cpp === diff --git a/intern/cycles/device/cuda/queue.cpp b/intern/cycles/device/cuda/queue.cpp index 84b0a1e0dd6..69fae03e32c 100644 --- a/intern/cycles/device/cuda/queue.cpp +++ b/intern/cycles/device/cuda/queue.cpp @@ -49,7 +49,7 @@ int CUDADeviceQueue::num_concurrent_states(const size_t state_size) const return num_states; } -int CUDADeviceQueue::num_concurrent_busy_states() const +int CUDADeviceQueue::num_concurrent_busy_states(const size_t /*state_size*/) const { const int max_num_threads = cuda_device_->get_num_multiprocessors() * cuda_device_->get_max_num_threads_per_multiprocessor(); diff --git a/intern/cycles/device/cuda/queue.h b/intern/cycles/device/cuda/queue.h index b450f5b3592..7107afe70c9 100644 --- a/intern/cycles/device/cuda/queue.h +++ b/intern/cycles/device/cuda/queue.h @@ -23,7 +23,7 @@ class CUDADeviceQueue : public DeviceQueue { ~CUDADeviceQueue(); virtual int num_concurrent_states(const size_t state_size) const override; - virtual int num_concurrent_busy_states() const override; + virtual int num_concurrent_busy_states(const size_t state_size) const override; virtual void init_execution() override; diff --git a/intern/cycles/device/hip/queue.cpp b/intern/cycles/device/hip/queue.cpp index 3f8b6267100..e93a9b4df3a 100644 --- a/intern/cycles/device/hip/queue.cpp +++ b/intern/cycles/device/hip/queue.cpp @@ -49,7 +49,7 @@ int HIPDeviceQueue::num_concurrent_states(const size_t state_size) const return num_states; } -int HIPDeviceQueue::num_concurrent_busy_states() const +int HIPDeviceQueue::num_concurrent_busy_states(const size_t /*state_size*/) const { const int max_num_threads = hip_device_->get_num_multiprocessors() * hip_device_->get_max_num_threads_per_multiprocessor(); diff --git a/intern/cycles/device/hip/queue.h b/intern/cycles/device/hip/queue.h index 729d8a19acb..df0678108af 100644 --- a/intern/cycles/device/hip/queue.h +++ b/intern/cycles/device/hip/queue.h @@ -23,7 +23,7 @@ class HIPDeviceQueue : public DeviceQueue { ~HIPDeviceQueue(); virtual int num_concurrent_states(const size_t state_size) const override; - virtual int num_concurrent_busy_states() const override; + virtual int num_concurrent_busy_states(const size_t state_size) const override; virtual void init_execution() override; diff --git a/intern/cycles/device/metal/device_impl.mm b/intern/cycles/device/metal/device_impl.mm index 4b929b6bc0a..6f1042b1e55 100644 --- a/intern/cycles/device/metal/device_impl.mm +++ b/intern/cycles/device/metal/device_impl.mm @@ -296,9 +296,11 @@ void MetalDevice::make_source(MetalPipelineType pso_type, const uint kernel_feat } source = global_defines + source; +# if 0 metal_printf("\n%s\n\%s\n", global_defines.c_str(), baked_constants.c_str()); +# endif /* Generate an MD5 from the source and include any baked constants. This is used when caching * PSOs. */ diff --git a/intern/cycles/device/metal/kernel.mm b/intern/cycles/device/me
[Bf-blender-cvs] [75064c7024b] universal-scene-description: USD import: crash reading shapes.
Commit: 75064c7024b12b845fc36d4fa3079f005651f7c7 Author: Michael Kowalski Date: Mon Oct 24 11:17:57 2022 -0400 Branches: universal-scene-description https://developer.blender.org/rB75064c7024b12b845fc36d4fa3079f005651f7c7 USD import: crash reading shapes. Updated the mesh reading code when reading shapes, to fix a crash due to the updated mesh API introduced in the last merge from master. === M source/blender/io/usd/intern/usd_reader_shape.cc === diff --git a/source/blender/io/usd/intern/usd_reader_shape.cc b/source/blender/io/usd/intern/usd_reader_shape.cc index 80478b9c9cc..3e6170e51c8 100644 --- a/source/blender/io/usd/intern/usd_reader_shape.cc +++ b/source/blender/io/usd/intern/usd_reader_shape.cc @@ -132,15 +132,17 @@ struct Mesh *USDShapeReader::read_mesh(struct Mesh *existing_mesh, existing_mesh, positions.size(), 0, 0, face_indices.size(), face_counts.size()); } + MutableSpan verts = active_mesh->verts_for_write(); + for (int i = 0; i < positions.size(); i++) { -MVert &mvert = active_mesh->mvert[i]; +MVert &mvert = verts[i]; mvert.co[0] = positions[i][0]; mvert.co[1] = positions[i][1]; mvert.co[2] = positions[i][2]; } - MPoly *mpolys = active_mesh->mpoly; - MLoop *mloops = active_mesh->mloop; + MutableSpan polys = active_mesh->polys_for_write(); + MutableSpan loops = active_mesh->loops_for_write(); int loop_index = 0; @@ -148,7 +150,7 @@ struct Mesh *USDShapeReader::read_mesh(struct Mesh *existing_mesh, for (int i = 0; i < face_counts.size(); i++) { const int face_size = face_counts[i]; - MPoly &poly = mpolys[i]; + MPoly &poly = polys[i]; poly.loopstart = loop_index; poly.totloop = face_size; @@ -156,7 +158,7 @@ struct Mesh *USDShapeReader::read_mesh(struct Mesh *existing_mesh, poly.flag |= is_cube ? 0 : ME_SMOOTH; for (int f = 0; f < face_size; ++f, ++loop_index) { -mloops[loop_index].v = face_indices[loop_index]; +loops[loop_index].v = face_indices[loop_index]; } } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [471636ffcd4] universal-scene-description: USD Import: fix error messages loading instances.
Commit: 471636ffcd49d5d339f80edce58d812cbe9aa12d Author: Michael Kowalski Date: Wed Oct 19 15:15:47 2022 -0400 Branches: universal-scene-description https://developer.blender.org/rB471636ffcd49d5d339f80edce58d812cbe9aa12d USD Import: fix error messages loading instances. Added logic to avoid attempting to bind the pxr::UsdSkelBindingAPI to instance proxies and prototypes, as this was generating errors. === M source/blender/io/usd/intern/usd_reader_mesh.cc M source/blender/io/usd/intern/usd_skel_convert.cc === diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index d4acba8059b..7a12258df0a 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -1093,20 +1093,22 @@ bool USDMeshReader::get_local_usd_xform(pxr::GfMatrix4d *r_xform, return USDXformReader::get_local_usd_xform(r_xform, r_is_constant, time); } - if (pxr::UsdSkelBindingAPI skel_api = pxr::UsdSkelBindingAPI::Apply(prim_)) { -if (skel_api.GetGeomBindTransformAttr().HasAuthoredValue()) { - pxr::GfMatrix4d bind_xf; - if (skel_api.GetGeomBindTransformAttr().Get(&bind_xf)) { -/* Assume that if a bind transform is defined, then the - * transform is constant. */ -if (r_is_constant) { - *r_is_constant = true; + if (!(prim_.IsInstanceProxy() || prim_.IsInPrototype())) { +if (pxr::UsdSkelBindingAPI skel_api = pxr::UsdSkelBindingAPI::Apply(prim_)) { + if (skel_api.GetGeomBindTransformAttr().HasAuthoredValue()) { +pxr::GfMatrix4d bind_xf; +if (skel_api.GetGeomBindTransformAttr().Get(&bind_xf)) { + /* Assume that if a bind transform is defined, then the + * transform is constant. */ + if (r_is_constant) { +*r_is_constant = true; + } + return get_geom_bind_xform_correction(bind_xf, r_xform, time); +} +else { + std::cout << "WARNING: couldn't compute geom bind transform for " << prim_.GetPath() +<< std::endl; } -return get_geom_bind_xform_correction(bind_xf, r_xform, time); - } - else { -std::cout << "WARNING: couldn't compute geom bind transform for " << prim_.GetPath() - << std::endl; } } } diff --git a/source/blender/io/usd/intern/usd_skel_convert.cc b/source/blender/io/usd/intern/usd_skel_convert.cc index f05c0ffc2dc..69ab05c234e 100644 --- a/source/blender/io/usd/intern/usd_skel_convert.cc +++ b/source/blender/io/usd/intern/usd_skel_convert.cc @@ -586,6 +586,12 @@ void import_skel_bindings(Main *bmain, Object *mesh_obj, pxr::UsdPrim prim) return; } + if (prim.IsInstanceProxy() || prim.IsInPrototype()) { +/* Attempting to create a UsdSkelBindingAPI for + * instance proxies and prototypes generates USD errors. */ +return; + } + if (mesh_obj->type != OB_MESH) { return; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [ae342e00ca0] universal-scene-description: USD Import: hide instance prototype collections.
Commit: ae342e00ca08eca8b98e37b7ce29017320db609a Author: Michael Kowalski Date: Thu Oct 20 16:37:11 2022 -0400 Branches: universal-scene-description https://developer.blender.org/rBae342e00ca08eca8b98e37b7ce29017320db609a USD Import: hide instance prototype collections. Now hiding the instance prototype parent collection in both the viewport and render. This change was also necessary because the previous code for hiding prototype layer collections stopped working with the latest merge from master. === M source/blender/io/usd/intern/usd_capi_import.cc === diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc index 5ec0d73e0f9..9ed0e4cb69f 100644 --- a/source/blender/io/usd/intern/usd_capi_import.cc +++ b/source/blender/io/usd/intern/usd_capi_import.cc @@ -166,6 +166,11 @@ static void create_proto_collections(Main *bmain, { Collection *all_protos_collection = create_collection(bmain, parent_collection, "prototypes"); + if (all_protos_collection) { +all_protos_collection->flag |= COLLECTION_HIDE_VIEWPORT; +all_protos_collection->flag |= COLLECTION_HIDE_RENDER; + } + std::map proto_collection_map; for (const auto &pair : proto_readers) { @@ -179,12 +184,6 @@ static void create_proto_collections(Main *bmain, Collection *proto_collection = create_collection( bmain, all_protos_collection, proto_collection_name.c_str()); -LayerCollection *proto_lc = BKE_layer_collection_first_from_scene_collection(view_layer, - proto_collection); -if (proto_lc) { - proto_lc->flag |= LAYER_COLLECTION_HIDE; -} - proto_collection_map.insert(std::make_pair(pair.first, proto_collection)); } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [0610cdcb86f] soc-2022-many-lights-sampling: Enable many light sampling by default, don't mark as experimental feature
Commit: 0610cdcb86f452d5a7f6a4bcf12c1288e111921e Author: Brecht Van Lommel Date: Mon Oct 24 16:20:26 2022 +0200 Branches: soc-2022-many-lights-sampling https://developer.blender.org/rB0610cdcb86f452d5a7f6a4bcf12c1288e111921e Enable many light sampling by default, don't mark as experimental feature This is intended to land in master in a state where it's ready to use. And for benchmark comparisons it's easy to have it enabled by default, but we may still revisit this. === M intern/cycles/blender/addon/properties.py M intern/cycles/blender/addon/ui.py === diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index d9161927325..d81bd1ff3a5 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -483,7 +483,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): use_light_tree: BoolProperty( name="Light Tree", description="Samples many lights more efficiently", -default=False, +default=True, ) splitting_threshold: FloatProperty( diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 86d50976fe6..14018228f29 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -385,10 +385,6 @@ class CYCLES_RENDER_PT_sampling_light_tree(CyclesButtonsPanel, Panel): bl_parent_id = "CYCLES_RENDER_PT_sampling" bl_options = {'DEFAULT_CLOSED'} -@classmethod -def poll(cls, context): -return (context.scene.cycles.feature_set == 'EXPERIMENTAL') - def draw_header(self, context): layout = self.layout scene = context.scene ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [d9f2f4656bb] asset-lite-greasepencil: Merge branch 'master' into asset-lite-greasepencil
Commit: d9f2f4656bb8e20c623a959a87acd724aaa3981c Author: Antonio Vazquez Date: Mon Oct 24 16:07:30 2022 +0200 Branches: asset-lite-greasepencil https://developer.blender.org/rBd9f2f4656bb8e20c623a959a87acd724aaa3981c Merge branch 'master' into asset-lite-greasepencil === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [c6dd4984b70] asset-lite-greasepencil: Changes after first review
Commit: c6dd4984b7075fe18d2d430026a01b48020a1de9 Author: Antonio Vazquez Date: Mon Oct 24 16:00:15 2022 +0200 Branches: asset-lite-greasepencil https://developer.blender.org/rBc6dd4984b7075fe18d2d430026a01b48020a1de9 Changes after first review === M release/scripts/startup/bl_ui/space_view3d.py M source/blender/editors/gpencil/gpencil_asset.c === diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 8a0379400c9..14c42455aaa 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -5224,18 +5224,18 @@ class VIEW3D_MT_edit_gpencil_asset(Menu): def draw(self, _context): layout = self.layout -layout.operator("gpencil.asset_create", text="Active Layer").mode = 'LAYER' -layout.operator("gpencil.asset_create", text="All Layers").mode = 'LAYERS_ALL' -layout.operator("gpencil.asset_create", text="All Layers Separated").mode = 'LAYERS_SPLIT' +layout.operator("gpencil.asset_create", text="Active Layer").source = 'LAYER' +layout.operator("gpencil.asset_create", text="All Layers").source = 'LAYERS_ALL' +layout.operator("gpencil.asset_create", text="All Layers Separated").source = 'LAYERS_SPLIT' layout.separator() -layout.operator("gpencil.asset_create", text="Active Keyframe (Active Layer)").mode = 'FRAME' -layout.operator("gpencil.asset_create", text="Active Keyframe (All Layers)").mode = 'FRAME_ALL' -layout.operator("gpencil.asset_create", text="Selected Keyframes").mode = 'FRAME_SELECTED' +layout.operator("gpencil.asset_create", text="Active Keyframe (Active Layer)").source = 'KEYFRAME' +layout.operator("gpencil.asset_create", text="Active Keyframe (All Layers)").source = 'KEYFRAME_ALL' +layout.operator("gpencil.asset_create", text="Selected Keyframes").source = 'KEYFRAME_SELECTED' layout.separator() -layout.operator("gpencil.asset_create", text="Selected Strokes").mode = 'SELECTED' -layout.operator("gpencil.asset_create", text="Selected Points").mode = 'POINT' +layout.operator("gpencil.asset_create", text="Selected Strokes").source = 'SELECTED' +layout.operator("gpencil.asset_create", text="Selected Points").source = 'POINT' class VIEW3D_MT_weight_gpencil(Menu): @@ -7454,7 +7454,7 @@ class VIEW3D_MT_gpencil_edit_context_menu(Menu): # Assets col.separator() -col.operator_menu_enum("gpencil.asset_create", "mode", text="Create Asset") +col.operator_menu_enum("gpencil.asset_create", "source", text="Create Asset") def draw_gpencil_layer_active(context, layout): diff --git a/source/blender/editors/gpencil/gpencil_asset.c b/source/blender/editors/gpencil/gpencil_asset.c index edda5be259d..544a3b8bda8 100644 --- a/source/blender/editors/gpencil/gpencil_asset.c +++ b/source/blender/editors/gpencil/gpencil_asset.c @@ -91,24 +91,24 @@ typedef struct tGPDasset { /** \name Create Grease Pencil data block Asset operator * \{ */ -typedef enum eGP_AssetModes { +typedef enum eGP_AssetSource { /* Active Layer. */ - GP_ASSET_MODE_ACTIVE_LAYER = 0, + GP_ASSET_SOURCE_ACTIVE_LAYER = 0, /* All Layers. */ - GP_ASSET_MODE_ALL_LAYERS, + GP_ASSET_SOURCE_ALL_LAYERS, /* All Layers in separated assets. */ - GP_ASSET_MODE_ALL_LAYERS_SPLIT, + GP_ASSET_SOURCE_ALL_LAYERS_SPLIT, /* Active Frame. */ - GP_ASSET_MODE_ACTIVE_FRAME, + GP_ASSET_SOURCE_ACTIVE_KEYFRAME, /* Active Frame All Layers. */ - GP_ASSET_MODE_ACTIVE_FRAME_ALL_LAYERS, + GP_ASSET_SOURCE_ACTIVE_KEYFRAME_ALL_LAYERS, /* Selected Frames. */ - GP_ASSET_MODE_SELECTED_FRAMES, + GP_ASSET_SOURCE_SELECTED_KEYFRAMES, /* Selected Strokes. */ - GP_ASSET_MODE_SELECTED_STROKES, + GP_ASSET_SOURCE_SELECTED_STROKES, /* Selected Strokes. */ - GP_ASSET_MODE_SELECTED_POINTS, -} eGP_AssetModes; + GP_ASSET_SOURCE_SELECTED_POINTS, +} eGP_AssetSource; /* Helper: Apply layer settings. */ static void apply_layer_settings(bGPDlayer *gpl) @@ -146,7 +146,7 @@ static bool gpencil_asset_create(const bContext *C, const wmOperator *op, const bGPdata *gpd_src, const bGPDlayer *gpl_filter, - const eGP_AssetModes mode, + const eGP_AssetSource mode, const bool reset_origin, const bool flatten_layers) { @@ -173,14 +173,14 @@ static bool gpencil_asset_create(const bContext *C, } /* If Active Layer or Active Frame mode, delete non active layers. */ -if ((ELEM(mode, GP_ASSET_MODE_ACTIVE_LAYER, GP_ASSET_MODE_ACTIVE_FRAME)) && +if ((ELEM(mode, G
[Bf-blender-cvs] [1aa4eca0c29] asset-lite-greasepencil: Merge branch 'master' into asset-lite-greasepencil
Commit: 1aa4eca0c2904bf16758008ad6ec12218ebd5026 Author: Antonio Vazquez Date: Mon Oct 24 15:31:43 2022 +0200 Branches: asset-lite-greasepencil https://developer.blender.org/rB1aa4eca0c2904bf16758008ad6ec12218ebd5026 Merge branch 'master' into asset-lite-greasepencil === === ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [9fc000cc6f5] master: Fix T101946: Outliner data-block counter treats bones as collection
Commit: 9fc000cc6f55784166be571c06a5f67faba9b47f Author: Philipp Oeser Date: Fri Oct 21 16:24:53 2022 +0200 Branches: master https://developer.blender.org/rB9fc000cc6f55784166be571c06a5f67faba9b47f Fix T101946: Outliner data-block counter treats bones as collection Mistake in own rBb6a35a8153c3 which caused code to always recurse into bone hierarchies (no matter which collapsed level an armature was found). This led to bone counts always being displayed even outside a collapsed armature (e.g. if an armature was somewhere down a object or collection, the collapsed object or collection would show this bonecount). This is inconsistent with other data counting in the Outliner, e.g. vertexgroups or bonegroups do have their indicator at object level, however the counter only shows if `Vertex Groups` or `Bone Groups` line shows (so if the object is not collapsed). And this also led to the bug reported in T101946 which was that the bone counts would be treated as collections when further down a collapsed hierarchy. Background: The whole concept of `MergedIconRow` is based on the concept of counting **objects types or collectinons/groups**. If other things like overrides, vertexgroups or bonegroups are displayed in a counted/ merged manner, then these will always be counted in the array spots that are usually reserved for groups/collections. But for things this is not a problem (since these are only displayed below their respective outliner entry -- and will never be reached otherwise). So to correct all this, we now only recurse into a bone hierarchy if a bone is at the "root-level" of a collapsed subtree (direct child of the collapsed element to merge into). NOTE: there are certainly other candidates for counted/merged display further up the hierarchy (not just bones -- constraints come to my mind here, but that is for another commit) Maniphest Tasks: T101946 Differential Revision: https://developer.blender.org/D16319 === M source/blender/editors/space_outliner/outliner_draw.cc === diff --git a/source/blender/editors/space_outliner/outliner_draw.cc b/source/blender/editors/space_outliner/outliner_draw.cc index f76c0980c4f..699dd6d4844 100644 --- a/source/blender/editors/space_outliner/outliner_draw.cc +++ b/source/blender/editors/space_outliner/outliner_draw.cc @@ -3054,6 +3054,7 @@ static void outliner_draw_iconrow(bContext *C, int *offsx, int ys, float alpha_fac, + bool in_bone_hierarchy, MergedIconRow *merged) { eOLDrawState active = OL_DRAWSEL_NONE; @@ -3063,8 +3064,12 @@ static void outliner_draw_iconrow(bContext *C, te->flag &= ~(TE_ICONROW | TE_ICONROW_MERGED); /* object hierarchy always, further constrained on level */ +/* Bones are also hierarchies and get a merged count, but we only start recursing into them if + * an they are at the root level of a collapsed subtree (e.g. not "hidden" in a collapsed + * collection). */ +const bool is_bone = ELEM(tselem->type, TSE_BONE, TSE_EBONE, TSE_POSE_CHANNEL); if ((level < 1) || ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) || -ELEM(tselem->type, TSE_BONE, TSE_EBONE, TSE_POSE_CHANNEL)) { +(in_bone_hierarchy && is_bone)) { /* active blocks get white circle */ if (tselem->type == TSE_SOME_ID) { if (te->idcode == ID_OB) { @@ -3107,8 +3112,13 @@ static void outliner_draw_iconrow(bContext *C, } } -/* this tree element always has same amount of branches, so don't draw */ -if (tselem->type != TSE_R_LAYER) { +/* TSE_R_LAYER tree element always has same amount of branches, so don't draw. */ +/* Also only recurse into bone hierarchies if a direct child of the collapsed element to merge + * into. */ +const bool is_root_level_bone = is_bone && (level == 0); +in_bone_hierarchy |= is_root_level_bone; +if (!ELEM(tselem->type, TSE_R_LAYER, TSE_BONE, TSE_EBONE, TSE_POSE_CHANNEL) || +in_bone_hierarchy) { outliner_draw_iconrow(C, block, fstyle, @@ -3120,6 +3130,7 @@ static void outliner_draw_iconrow(bContext *C, offsx, ys, alpha_fac, +in_bone_hierarchy, merged); } } @@ -3381,6 +3392,7 @@ static void outliner_draw_tree_element(bContext *C, &tempx, *starty, alpha_fac, +false, &merged); GPU_blend(GPU_BLEND_NONE); _
[Bf-blender-cvs] [0584a88046d] master: Fix T102008: Images are stretched when texture limit is enabled
Commit: 0584a88046d2a2c069e056e52b37907cd70db8c7 Author: Omar Emara Date: Mon Oct 24 12:15:22 2022 +0200 Branches: master https://developer.blender.org/rB0584a88046d2a2c069e056e52b37907cd70db8c7 Fix T102008: Images are stretched when texture limit is enabled Currently, if an image exceed the texture limit setup by the user or the GPU backend, it will be scaled down to satisfy the limit. However, scaling happens independently per axis, that means the aspect ratio of the image will not be maintained. This patch corrects the smaller size to maintain the aspect ratio. Differential Revision: https://developer.blender.org/D16327 Reviews By: Clement Foucault === M source/blender/imbuf/intern/util_gpu.c === diff --git a/source/blender/imbuf/intern/util_gpu.c b/source/blender/imbuf/intern/util_gpu.c index 5ed6b2b9843..35cdefbaaeb 100644 --- a/source/blender/imbuf/intern/util_gpu.c +++ b/source/blender/imbuf/intern/util_gpu.c @@ -301,6 +301,16 @@ GPUTexture *IMB_create_gpu_texture(const char *name, int size[2] = {GPU_texture_size_with_limit(ibuf->x), GPU_texture_size_with_limit(ibuf->y)}; bool do_rescale = (ibuf->x != size[0]) || (ibuf->y != size[1]); + /* Correct the smaller size to maintain the original aspect ratio of the image. */ + if (do_rescale && ibuf->x != ibuf->y) { +if (size[0] > size[1]) { + size[1] = (int)(ibuf->y * ((float)size[0] / ibuf->x)); +} +else { + size[0] = (int)(ibuf->x * ((float)size[1] / ibuf->y)); +} + } + #ifdef WITH_DDS if (ibuf->ftype == IMB_FTYPE_DDS) { eGPUTextureFormat compressed_format; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] [216e8d887b6] master: Cleanup: quiet parentheses warning
Commit: 216e8d887b6c80db4665e58ff91434659c21c5ae Author: Campbell Barton Date: Mon Oct 24 20:32:03 2022 +1100 Branches: master https://developer.blender.org/rB216e8d887b6c80db4665e58ff91434659c21c5ae Cleanup: quiet parentheses warning === M source/blender/editors/transform/transform_mode_curveshrinkfatten.c === diff --git a/source/blender/editors/transform/transform_mode_curveshrinkfatten.c b/source/blender/editors/transform/transform_mode_curveshrinkfatten.c index d8f04dea161..0b87b45679a 100644 --- a/source/blender/editors/transform/transform_mode_curveshrinkfatten.c +++ b/source/blender/editors/transform/transform_mode_curveshrinkfatten.c @@ -102,8 +102,8 @@ void initCurveShrinkFatten(TransInfo *t) t->flag |= T_NO_CONSTRAINT; float scale_factor = 0.0f; - if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW) && - t->data_len_all == 1 || + if (((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW) && + (t->data_len_all == 1)) || (t->data_len_all == 3 && TRANS_DATA_CONTAINER_FIRST_OK(t)->data[0].val == NULL)) { /* For cases where only one point on the curve is being transformed and the radius of that * point is zero, use the factor to multiply the offset of the ratio and allow scaling. ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs