public void RemoveAssetGroup(Model.ConnectionData connection)
 {
     if (m_connectionStreamMap.ContainsKey(connection.Id))
     {
         m_connectionStreamMap.Remove(connection.Id);
     }
 }
Esempio n. 2
0
 public AssetStream(Model.ConnectionData c, Node f, Node t, AssetReferenceStreamManager m)
 {
     connection  = c;
     nodeFrom    = f;
     nodeTo      = t;
     assetGroups = m.FindAssetGroup(c);
     output      = null;
 }
Esempio n. 3
0
 public static ConnectionGUI LoadConnection(Model.ConnectionData data, Model.ConnectionPointData output, Model.ConnectionPointData input)
 {
     return(new ConnectionGUI(
                data,
                output,
                input
                ));
 }
        public Dictionary <string, List <AssetReference> > FindAssetGroup(Model.ConnectionData connection)
        {
            if (!m_connectionStreamMap.ContainsKey(connection.Id))
            {
                m_connectionStreamMap[connection.Id] = new Dictionary <string, List <AssetReference> >();
            }

            return(m_connectionStreamMap[connection.Id]);
        }
Esempio n. 5
0
        private ConnectionGUI(Model.ConnectionData data, Model.ConnectionPointData output, Model.ConnectionPointData input)
        {
            UnityEngine.Assertions.Assert.IsTrue(output.IsOutput, "Given Output point is not output.");
            UnityEngine.Assertions.Assert.IsTrue(input.IsInput, "Given Input point is not input.");

            m_inspector           = ScriptableObject.CreateInstance <ConnectionGUIInspectorHelper>();
            m_inspector.hideFlags = HideFlags.DontSave;

            this.m_data        = data;
            this.m_outputPoint = output;
            this.m_inputPoint  = input;

            connectionButtonStyle = "sv_label_0";
        }
Esempio n. 6
0
        private void SetupStream(Model.ConnectionData conn)
        {
            Node fromNode = m_nodes.Find(n => n.data.Id == conn.FromNodeId);
            Node toNode   = m_nodes.Find(n => n.data.Id == conn.ToNodeId);

            if (fromNode != null && toNode != null)
            {
                AssetStream s = new AssetStream(conn, fromNode, toNode, m_streamManager);
                m_streams.Add(s);

                fromNode.streamTo.Add(s);
                toNode.streamFrom.Add(s);
            }

//			Assert.IsNotNull(fromNode);
//			Assert.IsNotNull(toNode);
        }
Esempio n. 7
0
 public AssetGroups(Model.ConnectionData c, Dictionary <string, List <AssetReference> > ag)
 {
     connection  = c;
     assetGroups = ag;
 }
Esempio n. 8
0
        public override void Prepare(BuildTarget target,
                                     Model.NodeData node,
                                     IEnumerable <PerformGraph.AssetGroups> incoming,
                                     IEnumerable <Model.ConnectionData> connectionsToOutput,
                                     PerformGraph.Output Output)
        {
            ValidateAssetGenerator(node, target, incoming,
                                   () => {
                throw new NodeException(node.Name + " :AssetGenerator is not specified. Please select generator from Inspector.", node.Id);
            },
                                   () => {
                throw new NodeException(node.Name + " :Failed to create AssetGenerator from settings. Please fix settings from Inspector.", node.Id);
            },
                                   (AssetReference badAsset, string msg) => {
                throw new NodeException(string.Format("{0} :{1} : Source: {2}", node.Name, msg, badAsset.importFrom), node.Id);
            },
                                   (AssetReference badAsset) => {
                throw new NodeException(string.Format("{0} :Can not import incoming asset {1}.", node.Name, badAsset.fileNameAndExtension), node.Id);
            }
                                   );

            if (incoming == null)
            {
                return;
            }

            if (connectionsToOutput == null || Output == null)
            {
                return;
            }

            var allOutput = new Dictionary <string, Dictionary <string, List <AssetReference> > >();

            foreach (var outPoints in node.OutputPoints)
            {
                allOutput[outPoints.Id] = new Dictionary <string, List <AssetReference> >();
            }

            var defaultOutputCond = connectionsToOutput.Where(c => c.FromNodeConnectionPointId == m_defaultOutputPointId);

            Model.ConnectionData defaultOutput = null;
            if (defaultOutputCond.Any())
            {
                defaultOutput = defaultOutputCond.First();
            }

            foreach (var ag in incoming)
            {
                if (defaultOutput != null)
                {
                    Output(defaultOutput, ag.assetGroups);
                }
                foreach (var groupKey in ag.assetGroups.Keys)
                {
                    foreach (var a in ag.assetGroups[groupKey])
                    {
                        foreach (var entry in m_entries)
                        {
                            var assetOutputDir = FileUtility.EnsureAssetGeneratorCacheDirExists(target, node);
                            var generator      = entry.m_instance.Get <IAssetGenerator>(target);
                            UnityEngine.Assertions.Assert.IsNotNull(generator);

                            var newItem = FileUtility.PathCombine(assetOutputDir, entry.m_id, a.fileName + generator.GetAssetExtension(a));
                            var output  = allOutput[entry.m_id];
                            if (!output.ContainsKey(groupKey))
                            {
                                output[groupKey] = new List <AssetReference>();
                            }
                            output[groupKey].Add(AssetReferenceDatabase.GetReferenceWithType(newItem, generator.GetAssetType(a)));
                        }
                    }
                }
            }

            foreach (var dst in connectionsToOutput)
            {
                if (allOutput.ContainsKey(dst.FromNodeConnectionPointId))
                {
                    Output(dst, allOutput[dst.FromNodeConnectionPointId]);
                }
            }
        }
 public void AssignAssetGroup(Model.ConnectionData connection, Dictionary <string, List <AssetReference> > groups)
 {
     m_connectionStreamMap[connection.Id] = groups;
 }