mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Added direct light mode to enable selection via mouse click
This commit is contained in:
parent
81b91d8522
commit
25e98200a3
@ -204,6 +204,24 @@ class DirectSession(PandaObject):
|
||||
# Set flag
|
||||
self.fEnabled = 1
|
||||
|
||||
def enableLight(self):
|
||||
if self.fEnabled:
|
||||
return
|
||||
# Make sure old tasks are shut down
|
||||
self.disable()
|
||||
# Start all display region context tasks
|
||||
self.drList.spawnContextTask()
|
||||
# Turn on object manipulation
|
||||
self.manipulationControl.enableManipulation()
|
||||
# Make sure list of selected items is reset
|
||||
self.deselectAll()
|
||||
self.selected.reset()
|
||||
# Accept appropriate hooks
|
||||
self.enableMouseEvents()
|
||||
self.enableActionEvents()
|
||||
# Set flag
|
||||
self.fEnabled = 1
|
||||
|
||||
def disable(self):
|
||||
# Shut down all display region context tasks
|
||||
self.drList.removeContextTask()
|
||||
|
@ -38,6 +38,8 @@ class privNodePathImpl(NodePath.NodePath):
|
||||
def __init__(self, name):
|
||||
node = hidden.attachNewNode(name)
|
||||
NodePath.NodePath.__init__(self, node)
|
||||
if __debug__:
|
||||
self.setTag('entity', '1')
|
||||
|
||||
def initNodePathAttribs(self):
|
||||
"""Call this after the entity has been initialized, and all
|
||||
@ -48,6 +50,8 @@ class privNodePathImpl(NodePath.NodePath):
|
||||
self.level.requestReparent(self, self.parent)
|
||||
|
||||
def destroy(self):
|
||||
if __debug__:
|
||||
self.clearTag('entity')
|
||||
self.removeNode()
|
||||
|
||||
def getNodePath(self):
|
||||
|
@ -161,6 +161,17 @@ class TreeNode:
|
||||
fraction = float(fraction) / y1
|
||||
self.canvas.yview_moveto(fraction)
|
||||
|
||||
def reveal(self):
|
||||
parent = self.parent
|
||||
while parent:
|
||||
if parent.state == 'collapsed':
|
||||
parent.state = 'expanded'
|
||||
parent = parent.parent
|
||||
else:
|
||||
break
|
||||
self.update()
|
||||
self.view()
|
||||
|
||||
def lastvisiblechild(self):
|
||||
if self.kidKeys and self.state == 'expanded':
|
||||
return self.children[self.kidKeys[-1]].lastvisiblechild()
|
||||
@ -317,6 +328,22 @@ class TreeNode:
|
||||
self.drawtext()
|
||||
self.canvas.focus_set()
|
||||
|
||||
def find(self, searchKey):
|
||||
if searchKey == self.item.GetKey():
|
||||
return self
|
||||
sublist = self.item._GetSubList()
|
||||
for item in sublist:
|
||||
key = item.GetKey()
|
||||
if self.children.has_key(key):
|
||||
child = self.children[key]
|
||||
else:
|
||||
child = TreeNode(self.canvas, self, item, self.menuList)
|
||||
self.children[key] = child
|
||||
self.kidKeys.append(key)
|
||||
retVal = child.find(searchKey)
|
||||
if retVal:
|
||||
return retVal
|
||||
return None
|
||||
|
||||
class TreeItem:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user