From ae9d2a3d028054c034b53e79b5bc894240f937ca Mon Sep 17 00:00:00 2001 From: Mark Mine Date: Fri, 8 Apr 2005 23:42:50 +0000 Subject: [PATCH] Added unmovableTagList to DirectManipulationControl. Used to specify objects as unmovable --- direct/src/directtools/DirectManipulation.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/direct/src/directtools/DirectManipulation.py b/direct/src/directtools/DirectManipulation.py index 1a76d55018..e1f471ccb4 100644 --- a/direct/src/directtools/DirectManipulation.py +++ b/direct/src/directtools/DirectManipulation.py @@ -36,7 +36,8 @@ class DirectManipulationControl(PandaObject): ['i', self.plantSelectedNodePath], ] self.optionalSkipFlags = 0 - + self.unmovableTagList = [] + def manipulationStart(self, modifiers): # Start out in select mode self.mode = 'select' @@ -172,7 +173,13 @@ class DirectManipulationControl(PandaObject): def manipulateObject(self): # 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 taskMgr.remove('followSelectedNodePath') # and the task to highlight the widget @@ -263,6 +270,13 @@ class DirectManipulationControl(PandaObject): # Continue 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 ### def xlate1D(self, state): # Constrained 1D Translation along widget axis