From bf866348c0f2579c3ebdfad122fb42b19f11e13c Mon Sep 17 00:00:00 2001 From: Alesandro Dragnev Date: Wed, 21 Jan 2026 14:46:46 +0200 Subject: [PATCH 1/6] Adding Display ratio --- src/GDTFManager.cpp | 20 ++++++++++++--- src/GDTFManager.h | 4 +++ src/Implementation/CGdtfGeometry.cpp | 26 ++++++++++++++++++++ src/Implementation/CGdtfGeometry.h | 2 ++ src/Include/IMediaRessourceVectorInterface.h | 2 ++ src/Prefix/CommonPrefix.h | 1 + 6 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/GDTFManager.cpp b/src/GDTFManager.cpp index 998828ae..4a0ccedd 100644 --- a/src/GDTFManager.cpp +++ b/src/GDTFManager.cpp @@ -2906,12 +2906,14 @@ GdtfGeometryDisplay::GdtfGeometryDisplay(GdtfGeometry* parent) :GdtfGeometry(parent) { fTexture = ""; + fAspectRatio = ""; } GdtfGeometryDisplay::GdtfGeometryDisplay(const TXString& name, GdtfModelPtr refToModel,const VWTransformMatrix& ma, GdtfGeometry* parent) :GdtfGeometry(name,refToModel,ma, parent) { - fTexture = ""; + fTexture = ""; + fAspectRatio = ""; } GdtfGeometryDisplay::~GdtfGeometryDisplay() @@ -2928,12 +2930,23 @@ void GdtfGeometryDisplay::SetTexture(const TXString& texture) fTexture = texture; } +const TXString& GdtfGeometryDisplay::GetAspectRatio() const +{ + return fAspectRatio; +} + +void GdtfGeometryDisplay::SetAspectRatio( const TXString& aspectRatio ) +{ + fAspectRatio = aspectRatio; +} + void GdtfGeometryDisplay::OnPrintToFile(IXMLFileNodePtr pNode) { //------------------------------------------------------------------------------------ // Call the parent GdtfGeometry::OnPrintToFile(pNode); - pNode->SetNodeAttributeValue(XML_GDTF_DisplayTexture, fTexture); + pNode->SetNodeAttributeValue( XML_GDTF_DisplayTexture, fTexture); + pNode->SetNodeAttributeValue( XML_GDTF_DisplayAspectRatio, fAspectRatio ); } void GdtfGeometryDisplay::OnReadFromNode(const IXMLFileNodePtr& pNode) @@ -2942,7 +2955,8 @@ void GdtfGeometryDisplay::OnReadFromNode(const IXMLFileNodePtr& pNode) // Call the parent GdtfGeometry::OnReadFromNode(pNode); - pNode->GetNodeAttributeValue(XML_GDTF_DisplayTexture, fTexture); + pNode->GetNodeAttributeValue( XML_GDTF_DisplayTexture, fTexture); + pNode->GetNodeAttributeValue( XML_GDTF_DisplayAspectRatio, fAspectRatio ); } void GdtfGeometryDisplay::OnErrorCheck(const IXMLFileNodePtr& pNode) diff --git a/src/GDTFManager.h b/src/GDTFManager.h index da4d9e2c..8dd7d3e0 100644 --- a/src/GDTFManager.h +++ b/src/GDTFManager.h @@ -951,10 +951,14 @@ namespace SceneData ~GdtfGeometryDisplay(); private: TXString fTexture; + TXString fAspectRatio; + public: virtual EGdtfObjectType GetObjectType(); const TXString& GetTexture(); void SetTexture(const TXString& texture); + const TXString& GetAspectRatio() const; + void SetAspectRatio( const TXString& aspectRatio ); protected: virtual TXString GetNodeName(); virtual void OnPrintToFile(IXMLFileNodePtr pNode); diff --git a/src/Implementation/CGdtfGeometry.cpp b/src/Implementation/CGdtfGeometry.cpp index abb6012f..b55586cf 100644 --- a/src/Implementation/CGdtfGeometry.cpp +++ b/src/Implementation/CGdtfGeometry.cpp @@ -983,6 +983,32 @@ VectorworksMVR::VCOMError VectorworksMVR::CGdtfGeometryImpl::SetTexture(MvrStrin return kVCOMError_NoError; } +MvrString VectorworksMVR::CGdtfGeometryImpl::GetAspectRatio() +{ + if(!fGeometry) return ""; + + if( fGeometryType != EGdtfObjectType::eGdtfGeometryDisplay) return ""; + + SceneData::GdtfGeometryDisplayPtr display = static_cast(fGeometry); + if(!display) return ""; + + return display->GetAspectRatio().GetCharPtr(); +} + +VectorworksMVR::VCOMError VectorworksMVR::CGdtfGeometryImpl::SetAspectRatio(MvrString aspectRatio) +{ + if (!fGeometry) return kVCOMError_NotInitialized; + + if( fGeometryType != EGdtfObjectType::eGdtfGeometryDisplay) return kVCOMError_WrongGeometryType; + + SceneData::GdtfGeometryDisplayPtr display = static_cast(fGeometry); + if(!display) return kVCOMError_Failed; + + display->SetAspectRatio(aspectRatio); + return kVCOMError_NoError; +} + + VectorworksMVR::VCOMError VectorworksMVR::CGdtfGeometryImpl::GetCountLinkedDmxChannel(size_t& count, IGdtfDmxMode * forMode) { // Get Count diff --git a/src/Implementation/CGdtfGeometry.h b/src/Implementation/CGdtfGeometry.h index 24c168ed..7ff99f61 100644 --- a/src/Implementation/CGdtfGeometry.h +++ b/src/Implementation/CGdtfGeometry.h @@ -66,6 +66,8 @@ namespace VectorworksMVR // Display virtual MvrString VCOM_CALLTYPE GetTexture(); virtual VCOMError VCOM_CALLTYPE SetTexture(MvrString texture); + virtual MvrString VCOM_CALLTYPE GetAspectRatio(); + virtual VCOMError VCOM_CALLTYPE SetAspectRatio(MvrString aspectRatio); // Helpers virtual VCOMError VCOM_CALLTYPE GetCountLinkedDmxChannel(size_t& count, IGdtfDmxMode * forMode); diff --git a/src/Include/IMediaRessourceVectorInterface.h b/src/Include/IMediaRessourceVectorInterface.h index 493b6360..b9059552 100644 --- a/src/Include/IMediaRessourceVectorInterface.h +++ b/src/Include/IMediaRessourceVectorInterface.h @@ -861,6 +861,8 @@ namespace VectorworksMVR // Display virtual MvrString VCOM_CALLTYPE GetTexture() = 0; virtual VCOMError VCOM_CALLTYPE SetTexture(MvrString texture) = 0; + virtual MvrString VCOM_CALLTYPE GetAspectRatio() = 0; + virtual VCOMError VCOM_CALLTYPE SetAspectRatio(MvrString aspectRatio) = 0; // GDTF 1.2 // Lamp diff --git a/src/Prefix/CommonPrefix.h b/src/Prefix/CommonPrefix.h index b3585592..78d38146 100644 --- a/src/Prefix/CommonPrefix.h +++ b/src/Prefix/CommonPrefix.h @@ -452,6 +452,7 @@ const Sint32 kGDTF_CurrentMinorVersion = 2; #define XML_GDTF_DisplayNodeName "Display" #define XML_GDTF_DisplayTexture "Texture" +#define XML_GDTF_DisplayAspectRatio "AspectRatio" #define XML_GDTF_LaserProtocolNodeName "Protocol" #define XML_GDTF_LaserProtocolName "Name" From 9bcb8578f96e6d35924934f2a69185c9807c6dc5 Mon Sep 17 00:00:00 2001 From: Alesandro Dragnev Date: Wed, 21 Jan 2026 15:01:11 +0200 Subject: [PATCH 2/6] Fixing Unit Tests --- unittest/EmptyGeometryUnitTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/unittest/EmptyGeometryUnitTest.cpp b/unittest/EmptyGeometryUnitTest.cpp index a7bcd09f..39932148 100644 --- a/unittest/EmptyGeometryUnitTest.cpp +++ b/unittest/EmptyGeometryUnitTest.cpp @@ -54,6 +54,7 @@ void GdtfEmptyModelTest::WriteFile(VectorworksMVR::IGdtfFixturePtr& fixture) IGdtfGeometryPtr geometry4; __checkVCOM(geometry1->CreateGeometry(EGdtfObjectType::eGdtfGeometryDisplay, "Geometry4", filledModel, STransformMatrix(), &geometry4)); __checkVCOM(geometry4->SetTexture("Texture.png")); + __checkVCOM(geometry4->SetAspectRatio("16:9")); // Magnet IGdtfGeometryPtr geometry5; From 0a587c712f488ddc90be9a4e180aaf73eedbd289 Mon Sep 17 00:00:00 2001 From: Alesandro Dragnev Date: Wed, 21 Jan 2026 15:06:20 +0200 Subject: [PATCH 3/6] Fixing Unit test again --- unittest/EmptyGeometryUnitTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unittest/EmptyGeometryUnitTest.cpp b/unittest/EmptyGeometryUnitTest.cpp index 39932148..28bccdb7 100644 --- a/unittest/EmptyGeometryUnitTest.cpp +++ b/unittest/EmptyGeometryUnitTest.cpp @@ -201,6 +201,8 @@ void GdtfEmptyModelTest::ReadFile(VectorworksMVR::IGdtfFixturePtr& fixture) checkifEqual("Check Texture", geometry4->GetTexture(), "Texture.png"); + checkifEqual("Check Aspect Ratio", geometry4->GetAspectRatio(), "16:9"); + // Magnet IGdtfGeometryPtr geoMagnet; __checkVCOM(geometry1->GetInternalGeometryAt(3, &geoMagnet)); From 96940a9025ab1b9bc7a77df1d61b45572b56a61d Mon Sep 17 00:00:00 2001 From: Alesandro Dragnev Date: Wed, 21 Jan 2026 15:51:40 +0200 Subject: [PATCH 4/6] Adding check to see where the test fails --- unittest/Unittest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/unittest/Unittest.cpp b/unittest/Unittest.cpp index 2de1fc85..8a3055f6 100644 --- a/unittest/Unittest.cpp +++ b/unittest/Unittest.cpp @@ -265,6 +265,7 @@ void Unittest::checkifEqual(const std::string& check, const std::string& aspecte fFailedTests.push_back(test); + std::cout << "Failed Test: " << test.fMessage << std::endl; }; bool Unittest::checkVCOM(VectorworksMVR::VCOMError error, const std::string& check) From 252386dbb7d3e0aeae5174ecb56578afde5ba848 Mon Sep 17 00:00:00 2001 From: Alesandro Dragnev Date: Wed, 21 Jan 2026 16:01:36 +0200 Subject: [PATCH 5/6] adding cout --- unittest/Utility.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/unittest/Utility.cpp b/unittest/Utility.cpp index b0e302b8..4314d93f 100644 --- a/unittest/Utility.cpp +++ b/unittest/Utility.cpp @@ -53,6 +53,7 @@ bool UnitTestUtil::GetFolderAppDataLocal(std::string& outPath) if(!result) return false; std::wstring ws(buffer); outPath = std::string(ws.begin(), ws.end()); + std::cout << "AppData Local Folder: " << outPath << std::endl; #elif _LINUX // LINUX_IMPLEMENTATION - done From b7424365edaec1b9277ec7d3f6ff9acd05a752f2 Mon Sep 17 00:00:00 2001 From: Alesandro Dragnev Date: Wed, 21 Jan 2026 16:48:46 +0200 Subject: [PATCH 6/6] Update Empty Geometry Test --- unittest/EmptyGeometryUnitTest.cpp | 18 ++++++++++++++---- unittest/EmptyGeometryUnitTest.h | 8 ++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/unittest/EmptyGeometryUnitTest.cpp b/unittest/EmptyGeometryUnitTest.cpp index 28bccdb7..9e6433c1 100644 --- a/unittest/EmptyGeometryUnitTest.cpp +++ b/unittest/EmptyGeometryUnitTest.cpp @@ -13,7 +13,7 @@ using namespace VectorworksMVR::GdtfDefines; #define __checkVCOM(x) this->checkVCOM(x, #x) #define __checkVCOM_NotSet(x) this->checkVCOM_NotSet(x, #x) -GdtfEmptyModelTest::GdtfEmptyModelTest(const std::string& currentDir) : GdtfUnitTest(currentDir) +GdtfEmptyModelTest::GdtfEmptyModelTest(const std::string& currentDir) { } @@ -21,10 +21,20 @@ GdtfEmptyModelTest::~GdtfEmptyModelTest() { } +bool GdtfEmptyModelTest::ExecuteTest() +{ + std::cout << "= GdtfEmptyModelTest =" << std::endl; -std::string GdtfEmptyModelTest::GetUnitTestName() -{ - return std::string("GdtfEmptyModel"); + VectorworksMVR::IGdtfFixturePtr fixture( IID_IGdtfFixture ); + fixture->OpenForWrite( "EmptyGeometryUnitTest", "MVR Group", MvrUUID(1,1,1,1) ); + + WriteFile(fixture); + + fixture->Close(); + + ReadFile(fixture); + + return true; } void GdtfEmptyModelTest::WriteFile(VectorworksMVR::IGdtfFixturePtr& fixture) diff --git a/unittest/EmptyGeometryUnitTest.h b/unittest/EmptyGeometryUnitTest.h index f42025ea..a1c91007 100644 --- a/unittest/EmptyGeometryUnitTest.h +++ b/unittest/EmptyGeometryUnitTest.h @@ -7,16 +7,16 @@ #include "GdtfUnittestHandler.h" -class GdtfEmptyModelTest : public GdtfUnitTest +class GdtfEmptyModelTest : public Unittest { public: GdtfEmptyModelTest(const std::string& currentDir); virtual ~GdtfEmptyModelTest(); protected: - std::string virtual GetUnitTestName() override; + bool virtual ExecuteTest(); private: - void virtual WriteFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringRead) override; - void virtual ReadFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringWrite) override; + void WriteFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringRead); + void ReadFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringWrite); }; \ No newline at end of file