void FileDialogProperty::deserialize(XmlDeserializer& s) { Property::deserialize(s); // An empty serialized value does not necessarily mean that it wasn't set, but could also mean that it was the // same path as the document path passed during serialization, which makes the relative path empty. We need an // extra bool to remember if this was the case. try { bool noPathSet; s.deserialize("noPathSet", noPathSet); if(noPathSet) { set(""); return; } } catch (XmlSerializationNoSuchDataException) { s.removeLastError(); } std::string value; s.deserialize("value", value); // convert path relative to the document's path to an absolute one if (!s.getDocumentPath().empty()) value = tgt::FileSystem::absolutePath(tgt::FileSystem::dirName(s.getDocumentPath()) + "/" + value); try { set(value); } catch (Condition::ValidationFailed& e) { s.addError(e); } }
void ColorMapProperty::deserialize(XmlDeserializer& s) { Property::deserialize(s); ColorMap cm = ColorMap::createColdHot(); s.deserialize("colors", cm); try { value_ = cm; } catch (Condition::ValidationFailed& e) { s.addError(e); } }
void OptionPropertyBase::deserialize(XmlDeserializer& s) { Property::deserialize(s); std::string id; s.deserialize("value", id); try { select(id); } catch (Condition::ValidationFailed& /*e*/) { s.addError("Invalid option value: " + id); } }
void NumericProperty<T>::deserialize(XmlDeserializer& s) { Property::deserialize(s); // deserialize value T value; s.deserialize("value", value); try { set(value); } catch (Condition::ValidationFailed& e) { s.addError(e); } // deserialize tracking mode, if available try { s.deserialize("tracking", tracking_); } catch (XmlSerializationNoSuchDataException&) { s.removeLastError(); } }