From 45431d3a8ba5f626c20143b8e7a79bb9148471ca Mon Sep 17 00:00:00 2001 From: Sai Nane Date: Sun, 18 Aug 2024 11:25:49 +0000 Subject: [PATCH] Use spaces for extra indentation within [csharp] --- doc/classes/EditorImportPlugin.xml | 68 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index 2989b59b6f0c..e8a83871da8b 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -278,40 +278,40 @@ [csharp] public partial class MyEditorImportPlugin : EditorImportPlugin { - public override Error _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array<string> platformVariants, Godot.Collections.Array<string> genFiles) - { - // Make textures folder if required. - string sourceFileFolder = sourceFile.Substring(0, sourceFile.LastIndexOf('/')); - string texturesFolder = $"{sourceFileFolder}/Textures"; - DirAccess.MakeDirRecursiveAbsolute(texturesFolder); - - // Simulate image export by copying the source file to the textures folder. - string exportPath = $"{texturesFolder}/Icon.png"; - using FileAccess exportImageFile = FileAccess.Open(exportPath, FileAccess.ModeFlags.Write); - exportImageFile.StoreBuffer(FileAccess.GetFileAsBytes("res://Game/MyIcon.png")); - exportImageFile.Close(); - - // Ensure file visibility for ResourceLoader later. - EditorFileSystem editorFileSystem = EditorInterface.Singleton.GetResourceFilesystem(); - editorFileSystem.UpdateFile(texturesFolder); - editorFileSystem.UpdateFile(exportPath); - - // Append exported file as external resource. - Error err = AppendImportExternalResource(exportPath); - if (err != Error.Ok) - { - return err; - } - - // Load exported image as a Texture2D. - Texture2D exportImageTex = ResourceLoader.Load<Texture2D>(exportPath, nameof(Texture2D), ResourceLoader.CacheMode.Replace); - if (exportImageTex == null) - { - return Error.ScriptFailed; - } - - ... - } + public override Error _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array<string> platformVariants, Godot.Collections.Array<string> genFiles) + { + // Make textures folder if required. + string sourceFileFolder = sourceFile.Substring(0, sourceFile.LastIndexOf('/')); + string texturesFolder = $"{sourceFileFolder}/Textures"; + DirAccess.MakeDirRecursiveAbsolute(texturesFolder); + + // Simulate image export by copying the source file to the textures folder. + string exportPath = $"{texturesFolder}/Icon.png"; + using FileAccess exportImageFile = FileAccess.Open(exportPath, FileAccess.ModeFlags.Write); + exportImageFile.StoreBuffer(FileAccess.GetFileAsBytes("res://Game/MyIcon.png")); + exportImageFile.Close(); + + // Ensure file visibility for ResourceLoader later. + EditorFileSystem editorFileSystem = EditorInterface.Singleton.GetResourceFilesystem(); + editorFileSystem.UpdateFile(texturesFolder); + editorFileSystem.UpdateFile(exportPath); + + // Append exported file as external resource. + Error err = AppendImportExternalResource(exportPath); + if (err != Error.Ok) + { + return err; + } + + // Load exported image as a Texture2D. + Texture2D exportImageTex = ResourceLoader.Load<Texture2D>(exportPath, nameof(Texture2D), ResourceLoader.CacheMode.Replace); + if (exportImageTex == null) + { + return Error.ScriptFailed; + } + + ... + } } [/csharp] [/codeblocks]