Download

Adding new material editor node, having couple of problems.

Hello, everyone!

Sorry, if it’s not the place to post my question (i haven’t found any better), and also sorry for inevitable mistakes in my English.

Now, i’ve been trying to add a new material editor node for our artists to use. What it should do, is fairly simple: it should work like a static switch, but instead of bool as it’s value input it should take a scalar; also, instead of only 2 inputs for “True” and “False” to select from, it should be able to have any number (up to some limit, which i will set later). So, basically, it’s a static switch with multiple variants, thus, it’s called StaticMultipleSwitch.

Presently, i’ve had success with implementing almost all of it, following this very helpfull article. The only 2 problems i have, are:

  1. My material node does not does not display name of newly added inputs, except the first one. When i add new one, it adds pins to the node but does not display their names.

  2. While first problem is mostly aesthetics, second one is a reason i actually started doing all of this. The thing here is, that our level artists want to use this node to select between material layers in a main parent material, giving an ability for others to simply state which preset material should be used on this layer (like Metal or Wood). To do this, my node should be able to accept and output material attributes, which it does not.

So, here is my main question: how can i make material editor node to pass material attributes through itself?

Here is code i added into source files to make this work so far:

  1. Header, that declares my node, MaterialExpressionStaticMultipleSwitch.h - http://pastebin.com/Q9BUTdfe
  2. In MaterialExpressions.cpp - http://pastebin.com/WGmZH6eJ
  3. In MaterialCompiler.h - http://pastebin.com/08SwjsaW
  4. Finally, in HLSLMaterialTranslator.h - http://pastebin.com/fRK9eL6Y