提交 7a678ac6 编写于 作者: R Rémi Arnaud

Merge pull request #408 from fl4re/fix/asset

Fixed COLLADASW::Asset
......@@ -297,9 +297,41 @@ namespace COLLADAMaya
}
//---------------------------------------------------------------
class MayaAsset : public COLLADASW::Asset
{
public:
MayaAsset(COLLADASW::StreamWriter* sw)
: COLLADASW::Asset(sw)
{}
protected:
virtual void addExtra() override
{
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_EXTRA);
{
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_TECHNIQUE);
mSW->appendAttribute(COLLADASW::CSWC::CSW_ATTRIBUTE_PROFILE, COLLADAMaya::PROFILE_MAYA);
{
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_PLUGIN_VERSION);
mSW->appendValues(COLLADAMaya::CURRENT_REVISION);
mSW->closeElement();
if (COLLADAMaya::CURRENT_SHA1.compare("undefined") != 0)
{
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_SHA1);
mSW->appendValues(COLLADAMaya::CURRENT_SHA1);
mSW->closeElement();
}
}
mSW->closeElement();
}
mSW->closeElement();
}
};
void DocumentExporter::exportAsset()
{
COLLADASW::Asset asset ( &mStreamWriter );
MayaAsset asset ( &mStreamWriter );
// Add contributor information
// Set the author
......@@ -389,10 +421,7 @@ namespace COLLADAMaya
asset.setUnit ( linearUnitName, colladaConversionFactor );
// Asset heraus schreiben
asset.openAsset();
asset.add();
asset.addVersionNumber(COLLADAMaya::CURRENT_REVISION, COLLADAMaya::CURRENT_SHA1, COLLADAMaya::PROFILE_MAYA);
asset.closeAsset();
}
//---------------------------------------------------------------
......
......@@ -93,8 +93,6 @@ namespace COLLADASW
to the right, and which is considered inward. */
UpAxisType mUpAxisType;
TagCloser assetCloser;
public:
/** Constructor that sets the stream the asset should be written to*/
Asset ( StreamWriter * streamWriter );
......@@ -102,15 +100,6 @@ namespace COLLADASW
/** Adds the asset to the stream, i.e. performes the actual writing*/
void add();
/** Writes the opening @a \<asset\> tag */
void openAsset();
/** Closes the tag opened by openAsset()*/
void closeAsset();
/** add versionNumber/ Build Version from jenkins into extra attribute pluginVersion*/
void addVersionNumber(const String& versionNumber, const String& sha1, const String& extraAttributeProfile);
/** Returns a reference to the contributor of th asset*/
Contributor& getContributor()
{
......@@ -208,7 +197,8 @@ namespace COLLADASW
return mUpAxisType;
}
protected:
virtual void addExtra() {}
};
} //namespace COLLADASW
......
......@@ -24,39 +24,11 @@ namespace COLLADASW
mUpAxisType ( NONE )
{}
void Asset::closeAsset()
{
assetCloser.close();
}
void Asset::openAsset()
{
assetCloser = mSW->openElement(CSWC::CSW_ELEMENT_ASSET);
}
void Asset::addVersionNumber(const String& versionNumber, const String& sha1, const String& extraAttributeProfile)
{
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_EXTRA);
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_TECHNIQUE);
mSW->appendAttribute(COLLADASW::CSWC::CSW_ATTRIBUTE_PROFILE, extraAttributeProfile);
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_PLUGIN_VERSION);
mSW->appendValues(versionNumber);
mSW->closeElement();
if (sha1.compare("undefined") != 0)
{
mSW->openElement(COLLADASW::CSWC::CSW_ELEMENT_SHA1);
mSW->appendValues(sha1);
mSW->closeElement();
}
mSW->closeElement();
mSW->closeElement();
}
//---------------------------------------------------------------
void Asset::add()
{
TagCloser asset = mSW->openElement(CSWC::CSW_ELEMENT_ASSET);
// add contributor only if at least one attribute is not empty
if ( !mContributor.mAuthor.empty() ||
......@@ -147,6 +119,10 @@ namespace COLLADASW
default:
mSW->appendTextElement ( CSWC::CSW_ELEMENT_UP_AXIS, CSWC::CSW_TEXT_Z_UP );
}
addExtra();
asset.close();
}
} //namespace COLLADASW
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册