diff --git a/Unity Studio.sln b/Unity Studio.sln index 10ab29f..33dddfe 100644 --- a/Unity Studio.sln +++ b/Unity Studio.sln @@ -5,22 +5,22 @@ VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity Studio", "Unity Studio\Unity Studio.csproj", "{24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity Studio-x86", "Unity Studio\Unity Studio-x86.csproj", "{F5E07FB2-95E4-417F-943F-D439D9A03BBA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Debug|x64.ActiveCfg = Debug|x64 - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Debug|x64.Build.0 = Debug|x64 - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Debug|x86.ActiveCfg = Debug|x86 - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Debug|x86.Build.0 = Debug|x86 - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Release|x64.ActiveCfg = Release|x64 - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Release|x64.Build.0 = Release|x64 - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Release|x86.ActiveCfg = Release|x86 - {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Release|x86.Build.0 = Release|x86 + {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Debug|Any CPU.ActiveCfg = Debug|x64 + {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Debug|Any CPU.Build.0 = Debug|x64 + {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Release|Any CPU.ActiveCfg = Release|x64 + {24551E2D-E9B6-4CD6-8F2A-D9F4A13E7853}.Release|Any CPU.Build.0 = Release|x64 + {F5E07FB2-95E4-417F-943F-D439D9A03BBA}.Debug|Any CPU.ActiveCfg = Debug|x86 + {F5E07FB2-95E4-417F-943F-D439D9A03BBA}.Debug|Any CPU.Build.0 = Debug|x86 + {F5E07FB2-95E4-417F-943F-D439D9A03BBA}.Release|Any CPU.ActiveCfg = Release|x86 + {F5E07FB2-95E4-417F-943F-D439D9A03BBA}.Release|Any CPU.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Unity Studio/Unity Classes/Shader.cs b/Unity Studio/Unity Classes/Shader.cs index 21c40e5..ad5b23b 100644 --- a/Unity Studio/Unity Classes/Shader.cs +++ b/Unity Studio/Unity Classes/Shader.cs @@ -27,7 +27,13 @@ namespace Unity_Studio { if (readSwitch) { - m_Script = Encoding.UTF8.GetBytes(preloadData.ViewStruct()); + string str; + if ((str = preloadData.ViewStruct()) != null) + { + m_Script = Encoding.UTF8.GetBytes(preloadData.ViewStruct()); + } + else + m_Script = Encoding.UTF8.GetBytes("Serialized Shader can't be read"); } else { diff --git a/Unity Studio/Unity Studio Classes/UnityStudio.cs b/Unity Studio/Unity Studio Classes/UnityStudio.cs index 8247391..240c9b4 100644 --- a/Unity Studio/Unity Studio Classes/UnityStudio.cs +++ b/Unity Studio/Unity Studio Classes/UnityStudio.cs @@ -1850,13 +1850,33 @@ namespace Unity_Studio mesh.VertexColours = colors; } #endregion + #region UV + if (m_Mesh.m_UV1 != null && m_Mesh.m_UV1.Length == m_Mesh.m_VertexCount * 2) + { + var uv = new ManagedFbx.Vector2[m_Mesh.m_VertexCount]; + for (int c = 0; c < m_Mesh.m_VertexCount; c++) + { + uv[c] = new ManagedFbx.Vector2(m_Mesh.m_UV1[c * 2], m_Mesh.m_UV1[c * 2 + 1]); + } + mesh.TextureCoords = uv; + } + else if (m_Mesh.m_UV2 != null && m_Mesh.m_UV2.Length == m_Mesh.m_VertexCount * 2) + { + var uv = new ManagedFbx.Vector2[m_Mesh.m_VertexCount]; + for (int c = 0; c < m_Mesh.m_VertexCount; c++) + { + uv[c] = new ManagedFbx.Vector2(m_Mesh.m_UV2[c * 2], m_Mesh.m_UV2[c * 2 + 1]); + } + mesh.TextureCoords = uv; + } + #endregion } SceneNode.AddMesh(meshnode, mesh); - m_scene.Save(exportPath); //default is .fbx + //m_scene.Save(exportPath); //default is .fbx //m_scene.Save(exportPath + ".fbx"); m_scene.Save(exportPath + ".obj"); - m_scene.Save(exportPath + ".dae"); + //m_scene.Save(exportPath + ".dae"); } public static bool ExportFileExists(string filename) diff --git a/Unity Studio/Unity Studio-x86.csproj b/Unity Studio/Unity Studio-x86.csproj new file mode 100644 index 0000000..8b652aa --- /dev/null +++ b/Unity Studio/Unity Studio-x86.csproj @@ -0,0 +1,262 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {F5E07FB2-95E4-417F-943F-D439D9A03BBA} + WinExe + Properties + Unity_Studio + Unity Studio + v4.0 + + + 512 + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + Resources\unity.ico + + + OnBuildSuccess + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + + + + False + library\x86\ManagedFbx.dll + False + + + False + library\OpenTK.dll + False + + + False + library\OpenTK.GLControl.dll + False + + + + + False + library\System.Half.dll + False + + + + + + + + + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + Form + + + AboutBox.cs + + + + + + + + + + + Form + + + ExportOptions.cs + + + + + + + Component + + + + + + + + + + + + + + + + + + + + + Form + + + UnityStudioForm.cs + + + AboutBox.cs + Designer + + + ExportOptions.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + UnityStudioForm.cs + Designer + + + + PreserveNewest + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + PreserveNewest + + + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 4.5 + true + + + + + + + + + + + xcopy /y "$(ProjectDir)library" "$(TargetDir)" +xcopy /y "$(ProjectDir)library\$(PlatformName)" "$(TargetDir)" + + + \ No newline at end of file diff --git a/Unity Studio/Unity Studio.csproj b/Unity Studio/Unity Studio.csproj index 24f400a..03bab8c 100644 --- a/Unity Studio/Unity Studio.csproj +++ b/Unity Studio/Unity Studio.csproj @@ -30,27 +30,6 @@ false true - - x86 - true - full - false - bin\x86\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - x86 - pdbonly - true - bin\x86\Release\ - TRACE - prompt - 4 - false - Resources\unity.ico @@ -72,10 +51,14 @@ prompt MinimumRecommendedRules.ruleset + + OnBuildSuccess + False library\x64\ManagedFbx.dll + False False @@ -99,7 +82,6 @@ - diff --git a/Unity Studio/UnityStudioForm.cs b/Unity Studio/UnityStudioForm.cs index 2ffe3fd..c725759 100644 --- a/Unity Studio/UnityStudioForm.cs +++ b/Unity Studio/UnityStudioForm.cs @@ -1734,7 +1734,7 @@ namespace Unity_Studio GL.DeleteShader(address); } - private void createVBO(int vboAddress, OpenTK.Vector3[] data, int address) + private void createVBO(out int vboAddress, OpenTK.Vector3[] data, int address) { GL.GenBuffers(1, out vboAddress); GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress); @@ -1746,7 +1746,7 @@ namespace Unity_Studio GL.EnableVertexAttribArray(address); } - private void createVBO(int vboAddress, OpenTK.Vector4[] data, int address) + private void createVBO(out int vboAddress, OpenTK.Vector4[] data, int address) { GL.GenBuffers(1, out vboAddress); GL.BindBuffer(BufferTarget.ArrayBuffer, vboAddress); @@ -1758,13 +1758,13 @@ namespace Unity_Studio GL.EnableVertexAttribArray(address); } - private void createVBO(int vboAddress, Matrix4[] data, int address) + private void createVBO(out int vboAddress, Matrix4[] data, int address) { GL.GenBuffers(1, out vboAddress); GL.UniformMatrix4(address, false, ref data[0]); } - private void createEBO(int address, int[] data) + private void createEBO(out int address, int[] data) { GL.GenBuffers(1, out address); GL.BindBuffer(BufferTarget.ElementArrayBuffer, address); @@ -1780,11 +1780,11 @@ namespace Unity_Studio GL.DeleteVertexArray(vao); GL.GenVertexArrays(1, out vao); GL.BindVertexArray(vao); - createVBO(vboPositions, vertexData, attributeVertexPosition); - createVBO(vboNormals, normalData, attributeNormalDirection); - createVBO(vboColors, colorData, attributeVertexColor); - createVBO(vboViewMatrix, viewMatrixData, uniformViewMatrix); - createEBO(eboElements, indiceData); + createVBO(out vboPositions, vertexData, attributeVertexPosition); + createVBO(out vboNormals, normalData, attributeNormalDirection); + createVBO(out vboColors, colorData, attributeVertexColor); + createVBO(out vboViewMatrix, viewMatrixData, uniformViewMatrix); + createEBO(out eboElements, indiceData); GL.BindBuffer(BufferTarget.ArrayBuffer, 0); GL.BindVertexArray(0); }