I’m trying to convert the .dsa as kindly provided by Rob, but I’ve some troubles.
The .dsa getGroupProperties is this:
function getGroupProperties( oGroup, bTraverse, bRecurse )
{
// Declare an array to hold properties
var aProperties = [];
// If a group isn’t passed in
if( !oGroup ){
// We’re done, return an empty array
return aProperties;
// If a group is passed in
} else {
// Get the number of proeprties in the group
var nProperties = oGroup.getNumProperties();
// Pre-size the properties array
aProperties = new Array( nProperties );
// Iterate over the properties, setting each element in the array
for( var i = 0; i < nProperties; i += 1 ){
aProperties[ i ] = oGroup.getProperty( i );
}
// If we are recursing
if( bRecurse ){
// Concatenate the properties array from child groups
aProperties = aProperties.concat( getGroupProperties( oGroup.getFirstChild(), bTraverse, bRecurse ) );
}
// If we are traversing
if( bTraverse ){
// Concatenate the properties array from sibling groups
aProperties = aProperties.concat( getGroupProperties( oGroup.getNextSibling(), bTraverse, bRecurse ) );
}
}
// Return the array of properties
return aProperties;
}
I tried to convert it into a SDK function and used the DzTArray to return group properties. However, I get errors in the highlighted lines (concat and GetFirstChild do not exist in SDK). Any chance to get some help? Thanks.
DzTArray<DzProperty> getGroupProperties( DzNode *oGroup, bool bTraverse, bool bRecurse )
{
// Declare an array to hold properties
DzTArray<DzProperty> aProperties;
// If a group isn’t passed in
if( !oGroup ){
// We’re done, return an empty array
return aProperties;
// If a group is passed in
} else {
// Get the number of proeprties in the group
int nProperties = oGroup->getNumProperties();
// Pre-size the properties array
aProperties = DzTArray<DzProperty> (nProperties) ;
// Iterate over the properties, setting each element in the array
for( int i = 0; i < nProperties; i += 1 ){
aProperties = *oGroup->getProperty(i);
}
// If we are recursing
if( bRecurse ){
// Concatenate the properties array from child groups
aProperties = aProperties.concat( getGroupProperties( oGroup->getFirstChild(), bTraverse, bRecurse ) );
}
// If we are traversing
if( bTraverse ){
// Concatenate the properties array from sibling groups
aProperties = aProperties->concat( getGroupProperties( oGroup->getNextSibling(), bTraverse, bRecurse ) );
}
}
// Return the array of properties
return aProperties;
}
I could use a <DzTArray>.append to concatenate values into the array, and getFirstChild() may be replaced by getNodeChild(0) ?
But I’m not sure the approach I used is the correct one…