Content Pipeline:

- Added ImporterConverter and ProcessorConverter to enable nice dropdown list for Importer/Processor in PropertyGrids

Content Compiler:
- Enabled choosing of Processors using a neat little dropdown list in the propertyGrid.
This commit is contained in:
SND\eagleeyestudios_cp 2012-10-05 11:11:31 +00:00 committed by Konstantin Koch
parent 193cd6d61c
commit 3f6dd9b9d0
8 changed files with 93 additions and 21 deletions

View File

@ -10,27 +10,26 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ANX.Framework.Content.Pipeline</RootNamespace>
<AssemblyName>ANX.Framework.Content.Pipeline</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -186,7 +185,9 @@
<Compile Include="Tasks\BuildContent.cs" />
<Compile Include="Tasks\BuildItem.cs" />
<Compile Include="Tasks\ContentProject.cs" />
<Compile Include="Tasks\ImporterConverter.cs" />
<Compile Include="Tasks\ImporterManager.cs" />
<Compile Include="Tasks\ProcessorConverter.cs" />
<Compile Include="Tasks\ProcessorManager.cs" />
<Compile Include="VideoContent.cs" />
<Compile Include="Serialization\XmlReaderExtensions.cs" />

View File

@ -1,6 +1,7 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
@ -28,12 +29,14 @@ namespace ANX.Framework.Content.Pipeline.Tasks
set;
}
[TypeConverter(typeof(ImporterConverter))]
public string ImporterName
{
get;
set;
}
[TypeConverter(typeof(ProcessorConverter))]
public string ProcessorName
{
get;

View File

@ -0,0 +1,28 @@
using System.Collections.Specialized;
using System.ComponentModel;
namespace ANX.Framework.Content.Pipeline.Tasks
{
/// <summary>
/// Class for enabling a dropdown list containing all available Importers for the PropertyGrid.
/// </summary>
public class ImporterConverter : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
//Show comboBox
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
//Non editable list
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
return new StandardValuesCollection(new StringCollection()); //TODO: Implement correct call to get available Importers
}
}
}

View File

@ -0,0 +1,29 @@
using System.ComponentModel;
using System.Linq;
namespace ANX.Framework.Content.Pipeline.Tasks
{
/// <summary>
/// Class for enabling a dropdown list containing all available Processors for the PropertyGrid.
/// </summary>
public class ProcessorConverter : StringConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
//Show comboBox
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
//Non editable list
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
var pManager = new ProcessorManager();
return new StandardValuesCollection(pManager.AvailableProcessors.Select(availableProcessor => availableProcessor.Key).ToArray());
}
}
}

View File

@ -25,11 +25,11 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
<OutputPath>..\..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>DEBUG;TRACE;MONO</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>true</UseVSHostingProcess>
@ -37,7 +37,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
@ -47,7 +47,7 @@
<StartupObject>ANX.ContentCompiler.GUI.Program</StartupObject>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>True</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
@ -55,12 +55,12 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<Optimize>True</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@ -233,11 +233,11 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\ANX.Framework.Content.Pipeline\ANX.Framework.Content.Pipeline.csproj">
<Project>{2dafdfc1-223b-4741-87bb-be3d0a7617db}</Project>
<Project>{2DAFDFC1-223B-4741-87BB-BE3D0A7617DB}</Project>
<Name>ANX.Framework.Content.Pipeline</Name>
</ProjectReference>
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
<Project>{6899f0c9-70b9-4eb0-9dd3-e598d4be3e35}</Project>
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
<Name>ANX.Framework</Name>
</ProjectReference>
</ItemGroup>

View File

@ -31,7 +31,7 @@
this.labelText = new System.Windows.Forms.Label();
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
#if !LINUX
#if !MONO
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
#endif
@ -109,7 +109,7 @@
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ArrowButtonMouseUp);
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
#if !LINUX
#if !MONO
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
#endif

View File

@ -70,7 +70,7 @@ namespace ANX.ContentCompiler.GUI
this.splitContainerMenuLayout.Panel1.SuspendLayout();
this.splitContainerMenuLayout.Panel2.SuspendLayout();
this.splitContainerMenuLayout.SuspendLayout();
#if !LINUX
#if !MONO
((System.ComponentModel.ISupportInitialize)(this.splitContainerMenuLayout)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.show_pictureBoxRibbon)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.show_pictureBoxMenu)).BeginInit();
@ -573,7 +573,7 @@ namespace ANX.ContentCompiler.GUI
this.splitContainerFileTree.Panel1.ResumeLayout(false);
this.splitContainerFileTree.Panel2.ResumeLayout(false);
this.splitContainerFileTree.ResumeLayout(false);
#if !LINUX
#if !MONO
((System.ComponentModel.ISupportInitialize)(this.show_pictureBoxRibbon)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.show_pictureBoxMenu)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.show_pictureBoxErrorLog)).EndInit();

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
@ -33,6 +34,9 @@ namespace ANX.ContentCompiler.GUI
private bool _mouseDown;
private readonly string[] _args;
private int _showCounter = 0;
private ImporterManager iManager;
private ProcessorManager pManager;
#endregion
#region Properties
@ -74,6 +78,8 @@ namespace ANX.ContentCompiler.GUI
treeViewItemDelete.MouseEnter += TreeViewItemMouseEnter;
treeViewItemRename.MouseEnter += TreeViewItemMouseEnter;
SetUpColors();
iManager = new ImporterManager();
pManager = new ProcessorManager();
}
private void MainWindowShown(object sender, EventArgs e)
@ -264,6 +270,11 @@ namespace ANX.ContentCompiler.GUI
{
bI.ImporterName = ImporterManager.GuessImporterByFileExtension(bI.SourceFilename);
}
if (String.IsNullOrEmpty(bI.ProcessorName))
{
bI.ProcessorName = pManager.GetProcessorForImporter(iManager.GetInstance(bI.ImporterName));
}
}
try
{
@ -340,8 +351,8 @@ namespace ANX.ContentCompiler.GUI
OutputFilename =
ProjectOutputDir + Path.DirectorySeparatorChar + folder + Path.DirectorySeparatorChar +
Path.GetFileNameWithoutExtension(file) + ".xnb", //<- Change this if you want some other extension (i.e. to annoy modders or whatever)
ImporterName = ImporterManager.GuessImporterByFileExtension(file)//,
//ProcessorName = ProcessorManager.GuessImporterByFileExtension(file) //<- This still needs to be implemented, Pipeline devs! *poke*
ImporterName = ImporterManager.GuessImporterByFileExtension(file),
ProcessorName = pManager.GetProcessorForImporter(iManager.GetInstance(ImporterManager.GuessImporterByFileExtension(file)))
};
_contentProject.BuildItems.Add(item);
}