UFO ‘d’ key writes to clipboard as well stdout.
This makes the console less necessary for scenery development, at least this is the goal.
This commit is contained in:
parent
3201c14768
commit
70711d9c37
2 changed files with 52 additions and 46 deletions
|
@ -5,20 +5,20 @@
|
||||||
<description>UFO from the 'White Project' of the UNESCO</description>
|
<description>UFO from the 'White Project' of the UNESCO</description>
|
||||||
<author>ET</author>
|
<author>ET</author>
|
||||||
|
|
||||||
<long-description>With the UFO you can place 3D objects in the FlightGear scenery,
|
<long-description>With the UFO you can place 3D objects in the FlightGear scenery,
|
||||||
and inspect the scenery without worrying about crashing.</long-description>
|
and inspect the scenery without worrying about crashing.</long-description>
|
||||||
<fr>
|
<fr>
|
||||||
<long-description>Avec l'UFO (OVNI) vous pouvez placer des objets 3D dans les scènes de FlightGear scenery</long-description>
|
<long-description>Avec l'UFO (OVNI) vous pouvez placer des objets 3D dans les scènes de FlightGear scenery</long-description>
|
||||||
</fr>
|
</fr>
|
||||||
<de>
|
<de>
|
||||||
<long-description>Mit dem UFO kann man 3D Objekte in der FlightGear Szenerie platzieren</long-description>
|
<long-description>Mit dem UFO kann man 3D Objekte in der FlightGear Szenerie platzieren</long-description>
|
||||||
</de>
|
</de>
|
||||||
|
|
||||||
<tags>
|
<tags>
|
||||||
<tag>fictional</tag>
|
<tag>fictional</tag>
|
||||||
<tag>spaceship</tag>
|
<tag>spaceship</tag>
|
||||||
</tags>
|
</tags>
|
||||||
|
|
||||||
<flight-model>ufo</flight-model>
|
<flight-model>ufo</flight-model>
|
||||||
|
|
||||||
<sound>
|
<sound>
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
</key>
|
</key>
|
||||||
<key>
|
<key>
|
||||||
<name>d</name>
|
<name>d</name>
|
||||||
<desc>dump object data to terminal</desc>
|
<desc>dump object</desc>
|
||||||
</key>
|
</key>
|
||||||
<key>
|
<key>
|
||||||
<name>e</name>
|
<name>e</name>
|
||||||
|
@ -500,8 +500,8 @@
|
||||||
</binding>
|
</binding>
|
||||||
</mod-up>
|
</mod-up>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
|
||||||
<key n="44">
|
<key n="44">
|
||||||
<name>,</name>
|
<name>,</name>
|
||||||
<desc>skew left</desc>
|
<desc>skew left</desc>
|
||||||
|
@ -532,8 +532,8 @@
|
||||||
</binding>
|
</binding>
|
||||||
</mod-up>
|
</mod-up>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<key n="363">
|
<key n="363">
|
||||||
<name>End</name>
|
<name>End</name>
|
||||||
|
|
|
@ -435,15 +435,15 @@ var modelmgr = {
|
||||||
me.mouse_coord = mouse_coord;
|
me.mouse_coord = mouse_coord;
|
||||||
status_dialog.open();
|
status_dialog.open();
|
||||||
adjust_dialog.center_sliders();
|
adjust_dialog.center_sliders();
|
||||||
|
|
||||||
if (KbdAlt.getValue() and KbdCtrl.getValue()) { # Provide information on the selected point
|
if (KbdAlt.getValue() and KbdCtrl.getValue()) { # Provide information on the selected point
|
||||||
var geod = geodinfo(me.mouse_coord.lat(), me.mouse_coord.lon());
|
var geod = geodinfo(me.mouse_coord.lat(), me.mouse_coord.lon());
|
||||||
var landclass = string.join(" ", geod[1].names);
|
var landclass = string.join(" ", geod[1].names);
|
||||||
var str = sprintf("lat:%.4f lon:%.4f alt:%.0fm class(es): %s",
|
var str = sprintf("lat:%.4f lon:%.4f alt:%.0fm class(es): %s",
|
||||||
me.mouse_coord.lat(), me.mouse_coord.lon(),
|
me.mouse_coord.lat(), me.mouse_coord.lon(),
|
||||||
me.mouse_coord.alt(), landclass);
|
me.mouse_coord.alt(), landclass);
|
||||||
gui.popupTip(str, 3);
|
gui.popupTip(str, 3);
|
||||||
print(str);
|
print(str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,8 +694,8 @@ var scan_dirs = func(csv) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var print_ufo_data = func {
|
var collect_ufo_data = func {
|
||||||
print("\n\n------------------------------ UFO -------------------------------\n");
|
var s = "\n\n------------------------------ UFO -------------------------------\n";
|
||||||
|
|
||||||
var lat = getprop("/position/latitude-deg");
|
var lat = getprop("/position/latitude-deg");
|
||||||
var lon = getprop("/position/longitude-deg");
|
var lon = getprop("/position/longitude-deg");
|
||||||
|
@ -704,34 +704,36 @@ var print_ufo_data = func {
|
||||||
var heading = getprop("/orientation/heading-deg");
|
var heading = getprop("/orientation/heading-deg");
|
||||||
var agl_ft = alt_ft - elev_m * M2FT;
|
var agl_ft = alt_ft - elev_m * M2FT;
|
||||||
|
|
||||||
printf("Latitude: %.8f deg", lat);
|
s ~= sprintf("Latitude: %.8f deg\n", lat);
|
||||||
printf("Longitude: %.8f deg", lon);
|
s ~= sprintf("Longitude: %.8f deg\n", lon);
|
||||||
printf("Altitude ASL: %.4f m (%.4f ft)", alt_ft * FT2M, alt_ft);
|
s ~= sprintf("Altitude ASL: %.4f m (%.4f ft)\n", alt_ft * FT2M, alt_ft);
|
||||||
printf("Altitude AGL: %.4f m (%.4f ft)", agl_ft * FT2M, agl_ft);
|
s ~= printf("Altitude AGL: %.4f m (%.4f ft)\n", agl_ft * FT2M, agl_ft);
|
||||||
printf("Heading: %.1f deg", normdeg(heading));
|
s ~= sprintf("Heading: %.1f deg\n", normdeg(heading));
|
||||||
printf("Ground Elev: %.4f m (%.4f ft)", elev_m, elev_m * M2FT);
|
s ~= sprintf("Ground Elev: %.4f m (%.4f ft)\n", elev_m, elev_m * M2FT);
|
||||||
print();
|
s ~= "\n";
|
||||||
print("# " ~ geo.tile_path(lat, lon));
|
s ~= "# " ~ geo.tile_path(lat, lon) ~ "\n";
|
||||||
printf("OBJECT_STATIC %.8f %.8f %.4f %.1f", lon, lat, elev_m, normdeg(360 - heading));
|
s ~= sprintf("OBJECT_STATIC %.8f %.8f %.4f %.1f\n", lon, lat, elev_m, normdeg(360 - heading));
|
||||||
print();
|
s ~= "\n";
|
||||||
|
|
||||||
var hdg = normdeg(heading + getprop("/sim/current-view/goal-pitch-offset-deg"));
|
var hdg = normdeg(heading + getprop("/sim/current-view/goal-pitch-offset-deg"));
|
||||||
printf("http://maps.google.com/maps?ll=%.10f,%.10f&z=12&t=h\n", lat, lon);
|
s ~= sprintf("http://maps.google.com/maps?ll=%.10f,%.10f&z=12&t=h\n", lat, lon);
|
||||||
printf("$ fgfs --aircraft=ufo --lat=%.6f --lon=%.6f --altitude=%.2f --heading=%.1f\n",
|
s ~= sprintf("$ fgfs --aircraft=ufo --lat=%.6f --lon=%.6f --altitude=%.2f --heading=%.1f\n",
|
||||||
lat, lon, alt_ft, hdg);
|
lat, lon, alt_ft, hdg);
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var print_model_data = func(prop) {
|
var collect_model_data = func(prop) {
|
||||||
print("\n\n------------------------ Selected Object -------------------------\n");
|
var s = "\n\n------------------------ Selected Object -------------------------\n";
|
||||||
var elev = prop.getNode("elevation-ft").getValue();
|
var elev = prop.getNode("elevation-ft").getValue();
|
||||||
printf("Path: %s", prop.getNode("path").getValue());
|
s ~= sprintf("Path: %s\n", prop.getNode("path").getValue());
|
||||||
printf("Latitude: %.8f deg", prop.getNode("latitude-deg").getValue());
|
s ~= sprintf("Latitude: %.8f deg\n", prop.getNode("latitude-deg").getValue());
|
||||||
printf("Longitude: %.8f deg", prop.getNode("longitude-deg").getValue());
|
s ~= sprintf("Longitude: %.8f deg\n", prop.getNode("longitude-deg").getValue());
|
||||||
printf("Altitude ASL: %.4f m (%.4f ft)", elev * FT2M, elev);
|
s ~= sprintf("Altitude ASL: %.4f m (%.4f ft)\n", elev * FT2M, elev);
|
||||||
printf("Heading: %.1f deg", prop.getNode("heading-deg").getValue());
|
s ~= sprintf("Heading: %.1f deg\n", prop.getNode("heading-deg").getValue());
|
||||||
printf("Pitch: %.1f deg", prop.getNode("pitch-deg").getValue());
|
s ~= sprintf("Pitch: %.1f deg\n", prop.getNode("pitch-deg").getValue());
|
||||||
printf("Roll: -%.1f deg", prop.getNode("roll-deg").getValue());
|
s ~= sprintf("Roll: -%.1f deg\n", prop.getNode("roll-deg").getValue());
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -784,16 +786,16 @@ var leftright = func(dir) {
|
||||||
var print_data = func {
|
var print_data = func {
|
||||||
var rule = "\n------------------------------------------------------------------\n";
|
var rule = "\n------------------------------------------------------------------\n";
|
||||||
print("\n\n");
|
print("\n\n");
|
||||||
print_ufo_data();
|
|
||||||
|
var s = collect_ufo_data();
|
||||||
|
|
||||||
var data = modelmgr.get_data();
|
var data = modelmgr.get_data();
|
||||||
|
|
||||||
var selected = data.getChild("model", 0);
|
var selected = data.getChild("model", 0);
|
||||||
if (selected == nil)
|
if (selected != nil) {
|
||||||
return print(rule);
|
s ~= collect_model_data(selected);
|
||||||
|
s ~= rule;
|
||||||
print_model_data(selected);
|
}
|
||||||
print(rule);
|
|
||||||
|
|
||||||
# group all objects of a bucket
|
# group all objects of a bucket
|
||||||
var bucket = {};
|
var bucket = {};
|
||||||
|
@ -806,10 +808,16 @@ var print_data = func {
|
||||||
bucket[stg] = [obj];
|
bucket[stg] = [obj];
|
||||||
}
|
}
|
||||||
foreach (var key; keys(bucket)) {
|
foreach (var key; keys(bucket)) {
|
||||||
print("\n# ", key);
|
s ~= sprintf("\n# \n", key);
|
||||||
foreach (var obj; bucket[key])
|
foreach (var obj; bucket[key])
|
||||||
print(obj);
|
s ~= obj ~ "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print(s); # send completed info to the console
|
||||||
|
clipboard.setText(s); # and also the clipboard
|
||||||
|
|
||||||
|
gui.popupTip("UFO wrote model data to the console and the clipboard");
|
||||||
|
|
||||||
print(rule);
|
print(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,5 +892,3 @@ setlistener("/sim/signals/click", func {
|
||||||
if (!mouse.mmb)
|
if (!mouse.mmb)
|
||||||
modelmgr.click(geo.click_position());
|
modelmgr.click(geo.click_position());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue