Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 2.0 #144

Merged
merged 126 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
b264697
Improve default material name
bneukom Jul 10, 2023
d208ffa
Cleanup constant variable names
bneukom Jul 10, 2023
e51a9f1
Add material replacement support
bneukom Feb 14, 2023
14047f0
Fix instance names and add instance identifier
bneukom Jul 19, 2023
672bb0b
Add instance replacement support
bneukom Jul 17, 2023
976cee4
Move Asset Widget to top of replacement dialog
bneukom Jul 21, 2023
2c6f358
Remove preview from instance replacement dialog
bneukom Jul 21, 2023
8c25d71
Support adding a new Data Asset in the replacement dialog
bneukom Jul 21, 2023
82c6fd7
Factor replacement window code into common base class
bneukom Jul 21, 2023
3e84544
Improve replacement dialog widgets naming
bneukom Jul 21, 2023
3da3348
Add generate support without applying replacements
bneukom Jul 25, 2023
d553dbc
Properly update apply button after replacement asset changes
bneukom Jul 25, 2023
e19ee04
Support multiple replacement alternatives for instances
bneukom Jul 25, 2023
dbec8d6
Block UI until generation has completed before opening replacement di…
bneukom Jul 25, 2023
63b32e5
Add missing GC Object referencer name
bneukom Jul 25, 2023
70c1144
Properly encapsulate replacement assets
bneukom Jul 25, 2023
f85eb0e
Use a normal TObjectPtr for the replacement mesh
bneukom Jul 25, 2023
ec40ca8
Improve replacement options editor naming
bneukom Jul 25, 2023
c99fb77
Support overriding/appending replacements in Asset
bneukom Jul 26, 2023
286ca65
Only allow single replacement dialog open at any time
bneukom Aug 2, 2023
c8c4723
Only regenerate on replacement dialog open/close when neceessary
bneukom Aug 3, 2023
b9a71de
Support uniform scaling for instance replacements
bneukom Aug 3, 2023
7fdba41
Identify materials by identifier for replacements
bneukom Aug 4, 2023
14ad004
Move include from header to implementation
bneukom Aug 4, 2023
9275bdc
Ensure that material identifiers are valid
bneukom Aug 14, 2023
7cf1b35
Add missing UPROPERTY categories
bneukom Aug 14, 2023
492f682
Add missing include
bneukom Aug 14, 2023
ea238ca
Merge pull request #127 from Esri/bneukom/asset_replacements
bneukom Aug 14, 2023
701adcf
Avoid regenerating buildings on spline edits in interactive mode
Jul 20, 2023
c7dec9a
Merge pull request #130 from Esri/cknieling/only_regenerate_when_spli…
bneukom Aug 18, 2023
7b21348
Fix access violation if no RPK is set for replacements
bneukom Oct 2, 2023
eff90d0
Only remove existing material/instance replacements in override case
bneukom Oct 4, 2023
c0fafd6
Merge pull request #131 from Esri/bneukom/asset_replacement_improvements
bneukom Oct 4, 2023
0f25121
Simplify initialization checks in module
bneukom Oct 24, 2023
cbceca4
Properly name add replacement button function
bneukom Dec 5, 2023
8cbde68
Switch to double precision vector for initial shape
bneukom Dec 5, 2023
63e7edd
Add support for batch model generation
bneukom Dec 5, 2023
e28009b
Do not triangulate mesh twice
bneukom Dec 5, 2023
f07f262
Fix callback proxy handling
bneukom Dec 5, 2023
fd43e6b
Move helper types back into VitruvioComponent
bneukom Dec 6, 2023
a0c8ba5
Only display the Values property for Array elements
bneukom Dec 20, 2023
81c0604
Move RulePackage to InitialShape to simplify batch generation
bneukom Dec 20, 2023
3960824
Return ModelDescription from ConvertMesh instead of pass by reference
bneukom Dec 20, 2023
6df2793
Cleanup geometry encoder
bneukom Dec 21, 2023
558b1aa
Add option to visualize batch grid
bneukom Dec 22, 2023
15b05aa
Properly cleanup old instances
bneukom Dec 28, 2023
a8accd6
Rename batch generate function
bneukom Jan 1, 2024
328c813
Merge pull request #132 from Esri/bneukom/generate_batching
bneukom Jan 12, 2024
a63ab40
Move replacement functions to header
bneukom Jan 4, 2024
d362384
Support replacements on batch VitruvioActor
bneukom Jan 4, 2024
205fd4b
Add collision generation for batched VitruvioActors
bneukom Jan 4, 2024
6e8afd0
Add generate all button to VitruvioBatchActor details panel
bneukom Jan 12, 2024
896a9ab
Merge pull request #134 from Esri/bneukom/batch_replacements
bneukom Jan 12, 2024
aacaa57
Merge pull request #133 from Esri/bneukom/fix_array_editor
bneukom Jan 15, 2024
dd48d29
Add missing property categories
bneukom Jan 16, 2024
6e363be
Fix plugin build issues
bneukom Jan 17, 2024
2399b4a
Fix crash for empty RPK batch generation
bneukom Jan 18, 2024
79eef60
Fix cooking mesh description segmentation fault
bneukom Jan 18, 2024
86d9cec
Add menu option to select all attached VitruvioActors for a given Actor
bneukom Jan 18, 2024
689c295
Schedule batch generate even if we don't have valid input data
bneukom Jan 19, 2024
70c837e
Assume we are always ready to generate in batch mode
bneukom Jan 19, 2024
260d03a
Regenerate in case of mesh removal and other attribute changes in bat…
bneukom Jan 19, 2024
80f2409
Force refresh details panel on batch generate change
bneukom Jan 22, 2024
747f0f3
Properly cleanup old generated meshes when switching batch generation
bneukom Jan 22, 2024
4b99ecc
Update to Unreal 5.3
bneukom Jan 16, 2024
a1628a5
Fix missing collision CPU access flag for generated models
bneukom Jan 17, 2024
730143f
Update to PRT 3.1
bneukom Jan 22, 2024
d171be4
Remove deprecated malloc profiler flag
bneukom Jan 22, 2024
9bb38c2
Merge pull request #135 from Esri/bneukom/ue53_update
bneukom Jan 24, 2024
13a4492
Merge pull request #136 from Esri/bneukom/prt31_update
bneukom Jan 24, 2024
ec80428
Add command line check to quit for CI
arisona Jan 25, 2024
fc732e3
Update build-vitruvio.yml
arisona Jan 25, 2024
319bf99
Update system test blueprint
arisona Jan 26, 2024
859b574
Merge branch 'develop' of github.com:Esri/vitruvio into develop
arisona Jan 26, 2024
a515d90
Update system test blueprint (fix)
arisona Jan 26, 2024
c081759
Update build-vitruvio.yml
bneukom Jan 30, 2024
cbef1aa
Support builtin assets for replacements
bneukom Jan 24, 2024
a65df34
Fix replacement random rotation
bneukom Jan 25, 2024
26a160e
Mark replacement asset as dirty after updates
bneukom Jan 25, 2024
f347262
Merge pull request #137 from Esri/bneukom/replacement_update
bneukom Jan 30, 2024
5779a75
Fix conversion to VitruvioActor
bneukom Jan 30, 2024
0d01eea
Add warning for default material replacements
bneukom Jan 31, 2024
15d455b
Fix GC cleanup issue for replacement dialogs
bneukom Jan 31, 2024
f1a2fe6
Close replacement dialogs on map changes
bneukom Jan 31, 2024
72e7016
Mark material replacement asset as dirty after changes
bneukom Jan 31, 2024
2f29db2
Fix apply to all VitruvioComponent with same RPK replacement
bneukom Jan 31, 2024
3da9750
Extract apply to all VitruvioActors helper function
bneukom Jan 31, 2024
69925a4
Merge pull request #138 from Esri/bneukom/replacement_improvements
bneukom Jan 31, 2024
3281281
Support cooking batched VitruvioActors
bneukom Feb 1, 2024
78c4b05
Only execute completed callback once for generate all calls
bneukom Feb 4, 2024
e521b8a
Improve convert to VitruvioActor check
bneukom Feb 5, 2024
c4e1b23
Fix initial shape selection in outliner
bneukom Feb 5, 2024
8e22fe0
Extract cooking function and ensure cooking is only executed once
bneukom Feb 5, 2024
0ebe63d
Simplify cooked instance creation
bneukom Feb 6, 2024
e5b447d
Merge pull request #139 from Esri/bneukom/cook_batched_actors
bneukom Feb 6, 2024
526c68d
Update build-vitruvio.yml
arisona Feb 12, 2024
e8ba62e
Fix Vitruvio and PRT plugin version
bneukom Feb 13, 2024
d06e860
Update Candler Building Actor
bneukom Feb 13, 2024
2597000
Fix material preview resetting after replacement
bneukom Feb 19, 2024
91e2010
Increase material replacement dialog size
bneukom Feb 19, 2024
7030974
Only regenerate if attributes actually changed in details panel
bneukom Feb 20, 2024
465500d
Cache collision body setup
bneukom Feb 27, 2024
715aac8
Fix unique FName issue for materials
bneukom Feb 27, 2024
54c87c9
Merge pull request #141 from Esri/bneukom/cache_body_setup
bneukom Feb 27, 2024
ae2758e
Make GenerateOptions optional and expose parameters to BPs
bneukom Feb 28, 2024
3180619
Update wrong Generate function doc
bneukom Feb 28, 2024
517f4db
Fix packaging compilation issues
bneukom Feb 28, 2024
7f76a25
Add Blueprint support for batch generation
bneukom Feb 28, 2024
0dc8cc0
Add batch generate option for convert to VitruvioActor action
bneukom Feb 28, 2024
c532b41
Fix batch actor generation concurrency issue
bneukom Feb 28, 2024
0106487
Support attribute evaluation for batch generation
bneukom Feb 28, 2024
5cac246
Remove unused generate collision property
bneukom Mar 1, 2024
1554d03
Simplify batch generate on RPK reload
bneukom Mar 1, 2024
ad7e531
Cleanup includes
bneukom Mar 1, 2024
83c3b40
Merge pull request #143 from Esri/bneukom/batch_fixes
bneukom Mar 1, 2024
f74e534
Update copyright notice
bneukom Mar 4, 2024
47d3269
Make BatchGridVisualizer AInfo
bneukom Mar 6, 2024
a2f6cfd
Make VitruvioBatchActor non deletable
bneukom Mar 6, 2024
02da185
Remove unused GenerateCollision flag
bneukom Mar 6, 2024
255629c
Add doc for bBatchGenerate
bneukom Mar 6, 2024
13f9bce
Update install instructions
bneukom Mar 7, 2024
9a35d85
Update candler demo camera position
bneukom Mar 7, 2024
1b0569d
Add batch generate usage guide
bneukom Mar 7, 2024
eb472c6
Fix batch generate image path
bneukom Mar 7, 2024
72e5c7e
Add replacement section to usage guide
bneukom Mar 7, 2024
ce6261d
Fix replacement image dimensions
bneukom Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/build-vitruvio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ name: build-vitruvio

on:
push:
# Careful! No fall-through for the filters.
branches:
- main
- develop
- 'arisona/workflows'

pull_request:
# Careful! No fall-through for the filters.
branches:
- main
- develop
- workflow_integration

jobs:
package-host-main:
Expand All @@ -16,7 +23,9 @@ jobs:
- uses: actions/checkout@v2
- run: |
C:\dev\git\zrh-xr-devops\scripts\ue_build_action.py ${{github.workspace}} ${{github.ref_name}} vitruvio_host_package_shipping

- run: |
C:\dev\git\zrh-xr-devops\scripts\ue_run_action.py ${{github.workspace}} ${{github.ref_name}} vitruvio_host_package_shipping

build-plugin-main:
runs-on: [self-hosted, zrh-unreal]
name: Build plugin on main branch
Expand All @@ -29,16 +38,18 @@ jobs:
package-host-develop:
runs-on: [self-hosted, zrh-unreal]
name: Package host project (debug) on develop branch
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/arisona/workflows'
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- run: |
C:\dev\git\zrh-xr-devops\scripts\ue_build_action.py ${{github.workspace}} ${{github.ref_name}} vitruvio_host_package_debug

- run: |
C:\dev\git\zrh-xr-devops\scripts\ue_run_action.py ${{github.workspace}} ${{github.ref_name}} vitruvio_host_package_debug

