Skip to content

Commit c3cc278

Browse files
committed
Create repo
1 parent 7095c50 commit c3cc278

File tree

10 files changed

+260
-0
lines changed

10 files changed

+260
-0
lines changed

.vs/PmxEditorPlugins/v16/.suo

23.5 KB
Binary file not shown.

.vs/ProjectSettings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"CurrentProjectSetting": null
3+
}

.vs/VSWorkspaceState.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"ExpandedNodes": [
3+
""
4+
],
5+
"PreviewInSolutionExplorer": false
6+
}

.vs/slnx.sqlite

208 KB
Binary file not shown.

MMDTools.Common/Material.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace MMDTools.Common
8+
{
9+
public class MaterialInfo
10+
{
11+
public string Name { get; set; }
12+
public string Texture { get; set; }
13+
}
14+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
using MMDTools.Common;
2+
using Newtonsoft.Json;
3+
using PEPlugin;
4+
using PEPlugin.Form;
5+
using PEPlugin.Pmd;
6+
using PEPlugin.Pmx;
7+
using PEPlugin.View;
8+
using System;
9+
using System.Collections.Generic;
10+
using System.IO;
11+
using System.Windows.Forms;
12+
13+
namespace MMDTools.MaterialTextureTool
14+
{
15+
public class MaterialTexturePlugin : PEPluginClass
16+
{
17+
public IPEPluginHost host;
18+
public IPEBuilder builder;
19+
public IPEShortBuilder bd;
20+
public IPEConnector connect;
21+
public IPEXPmd pex;
22+
public IPXPmx PMX;
23+
public IPEPmd PMD;
24+
public IPEFormConnector Form;
25+
public IPEPMDViewConnector PMDView;
26+
27+
#region IPEPlugin
28+
29+
public override string Name => "Export all material texture filename as list";
30+
31+
public override string Version => "1.0.0.1";
32+
33+
public override string Description => "A tool that used for save material filename to a list";
34+
35+
#endregion
36+
public override void Run(IPERunArgs args)
37+
{
38+
this.host = args.Host;
39+
this.builder = this.host.Builder;
40+
this.bd = this.host.Builder.SC;
41+
this.connect = this.host.Connector;
42+
this.pex = this.connect.Pmd.GetCurrentStateEx();
43+
this.PMD = this.connect.Pmd.GetCurrentState();
44+
this.PMX = this.connect.Pmx.GetCurrentState();
45+
this.Form = this.connect.Form;
46+
this.PMDView = this.connect.View.PMDView;
47+
48+
using (var saveFileDialog = new SaveFileDialog())
49+
{
50+
saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); ;
51+
saveFileDialog.Filter = "Json files (*.json)|*.json|All files (*.*)|*.*";
52+
saveFileDialog.FilterIndex = 1;
53+
saveFileDialog.RestoreDirectory = true;
54+
55+
DialogResult result = saveFileDialog.ShowDialog();
56+
57+
if (result == DialogResult.OK)
58+
{
59+
var materials = PMX.Material;
60+
List<MaterialInfo> materialList = new List<MaterialInfo>();
61+
foreach (var m in materials)
62+
{
63+
materialList.Add(new MaterialInfo() { Name = m.Name, Texture = m.Tex });
64+
}
65+
66+
SaveToFile(saveFileDialog.FileName, materialList);
67+
}
68+
}
69+
}
70+
71+
/// <summary>
72+
/// Save material list to a json file
73+
/// </summary>
74+
/// <param name="path"></param>
75+
/// <param name="materialList"></param>
76+
private void SaveToFile(string path, List<MaterialInfo> materialList)
77+
{
78+
// serialize JSON to a string and then write string to a file
79+
File.WriteAllText(path, JsonConvert.SerializeObject(materialList));
80+
81+
// serialize JSON directly to a file
82+
using (StreamWriter file = File.CreateText(path))
83+
{
84+
JsonSerializer serializer = new JsonSerializer();
85+
serializer.Serialize(file, materialList);
86+
}
87+
}
88+
}
89+
}

