Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5,282 changes: 5,282 additions & 0 deletions Virtual-res-issue-test-file.xml

Large diffs are not rendered by default.

48 changes: 26 additions & 22 deletions src/GDTFManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5406,15 +5406,15 @@ void GdtfDmxChannel::OnReadFromNode(const IXMLFileNodePtr& pNode)
TXString defVal;
if (pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDefault, defVal) == kVCOMError_NoError)
{
GdtfConverter::ConvertDMXValue(defVal, pNode, this->GetChannelBitResolution(), fDefaultValue_old);
GdtfConverter::ConvertDMXValue(defVal, pNode, this->GetChannelBitResolution(), fDefaultValue_old, this->IsVirtual());
}
// ------------------------------------------------------------------------------------

//
TXString highlight;
if(VCOM_SUCCEEDED(pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelHighlight, highlight) ))
{
GdtfConverter::ConvertDMXValue(highlight, pNode, this->GetChannelBitResolution(), fHeighlight, fHeighlightNone);
GdtfConverter::ConvertDMXValue(highlight, pNode, this->GetChannelBitResolution(), fHeighlight, fHeighlightNone, this->IsVirtual());
}

pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelGeometry, fUnresolvedGeomRef);
Expand Down Expand Up @@ -5589,16 +5589,12 @@ const TGdtfDmxLogicalChannelArray GdtfDmxChannel::GetLogicalChannelArray()

EGdtfChannelBitResolution SceneData::GdtfDmxChannel::GetChannelBitResolution()
{
// 0 is false, everything else is true
if ((!fCoarse) && !fFine && !fUltra && !fUber) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_32; }
else if (( fCoarse) && !fFine && !fUltra && !fUber) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_8; }
else if (( fCoarse) &&( fFine) && !fUltra && !fUber ) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_16; }
else if (( fCoarse) &&( fFine) && ( fUltra) && !fUber ) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_24; }
else if (( fCoarse) &&( fFine) && ( fUltra) && ( fUber)) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_32; }

// Other states are invalid. This line should never be reached.
DSTOP((kEveryone, "Invalid state in GetChannelBitResolution()"));
return EGdtfChannelBitResolution::eGdtfChannelBitResolution_8;
if (!fCoarse) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_16; }
else if (!fFine) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_8; }
else if (!fUltra) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_16; }
else if (!fUber ) { return EGdtfChannelBitResolution::eGdtfChannelBitResolution_24; }

return EGdtfChannelBitResolution::eGdtfChannelBitResolution_32;
}

DmxValue SceneData::GdtfDmxChannel::GetChannelMaxDmx()
Expand Down Expand Up @@ -6118,11 +6114,14 @@ void GdtfDmxChannelFunction::OnReadFromNode(const IXMLFileNodePtr& pNode)
// ------------------------------------------------------------------------------------
// Print node attributes
EGdtfChannelBitResolution channelReso = fParentLogicalChannel->GetParentDMXChannel()->GetChannelBitResolution();
bool isVirtual = fParentLogicalChannel->GetParentDMXChannel()->IsVirtual();

pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionName, fName);
pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionOriginalAttribute, fOrignalAttribute);
TXString defaultValue; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDefault, defaultValue); GdtfConverter::ConvertDMXValue(defaultValue, pNode, channelReso,fDefaultValue);
TXString dmxFrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDMXFrom, dmxFrom); GdtfConverter::ConvertDMXValue(dmxFrom, pNode, channelReso,fAdressStart);
bool noneValue_defaultValue = false;
TXString defaultValue; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDefault, defaultValue); GdtfConverter::ConvertDMXValue(defaultValue, pNode, channelReso,fDefaultValue, noneValue_defaultValue, isVirtual);
bool noneValue_dmxFrom = false;
TXString dmxFrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionDMXFrom, dmxFrom); GdtfConverter::ConvertDMXValue(dmxFrom, pNode, channelReso,fAdressStart, noneValue_dmxFrom, isVirtual);
TXString physFrom; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionPhysicalFrom, physFrom); GdtfConverter::ConvertDouble(physFrom, pNode, fPhysicalStart);
TXString physTo; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionPhysicalTo, physTo); GdtfConverter::ConvertDouble(physTo, pNode, fPhysicalEnd);
TXString realFade; pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelFuntionRealFade, realFade); GdtfConverter::ConvertDouble(realFade, pNode, fRealFade);
Expand Down Expand Up @@ -6419,13 +6418,13 @@ DmxValue GdtfDmxChannelFunction::GetModeMasterDmxEnd() const
return fDmxModeEnd;
}