build-plugin-develop:
runs-on: [self-hosted, zrh-unreal]
name: Build plugin on develop branch
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/arisona/workflows'
if: github.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- run: |
Expand Down
Binary file modified VitruvioHost/Plugins/Vitruvio/Content/Demo/CandlerDemo.umap
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace
{
const int VERSION_MAJOR = 3;
const int VERSION_MINOR = 0;
const int VERSION_MINOR = 1;
} // namespace

extern "C"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2020 Esri
/* Copyright 2023 Esri
*
* Licensed under the Apache License Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -148,22 +148,28 @@ uint32_t scanValidTextures(const prtx::MaterialPtr& mat)
return highestUVSet + 1;
}

// use shape name by default for the actor and if the instance originates from a file we use the file name for better readability
std::wstring createInstanceName(const prtx::EncodePreparator::FinalizedInstance& fi)
struct InstanceIdentifier
{
std::wstring name;
std::wstring meshId;
};

// use shape name by default and if the instance originates from a file we use the file name for better readability
InstanceIdentifier createInstanceIdentifier(const prtx::EncodePreparator::FinalizedInstance& fi)
{
const auto geometry = fi.getGeometry();
const auto uri = geometry->getURI();

if (uri->isFilePath())
return uri->getBaseName();
if (!uri->getExtension().empty())
return { uri->getBaseName(), uri->getPath() };

std::wstring meshName = fi.getShapeName();

// remove last point similar to the model hierarchy
if (!meshName.empty() && meshName.back() == '.')
meshName = meshName.substr(0, meshName.length() - 1);

return meshName;
return { meshName, uri->getPath() + L"/" + meshName};
}

std::wstring uriToPath(const prtx::TexturePtr& t)
Expand Down Expand Up @@ -514,7 +520,7 @@ SerializedGeometry serializeGeometry(const prtx::GeometryPtrVector& geometries,
return sg;
}

void encodeMesh(IUnrealCallbacks* cb, const SerializedGeometry& sg, wchar_t const* name, int32_t prototypeIndex, const std::wstring& uri,
void encodeMesh(IUnrealCallbacks* cb, const SerializedGeometry& sg, wchar_t const* name, wchar_t const* meshId, int32_t prototypeIndex, const std::wstring& uri,
prtx::GeometryPtrVector geometries, std::vector<prtx::MaterialPtrVector> materials)
{
auto puvs = toPtrVec(sg.uvs);
Expand Down Expand Up @@ -543,7 +549,7 @@ void encodeMesh(IUnrealCallbacks* cb, const SerializedGeometry& sg, wchar_t cons
++matIt;
}

cb->addMesh(name, prototypeIndex, uri.c_str(), sg.coords.data(), sg.coords.size(), sg.normals.data(), sg.normals.size(),
cb->addMesh(name, meshId, prototypeIndex, uri.c_str(), sg.coords.data(), sg.coords.size(), sg.normals.data(), sg.normals.size(),
sg.faceVertexCounts.data(), sg.faceVertexCounts.size(), sg.vertexIndices.data(), sg.vertexIndices.size(), sg.normalIndices.data(),
sg.normalIndices.size(),

Expand Down Expand Up @@ -574,9 +580,16 @@ UnrealGeometryEncoder::UnrealGeometryEncoder(const std::wstring& id, const prt::

void UnrealGeometryEncoder::init(prtx::GenerateContext&)
{
mNsMesh = mNamePrep.newNamespace();
mNsMaterial = mNamePrep.newNamespace();

mEncPrep = prtx::EncodePreparator::create(true, mNamePrep, mNsMesh, mNsMaterial);

auto* callbacks = dynamic_cast<IUnrealCallbacks*>(getCallbacks());
if (callbacks == nullptr)
throw prtx::StatusException(prt::STATUS_ILLEGAL_CALLBACK_OBJECT);

callbacks->init();
}

void UnrealGeometryEncoder::encode(prtx::GenerateContext& context, size_t initialShapeIndex)
Expand All @@ -585,39 +598,17 @@ void UnrealGeometryEncoder::encode(prtx::GenerateContext& context, size_t initia

IUnrealCallbacks* cb = static_cast<IUnrealCallbacks*>(getCallbacks());

const bool emitAttrs = getOptions()->getBool(EO_EMIT_ATTRIBUTES);

prtx::DefaultNamePreparator namePrep;
prtx::NamePreparator::NamespacePtr nsMesh = namePrep.newNamespace();
prtx::NamePreparator::NamespacePtr nsMaterial = namePrep.newNamespace();
prtx::EncodePreparatorPtr encPrep = prtx::EncodePreparator::create(true, namePrep, nsMesh, nsMaterial);

// generate geometry
prtx::ReportsAccumulatorPtr reportsAccumulator{prtx::SummarizingReportsAccumulator::create()};
prtx::ReportingStrategyPtr reportsCollector{prtx::AllShapesReportingStrategy::create(context, initialShapeIndex, reportsAccumulator)};
prtx::LeafIteratorPtr li = prtx::LeafIterator::create(context, initialShapeIndex);
for (prtx::ShapePtr shape = li->getNext(); shape; shape = li->getNext())
{
encPrep->add(context.getCache(), shape, initialShape.getAttributeMap());
mEncPrep->add(context.getCache(), shape, initialShape.getAttributeMap());
}

const prtx::EncodePreparator::PreparationFlags PREP_FLAGS =
prtx::EncodePreparator::PreparationFlags()
.instancing(true)
.meshMerging(prtx::MeshMerging::ALL_OF_SAME_MATERIAL_AND_TYPE)
.triangulate(false)
.processHoles(prtx::HoleProcessor::TRIANGULATE_FACES_WITH_HOLES)
.mergeVertices(true)
.cleanupVertexNormals(true)
.cleanupUVs(true)
.processVertexNormals(prtx::VertexNormalProcessor::SET_MISSING_TO_FACE_NORMALS)
.indexSharing(prtx::EncodePreparator::PreparationFlags::INDICES_SEPARATE_FOR_ALL_VERTEX_ATTRIBUTES);

prtx::EncodePreparator::InstanceVector instances;
encPrep->fetchFinalizedInstances(instances, PREP_FLAGS);
convertGeometry(initialShape, instances, cb);

const bool emitAttrs = getOptions()->getBool(EO_EMIT_ATTRIBUTES);
if (emitAttrs) {
prtx::ReportsAccumulatorPtr reportsAccumulator{prtx::SummarizingReportsAccumulator::create()};
prtx::ReportingStrategyPtr reportsCollector{prtx::AllShapesReportingStrategy::create(context, initialShapeIndex, reportsAccumulator)};

const prtx::ReportsPtr& reports = reportsCollector->getReports();
if (reports) {
prtx::PRTUtils::AttributeMapPtr reportMap = convertReportToAttributeMap(reports);
Expand All @@ -626,32 +617,28 @@ void UnrealGeometryEncoder::encode(prtx::GenerateContext& context, size_t initia
}
}

void UnrealGeometryEncoder::convertGeometry(const prtx::InitialShape& initialShape, const prtx::EncodePreparator::InstanceVector& instances,
IUnrealCallbacks* cb) const
void UnrealGeometryEncoder::convertGeometry(const prtx::EncodePreparator::InstanceVector& instances, IUnrealCallbacks* cb)
{
std::set<int> serializedPrototypes;

prtx::GeometryPtrVector geometries;
std::vector<prtx::MaterialPtrVector> materials;
prtx::PRTUtils::AttributeMapBuilderPtr instanceMatAmb(prt::AttributeMapBuilder::create());
for (const auto& inst : instances)
{
if (inst.getPrototypeIndex() != -1)
if (inst.getPrototypeIndex() != prtx::EncodePreparator::FinalizedInstance::NO_PROTOTYPE_INDEX)
{
const prtx::MaterialPtrVector& instMaterials = inst.getMaterials();
const prtx::GeometryPtr& instGeom = inst.getGeometry();

AttributeMapNOPtrVectorOwner instMaterialsAttributeMap;

if (serializedPrototypes.find(inst.getPrototypeIndex()) == serializedPrototypes.end())
InstanceIdentifier identifier = createInstanceIdentifier(inst);

if (serializedPrototypes.find(identifier.meshId) == serializedPrototypes.end())
{
const std::wstring uri = instGeom->getURI()->wstring();
const SerializedGeometry sg = serializeGeometry({instGeom}, {instMaterials});
const std::wstring instName = createInstanceName(inst);

encodeMesh(cb, sg, instName.c_str(), inst.getPrototypeIndex(), uri, {instGeom}, {instMaterials});

serializedPrototypes.insert(inst.getPrototypeIndex());
encodeMesh(cb, sg, identifier.name.c_str(), identifier.meshId.c_str(), inst.getPrototypeIndex(), uri, {instGeom}, {instMaterials});
serializedPrototypes.insert(identifier.meshId);
}

const prtx::MeshPtrVector& meshes = instGeom->getMeshes();
Expand All @@ -663,7 +650,7 @@ void UnrealGeometryEncoder::convertGeometry(const prtx::InitialShape& initialSha
instMaterialsAttributeMap.v.push_back(instanceMatAmb->createAttributeMapAndReset());
}

cb->addInstance(inst.getPrototypeIndex(), inst.getTransformation().data(), instMaterialsAttributeMap.v.data(),
cb->addInstance(inst.getPrototypeIndex(), identifier.meshId.c_str(), inst.getTransformation().data(), instMaterialsAttributeMap.v.data(),
instMaterialsAttributeMap.v.size());
}
else
Expand All @@ -676,14 +663,36 @@ void UnrealGeometryEncoder::convertGeometry(const prtx::InitialShape& initialSha
if (geometries.size() > 0)
{
const SerializedGeometry sg = serializeGeometry(geometries, materials);
encodeMesh(cb, sg, initialShape.getName(), -1, L"", geometries, materials);
encodeMesh(cb, sg, L"", L"", prtx::EncodePreparator::FinalizedInstance::NO_PROTOTYPE_INDEX, L"", geometries, materials);
}

if (DBG)
log_debug(L"UnrealGeometryEncoder::convertGeometry: end");
}

void UnrealGeometryEncoder::finish(prtx::GenerateContext& /*context*/) {}
void UnrealGeometryEncoder::finish(prtx::GenerateContext& /*context*/)
{
IUnrealCallbacks* cb = static_cast<IUnrealCallbacks*>(getCallbacks());

const prtx::EncodePreparator::PreparationFlags PREP_FLAGS =
prtx::EncodePreparator::PreparationFlags()
.instancing(true)
.meshMerging(prtx::MeshMerging::ALL_OF_SAME_MATERIAL_AND_TYPE)
.triangulate(false)
.processHoles(prtx::HoleProcessor::TRIANGULATE_FACES_WITH_HOLES)
.mergeVertices(true)
.cleanupVertexNormals(true)
.cleanupUVs(true)
.processVertexNormals(prtx::VertexNormalProcessor::SET_MISSING_TO_FACE_NORMALS)
.indexSharing(prtx::EncodePreparator::PreparationFlags::INDICES_SEPARATE_FOR_ALL_VERTEX_ATTRIBUTES);

prtx::EncodePreparator::InstanceVector instances;
mEncPrep->fetchFinalizedInstances(instances, PREP_FLAGS);

convertGeometry(instances, cb);

cb->finish();
}

