Skip to content

Commit 278d363

Browse files
committed
test
1 parent 3411aca commit 278d363

6 files changed

Lines changed: 5317 additions & 20 deletions

File tree

Virtual-res-issue-test-file.xml

Lines changed: 5282 additions & 0 deletions
Large diffs are not rendered by default.

src/GDTFManager.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5406,15 +5406,15 @@ void GdtfDmxChannel::OnReadFromNode(const IXMLFileNodePtr& pNode)
54065406
TXString defVal;
54075407
if (pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDefault, defVal) == kVCOMError_NoError)
54085408
{
5409-
GdtfConverter::ConvertDMXValue(defVal, pNode, this->GetChannelBitResolution(), fDefaultValue_old);
5409+
GdtfConverter::ConvertDMXValue(defVal, pNode, this->GetChannelBitResolution(), fDefaultValue_old, this->IsVirtual());
54105410
}
54115411
// ------------------------------------------------------------------------------------
54125412

54135413
//
54145414
TXString highlight;
54155415
if(VCOM_SUCCEEDED(pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelHighlight, highlight) ))
54165416
{
5417-
GdtfConverter::ConvertDMXValue(highlight, pNode, this->GetChannelBitResolution(), fHeighlight, fHeighlightNone);
5417+
GdtfConverter::ConvertDMXValue(highlight, pNode, this->GetChannelBitResolution(), fHeighlight, fHeighlightNone, this->IsVirtual());
54185418
}
54195419

54205420
pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelGeometry, fUnresolvedGeomRef);
@@ -6114,11 +6114,14 @@ void GdtfDmxChannelFunction::OnReadFromNode(const IXMLFileNodePtr& pNode)
61146114
// ------------------------------------------------------------------------------------
61156115
// Print node attributes
61166116
EGdtfChannelBitResolution channelReso = fParentLogicalChannel->GetParentDMXChannel()->GetChannelBitResolution();
6117+
bool isVirtual = fParentLogicalChannel->GetParentDMXChannel()->IsVirtual();
61176118

61186119
pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionName, fName);
61196120
pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionOriginalAttribute, fOrignalAttribute);
6120-
TXString defaultValue; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDefault, defaultValue); GdtfConverter::ConvertDMXValue(defaultValue, pNode, channelReso,fDefaultValue);
6121-
TXString dmxFrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDMXFrom, dmxFrom); GdtfConverter::ConvertDMXValue(dmxFrom, pNode, channelReso,fAdressStart);
6121+
bool noneValue_defaultValue = false;
6122+
TXString defaultValue; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDefault, defaultValue); GdtfConverter::ConvertDMXValue(defaultValue, pNode, channelReso,fDefaultValue, noneValue_defaultValue, isVirtual);
6123+
bool noneValue_dmxFrom = false;
6124+
TXString dmxFrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDMXFrom, dmxFrom); GdtfConverter::ConvertDMXValue(dmxFrom, pNode, channelReso,fAdressStart, noneValue_dmxFrom, isVirtual);
61226125
TXString physFrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionPhysicalFrom, physFrom); GdtfConverter::ConvertDouble(physFrom, pNode, fPhysicalStart);
61236126
TXString physTo; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionPhysicalTo, physTo); GdtfConverter::ConvertDouble(physTo, pNode, fPhysicalEnd);
61246127
TXString realFade; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionRealFade, realFade); GdtfConverter::ConvertDouble(realFade, pNode, fRealFade);
@@ -6415,13 +6418,13 @@ DmxValue GdtfDmxChannelFunction::GetModeMasterDmxEnd() const
64156418
return fDmxModeEnd;
64166419
}
64176420

6418-
void GdtfDmxChannelFunction::ResolveModeMasterDmx(EGdtfChannelBitResolution resolution)
6421+
void GdtfDmxChannelFunction::ResolveModeMasterDmx(EGdtfChannelBitResolution resolution, bool isVirtual)
64196422
{
64206423
IXMLFileNodePtr node;
64216424
this->GetNode(node);
64226425

6423-
GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeStart, node, resolution, fDmxModeStart);
6424-
GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeEnd,node, resolution, fDmxModeEnd);
6426+
GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeStart, node, resolution, fDmxModeStart, isVirtual);
6427+
GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeEnd,node, resolution, fDmxModeEnd, isVirtual);
64256428
}
64266429

64276430
void GdtfDmxChannelFunction::SetModeMaster_Channel(GdtfDmxChannel* channel)
@@ -6660,8 +6663,10 @@ void GdtfDmxChannelSet::OnReadFromNode(const IXMLFileNodePtr& pNode)
66606663
pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelSetName, fUniqueName);
66616664

66626665
EGdtfChannelBitResolution channelReso = fParentChnlFunction->GetParentDMXChannel()->GetChannelBitResolution();
6666+
bool isVirtual = fParentChnlFunction->GetParentDMXChannel()->IsVirtual();
6667+
bool noneValue = false;
66636668

6664-
TXString dmxfrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelSetDMXFrom, dmxfrom); fValid = GdtfConverter::ConvertDMXValue (dmxfrom, pNode, channelReso, fDmxStart);
6669+
TXString dmxfrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelSetDMXFrom, dmxfrom); fValid = GdtfConverter::ConvertDMXValue (dmxfrom, pNode, channelReso, fDmxStart, noneValue, isVirtual);
66656670
TXString wheelId; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelSetWheelSlotIndexRef, wheelId); GdtfConverter::ConvertInteger(wheelId, pNode, fWheelSlotIdx);
66666671

66676672

@@ -8383,7 +8388,7 @@ void GdtfFixture::ResolveMacroRefs(GdtfDmxModePtr dmxMode)
83838388
{
83848389

83858390
DmxValue dmxVal = 0;
8386-
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, value->GetDMXChannel()->GetChannelBitResolution(), dmxVal);
8391+
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, value->GetDMXChannel()->GetChannelBitResolution(), dmxVal, false);
83878392
value->SetValue(dmxVal);
83888393
}
83898394
else
@@ -8420,7 +8425,7 @@ void GdtfFixture::ResolveMacroRefs(GdtfDmxModePtr dmxMode)
84208425
value->GetNode(node);
84218426

84228427
DmxValue dmxVal = 0;
8423-
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, channelFunction->GetParentDMXChannel()->GetChannelBitResolution(), dmxVal);
8428+
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, channelFunction->GetParentDMXChannel()->GetChannelBitResolution(), dmxVal, false);
84248429
value->SetDmxValue(dmxVal);
84258430
}
84268431
}
@@ -8500,13 +8505,15 @@ void GdtfFixture::ResolveDMXModeMasters()
85008505
{
85018506
bool resolved = false;
85028507
EGdtfChannelBitResolution resolution = EGdtfChannelBitResolution::eGdtfChannelBitResolution_8;
8508+
bool isVirtual = false;
85038509

85048510
GdtfDmxChannelPtr channelPtr = getDmxChannelByRef(unresolvedModeMaster, mode);
85058511
if(! resolved && channelPtr)
85068512
{
85078513
function->SetModeMaster_Channel(channelPtr);
85088514
resolved = true;
8509-
resolution = channelPtr->GetChannelBitResolution();
8515+
resolution = channelPtr->GetChannelBitResolution();
8516+
isVirtual = channelPtr->IsVirtual();
85108517
}
85118518

85128519
GdtfDmxChannelFunctionPtr functionPtr = getDmxFunctionByRef(unresolvedModeMaster, mode);
@@ -8515,10 +8522,11 @@ void GdtfFixture::ResolveDMXModeMasters()
85158522
function->SetModeMaster_Function(functionPtr);
85168523
resolved = true;
85178524
resolution = functionPtr->GetParentDMXChannel()->GetChannelBitResolution();
8525+
isVirtual = functionPtr->GetParentDMXChannel()->IsVirtual();
85188526
}
85198527

