Fixes to 3.0 exporter: fix rotations, remap animation tracks
Also fixed some spacing issues to better match to .tscn format as written by Godot 3.0.
This commit is contained in:
parent
fb8cee9af9
commit
13d1df2e4b
|
@ -234,7 +234,7 @@ static const char *prop_renames[][2] = {
|
||||||
{ "shadow/filter", "shadow_filter" },
|
{ "shadow/filter", "shadow_filter" },
|
||||||
{ "shadow/item_cull_mask", "shadow_item_cull_mask" },
|
{ "shadow/item_cull_mask", "shadow_item_cull_mask" },
|
||||||
{ "transform/pos", "position" },
|
{ "transform/pos", "position" },
|
||||||
{ "transform/rot", "rotation" },
|
{ "transform/rot", "rotation_deg" },
|
||||||
{ "transform/scale", "scale" },
|
{ "transform/scale", "scale" },
|
||||||
{ "z/z", "z" },
|
{ "z/z", "z" },
|
||||||
{ "z/relative", "z_as_relative" },
|
{ "z/relative", "z_as_relative" },
|
||||||
|
@ -319,8 +319,8 @@ static const char *prop_renames[][2] = {
|
||||||
{ "quad/offset", "offset" },
|
{ "quad/offset", "offset" },
|
||||||
{ "quad/centered", "centered" },
|
{ "quad/centered", "centered" },
|
||||||
{ "transform/local", "transform" },
|
{ "transform/local", "transform" },
|
||||||
{ "transform/transiation", "translation" },
|
{ "transform/translation", "translation" },
|
||||||
{ "transform/rotation", "rotation" },
|
{ "transform/rotation", "rotation_deg" },
|
||||||
{ "transform/scale", "scale" },
|
{ "transform/scale", "scale" },
|
||||||
{ "visibility/visible", "visible" },
|
{ "visibility/visible", "visible" },
|
||||||
{ "params/volume_db", "volume_db" },
|
{ "params/volume_db", "volume_db" },
|
||||||
|
@ -532,6 +532,14 @@ void EditorExportGodot3::_rename_properties(const String &p_type, List<ExportDat
|
||||||
if (prop_rename_map.has(E->get().name)) {
|
if (prop_rename_map.has(E->get().name)) {
|
||||||
E->get().name = prop_rename_map[E->get().name];
|
E->get().name = prop_rename_map[E->get().name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hardcoded fixups for properties that changed definition in 3.0 */
|
||||||
|
|
||||||
|
// 2D rotations are now clockwise to match the downward Y base
|
||||||
|
// TODO: Make sure this doesn't break 3D rotations
|
||||||
|
if (E->get().name == "rotation_deg") {
|
||||||
|
E->get().value = E->get().value.operator real_t() * -1.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,6 +1017,16 @@ Error EditorExportGodot3::_get_property_as_text(const Variant &p_variant, String
|
||||||
case Variant::NODE_PATH: {
|
case Variant::NODE_PATH: {
|
||||||
|
|
||||||
String str = p_variant;
|
String str = p_variant;
|
||||||
|
// In animation tracks, NodePaths can refer to properties that need to be renamed
|
||||||
|
int sep = str.find(":");
|
||||||
|
if (sep != -1) {
|
||||||
|
String path = str.substr(0, sep);
|
||||||
|
String prop = str.substr(sep + 1, str.length());
|
||||||
|
if (prop_rename_map.has(prop)) {
|
||||||
|
prop = prop_rename_map[prop];
|
||||||
|
}
|
||||||
|
str = path + ":" + prop;
|
||||||
|
}
|
||||||
|
|
||||||
str = "NodePath(\"" + str.c_escape() + "\")";
|
str = "NodePath(\"" + str.c_escape() + "\")";
|
||||||
p_string += (str);
|
p_string += (str);
|
||||||
|
@ -1254,7 +1272,7 @@ void EditorExportGodot3::_save_text(const String &p_path, ExportData &resource)
|
||||||
|
|
||||||
for (Map<int, ExportData::Dependency>::Element *E = resource.dependencies.front(); E; E = E->next()) {
|
for (Map<int, ExportData::Dependency>::Element *E = resource.dependencies.front(); E; E = E->next()) {
|
||||||
|
|
||||||
f->store_line("[ext_resource type=\"" + E->get().type + "\" path=\"" + E->get().path + "\" id=" + itos(E->key()) + "]\n");
|
f->store_line("[ext_resource path=\"" + E->get().path + "\" type=\"" + E->get().type + "\" id=" + itos(E->key()) + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < resource.resources.size(); i++) {
|
for (int i = 0; i < resource.resources.size(); i++) {
|
||||||
|
@ -1282,10 +1300,6 @@ void EditorExportGodot3::_save_text(const String &p_path, ExportData &resource)
|
||||||
node_txt += " name=\"" + String(resource.nodes[i].name).c_escape() + "\"";
|
node_txt += " name=\"" + String(resource.nodes[i].name).c_escape() + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resource.nodes[i].parent != NodePath()) {
|
|
||||||
node_txt += " parent=\"" + String(resource.nodes[i].parent).c_escape() + "\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resource.nodes[i].owner != NodePath()) {
|
if (resource.nodes[i].owner != NodePath()) {
|
||||||
node_txt += " owner=\"" + String(resource.nodes[i].owner).c_escape() + "\"";
|
node_txt += " owner=\"" + String(resource.nodes[i].owner).c_escape() + "\"";
|
||||||
}
|
}
|
||||||
|
@ -1294,6 +1308,10 @@ void EditorExportGodot3::_save_text(const String &p_path, ExportData &resource)
|
||||||
node_txt += " type=\"" + resource.nodes[i].type + "\"";
|
node_txt += " type=\"" + resource.nodes[i].type + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (resource.nodes[i].parent != NodePath()) {
|
||||||
|
node_txt += " parent=\"" + String(resource.nodes[i].parent).c_escape() + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
if (resource.nodes[i].instance != String()) {
|
if (resource.nodes[i].instance != String()) {
|
||||||
String prop;
|
String prop;
|
||||||
_get_property_as_text(resource.nodes[i].instance, prop);
|
_get_property_as_text(resource.nodes[i].instance, prop);
|
||||||
|
|
Loading…
Reference in a new issue