UnrealGeometryEncoderFactory* UnrealGeometryEncoderFactory::createInstance()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2020 Esri
/* Copyright 2023 Esri
*
* Licensed under the Apache License Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "Codec/CodecMain.h"

#include <iostream>
#include <set>
#include <stdexcept>
#include <string>

Expand All @@ -45,16 +46,22 @@ class UnrealGeometryEncoder final : public prtx::GeometryEncoder
{
public:
UnrealGeometryEncoder(const std::wstring& id, const prt::AttributeMap* options, prt::Callbacks* callbacks);
~UnrealGeometryEncoder() override = default;
virtual ~UnrealGeometryEncoder() override = default;

public:
void init(prtx::GenerateContext& context) override;
void encode(prtx::GenerateContext& context, size_t initialShapeIndex) override;
void finish(prtx::GenerateContext& context) override;
virtual void init(prtx::GenerateContext& context) override;
virtual void encode(prtx::GenerateContext& context, size_t initialShapeIndex) override;
virtual void finish(prtx::GenerateContext& context) override;

private:
void convertGeometry(const prtx::InitialShape& initialShape, const prtx::EncodePreparator::InstanceVector& instances,
IUnrealCallbacks* callbacks) const;
void convertGeometry(const prtx::EncodePreparator::InstanceVector& instances, IUnrealCallbacks* callbacks);

prtx::DefaultNamePreparator mNamePrep;
prtx::EncodePreparatorPtr mEncPrep;
prtx::NamePreparator::NamespacePtr mNsMesh;
prtx::NamePreparator::NamespacePtr mNsMaterial;

std::set<std::wstring> serializedPrototypes;
};

class UnrealGeometryEncoderFactory final : public prtx::EncoderFactory, public prtx::Singleton<UnrealGeometryEncoderFactory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class IUnrealCallbacks : public prt::Callbacks
~IUnrealCallbacks() override = default;

/**
* @param name initial shape name, optionally used to create primitive groups on output
* @param name either the name of the inserted asset or the shape name
* @param meshId unique identifier of this mesh
* @param prototypeId the id of the prototype or -1 of not cached
* @param uri the uri of the inserted asset or empty otherwise
* @param vtx vertex coordinate array
* @param vtxSize of vertex coordinate array
* @param nrm vertex normal array
Expand All @@ -43,7 +45,7 @@ class IUnrealCallbacks : public prt::Callbacks
* types)
*/
// clang-format off
virtual void addMesh(const wchar_t* name,
virtual void addMesh(const wchar_t* name, const wchar_t* meshId,
int32_t prototypeId, const wchar_t* uri,
const double* vtx, size_t vtxSize,
const double* nrm, size_t nrmSize,
Expand All @@ -64,15 +66,18 @@ class IUnrealCallbacks : public prt::Callbacks
/**
* Add a new instance with the given id, transform and an optional set of overriding attributes for this instance
*
* @param prototypeId the id of the prorotype. An @ref addMesh call with the specified prorotypeId will be called before
* @param prototypeId the id of the prototype. An @ref addMesh call with the specified prototype id will be called before
* the call to addInstance and addReport
* @param meshId unique identifier of this mesh
* @param transform the transformation matrix of this instance
* @param instanceMaterial override materials for this instance
* @param numInstanceMaterials number of instance material overrides. Is either 0 or is equal to the number
* of materials of the original mesh (by prototypeId)
*/
virtual void addInstance(int32_t prototypeId, const double* transform, const prt::AttributeMap** instanceMaterial,
virtual void addInstance(int32_t prototypeId, const wchar_t* meshId, const double* transform, const prt::AttributeMap** instanceMaterial,
size_t numInstanceMaterials) = 0;


virtual void init() = 0;
virtual void finish() = 0;
virtual void addReport(const prt::AttributeMap* reports) = 0;
};
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ using AttributeMapBuilderUPtr = std::unique_ptr<prt::AttributeMapBuilder, PRTDes
using AttributeMapBuilderVector = std::vector<AttributeMapBuilderUPtr>;
using InitialShapePtr = std::shared_ptr<const prt::InitialShape>;
using InitialShapeUPtr = std::unique_ptr<const prt::InitialShape, PRTDestroyer>;
using InitialShapeUPtrVector = std::vector<InitialShapeUPtr>;
using InitialShapeBuilderPtr = std::shared_ptr<const prt::InitialShapeBuilder>;
using InitialShapeBuilderUPtr = std::unique_ptr<prt::InitialShapeBuilder, PRTDestroyer>;
using InitialShapeBuilderVector = std::vector<InitialShapeBuilderUPtr>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public UnrealGeometryEncoderTarget(TargetInfo Target)
bShouldCompileAsDLL = true;

bBuildDeveloperTools = false;
bUseMallocProfiler = false;
bBuildWithEditorOnlyData = true;
bCompileAgainstEngine = false;
bCompileAgainstCoreUObject = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Esri
/* Copyright 2024 Esri
*
* Licensed under the Apache License Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,8 +28,8 @@ public class PRT : ModuleRules

// PRT version and toolchain (needs to be correct for download URL)
private const int PrtMajor = 3;
private const int PrtMinor = 0;
private const int PrtBuild = 8905;
private const int PrtMinor = 1;
private const int PrtBuild = 9666;

private const string PrtCoreDllName = "com.esri.prt.core.dll";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Esri
/* Copyright 2024 Esri
*
* Licensed under the Apache License Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading
Loading