Make ContentCompilerGui compatible to recent changes in pipeline and did some usability changes. Make the Visual Studio Extension work even if the ANX Framework is not installed additionally.. Improve that the path for assembly refernces in a content project doesn't get automatically updated, only if the reference is actually saved, this is so you can specify a relative path yourself. Fix missing icon for ContentProject when it was opened with Visual Studio. Made create_shaders.bat directly executable under windows by fixing the directory separators.
67 lines
2.1 KiB
C#
67 lines
2.1 KiB
C#
using ANX.Framework.Content.Pipeline.Tasks;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace ANX.ContentCompiler.GUI.Converters
|
|
{
|
|
class ImporterConverter : StringConverter
|
|
{
|
|
private ImporterManager importerManager = new ImporterManager();
|
|
|
|
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
|
|
{
|
|
if (sourceType == typeof(string))
|
|
{
|
|
return true;
|
|
}
|
|
return base.CanConvertFrom(context, sourceType);
|
|
}
|
|
|
|
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
|
|
{
|
|
return base.CanConvertTo(context, destinationType);
|
|
}
|
|
|
|
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
|
{
|
|
//From real name to display name.
|
|
if (value is string)
|
|
{
|
|
return importerManager.GetImporterDisplayName((string)value);
|
|
}
|
|
|
|
return base.ConvertTo(context, culture, value, destinationType);
|
|
}
|
|
|
|
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
|
{
|
|
//From display name to real name.
|
|
if (value is string)
|
|
{
|
|
return importerManager.GetImporterName((string)value);
|
|
}
|
|
|
|
return base.ConvertFrom(context, culture, value);
|
|
}
|
|
|
|
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
|
{
|
|
return new StandardValuesCollection(importerManager.AvailableImporters.Select((x) => x.Key).ToArray());
|
|
}
|
|
}
|
|
}
|