Beispiel #1
0
        private List <IResourceConnection> CTPT_addPair()
        {
            Diagnostics.Log("CTPT_addPair");

            byte status = (byte)base.resource["CommonBlock.BuildBuyProductStatusFlags"].Value;
            Dictionary <ulong, SpecificResource> indexToPair;

            if ((status & BBProdStatusShowInCatalog) != 0)
            {
                indexToPair = CTPTBrushIndexToPair0;
            }
            else
            {
                indexToPair = CTPTBrushIndexToPair1;
            }

            //int brushIndex = ("" + base.Resource["BrushTexture"]).GetHashCode();
            ulong brushIndex = (ulong)base.resource["CommonBlock.NameGUID"].Value;

            if (indexToPair.ContainsKey(brushIndex))
            {
                //Add("ctpt_pair", CTPTBrushIndexToPair[brushIndex].RequestedRK);
                List <IResourceConnection> results = new List <IResourceConnection>();
                results.Add(new CTPTConnection(indexToPair[brushIndex]));
                return(results);
            }
            else
            {
                Diagnostics.Show(String.Format("CTPT {0} BrushIndex {1} not found",
                                               ResourceGraph.PrintRKTag(base.originalKey, "CatalogTerrainPaintBrush"),
                                               brushIndex), "No ctpt_pair item");
                return(new List <IResourceConnection>());
            }
        }
Beispiel #2
0
        private List <IResourceConnection> MATD_GetDiffuseSpecular()
        {
            string rootStr = this.GetContentPathRootName();
            List <IResourceConnection> results = new List <IResourceConnection>();
            GenericRCOLResource        rcol    = base.Resource as GenericRCOLResource;

            if (rcol == null)
            {
                return(results);
            }
            string absolutePath, absoluteName;

            Diagnostics.Log("MATD_GetDiffuseSpecular: " +
                            ResourceGraph.PrintRKTag(base.originalKey, rootStr));
            for (int i = 0; i < rcol.ChunkEntries.Count; i++)
            {
                MATD matd = rcol.ChunkEntries[i].RCOLBlock as MATD;
                if (matd == null)
                {
                    continue;
                }

                ShaderDataList sdataList;
                if (matd.ContentFields.Contains("Mtnf"))
                {
                    sdataList    = matd.Mtnf.SData;
                    absolutePath = rootStr + ".ChunkEntries[" + i + "].RCOLBlock.Mtnf.SData[";
                }
                else
                {
                    sdataList    = matd.Mtrl.SData;
                    absolutePath = rootStr + ".ChunkEntries[" + i + "].RCOLBlock.Mtrl.SData[";
                }

                for (int j = 0; j < sdataList.Count; j++)
                {
                    ElementTextureRef texRef = sdataList[i] as ElementTextureRef;
                    if (texRef != null && IsWantedImage(texRef.Field))
                    {
                        TGIBlock tgiblock = rcol.Resources[texRef.Data.TGIBlockIndex];
                        if (ResourceGraph.IsDDS(tgiblock.ResourceType))
                        {
                            absoluteName = rootStr + ".Resources[" + texRef.Data.TGIBlockIndex + "]";
                            results.Add(new DefaultConnection(tgiblock, tgiblock,
                                                              ResourceDataActions.FindWrite, absoluteName));
                        }
                    }
                    else
                    {
                        ElementTextureKey texKey = sdataList[i] as ElementTextureKey;
                        if (texKey != null && IsWantedImage(texKey.Field))
                        {
                            if (ResourceGraph.IsDDS(texKey.Data.ResourceType))
                            {
                                absoluteName = absolutePath + j + "].Data";
                                results.Add(new DefaultConnection(texKey.Data, texKey,
                                                                  ResourceDataActions.FindWrite, absoluteName, rootStr + ".Data"));
                            }
                        }
                    }
                }
            }
            return(results);
        }