Beispiel #1
0
        private ShapeMaterial RestoreShapeMaterial(ShapeMaterial currentShapeMaterial, agx.Material material)
        {
            if (material == null)
            {
                return(null);
            }

            var materialNode = m_tree.GetNode(material.getUuid());
            // If another shape material has been assigned to the object it's
            // possible to detect that here, e.g.;
            //     materialNode.Asset != null &&
            //     currentShapeMaterial != null &&
            //     materialNode.Assset != currentShapeMaterial
            // For now we're taking the node's asset because the material UUID
            // references the object we're currently processing.
            var refMaterial = materialNode.Asset != null ?
                              materialNode.Asset as ShapeMaterial :
                              currentShapeMaterial;

            return(FileInfo.ObjectDb.GetOrCreateAsset(refMaterial,
                                                      FindName(material.getName(),
                                                               materialNode.Type.ToString()),
                                                      m =>
            {
                m.RestoreLocalDataFrom(material);
                materialNode.Asset = m;
            }));
        }