mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Enabled selection only mode while other manipluation is disabled
This commit is contained in:
parent
d8e6dc13a3
commit
084bda9f8e
@ -40,6 +40,9 @@ class DirectManipulationControl(DirectObject):
|
|||||||
self.optionalSkipFlags = 0
|
self.optionalSkipFlags = 0
|
||||||
self.unmovableTagList = []
|
self.unmovableTagList = []
|
||||||
|
|
||||||
|
# [gjeon] to enable selection while other manipulation is disabled
|
||||||
|
self.fAllowSelectionOnly = 0
|
||||||
|
|
||||||
def manipulationStart(self, modifiers):
|
def manipulationStart(self, modifiers):
|
||||||
# Start out in select mode
|
# Start out in select mode
|
||||||
self.mode = 'select'
|
self.mode = 'select'
|
||||||
@ -47,6 +50,9 @@ class DirectManipulationControl(DirectObject):
|
|||||||
if base.direct.cameraControl.useMayaCamControls and modifiers == 4:
|
if base.direct.cameraControl.useMayaCamControls and modifiers == 4:
|
||||||
self.mode = 'camera'
|
self.mode = 'camera'
|
||||||
|
|
||||||
|
if self.fAllowSelectionOnly:
|
||||||
|
return
|
||||||
|
|
||||||
# Check for a widget hit point
|
# Check for a widget hit point
|
||||||
entry = base.direct.iRay.pickWidget()
|
entry = base.direct.iRay.pickWidget()
|
||||||
# Did we hit a widget?
|
# Did we hit a widget?
|
||||||
@ -162,10 +168,19 @@ class DirectManipulationControl(DirectObject):
|
|||||||
for event in self.actionEvents:
|
for event in self.actionEvents:
|
||||||
self.accept(event[0], event[1], extraArgs = event[2:])
|
self.accept(event[0], event[1], extraArgs = event[2:])
|
||||||
|
|
||||||
def disableManipulation(self):
|
self.fAllowSelectionOnly = 0
|
||||||
|
|
||||||
|
def disableManipulation(self, allowSelectionOnly=False):
|
||||||
# Ignore events
|
# Ignore events
|
||||||
for event in self.actionEvents:
|
for event in self.actionEvents:
|
||||||
self.ignore(event[0])
|
self.ignore(event[0])
|
||||||
|
|
||||||
|
# [gjeon] to enable selection while other manipulation is disabled
|
||||||
|
if allowSelectionOnly:
|
||||||
|
self.fAllowSelectionOnly = allowSelectionOnly
|
||||||
|
self.accept('DIRECT-mouse1', self.manipulationStart)
|
||||||
|
self.accept('DIRECT-mouse1Up', self.manipulationStop)
|
||||||
|
|
||||||
self.removeManipulateObjectTask()
|
self.removeManipulateObjectTask()
|
||||||
taskMgr.remove('manipulateObject')
|
taskMgr.remove('manipulateObject')
|
||||||
taskMgr.remove('manip-move-wait')
|
taskMgr.remove('manip-move-wait')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user