Browse Source

Swap arguments of ResourceSaver.save()

Evanaellio 2 years ago
parent
commit
bc35550dc5

+ 1 - 1
tutorials/3d/procedural_geometry/arraymesh.rst

@@ -243,4 +243,4 @@ This is useful when you want to generate a mesh and then use it later without ha
  .. code-tab:: gdscript GDScript
 
     # Saves mesh to a .tres file with compression enabled.
-    ResourceSaver.save("res://sphere.tres", mesh, ResourceSaver.FLAG_COMPRESS)
+    ResourceSaver.save(mesh, "res://sphere.tres", ResourceSaver.FLAG_COMPRESS)

+ 3 - 3
tutorials/plugins/editor/import_plugins.rst

@@ -339,7 +339,7 @@ as the value we got before.
 
 ::
 
-    return ResourceSaver.save("%s.%s" % [save_path, get_save_extension()], material)
+    return ResourceSaver.save(material, "%s.%s" % [save_path, get_save_extension()])
 
 This is the last part and quite an important one, because here we save the made
 resource to the disk. The path of the saved file is generated and informed by
@@ -375,7 +375,7 @@ would need to do something like the following:
 ::
 
     r_platform_variants.push_back("mobile")
-    return ResourceSaver.save("%s.%s.%s" % [save_path, "mobile", get_save_extension()], mobile_material)
+    return ResourceSaver.save(mobile_material, "%s.%s.%s" % [save_path, "mobile", get_save_extension()])
 
 The ``r_gen_files`` argument is meant for extra files that are generated during
 your import process and need to be kept. The editor will look at it to
@@ -392,7 +392,7 @@ in a different file:
     next_pass.albedo_color = color.inverted()
     var next_pass_path = "%s.next_pass.%s" % [save_path, get_save_extension()]
 
-    err = ResourceSaver.save(next_pass_path, next_pass)
+    err = ResourceSaver.save(next_pass, next_pass_path)
     if err != OK:
         return err
     r_gen_files.push_back(next_pass_path)

+ 2 - 2
tutorials/scripting/resources.rst

@@ -351,7 +351,7 @@ Let's see some examples.
             var my_res = MyResource.new()
 
             # This will NOT serialize the 'value' property.
-            ResourceSaver.save("res://my_res.tres", my_res)
+            ResourceSaver.save(my_res, "res://my_res.tres")
       .. code-tab:: csharp
 
         using System;
@@ -370,6 +370,6 @@ Let's see some examples.
                 var res = new MyResource();
 
                 // This will NOT serialize the 'Value' property.
-                ResourceSaver.Save("res://MyRes.tres", res);
+                ResourceSaver.Save(res, "res://MyRes.tres");
             }
         }