Commit 1e660713 authored by loring's avatar loring

override process old versions to fix backward incompatible

change to transform attributes introduced in r19090.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23810 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4870b29f
......@@ -93,7 +93,6 @@
<Field name="m03" label="m03" type="double">
0.000000
</Field>
<Field name="m10" label="m10" type="double">
0.000000
</Field>
......@@ -106,7 +105,6 @@
<Field name="m13" label="m13" type="double">
0.000000
</Field>
<Field name="m20" label="m20" type="double">
0.000000
</Field>
......@@ -119,7 +117,6 @@
<Field name="m23" label="m23" type="double">
0.000000
</Field>
<Field name="m30" label="m30" type="double">
0.000000
</Field>
......@@ -145,6 +142,8 @@
</Function>
<Function name="CreateCompatible" user="false" member="true">
</Function>
<Function name="ProcessOldVersions" user="true" member="true">
</Function>
<Include file="source" quoted="false">
BoxExtents.h
</Include>
......
......@@ -2132,3 +2132,68 @@ TransformAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: TransformAttributes::ProcessOldVersions
//
// Purpose:
// This method handles some old fields by converting them to new fields.
//
// Programmer: Burlen Loring
// Creation: Fri Jul 18 15:20:59 PDT 2014
//
// Modifications:
//
// ****************************************************************************
void
TransformAttributes::ProcessOldVersions(DataNode *parentNode,
const char *configVersion)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("TransformAttributes");
if(searchNode == 0)
return;
// deal with the changes in r19090 where type for a number of attributes
// was changed from float/floatArray to double/doubleArray.
if(VersionLessThan(configVersion, "2.6.0"))
{
const char *floatArrayAtts[] = {
"rotateOrigin",
"rotateAxis",
"scaleOrigin",
};
for (size_t i=0; i<3; ++i)
{
DataNode *floatArrayAtt = searchNode->GetNode(floatArrayAtts[i]);
if (floatArrayAtt)
{
const float *f = floatArrayAtt->AsFloatArray();
double d[3] = {f[0], f[1], f[2]};
searchNode->RemoveNode(floatArrayAtts[i], true);
searchNode->AddNode(new DataNode(floatArrayAtts[i], d, 3));
}
}
const char *floatAtts[] = {
"rotateAmount",
"scaleX",
"scaleY",
"scaleZ",
"translateX",
"translateY",
"translateZ"
};
for (size_t i=0; i<7; ++i)
{
DataNode *floatAtt = searchNode->GetNode(floatAtts[i]);
if (floatAtt)
{
float f = floatAtt->AsFloat();
searchNode->RemoveNode(floatAtts[i], true);
searchNode->AddNode(new DataNode(floatAtts[i], double(f)));
}
}
}
}
......@@ -92,3 +92,72 @@ TransformAttributes::CreateCompatible(const std::string &tname) const
return retval;
}
Function: ProcessOldVersions
Declaration: virtual void ProcessOldVersions(DataNode *parentNode, const char *configVersion);
Definition:
// ****************************************************************************
// Method: TransformAttributes::ProcessOldVersions
//
// Purpose:
// This method handles some old fields by converting them to new fields.
//
// Programmer: Burlen Loring
// Creation: Fri Jul 18 15:20:59 PDT 2014
//
// Modifications:
//
// ****************************************************************************
void
TransformAttributes::ProcessOldVersions(DataNode *parentNode,
const char *configVersion)
{
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("TransformAttributes");
if(searchNode == 0)
return;
// deal with the changes in r19090 where type for a number of attributes
// was changed from float/floatArray to double/doubleArray.
if(VersionLessThan(configVersion, "2.6.0"))
{
const char *floatArrayAtts[] = {
"rotateOrigin",
"rotateAxis",
"scaleOrigin",
};
for (size_t i=0; i<3; ++i)
{
DataNode *floatArrayAtt = searchNode->GetNode(floatArrayAtts[i]);
if (floatArrayAtt)
{
const float *f = floatArrayAtt->AsFloatArray();
double d[3] = {f[0], f[1], f[2]};
searchNode->RemoveNode(floatArrayAtts[i], true);
searchNode->AddNode(new DataNode(floatArrayAtts[i], d, 3));
}
}
const char *floatAtts[] = {
"rotateAmount",
"scaleX",
"scaleY",
"scaleZ",
"translateX",
"translateY",
"translateZ"
};
for (size_t i=0; i<7; ++i)
{
DataNode *floatAtt = searchNode->GetNode(floatAtts[i]);
if (floatAtt)
{
float f = floatAtt->AsFloat();
searchNode->RemoveNode(floatAtts[i], true);
searchNode->AddNode(new DataNode(floatAtts[i], double(f)));
}
}
}
}
......@@ -227,6 +227,8 @@ public:
virtual std::string GetFieldTypeName(int index) const;
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
// User-defined methods
virtual void ProcessOldVersions(DataNode *parentNode, const char *configVersion);
// IDs that can be used to identify fields in case statements
enum {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment