Exemple #1
0
 /// <summary>
 /// 初始化所有fbx列表
 /// </summary>
 private void initLst()
 {
     string[] allPath = Directory.GetDirectories(getFullPath());
     for (int i = 0; i < allPath.Length; i++)
     {
         FbxInfo info = new FbxInfo();
         string  path = allPath[i];
         info.path = path;
         string[] sonLst = Directory.GetFiles(path, "*.FBX");
         for (int j = 0; j < sonLst.Length; j++)
         {
             if (sonLst[j].Contains("Amt"))
             {
                 UnityEngine.Object amt = getObj(getAssetPath(sonLst[j]));
                 info.fbxAmt = amt;
             }
             else
             {
                 UnityEngine.Object model = getObj(getAssetPath(sonLst[j]));
                 info.fbxModel = model;
             }
         }
         fbxLst.Add(info);
     }
 }
Exemple #2
0
 //左侧列表
 private void drawLeftLst()
 {
     for (int i = 0; i < fbxLst.Count; i++)
     {
         string name = fbxLst[i].amtName;
         GUI.color = fbxLst[i].isSelect ? Color.green : Color.white;
         if (GUILayout.Button(name, GUILayout.Width(175), GUILayout.Height(50)))
         {
             if (selectInfo != null)
             {
                 selectInfo.isSelect = false;
             }
             fbxLst[i].isSelect = true;
             selectInfo         = fbxLst[i];
             pingObj(selectInfo.fbxAmt);
         }
         GUI.color = Color.white;
     }
 }
Exemple #3
0
        /// Given a path to an arbitrary file, return some info about that file.
        public static FbxInfo GetTiltBrushFbxInfo(string path, bool force = false)
        {
            FbxInfo info = new FbxInfo();

            if (force || path.ToLowerInvariant().EndsWith(".fbx"))
            {
                IEnumerable <KeyValuePair <string, string> > propsIter = null;
                if (IsBinaryFbx(path))
                {
                    propsIter = IterUserPropertiesBinary(path);
                }
                else if (IsAsciiFbx(path))
                {
                    propsIter = IterUserPropertiesAscii(path);
                }

                if (propsIter != null)
                {
                    info.isFbx = true;
                    var props = new Dictionary <string, string>();
                    try {
                        foreach (var pair in propsIter)
                        {
                            props[pair.Key] = pair.Value;
                        }
                    } catch (FbxError) {
                        // Can't find any properties
                    }

                    string name;
                    if (props.TryGetValue("Original|ApplicationName", out name) && name == "Tilt Brush")
                    {
                        info.tiltBrushVersion = FromDict(
                            props, "Original|ApplicationVersion");
                    }
                    info.requiredToolkitVersion = FromDict(
                        props, "Original|RequiredToolkitVersion");
                }
            }
            return(info);
        }