I see two options:
1) Run-time code configuration.
Traditional use case would be typical scene (level) data files.
Typically a custom implementation is used (could be using a well-known transport such as XML and JSON).
Disadvantages: potentially more work to implement, limited to code configuration rather than generation (scripting aside).
Advantages: run-time configuration potential (e.g. user level editing), high format flexibility.
2) Compile/build time code generation.
Typically third-party solutions are used:
Disadvantages: typically limited to compile/build time, very coder-oriented.
Advantages: simpler to get something working, closer to code.
I only have some minor experience using T4 in Visual Studio and it seems that it works.
Visual Studio is considered one of the best IDEs and there are some good T4 extensions for it as well.
This topic is very close to Domain Specific Languages design and implementation, so it might be worth exploring as well.