-
Notifications
You must be signed in to change notification settings - Fork 3
/
problemlib.py
133 lines (113 loc) · 3.21 KB
/
problemlib.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# SPDX-FileCopyrightText: 2020-2024 Mikhail Rachinskiy
# SPDX-License-Identifier: GPL-3.0-or-later
from typing import NamedTuple
TYPE_ERROR = 1
TYPE_WARN = 2
# Object
ID_OB_SCALE = 101
ID_OB_EMPTY = 102
# Relations
ID_MOD_ORDER = 201
ID_CYCLIC_DEP = 202
# Object Data
ID_CURVE_RADIUS = 301
ID_CURVE_ORDER = 302
ID_CURVE_RESOLUTION = 303
# Scene
ID_COLLECTION_NAME = 401
class Problem(NamedTuple):
code: int
type: int
title: str
desc: str
select: bool = True
ObjectScale = Problem(
ID_OB_SCALE,
TYPE_ERROR,
"Scaled object",
(
"Object scaling could lead to unexpected results when using certain tools and modifiers."
"\n\nRecommendation: if you did not set object scale on purpose use Object > Apply > Scale."
),
)
ObjectEmpty = Problem(
ID_OB_EMPTY,
TYPE_WARN,
"Empty object",
(
"Mesh or curve object missing object data."
"\n\nRecommendation: delete empty objects."
),
)
ModOrder = Problem(
ID_MOD_ORDER,
TYPE_ERROR,
"Modifier order is incorrect",
(
"Generally Subdivision modifier should be placed before boolean or deform modifiers. Example:"
"\n* Mirror"
"\n* Subdivision"
"\n* Lattice"
"\n* Curve"
"\n* Boolean"
"\n\nRecommendation: place Subdivision modifier before boolean and deform modifiers, "
"unless you did it on purpose to achieve specific result."
),
)
CyclicDep = Problem(
ID_CYCLIC_DEP,
TYPE_ERROR,
"Cyclic dependency",
(
"Using the same object as a target for Shrinkwrap and Boolean modifiers creates cyclic dependency."
"\n\nRecommendation: use a duplicate object without Boolean modifier as a target in Shrinkwrap modifier."
),
)
CurveRadius = Problem(
ID_CURVE_RADIUS,
TYPE_ERROR,
"Curve Radius deformation",
(
"Curve Radius scales objects deformed by Curve modifier."
"\n\nRecommendation: disable curve Radius property, unless you are using it on purpose."
),
)
CurveOrder = Problem(
ID_CURVE_ORDER,
TYPE_ERROR,
"Curve low Order",
(
"Low Order property makes curve shape angular."
"\n\nRecommendation: set Object Data > Active Spline > Order U property to 5, "
"if you need angular curve, then you better off using Bezier curves."
),
)
CurveResolution = Problem(
ID_CURVE_RESOLUTION,
TYPE_ERROR,
"Curve low Resolution",
(
"Low Resolution property makes deformed object look low poly regardless of its polycount."
"\n\nRecommendation: set Object Data > Shape > Resolution Preview U property to a greater value."
),
)
CollectionName = Problem(
ID_COLLECTION_NAME,
TYPE_WARN,
"Collection uses default name",
(
"Default collection names make it difficult to understand scene hierarchy for other people and yourself."
"\n\nRecommendation: give descriptive names to all collections."
),
False,
)
coll = {
ObjectScale.code: ObjectScale,
ObjectEmpty.code: ObjectEmpty,
ModOrder.code: ModOrder,
CyclicDep.code: CyclicDep,
CurveRadius.code: CurveRadius,
CurveOrder.code: CurveOrder,
CurveResolution.code: CurveResolution,
CollectionName.code: CollectionName,
}