void OnPreprocessModel()
        {
            m_Info = FbxUtils.GetTiltBrushFbxInfo(assetPath);
            if (!IsTiltBrush)
            {
                return;
            }

            if (m_Info.tiltBrushVersion >= new Version {
                major = 10
            })
            {
                var importer = assetImporter as ModelImporter;
                if (importer != null && importer.optimizeMesh)
                {
                    // Not a warning, just a friendly notification.
                    Debug.LogFormat("{0}: Tilt Brush Toolkit requires optimizeMesh=false; disabling.", assetPath);
                    importer.optimizeMesh = false;
                }
            }

            if (m_Info.tiltBrushVersion < kRequiredFbxExportVersion)
            {
                LogWarningWithContext(string.Format(
                                          "{0} was exported with an older version of Tilt Brush ({1}) that is not supported by this version of the Toolkit. For best results, re-export it with a newer Tilt Brush version ({2}).",
                                          assetPath, m_Info.tiltBrushVersion, kRequiredFbxExportVersion));
            }
            else if (m_Info.requiredToolkitVersion != null &&
                     kToolkitVersion < m_Info.requiredToolkitVersion)
            {
                LogWarningWithContext(string.Format(
                                          "{0} was exported with an newer version of Tilt Brush that is not supported by this version of the Toolkit ({1}). For best results, upgrade your Toolkit to a newer version ({2}) or downgrade your Tilt Brush.",
                                          assetPath, kToolkitVersion, m_Info.requiredToolkitVersion));
            }
        }
示例#2
0
        /// Returns true if the path refers to an fbx that can be processed
        /// by this version of the toolkit
        bool IsSupportedTiltBrushFbx(string path)
        {
            var info = FbxUtils.GetTiltBrushFbxInfo(path);

            if (info.tiltBrushVersion == null)
            {
                return(false);
            }

            if (info.tiltBrushVersion < kRequiredFbxExportVersion)
            {
                LogWarningWithContext(string.Format(
                                          "{0} was exported with an older version of Tilt Brush ({1}) that is not supported by this version of the Toolkit. For best results, re-export it with a newer Tilt Brush version ({2}).",
                                          assetPath, info.tiltBrushVersion, kRequiredFbxExportVersion));
                return(false);
            }

            if (info.requiredToolkitVersion != null &&
                kToolkitVersion < info.requiredToolkitVersion)
            {
                LogWarningWithContext(string.Format(
                                          "{0} was exported with an newer version of Tilt Brush that is not supported by this version of the Toolkit ({1}). For best results, upgrade your Toolkit to a newer version ({2}) or downgrade your Tilt Brush.",
                                          assetPath, kToolkitVersion, info.requiredToolkitVersion));
                return(false);
            }

            return(true);
        }
示例#3
0
        public void TestFbxUserPropertiesAscii()
        {
            var file = string.Format(
                "{0}/Editor/Tests/{1}-fbx.bytes", UnityEngine.Application.dataPath, "v10-text");
            var dict = new Dictionary <string, string>();

            foreach (var pair in FbxUtils.IterUserPropertiesAscii(file))
            {
                dict[pair.Key] = pair.Value;
            }
            Assert.IsTrue(dict.ContainsKey("SrcDocumentUrl"));
            Assert.AreEqual("v10comma,text.fbx", dict["SrcDocumentUrl"]);
        }
示例#4
0
        public void TestFbxHeaderParse(string sketch, string tbVersion, string toolkitVersion)
        {
            var file = string.Format(
                "{0}/Editor/Tests/{1}-fbx.bytes", UnityEngine.Application.dataPath, sketch);

            var info = FbxUtils.GetTiltBrushFbxInfo(file, force: true);

            Assert.AreEqual(tbVersion, info.tiltBrushVersion.ToString());
            Assert.AreEqual(Version.Parse(tbVersion), info.tiltBrushVersion);

            if (toolkitVersion == null)
            {
                Assert.AreEqual(null, info.requiredToolkitVersion);
            }
            else
            {
                Assert.AreEqual(toolkitVersion, info.requiredToolkitVersion.ToString());
                Assert.AreEqual(Version.Parse(toolkitVersion), info.requiredToolkitVersion);
            }
        }