rokojori_action_library/Runtime/Godot/ResourceExtensions.cs

37 lines
710 B
C#
Raw Permalink Normal View History

2025-08-31 06:05:39 +00:00
using Godot;
using System.Collections.Generic;
using System;
using System.Threading.Tasks;
using System.Reflection;
using Microsoft.VisualBasic;
namespace Rokojori
{
public static class ResourceExtensions
{
2025-12-18 10:29:54 +00:00
2025-08-31 06:05:39 +00:00
public static Error SaveAs( this Resource resource, string savePath, bool forceUpdate = false, ResourceSaver.SaverFlags saverFlags = ResourceSaver.SaverFlags.None )
{
2025-12-18 10:29:54 +00:00
#if ! TOOLS
return Error.Unavailable;
#else
2025-08-31 06:05:39 +00:00
var error = ResourceSaver.Save( resource, savePath, saverFlags );
if ( forceUpdate )
{
EditorInterface.Singleton.GetResourceFilesystem().Scan();
}
return error;
2025-12-18 10:29:54 +00:00
#endif
2025-08-31 06:05:39 +00:00
}
2025-12-18 10:29:54 +00:00
2025-08-31 06:05:39 +00:00
}
}