protected override void link() { SceneNodeElement sceneNode = Owner.getElement(nodeName) as SceneNodeElement; if (sceneNode == null) { blacklist("Could not find node {0}.", nodeName); } entity = sceneNode.getNodeObject(entityName) as Entity; if (entity == null) { blacklist("No entity specified or entity is not found."); } if (subEntityIndex >= entity.getNumSubEntities()) { blacklist("Entity {0} only has {1} SubEntities. Index {3} is invalid.", entity.getName(), entity.getNumSubEntities(), subEntityIndex); } subEntity = entity.getSubEntity(subEntityIndex); baseMaterialName = subEntity.getMaterialName(); MaterialManager materialManager = MaterialManager.getInstance(); String alphaMaterialName = baseMaterialName + alphaSuffix; if (materialManager.resourceExists(alphaMaterialName)) { finalAlphaMaterialName = alphaMaterialName; } else { blacklist("Cannot find automatic alpha material {0}. Please ensure one exists or define a custom alpha behavior.", alphaMaterialName); } }
protected override void constructed() { SceneNodeElement sceneNode = Owner.getElement(nodeName) as SceneNodeElement; if (sceneNode != null) { entity = sceneNode.getNodeObject(entityName) as Entity; } if (entity == null) { blacklist("No entity specified or entity is not found."); } originalRenderGroup = entity.getRenderQueueGroup(); if (subEntityIndex >= entity.getNumSubEntities()) { blacklist("Entity {0} only has {1} SubEntities. Index {2} is invalid.", entity.getName(), entity.getNumSubEntities(), subEntityIndex); } subEntity = entity.getSubEntity(subEntityIndex); baseMaterialName = subEntity.getMaterialName(); MaterialManager materialManager = MaterialManager.getInstance(); bool useDefinedMaterial = !(alphaMaterialName == null || alphaMaterialName.Equals(String.Empty)); if (useDefinedMaterial) { if (materialManager.resourceExists(alphaMaterialName)) { finalAlphaMaterialName = alphaMaterialName; } else { blacklist("A custom material {0} is defined that cannot be found. This object will not be able to be alpha controlled.", this.alphaMaterialName); } } else { if (materialManager.resourceExists(baseMaterialName + alphaSuffix)) { finalAlphaMaterialName = baseMaterialName + alphaSuffix; } else { blacklist("Cannot find automatic alpha material {0}. Please ensure one exists or define a custom alpha behavior.", baseMaterialName + alphaSuffix); } } setAlpha(currentAlpha); }
protected override void constructed() { transparencyStates = new List <TransparencyState>(); transparencyStates.Add(new TransparencyState(startingTransparency)); SceneNodeElement sceneNode = Owner.getElement(nodeName) as SceneNodeElement; if (sceneNode == null) { blacklist("Cannot find Node '{0}'", nodeName); } if (childNodeName != null && childNodeName != String.Empty) { sceneNode = sceneNode.findChildNode(childNodeName); if (sceneNode == null) { blacklist("Could not find child node '{0}' in node '{1}'.", childNodeName, nodeName); } } entity = sceneNode.getNodeObject(entityName) as Entity; if (entity == null) { if (entityName == null) { blacklist("entityName is Null"); } else { blacklist("Cannot find entity named '{0}' in node '{1}'.", entityName, nodeName); } } originalRenderGroup = entity.getRenderQueueGroup(); if (subEntityIndex >= entity.getNumSubEntities()) { blacklist("Entity '{0}' only has '{1}' SubEntities. Index '{2}' is invalid.", entity.getName(), entity.getNumSubEntities(), subEntityIndex); } subEntity = entity.getSubEntity(subEntityIndex); baseMaterialName = subEntity.getMaterialName(); MaterialManager materialManager = MaterialManager.getInstance(); bool useDefinedMaterial = !(alphaMaterialName == null || alphaMaterialName.Equals(String.Empty)); if (useDefinedMaterial) { if (materialManager.resourceExists(alphaMaterialName)) { finalAlphaMaterialName = alphaMaterialName; } else { blacklist("A custom material '{0}' is defined that cannot be found. This object will not be able to be alpha controlled.", this.alphaMaterialName); } } else { if (materialManager.resourceExists(baseMaterialName + alphaSuffix)) { finalAlphaMaterialName = baseMaterialName + alphaSuffix; } else { blacklist("Cannot find automatic alpha material '{0}'. Please ensure one exists or define a custom alpha behavior.", baseMaterialName + alphaSuffix); } } using (var mat = subEntity.getMaterial()) { usesVirtualTexture = TransparencyController.isVirtualTextureMaterial(mat.Value); if (!usesVirtualTexture) { entity.setVisibilityFlags(TransparencyController.HiddenVisibilityMask); } } TransparencyController.addTransparencyObject(this); applyAlphaToMaterial(getCurrentTransparency(activeTransparencyState)); }