本文整理汇总了Python中SCObject.SCObject类的典型用法代码示例。如果您正苦于以下问题:Python SCObject类的具体用法?Python SCObject怎么用?Python SCObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SCObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: invalidate
def invalidate(self):
SCObject.invalidate(self)
parentMenu = self.getParentMenu()
if parentMenu is not None:
if not parentMenu.isFinalizing():
parentMenu.invalidate()
return
示例2: enterVisible
def enterVisible(self):
SCObject.enterVisible(self)
self.privScheduleFinalize()
for member in self:
if member.isViewable():
if not member.isVisible():
member.enterVisible()
self.childHasFaded = 0
alreadyFaded = 0
parentMenu = None
if self.holder is not None:
if self.holder.parentMenu is not None:
parentMenu = self.holder.parentMenu
alreadyFaded = parentMenu.childHasFaded
if SCMenu.WantFade:
if alreadyFaded:
self.fadeFunc(1.0)
else:
self.stopFade()
self.fadeIval = LerpFunctionInterval(self.fadeFunc, fromData=0.0, toData=1.0, duration=SCMenu.FadeDuration)
self.fadeIval.play()
if parentMenu is not None:
parentMenu.childHasFaded = 1
return
示例3: destroy
def destroy(self):
if self.isActive():
self.exitActive()
SCObject.destroy(self)
if hasattr(self, 'button'):
self.button.destroy()
del self.button
self.parentMenu = None
self.detachNode()
return
示例4: exitVisible
def exitVisible(self):
SCObject.exitVisible(self)
self.stopFade()
self.privCancelFinalize()
self._SCMenu__cancelActiveMemberSwitch()
self._SCMenu__setActiveMember(None)
for member in self:
if member.isVisible():
member.exitVisible()
continue
示例5: __init__
def __init__(self, parentMenu = None):
SCObject.__init__(self)
self.SerialNum = SCElement.SerialNum
SCElement.SerialNum += 1
node = hidden.attachNewNode('SCElement%s' % self.SerialNum)
NodePath.__init__(self, node)
self.FinalizeTaskName = 'SCElement%s_Finalize' % self.SerialNum
self.parentMenu = parentMenu
self.__active = 0
self.__viewable = 1
self.lastWidth = 0
self.lastHeight = 0
self.setDimensions(0, 0)
self.padX = 0.25
self.padZ = 0.1
示例6: finalize
def finalize(self, dbArgs = { }):
if not self.isDirty():
return None
SCObject.finalize(self)
if hasattr(self, 'button'):
self.button.destroy()
del self.button
halfHeight = self.height / 2.0
textX = 0
if dbArgs.has_key('text_align'):
if dbArgs['text_align'] == TextNode.ACenter:
textX = self.width / 2.0
args = {
'text': self.getDisplayText(),
'frameColor': (0, 0, 0, 0),
'rolloverColor': self.getColorScheme().getRolloverColor() + (1,),
'pressedColor': self.getColorScheme().getPressedColor() + (1,),
'text_font': OTPGlobals.getInterfaceFont(),
'text_align': TextNode.ALeft,
'text_fg': self.getColorScheme().getTextColor() + (1,),
'text_pos': (textX, -0.25 - halfHeight, 0),
'relief': DGG.FLAT,
'pressEffect': 0 }
args.update(dbArgs)
rolloverColor = args['rolloverColor']
pressedColor = args['pressedColor']
del args['rolloverColor']
del args['pressedColor']
btn = DirectButton(parent = self, frameSize = (0, self.width, -(self.height), 0), **None)
btn.frameStyle[DGG.BUTTON_ROLLOVER_STATE].setColor(*rolloverColor)
btn.frameStyle[DGG.BUTTON_DEPRESSED_STATE].setColor(*pressedColor)
btn.updateFrameStyle()
btn.bind(DGG.ENTER, self.onMouseEnter)
btn.bind(DGG.EXIT, self.onMouseLeave)
btn.bind(DGG.B1PRESS, self.onMouseClick)
self.button = btn
self.lastWidth = self.width
self.lastHeight = self.height
self.validate()
示例7: __init__
def __init__(self, holder = None):
SCObject.__init__(self)
self.SerialNum = SCMenu.SerialNum
SCMenu.SerialNum += 1
node = hidden.attachNewNode('SCMenu%s' % self.SerialNum)
NodePath.__init__(self, node)
self.setHolder(holder)
self.FinalizeTaskName = 'SCMenu%s_Finalize' % self.SerialNum
self.ActiveMemberSwitchTaskName = 'SCMenu%s_SwitchActiveMember' % self.SerialNum
self.bg = loader.loadModel(self.BackgroundModelName)
def findNodes(names, model = self.bg):
results = []
for name in names:
for nm in makeTuple(name):
node = model.find('**/%s' % nm)
if not node.isEmpty():
results.append(node)
break
continue
return results
(self.bgTop, self.bgBottom, self.bgLeft, self.bgRight, self.bgMiddle, self.bgTopLeft, self.bgBottomLeft, self.bgTopRight, self.bgBottomRight) = findNodes([
('top', 'top1'),
'bottom',
'left',
'right',
'middle',
'topLeft',
'bottomLeft',
'topRight',
'bottomRight'])
self.bg.reparentTo(self, -1)
self._SCMenu__members = []
self.activeMember = None
self.activeCandidate = None
self.fadeIval = None
self.width = 1
self.inFinalize = 0
示例8: destroy
def destroy(self):
self.stopFade()
SCObject.destroy(self)
del self.bgTop
del self.bgBottom
del self.bgLeft
del self.bgRight
del self.bgMiddle
del self.bgBottomLeft
del self.bgTopRight
del self.bgBottomRight
self.bg.removeNode()
del self.bg
self.holder = None
for member in self._SCMenu__members:
member.destroy()
del self._SCMenu__members
self.removeNode()
taskMgr.remove(self.FinalizeTaskName)
taskMgr.remove(self.ActiveMemberSwitchTaskName)
示例9: finalizeAll
def finalizeAll(self):
SCObject.finalizeAll(self)
for member in self:
member.finalizeAll()
示例10: invalidateAll
def invalidateAll(self):
SCObject.invalidateAll(self)
for member in self:
member.invalidateAll()
示例11: privSetSettingsRef
def privSetSettingsRef(self, settingsRef):
SCObject.privSetSettingsRef(self, settingsRef)
for member in self:
member.privSetSettingsRef(settingsRef)
示例12: finalize
def finalize(self):
if not self.isDirty():
return
self.inFinalize = 1
SCObject.finalize(self)
visibleMembers = []
for member in self:
if member.isViewable():
visibleMembers.append(member)
member.reparentTo(self)
else:
member.reparentTo(hidden)
if self.activeMember is member:
self.__setActiveMember(None)
maxWidth = 0.0
maxHeight = 0.0
for member in visibleMembers:
width, height = member.getMinDimensions()
maxWidth = max(maxWidth, width)
maxHeight = max(maxHeight, height)
holder = self.getHolder()
if holder is not None:
widthToCover = holder.getMinSubmenuWidth()
maxWidth = max(maxWidth, widthToCover)
memberWidth, memberHeight = maxWidth, maxHeight
self.width = maxWidth
for i in xrange(len(visibleMembers)):
member = visibleMembers[i]
member.setPos(0, 0, -i * maxHeight)
member.setDimensions(memberWidth, memberHeight)
member.finalize()
if len(visibleMembers) > 0:
z1 = visibleMembers[0].getZ(aspect2d)
visibleMembers[0].setZ(-maxHeight)
z2 = visibleMembers[0].getZ(aspect2d)
visibleMembers[0].setZ(0)
actualHeight = (z2 - z1) * len(visibleMembers)
bottomZ = self.getZ(aspect2d) + actualHeight
if bottomZ < -1.0:
overlap = bottomZ - -1.0
self.setZ(aspect2d, self.getZ(aspect2d) - overlap)
if self.getZ(aspect2d) > 1.0:
self.setZ(aspect2d, 1.0)
sX = memberWidth
sZ = memberHeight * len(visibleMembers)
self.bgMiddle.setScale(sX, 1, sZ)
self.bgTop.setScale(sX, 1, 1)
self.bgBottom.setScale(sX, 1, 1)
self.bgLeft.setScale(1, 1, sZ)
self.bgRight.setScale(1, 1, sZ)
self.bgBottomLeft.setZ(-sZ)
self.bgBottom.setZ(-sZ)
self.bgTopRight.setX(sX)
self.bgRight.setX(sX)
self.bgBottomRight.setX(sX)
self.bgBottomRight.setZ(-sZ)
sB = 0.15
self.bgTopLeft.setSx(aspect2d, sB)
self.bgTopLeft.setSz(aspect2d, sB)
self.bgBottomRight.setSx(aspect2d, sB)
self.bgBottomRight.setSz(aspect2d, sB)
self.bgBottomLeft.setSx(aspect2d, sB)
self.bgBottomLeft.setSz(aspect2d, sB)
self.bgTopRight.setSx(aspect2d, sB)
self.bgTopRight.setSz(aspect2d, sB)
self.bgTop.setSz(aspect2d, sB)
self.bgBottom.setSz(aspect2d, sB)
self.bgLeft.setSx(aspect2d, sB)
self.bgRight.setSx(aspect2d, sB)
r, g, b = self.getColorScheme().getFrameColor()
a = self.getColorScheme().getAlpha()
self.bg.setColorScale(r, g, b, a)
if self.activeMember is not None:
self.activeMember.reparentTo(self)
self.validate()
self.inFinalize = 0
return
示例13: invalidate
def invalidate(self):
SCObject.invalidate(self)
if self.isVisible():
self.privScheduleFinalize()
示例14: privSetSettingsRef
def privSetSettingsRef(self, settingsRef):
SCObject.privSetSettingsRef(self, settingsRef)
if self.menu is not None:
self.menu.privSetSettingsRef(settingsRef)
return
示例15: exitVisible
def exitVisible(self):
SCObject.exitVisible(self)
self.privCancelFinalize()