Merge branch 'master' into LouDi_Quan
This commit is contained in:
commit
c6b3b07ad6
@ -522,7 +522,7 @@ RectTransform:
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 7464141640143892343}
|
||||
- {fileID: 3051202814640239909}
|
||||
- {fileID: 4775158531114985421}
|
||||
- {fileID: 642645979159612403}
|
||||
m_Father: {fileID: 8969698929162076767}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -1055,7 +1055,7 @@ RectTransform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6746250251467292074}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
@ -1063,7 +1063,7 @@ RectTransform:
|
||||
- {fileID: 1684458048730538019}
|
||||
- {fileID: 5860908020037853715}
|
||||
- {fileID: 8568704472119011922}
|
||||
m_Father: {fileID: 5675325337001315481}
|
||||
m_Father: {fileID: 4775158531114985421}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
@ -1183,3 +1183,79 @@ MonoBehaviour:
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &9141652036248099059
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4775158531114985421}
|
||||
- component: {fileID: 5397078064978493576}
|
||||
- component: {fileID: 6634696415031054332}
|
||||
m_Layer: 0
|
||||
m_Name: IconBg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4775158531114985421
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9141652036248099059}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 3051202814640239909}
|
||||
m_Father: {fileID: 5675325337001315481}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 76, y: 76}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &5397078064978493576
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9141652036248099059}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &6634696415031054332
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 9141652036248099059}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.07058824, g: 0.15686275, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 0
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
|
||||
@ -4,7 +4,6 @@ using UnityEditor;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System;
|
||||
|
||||
|
||||
public class FbxAnimListPostprocessor : MonoBehaviour
|
||||
@ -16,17 +15,73 @@ public class FbxAnimListPostprocessor : MonoBehaviour
|
||||
if (null != obj)
|
||||
{
|
||||
string assetPath = AssetDatabase.GetAssetPath(obj);
|
||||
try
|
||||
SplitAnim(assetPath);
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Assets/SplitAnimFloder")]
|
||||
public static void SetAplitAnim()
|
||||
{
|
||||
Object[] selectedObjects = Selection.GetFiltered<Object>(SelectionMode.DeepAssets);
|
||||
foreach (Object obj in selectedObjects)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
string path = AssetDatabase.GetAssetPath(obj);
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
EnableFBXReadWriteInFolder(path);
|
||||
}
|
||||
else if (path.EndsWith(".fbx", System.StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
EnableFBXReadWriteForFile(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void EnableFBXReadWriteInFolder(string folderPath)
|
||||
{
|
||||
string[] files = Directory.GetFiles(folderPath, "*.fbx", SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
{
|
||||
EnableFBXReadWriteForFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
public static void EnableFBXReadWriteForFile(string filePath)
|
||||
{
|
||||
string relativePath = filePath;
|
||||
SplitAnim(filePath, true);
|
||||
}
|
||||
|
||||
|
||||
public static void SplitAnim(string assetPath, bool autoImport = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
string fileAnim;
|
||||
fileAnim = assetPath;
|
||||
string ClipText = Path.ChangeExtension(fileAnim, ".txt");
|
||||
StreamReader file = new StreamReader(ClipText);
|
||||
string sAnimList = file.ReadToEnd();
|
||||
file.Close();
|
||||
//
|
||||
if (autoImport)
|
||||
{
|
||||
System.Collections.ArrayList List = new ArrayList();
|
||||
ParseAnimFile(sAnimList, ref List);
|
||||
|
||||
ModelImporter modelImporter = ModelImporter.GetAtPath(assetPath) as ModelImporter;
|
||||
modelImporter.animationType = ModelImporterAnimationType.Legacy;
|
||||
//modelImporter.clipAnimations. = true;
|
||||
modelImporter.clipAnimations = (ModelImporterClipAnimation[])
|
||||
List.ToArray(typeof(ModelImporterClipAnimation));
|
||||
AssetDatabase.ImportAsset(assetPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
string fileAnim;
|
||||
fileAnim = assetPath;
|
||||
string ClipText = Path.ChangeExtension(fileAnim, ".txt");
|
||||
StreamReader file = new StreamReader(ClipText);
|
||||
string sAnimList = file.ReadToEnd();
|
||||
file.Close();
|
||||
//
|
||||
if (EditorUtility.DisplayDialog("FBX Animation Import from file",
|
||||
fileAnim, "Import", "Cancel"))
|
||||
fileAnim, "Import", "Cancel"))
|
||||
{
|
||||
System.Collections.ArrayList List = new ArrayList();
|
||||
ParseAnimFile(sAnimList, ref List);
|
||||
@ -43,9 +98,10 @@ public class FbxAnimListPostprocessor : MonoBehaviour
|
||||
+ modelImporter.clipAnimations.GetLength(0).ToString(), "OK");
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
// (Exception e) { EditorUtility.DisplayDialog("Imported animations", e.Message, "OK"); }
|
||||
|
||||
}
|
||||
catch { }
|
||||
// (Exception e) { EditorUtility.DisplayDialog("Imported animations", e.Message, "OK"); }
|
||||
}
|
||||
|
||||
static void ParseAnimFile(string sAnimList, ref System.Collections.ArrayList List)
|
||||
|
||||
@ -27,6 +27,9 @@ public class SetReadWrite : Editor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void EnableFBXReadWriteInFolder(string folderPath)
|
||||
{
|
||||
string[] files = Directory.GetFiles(folderPath, "*.fbx", SearchOption.AllDirectories);
|
||||
|
||||
@ -59,7 +59,7 @@ namespace QFramework.Example
|
||||
GameObject obj = GameObject.Instantiate(ItemPrefab.gameObject, Content);
|
||||
obj.name = item.Name;
|
||||
obj.transform.Find("Name").GetComponent<TextMeshProUGUI>().text = item.Name;
|
||||
Image icon = obj.transform.Find("Icon").GetComponent<Image>();
|
||||
Image icon = obj.transform.Find("IconBg/Icon").GetComponent<Image>();
|
||||
var localImageUrl = Global.deviceIconsPath + item.Icon;
|
||||
GameObject right = icon.transform.Find("Right").gameObject;
|
||||
GameObject wrong = icon.transform.Find("Wrong").gameObject;
|
||||
@ -124,7 +124,7 @@ namespace QFramework.Example
|
||||
|
||||
public void SetSelected(GameObject item, bool isRight)
|
||||
{
|
||||
Transform icon = item.transform.Find("Icon");
|
||||
Transform icon = item.transform.Find("IconBg/Icon");
|
||||
GameObject right = icon.Find("Right").gameObject;
|
||||
GameObject wrong = icon.Find("Wrong").gameObject;
|
||||
GameObject Selected = icon.Find("Selected").gameObject;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user