Fixes to the 2to3 project exporter

This commit is contained in:
Rémi Verschelde 2017-07-15 12:37:31 +02:00
parent 408f91024c
commit 63a9b02131

View File

@ -143,12 +143,12 @@ static const char *globals_renames[][2] = {
/* [physics_2d] */
{ "physics_2d/thread_model", "physics/2d/thread_model" },
//{ "physics_2d/motion_fix_enabled", "" },
{ "physics_2d/sleep_threashold_linear", "physics/2d/sleep_threshold_linear" }, // FIXME: Typo in 2.1 and master, fix in master
{ "physics_2d/sleep_threashold_linear", "physics/2d/sleep_threshold_linear" },
{ "physics_2d/sleep_threshold_angular", "physics/2d/sleep_threshold_angular" },
{ "physics_2d/time_before_sleep", "physics/2d/time_before_sleep" },
{ "physics_2d/bp_hash_table_size", "physics/2d/bp_hash_table_size" },
{ "physics_2d/cell_size", "physics/2d/cell_size" },
{ "physics_2d/large_object_surface_treshold_in_cells", "physics/2d/large_object_surface_threshold_in_cells" }, // FIXME: Typo in 2.1 and master, fix in master
{ "physics_2d/large_object_surface_treshold_in_cells", "physics/2d/large_object_surface_threshold_in_cells" },
{ "physics_2d/default_gravity", "physics/2d/default_gravity" },
{ "physics_2d/default_gravity_vector", "physics/2d/default_gravity" },
{ "physics_2d/default_linear_damp", "physics/2d/default_linear_damp" },
@ -438,7 +438,7 @@ static const char *prop_renames[][2] = {
{ "texture/under", "texture_under" },
{ "texture/over", "texture_over" },
{ "texture/progress", "texture_progress" },
// { "mode", "fill_mode" }, breaks tilemap :\
//{ "mode", "fill_mode" }, breaks tilemap :\
{ "radial_fill/initial_angle", "radial_initial_angle" },
{ "radial_fill/fill_degrees", "radial_fill_degrees" },
{ "radial_fill/center_offset", "radial_center_offset" },
@ -475,6 +475,7 @@ static const char *prop_renames[][2] = {
{ "cell/center_y", "cell_center_y" },
{ "cell/center_z", "cell_center_z" },
{ "cell/scale", "cell_scale" },
{ "region", "region_enabled" },
{ NULL, NULL }
};
@ -490,10 +491,12 @@ static const char *type_renames[][2] = {
{ "Particles2D", "Node2D" },
{ "SampleLibrary", "Resource" },
{ "TextureFrame", "TextureRect" },
{ "Patch9Frame", "NinePatchRect" },
{ "FixedMaterial", "SpatialMaterial" },
{ "ColorRamp", "Gradient" },
{"CanvasItemShader","Shader"},
{"CanvasItemMaterial","ShaderMaterial"},
{ "CanvasItemShader", "Shader" },
{ "CanvasItemMaterial", "ShaderMaterial" },
{ "TestCube", "MeshInstance" },
{ NULL, NULL }
};
@ -513,6 +516,7 @@ static const char *signal_renames[][2] = {
{ "modal_close", "modal_closed" },
{ "enter_tree", "tree_entered" },
{ "exit_tree", "tree_exited" },
{ "input_event", "gui_input" },
{ NULL, NULL }
};
@ -543,6 +547,19 @@ void EditorExportGodot3::_rename_properties(const String &p_type, List<ExportDat
if (E->get().name == "rotation_deg") {
E->get().value = E->get().value.operator real_t() * -1.0;
}
// Anchors changed from Begin,End,Ratio,Center to Begin,End,Center
if (E->get().name.begins_with("anchor_")) {
switch (E->get().value.operator int()) {
case 0: // Begin
case 1: // End
break;
case 2: // Ratio
E->get().value = 0;
case 3: // Center
E->get().value = 2;
}
}
}
}
@ -1321,6 +1338,14 @@ void EditorExportGodot3::_save_text(const String &p_path, ExportData &resource)
node_txt += " instance=" + prop + "";
}
if (!resource.nodes[i].groups.empty()) {
node_txt += " groups=[\n";
for (int j = 0; j < resource.nodes[i].groups.size(); j++) {
node_txt += "\"" + resource.nodes[i].groups[j] + "\",\n";
}
node_txt += "]";
}
node_txt += "]\n";
f->store_line(node_txt);