Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
MaterialNodeReplacer.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 namespace SiliconStudio.Paradox.Assets.Materials.Processor.Visitors
4 {
6  {
7  public MaterialNodeReplacer(MaterialDescription mat) : base(mat)
8  {
9  }
10 
11  /// <summary>
12  /// Replace all occurences of a node in a tree.
13  /// </summary>
14  public void Replace(IMaterialNode nodeToReplace, IMaterialNode replacementNode)
15  {
16  Material.VisitNodes((context, nodeEntry) =>
17  {
18  if (ReferenceEquals(nodeEntry.Node, nodeToReplace))
19  {
20  nodeEntry.Node = replacementNode;
21  }
22  });
23  }
24  }
25 }
void Replace(IMaterialNode nodeToReplace, IMaterialNode replacementNode)
Replace all occurences of a node in a tree.
Base interface for all nodes in the material tree