#99807: Add support for exporting to USDZ - ultimate fixes #105185

Merged
Bastien Montagne merged 12 commits from mont29/blender:usdz_export_fixes into main 2023-02-26 16:37:02 +01:00
6 changed files with 23 additions and 31 deletions
Showing only changes of commit b710098e54 - Show all commits

View File

@ -434,7 +434,10 @@ def external_scripts_update(args: argparse.Namespace,
# Switch to branch and pull.
if submodule_branch:
if make_utils.git_branch(args.git_command) != submodule_branch:
call([args.git_command, "checkout", submodule_branch])
if make_utils.git_remote_exist(args.git_command, "origin"):
call([args.git_command, "checkout", "-t", f"origin/{submodule_branch}"])
elif make_utils.git_remote_exist(args.git_command, "upstream"):
call([args.git_command, "checkout", "-t", f"upstream/{submodule_branch}"])
# Don't use extra fetch since all remotes of interest have been already fetched
# some lines above.
skip_msg += work_tree_update(args, use_fetch=False)

View File

@ -116,8 +116,7 @@ class Manager {
~Manager();
/**
* Create a new resource handle for the given object. Can be called multiple time with the
* same object **successively** without duplicating the data.
* Create a new resource handle for the given object.
*/
ResourceHandle resource_handle(const ObjectRef ref);
/**

View File

@ -99,6 +99,8 @@ static Array<float> calculate_point_lengths(
const Span<float> evaluated_lengths = curves.evaluated_lengths_for_curve(i_curve, is_cyclic);
MutableSpan<float> lengths = result.as_mutable_span().slice(points);
lengths.first() = 0.0f;
const float last_evaluated_length = evaluated_lengths.is_empty() ? 0.0f :
evaluated_lengths.last();
float total;
switch (types[i_curve]) {
@ -107,19 +109,19 @@ static Array<float> calculate_point_lengths(
for (const int i : IndexRange(points.size()).drop_back(1)) {
lengths[i + 1] = evaluated_lengths[resolution * (i + 1) - 1];
}
total = evaluated_lengths.last();
total = last_evaluated_length;
break;
}
case CURVE_TYPE_POLY:
lengths.drop_front(1).copy_from(evaluated_lengths.take_front(lengths.size() - 1));
total = evaluated_lengths.last();
total = last_evaluated_length;
break;
case CURVE_TYPE_BEZIER: {
const Span<int> offsets = curves.bezier_evaluated_offsets_for_curve(i_curve);
for (const int i : IndexRange(points.size()).drop_back(1)) {
lengths[i + 1] = evaluated_lengths[offsets[i + 1] - 1];
}
total = evaluated_lengths.last();
total = last_evaluated_length;
break;
}
case CURVE_TYPE_NURBS: {

View File

@ -218,29 +218,17 @@ class ReverseUVSampleFunction : public mf::MultiFunction {
MutableSpan<float3> bary_weights = params.uninitialized_single_output_if_required<float3>(
3, "Barycentric Weights");
Array<ReverseUVSampler::Result> results(mask.min_array_size());
reverse_uv_sampler_->sample_many(sample_uvs, results);
if (!is_valid.is_empty()) {
std::transform(results.begin(),
results.end(),
is_valid.begin(),
[](const ReverseUVSampler::Result &result) {
return result.type == ReverseUVSampler::ResultType::Ok;
});
}
if (!tri_index.is_empty()) {
std::transform(results.begin(),
results.end(),
tri_index.begin(),
[](const ReverseUVSampler::Result &result) { return result.looptri_index; });
}
if (!bary_weights.is_empty()) {
std::transform(results.begin(),
results.end(),
bary_weights.begin(),
[](const ReverseUVSampler::Result &result) { return result.bary_weights; });
for (const int i : mask) {
const ReverseUVSampler::Result result = reverse_uv_sampler_->sample(sample_uvs[i]);
if (!is_valid.is_empty()) {
is_valid[i] = result.type == ReverseUVSampler::ResultType::Ok;
}
if (!tri_index.is_empty()) {
tri_index[i] = result.looptri_index;
}
if (!bary_weights.is_empty()) {
bary_weights[i] = result.bary_weights;
}
}
}

View File

@ -28,7 +28,7 @@ VERSION_MIN = (1, 6, 0)
VERSION_MAX_RECOMMENDED = (1, 6, 0)
AUTOPEP8_FORMAT_CMD = "autopep8"
BASE_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
BASE_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))
os.chdir(BASE_DIR)

View File

@ -26,7 +26,7 @@ VERSION_MIN = (8, 0, 0)
VERSION_MAX_RECOMMENDED = (12, 0, 0)
CLANG_FORMAT_CMD = "clang-format"
BASE_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
BASE_DIR = os.path.normpath(os.path.join(os.path.dirname(__file__), "..", ".."))
os.chdir(BASE_DIR)