Thursday, 27 November 2025

TEKART HW12

NameRules_UE5.json stores categories including Level, Material, Blueprint, Texture, Mesh, Particles, Animation, Audio, Physics, UI, Misc. Each with their own prefix/suffix pairs. Sub-categories get flattened automatically.

NameGenerator.py:

1. Load and flatten rules

The JSON file is parsed and any nested categories are flattened into direct lookup keys. If the file is missing or invalid, the generator stays uninitialized.

2. Generate names
Given an asset type and a base name, the class retrieves the corresponding prefix/suffix and produces the final name. If the asset type is unknown or inputs are invalid, the function handles the error safely and returns None.

3. Add custom rules
Users can inject new naming rules at runtime. Invalid custom rule definitions are caught and reported without interrupting execution.

The output shows the system behaving correctly in every case: initialization, JSON parsing, rule flattening, name generation, custom rule override, and exception handling.

P4V:




No comments:

Post a Comment