Fixed rotation arrow rendering bug, fixed waypoint path bounding boxes not updating when the waypoints are transformed, fixed clone selection and paste nodes commands not properly notifying linked instances of their links being modified

This commit is contained in:
parax0 2016-03-21 16:01:14 -06:00
parent 0faa4c3630
commit 9d782f5a4c
7 changed files with 40 additions and 8 deletions

View File

@ -247,6 +247,9 @@ void CScriptNode::DrawSelection()
CGraphics::sMVPBlock.ModelMatrix = Transform.ToMatrix4f();
CGraphics::UpdateMVPBlock();
CGraphics::sPixelBlock.TintColor = CColor::skWhite;
CGraphics::UpdatePixelBlock();
DrawRotationArrow();
}

View File

@ -138,6 +138,17 @@ void CWaypointExtra::GetLinkedWaypoints(std::list<CWaypointExtra*>& rOut)
}
}
void CWaypointExtra::OnTransformed()
{
for (u32 iLink = 0; iLink < mLinks.size(); iLink++)
{
SWaypointLink& rLink = mLinks[iLink];
rLink.LineAABB = CAABox::skInfinite;
rLink.LineAABB.ExpandBounds(AbsolutePosition());
rLink.LineAABB.ExpandBounds(rLink.pWaypoint->AbsolutePosition());
}
}
void CWaypointExtra::LinksModified()
{
BuildLinks();

View File

@ -29,6 +29,7 @@ public:
bool IsPathLink(CLink *pLink);
void GetLinkedWaypoints(std::list<CWaypointExtra*>& rOut);
void OnTransformed();
void LinksModified();
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
void Draw(FRenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);

View File

@ -10,7 +10,21 @@ CCloneSelectionCommand::CCloneSelectionCommand(INodeEditor *pEditor)
for (CSelectionIterator It(mpEditor->Selection()); It; ++It)
{
if (It->NodeType() == eScriptNode)
{
mNodesToClone << *It;
// Fetch linked objects
CScriptNode *pScript = static_cast<CScriptNode*>(*It);
CScriptObject *pInst = pScript->Object();
for (u32 iLink = 0; iLink < pInst->NumLinks(eOutgoing); iLink++)
{
CScriptNode *pNode = mpEditor->Scene()->NodeForObject(pInst->Link(eOutgoing, iLink)->Receiver());
if (!pNode->IsSelected())
mLinkedInstances << pNode->Object();
}
}
}
}
@ -30,6 +44,7 @@ void CCloneSelectionCommand::undo()
}
mClonedNodes.clear();
mpEditor->OnLinksModified(mLinkedInstances.DereferenceList());
mpEditor->Selection()->SetSelectedNodes(mOriginalSelection.DereferenceList());
}
@ -65,8 +80,6 @@ void CCloneSelectionCommand::redo()
}
// Clone outgoing links from source object; incoming ones are discarded
QList<CScriptObject*> LinkedInstances;
for (int iNode = 0; iNode < ClonedNodes.size(); iNode++)
{
CScriptObject *pSrc = static_cast<CScriptNode*>(ToClone[iNode])->Object();
@ -84,11 +97,6 @@ void CCloneSelectionCommand::redo()
CLink *pCloneLink = new CLink(pSrcLink->Area(), pSrcLink->State(), pSrcLink->Message(), pClone->InstanceID(), ReceiverID);
pCloneLink->Sender()->AddLink(eOutgoing, pCloneLink);
pCloneLink->Receiver()->AddLink(eIncoming, pCloneLink);
if (!LinkedInstances.contains(pCloneLink->Sender()))
LinkedInstances << pCloneLink->Sender();
if (!LinkedInstances.contains(pCloneLink->Receiver()))
LinkedInstances << pCloneLink->Receiver();
}
}
@ -96,6 +104,6 @@ void CCloneSelectionCommand::redo()
foreach (CSceneNode *pNode, ClonedNodes)
pNode->OnLoadFinished();
mpEditor->OnLinksModified(LinkedInstances);
mpEditor->OnLinksModified(mLinkedInstances.DereferenceList());
mpEditor->Selection()->SetSelectedNodes(mClonedNodes.DereferenceList());
}

View File

@ -11,6 +11,7 @@ class CCloneSelectionCommand : public IUndoCommand
CNodePtrList mOriginalSelection;
CNodePtrList mNodesToClone;
CNodePtrList mClonedNodes;
CInstancePtrList mLinkedInstances;
public:
CCloneSelectionCommand(INodeEditor *pEditor);

View File

@ -34,6 +34,8 @@ void CPasteNodesCommand::undo()
mpEditor->NotifyNodeDeleted();
}
mpEditor->OnLinksModified(mLinkedInstances.DereferenceList());
mLinkedInstances.clear();
mPastedNodes.clear();
}
@ -112,6 +114,9 @@ void CPasteNodesCommand::redo()
delete pLink;
iLink--;
}
else
mLinkedInstances << pLink->Receiver();
}
}
}
@ -123,5 +128,7 @@ void CPasteNodesCommand::redo()
pNode->OnLoadFinished();
mpEditor->Selection()->SetSelectedNodes(PastedNodes);
mpEditor->OnLinksModified(mLinkedInstances.DereferenceList());
mPastedNodes = PastedNodes;
}

View File

@ -15,6 +15,7 @@ class CPasteNodesCommand : public IUndoCommand
CNodeCopyMimeData *mpMimeData;
CNodePtrList mPastedNodes;
CNodePtrList mOriginalSelection;
CInstancePtrList mLinkedInstances;
public:
CPasteNodesCommand(CWorldEditor *pEditor, CScriptLayer *pLayer, CVector3f PastePoint);