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