UI: Configurable UI Font Weight #112454

Merged
Harley Acheson merged 36 commits from Harley/blender:TextUiStyles into main 2023-10-21 00:28:37 +02:00
5 changed files with 69 additions and 20 deletions
Showing only changes of commit 7af38ac0f0 - Show all commits

View File

@ -571,15 +571,29 @@ ccl_device_inline float triangle_area(ccl_private const float3 &v1,
/* Orthonormal vectors */
ccl_device_inline void make_orthonormals(const float3 N,
ccl_private float3 *T,
ccl_private float3 *B)
ccl_private float3 *a,
ccl_private float3 *b)
{
/* Duff, Tom, et al. "Building an orthonormal basis, revisited." JCGT 6.1 (2017). */
float sign = signf(N.z);
float a = -1.0f / (sign + N.z);
float b = N.x * N.y * a;
*T = make_float3(1.0f + sign * N.x * N.x * a, sign * b, -sign * N.x);
*B = make_float3(b, sign + N.y * N.y * a, -N.y);
#if 0
if (fabsf(N.y) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 0, 1);
return;
}
if (fabsf(N.z) >= 0.999f) {
*a = make_float3(1, 0, 0);
*b = make_float3(0, 1, 0);
return;
}
#endif
if (N.x != N.y || N.x != N.z)
*a = make_float3(N.z - N.y, N.x - N.z, N.y - N.x); //(1,1,1)x N
else
*a = make_float3(N.z - N.y, N.x + N.z, -N.y - N.x); //(-1,1,1)x N
*a = normalize(*a);
*b = cross(N, *a);
}
/* Color division */

View File

@ -148,7 +148,8 @@ class Layer;
bool is_editable() const; \
bool is_selected() const; \
void set_selected(bool selected); \
bool use_onion_skinning() const;
bool use_onion_skinning() const; \
bool is_child_of(const LayerGroup &group) const;
/* Implements the forwarding of the methods defined by #TREENODE_COMMON_METHODS. */
#define TREENODE_COMMON_METHODS_FORWARD_IMPL(class_name) \
@ -191,6 +192,10 @@ class Layer;
inline bool class_name::use_onion_skinning() const \
{ \
return this->as_node().use_onion_skinning(); \
} \
inline bool class_name::is_child_of(const LayerGroup &group) const \
{ \
return this->as_node().is_child_of(group); \
}
/**
@ -622,6 +627,16 @@ inline bool TreeNode::use_onion_skinning() const
{
return ((this->flag & GP_LAYER_TREE_NODE_USE_ONION_SKINNING) != 0);
}
inline bool TreeNode::is_child_of(const LayerGroup &group) const
{
if (const LayerGroup *parent = this->parent_group()) {
if (parent == &group) {
return true;
}
return parent->is_child_of(group);
}
return false;
}
inline StringRefNull TreeNode::name() const
{
return (this->GreasePencilLayerTreeNode::name != nullptr) ?

View File

@ -189,6 +189,29 @@ TEST(greasepencil, layer_tree_node_types)
}
}
TEST(greasepencil, layer_tree_is_child_of)
{
GreasePencilLayerTreeExample ex;
EXPECT_FALSE(ex.grease_pencil.root_group().is_child_of(ex.grease_pencil.root_group()));
const LayerGroup &group1 = *ex.grease_pencil.find_layer_group_by_name("Group1");
const LayerGroup &group2 = *ex.grease_pencil.find_layer_group_by_name("Group2");
const Layer &layer1 = *ex.grease_pencil.find_layer_by_name("Layer1");
const Layer &layer3 = *ex.grease_pencil.find_layer_by_name("Layer3");
const Layer &layer5 = *ex.grease_pencil.find_layer_by_name("Layer5");
EXPECT_TRUE(layer1.is_child_of(ex.grease_pencil.root_group()));
EXPECT_TRUE(layer1.is_child_of(group1));
EXPECT_TRUE(layer3.is_child_of(group1));
EXPECT_FALSE(layer5.is_child_of(group1));
EXPECT_TRUE(layer3.is_child_of(group2));
EXPECT_FALSE(layer1.is_child_of(group2));
EXPECT_TRUE(layer5.is_child_of(ex.grease_pencil.root_group()));
}
/* --------------------------------------------------------------------------------------------- */
/* Frames Tests. */

View File

@ -445,7 +445,6 @@ if(WIN32)
)
list(APPEND LIB
bf_intern_utfconv
dxguid
dxgi
)
list(APPEND SRC

View File

@ -458,27 +458,25 @@ bool BLI_windows_get_directx_driver_version(const wchar_t *deviceSubString,
{
IDXGIFactory *pFactory = NULL;
IDXGIAdapter *pAdapter = NULL;
if (CreateDXGIFactory(&IID_IDXGIFactory, (void **)&pFactory) == S_OK) {
for (UINT i = 0; IDXGIFactory_EnumAdapters(pFactory, i, &pAdapter) != DXGI_ERROR_NOT_FOUND;
++i) {
if (CreateDXGIFactory(__uuidof(IDXGIFactory), (void **)&pFactory) == S_OK) {
for (UINT i = 0; pFactory->EnumAdapters(i, &pAdapter) != DXGI_ERROR_NOT_FOUND; ++i) {
LARGE_INTEGER version;
if (IDXGIAdapter_CheckInterfaceSupport(pAdapter, &IID_IDXGIDevice, &version) == S_OK) {
if (pAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &version) == S_OK) {
DXGI_ADAPTER_DESC desc;
if (IDXGIAdapter_GetDesc(pAdapter, &desc) == S_OK) {
if (pAdapter->GetDesc(&desc) == S_OK) {
if (wcsstr(desc.Description, deviceSubString)) {
*r_driverVersion = version.QuadPart;
IDXGIAdapter_Release(pAdapter);
IDXGIFactory_Release(pFactory);
pAdapter->Release();
pFactory->Release();
return true;
}
}
}
IDXGIAdapter_Release(pAdapter);
pAdapter->Release();
}
IDXGIFactory_Release(pFactory);
pFactory->Release();
}
return false;