Added unmovableTagList to DirectManipulationControl. Used to specify objects as unmovable

This commit is contained in:
Mark Mine 2005-04-08 23:42:50 +00:00
parent 61dcffa70c
commit ae9d2a3d02

View File

@ -36,6 +36,7 @@ class DirectManipulationControl(PandaObject):
['i', self.plantSelectedNodePath], ['i', self.plantSelectedNodePath],
] ]
self.optionalSkipFlags = 0 self.optionalSkipFlags = 0
self.unmovableTagList = []
def manipulationStart(self, modifiers): def manipulationStart(self, modifiers):
# Start out in select mode # Start out in select mode
@ -172,7 +173,13 @@ class DirectManipulationControl(PandaObject):
def manipulateObject(self): def manipulateObject(self):
# Only do this if something is selected # Only do this if something is selected
if direct.selected: selectedList = direct.selected.getSelectedAsList()
# See if any of the selected in the don't manipulate tag list
for tag in self.unmovableTagList:
for selected in selectedList:
if selected.hasTag(tag):
return
if selectedList:
# Remove the task to keep the widget attached to the object # Remove the task to keep the widget attached to the object
taskMgr.remove('followSelectedNodePath') taskMgr.remove('followSelectedNodePath')
# and the task to highlight the widget # and the task to highlight the widget
@ -263,6 +270,13 @@ class DirectManipulationControl(PandaObject):
# Continue # Continue
return Task.cont return Task.cont
def addTag(self, tag):
if tag not in self.unmovableTagList:
self.unmovableTagList.append(tag)
def removeTag(self, tag):
self.unmovableTagList.remove(tag)
### WIDGET MANIPULATION METHODS ### ### WIDGET MANIPULATION METHODS ###
def xlate1D(self, state): def xlate1D(self, state):
# Constrained 1D Translation along widget axis # Constrained 1D Translation along widget axis