using System.Collections; using System.Collections.Generic; using Godot; using System; namespace Rokojori { [Tool] [GlobalClass] public partial class SetBakingMaterials:RJAction { [Export] public Node targetContainer; public enum BakingMaterialMode { Albedo, Normals, ORM, Depth } [Export] public BakingMaterialMode mode; public override void _OnTrigger() { var baseMaterial = GetBaseMaterial(); Nodes.ForEach( targetContainer, ( v )=> { } ); } public static readonly string materialsPath = "res://addons/rokojori_action_library/External/Imposter/materials/"; static Dictionary _cachedMaterials = new Dictionary(); public static Material LoadMaterial( string materialName ) { if ( _cachedMaterials.ContainsKey( materialName ) ) { return _cachedMaterials[ materialName ]; } var loadedMaterial = ResourceLoader.Load( materialsPath + materialName ) as Material; _cachedMaterials[ materialName ] = loadedMaterial; return loadedMaterial; } public Material GetBaseMaterial() { switch ( mode ) { case BakingMaterialMode.Albedo: return LoadMaterial( "albedo_material.material" ); case BakingMaterialMode.Normals: return LoadMaterial( "normal_baker.material" ); case BakingMaterialMode.ORM: return LoadMaterial( "orm_baker.material" ); case BakingMaterialMode.Depth: return LoadMaterial( "depth_baker.material" ); } return null; } } }