diff --git a/direct/src/directtools/DirectSession.py b/direct/src/directtools/DirectSession.py index c3947d8fc3..ccf4bb128c 100644 --- a/direct/src/directtools/DirectSession.py +++ b/direct/src/directtools/DirectSession.py @@ -106,6 +106,7 @@ class DirectSession(PandaObject): ['SGE_Deselect', self.deselect], ['SGE_Set Parent', self.setActiveParent], ['SGE_Reparent', self.reparent], + ['SGE_WRT Reparent', lambda np, s=self: s.reparent(np, fWrt = 1)], ['SGE_Flash', self.flash], ['SGE_Isolate', self.isolate], ['SGE_Toggle Vis', self.toggleVis], @@ -255,6 +256,9 @@ class DirectSession(PandaObject): elif input == 'r': if self.selected.last: self.reparent(self.selected.last) + elif input == 'R': + if self.selected.last: + self.reparent(self.selected.last, fWrt = 1) elif input == 's': if self.selected.last: self.select(self.selected.last) @@ -340,11 +344,14 @@ class DirectSession(PandaObject): # Alert everyone else messenger.send('DIRECT_activeParent', [self.activeParent]) - def reparent(self, nodePath = None): + def reparent(self, nodePath = None, fWrt = 0): if (nodePath and self.activeParent and self.isNotCycle(nodePath, self.activeParent)): oldParent = nodePath.getParent() - nodePath.reparentTo(self.activeParent) + if fWrt: + nodePath.wrtReparentTo(self.activeParent) + else: + nodePath.reparentTo(self.activeParent) # Alert everyone else messenger.send('DIRECT_reparent', [nodePath, oldParent, self.activeParent]) diff --git a/direct/src/directtools/DirectUtil.py b/direct/src/directtools/DirectUtil.py index 26370bc6c4..fa5b89b0ae 100644 --- a/direct/src/directtools/DirectUtil.py +++ b/direct/src/directtools/DirectUtil.py @@ -1,11 +1,25 @@ from PandaObject import * from EntryScale import EntryScale -def adjust(command = None, min = 0.0, max = 1.0, text = 'Adjust'): +def adjust(**kw): + """ + Popup and entry scale to adjust a parameter + Accepts any EntryScale keyword argument. Typical arguments include: + command: The one argument command to execute + min: The min value of the slider + max: The max value of the slider + resolution: The resolution of the slider + text: The label on the slider + """ + from Tkinter import * + import Pmw + from EntryScale import * tl = Toplevel() tl.title('Parameter Adjust') - es = EntryScale(tl, command = command, min = min, max = max, text = text) + es = apply(EntryScale, (tl,), kw) es.pack(expand = 1, fill = X) + es.tl = tl + return es ## Background Color ## def setBackgroundColor(r,g,b): diff --git a/direct/src/tkwidgets/SceneGraphExplorer.py b/direct/src/tkwidgets/SceneGraphExplorer.py index 280faddf68..9dff7e006b 100644 --- a/direct/src/tkwidgets/SceneGraphExplorer.py +++ b/direct/src/tkwidgets/SceneGraphExplorer.py @@ -6,13 +6,15 @@ import Pmw DEFAULT_MENU_ITEMS = [ 'Update Explorer', 'Separator', - 'Select', 'Deselect', 'Set Parent', 'Reparent', 'Set Name', + 'Select', 'Deselect', 'Separator', 'Delete', 'Separator', 'Fit', 'Flash', 'Isolate', 'Toggle Vis', 'Show All', 'Separator', - 'Place', 'Set Color', 'Explore', + 'Set Parent', 'Reparent', 'WRT Reparent', + 'Separator', + 'Place', 'Set Name', 'Set Color', 'Explore', 'Separator'] class SceneGraphExplorer(Pmw.MegaWidget, PandaObject):