- SGPropertyNode * out_child = out->getChild(in_child->getName(),
- in_child->getIndex(),
- true);
- if (!copyProperties(in_child, out_child))
- retval = false;
+ int mask = attr_mask;
+ /* attributes have no meaning for nodes without values - except
+ * the PRESERVE flag. So ignore them. */
+ if (!in_child->hasValue())
+ mask &= SGPropertyNode::PRESERVE;
+ if ((in_child->getAttributes() & mask) == (attr_value & mask))
+ {
+ SGPropertyNode * out_child = out->getChild(in_child->getNameString(),
+ in_child->getIndex(),
+ false);
+ if (!out_child)
+ {
+ out_child = out->getChild(in_child->getNameString(),
+ in_child->getIndex(),
+ true);
+ }
+ else
+ {
+ mask = attr_mask;
+ if (!out_child->hasValue())
+ mask &= SGPropertyNode::PRESERVE;
+ if ((out_child->getAttributes() & mask) != (attr_value & mask))
+ out_child = NULL;
+ }
+ if (out_child &&
+ (!copyProperties(in_child, out_child, attr_value, attr_mask)))
+ retval = false;
+ }