void GdtfDmxChannelFunction::ResolveModeMasterDmx(EGdtfChannelBitResolution resolution)
void GdtfDmxChannelFunction::ResolveModeMasterDmx(EGdtfChannelBitResolution resolution, bool isVirtual)
{
IXMLFileNodePtr node;
this->GetNode(node);

GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeStart, node, resolution, fDmxModeStart);
GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeEnd,node, resolution, fDmxModeEnd);
GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeStart, node, resolution, fDmxModeStart, isVirtual);
GdtfConverter::ConvertDMXValue(fUnresolvedDmxModeEnd,node, resolution, fDmxModeEnd, isVirtual);
}

void GdtfDmxChannelFunction::SetModeMaster_Channel(GdtfDmxChannel* channel)
Expand Down Expand Up @@ -6664,8 +6663,10 @@ void GdtfDmxChannelSet::OnReadFromNode(const IXMLFileNodePtr& pNode)
pNode->GetNodeAttributeValue(XML_GDTF_DMXChannelSetName, fUniqueName);

EGdtfChannelBitResolution channelReso = fParentChnlFunction->GetParentDMXChannel()->GetChannelBitResolution();
bool isVirtual = fParentChnlFunction->GetParentDMXChannel()->IsVirtual();
bool noneValue = false;

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


Expand Down Expand Up @@ -8387,7 +8388,7 @@ void GdtfFixture::ResolveMacroRefs(GdtfDmxModePtr dmxMode)
{

DmxValue dmxVal = 0;
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, value->GetDMXChannel()->GetChannelBitResolution(), dmxVal);
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, value->GetDMXChannel()->GetChannelBitResolution(), dmxVal, false);
value->SetValue(dmxVal);
}
else
Expand Down Expand Up @@ -8424,7 +8425,7 @@ void GdtfFixture::ResolveMacroRefs(GdtfDmxModePtr dmxMode)
value->GetNode(node);

DmxValue dmxVal = 0;
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, channelFunction->GetParentDMXChannel()->GetChannelBitResolution(), dmxVal);
GdtfConverter::ConvertDMXValue(value->GetUnresolvedDMXValue(), node, channelFunction->GetParentDMXChannel()->GetChannelBitResolution(), dmxVal, false);
value->SetDmxValue(dmxVal);
}
}
Expand Down Expand Up @@ -8504,13 +8505,15 @@ void GdtfFixture::ResolveDMXModeMasters()
{
bool resolved = false;
EGdtfChannelBitResolution resolution = EGdtfChannelBitResolution::eGdtfChannelBitResolution_8;
bool isVirtual = false;

GdtfDmxChannelPtr channelPtr = getDmxChannelByRef(unresolvedModeMaster, mode);
if(! resolved && channelPtr)
{
function->SetModeMaster_Channel(channelPtr);
resolved = true;
resolution = channelPtr->GetChannelBitResolution();
resolution = channelPtr->GetChannelBitResolution();
isVirtual = channelPtr->IsVirtual();
}

GdtfDmxChannelFunctionPtr functionPtr = getDmxFunctionByRef(unresolvedModeMaster, mode);
Expand All @@ -8519,10 +8522,11 @@ void GdtfFixture::ResolveDMXModeMasters()
function->SetModeMaster_Function(functionPtr);
resolved = true;
resolution = functionPtr->GetParentDMXChannel()->GetChannelBitResolution();
isVirtual = functionPtr->GetParentDMXChannel()->IsVirtual();
}

