more refactoring

remove code duplication
remove magic constant
add new constant
add LICENSE.meta
This commit is contained in:
aliaksei.kalosha
2025-03-18 12:12:39 +01:00
parent e2a9c13fe5
commit f89ed71bd4
4 changed files with 61 additions and 58 deletions

View File

@@ -26,7 +26,7 @@ namespace SplashEdit.RuntimeCode
public void Export()
{
LoadData();
_psxData = Utils.LoadData(out selectedResolution, out dualBuffering, out verticalLayout, out prohibitedAreas);
_exporters = FindObjectsByType<PSXObjectExporter>(FindObjectsSortMode.None);
foreach (PSXObjectExporter exp in _exporters)
{
@@ -39,10 +39,7 @@ namespace SplashEdit.RuntimeCode
void PackTextures()
{
Rect buffer1 = new Rect(0, 0, selectedResolution.x, selectedResolution.y);
Rect buffer2 = verticalLayout ? new Rect(0, 256, selectedResolution.x, selectedResolution.y)
: new Rect(selectedResolution.x, 0, selectedResolution.x, selectedResolution.y);
(Rect buffer1, Rect buffer2) = Utils.BufferForResolution(selectedResolution, verticalLayout);
List<Rect> framebuffers = new List<Rect> { buffer1 };
if (dualBuffering)
@@ -111,24 +108,6 @@ namespace SplashEdit.RuntimeCode
Debug.Log(totalFaces);
}
public void LoadData()
{
_psxData = AssetDatabase.LoadAssetAtPath<PSXData>(_psxDataPath);
if (!_psxData)
{
_psxData = ScriptableObject.CreateInstance<PSXData>();
AssetDatabase.CreateAsset(_psxData, _psxDataPath);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
selectedResolution = _psxData.OutputResolution;
dualBuffering = _psxData.DualBuffering;
verticalLayout = _psxData.VerticalBuffering;
prohibitedAreas = _psxData.ProhibitedAreas;
}
void OnDrawGizmos()
{
Gizmos.DrawIcon(transform.position, "Packages/net.psxsplash.splashedit/Icons/PSXSceneExporter.png", true);