Added grid snapping support for drag/drop object creation

This commit is contained in:
Gyedo Jeon 2010-04-07 18:30:14 +00:00
parent 06167a0ec7
commit 36956aed7b
1 changed files with 5 additions and 0 deletions

View File

@ -79,6 +79,11 @@ class PandaTextDropTarget(wx.TextDropTarget):
# create a temp nodePath to get the position
np = NodePath('temp')
np.setPos(self.view.camera, hitPt)
if base.direct.manipulationControl.fGridSnap:
snappedPos = self.view.grid.computeSnapPoint(np.getPos())
np.setPos(snappedPos)
# update temp nodePath's HPR and scale with newobj's
np.setHpr(newobj.getHpr())
np.setScale(newobj.getScale())