ASSERTN(kEveryone, resolved);
if(resolved) { function->ResolveModeMasterDmx(resolution); }
if(resolved) { function->ResolveModeMasterDmx(resolution, isVirtual); }
else
{
IXMLFileNodePtr node;
Expand Down
2 changes: 1 addition & 1 deletion src/GDTFManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ namespace SceneData

GdtfDmxChannel* GetParentDMXChannel() const;
GdtfDmxLogicalChannel* GetParentLogicalChannel() const;
void ResolveModeMasterDmx(EGdtfChannelBitResolution resolution);
void ResolveModeMasterDmx(EGdtfChannelBitResolution resolution, bool isVirtual);

void SetNextFunction(GdtfDmxChannelFunction* next);
GdtfDmxChannelFunction* GetNextFunction() const;
Expand Down
15 changes: 11 additions & 4 deletions src/XmlFileHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ bool SplitStr(const TXString& str, TXString& part1, TXString& part2, size_t spli
return true;
}

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

// If isVirtual is true and channel resolution is 32-bit, convert to work as 16-bit
// This allows old 32-bit virtual channels to be converted to 16-bit
if (isVirtual && chanlReso == 4)
{
chanlReso = (EGdtfChannelBitResolution)2; // Change resolution from 32-bit to 16-bit
}

// Split the String ("ValRaw/byteSpecifier")
TXString firstPart;
TXString secndPart;
Expand Down Expand Up @@ -767,7 +774,7 @@ bool SceneData::GdtfConverter::ConvertDMXValue(const TXString& strValue, const I
return true;
}

bool SceneData::GdtfConverter::ConvertDMXValue(const TXString & strValue, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue & intValue, bool & noneValue)
bool SceneData::GdtfConverter::ConvertDMXValue(const TXString & strValue, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue & intValue, bool & noneValue, bool isVirtual)
/* Converts a string to a DmxValue */
{
noneValue = false;
Expand All @@ -778,7 +785,7 @@ bool SceneData::GdtfConverter::ConvertDMXValue(const TXString & strValue, const
return true;
}

ConvertDMXValue(strValue, node, chanlReso, intValue);
ConvertDMXValue(strValue, node, chanlReso, intValue, isVirtual);

return true;
}
Expand Down Expand Up @@ -2407,7 +2414,7 @@ TXString SceneData::SceneDataZip::GetResourceSubFolder(ERessourceType resType)

/*static*/ bool GdtfConverter::ConvertDMXValue_UnitTest(const char* value, EGdtfChannelBitResolution chanlReso, DmxValue& intValue)
{
return GdtfConverter::ConvertDMXValue(value,nullptr, chanlReso, intValue);
return GdtfConverter::ConvertDMXValue(value,nullptr, chanlReso, intValue, false);
}

void GdtfConverter::TraverseNodes(IXMLFileNodePtr root, const TXString& childContainerNodeName, const TXString& childNodeName, TProcessNodeCall processNodeFunction)
Expand Down
4 changes: 2 additions & 2 deletions src/XmlFileHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ namespace SceneData
static bool ConvertInteger( const TXString& value, const IXMLFileNodePtr& node, Sint32& intValue, bool& noneValue);
static bool ConvertIntegerArray( TXString values,const IXMLFileNodePtr& node, TSint32Array& intArray);
static bool ConvertDMXAdress( const TXString& value, const IXMLFileNodePtr& node, DMXAddress& intValue);
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue);
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue, bool& noneValue);
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue, bool isVirtual);
static bool ConvertDMXValue( const TXString& value, const IXMLFileNodePtr& node, EGdtfChannelBitResolution chanlReso, DmxValue& intValue, bool& noneValue, bool isVirtual);
static bool ConvertRelationEnum( const TXString& value, const IXMLFileNodePtr& node, EGdtfDmxRelationType& relation);
static bool ConvertSnapEnum( const TXString& value, const IXMLFileNodePtr& node, EGdtfDmxSnap& snap);
static bool ConvertMasterEnum( const TXString& value, const IXMLFileNodePtr& node, EGdtfDmxMaster& master);
Expand Down
2 changes: 1 addition & 1 deletion unittest/XmlConversionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void CheckDmxValue(const char* string, DmxValue result, EGdtfChannelBitResolutio
{
#ifndef _WINDOWS
DmxValue value = 0;
ref->checkifTrue("DMX Conversion failed" ,GdtfConverter::ConvertDMXValue(string, nullptr, targetResolution, value) );
ref->checkifTrue("DMX Conversion failed" ,GdtfConverter::ConvertDMXValue(string, nullptr, targetResolution, value, false) );
ref->checkifEqual("DmxValue", value, result);
#endif
};
Expand Down
Loading