MMDTools.csproj

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="packages\ILMerge.3.0.29\build\ILMerge.props" Condition="Exists('packages\ILMerge.3.0.29\build\ILMerge.props')" />
4+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
5+
<PropertyGroup>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<ProjectGuid>{2CC83AFF-ABEE-48A9-84AC-5BF9E66A94B3}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>MMDTools</RootNamespace>
12+
<AssemblyName>MaterialTextureTool</AssemblyName>
13+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
<Deterministic>true</Deterministic>
16+
<NuGetPackageImportStamp>
17+
</NuGetPackageImportStamp>
18+
</PropertyGroup>
19+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
20+
<DebugSymbols>true</DebugSymbols>
21+
<DebugType>full</DebugType>
22+
<Optimize>false</Optimize>
23+
<OutputPath>bin\Debug\</OutputPath>
24+
<DefineConstants>DEBUG;TRACE</DefineConstants>
25+
<ErrorReport>prompt</ErrorReport>
26+
<WarningLevel>4</WarningLevel>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
38+
<HintPath>packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
39+
</Reference>
40+
<Reference Include="PEPlugin">
41+
<HintPath>..\..\..\Program_Files\PmxEditor_0236\Lib\PEPlugin\PEPlugin.dll</HintPath>
42+
</Reference>
43+
<Reference Include="PresentationCore" />
44+
<Reference Include="PresentationFramework" />
45+
<Reference Include="System" />
46+
<Reference Include="System.Core" />
47+
<Reference Include="System.Windows.Forms" />
48+
<Reference Include="System.Xaml" />
49+
<Reference Include="System.Xml.Linq" />
50+
<Reference Include="System.Data.DataSetExtensions" />
51+
<Reference Include="Microsoft.CSharp" />
52+
<Reference Include="System.Data" />
53+
<Reference Include="System.Net.Http" />
54+
<Reference Include="System.Xml" />
55+
<Reference Include="WindowsBase" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<Compile Include="MMDTools.Common\Material.cs" />
59+
<Compile Include="MMDTools.MaterialTextureTool\MaterialTexturePlugin.cs" />
60+
<Compile Include="Properties\AssemblyInfo.cs" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<None Include="packages.config" />
64+
</ItemGroup>
65+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
66+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
67+
<PropertyGroup>
68+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
69+
</PropertyGroup>
70+
<Error Condition="!Exists('packages\ILMerge.3.0.29\build\ILMerge.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\ILMerge.3.0.29\build\ILMerge.props'))" />
71+
</Target>
72+
<ItemGroup>
73+
<PackageReference Include="ILMerge" Version="3.0.29" />
74+
</ItemGroup>
75+
<Target Name="ILMerge">
76+
<!-- the ILMergePath property points to the location of ILMerge.exe console application -->
77+
<Exec Command="$(ILMergeConsolePath) /out:bin\Release\MergedMMDTools.dll ^&#xD;&#xA; bin\Release\MMDTools.dll ^&#xD;&#xA; bin\Release\Newtonsoft.Json.dll " />
78+
</Target>
79+
</Project>

MMDTools.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28917.181
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MMDTools", "MMDTools.csproj", "{2CC83AFF-ABEE-48A9-84AC-5BF9E66A94B3}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{2CC83AFF-ABEE-48A9-84AC-5BF9E66A94B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2CC83AFF-ABEE-48A9-84AC-5BF9E66A94B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2CC83AFF-ABEE-48A9-84AC-5BF9E66A94B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2CC83AFF-ABEE-48A9-84AC-5BF9E66A94B3}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {050B30E8-8223-4AF1-8A1D-6B045E2F234C}
24+
EndGlobalSection
25+
EndGlobal

Properties/AssemblyInfo.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Resources;
2+
using System.Reflection;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("MaterialTextureTool")]
10+
[assembly: AssemblyDescription("A tool that used for save material filename to a list")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("Lolisay Studio")]
13+
[assembly: AssemblyProduct("PE Plugin")]
14+
[assembly: AssemblyCopyright("Copyright © 2019 Lolisay Studio")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
18+
// Setting ComVisible to false makes the types in this assembly not visible
19+
// to COM components. If you need to access a type in this assembly from
20+
// COM, set the ComVisible attribute to true on that type.
21+
[assembly: ComVisible(false)]
22+
23+
// The following GUID is for the ID of the typelib if this project is exposed to COM
24+
[assembly: Guid("2cc83aff-abee-48a9-84ac-5bf9e66a94b3")]
25+
26+
// Version information for an assembly consists of the following four values:
27+
//
28+
// Major Version
29+
// Minor Version
30+
// Build Number
31+
// Revision
32+
//
33+
// You can specify all the values or you can default the Build and Revision Numbers
34+
// by using the '*' as shown below:
35+
// [assembly: AssemblyVersion("1.0.*")]
36+
[assembly: AssemblyVersion("1.0.0.1")]
37+
[assembly: AssemblyFileVersion("1.0.0.0")]
38+
[assembly: NeutralResourcesLanguage("en")]
39+

packages.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="ILMerge" version="3.0.29" targetFramework="net472" />
4+
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
5+
</packages>

0 commit comments

Comments
 (0)