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 */
GOType type;
/** @brief idObject id of parent object. Only for modeling. All another return 0. */
/** @brief idObject id of parent object. */
quint32 idObject;
/** @brief _name object name */

View File

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

View File

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