Skip to content

1.Writing Rules

1. Naming Check

For the naming check of resources, it will first perform a global naming check and then perform its own naming check.

Example: StaticMesh 'S_aaa' will first perform the global check (whether it contains Chinese characters, special symbols), and then perform the StaticMesh check (whether it starts with S_ )

You can refer to this use case to design a naming check solution suitable for your own project team.

By default, all resources need to go through the naming check, so CheckName is not a separate subclass of IRule, but an inherent function of IObjectRules.

image-20220512114644286

All method sets can realize the function of naming check through the Override CheckName method. If it is not realized or not needed, it can directly return true. (The naming check is passed).

Example: The corresponding class is UBlueprint, with BP_ as the prefix of the name. The naming check declaration is in the BlueprintRules.h file, and the function implementation is as follows.

image-20220512114706082

Some common naming checks can be implemented through GlobalRules::CheckName.

For example, Chinese characters and special symbols cannot be included in the naming, which is a common requirement.

At present, there are some default naming settings, which can be modified if they do not meet the project requirement.

2. Writing New Rules (C++)

In Example Rules, you can see what kind of style the rule content is, so how can we make this rule valid and function correctly in our check?

Here, we're still taking the previous rule of "empty check StaticMesh of StaticMeshComponent in Blueprint" as an example.

Declaration

First of all, we declare this rule, and that the position of declaration is the resource you want to apply the rule on. The above is the Blueprint

image-20220512113240793

Declare a constructor, and a RuleCheck function.

Constructor

The constructor needs to include the RuleName, which is used to receive the rule name from ArtEase, and enable the switching of controlling rules on ArtEase.

bActiveStatus is the default activation status of the rule, which is generally considered to be false.

image-20220512113431050

RuleCheck Function

Please refer to Example Rules to see this function. You need to pay attention to 3 variables

Object, the incoming resource to be checked

InOutLog, the output log; if you need to return a new log prompt, just directly use InOutLog += (rule content).

bPass, check the result. You can also return true/false directly.

Add to Rule Set

Add the rule class to the corresponding position, so that you can run it smoothly every time according to ArtEase's rule switching.

image-20220512113505491

3. Writing New Rules (Python)

Writing Python rules is different from C++. The advantage is that it can take effect in real time and does not need to modify the DLL file, so it is highly recommended to write in this way.

The writing of Python rules is completely placed on ArtEase, which supports Unreal native-Python and Unreal Engine Python. The following uses native Python as an example.

How to create a new Python rule

image-20220512113641296

Writing the rule content

image-20220512113721733

bPass is the check result

OutputLog is the output log

Asset is the resource to be checked

The content of the above rule is , when the LOD number of a StaticMesh resource is less than 1, it fails the check.

Saving such a resource will prompt

image-20220512113751952

image-20220512113814274

4. Example Rules

At present, some rules have been implemented, which are for ease of reference. The following is an expansion of one rule of BlueprintRules, and the others will only be briefly introduced.

BlueprintRules

The corresponding class is UBlueprint, with BP_ as the prefix of the name.

Currently, it supports: a. checking whether StaticMesh of StaticMeshComponent in Blueprint is empty or not; and b. whether DrawDistance is set or not. See the image below for the implementation.

image-20220512112432840

The final Return bPass is the check result (true means pass, false means fail)

InOutLog is a check prompt, which is used for local saving and pop-up window prompts.

When the above rules are in effect, if I add a StaticMeshComponent that does not comply with the rules in the Blueprint, there will be a "StaticMesh is empty" prompt.

image-20220512112515260

At the same time, the log as shown in the image below will be saved locally.

image-20220512112548087

FoliageTypeRules

The corresponding class is UFoliageType, with no naming requirements

Currently supports checking whether CullDistance is set or not.

LandscapeGrassRules

The corresponding class is ULandscapeGrassType, with no naming requirements

Currently supports checking whether CullDistance is set or not.

MaterialRules

The corresponding class is UMaterial, which starts with M. UMaterialInstance starts with MI. UPhysicalMaterial starts with PM.

Currently, it supports UMaterialInterface (the parent class of UMaterial and UMaterialInstance) to check for empty reference textures and UMaterial path checks.

ParticleSystemRules

The corresponding class is UParticleSystem, which starts with P_.

Currently, it supports checking the number of particles in LOD0, and the default upper limit is 200.

SkeletalMeshRules

The corresponding class is USkeletalMesh, which starts with SK_.

Currently, it can check the step-by-step reduction of the number of faces/vertices of SK, the step-by-step reduction of ScreenSize, and the situation of referencing Default material/material is empty/material repeated.

StaticMeshRules

The corresponding class is UStaticMesh, which starts with S_.

Currently, it can check the step-by-step reduction of the number of faces/vertices of StaticMesh, the number of UV channels, and the situation of referencing Default material/material is empty/material repeated.

WorldRules

The corresponding class is UWorld (that is, a Map file), which starts with Map_.

At present, it supports checking the StaticMeshComponent of World and the DrawDistance of HISMComponent (the ISM Component is not checked, it can be implemented by itself). Note that the check of BP is skipped here, because the DrawDistance of BP is generally set in the BP resource, and it will override when dragged into the scene. You can modify it yourself if necessary.

LevelBounds size check (default is 33000, a square with a length and width of 330 meters). Lightmap size check in WorldSettings (default is 2048)

The above are all supported categories.