Rules and Issues

Rule

These are definitions of rules or checks against your Blender file. Any violations will be listed as issues.

class blint.model.lint_rule.LintRule(*args, **kwargs)

Model class for BLint rule properties. Used for displaying within a UI list. BLint rules are violations that may be seen in the Blender file that can be fixed.

enabled: bpy.props.BoolProperty(name='Enabled', default=True)

If rule is enabled by default.

description: bpy.props.StringProperty(name='Description', default='')

Describes the issue based on its rule.

severity_icon: bpy.props.EnumProperty(name='Severity', default='INFO', items=get_severity_enum())

Name of Blender icon to represent severity.

category_icon: bpy.props.EnumProperty(name='Category', default='SCENE_DATA', items=get_icon_enum())

Name of Blender icon to represent the category of the issue’s rule (meshes, animation, etc.).

iterable_expr: bpy.props.StringProperty(name='Data iteration type', description='Python expression representing Blender data containing elements with potential issues', default='bpy.data.scenes')

String of Python code that evaluates to a list of properties. Optional.

If provided, multiple issues can be found from one rule.

iterable_var: bpy.props.StringProperty(name='Variable', description='Variable name to reference data iteration element', default='my_scene')

Required if iterable_expr is defined.

If provided, any instance of iterable_var in issue_expr, fix_expr or prop_label_expr will be replaced with the value of iterable_expr.

issue_expr: bpy.props.StringProperty(name='Issue', description='Python expression that returns true if issue exists (can reference data iteration variable)', default='')

Optional. Python statement(s) that fix(es) the issue.

A rule should only have a fix that will always work (no errors), is always what the user would want, and will remove the issue from the panel.

fix_expr: bpy.props.StringProperty(name='Fix', description='Statement(s) to fix the issue (can reference data iteration variable)', default='')

String representation of Python code that will fix the issue.

prop_label_expr: bpy.props.StringProperty(name='Issue identifier', description='Python expression to further identify issuein its description (can reference data iteration variable)', default='')

Python expression that evaluates to an identifying label used with the issue description in the UI.

check_for_errors()

Validates LintRule properties.

Returns a list of errors to fix to make the LintRule valid.

Return type:

list[str]

copy(other_rule)

Copies self’s properties to another rule, and returns the other rule.

Parameters:

other_rule (LintRule) – target rule to have properties applied and then returned.

Return type:

LintRule

get_list_str()

Generates a list of data items that violate the LintRule.

Returns Python code to represent a Python list of LintIssue items.

Return type:

str

generate_fix(idx=-1)

Generates and returns a Python statement to fix a LintIssue instance of a rule.

Parameters:

idx (int) – element index within the issue list.

Return type:

str

generate_description(idx=-1)

Generates and returns a Python statement to fix a LintIssue instance of a rule.

Parameters:

idx (int) – element index within the issue list.

Return type:

str

get_iterative_list()

Evaluates get_list_str() and returns a list to iterate for displaying and fixing issues.

Return type:

list

does_issue_exist()

Returns True if any issues exist that violate the rule, False otherwise.

Return type:

bool

get_ui_identifier()

Retrieves a string-based data property that contains the rule violation.

Return type:

str

draw(layout)

Draws rule in a panel.

get_issues()

Generates and returns a list of issues that violate rules.

Return type:

list[dict]

Issue

These are instances of rule violations in your Blender file.

Model class for BLint issue property groups. Issues are instances of rule violations seen in the Blender file.

class blint.model.lint_issue.LintIssue(*args, **kwargs)

Model class for BLint issue properties. Used for displaying within a UI list.

BLint issues are instances of LintRule violations seen in the Blender file.

description: StringProperty

Describes the issue based on its rule.

severity_icon: EnumProperty

Name of Blender icon to represent severity.

category_icon: EnumProperty

Name of Blender icon to represent the category of the issue’s rule (meshes, animation, etc.).

fix_expr: StringProperty

String representation of Python code that will fix the issue.

rule_file: StringProperty

Path to rule file containing fix.

draw(layout)

Draws the issue in a panel.

blint.model.lint_issue.get_sort_value(issue)

Utility function generating a sort value for an issue based on its rule’s severity.

Parameters:

issue (LintIssue) – LintIssue property

Return type:

int