- default ContentProcessor for ContentImporter now working

- some improvements in TextureImporter
- some improvements in SpriteTextureProcessor

Missing for basic texture handling: Texture2DContentWriter
This commit is contained in:
Glatzemann 2012-09-28 10:43:38 +00:00 committed by Konstantin Koch
parent 4adbea1887
commit 4c4b999b9c
4 changed files with 46 additions and 3 deletions

View File

@ -45,7 +45,7 @@ namespace ANX.Framework.Content.Pipeline.Importer
} }
TextureContent textureContent = new Texture2DContent(); TextureContent textureContent = new Texture2DContent();
textureContent.Faces.Add(new MipmapChain(bitmapContent)); textureContent.Faces[0] = new MipmapChain(bitmapContent);
return textureContent; return textureContent;
} }

View File

@ -26,7 +26,27 @@ namespace ANX.Framework.Content.Pipeline.Processors
public override TextureContent Process(TextureContent input, ContentProcessorContext context) public override TextureContent Process(TextureContent input, ContentProcessorContext context)
{ {
throw new NotImplementedException(); if (ColorKeyEnabled)
{
throw new NotImplementedException("ColorKey not yet implemented");
}
if (GenerateMipmaps)
{
throw new NotImplementedException("Generation of MipMaps not yet implemented");
}
if (ResizeToPowerOfTwo)
{
throw new NotImplementedException("Resizing to power of two not yet implemented");
}
if (TextureFormat == TextureProcessorOutputFormat.DxtCompressed)
{
throw new NotImplementedException("DXT compression of textures not yet implemented");
}
return input;
} }
} }
} }

View File

@ -106,7 +106,11 @@ namespace ANX.Framework.Content.Pipeline.Tasks
if (String.IsNullOrEmpty(buildItem.ProcessorName)) if (String.IsNullOrEmpty(buildItem.ProcessorName))
{ {
buildItem.ProcessorName = ProcessorManager.GetProcessorForType(importedObject.GetType()); buildItem.ProcessorName = ImporterManager.GetDefaultProcessor(buildItem.ImporterName);
if (string.IsNullOrEmpty(buildItem.ProcessorName))
{
buildItem.ProcessorName = ProcessorManager.GetProcessorForType(importedObject.GetType());
}
} }
var buildedItem = Process(buildItem, importedObject); var buildedItem = Process(buildItem, importedObject);

View File

@ -17,6 +17,7 @@ namespace ANX.Framework.Content.Pipeline.Tasks
public class ImporterManager public class ImporterManager
{ {
private Dictionary<String, Type> importerTypes = new Dictionary<string,Type>(); private Dictionary<String, Type> importerTypes = new Dictionary<string,Type>();
private Dictionary<String, String> defaultProcessor = new Dictionary<string, string>();
public ImporterManager() public ImporterManager()
{ {
@ -29,6 +30,14 @@ namespace ANX.Framework.Content.Pipeline.Tasks
if (value.Length > 0) if (value.Length > 0)
{ {
importerTypes[type.Name] = type; importerTypes[type.Name] = type;
foreach (ContentImporterAttribute cia in value)
{
if (!String.IsNullOrEmpty(cia.DefaultProcessor))
{
defaultProcessor.Add(type.Name, cia.DefaultProcessor);
}
}
} }
} }
} }
@ -44,6 +53,16 @@ namespace ANX.Framework.Content.Pipeline.Tasks
return (IContentImporter)Activator.CreateInstance(type); return (IContentImporter)Activator.CreateInstance(type);
} }
public String GetDefaultProcessor(string importerName)
{
if (defaultProcessor.ContainsKey(importerName))
{
return defaultProcessor[importerName];
}
return String.Empty;
}
public static String GuessImporterByFileExtension(string filename) public static String GuessImporterByFileExtension(string filename)
{ {
String extension = System.IO.Path.GetExtension(filename); String extension = System.IO.Path.GetExtension(filename);