85208528
ASSERTN(kEveryone, resolved);
8521-
if(resolved) { function->ResolveModeMasterDmx(resolution); }
8529+
if(resolved) { function->ResolveModeMasterDmx(resolution, isVirtual); }
85228530
else
85238531
{
85248532
IXMLFileNodePtr node;

src/GDTFManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ namespace SceneData
16431643

16441644
GdtfDmxChannel* GetParentDMXChannel() const;
16451645
GdtfDmxLogicalChannel* GetParentLogicalChannel() const;
1646-
void ResolveModeMasterDmx(EGdtfChannelBitResolution resolution);
1646+
void ResolveModeMasterDmx(EGdtfChannelBitResolution resolution, bool isVirtual);
16471647

16481648
void SetNextFunction(GdtfDmxChannelFunction* next);
16491649
GdtfDmxChannelFunction* GetNextFunction() const;

src/XmlFileHelper.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ bool SplitStr(const TXString& str, TXString& part1, TXString& part2, size_t spli
675675
return true;
676676
}
677677

678-
bool SceneData::GdtfConverter::ConvertDMXValue(const TXString& strValue, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue & intValue)
678+
bool SceneData::GdtfConverter::ConvertDMXValue(const TXString& strValue, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue & intValue, bool isVirtual)
679679
/* Converts a string to a DmxValue. returns succes of the opeation as bool (XXX this is always true at the moment.)*/
680680
{
681681
if(strValue.IsEmpty())
@@ -684,6 +684,13 @@ bool SceneData::GdtfConverter::ConvertDMXValue(const TXString& strValue, const I
684684
return true;
685685
}
686686

687+
// If isVirtual is true and channel resolution is 32-bit, convert to work as 16-bit
688+
// This allows old 32-bit virtual channels to be converted to 16-bit
689+
if (isVirtual && chanlReso == 4)
690+
{
691+
chanlReso = (EGdtfChannelBitResolution)2; // Change resolution from 32-bit to 16-bit
692+
}
693+
687694
// Split the String ("ValRaw/byteSpecifier")
688695
TXString firstPart;
689696
TXString secndPart;
@@ -767,7 +774,7 @@ bool SceneData::GdtfConverter::ConvertDMXValue(const TXString& strValue, const I
767774
return true;
768775
}
769776

770-
bool SceneData::GdtfConverter::ConvertDMXValue(const TXString & strValue, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue & intValue, bool & noneValue)
777+
bool SceneData::GdtfConverter::ConvertDMXValue(const TXString & strValue, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue & intValue, bool & noneValue, bool isVirtual)
771778
/* Converts a string to a DmxValue */
772779
{
773780
noneValue = false;
@@ -778,7 +785,7 @@ bool SceneData::GdtfConverter::ConvertDMXValue(const TXString & strValue, const
778785
return true;
779786
}
780787

781-
ConvertDMXValue(strValue, node, chanlReso, intValue);
788+
ConvertDMXValue(strValue, node, chanlReso, intValue, isVirtual);
782789

783790
return true;
784791
}
@@ -2407,7 +2414,7 @@ TXString SceneData::SceneDataZip::GetResourceSubFolder(ERessourceType resType)
24072414

24082415
/*static*/ bool GdtfConverter::ConvertDMXValue_UnitTest(const char* value, EGdtfChannelBitResolution chanlReso, DmxValue& intValue)
24092416
{
2410-
return GdtfConverter::ConvertDMXValue(value,nullptr, chanlReso, intValue);
2417+
return GdtfConverter::ConvertDMXValue(value,nullptr, chanlReso, intValue, false);
24112418
}
24122419

24132420
void GdtfConverter::TraverseNodes(IXMLFileNodePtr root, const TXString& childContainerNodeName, const TXString& childNodeName, TProcessNodeCall processNodeFunction)

src/XmlFileHelper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ namespace SceneData
128128
static bool ConvertInteger( const TXString& value, const IXMLFileNodePtr& node, Sint32& intValue, bool& noneValue);
129129
static bool ConvertIntegerArray( TXString values,const IXMLFileNodePtr& node, TSint32Array& intArray);
130130
static bool ConvertDMXAdress( const TXString& value, const IXMLFileNodePtr& node, DMXAddress& intValue);
131-
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue);
132-
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue, bool& noneValue);
131+
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue, bool isVirtual);
132+
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue, bool& noneValue, bool isVirtual);
133133
static bool ConvertRelationEnum( const TXString& value, const IXMLFileNodePtr& node, EGdtfDmxRelationType& relation);
134134
static bool ConvertSnapEnum( const TXString& value, const IXMLFileNodePtr& node, EGdtfDmxSnap& snap);
135135
static bool ConvertMasterEnum( const TXString& value, const IXMLFileNodePtr& node, EGdtfDmxMaster& master);

unittest/XmlConversionTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void CheckDmxValue(const char* string, DmxValue result, EGdtfChannelBitResolutio
3131
{
3232
#ifndef _WINDOWS
3333
DmxValue value = 0;
34-
ref->checkifTrue("DMX Conversion failed" ,GdtfConverter::ConvertDMXValue(string, nullptr, targetResolution, value) );
34+
ref->checkifTrue("DMX Conversion failed" ,GdtfConverter::ConvertDMXValue(string, nullptr, targetResolution, value, false) );
3535
ref->checkifEqual("DmxValue", value, result);
3636
#endif
3737
};

0 commit comments

Comments
 (0)