private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { string[] houdiniGeosImported = importedAssets.Where(p => IsHoudiniGeoFile(p)).ToArray(); foreach (var assetPath in houdiniGeosImported) { //Debug.Log("Importing: " + assetPath); string outDir = Path.GetDirectoryName(assetPath); string assetName = Path.GetFileNameWithoutExtension(assetPath); // Parse geo var geoOutputPath = string.Format("{0}/{1}.asset", outDir, assetName); var houdiniGeo = AssetDatabase.LoadAllAssetsAtPath(geoOutputPath).Where(a => a is HoudiniGeo).FirstOrDefault() as HoudiniGeo; if (houdiniGeo == null) { houdiniGeo = ScriptableObject.CreateInstance <HoudiniGeo>(); AssetDatabase.CreateAsset(houdiniGeo, geoOutputPath); } HoudiniGeoFileParser.ParseInto(assetPath, houdiniGeo); houdiniGeo.ImportAllMeshes(); EditorUtility.SetDirty(houdiniGeo); } if (houdiniGeosImported.Length > 0) { AssetDatabase.SaveAssets(); } }
private static void AddSingleAttributeToDictionary(List <object> attributes, HoudiniGeoAttribute attribute) { string typeString = HoudiniGeoFileParser.AttributeTypeEnumValueToCategoryString(attribute.type); // Each attribute has a list with two dictionaries: a header and a body. List <object> attributeDictionaries = new List <object>(); attributes.Add(attributeDictionaries); // Header dictionary. Dictionary <string, object> header = new Dictionary <string, object>() { { "scope", "public" }, // TODO: Does this ever vary?