WIP: Brush assets project #106303

Draft
Julian Eisel wants to merge 354 commits from brush-assets-project into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
6 changed files with 30 additions and 16 deletions
Showing only changes of commit ade1056a29 - Show all commits

View File

@ -523,7 +523,7 @@ bool MetalDeviceQueue::enqueue(DeviceKernel kernel,
break;
}
if (bvhMetalRT) {
if (bvhMetalRT && bvhMetalRT->accel_struct) {
/* Mark all Accelerations resources as used */
[mtlComputeCommandEncoder useResource:bvhMetalRT->accel_struct
usage:MTLResourceUsageRead];

View File

@ -58,4 +58,4 @@ class AssetCatalogCollection {
static OwningAssetCatalogMap copy_catalog_map(const OwningAssetCatalogMap &orig);
};
}
} // namespace blender::asset_system

View File

@ -29,7 +29,7 @@ class GField;
namespace blender::bke {
enum class AttrDomain : int8_t {
/* Use for to choose automatically based on other data. */
/* Used to choose automatically based on other data. */
Auto = -1,
/* Mesh, Curve or Point Cloud Point. */
Point = 0,

View File

@ -368,19 +368,17 @@ SphericalHarmonicL1 spherical_harmonics_triple_product(SphericalHarmonicL1 a,
/* Adapted from:
* "Code Generation and Factoring for Fast Evaluation of Low-order Spherical Harmonic Products
* and Squares" Function "SH_product_3". */
const float L0_M0_coef = 0.282094792;
SphericalHarmonicL1 sh;
sh.L0.M0 = 0.282094792 * a.L0.M0 * b.L0.M0;
sh.L0.M0 = a.L0.M0 * b.L0.M0;
sh.L0.M0 += a.L1.Mn1 * b.L1.Mn1;
sh.L0.M0 += a.L1.M0 * b.L1.M0;
sh.L0.M0 += a.L1.Mp1 * b.L1.Mp1;
sh.L0.M0 *= L0_M0_coef;
vec4 ta = 0.282094791 * a.L0.M0;
vec4 tb = 0.282094791 * b.L0.M0;
sh.L1.Mn1 = ta * b.L1.Mn1 + tb * a.L1.Mn1;
sh.L1.M0 = ta * b.L1.M0 + tb * a.L1.M0;
sh.L1.Mp1 = ta * b.L1.Mp1 + tb * a.L1.Mp1;
sh.L0.M0 += 0.282094791 * (a.L1.Mn1 * b.L1.Mn1);
sh.L0.M0 += 0.282094795 * (a.L1.M0 * b.L1.M0);
sh.L0.M0 += 0.282094791 * (a.L1.Mp1 * b.L1.Mp1);
sh.L1.Mn1 = L0_M0_coef * (a.L0.M0 * b.L1.Mn1 + b.L0.M0 * a.L1.Mn1);
sh.L1.M0 = L0_M0_coef * (a.L0.M0 * b.L1.M0 + b.L0.M0 * a.L1.M0);
sh.L1.Mp1 = L0_M0_coef * (a.L0.M0 * b.L1.Mp1 + b.L0.M0 * a.L1.Mp1);
return sh;
}

View File

@ -51,6 +51,8 @@
#include "BLI_listbase.h"
#include "BLI_math_matrix.h"
#include "BLI_path_util.h"
#include "BLI_sort.hh"
#include "BLI_span.hh"
#include "BLI_string.h"
#include "BLI_timeit.hh"
@ -453,6 +455,16 @@ static void report_job_duration(const ImportJobData *data)
std::cout << '\n';
}
static void sort_readers(blender::MutableSpan<AbcObjectReader *> readers)
{
blender::parallel_sort(
readers.begin(), readers.end(), [](const AbcObjectReader *a, const AbcObjectReader *b) {
const char *na = a->name().c_str();
const char *nb = b->name().c_str();
return BLI_strcasecmp(na, nb) < 0;
});
}
static void import_startjob(void *user_data, wmJobWorkerStatus *worker_status)
{
SCOPE_TIMER("Alembic import, objects reading and creation");
@ -509,6 +521,10 @@ static void import_startjob(void *user_data, wmJobWorkerStatus *worker_status)
/* Create objects and set scene frame range. */
/* Sort readers by name: when creating a lot of objects in Blender,
* it is much faster if the order is sorted by name. */
sort_readers(data->readers);
const float size = float(data->readers.size());
size_t i = 0;
@ -531,7 +547,7 @@ static void import_startjob(void *user_data, wmJobWorkerStatus *worker_status)
<< " is invalid.\n";
}
*data->progress = 0.1f + 0.3f * (++i / size);
*data->progress = 0.1f + 0.6f * (++i / size);
*data->do_update = true;
if (G.is_break) {

View File

@ -107,7 +107,7 @@ static void node_rna(StructRNA *srna)
rna_enum_attribute_domain_without_corner_items,
NOD_storage_enum_accessors(domain),
int(AttrDomain::Point),
enums::domain_experimental_grease_pencil_version3_fn);
enums::domain_without_corner_experimental_grease_pencil_version3_fn);
}
static void node_register()