https://github.com/microdee/ue4-material-expression-generator
Generate Material expressions to the clipboard to be pasted in Unreal Engine 4 material editor
https://github.com/microdee/ue4-material-expression-generator
Last synced: 6 months ago
JSON representation
Generate Material expressions to the clipboard to be pasted in Unreal Engine 4 material editor
- Host: GitHub
- URL: https://github.com/microdee/ue4-material-expression-generator
- Owner: microdee
- Created: 2020-03-13T19:22:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T14:23:39.000Z (about 3 years ago)
- Last Synced: 2025-02-13T08:37:37.121Z (about 1 year ago)
- Language: TypeScript
- Size: 237 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# UE4 Material Expression Node Generator
## Features
Looks for `float main(...)` function in the active document and generates a material expression node to the clipboard ready to be pasted in your UE4 material. Works great with the HLSL Preview extension.
```C
float GlobalParam = 1;
float4 main(float2 uv : TEXCOORD0) : SV_Target0
{
return 1;
}
```
* Enter **Generate UE4 Material Expression Node** in command palette to copy an entire node to clipboard
* Enter **Generate text for UE4 Material Expression** to copy only the expanded text to clipboard
* (used for iterations)
this extension assumes that the main function is in global scope, its definition starts right at the beginning of line and the enclosing curly brackets are also both are the first characters on a line as seen above.
You can include other files in your code and this extension will recursively expand them for the expression node. Includes are always relative to their containing file.
```C
// include.hlsl
#if !defined(include_hlsl)
#define include_hlsl 1
#define PI 3.141592653589793238
#endif
// main.hlsl
float GlobalParam = 1;
float4 main(float2 uv : TEXCOORD0) : SV_Target0
{
#include "include.hlsl"
return PI;
}
```
will result in
```C
#if !defined(include_hlsl)
#define include_hlsl 1
#define PI 3.141592653589793238
#endif
return PI
```
## Known Issues
It would be great if the extension would ask for function name instead of being hard coded.
**Enjoy!**