ezEngine Release 26.9
Loading...
Searching...
No Matches
ezAssetCheckRule Class Referenceabstract

#include <AssetCheckRule.h>

Inheritance diagram for ezAssetCheckRule:

Public Member Functions

virtual ezStringView GetDisplayName () const =0
 
virtual ezStringView GetDescription () const =0
 
virtual bool CanFix () const
 Whether the rule can fix the issues it reports. If false, auto-fix has no effect for it.
 
virtual bool AppliesToDocumentType (ezStringView sDocumentTypeName) const
 Whether the rule should run on documents of the given type. Defaults to all types.
 
virtual void CheckDocument (ezAssetCheckContext &ref_ctx)
 
- Public Member Functions inherited from ezReflectedClass
virtual const ezRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const ezRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
EZ_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Static Public Member Functions

static void CreateRules (ezDynamicArray< ezAssetCheckRule * > &out_rules)
 Allocates one instance of every reflected, allocatable rule type, sorted by display name.
 
static void DestroyRules (ezDynamicArray< ezAssetCheckRule * > &ref_rules)
 
- Static Public Member Functions inherited from ezNoBase
static const ezRTTIGetStaticRTTI ()
 

Protected Member Functions

virtual void CheckObject (ezAssetCheckContext &ref_ctx, const ezDocumentObject *pObject)
 
virtual void CheckProperty (ezAssetCheckContext &ref_ctx, const ezDocumentObject *pObject, const ezAbstractProperty *pProp)
 

Static Protected Member Functions

static ezResult GetPropertyValues (ezObjectAccessorBase *pAcc, const ezDocumentObject *pObject, const ezAbstractProperty *pProp, ezDynamicArray< ezVariant > &out_indices, ezDynamicArray< ezVariant > &out_values)
 

Detailed Description

Base class for asset check rules.

Derive in any editor plugin (with EZ_ADD_DYNAMIC_REFLECTION and a default allocator) and the rule is auto-discovered via reflection. A rule inspects an open document and reports issues, optionally fixing them when auto-fix is enabled.

Member Function Documentation

◆ AppliesToDocumentType()

virtual bool ezAssetCheckRule::AppliesToDocumentType ( ezStringView  sDocumentTypeName) const
inlinevirtual

Whether the rule should run on documents of the given type. Defaults to all types.

Reimplemented in ezEmptyGameObjectAssetCheckRule.

◆ CanFix()

virtual bool ezAssetCheckRule::CanFix ( ) const
inlinevirtual

Whether the rule can fix the issues it reports. If false, auto-fix has no effect for it.

Reimplemented in ezUnknownTagsAssetCheckRule, and ezEmptyGameObjectAssetCheckRule.

◆ CheckDocument()

void ezAssetCheckRule::CheckDocument ( ezAssetCheckContext ref_ctx)
virtual

Inspects the document and reports all issues via ref_ctx.ReportIssue.

The default implementation visits the document's root object and every object below it and calls CheckObject for each (child objects reached through properties marked with ezTemporaryAttribute are skipped). Rules that follow this per-object / per-property structure only need to override CheckObject or CheckProperty. Override CheckDocument itself to replace the traversal entirely.

If ref_ctx.IsAutoFixAllowed() is true, the rule also fixes the issues through ref_ctx.GetObjectAccessor() and reports them with bFixed = true. The runner manages the undo transaction, so implementations must not call Start/Finish/CancelTransaction.

Reimplemented in ezEmptyGameObjectAssetCheckRule.

◆ CheckObject()

void ezAssetCheckRule::CheckObject ( ezAssetCheckContext ref_ctx,
const ezDocumentObject pObject 
)
protectedvirtual

Inspects a single object as part of the default CheckDocument traversal.

The default iterates all of the object's properties, skipping those marked with ezTemporaryAttribute, and calls CheckProperty for each. Child objects are visited separately by the traversal and must not be recursed into here.

Reimplemented in ezEmptyGameObjectAssetCheckRule.

◆ CheckProperty()

void ezAssetCheckRule::CheckProperty ( ezAssetCheckContext ref_ctx,
const ezDocumentObject pObject,
const ezAbstractProperty pProp 
)
protectedvirtual

Inspects a single property of an object. The default does nothing.

Called for Member, Array, Set and Map properties alike. Use GetPropertyValues to read the contained element values without having to special-case the property category.

Reimplemented in ezUnknownTagsAssetCheckRule, and ezRequiredPropertyAssetCheckRule.

◆ GetPropertyValues()

ezResult ezAssetCheckRule::GetPropertyValues ( ezObjectAccessorBase pAcc,
const ezDocumentObject pObject,
const ezAbstractProperty pProp,
ezDynamicArray< ezVariant > &  out_indices,
ezDynamicArray< ezVariant > &  out_values 
)
staticprotected

Reads all element values of a property, regardless of its category.

Member properties yield their single value; Array and Set properties yield all elements; Map properties yield all values. out_indices receives the index/key that addresses each value, usable with ezObjectAccessorBase::RemoveValue and related functions; for Member properties it is an invalid ezVariant. Returns EZ_FAILURE for categories that hold no readable values (such as pointer properties, whose targets are visited as separate child objects).


The documentation for this class was generated from the following files: