Fix generation of recipe.
Modeling object can be removed by the garment collector. In this case the recipe generator will complain about a missed object. We can happily ignore this case if we deal with modeling object.
This commit is contained in:
parent
8eac0d5c66
commit
0483dd508e
|
@ -66,3 +66,15 @@ VToolRecord &VToolRecord::operator=(const VToolRecord &record)
|
|||
VToolRecord::VToolRecord(const VToolRecord &record)
|
||||
:id(record.getId()), typeTool(record.getTypeTool()), nameDraw(record.getNameDraw())
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VToolRecord::IsMandatory() const
|
||||
{
|
||||
return typeTool != Tool::Pin
|
||||
&& typeTool != Tool::NodePoint
|
||||
&& typeTool != Tool::NodeArc
|
||||
&& typeTool != Tool::NodeElArc
|
||||
&& typeTool != Tool::NodeSpline
|
||||
&& typeTool != Tool::NodeSplinePath
|
||||
&& typeTool != Tool::PiecePath;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
QString getNameDraw() const;
|
||||
void setNameDraw(const QString &value);
|
||||
|
||||
bool IsMandatory() const;
|
||||
|
||||
private:
|
||||
/** @brief id tool id. */
|
||||
quint32 id;
|
||||
|
|
|
@ -286,7 +286,7 @@ QDomElement VPatternRecipe::Step(const VToolRecord &tool)
|
|||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in history.");
|
||||
|
||||
const QDomElement domElem = m_pattern->elementById(tool.getId());
|
||||
if (not domElem.isElement())
|
||||
if (not domElem.isElement() && tool.IsMandatory())
|
||||
{
|
||||
throw VExceptionInvalidHistory(tr("Can't find element by id '%1'").arg(tool.getId()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user