mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
*** empty log message ***
This commit is contained in:
parent
725bd3e408
commit
9e9defff7e
@ -45,7 +45,7 @@ class DirectButtons(ButtonNode, PandaObject):
|
|||||||
self.nodePath = base.dataRoot.attachNewNode(self)
|
self.nodePath = base.dataRoot.attachNewNode(self)
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
if (index < 0) | (index > self.getNumButtons()):
|
if (index < 0) or (index > self.getNumButtons()):
|
||||||
raise IndexError
|
raise IndexError
|
||||||
return self.getButtonState(index)
|
return self.getButtonState(index)
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class DirectAnalogs(AnalogNode, PandaObject):
|
|||||||
self.nodePath = base.dataRoot.attachNewNode(self)
|
self.nodePath = base.dataRoot.attachNewNode(self)
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
if (index < 0) | (index > self.getNumControls()):
|
if (index < 0) or (index > self.getNumControls()):
|
||||||
raise IndexError
|
raise IndexError
|
||||||
return self.getControlState(index)
|
return self.getControlState(index)
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class DirectAnalogs(AnalogNode, PandaObject):
|
|||||||
|
|
||||||
def normalizeChannel(self, chan, minVal = -1, maxVal = 1):
|
def normalizeChannel(self, chan, minVal = -1, maxVal = 1):
|
||||||
try:
|
try:
|
||||||
if (chan == 2) | (chan == 6):
|
if (chan == 2) or (chan == 6):
|
||||||
# These channels have reduced range
|
# These channels have reduced range
|
||||||
return self.normalize(self[chan] * 3.0, minVal, maxVal)
|
return self.normalize(self[chan] * 3.0, minVal, maxVal)
|
||||||
else:
|
else:
|
||||||
@ -144,7 +144,7 @@ class DirectDials(DialNode, PandaObject):
|
|||||||
self.nodePath = base.dataRoot.attachNewNode(self)
|
self.nodePath = base.dataRoot.attachNewNode(self)
|
||||||
|
|
||||||
def __getitem__(self, index):
|
def __getitem__(self, index):
|
||||||
if (index < 0) | (index > self.getNumDials()):
|
if (index < 0) or (index > self.getNumDials()):
|
||||||
raise IndexError
|
raise IndexError
|
||||||
return self.readDial(index)
|
return self.readDial(index)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
# Record undo point
|
# Record undo point
|
||||||
direct.pushUndo([direct.camera])
|
direct.pushUndo([direct.camera])
|
||||||
# Where are we in the display region?
|
# Where are we in the display region?
|
||||||
if ((abs(direct.dr.mouseX) < 0.9) & (abs(direct.dr.mouseY) < 0.9)):
|
if ((abs(direct.dr.mouseX) < 0.9) and (abs(direct.dr.mouseY) < 0.9)):
|
||||||
# MOUSE IS IN CENTRAL REGION
|
# MOUSE IS IN CENTRAL REGION
|
||||||
# Hide the marker for this kind of motion
|
# Hide the marker for this kind of motion
|
||||||
self.coaMarker.hide()
|
self.coaMarker.hide()
|
||||||
@ -73,7 +73,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
coa.assign(hitPt)
|
coa.assign(hitPt)
|
||||||
coaDist = hitPtDist
|
coaDist = hitPtDist
|
||||||
# Handle case of bad coa point (too close or too far)
|
# Handle case of bad coa point (too close or too far)
|
||||||
if ((coaDist < (1.1 * direct.dr.near)) |
|
if ((coaDist < (1.1 * direct.dr.near)) or
|
||||||
(coaDist > direct.dr.far)):
|
(coaDist > direct.dr.far)):
|
||||||
# Just use existing point
|
# Just use existing point
|
||||||
coa.assign(self.coaMarker.getPos(direct.camera))
|
coa.assign(self.coaMarker.getPos(direct.camera))
|
||||||
@ -96,7 +96,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
self.spawnXZTranslateOrHPanYZoom()
|
self.spawnXZTranslateOrHPanYZoom()
|
||||||
# END MOUSE IN CENTRAL REGION
|
# END MOUSE IN CENTRAL REGION
|
||||||
else:
|
else:
|
||||||
if ((abs(direct.dr.mouseX) > 0.9) & (abs(direct.dr.mouseY) > 0.9)):
|
if ((abs(direct.dr.mouseX) > 0.9) and (abs(direct.dr.mouseY) > 0.9)):
|
||||||
# Mouse is in corners, spawn roll task
|
# Mouse is in corners, spawn roll task
|
||||||
self.spawnMouseRollTask()
|
self.spawnMouseRollTask()
|
||||||
else:
|
else:
|
||||||
@ -217,10 +217,10 @@ class DirectCameraControl(PandaObject):
|
|||||||
|
|
||||||
def mouseRotateTask(self, state):
|
def mouseRotateTask(self, state):
|
||||||
# If moving outside of center, ignore motion perpendicular to edge
|
# If moving outside of center, ignore motion perpendicular to edge
|
||||||
if ((state.constrainedDir == 'y') & (abs(direct.dr.mouseX) > 0.9)):
|
if ((state.constrainedDir == 'y') and (abs(direct.dr.mouseX) > 0.9)):
|
||||||
deltaX = 0
|
deltaX = 0
|
||||||
deltaY = direct.dr.mouseDeltaY
|
deltaY = direct.dr.mouseDeltaY
|
||||||
elif ((state.constrainedDir == 'x') & (abs(direct.dr.mouseY) > 0.9)):
|
elif ((state.constrainedDir == 'x') and (abs(direct.dr.mouseY) > 0.9)):
|
||||||
deltaX = direct.dr.mouseDeltaX
|
deltaX = direct.dr.mouseDeltaX
|
||||||
deltaY = 0
|
deltaY = 0
|
||||||
else:
|
else:
|
||||||
@ -291,6 +291,7 @@ class DirectCameraControl(PandaObject):
|
|||||||
def homeCam(self):
|
def homeCam(self):
|
||||||
# Record undo point
|
# Record undo point
|
||||||
direct.pushUndo([direct.camera])
|
direct.pushUndo([direct.camera])
|
||||||
|
direct.camera.reparentTo(render)
|
||||||
direct.camera.setMat(Mat4.identMat())
|
direct.camera.setMat(Mat4.identMat())
|
||||||
# Resize coa marker
|
# Resize coa marker
|
||||||
self.updateCoaMarkerSize()
|
self.updateCoaMarkerSize()
|
||||||
|
@ -71,7 +71,7 @@ class DirectManipulationControl(PandaObject):
|
|||||||
return Task.done
|
return Task.done
|
||||||
|
|
||||||
def watchMouseTask(self, state):
|
def watchMouseTask(self, state):
|
||||||
if (((abs (state.initX - direct.dr.mouseX)) > 0.01) |
|
if (((abs (state.initX - direct.dr.mouseX)) > 0.01) or
|
||||||
((abs (state.initY - direct.dr.mouseY)) > 0.01)):
|
((abs (state.initY - direct.dr.mouseY)) > 0.01)):
|
||||||
taskMgr.removeTasksNamed('manip-move-wait')
|
taskMgr.removeTasksNamed('manip-move-wait')
|
||||||
self.mode = 'move'
|
self.mode = 'move'
|
||||||
@ -197,7 +197,7 @@ class DirectManipulationControl(PandaObject):
|
|||||||
# Compute widget's xy coords in screen space
|
# Compute widget's xy coords in screen space
|
||||||
t.coaCenter = getScreenXY(direct.widget)
|
t.coaCenter = getScreenXY(direct.widget)
|
||||||
# These are used to rotate about view vector
|
# These are used to rotate about view vector
|
||||||
if t.fMouseX & t.fMouseY:
|
if t.fMouseX and t.fMouseY:
|
||||||
t.lastAngle = getCrankAngle(t.coaCenter)
|
t.lastAngle = getCrankAngle(t.coaCenter)
|
||||||
taskMgr.spawnTaskNamed(t, 'manipulateObject')
|
taskMgr.spawnTaskNamed(t, 'manipulateObject')
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ class DirectManipulationControl(PandaObject):
|
|||||||
# No widget interaction, determine free manip mode
|
# No widget interaction, determine free manip mode
|
||||||
elif self.fFreeManip:
|
elif self.fFreeManip:
|
||||||
# If we've been scaling and changed modes, reset object handles
|
# If we've been scaling and changed modes, reset object handles
|
||||||
if 0 & self.fScaling & (not direct.fAlt):
|
if 0 and self.fScaling and (not direct.fAlt):
|
||||||
self.objectHandles.transferObjectHandlesScale()
|
self.objectHandles.transferObjectHandlesScale()
|
||||||
self.fScaling = 0
|
self.fScaling = 0
|
||||||
# Alt key switches to a scaling mode
|
# Alt key switches to a scaling mode
|
||||||
@ -222,10 +222,10 @@ class DirectManipulationControl(PandaObject):
|
|||||||
self.fScaling = 1
|
self.fScaling = 1
|
||||||
self.scale3D(state)
|
self.scale3D(state)
|
||||||
# Otherwise, manip mode depends on where you started
|
# Otherwise, manip mode depends on where you started
|
||||||
elif state.fMouseX & state.fMouseY:
|
elif state.fMouseX and state.fMouseY:
|
||||||
# In the corner, spin around camera's axis
|
# In the corner, spin around camera's axis
|
||||||
self.rotateAboutViewVector(state)
|
self.rotateAboutViewVector(state)
|
||||||
elif state.fMouseX | state.fMouseY:
|
elif state.fMouseX or state.fMouseY:
|
||||||
# Mouse started elsewhere in the outer frame, rotate
|
# Mouse started elsewhere in the outer frame, rotate
|
||||||
self.rotate2D(state)
|
self.rotate2D(state)
|
||||||
else:
|
else:
|
||||||
@ -393,10 +393,10 @@ class DirectManipulationControl(PandaObject):
|
|||||||
self.fScaleInit = 1
|
self.fScaleInit = 1
|
||||||
tumbleRate = 360
|
tumbleRate = 360
|
||||||
# If moving outside of center, ignore motion perpendicular to edge
|
# If moving outside of center, ignore motion perpendicular to edge
|
||||||
if ((state.constrainedDir == 'y') & (abs(direct.dr.mouseX) > 0.9)):
|
if ((state.constrainedDir == 'y') and (abs(direct.dr.mouseX) > 0.9)):
|
||||||
deltaX = 0
|
deltaX = 0
|
||||||
deltaY = direct.dr.mouseDeltaY
|
deltaY = direct.dr.mouseDeltaY
|
||||||
elif ((state.constrainedDir == 'x') & (abs(direct.dr.mouseY) > 0.9)):
|
elif ((state.constrainedDir == 'x') and (abs(direct.dr.mouseY) > 0.9)):
|
||||||
deltaX = direct.dr.mouseDeltaX
|
deltaX = direct.dr.mouseDeltaX
|
||||||
deltaY = 0
|
deltaY = 0
|
||||||
else:
|
else:
|
||||||
@ -450,7 +450,7 @@ class DirectManipulationControl(PandaObject):
|
|||||||
node, hitPt, hitPtDist = direct.iRay.pickGeom(
|
node, hitPt, hitPtDist = direct.iRay.pickGeom(
|
||||||
fIntersectUnpickable = 1)
|
fIntersectUnpickable = 1)
|
||||||
# MRM: Need to handle moving COA
|
# MRM: Need to handle moving COA
|
||||||
if (node != None) & (direct.selected.last != None):
|
if (node != None) and (direct.selected.last != None):
|
||||||
# Record undo point
|
# Record undo point
|
||||||
direct.pushUndo(direct.selected)
|
direct.pushUndo(direct.selected)
|
||||||
# Record wrt matrix
|
# Record wrt matrix
|
||||||
|
@ -239,9 +239,9 @@ class DirectSession(PandaObject):
|
|||||||
self.selected.toggleVisAll()
|
self.selected.toggleVisAll()
|
||||||
elif input == 'w':
|
elif input == 'w':
|
||||||
base.toggleWireframe()
|
base.toggleWireframe()
|
||||||
elif (input == '[') | (input == '{'):
|
elif (input == '[') or (input == '{'):
|
||||||
self.undo()
|
self.undo()
|
||||||
elif (input == ']') | (input == '}'):
|
elif (input == ']') or (input == '}'):
|
||||||
self.redo()
|
self.redo()
|
||||||
|
|
||||||
def select(self, nodePath, fMultiSelect = 0, fResetAncestry = 1):
|
def select(self, nodePath, fMultiSelect = 0, fResetAncestry = 1):
|
||||||
@ -402,7 +402,7 @@ class DirectSession(PandaObject):
|
|||||||
if i < l:
|
if i < l:
|
||||||
np = self.ancestry[i]
|
np = self.ancestry[i]
|
||||||
name = np.getName()
|
name = np.getName()
|
||||||
if (name != 'render') & (name != 'renderTop'):
|
if (name != 'render') and (name != 'renderTop'):
|
||||||
self.ancestryIndex = i
|
self.ancestryIndex = i
|
||||||
self.select(np, 0, 0)
|
self.select(np, 0, 0)
|
||||||
self.flash(np)
|
self.flash(np)
|
||||||
@ -414,7 +414,7 @@ class DirectSession(PandaObject):
|
|||||||
if i >= 0:
|
if i >= 0:
|
||||||
np = self.ancestry[i]
|
np = self.ancestry[i]
|
||||||
name = np.getName()
|
name = np.getName()
|
||||||
if (name != 'render') & (name != 'renderTop'):
|
if (name != 'render') and (name != 'renderTop'):
|
||||||
self.ancestryIndex = i
|
self.ancestryIndex = i
|
||||||
self.select(np, 0, 0)
|
self.select(np, 0, 0)
|
||||||
self.flash(np)
|
self.flash(np)
|
||||||
@ -434,7 +434,7 @@ class DirectSession(PandaObject):
|
|||||||
self.undoList = self.undoList[-25:]
|
self.undoList = self.undoList[-25:]
|
||||||
# Alert anyone who cares
|
# Alert anyone who cares
|
||||||
messenger.send('pushUndo')
|
messenger.send('pushUndo')
|
||||||
if fResetRedo & (nodePathList != []):
|
if fResetRedo and (nodePathList != []):
|
||||||
self.redoList = []
|
self.redoList = []
|
||||||
messenger.send('redoListEmpty')
|
messenger.send('redoListEmpty')
|
||||||
|
|
||||||
|
@ -571,7 +571,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
if parentDNAObject:
|
if parentDNAObject:
|
||||||
# Yes it does, move node path (and DNA)
|
# Yes it does, move node path (and DNA)
|
||||||
# to new parent (if active parent set)
|
# to new parent (if active parent set)
|
||||||
if ((self.NPParent != None) &
|
if ((self.NPParent != None) and
|
||||||
(self.DNAParent != None)):
|
(self.DNAParent != None)):
|
||||||
nodePath.reparentTo(self.NPParent)
|
nodePath.reparentTo(self.NPParent)
|
||||||
parentDNAObject.remove(dnaNode)
|
parentDNAObject.remove(dnaNode)
|
||||||
@ -702,11 +702,11 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
chance = randint(0,100)
|
chance = randint(0,100)
|
||||||
if chance <= 15:
|
if chance <= 15:
|
||||||
return 5.0
|
return 5.0
|
||||||
elif (chance > 15) & (chance <= 30):
|
elif (chance > 15) and (chance <= 30):
|
||||||
return 10.0
|
return 10.0
|
||||||
elif (chance > 30) & (chance <= 65):
|
elif (chance > 30) and (chance <= 65):
|
||||||
return 15.0
|
return 15.0
|
||||||
elif (chance > 65) & (chance <= 85):
|
elif (chance > 65) and (chance <= 85):
|
||||||
return 20.0
|
return 20.0
|
||||||
elif (chance > 85):
|
elif (chance > 85):
|
||||||
return 25.0
|
return 25.0
|
||||||
@ -748,7 +748,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
# destination (part of cleanup
|
# destination (part of cleanup
|
||||||
taskMgr.removeTasksNamed('autoPositionGrid')
|
taskMgr.removeTasksNamed('autoPositionGrid')
|
||||||
# Now find where to put node path
|
# Now find where to put node path
|
||||||
if (hotKey is not None) & nodeClass.eq(DNA_PROP):
|
if (hotKey is not None) and nodeClass.eq(DNA_PROP):
|
||||||
# If its a prop and a copy, place it based upon current
|
# If its a prop and a copy, place it based upon current
|
||||||
# mouse position
|
# mouse position
|
||||||
hitPt = self.getGridIntersectionPoint()
|
hitPt = self.getGridIntersectionPoint()
|
||||||
@ -1023,7 +1023,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
menuMode = 'cornice_orientation'
|
menuMode = 'cornice_orientation'
|
||||||
else:
|
else:
|
||||||
menuMode = 'cornice_texture'
|
menuMode = 'cornice_texture'
|
||||||
elif ((xPt < 0.3) | (xPt > 0.7)):
|
elif ((xPt < 0.3) or (xPt > 0.7)):
|
||||||
# Do wall operations
|
# Do wall operations
|
||||||
if direct.fControl:
|
if direct.fControl:
|
||||||
menuMode = 'wall_color'
|
menuMode = 'wall_color'
|
||||||
@ -1061,10 +1061,10 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
# Update panel color if appropriate
|
# Update panel color if appropriate
|
||||||
if self.DNATarget:
|
if self.DNATarget:
|
||||||
objClass = DNAGetClassType(self.DNATarget)
|
objClass = DNAGetClassType(self.DNATarget)
|
||||||
if ((objClass.eq(DNA_WALL)) |
|
if ((objClass.eq(DNA_WALL)) or
|
||||||
(objClass.eq(DNA_WINDOWS)) |
|
(objClass.eq(DNA_WINDOWS)) or
|
||||||
(objClass.eq(DNA_DOOR)) |
|
(objClass.eq(DNA_DOOR)) or
|
||||||
(objClass.eq(DNA_CORNICE)) |
|
(objClass.eq(DNA_CORNICE)) or
|
||||||
(objClass.eq(DNA_PROP))
|
(objClass.eq(DNA_PROP))
|
||||||
):
|
):
|
||||||
self.panel.setCurrentColor(self.DNATarget.getColor())
|
self.panel.setCurrentColor(self.DNATarget.getColor())
|
||||||
@ -1075,10 +1075,10 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.replaceSelected()
|
self.replaceSelected()
|
||||||
|
|
||||||
def setDNATargetCode(self, type, code):
|
def setDNATargetCode(self, type, code):
|
||||||
if (self.DNATarget != None) & (code != None):
|
if (self.DNATarget != None) and (code != None):
|
||||||
# Update code
|
# Update code
|
||||||
self.DNATarget.setCode(code)
|
self.DNATarget.setCode(code)
|
||||||
elif (self.DNATarget != None) & (code == None):
|
elif (self.DNATarget != None) and (code == None):
|
||||||
# Delete object, record pertinant properties before
|
# Delete object, record pertinant properties before
|
||||||
# you delete the object so you can restore them later
|
# you delete the object so you can restore them later
|
||||||
# Remove object
|
# Remove object
|
||||||
@ -1092,7 +1092,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.removeWindows(self.DNATarget, self.DNATargetParent)
|
self.removeWindows(self.DNATarget, self.DNATargetParent)
|
||||||
# Clear out DNATarget
|
# Clear out DNATarget
|
||||||
self.DNATarget = None
|
self.DNATarget = None
|
||||||
elif (self.DNATarget == None) & (code != None):
|
elif (self.DNATarget == None) and (code != None):
|
||||||
# Add new object
|
# Add new object
|
||||||
if (type == 'cornice'):
|
if (type == 'cornice'):
|
||||||
self.DNATarget = self.createCornice()
|
self.DNATarget = self.createCornice()
|
||||||
@ -1114,13 +1114,13 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.replaceSelected()
|
self.replaceSelected()
|
||||||
|
|
||||||
def setDNATargetOrientation(self, orientation):
|
def setDNATargetOrientation(self, orientation):
|
||||||
if (self.DNATarget != None) & (orientation != None):
|
if (self.DNATarget != None) and (orientation != None):
|
||||||
oldCode = self.DNATarget.getCode()[:-3]
|
oldCode = self.DNATarget.getCode()[:-3]
|
||||||
self.DNATarget.setCode(oldCode + '_' + orientation)
|
self.DNATarget.setCode(oldCode + '_' + orientation)
|
||||||
self.replaceSelected()
|
self.replaceSelected()
|
||||||
|
|
||||||
def setBuildingStyle(self, style):
|
def setBuildingStyle(self, style):
|
||||||
if (self.DNATarget != None) & (style != None):
|
if (self.DNATarget != None) and (style != None):
|
||||||
self.styleManager.setDNAFlatBuildingStyle(
|
self.styleManager.setDNAFlatBuildingStyle(
|
||||||
self.DNATarget, style,
|
self.DNATarget, style,
|
||||||
width = self.DNATarget.getWidth(),
|
width = self.DNATarget.getWidth(),
|
||||||
@ -1139,19 +1139,19 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.replaceSelected()
|
self.replaceSelected()
|
||||||
|
|
||||||
def setWindowCount(self, count):
|
def setWindowCount(self, count):
|
||||||
if (self.DNATarget != None) & (count != 0):
|
if (self.DNATarget != None) and (count != 0):
|
||||||
self.DNATarget.setWindowCount(count)
|
self.DNATarget.setWindowCount(count)
|
||||||
elif (self.DNATarget != None) & (count == 0):
|
elif (self.DNATarget != None) and (count == 0):
|
||||||
# Remove windows and clear out DNATarget
|
# Remove windows and clear out DNATarget
|
||||||
self.removeWindows(self.DNATarget, self.DNATargetParent)
|
self.removeWindows(self.DNATarget, self.DNATargetParent)
|
||||||
self.DNATarget = None
|
self.DNATarget = None
|
||||||
elif (self.DNATarget == None) & (count != 0):
|
elif (self.DNATarget == None) and (count != 0):
|
||||||
self.DNATarget = self.createWindows()
|
self.DNATarget = self.createWindows()
|
||||||
self.DNATargetParent.add(self.DNATarget)
|
self.DNATargetParent.add(self.DNATarget)
|
||||||
self.replaceSelected()
|
self.replaceSelected()
|
||||||
|
|
||||||
def setWallStyle(self, style):
|
def setWallStyle(self, style):
|
||||||
if (self.DNATarget != None) & (style != None):
|
if (self.DNATarget != None) and (style != None):
|
||||||
self.styleManager.setDNAWallStyle(
|
self.styleManager.setDNAWallStyle(
|
||||||
self.DNATarget, style,
|
self.DNATarget, style,
|
||||||
self.DNATarget.getHeight())
|
self.DNATarget.getHeight())
|
||||||
@ -1241,7 +1241,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
# MANIPULATION FUNCTIONS
|
# MANIPULATION FUNCTIONS
|
||||||
def keyboardRotateSelected(self, arrowDirection):
|
def keyboardRotateSelected(self, arrowDirection):
|
||||||
""" Rotate selected objects using arrow keys """
|
""" Rotate selected objects using arrow keys """
|
||||||
if ((arrowDirection == 'left') | (arrowDirection == 'up')):
|
if ((arrowDirection == 'left') or (arrowDirection == 'up')):
|
||||||
self.setLastAngle(self.getLastAngle() + SNAP_ANGLE)
|
self.setLastAngle(self.getLastAngle() + SNAP_ANGLE)
|
||||||
else:
|
else:
|
||||||
self.setLastAngle(self.getLastAngle() - SNAP_ANGLE)
|
self.setLastAngle(self.getLastAngle() - SNAP_ANGLE)
|
||||||
@ -1401,7 +1401,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def getRandomWindowCount(self):
|
def getRandomWindowCount(self):
|
||||||
if ((self.lastWall != None) & (self.lastBuilding != None)):
|
if ((self.lastWall != None) and (self.lastBuilding != None)):
|
||||||
h = ROUND_INT(self.lastWall.getHeight())
|
h = ROUND_INT(self.lastWall.getHeight())
|
||||||
w = ROUND_INT(self.lastBuilding.getWidth())
|
w = ROUND_INT(self.lastBuilding.getWidth())
|
||||||
# Otherwise....
|
# Otherwise....
|
||||||
@ -1460,7 +1460,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
taskMgr.removeTasksNamed('autoMoveDelay')
|
taskMgr.removeTasksNamed('autoMoveDelay')
|
||||||
handlesToCam = direct.widget.getPos(direct.camera)
|
handlesToCam = direct.widget.getPos(direct.camera)
|
||||||
handlesToCam = handlesToCam * ( direct.dr.near/handlesToCam[1])
|
handlesToCam = handlesToCam * ( direct.dr.near/handlesToCam[1])
|
||||||
if ((abs(handlesToCam[0]) > (direct.dr.nearWidth * 0.4)) |
|
if ((abs(handlesToCam[0]) > (direct.dr.nearWidth * 0.4)) or
|
||||||
(abs(handlesToCam[2]) > (direct.dr.nearHeight * 0.4))):
|
(abs(handlesToCam[2]) > (direct.dr.nearHeight * 0.4))):
|
||||||
taskMgr.removeTasksNamed('manipulateCamera')
|
taskMgr.removeTasksNamed('manipulateCamera')
|
||||||
direct.cameraControl.centerCamIn(0.5)
|
direct.cameraControl.centerCamIn(0.5)
|
||||||
@ -1701,7 +1701,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
xPt = hitPt[0]
|
xPt = hitPt[0]
|
||||||
zPt = hitPt[2]
|
zPt = hitPt[2]
|
||||||
# Left or right of building
|
# Left or right of building
|
||||||
if ((xPt < 0) | (xPt > aDNAFlatBuilding.getWidth())):
|
if ((xPt < 0) or (xPt > aDNAFlatBuilding.getWidth())):
|
||||||
return -1
|
return -1
|
||||||
# Below the building
|
# Below the building
|
||||||
if zPt < 0:
|
if zPt < 0:
|
||||||
@ -2079,7 +2079,7 @@ class LevelStyleManager:
|
|||||||
pair = map(string.strip, l.split(':'))
|
pair = map(string.strip, l.split(':'))
|
||||||
if style.__dict__.has_key(pair[0]):
|
if style.__dict__.has_key(pair[0]):
|
||||||
# Convert colors and count strings to numerical values
|
# Convert colors and count strings to numerical values
|
||||||
if ((string.find(pair[0],'_color') >= 0) |
|
if ((string.find(pair[0],'_color') >= 0) or
|
||||||
(string.find(pair[0],'_count') >= 0)):
|
(string.find(pair[0],'_count') >= 0)):
|
||||||
style[pair[0]] = eval(pair[1])
|
style[pair[0]] = eval(pair[1])
|
||||||
else:
|
else:
|
||||||
@ -2482,7 +2482,7 @@ class LevelStyleManager:
|
|||||||
for dnaType in DNA_TYPES:
|
for dnaType in DNA_TYPES:
|
||||||
# Create a dictionary of dna types
|
# Create a dictionary of dna types
|
||||||
dict = {}
|
dict = {}
|
||||||
if ((dnaType == 'street') | (dnaType == 'prop') |
|
if ((dnaType == 'street') or (dnaType == 'prop') or
|
||||||
(dnaType == 'toon_landmark')):
|
(dnaType == 'toon_landmark')):
|
||||||
dnaList = self.getCatalogCodes(dnaType)
|
dnaList = self.getCatalogCodes(dnaType)
|
||||||
else:
|
else:
|
||||||
@ -2494,7 +2494,7 @@ class LevelStyleManager:
|
|||||||
attribute = LevelAttribute(dnaType + '_texture')
|
attribute = LevelAttribute(dnaType + '_texture')
|
||||||
attribute.setDict(dict)
|
attribute.setDict(dict)
|
||||||
# Prepend None to allow option of no item
|
# Prepend None to allow option of no item
|
||||||
if ((dnaType == 'street') | (dnaType == 'prop') |
|
if ((dnaType == 'street') or (dnaType == 'prop') or
|
||||||
(dnaType == 'toon_landmark')):
|
(dnaType == 'toon_landmark')):
|
||||||
attribute.setMenu(self.createTextPieMenu(dnaType, dnaList))
|
attribute.setMenu(self.createTextPieMenu(dnaType, dnaList))
|
||||||
elif (dnaType == 'wall'):
|
elif (dnaType == 'wall'):
|
||||||
@ -3320,12 +3320,12 @@ class LevelEditorPanel(Pmw.MegaToplevel):
|
|||||||
def updateSelectedObjColor(self, color):
|
def updateSelectedObjColor(self, color):
|
||||||
try:
|
try:
|
||||||
obj = self.levelEditor.DNATarget
|
obj = self.levelEditor.DNATarget
|
||||||
if self.fUpdateSelected & (obj != None):
|
if self.fUpdateSelected and (obj != None):
|
||||||
objClass = DNAGetClassType(obj)
|
objClass = DNAGetClassType(obj)
|
||||||
if ((objClass.eq(DNA_WALL)) |
|
if ((objClass.eq(DNA_WALL)) or
|
||||||
(objClass.eq(DNA_WINDOWS)) |
|
(objClass.eq(DNA_WINDOWS)) or
|
||||||
(objClass.eq(DNA_DOOR)) |
|
(objClass.eq(DNA_DOOR)) or
|
||||||
(objClass.eq(DNA_CORNICE)) |
|
(objClass.eq(DNA_CORNICE)) or
|
||||||
(objClass.eq(DNA_PROP))
|
(objClass.eq(DNA_PROP))
|
||||||
):
|
):
|
||||||
self.levelEditor.setDNATargetColor(
|
self.levelEditor.setDNATargetColor(
|
||||||
|
@ -74,7 +74,7 @@ class PieMenu(NodePath, PandaObject):
|
|||||||
self.lines.setVertex(1,(deltaX/self.sfx),0.0,(deltaY/self.sfz))
|
self.lines.setVertex(1,(deltaX/self.sfx),0.0,(deltaY/self.sfz))
|
||||||
|
|
||||||
# How far from starting point has user moved the cursor?
|
# How far from starting point has user moved the cursor?
|
||||||
if ((abs(deltaX) < 0.1) & (abs(deltaY) < 0.1)):
|
if ((abs(deltaX) < 0.1) and (abs(deltaY) < 0.1)):
|
||||||
# In the center
|
# In the center
|
||||||
if self.fUpdateOnlyOnChange:
|
if self.fUpdateOnlyOnChange:
|
||||||
# Only do this when things change
|
# Only do this when things change
|
||||||
|
@ -109,21 +109,21 @@ def _pdir(obj, str = None, fOverloaded = 0, width = None,
|
|||||||
if str:
|
if str:
|
||||||
if re.search(str, key, re.I):
|
if re.search(str, key, re.I):
|
||||||
aproposKeys.append(key)
|
aproposKeys.append(key)
|
||||||
if (not width) & (keyWidth > maxWidth):
|
if (not width) and (keyWidth > maxWidth):
|
||||||
maxWidth = keyWidth
|
maxWidth = keyWidth
|
||||||
else:
|
else:
|
||||||
if key[:2] == '__':
|
if key[:2] == '__':
|
||||||
privateKeys.append(key)
|
privateKeys.append(key)
|
||||||
if (not width) & (keyWidth > maxWidth):
|
if (not width) and (keyWidth > maxWidth):
|
||||||
maxWidth = keyWidth
|
maxWidth = keyWidth
|
||||||
elif (key[:10] == 'overloaded'):
|
elif (key[:10] == 'overloaded'):
|
||||||
if fOverloaded:
|
if fOverloaded:
|
||||||
overloadedKeys.append(key)
|
overloadedKeys.append(key)
|
||||||
if (not width) & (keyWidth > maxWidth):
|
if (not width) and (keyWidth > maxWidth):
|
||||||
maxWidth = keyWidth
|
maxWidth = keyWidth
|
||||||
else:
|
else:
|
||||||
remainingKeys.append(key)
|
remainingKeys.append(key)
|
||||||
if (not width) & (keyWidth > maxWidth):
|
if (not width) and (keyWidth > maxWidth):
|
||||||
maxWidth = keyWidth
|
maxWidth = keyWidth
|
||||||
# Sort appropriate keys
|
# Sort appropriate keys
|
||||||
if str:
|
if str:
|
||||||
|
@ -672,7 +672,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
Hook called upon deselection of a node path used to select playback
|
Hook called upon deselection of a node path used to select playback
|
||||||
marker if subnode selected
|
marker if subnode selected
|
||||||
"""
|
"""
|
||||||
if ((nodePath.id() == self.playbackMarker.id()) |
|
if ((nodePath.id() == self.playbackMarker.id()) or
|
||||||
(nodePath.id() == self.tangentMarker.id())):
|
(nodePath.id() == self.tangentMarker.id())):
|
||||||
self.tangentGroup.hide()
|
self.tangentGroup.hide()
|
||||||
|
|
||||||
@ -947,7 +947,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.recordPoint(self.recordStart)
|
self.recordPoint(self.recordStart)
|
||||||
# Everything else
|
# Everything else
|
||||||
else:
|
else:
|
||||||
if ((self.recordingType.get() == 'Refine') |
|
if ((self.recordingType.get() == 'Refine') or
|
||||||
(self.recordingType.get() == 'Extend')):
|
(self.recordingType.get() == 'Extend')):
|
||||||
# Turn off looping playback
|
# Turn off looping playback
|
||||||
self.loopPlayback = 0
|
self.loopPlayback = 0
|
||||||
@ -972,7 +972,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
if self.samplingMode == 'Continuous':
|
if self.samplingMode == 'Continuous':
|
||||||
# Kill old task
|
# Kill old task
|
||||||
taskMgr.removeTasksNamed(self.name + '-recordTask')
|
taskMgr.removeTasksNamed(self.name + '-recordTask')
|
||||||
if ((self.recordingType.get() == 'Refine') |
|
if ((self.recordingType.get() == 'Refine') or
|
||||||
(self.recordingType.get() == 'Extend')):
|
(self.recordingType.get() == 'Extend')):
|
||||||
# Reparent node path back to parent
|
# Reparent node path back to parent
|
||||||
self['nodePath'].wrtReparentTo(self.nodePathParent)
|
self['nodePath'].wrtReparentTo(self.nodePathParent)
|
||||||
@ -988,7 +988,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.setSamplingMode('Continuous')
|
self.setSamplingMode('Continuous')
|
||||||
self.enableKeyframeButton()
|
self.enableKeyframeButton()
|
||||||
# Clean up after refine or extend
|
# Clean up after refine or extend
|
||||||
if ((self.recordingType.get() == 'Refine') |
|
if ((self.recordingType.get() == 'Refine') or
|
||||||
(self.recordingType.get() == 'Extend')):
|
(self.recordingType.get() == 'Extend')):
|
||||||
# Merge prePoints, pointSet, postPoints
|
# Merge prePoints, pointSet, postPoints
|
||||||
self.mergePoints()
|
self.mergePoints()
|
||||||
@ -1008,7 +1008,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
|
|
||||||
def addKeyframe(self, fToggleRecord = 1):
|
def addKeyframe(self, fToggleRecord = 1):
|
||||||
# Make sure we're in a recording mode!
|
# Make sure we're in a recording mode!
|
||||||
if (fToggleRecord &
|
if (fToggleRecord and
|
||||||
(not self.getVariable('Recording', 'Record').get())):
|
(not self.getVariable('Recording', 'Record').get())):
|
||||||
# Set sampling mode
|
# Set sampling mode
|
||||||
self.setSamplingMode('Keyframe')
|
self.setSamplingMode('Keyframe')
|
||||||
@ -1042,16 +1042,16 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
|
|
||||||
def recordPoint(self, time):
|
def recordPoint(self, time):
|
||||||
# Call user define callback before recording point
|
# Call user define callback before recording point
|
||||||
if (self.getVariable('Recording', 'PRF Active').get() &
|
if (self.getVariable('Recording', 'PRF Active').get() and
|
||||||
(self.preRecordFunc != None)):
|
(self.preRecordFunc != None)):
|
||||||
self.preRecordFunc()
|
self.preRecordFunc()
|
||||||
# Get point
|
# Get point
|
||||||
pos = self['nodePath'].getPos(self.nodePathParent)
|
pos = self['nodePath'].getPos(self.nodePathParent)
|
||||||
hpr = self['nodePath'].getHpr(self.nodePathParent)
|
hpr = self['nodePath'].getHpr(self.nodePathParent)
|
||||||
# Blend between recordNodePath and self['nodePath']
|
# Blend between recordNodePath and self['nodePath']
|
||||||
if ((self.recordingType.get() == 'Refine') |
|
if ((self.recordingType.get() == 'Refine') or
|
||||||
(self.recordingType.get() == 'Extend')):
|
(self.recordingType.get() == 'Extend')):
|
||||||
if ((time < self.controlStart) &
|
if ((time < self.controlStart) and
|
||||||
((self.controlStart - self.recordStart) != 0.0)):
|
((self.controlStart - self.recordStart) != 0.0)):
|
||||||
rPos = self.playbackNodePath.getPos(self.nodePathParent)
|
rPos = self.playbackNodePath.getPos(self.nodePathParent)
|
||||||
rHpr = self.playbackNodePath.getHpr(self.nodePathParent)
|
rHpr = self.playbackNodePath.getHpr(self.nodePathParent)
|
||||||
@ -1060,8 +1060,8 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
# Transition between the recorded node path and the driven one
|
# Transition between the recorded node path and the driven one
|
||||||
pos = (rPos * (1 - t)) + (pos * t)
|
pos = (rPos * (1 - t)) + (pos * t)
|
||||||
hpr = (rHpr * (1 - t)) + (hpr * t)
|
hpr = (rHpr * (1 - t)) + (hpr * t)
|
||||||
elif ((self.recordingType.get() == 'Refine') &
|
elif ((self.recordingType.get() == 'Refine') and
|
||||||
(time > self.controlStop) &
|
(time > self.controlStop) and
|
||||||
((self.recordStop - self.controlStop) != 0.0)):
|
((self.recordStop - self.controlStop) != 0.0)):
|
||||||
rPos = self.playbackNodePath.getPos(self.nodePathParent)
|
rPos = self.playbackNodePath.getPos(self.nodePathParent)
|
||||||
rHpr = self.playbackNodePath.getHpr(self.nodePathParent)
|
rHpr = self.playbackNodePath.getHpr(self.nodePathParent)
|
||||||
@ -1084,7 +1084,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
|
|
||||||
def computeCurves(self):
|
def computeCurves(self):
|
||||||
# Check to make sure curve fitters have points
|
# Check to make sure curve fitters have points
|
||||||
if ((self.xyzCurveFitter.getNumSamples() == 0) |
|
if ((self.xyzCurveFitter.getNumSamples() == 0) or
|
||||||
(self.hprCurveFitter.getNumSamples() == 0)):
|
(self.hprCurveFitter.getNumSamples() == 0)):
|
||||||
print 'MopathRecorder.computeCurves: Must define curve first'
|
print 'MopathRecorder.computeCurves: Must define curve first'
|
||||||
return
|
return
|
||||||
@ -1288,7 +1288,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.loopPlayback = self.getVariable('Playback', 'Loop').get()
|
self.loopPlayback = self.getVariable('Playback', 'Loop').get()
|
||||||
|
|
||||||
def playbackGoTo(self, time):
|
def playbackGoTo(self, time):
|
||||||
if (self.xyzNurbsCurve == None) & (self.hprNurbsCurve == None):
|
if (self.xyzNurbsCurve == None) and (self.hprNurbsCurve == None):
|
||||||
return
|
return
|
||||||
self.playbackTime = CLAMP(time, 0.0, self.maxT)
|
self.playbackTime = CLAMP(time, 0.0, self.maxT)
|
||||||
if self.xyzNurbsCurve != None:
|
if self.xyzNurbsCurve != None:
|
||||||
@ -1301,7 +1301,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.playbackNodePath.setHpr(self.nodePathParent, hpr)
|
self.playbackNodePath.setHpr(self.nodePathParent, hpr)
|
||||||
|
|
||||||
def startPlayback(self):
|
def startPlayback(self):
|
||||||
if (self.xyzNurbsCurve == None) & (self.hprNurbsCurve == None):
|
if (self.xyzNurbsCurve == None) and (self.hprNurbsCurve == None):
|
||||||
return
|
return
|
||||||
# Kill any existing tasks
|
# Kill any existing tasks
|
||||||
self.stopPlayback()
|
self.stopPlayback()
|
||||||
@ -1329,7 +1329,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
cTime = state.currentTime + dTime
|
cTime = state.currentTime + dTime
|
||||||
# Stop task if not looping and at end of curve
|
# Stop task if not looping and at end of curve
|
||||||
# Or if refining curve and past recordStop
|
# Or if refining curve and past recordStop
|
||||||
if ((self.recordingType.get() == 'Refine') &
|
if ((self.recordingType.get() == 'Refine') and
|
||||||
(cTime > self.recordStop)):
|
(cTime > self.recordStop)):
|
||||||
# Go to recordStop
|
# Go to recordStop
|
||||||
self.getWidget('Playback', 'Time').set(self.recordStop)
|
self.getWidget('Playback', 'Time').set(self.recordStop)
|
||||||
@ -1338,8 +1338,8 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
# Also kill record task
|
# Also kill record task
|
||||||
self.toggleRecordVar()
|
self.toggleRecordVar()
|
||||||
return Task.done
|
return Task.done
|
||||||
elif (((self.loopPlayback == 0) & (cTime > self.maxT)) |
|
elif (((self.loopPlayback == 0) and (cTime > self.maxT)) or
|
||||||
((self.recordingType.get() == 'Extend') & (cTime > self.maxT))):
|
((self.recordingType.get() == 'Extend') and (cTime > self.maxT))):
|
||||||
# Go to maxT
|
# Go to maxT
|
||||||
self.getWidget('Playback', 'Time').set(self.maxT)
|
self.getWidget('Playback', 'Time').set(self.maxT)
|
||||||
# Then stop playback
|
# Then stop playback
|
||||||
@ -1373,7 +1373,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.desampleFrequency = frequency
|
self.desampleFrequency = frequency
|
||||||
|
|
||||||
def desampleCurve(self):
|
def desampleCurve(self):
|
||||||
if ((self.xyzCurveFitter.getNumSamples() == 0) |
|
if ((self.xyzCurveFitter.getNumSamples() == 0) or
|
||||||
(self.hprCurveFitter.getNumSamples() == 0)):
|
(self.hprCurveFitter.getNumSamples() == 0)):
|
||||||
print 'MopathRecorder.desampleCurve: Must define curve first'
|
print 'MopathRecorder.desampleCurve: Must define curve first'
|
||||||
return
|
return
|
||||||
@ -1393,7 +1393,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
self.numSamples = int(numSamples)
|
self.numSamples = int(numSamples)
|
||||||
|
|
||||||
def sampleCurve(self, even = 'None Given'):
|
def sampleCurve(self, even = 'None Given'):
|
||||||
if (self.xyzNurbsCurve == None) & (self.hprNurbsCurve == None):
|
if (self.xyzNurbsCurve == None) and (self.hprNurbsCurve == None):
|
||||||
print 'MopathRecorder.sampleCurve: Must define curve first'
|
print 'MopathRecorder.sampleCurve: Must define curve first'
|
||||||
return
|
return
|
||||||
# Reset curve fitters
|
# Reset curve fitters
|
||||||
@ -1662,7 +1662,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
# Get points within bounds
|
# Get points within bounds
|
||||||
for time, pos, hpr in oldPoints:
|
for time, pos, hpr in oldPoints:
|
||||||
# Is it within the time?
|
# Is it within the time?
|
||||||
if ((time > self.cropFrom) &
|
if ((time > self.cropFrom) and
|
||||||
(time < self.cropTo)):
|
(time < self.cropTo)):
|
||||||
# Add it to the curve fitters
|
# Add it to the curve fitters
|
||||||
t = time - self.cropFrom
|
t = time - self.cropFrom
|
||||||
@ -1707,7 +1707,7 @@ class MopathRecorder(AppShell, PandaObject):
|
|||||||
nodePath = loader.loadModel(mopathFilename)
|
nodePath = loader.loadModel(mopathFilename)
|
||||||
if nodePath:
|
if nodePath:
|
||||||
self.extractCurves(nodePath)
|
self.extractCurves(nodePath)
|
||||||
if ((self.xyzNurbsCurve != None) &
|
if ((self.xyzNurbsCurve != None) and
|
||||||
(self.hprNurbsCurve != None)):
|
(self.hprNurbsCurve != None)):
|
||||||
# Save a pointset for this curve
|
# Save a pointset for this curve
|
||||||
self.savePointSet()
|
self.savePointSet()
|
||||||
|
@ -455,7 +455,7 @@ class Placer(AppShell):
|
|||||||
self.nodePathMenuEntry.configure(
|
self.nodePathMenuEntry.configure(
|
||||||
background = self.nodePathMenuBG)
|
background = self.nodePathMenuBG)
|
||||||
# Check to see if node path and ref node path are the same
|
# Check to see if node path and ref node path are the same
|
||||||
if ((self.refCS != None) &
|
if ((self.refCS != None) and
|
||||||
(self.refCS.id() == self['nodePath'].id())):
|
(self.refCS.id() == self['nodePath'].id())):
|
||||||
# Yes they are, use temp CS as ref
|
# Yes they are, use temp CS as ref
|
||||||
# This calls updatePlacer
|
# This calls updatePlacer
|
||||||
@ -499,7 +499,7 @@ class Placer(AppShell):
|
|||||||
listbox = self.refNodePathMenu.component('scrolledlist')
|
listbox = self.refNodePathMenu.component('scrolledlist')
|
||||||
listbox.setlist(self.refNodePathNames)
|
listbox.setlist(self.refNodePathNames)
|
||||||
# Check to see if node path and ref node path are the same
|
# Check to see if node path and ref node path are the same
|
||||||
if (nodePath != None) & (nodePath.id() == self['nodePath'].id()):
|
if (nodePath != None) and (nodePath.id() == self['nodePath'].id()):
|
||||||
# Yes they are, use temp CS and update listbox accordingly
|
# Yes they are, use temp CS and update listbox accordingly
|
||||||
nodePath = self.tempCS
|
nodePath = self.tempCS
|
||||||
self.refNodePathMenu.selectitem('self')
|
self.refNodePathMenu.selectitem('self')
|
||||||
@ -549,7 +549,7 @@ class Placer(AppShell):
|
|||||||
hpr = Vec3(0)
|
hpr = Vec3(0)
|
||||||
scale = Vec3(1)
|
scale = Vec3(1)
|
||||||
np = self['nodePath']
|
np = self['nodePath']
|
||||||
if (np != None) & isinstance(np, NodePath):
|
if (np != None) and isinstance(np, NodePath):
|
||||||
# Update temp CS
|
# Update temp CS
|
||||||
self.updateAuxiliaryCoordinateSystems()
|
self.updateAuxiliaryCoordinateSystems()
|
||||||
# Update widgets
|
# Update widgets
|
||||||
@ -620,7 +620,7 @@ class Placer(AppShell):
|
|||||||
|
|
||||||
def xformRelative(self, value, axis):
|
def xformRelative(self, value, axis):
|
||||||
nodePath = self['nodePath']
|
nodePath = self['nodePath']
|
||||||
if (nodePath != None) & (self.refCS != None):
|
if (nodePath != None) and (self.refCS != None):
|
||||||
if axis == 'x':
|
if axis == 'x':
|
||||||
nodePath.setX(self.refCS, value)
|
nodePath.setX(self.refCS, value)
|
||||||
elif axis == 'y':
|
elif axis == 'y':
|
||||||
@ -639,8 +639,8 @@ class Placer(AppShell):
|
|||||||
|
|
||||||
def xformOrbit(self, value, axis):
|
def xformOrbit(self, value, axis):
|
||||||
nodePath = self['nodePath']
|
nodePath = self['nodePath']
|
||||||
if ((nodePath != None) & (self.refCS != None) &
|
if ((nodePath != None) and (self.refCS != None) and
|
||||||
(self.orbitFromCS != None) & (self.orbitToCS != None)):
|
(self.orbitFromCS != None) and (self.orbitToCS != None)):
|
||||||
if axis == 'x':
|
if axis == 'x':
|
||||||
self.posOffset.setX(value)
|
self.posOffset.setX(value)
|
||||||
elif axis == 'y':
|
elif axis == 'y':
|
||||||
|
@ -232,9 +232,9 @@ class Dial(Pmw.MegaWidget):
|
|||||||
delta = self.delta
|
delta = self.delta
|
||||||
dialAngle = dialAngle % TWO_PI
|
dialAngle = dialAngle % TWO_PI
|
||||||
# Check for rollover, if necessary
|
# Check for rollover, if necessary
|
||||||
if (self.lastAngle > ONEPOINTFIVE_PI) & (dialAngle < POINTFIVE_PI):
|
if (self.lastAngle > ONEPOINTFIVE_PI) and (dialAngle < POINTFIVE_PI):
|
||||||
self.baseVal = self.baseVal + delta
|
self.baseVal = self.baseVal + delta
|
||||||
elif (self.lastAngle < POINTFIVE_PI) & (dialAngle > ONEPOINTFIVE_PI):
|
elif (self.lastAngle < POINTFIVE_PI) and (dialAngle > ONEPOINTFIVE_PI):
|
||||||
self.baseVal = self.baseVal - delta
|
self.baseVal = self.baseVal - delta
|
||||||
self.lastAngle = dialAngle
|
self.lastAngle = dialAngle
|
||||||
# Update value and entry
|
# Update value and entry
|
||||||
@ -257,7 +257,7 @@ class Dial(Pmw.MegaWidget):
|
|||||||
self.dialAngle = None
|
self.dialAngle = None
|
||||||
else:
|
else:
|
||||||
self.updateIndicator(value)
|
self.updateIndicator(value)
|
||||||
if fCommand & (self['command'] != None):
|
if fCommand and (self['command'] != None):
|
||||||
apply(self['command'], [value] + self['commandData'])
|
apply(self['command'], [value] + self['commandData'])
|
||||||
|
|
||||||
def updateIndicator(self, value):
|
def updateIndicator(self, value):
|
||||||
|
@ -223,7 +223,7 @@ class EntryScale(Pmw.MegaWidget):
|
|||||||
self.entry.checkentry()
|
self.entry.checkentry()
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
if fCommand & (self['command'] is not None):
|
if fCommand and (self['command'] is not None):
|
||||||
self['command']( newVal )
|
self['command']( newVal )
|
||||||
|
|
||||||
def onReturn(self, *args):
|
def onReturn(self, *args):
|
||||||
@ -349,7 +349,7 @@ class EntryScaleGroup(Pmw.MegaToplevel):
|
|||||||
self._value[i] = value[i]
|
self._value[i] = value[i]
|
||||||
# Update entryScale, but don't execute its command
|
# Update entryScale, but don't execute its command
|
||||||
self.entryScaleList[i].set(value[i], 0)
|
self.entryScaleList[i].set(value[i], 0)
|
||||||
if fCommand & (self['command'] is not None):
|
if fCommand and (self['command'] is not None):
|
||||||
self['command'](self._value)
|
self['command'](self._value)
|
||||||
|
|
||||||
def setAt(self, index, value):
|
def setAt(self, index, value):
|
||||||
|
@ -182,7 +182,7 @@ class Floater(Pmw.MegaWidget):
|
|||||||
self.entry.checkentry()
|
self.entry.checkentry()
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
if fCommand & (self['command'] is not None):
|
if fCommand and (self['command'] is not None):
|
||||||
apply(self['command'], [newVal] + self['commandData'])
|
apply(self['command'], [newVal] + self['commandData'])
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
@ -305,7 +305,7 @@ class FloaterGroup(Pmw.MegaToplevel):
|
|||||||
self._value[i] = value[i]
|
self._value[i] = value[i]
|
||||||
# Update floater, but don't execute its command
|
# Update floater, but don't execute its command
|
||||||
self.floaterList[i].set(value[i], 0)
|
self.floaterList[i].set(value[i], 0)
|
||||||
if fCommand & (self['command'] is not None):
|
if fCommand and (self['command'] is not None):
|
||||||
self['command'](self._value)
|
self['command'](self._value)
|
||||||
|
|
||||||
def setAt(self, index, value):
|
def setAt(self, index, value):
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# - key bindings (instead of quick-n-dirty bindings on Canvas):
|
# - key bindings (instead of quick-n-dirty bindings on Canvas):
|
||||||
# - up/down arrow keys to move focus around
|
# - up/down arrow keys to move focus around
|
||||||
# - ditto for page up/down, home/end
|
# - ditto for page up/down, home/end
|
||||||
# - left/right arrows to expand/collapse & move out/in
|
# - left/right arrows to expand/collapse and move out/in
|
||||||
# - more doc strings
|
# - more doc strings
|
||||||
# - add icons for "file", "module", "class", "method"; better "python" icon
|
# - add icons for "file", "module", "class", "method"; better "python" icon
|
||||||
# - callback for selection???
|
# - callback for selection???
|
||||||
|
@ -213,7 +213,7 @@ class VectorEntry(Pmw.MegaWidget):
|
|||||||
|
|
||||||
def action(self, fCommand = 1):
|
def action(self, fCommand = 1):
|
||||||
self._refreshFloaters()
|
self._refreshFloaters()
|
||||||
if fCommand & (self['command'] != None):
|
if fCommand and (self['command'] != None):
|
||||||
self['command'](self._value)
|
self['command'](self._value)
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user