Added player character and step in/out of dialogue in scene 101
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
#if FBX_EXPORTER
|
||||
|
||||
using UnityEditor;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using UnityEditor.Formats.Fbx.Exporter;
|
||||
using UnityEditor.ProBuilder;
|
||||
using UnityEditor.ProBuilder.Actions;
|
||||
|
||||
namespace UnityEngine.ProBuilder.Addons.FBX
|
||||
{
|
||||
/// <summary>
|
||||
/// ProBuilder-specific options when exporting FBX files with the Unity FBX Exporter.
|
||||
/// </summary>
|
||||
class FbxOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Export mesh topology as quads if possible.
|
||||
/// </summary>
|
||||
#pragma warning disable 649
|
||||
public bool quads;
|
||||
#pragma warning restore 649
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides some additional functionality when the FbxSdk and FbxExporter packages are available in the project.
|
||||
/// </summary>
|
||||
[InitializeOnLoad]
|
||||
static class Fbx
|
||||
{
|
||||
static FbxOptions s_FbxOptions = new FbxOptions() {
|
||||
quads = true
|
||||
};
|
||||
|
||||
static Fbx()
|
||||
{
|
||||
TryLoadFbxSupport();
|
||||
}
|
||||
|
||||
static void TryLoadFbxSupport()
|
||||
{
|
||||
ModelExporter.RegisterMeshCallback<ProBuilderMesh>(GetMeshForPBComponent, true);
|
||||
s_FbxOptions.quads = ProBuilderSettings.Get<bool>("Export::m_FbxQuads", SettingsScope.User, true);
|
||||
}
|
||||
|
||||
static bool GetMeshForPBComponent(ModelExporter exporter, ProBuilderMesh pmesh, Autodesk.Fbx.FbxNode node)
|
||||
{
|
||||
Mesh mesh = new Mesh();
|
||||
MeshUtility.Compile(pmesh, mesh, s_FbxOptions.quads ? MeshTopology.Quads : MeshTopology.Triangles);
|
||||
|
||||
var pMeshRenderer = pmesh.GetComponent<MeshRenderer>();
|
||||
var sharedMaterials = pMeshRenderer ? pMeshRenderer.sharedMaterials : null;
|
||||
|
||||
exporter.ExportMesh(mesh, node, sharedMaterials);
|
||||
|
||||
Object.DestroyImmediate(mesh);
|
||||
|
||||
//Need to have ExportOptions accessible to remove this reflection
|
||||
var exporterType = exporter.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)
|
||||
.First(x => x.Name == "get_ExportOptions").Invoke(exporter, null).GetType();
|
||||
|
||||
if(exporterType == typeof(ConvertToPrefabSettingsSerialize))
|
||||
{
|
||||
// probuilder can't handle mesh assets that may be externally reloaded, just strip pb stuff for now.
|
||||
StripProBuilderScripts.DoStrip(pmesh);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 561f179dea8740f41a4a539592427f2b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "Unity.ProBuilder.AddOns.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"Unity.ProBuilder",
|
||||
"Unity.ProBuilder.Editor",
|
||||
"Unity.Formats.Fbx.Editor",
|
||||
"Autodesk.Fbx"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [
|
||||
{
|
||||
"name": "com.unity.formats.fbx",
|
||||
"expression": "4.0.0",
|
||||
"define": "FBX_EXPORTER"
|
||||
}
|
||||
],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cfd637d8bffa4f3ebad425f3bdd33a2
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
# Enabling FBX Integration
|
||||
|
||||
- Install *FBX Exporter* 2.0.1 or newer via Package Manager.
|
||||
- Add the following dependencies to `Unity.ProBuilder.AddOns.Editor.asmdef` in the "references" array:
|
||||
- "Autodesk.Fbx"
|
||||
- "Unity.Formats.Fbx.Editor"
|
||||
- Open *Project Settings* and add `PROBUILDER_FBX_2_0_1_OR_NEWER` to the *Scripting Define Symbols* field.
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 775c13f8a03a14fcf9021cd73ff0377e
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user