diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/curves.cpp | 64 | ||||
-rw-r--r-- | intern/cycles/device/hip/device_impl.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/integrator/shader_eval.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ImeWin32.cpp | 5 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_ImeWin32.h | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 34 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XrContext.cpp | 11 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_XrContext.h | 1 | ||||
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 4 | ||||
-rw-r--r-- | intern/locale/CMakeLists.txt | 1 |
12 files changed, 92 insertions, 40 deletions
diff --git a/intern/cycles/blender/curves.cpp b/intern/cycles/blender/curves.cpp index 65a02d041cc..4206a1d8a8b 100644 --- a/intern/cycles/blender/curves.cpp +++ b/intern/cycles/blender/curves.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <optional> + #include "blender/sync.h" #include "blender/util.h" @@ -625,14 +627,35 @@ void BlenderSync::sync_particle_hair( } #ifdef WITH_HAIR_NODES -static float4 hair_point_as_float4(BL::HairPoint b_point) + +static std::optional<BL::FloatAttribute> find_curves_radius_attribute(BL::Hair b_hair) +{ + for (BL::Attribute &b_attribute : b_hair.attributes) { + if (b_attribute.name() != "radius") { + continue; + } + if (b_attribute.domain() != BL::Attribute::domain_POINT) { + continue; + } + if (b_attribute.data_type() != BL::Attribute::data_type_FLOAT) { + continue; + } + return BL::FloatAttribute{b_attribute}; + } + return std::nullopt; +} + +static float4 hair_point_as_float4(BL::Hair b_hair, + std::optional<BL::FloatAttribute> b_attr_radius, + const int index) { - float4 mP = float3_to_float4(get_float3(b_point.co())); - mP.w = b_point.radius(); + float4 mP = float3_to_float4(get_float3(b_hair.position_data[index].vector())); + mP.w = b_attr_radius ? b_attr_radius->data[index].value() : 0.0f; return mP; } static float4 interpolate_hair_points(BL::Hair b_hair, + std::optional<BL::FloatAttribute> b_attr_radius, const int first_point_index, const int num_points, const float step) @@ -641,8 +664,8 @@ static float4 interpolate_hair_points(BL::Hair b_hair, const int point_a = clamp((int)curve_t, 0, num_points - 1); const int point_b = min(point_a + 1, num_points - 1); const float t = curve_t - (float)point_a; - return lerp(hair_point_as_float4(b_hair.points[first_point_index + point_a]), - hair_point_as_float4(b_hair.points[first_point_index + point_b]), + return lerp(hair_point_as_float4(b_hair, b_attr_radius, first_point_index + point_a), + hair_point_as_float4(b_hair, b_attr_radius, first_point_index + point_b), t); } @@ -671,12 +694,14 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair) hair->reserve_curves(num_curves, num_keys); + std::optional<BL::FloatAttribute> b_attr_radius = find_curves_radius_attribute(b_hair); + /* Export curves and points. */ vector<float> points_length; - for (BL::HairCurve &b_curve : b_hair.curves) { - const int first_point_index = b_curve.first_point_index(); - const int num_points = b_curve.num_points(); + for (int i = 0; i < num_curves; i++) { + const int first_point_index = b_hair.curve_offset_data[i].value(); + const int num_points = b_hair.curve_offset_data[i + 1].value() - first_point_index; float3 prev_co = zero_float3(); float length = 0.0f; @@ -687,10 +712,9 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair) /* Position and radius. */ for (int i = 0; i < num_points; i++) { - BL::HairPoint b_point = b_hair.points[first_point_index + i]; - - const float3 co = get_float3(b_point.co()); - const float radius = b_point.radius(); + const float3 co = get_float3(b_hair.position_data[first_point_index + i].vector()); + const float radius = b_attr_radius ? b_attr_radius->data[first_point_index + i].value() : + 0.0f; hair->add_curve_key(co, radius); if (attr_intercept) { @@ -715,7 +739,7 @@ static void export_hair_curves(Scene *scene, Hair *hair, BL::Hair b_hair) /* Random number per curve. */ if (attr_random != NULL) { - attr_random->add(hash_uint2_to_float(b_curve.index(), 0)); + attr_random->add(hash_uint2_to_float(i, 0)); } /* Curve. */ @@ -737,14 +761,17 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st /* Export motion keys. */ const int num_keys = hair->get_curve_keys().size(); + const int num_curves = b_hair.curves.length(); float4 *mP = attr_mP->data_float4() + motion_step * num_keys; bool have_motion = false; int num_motion_keys = 0; int curve_index = 0; - for (BL::HairCurve &b_curve : b_hair.curves) { - const int first_point_index = b_curve.first_point_index(); - const int num_points = b_curve.num_points(); + std::optional<BL::FloatAttribute> b_attr_radius = find_curves_radius_attribute(b_hair); + + for (int i = 0; i < num_curves; i++) { + const int first_point_index = b_hair.curve_offset_data[i].value(); + const int num_points = b_hair.curve_offset_data[i + 1].value() - first_point_index; Hair::Curve curve = hair->get_curve(curve_index); curve_index++; @@ -755,7 +782,7 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st int point_index = first_point_index + i; if (point_index < num_keys) { - mP[num_motion_keys] = hair_point_as_float4(b_hair.points[point_index]); + mP[num_motion_keys] = hair_point_as_float4(b_hair, b_attr_radius, point_index); num_motion_keys++; if (!have_motion) { @@ -774,7 +801,8 @@ static void export_hair_curves_motion(Hair *hair, BL::Hair b_hair, int motion_st const float step_size = curve.num_keys > 1 ? 1.0f / (curve.num_keys - 1) : 0.0f; for (int i = 0; i < curve.num_keys; i++) { const float step = i * step_size; - mP[num_motion_keys] = interpolate_hair_points(b_hair, first_point_index, num_points, step); + mP[num_motion_keys] = interpolate_hair_points( + b_hair, b_attr_radius, first_point_index, num_points, step); num_motion_keys++; } have_motion = true; diff --git a/intern/cycles/device/hip/device_impl.cpp b/intern/cycles/device/hip/device_impl.cpp index 4f1cbabc89b..85ed3dc5b55 100644 --- a/intern/cycles/device/hip/device_impl.cpp +++ b/intern/cycles/device/hip/device_impl.cpp @@ -905,8 +905,8 @@ void HIPDevice::tex_alloc(device_texture &mem) address_mode = hipAddressModeClamp; break; case EXTENSION_CLIP: - // TODO : (Arya) setting this to Mode Clamp instead of Mode Border because it's unsupported - // in hip + /* TODO(@arya): setting this to Mode Clamp instead of Mode Border + * because it's unsupported in HIP. */ address_mode = hipAddressModeClamp; break; default: diff --git a/intern/cycles/integrator/shader_eval.cpp b/intern/cycles/integrator/shader_eval.cpp index 95a1adeb016..0edd3810c39 100644 --- a/intern/cycles/integrator/shader_eval.cpp +++ b/intern/cycles/integrator/shader_eval.cpp @@ -157,7 +157,7 @@ bool ShaderEval::eval_gpu(Device *device, queue->init_execution(); /* Execute work on GPU in chunk, so we can cancel. - * TODO : query appropriate size from device.*/ + * TODO: query appropriate size from device. */ const int32_t chunk_size = 65536; device_ptr d_input = input.device_pointer; diff --git a/intern/ghost/intern/GHOST_ImeWin32.cpp b/intern/ghost/intern/GHOST_ImeWin32.cpp index d1fc80adf56..2a1bfb633b3 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.cpp +++ b/intern/ghost/intern/GHOST_ImeWin32.cpp @@ -96,7 +96,7 @@ bool GHOST_ImeWin32::IsEnglishMode() !(conversion_modes_ & (IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE)); } -bool GHOST_ImeWin32::IsImeKeyEvent(char ascii) +bool GHOST_ImeWin32::IsImeKeyEvent(char ascii, GHOST_TKey key) { if (!(IsEnglishMode())) { /* In Chinese, Japanese, Korean, all alpha keys are processed by IME. */ @@ -106,7 +106,8 @@ bool GHOST_ImeWin32::IsImeKeyEvent(char ascii) if (IsLanguage(IMELANG_JAPANESE) && (ascii >= ' ' && ascii <= '~')) { return true; } - else if (IsLanguage(IMELANG_CHINESE) && ascii && strchr("!\"$'(),.:;<>?[\\]^_`/", ascii)) { + else if (IsLanguage(IMELANG_CHINESE) && ascii && strchr("!\"$'(),.:;<>?[\\]^_`/", ascii) && + !(key == GHOST_kKeyNumpadPeriod)) { return true; } } diff --git a/intern/ghost/intern/GHOST_ImeWin32.h b/intern/ghost/intern/GHOST_ImeWin32.h index ce0e4d64d53..d17a6d79503 100644 --- a/intern/ghost/intern/GHOST_ImeWin32.h +++ b/intern/ghost/intern/GHOST_ImeWin32.h @@ -161,7 +161,7 @@ class GHOST_ImeWin32 { bool IsEnglishMode(); /* Checks a key whether IME has to do handling. */ - bool IsImeKeyEvent(char ascii); + bool IsImeKeyEvent(char ascii, GHOST_TKey key); /** * Create the IME windows, and allocate required resources for them. diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index b92c3e73a88..756c4f876ed 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -890,7 +890,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent) bool anyProcessed = false; NSEvent *event; - // TODO : implement timer ?? + /* TODO: implement timer? */ #if 0 do { GHOST_TimerManager* timerMgr = getTimerManager(); diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 5251dd01b29..64e1ac3b9b3 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1220,7 +1220,7 @@ GHOST_EventKey *GHOST_SystemWin32::processKeyEvent(GHOST_WindowWin32 *window, RA } #ifdef WITH_INPUT_IME - if (window->getImeInput()->IsImeKeyEvent(ascii)) { + if (window->getImeInput()->IsImeKeyEvent(ascii, key)) { return NULL; } #endif /* WITH_INPUT_IME */ diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index b5d0fd8e6db..47d4ff77d17 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -71,6 +71,8 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, m_mousePresent(false), m_inLiveResize(false), m_system(system), + m_dropTarget(NULL), + m_hWnd(0), m_hDC(0), m_isDialog(dialog), m_hasMouseCaptured(false), @@ -78,6 +80,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, m_nPressedButtons(0), m_customCursor(0), m_wantAlphaBackground(alphaBackground), + m_Bar(NULL), m_wintab(NULL), m_lastPointerTabletData(GHOST_TABLET_DATA_NONE), m_normal_state(GHOST_kWindowStateNormal), @@ -129,8 +132,24 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, m_hDC = ::GetDC(m_hWnd); if (!setDrawingContextType(type)) { + const char *title = "Blender - Unsupported Graphics Card Configuration"; + const char *text = + "A graphics card and driver with support for OpenGL 3.3 or higher is " + "required.\n\nInstalling the latest driver for your graphics card might resolve the " + "issue."; + if (GetSystemMetrics(SM_CMONITORS) > 1) { + text = + "A graphics card and driver with support for OpenGL 3.3 or higher is " + "required.\n\nPlugging all monitors into your primary graphics card might resolve " + "this issue. Installing the latest driver for your graphics card could also help."; + } + MessageBox(m_hWnd, text, title, MB_OK | MB_ICONERROR); + ::ReleaseDC(m_hWnd, m_hDC); ::DestroyWindow(m_hWnd); m_hWnd = NULL; + if (!parentwindow) { + exit(0); + } return; } @@ -564,20 +583,13 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty (m_debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0), GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY); - if (context->initializeDrawingContext()) { - return context; - } - else { - MessageBox(m_hWnd, - "A graphics card and driver with support for OpenGL 3.3 or higher is required.\n" - "Installing the latest driver for your graphics card may resolve the issue.\n\n" - "The program will now close.", - "Blender - Unsupported Graphics Card or Driver", - MB_OK | MB_ICONERROR); + if (context && !context->initializeDrawingContext()) { delete context; - exit(0); + context = nullptr; } + return context; + #elif defined(WITH_GL_PROFILE_COMPAT) // ask for 2.1 context, driver gives any GL version >= 2.1 // (hopefully the latest compatibility profile) diff --git a/intern/ghost/intern/GHOST_XrContext.cpp b/intern/ghost/intern/GHOST_XrContext.cpp index 15b40690d83..9fa93f0c4b4 100644 --- a/intern/ghost/intern/GHOST_XrContext.cpp +++ b/intern/ghost/intern/GHOST_XrContext.cpp @@ -86,6 +86,7 @@ void GHOST_XrContext::initialize(const GHOST_XrContextCreateInfo *create_info) initApiLayers(); initExtensions(); if (isDebugMode()) { + printSDKVersion(); printAvailableAPILayersAndExtensionsInfo(); } @@ -156,6 +157,16 @@ void GHOST_XrContext::storeInstanceProperties() /** \name Debug Printing * \{ */ +void GHOST_XrContext::printSDKVersion() +{ + const XrVersion sdk_version = XR_CURRENT_API_VERSION; + + printf("OpenXR SDK Version: %u.%u.%u\n", + XR_VERSION_MAJOR(sdk_version), + XR_VERSION_MINOR(sdk_version), + XR_VERSION_PATCH(sdk_version)); +} + void GHOST_XrContext::printInstanceInfo() { assert(m_oxr->instance != XR_NULL_HANDLE); diff --git a/intern/ghost/intern/GHOST_XrContext.h b/intern/ghost/intern/GHOST_XrContext.h index 479b50e1537..b00f017ff59 100644 --- a/intern/ghost/intern/GHOST_XrContext.h +++ b/intern/ghost/intern/GHOST_XrContext.h @@ -126,6 +126,7 @@ class GHOST_XrContext : public GHOST_IXrContext { void storeInstanceProperties(); void initDebugMessenger(); + void printSDKVersion(); void printInstanceInfo(); void printAvailableAPILayersAndExtensionsInfo(); void printExtensionsAndAPILayersToEnable(); diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index 8a20323dcfc..d071def2ca4 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -39,8 +39,8 @@ * second intern/ module with MEM_ prefix, for use in c++. * * \subsection memdependencies Dependencies - * - stdlib - * - stdio + * - `stdlib` + * - `stdio` * * \subsection memdocs API Documentation * See \ref MEM_guardedalloc.h diff --git a/intern/locale/CMakeLists.txt b/intern/locale/CMakeLists.txt index 732fa1e4d11..3e467302d8e 100644 --- a/intern/locale/CMakeLists.txt +++ b/intern/locale/CMakeLists.txt @@ -56,7 +56,6 @@ if(WITH_INTERNATIONAL) list(APPEND LIB ${BOOST_LIBRARIES} ) - add_definitions(-DWITH_INTERNATIONAL) add_definitions(${BOOST_DEFINITIONS}) endif() |