Browse Source

*** empty log message ***

Mark Mine 20 years ago
parent
commit
a380a196ea
1 changed files with 16 additions and 7 deletions
  1. 16 7
      direct/src/directtools/DirectSelection.py

+ 16 - 7
direct/src/directtools/DirectSelection.py

@@ -25,7 +25,10 @@ class DirectNodePath(NodePath):
         # Transform from nodePath to widget
         # Transform from nodePath to widget
         self.tDnp2Widget = TransformState.makeIdentity()
         self.tDnp2Widget = TransformState.makeIdentity()
 
 
-    def highlight(self):
+    def highlight(self, fRecompute = 1):
+        if fRecompute:
+            pass
+            #self.bbox.recompute()
         self.bbox.show()
         self.bbox.show()
 
 
     def dehighlight(self):
     def dehighlight(self):
@@ -60,7 +63,7 @@ class SelectedNodePaths(PandaObject):
         self.deselectedDict = {}
         self.deselectedDict = {}
         __builtins__["last"] = self.last = None
         __builtins__["last"] = self.last = None
 
 
-    def select(self, nodePath, fMultiSelect = 0):
+    def select(self, nodePath, fMultiSelect = 0, fSelectTag = 1):
         """ Select the specified node path.  Multiselect as required """
         """ Select the specified node path.  Multiselect as required """
         # Do nothing if nothing selected
         # Do nothing if nothing selected
         if not nodePath:
         if not nodePath:
@@ -72,10 +75,11 @@ class SelectedNodePaths(PandaObject):
             self.deselectAll()
             self.deselectAll()
 
 
         # Select tagged object if present
         # Select tagged object if present
-        for tag in self.tagList:
-            if nodePath.hasNetTag(tag):
-                nodePath = nodePath.findNetTag(tag)
-                break
+        if fSelectTag:
+            for tag in self.tagList:
+                if nodePath.hasNetTag(tag):
+                    nodePath = nodePath.findNetTag(tag)
+                    break
         
         
         # Get this pointer
         # Get this pointer
         id = nodePath.id()
         id = nodePath.id()
@@ -94,7 +98,7 @@ class SelectedNodePaths(PandaObject):
                 # Didn't find it, create a new selectedNodePath instance
                 # Didn't find it, create a new selectedNodePath instance
                 dnp = DirectNodePath(nodePath)
                 dnp = DirectNodePath(nodePath)
                 # Show its bounding box
                 # Show its bounding box
-                dnp.highlight()
+                dnp.highlight(fRecompute = 0)
             # Add it to the selected dictionary
             # Add it to the selected dictionary
             self.selectedDict[dnp.id()] = dnp
             self.selectedDict[dnp.id()] = dnp
         # And update last
         # And update last
@@ -248,6 +252,11 @@ class DirectBoundingBox:
         # Generate the bounding box
         # Generate the bounding box
         self.lines = self.createBBoxLines()
         self.lines = self.createBBoxLines()
 
 
+    def recompute(self):
+        # Compute bounds, min, max, etc.
+        self.computeTightBounds()
+        self.updateBBoxLines()
+
     def computeTightBounds(self):
     def computeTightBounds(self):
         # Compute bounding box using tighter calcTightBounds function
         # Compute bounding box using tighter calcTightBounds function
         # Need to clear out existing transform on node path
         # Need to clear out existing transform on node path