Fix bug in copy piece tool.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-01-24 16:50:25 +02:00
parent 114bdfe9dd
commit f78f191843
3 changed files with 17 additions and 2 deletions

View File

@ -61,7 +61,7 @@ public:
/** @brief type type of graphical object */ /** @brief type type of graphical object */
GOType type; GOType type;
/** @brief idObject id of parent object. Only for modeling. All another return 0. */ /** @brief idObject id of parent object. */
quint32 idObject; quint32 idObject;
/** @brief _name object name */ /** @brief _name object name */

View File

@ -73,6 +73,8 @@ public:
ParentType GetParentType() const; ParentType GetParentType() const;
void SetParentType(const ParentType &value); void SetParentType(const ParentType &value);
quint32 GetIdTool() const;
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE; virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
bool IsExluded() const; bool IsExluded() const;
@ -101,4 +103,10 @@ private:
Q_DISABLE_COPY(VAbstractNode) Q_DISABLE_COPY(VAbstractNode)
}; };
//---------------------------------------------------------------------------------------------------------------------
inline quint32 VAbstractNode::GetIdTool() const
{
return idTool;
}
#endif // VABSTRACTNODE_H #endif // VABSTRACTNODE_H

View File

@ -1898,6 +1898,8 @@ quint32 VToolSeamAllowance::DuplicateNode(const VPieceNode &node, const VToolSea
SCASSERT(initData.data != nullptr) SCASSERT(initData.data != nullptr)
const QSharedPointer<VGObject> gobj = initData.data->GetGObject(node.GetId()); const QSharedPointer<VGObject> gobj = initData.data->GetGObject(node.GetId());
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(node.GetId()));
SCASSERT(tool != nullptr)
VAbstractNodeInitData initNodeData; VAbstractNodeInitData initNodeData;
initNodeData.idObject = gobj->getIdObject(); initNodeData.idObject = gobj->getIdObject();
@ -1907,6 +1909,7 @@ quint32 VToolSeamAllowance::DuplicateNode(const VPieceNode &node, const VToolSea
initNodeData.typeCreation = Source::FromGui; initNodeData.typeCreation = Source::FromGui;
initNodeData.scene = initData.scene; initNodeData.scene = initData.scene;
initNodeData.drawName = initData.drawName; initNodeData.drawName = initData.drawName;
initNodeData.idTool = tool->GetIdTool();
switch (node.GetTypeTool()) switch (node.GetTypeTool())
{ {
@ -1940,13 +1943,16 @@ quint32 VToolSeamAllowance::DuplicateNode(const VPieceNode &node, const VToolSea
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
quint32 VToolSeamAllowance::DuplicatePiecePath(quint32 id, const VToolSeamAllowanceInitData &initData) quint32 VToolSeamAllowance::DuplicatePiecePath(quint32 id, const VToolSeamAllowanceInitData &initData)
{ {
VPiecePath path = initData.data->GetPiecePath(id); const VPiecePath path = initData.data->GetPiecePath(id);
VPiecePath newPath = path; VPiecePath newPath = path;
QMap<quint32, quint32> recordReplacements; // Not used QMap<quint32, quint32> recordReplacements; // Not used
newPath.SetNodes(DuplicateNodes(path, initData, recordReplacements)); newPath.SetNodes(DuplicateNodes(path, initData, recordReplacements));
const quint32 idPath = initData.data->AddPiecePath(newPath); const quint32 idPath = initData.data->AddPiecePath(newPath);
VAbstractNode *tool = qobject_cast<VAbstractNode *>(VAbstractPattern::getTool(id));
SCASSERT(tool != nullptr)
VToolPiecePathInitData initNodeData; VToolPiecePathInitData initNodeData;
initNodeData.id = idPath; initNodeData.id = idPath;
initNodeData.idObject = NULL_ID; // piece id initNodeData.idObject = NULL_ID; // piece id
@ -1956,6 +1962,7 @@ quint32 VToolSeamAllowance::DuplicatePiecePath(quint32 id, const VToolSeamAllowa
initNodeData.parse = Document::FullParse; initNodeData.parse = Document::FullParse;
initNodeData.typeCreation = Source::FromTool; initNodeData.typeCreation = Source::FromTool;
initNodeData.drawName = initData.drawName; initNodeData.drawName = initData.drawName;
initNodeData.idTool = tool->GetIdTool();
initNodeData.path = newPath; initNodeData.path = newPath;
VToolPiecePath::Create(initNodeData); VToolPiecePath::Create(initNodeData);