mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
*** empty log message ***
This commit is contained in:
parent
1f4adc9a97
commit
bc583add45
@ -40,19 +40,30 @@ class DirectCameraControl(PandaObject):
|
||||
# And then spawn task to determine mouse mode
|
||||
numEntries = self.direct.iRay.pickGeom(
|
||||
render,chan.mouseX,chan.mouseY)
|
||||
# Filter out hidden nodes from entry list
|
||||
indexList = []
|
||||
for i in range(0,numEntries):
|
||||
entry = self.direct.iRay.cq.getEntry(i)
|
||||
node = entry.getIntoNode()
|
||||
if node.isHidden():
|
||||
pass
|
||||
else:
|
||||
# Not one of the widgets, use it
|
||||
indexList.append(i)
|
||||
coa = Point3(0)
|
||||
if(numEntries):
|
||||
if(indexList):
|
||||
# Start off with first point
|
||||
minPt = 0
|
||||
minPt = indexList[0]
|
||||
# Find hit point in camera's space
|
||||
hitPt = self.direct.iRay.camToHitPt(minPt)
|
||||
coa.set(hitPt[0],hitPt[1],hitPt[2])
|
||||
coaDist = Vec3(coa - self.zeroPoint).length()
|
||||
# Check other intersection points, sorting them
|
||||
# TBD: Use TBS C++ function to do this
|
||||
if numEntries > 1:
|
||||
for i in range(1,numEntries):
|
||||
hitPt = self.direct.iRay.camToHitPt(i)
|
||||
if len(indexList) > 1:
|
||||
for i in range(1,len(indexList)):
|
||||
entryNum = indexList[i]
|
||||
hitPt = self.direct.iRay.camToHitPt(entryNum)
|
||||
dist = Vec3(hitPt - self.zeroPoint).length()
|
||||
if (dist < coaDist):
|
||||
coaDist = dist
|
||||
|
@ -59,7 +59,7 @@ class DirectGrid(NodePath,PandaObject):
|
||||
self.ignore('selectedNodePath')
|
||||
|
||||
def selectGridBackParent(self, nodePath):
|
||||
if nodePath.getNodePathName() == 'GridBack':
|
||||
if nodePath.getName() == 'GridBack':
|
||||
self.direct.select(self)
|
||||
|
||||
def updateGrid(self):
|
||||
|
@ -97,7 +97,7 @@ class DirectManipulationControl(PandaObject):
|
||||
return Task.done
|
||||
else:
|
||||
return Task.cont
|
||||
|
||||
|
||||
def manipulationStop(self):
|
||||
taskMgr.removeTasksNamed('manipulateObject')
|
||||
taskMgr.removeTasksNamed('manip-move-wait')
|
||||
@ -113,6 +113,8 @@ class DirectManipulationControl(PandaObject):
|
||||
for i in range(0,numEntries):
|
||||
entry = self.direct.iRay.cq.getEntry(i)
|
||||
node = entry.getIntoNode()
|
||||
if node.isHidden():
|
||||
pass
|
||||
# Is it a named node?, If so, see if it has a name
|
||||
if issubclass(node.__class__, NamedNode):
|
||||
name = node.getName()
|
||||
|
@ -10,7 +10,7 @@ class DirectNodePath(NodePath):
|
||||
NodePath.__init__(self)
|
||||
self.assign(nodePath)
|
||||
# Get a reasonable name
|
||||
self.name = self.getNodePathName()
|
||||
self.name = self.getName()
|
||||
# Create a bounding box
|
||||
self.bbox = DirectBoundingBox(self)
|
||||
center = self.bbox.getCenter()
|
||||
@ -308,7 +308,7 @@ class DirectBoundingBox:
|
||||
|
||||
def __repr__(self):
|
||||
return (`self.__class__` +
|
||||
'\nNodePath:\t%s\n' % self.nodePath.getNodePathName() +
|
||||
'\nNodePath:\t%s\n' % self.nodePath.getName() +
|
||||
'Min:\t\t%s\n' % self.vecAsString(self.min) +
|
||||
'Max:\t\t%s\n' % self.vecAsString(self.max) +
|
||||
'Center:\t\t%s\n' % self.vecAsString(self.center) +
|
||||
|
@ -8,7 +8,8 @@
|
||||
"""Returns the bottom node's this pointer as a unique id"""
|
||||
return self.getBottomArc()
|
||||
|
||||
def getNodePathName(self):
|
||||
def getName(self):
|
||||
"""Returns the name of the bottom node if it exists, or <noname>"""
|
||||
from PandaModules import *
|
||||
# Initialize to a default value
|
||||
name = '<noname>'
|
||||
@ -24,41 +25,49 @@
|
||||
|
||||
# For iterating over children
|
||||
def getChildrenAsList(self):
|
||||
"""Converts a node path's child NodePathCollection into a list"""
|
||||
childrenList = []
|
||||
for childNum in range(self.getNumChildren()):
|
||||
childrenList.append(self.getChild(childNum))
|
||||
return childrenList
|
||||
|
||||
def printChildren(self):
|
||||
"""Prints out the children of the bottom node of a node path"""
|
||||
for child in self.getChildrenAsList():
|
||||
print child.getNodePathName()
|
||||
print child.getName()
|
||||
|
||||
def toggleViz(self):
|
||||
"""Toggles visibility of a nodePath"""
|
||||
if self.isHidden():
|
||||
self.show()
|
||||
else:
|
||||
self.hide()
|
||||
|
||||
def showSiblings(self):
|
||||
"""Show all the siblings of a node path"""
|
||||
for sib in self.getParent().getChildrenAsList():
|
||||
if sib.node() != self.node():
|
||||
sib.show()
|
||||
|
||||
def hideSiblings(self):
|
||||
"""Hide all the siblings of a node path"""
|
||||
for sib in self.getParent().getChildrenAsList():
|
||||
if sib.node() != self.node():
|
||||
sib.hide()
|
||||
|
||||
def showAllDescendants(self):
|
||||
"""Show the node path and all its children"""
|
||||
self.show()
|
||||
for child in self.getChildrenAsList():
|
||||
child.showAllDescendants()
|
||||
|
||||
def isolate(self):
|
||||
"""Show the node path and hide its siblings"""
|
||||
self.showAllDescendants()
|
||||
self.hideSiblings()
|
||||
|
||||
def remove(self):
|
||||
"""Remove a node path from the scene graph"""
|
||||
from PandaObject import *
|
||||
# Send message in case anyone needs to do something
|
||||
# before node is deleted
|
||||
@ -68,15 +77,17 @@
|
||||
self.removeNode()
|
||||
|
||||
def reversels(self):
|
||||
"""Walk up a tree and print out the path to the root"""
|
||||
ancestry = self.getAncestry()
|
||||
indentString = ""
|
||||
for nodePath in ancestry:
|
||||
type = nodePath.node().getType().getName()
|
||||
name = nodePath.getNodePathName()
|
||||
name = nodePath.getName()
|
||||
print indentString + type + " " + name
|
||||
indentString = indentString + " "
|
||||
|
||||
def getAncestry(self):
|
||||
"""Get a list of a node path's ancestors"""
|
||||
from PandaObject import *
|
||||
node = self.node()
|
||||
if (self.hasParent()):
|
||||
|
@ -381,6 +381,7 @@ class LevelEditor(NodePath, PandaObject):
|
||||
self.ignore('manipulateObjectCleanup')
|
||||
self.ignore('SGESelectNodePath')
|
||||
self.ignore('SGEIsolateNodePath')
|
||||
self.ignore('SGEToggle VizNodePath')
|
||||
self.ignore('SGESet ParentNodePath')
|
||||
self.ignore('SGEAdd GroupNodePath')
|
||||
self.ignore('showAll')
|
||||
@ -460,8 +461,9 @@ class LevelEditor(NodePath, PandaObject):
|
||||
self.accept('setNodePathName', self.setNodePathName)
|
||||
self.accept('manipulateObjectCleanup', self.updateSelectedPose)
|
||||
self.accept('SGESelectNodePath', self.selectNodePath)
|
||||
self.accept('SGESelectNodePath', self.preSelectNodePath)
|
||||
self.accept('SGEFlashNodePath', self.preSelectNodePath)
|
||||
self.accept('SGEIsolateNodePath', self.isolateNodePath)
|
||||
self.accept('SGEToggle VizNodePath', self.toggleNodePathViz)
|
||||
self.accept('SGESet ParentNodePath', self.setGroupParent)
|
||||
self.accept('SGEAdd GroupNodePath', self.addGroupToSelected)
|
||||
self.accept('showAll', self.showAll)
|
||||
@ -657,7 +659,7 @@ class LevelEditor(NodePath, PandaObject):
|
||||
|
||||
def selectDNARoot(self, aNodePath):
|
||||
# If this isn't a root object see if one exists above it
|
||||
if (aNodePath.getNodePathName()[-8:] != '_DNARoot'):
|
||||
if (aNodePath.getName()[-8:] != '_DNARoot'):
|
||||
dnaRoot = self.getDNARoot(aNodePath)
|
||||
# Is this a DNA object?
|
||||
if dnaRoot:
|
||||
@ -668,7 +670,7 @@ class LevelEditor(NodePath, PandaObject):
|
||||
if ((aNodePath.node() == render.node()) |
|
||||
(aNodePath.node() == hidden.node())):
|
||||
return 0
|
||||
name = aNodePath.getNodePathName()
|
||||
name = aNodePath.getName()
|
||||
if (name[-8:] == '_DNARoot'):
|
||||
return aNodePath
|
||||
else:
|
||||
@ -920,6 +922,9 @@ class LevelEditor(NodePath, PandaObject):
|
||||
else:
|
||||
self.levelMap.reparentTo(hidden)
|
||||
|
||||
def toggleNodePathViz(self, aNodePath):
|
||||
pass
|
||||
|
||||
def setXyzSnap(self, flag):
|
||||
self.grid.setXyzSnap(flag)
|
||||
if flag:
|
||||
@ -3199,7 +3204,8 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
||||
self.sceneGraphExplorer = SceneGraphExplorer(
|
||||
parent = sceneGraphPage,
|
||||
root = self.levelEditor.getLevelObjects(),
|
||||
menuItems = ['Select', 'Isolate', 'Set Parent', 'Add Group'])
|
||||
menuItems = ['Select', 'Isolate', 'Flash',
|
||||
'Toggle Viz', 'Set Parent', 'Add Group'])
|
||||
self.sceneGraphExplorer.pack(expand = 1, fill = 'both')
|
||||
|
||||
def toggleGrid(self):
|
||||
|
@ -85,7 +85,7 @@ class SceneGraphExplorerItem(TreeItem):
|
||||
|
||||
def GetText(self):
|
||||
type = self.nodePath.node().getType().getName()
|
||||
name = self.nodePath.getNodePathName()
|
||||
name = self.nodePath.getName()
|
||||
return type + " " + name
|
||||
|
||||
def IsEditable(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user