diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..562c648 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +#ignore thumbnails created by windows +Thumbs.db +#Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* \ No newline at end of file diff --git a/Build/samplefile.FBX b/Build/samplefile.FBX new file mode 100644 index 0000000..338db02 Binary files /dev/null and b/Build/samplefile.FBX differ diff --git a/ManagedFbx.Samples/FbxForm.Designer.cs b/ManagedFbx.Samples/FbxForm.Designer.cs new file mode 100644 index 0000000..8b47336 --- /dev/null +++ b/ManagedFbx.Samples/FbxForm.Designer.cs @@ -0,0 +1,69 @@ +partial class FbxForm +{ + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.uxFbxTree = new System.Windows.Forms.TreeView(); + this.uxTranslationLabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // uxFbxTree + // + this.uxFbxTree.Location = new System.Drawing.Point(12, 12); + this.uxFbxTree.Name = "uxFbxTree"; + this.uxFbxTree.Size = new System.Drawing.Size(403, 490); + this.uxFbxTree.TabIndex = 0; + this.uxFbxTree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.OnTreeSelect); + // + // uxTranslationLabel + // + this.uxTranslationLabel.AutoSize = true; + this.uxTranslationLabel.Location = new System.Drawing.Point(421, 12); + this.uxTranslationLabel.Name = "uxTranslationLabel"; + this.uxTranslationLabel.Size = new System.Drawing.Size(24, 13); + this.uxTranslationLabel.TabIndex = 1; + this.uxTranslationLabel.Text = "pos"; + // + // FbxForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(839, 514); + this.Controls.Add(this.uxTranslationLabel); + this.Controls.Add(this.uxFbxTree); + this.Name = "FbxForm"; + this.Text = "FbxForm"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TreeView uxFbxTree; + private System.Windows.Forms.Label uxTranslationLabel; + +} \ No newline at end of file diff --git a/ManagedFbx.Samples/FbxForm.cs b/ManagedFbx.Samples/FbxForm.cs new file mode 100644 index 0000000..06ce62b --- /dev/null +++ b/ManagedFbx.Samples/FbxForm.cs @@ -0,0 +1,39 @@ +using System.IO; +using System.Windows.Forms; +using ManagedFbx; + +public partial class FbxForm : Form +{ + public FbxForm(Scene scene) + { + InitializeComponent(); + AllowDrop = true; + Add(scene.RootNode, null); + } + + public void Add(SceneNode node, TreeNode parentNode) + { + var item = new TreeNode(node.Name) { Tag = node }; + + if(parentNode == null) + uxFbxTree.Nodes.Add(item); + else + parentNode.Nodes.Add(item); + + foreach(var sub in node.ChildNodes) + { + var subitem = new TreeNode(sub.Name) { Tag = sub }; + Add(sub, item); + } + } + + private void OnTreeSelect(object sender, TreeViewEventArgs e) + { + var node = e.Node.Tag as SceneNode; + + if(node == null) + return; + + uxTranslationLabel.Text = string.Format("Position: {0}\nRotation: {1}\nScale: {2}", node.Position, node.Rotation, node.Scale); + } +} diff --git a/ManagedFbx.Samples/FbxForm.resx b/ManagedFbx.Samples/FbxForm.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/ManagedFbx.Samples/FbxForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ManagedFbx.Samples/ManagedFbx.Samples.csproj b/ManagedFbx.Samples/ManagedFbx.Samples.csproj new file mode 100644 index 0000000..e91b6b6 --- /dev/null +++ b/ManagedFbx.Samples/ManagedFbx.Samples.csproj @@ -0,0 +1,95 @@ + + + + + Debug + AnyCPU + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC} + WinExe + Properties + ManagedFbx.Samples + ManagedFbx.Samples + v4.5 + 512 + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + true + ..\Build\ + DEBUG;TRACE + full + x86 + prompt + MinimumRecommendedRules.ruleset + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + MinimumRecommendedRules.ruleset + false + + + Program + + + + ..\Build\ManagedFbx.dll + + + + + + + + + + + + + Form + + + FbxForm.cs + + + + + + + FbxForm.cs + + + + + \ No newline at end of file diff --git a/ManagedFbx.Samples/Program.cs b/ManagedFbx.Samples/Program.cs new file mode 100644 index 0000000..33f3c51 --- /dev/null +++ b/ManagedFbx.Samples/Program.cs @@ -0,0 +1,16 @@ +using System; +using System.Windows.Forms; +using ManagedFbx; + +public class Program +{ + [STAThread] + public static void Main() + { + var manager = new Manager(); + var scene = manager.ImportScene("samplefile.fbx"); + + Application.EnableVisualStyles(); + Application.Run(new FbxForm(scene)); + } +} \ No newline at end of file diff --git a/ManagedFbx.Samples/Properties/AssemblyInfo.cs b/ManagedFbx.Samples/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f2e92ea --- /dev/null +++ b/ManagedFbx.Samples/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Managed")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Managed")] +[assembly: AssemblyCopyright("Copyright © 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("e43b02f2-c8e6-4d25-ad63-b4a812fe2bec")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ManagedFbx.sln b/ManagedFbx.sln new file mode 100644 index 0000000..cb20327 --- /dev/null +++ b/ManagedFbx.sln @@ -0,0 +1,54 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ManagedFbx", "ManagedFbx\ManagedFbx.vcxproj", "{163D9B5E-1A69-4821-89DE-298736F2C14E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedFbx.Samples", "ManagedFbx.Samples\ManagedFbx.Samples.csproj", "{78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Debug|Win32.ActiveCfg = Debug|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Debug|Win32.Build.0 = Debug|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Debug|x86.ActiveCfg = Debug|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Debug|x86.Build.0 = Debug|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Release|Any CPU.ActiveCfg = Release|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Release|Mixed Platforms.Build.0 = Release|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Release|Win32.ActiveCfg = Release|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Release|Win32.Build.0 = Release|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Release|x86.ActiveCfg = Release|Win32 + {163D9B5E-1A69-4821-89DE-298736F2C14E}.Release|x86.Build.0 = Release|Win32 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|Win32.ActiveCfg = Debug|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|Win32.Build.0 = Debug|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|x86.ActiveCfg = Debug|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Debug|x86.Build.0 = Debug|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|Any CPU.Build.0 = Release|Any CPU + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|Mixed Platforms.Build.0 = Release|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|Win32.ActiveCfg = Release|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|Win32.Build.0 = Release|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|x86.ActiveCfg = Release|x86 + {78BA3050-B035-46F5-AAC2-4B9B8A3CFDDC}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ManagedFbx/Expose.cpp b/ManagedFbx/Expose.cpp new file mode 100644 index 0000000..df15290 --- /dev/null +++ b/ManagedFbx/Expose.cpp @@ -0,0 +1,20 @@ +#include "stdafx.h" + +namespace FbxSdk +{ + public ref class Expose + { + public: + static System::String ^ManagedTest() + { + auto test = "rawr"; + return gcnew System::String(test); + } + + static void Load(System::String ^filepath) + { + auto manager = FbxManager::Create(); + auto scene = FbxScene::Create(manager, "Scene"); + } + }; +} \ No newline at end of file diff --git a/ManagedFbx/FbxException.cpp b/ManagedFbx/FbxException.cpp new file mode 100644 index 0000000..e69de29 diff --git a/ManagedFbx/FbxException.h b/ManagedFbx/FbxException.h new file mode 100644 index 0000000..32afabb --- /dev/null +++ b/ManagedFbx/FbxException.h @@ -0,0 +1,12 @@ +#pragma once + +namespace ManagedFbx +{ + public ref class FbxException : public System::Exception + { + public: + FbxException(System::String ^message, ...array ^args) : Exception(System::String::Format(message, args)) + { + } + }; +} \ No newline at end of file diff --git a/ManagedFbx/ManagedFbx.vcxproj b/ManagedFbx/ManagedFbx.vcxproj new file mode 100644 index 0000000..021d385 --- /dev/null +++ b/ManagedFbx/ManagedFbx.vcxproj @@ -0,0 +1,115 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + $(VCTargetsPath11) + + + {163D9B5E-1A69-4821-89DE-298736F2C14E} + Win32Proj + Native + ManagedFbx + + + + DynamicLibrary + true + v100 + NotSet + true + + + Application + false + v110 + true + Unicode + + + + + + + + + + + + + true + C:\Program Files\Autodesk\FBX\FBX SDK\2013.2\include\;$(IncludePath) + C:\Program Files\Autodesk\FBX\FBX SDK\2013.2\lib\vs2010\x86;$(LibraryPath) + $(SolutionDir)\Build + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDebugDLL + false + true + + + Console + true + fbxsdk-2013.2-mdd.lib;wininet.lib;%(AdditionalDependencies) + LIBMCT + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/ManagedFbx/ManagedFbx.vcxproj.filters b/ManagedFbx/ManagedFbx.vcxproj.filters new file mode 100644 index 0000000..2fc1007 --- /dev/null +++ b/ManagedFbx/ManagedFbx.vcxproj.filters @@ -0,0 +1,44 @@ + + + + + + + Helpers + + + + + + + Helpers + + + + + Helpers + + + + Helpers + + + + Maths + + + Exceptions + + + + + {294b9ba4-ee57-4d5f-b87f-715a6ea77c8a} + + + {9015aafe-42e1-4b07-bda4-9dd023a1aeda} + + + {b6172554-dbf5-4472-89ce-76f3920496e0} + + + \ No newline at end of file diff --git a/ManagedFbx/Manager.cpp b/ManagedFbx/Manager.cpp new file mode 100644 index 0000000..40d8c6b --- /dev/null +++ b/ManagedFbx/Manager.cpp @@ -0,0 +1,29 @@ +#include "stdafx.h" +#include "Manager.h" + +using namespace ManagedFbx; + +Manager::Manager() +{ + m_pNativeManager = FbxManager::Create(); + m_pNativeImporter = FbxImporter::Create(m_pNativeManager, "Importer"); +} + +Scene ^Manager::CreateScene(string ^name) +{ + auto nativeScene = FbxScene::Create(m_pNativeManager, StringHelper::ToNative(name)); + return gcnew Scene(nativeScene); +} + +Scene ^Manager::ImportScene(string ^filename) +{ + bool success = m_pNativeImporter->Initialize(StringHelper::ToNative(filename)); + + if(!success) + throw gcnew FbxException("Failed to initialise the FBX importer: " + gcnew string(m_pNativeImporter->GetLastErrorString())); + + auto nativeScene = FbxScene::Create(m_pNativeManager, ""); + m_pNativeImporter->Import(nativeScene); + + return gcnew Scene(nativeScene); +} \ No newline at end of file diff --git a/ManagedFbx/Manager.h b/ManagedFbx/Manager.h new file mode 100644 index 0000000..9d1c8fa --- /dev/null +++ b/ManagedFbx/Manager.h @@ -0,0 +1,19 @@ +#pragma once + +#include "Scene.h" + +namespace ManagedFbx +{ + public ref class Manager + { + public: + Manager(); + + Scene ^CreateScene(string ^name); + Scene ^ImportScene(string ^filename); + + private: + FbxManager *m_pNativeManager; + FbxImporter *m_pNativeImporter; + }; +} \ No newline at end of file diff --git a/ManagedFbx/NativeString.h b/ManagedFbx/NativeString.h new file mode 100644 index 0000000..286aab5 --- /dev/null +++ b/ManagedFbx/NativeString.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +using namespace msclr::interop; + +ref class StringHelper +{ +public: + static const char *ToNative(System::String ^string) + { + if(!m_context) + m_context = gcnew marshal_context(); + + return m_context->marshal_as(string); + } + +private: + static marshal_context ^m_context; +}; \ No newline at end of file diff --git a/ManagedFbx/Properties.h b/ManagedFbx/Properties.h new file mode 100644 index 0000000..0319d39 --- /dev/null +++ b/ManagedFbx/Properties.h @@ -0,0 +1,13 @@ + +#define property_r(type, name)\ + property type name\ + {\ + type get();\ + } + +#define property_rw(type, name)\ + property type name\ + {\ + type get();\ + void set(type value);\ + } \ No newline at end of file diff --git a/ManagedFbx/Scene.cpp b/ManagedFbx/Scene.cpp new file mode 100644 index 0000000..28afa55 --- /dev/null +++ b/ManagedFbx/Scene.cpp @@ -0,0 +1,25 @@ +#include "stdafx.h" +#include "Scene.h" + +using namespace ManagedFbx; + +Scene::Scene(FbxScene *nativeScene) +{ + m_nativeScene = nativeScene; + m_rootNode = gcnew SceneNode(m_nativeScene->GetRootNode()); +} + +void Scene::Name::set(string ^value) +{ + m_nativeScene->SetName(StringHelper::ToNative(value)); +} + +string ^Scene::Name::get() +{ + return gcnew string(m_nativeScene->GetName()); +} + +SceneNode ^Scene::RootNode::get() +{ + return m_rootNode; +} \ No newline at end of file diff --git a/ManagedFbx/Scene.h b/ManagedFbx/Scene.h new file mode 100644 index 0000000..d25b6d1 --- /dev/null +++ b/ManagedFbx/Scene.h @@ -0,0 +1,22 @@ +#pragma once + +#include "SceneNode.h" + +using namespace System::Collections::Generic; + +namespace ManagedFbx +{ + public ref class Scene + { + public: + property_r(SceneNode^, RootNode); + property_rw(string^, Name); + + internal: + Scene(FbxScene *nativeScene); + + private: + FbxScene *m_nativeScene; + SceneNode ^m_rootNode; + }; +} \ No newline at end of file diff --git a/ManagedFbx/SceneNode.cpp b/ManagedFbx/SceneNode.cpp new file mode 100644 index 0000000..774701d --- /dev/null +++ b/ManagedFbx/SceneNode.cpp @@ -0,0 +1,67 @@ +#include "stdafx.h" +#include "SceneNode.h" + +using namespace ManagedFbx; + +SceneNode::SceneNode(FbxNode *node) +{ + m_nativeNode = node; + m_children = gcnew List(); + + for(int i = 0; i < m_nativeNode->GetChildCount(); i++) + { + auto sub = m_nativeNode->GetChild(i); + m_children->Add(gcnew SceneNode(sub)); + } +} + +IEnumerable^ SceneNode::ChildNodes::get() +{ + return m_children->AsReadOnly(); +} + +string ^SceneNode::Name::get() +{ + return gcnew string(m_nativeNode->GetName()); +} + +void SceneNode::Name::set(string ^value) +{ + m_nativeNode->SetName(StringHelper::ToNative(value)); +} + +void SceneNode::AddChild(SceneNode ^node) +{ + m_nativeNode->AddChild(node->m_nativeNode); + m_children->Add(node); +} + +void SceneNode::Position::set(Vector3 value) +{ + m_nativeNode->LclTranslation.Set(value); +} + +void SceneNode::Rotation::set(Vector3 value) +{ + m_nativeNode->LclRotation.Set(value); +} + +void SceneNode::Scale::set(Vector3 value) +{ + m_nativeNode->LclScaling.Set(value); +} + +Vector3 SceneNode::Position::get() +{ + return Vector3(m_nativeNode->LclTranslation.Get()); +} + +Vector3 SceneNode::Rotation::get() +{ + return Vector3(m_nativeNode->LclRotation.Get()); +} + +Vector3 SceneNode::Scale::get() +{ + return Vector3(m_nativeNode->LclScaling.Get()); +} \ No newline at end of file diff --git a/ManagedFbx/SceneNode.h b/ManagedFbx/SceneNode.h new file mode 100644 index 0000000..e4fdd59 --- /dev/null +++ b/ManagedFbx/SceneNode.h @@ -0,0 +1,28 @@ +#pragma once + +#include "Properties.h" + +using namespace System::Collections::Generic; + +namespace ManagedFbx +{ + public ref class SceneNode + { + public: + property_rw(string^, Name); + property_r(IEnumerable^, ChildNodes); + + property_rw(Vector3, Position); + property_rw(Vector3, Rotation); + property_rw(Vector3, Scale); + + void AddChild(SceneNode ^node); + + internal: + SceneNode(FbxNode *node); + + private: + FbxNode *m_nativeNode; + List ^m_children; + }; +} \ No newline at end of file diff --git a/ManagedFbx/SceneNodeAttribute.cpp b/ManagedFbx/SceneNodeAttribute.cpp new file mode 100644 index 0000000..4770aaa --- /dev/null +++ b/ManagedFbx/SceneNodeAttribute.cpp @@ -0,0 +1,2 @@ +#include "stdafx.h" +#include "SceneNodeAttribute.h" \ No newline at end of file diff --git a/ManagedFbx/SceneNodeAttribute.h b/ManagedFbx/SceneNodeAttribute.h new file mode 100644 index 0000000..0c8c828 --- /dev/null +++ b/ManagedFbx/SceneNodeAttribute.h @@ -0,0 +1,9 @@ +#pragma once + +namespace ManagedFbx +{ + public ref class SceneNodeAttribute + { + + }; +} \ No newline at end of file diff --git a/ManagedFbx/Vector.h b/ManagedFbx/Vector.h new file mode 100644 index 0000000..50b5aec --- /dev/null +++ b/ManagedFbx/Vector.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include "Properties.h" + +using namespace System; + +namespace ManagedFbx +{ + public value struct Vector3 + { + public: + Vector3(double x, double y, double z) + { + X = x; + Y = y; + Z = z; + } + + property double X; + property double Y; + property double Z; + + operator FbxDouble3() + { + return FbxDouble3(X, Y, Z); + } + + virtual String ^ToString() override + { + return String::Format("{0}, {1}, {2}", Math::Round(X, 3), Math::Round(Y, 3), Math::Round(Z, 3)); + } + + internal: + Vector3(FbxDouble3 fbxDouble) + { + X = fbxDouble[0]; + Y = fbxDouble[1]; + Z = fbxDouble[2]; + } + }; +} \ No newline at end of file diff --git a/ManagedFbx/stdafx.cpp b/ManagedFbx/stdafx.cpp new file mode 100644 index 0000000..1577c4e --- /dev/null +++ b/ManagedFbx/stdafx.cpp @@ -0,0 +1 @@ +#include "stdafx.h" \ No newline at end of file diff --git a/ManagedFbx/stdafx.h b/ManagedFbx/stdafx.h new file mode 100644 index 0000000..460850f --- /dev/null +++ b/ManagedFbx/stdafx.h @@ -0,0 +1,9 @@ +#pragma once + +#define FBXSDK_NEW_API +#include +#include "NativeString.h" +#include "FbxException.h" +#include "Vector.h" + +typedef System::String string; \ No newline at end of file diff --git a/licence.md b/licence.md new file mode 100644 index 0000000..37909ce --- /dev/null +++ b/licence.md @@ -0,0 +1,5 @@ +This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License (http://creativecommons.org/licenses/by-nc-sa/3.0/) + +This means that you are free to download and use this software for non-commercial purposes as you see fit. + +This software contains Autodesk® FBX® code developed by Autodesk, Inc. Copyright Autodesk, Inc. All rights, reserved. Such code is provided “as is” and Autodesk, Inc. disclaims any and all warranties, whether express or implied, including without limitation the implied warranties of merchantability, fitness for a particular purpose or non-infringement of third party rights. In no event shall Autodesk, Inc. be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of such code. \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..66f0e51 --- /dev/null +++ b/readme.md @@ -0,0 +1,7 @@ +ManagedFBX is a .NET wrapper for Autodesk's FBX SDK, written in C++/CLI. + +# Building from source + +* Install the [FBX SDK](http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847) +* Ensure that the ManagedFbx project is pointing at the correct library and headers for the SDK +* Build the solution and verify it's working correctly by running the sample project provided \ No newline at end of file