Navigation
API > API/Plugins > API/Plugins/RigVMDeveloper
Custom Inja template environment providing C++ code generation helpers.
Extends inja::Environment to register custom callback functions that can be invoked from within Inja templates. These functions handle UE-specific types, indentation management, and C++ code generation patterns.Template Function ReferenceString Utilities
- `sanitize(name)_ - Converts a name to a valid C++ identifier
- `starts_with(str, prefix)_ - Returns true if str starts with prefix
- `ends_with(str, suffix)_ - Returns true if str ends with suffix
- `remove_whitespace(str)_ - Removes all spaces and tabs from str
-
`format_number(format, value)_ - Printf-style number formatting (e.g., "%04d") Indentation Management
- `tabs()_ - Returns current indentation as tab characters
- `inc_tabs()_ - Increases indentation level by 1 (void, no return)
-
`dec_tabs()_ - Decreases indentation level by 1 (void, no return) JSON Utilities
- `has_key(object, key)_ - Returns true if object contains key with truthy value
-
`count_key(array, key)_ - Counts array elements that contain key with truthy value C++ Code Generation
- `cpp_get_default_for_native_type(type)_ - Returns default value for a C++ type (e.g., "FVector" -> "FVector::ZeroVector", "bool" -> "true")
- `cpp_get_initialize_code_for_property(memType, name, origName, nativeType, nativePath, default)_ Returns array of C++ initialization statements for a property
- `cpp_get_block_to_run_operand(instruction)_ - Resolves the BlockToRun operand for control flow instructions
- `cpp_is_default_value(nativeType, defaultValue)_ - Returns true if the value matches the header inline default, allowing constructor init to be skipped Example Template Usage
{{tabs()}}{{sanitize(Property.Name)}}={{cpp_get_default_for_native_type(Property.NativeType)}};{%inc_tabs()%}##forPropinProperties{{tabs()}}//Initialize{{Prop.Name}}##endfor{%dec_tabs()%}
| Name | FRigVMCodeEnvironment |
| Type | class |
| Header File | /Engine/Plugins/Runtime/RigVM/Source/RigVMDeveloper/Public/RigVMCompiler/RigVMCodeEnvironment.h |
| Include Path | #include "RigVMCompiler/RigVMCodeEnvironment.h" |
Syntax
class FRigVMCodeEnvironment : public inja::Environment
Inheritance Hierarchy
- inja::Environment → FRigVMCodeEnvironment
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FRigVMCodeEnvironment
(
const FString& InTemplateFolder, |
Constructs the environment and registers all custom template functions. | RigVMCompiler/RigVMCodeEnvironment.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| DefaultLinearColor | const FLinearColor | RigVMCompiler/RigVMCodeEnvironment.h | |
| IntegerTypes | const TSet< FString > | Set of C++ integer type names for default value lookup. | RigVMCompiler/RigVMCodeEnvironment.h |
| NativeStructTypeDefaults | const TMap< FString, const void * > | Map of native type names to their default value expressions. O(1) lookup. | RigVMCompiler/RigVMCodeEnvironment.h |
| NativeTypeDefaults | const TMap< FString, FString > | Map of native type names to their default value expressions. O(1) lookup. | RigVMCompiler/RigVMCodeEnvironment.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Converter | FRigVMCodeConverter * | Back-reference to converter for type lookups and bytecode access. | RigVMCompiler/RigVMCodeEnvironment.h | |
| NativeTypeLookup | TMap< FString, UObject * > | Local cache for looking up native types by name | RigVMCompiler/RigVMCodeEnvironment.h | |
| Tabs | int32 | ============================================================================ State | RigVMCompiler/RigVMCodeEnvironment.h |
Functions
Public
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static inja::json count_key
(
inja::Renderer* InRenderer, |
Counts elements in Arg0 (array) that contain Arg1 (key) with a truthy value. | RigVMCompiler/RigVMCodeEnvironment.h | |
static inja::json ends_with
(
inja::Renderer* InRenderer, |
Returns true if Arg0 ends with Arg1. | RigVMCompiler/RigVMCodeEnvironment.h | |
static inja::json format_number
(
inja::Renderer* InRenderer, |
Printf-style formatting: format_number("%04d", 42) -> "0042". | RigVMCompiler/RigVMCodeEnvironment.h | |
| Converts std::string to FString. | RigVMCompiler/RigVMCodeEnvironment.h | ||
| Converts inja::json to FString. | RigVMCompiler/RigVMCodeEnvironment.h | ||
static inja::json has_key
(
inja::Renderer* InRenderer, |
============================================================================ JSON Utility Callbacks | RigVMCompiler/RigVMCodeEnvironment.h | |
static inja::json remove_whitespace
(
inja::Renderer* InRenderer, |
Removes all whitespace (spaces and tabs) from Arg0. | RigVMCompiler/RigVMCodeEnvironment.h | |
static inja::json sanitize
(
inja::Renderer* InRenderer, |
============================================================================ String Utility Callbacks | RigVMCompiler/RigVMCodeEnvironment.h | |
static inja::json starts_with
(
inja::Renderer* InRenderer, |
Returns true if Arg0 starts with Arg1. | RigVMCompiler/RigVMCodeEnvironment.h | |
| Converts FName to inja::json. | RigVMCompiler/RigVMCodeEnvironment.h | ||
| ============================================================================ JSON Conversion Helpers | RigVMCompiler/RigVMCodeEnvironment.h | ||
| Converts FText to inja::json. | RigVMCompiler/RigVMCodeEnvironment.h |