- add all exported models into "models" group. That way it's possible to
load the export file directly into fgfs via --config option: --config=$HOME/.fgfs/ufo-model-export.xml (An fgfs wrapper could add this option automatically if the file exists. Mine does. :-) - import all /models/model[n] objects into the UFO's model manager, so that they become editable Both features together allow to save an UFO object session and to continue it next time.
This commit is contained in:
parent
063a9d92e0
commit
25e6e4329a
1 changed files with 18 additions and 1 deletions
|
@ -515,6 +515,7 @@ ModelMgr = {
|
|||
m.dynamic = nil;
|
||||
m.static = [];
|
||||
m.block = 0;
|
||||
m.import();
|
||||
return m;
|
||||
},
|
||||
click : func {
|
||||
|
@ -633,6 +634,22 @@ ModelMgr = {
|
|||
me.dynamic = st.make_dynamic();
|
||||
}
|
||||
},
|
||||
import : func {
|
||||
var models = props.globals.getNode("models", 1);
|
||||
var tmp = props.Node.new();
|
||||
props.copy(models, tmp);
|
||||
models.removeChildren("model");
|
||||
foreach (var m; tmp.getChildren("model")) {
|
||||
append(me.static, Static.new(m.getNode("path").getValue(),
|
||||
m.getNode("longitude-deg", 1).getValue(),
|
||||
m.getNode("latitude-deg", 1).getValue(),
|
||||
m.getNode("elevation-ft", 1).getValue(),
|
||||
m.getNode("heading-deg", 1).getValue(),
|
||||
m.getNode("pitch-deg", 1).getValue(),
|
||||
m.getNode("roll-deg", 1).getValue()));
|
||||
}
|
||||
me.select();
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
@ -772,7 +789,7 @@ exportData = func {
|
|||
}
|
||||
var tmp = "save-ufo-data";
|
||||
save = props.globals.getNode(tmp, 1);
|
||||
props.copy(modelmgr.get_data(), save);
|
||||
props.copy(modelmgr.get_data(), save.getNode("models", 1));
|
||||
var path = getprop("/sim/fg-home") ~ "/ufo-model-export.xml";
|
||||
savexml(path, save.getPath());
|
||||
print("model data exported to ", path);
|
||||
|
|
Loading…
Add table
Reference in a new issue