private bool LoadImage() { settings = new PsdExportSettings(image); showImportSettings = !settings.HasMetaData; bool valid = (settings.Psd != null); if (valid) { // Parse the layer info fileInfo = new PsdFileInfo(settings.Psd); settings.LoadLayers(fileInfo); } return(valid); }
private static void ExecuteAutoImport() { // This function only fires once, unhook from update function immediately EditorApplication.update -= ExecuteAutoImport; for (int i = 0; i < reimports.Count; i++) { var target = reimports[i]; var exportSettings = new PsdExportSettings(target); if (exportSettings.AutoReImport) { PsdFileInfo psdInfo = new PsdFileInfo(exportSettings.Psd); exportSettings.LoadLayers(psdInfo); PSDExporter.Export(exportSettings, psdInfo); } } reimports.Clear(); }
private static List <PanelNode> GetLayer(Texture2D psdFile, string filter = "") { List <PanelNode> PanelNodeList = new List <PanelNode> (); PsdExportSettings settings = new PsdExportSettings(psdFile); PsdFileInfo fileInfo = new PsdFileInfo(settings.Psd); bool valid = (settings.Psd != null); if (valid) { settings.LoadLayers(fileInfo); PsdFile psd = settings.Psd; int layerIndexMin = 0; int layerIndexMax = 0; for (int i = 0; i < psd.Layers.Count; i++) { PSDLayerGroupInfo groupInfo = fileInfo.GetGroupByLayerIndex(i); //Debug.Log (groupInfo.start + "-" + groupInfo.end + ":" + groupInfo.name); if (groupInfo != null && !PanelNodeList.Exists(a => a.Name.Equals(groupInfo.name))) { PanelNode panelNode = new PanelNode(groupInfo.name); panelNode.visible = groupInfo.visible; panelNode.idxStart = groupInfo.start; panelNode.idxEnd = groupInfo.end; panelNode.isGroup = true; PanelNodeList.Add(panelNode); } } for (int i = 0; i < fileInfo.LayerIndices.Length; i++) { int layerIndex = fileInfo.LayerIndices [i]; Layer layer = psd.Layers [layerIndex]; PanelNode panelNode = new PanelNode(layer.Name); panelNode.visible = layer.Visible; panelNode.Index = layerIndex; panelNode.isGroup = false; panelNode.layer = layer; PanelNodeList.Add(panelNode); } ArrangementNode(PanelNodeList); } return(PanelNodeList); }