mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
drose changed onScreenText to TextNode
This commit is contained in:
parent
51d9d1a928
commit
71ad80feff
@ -2,6 +2,7 @@ import pdb
|
|||||||
from PandaObject import *
|
from PandaObject import *
|
||||||
from PieMenu import *
|
from PieMenu import *
|
||||||
from OnscreenText import *
|
from OnscreenText import *
|
||||||
|
from GuiGlobals import *
|
||||||
from Tkinter import *
|
from Tkinter import *
|
||||||
from DirectGeometry import *
|
from DirectGeometry import *
|
||||||
from SceneGraphExplorer import *
|
from SceneGraphExplorer import *
|
||||||
@ -1179,7 +1180,7 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
self.panel.setCurrentColor(state)
|
self.panel.setCurrentColor(state)
|
||||||
self.panel.setResetColor(state)
|
self.panel.setResetColor(state)
|
||||||
elif string.find(menuMode, 'orientation') >= 0:
|
elif string.find(menuMode, 'orientation') >= 0:
|
||||||
state = self.DNATarget.getCode()[-3:]
|
state = self.DNATarget.getCode()[-2:]
|
||||||
elif menuMode == 'building_width' >= 0:
|
elif menuMode == 'building_width' >= 0:
|
||||||
state = self.DNATarget.getWidth()
|
state = self.DNATarget.getWidth()
|
||||||
elif menuMode == 'window_count' >= 0:
|
elif menuMode == 'window_count' >= 0:
|
||||||
@ -1349,8 +1350,8 @@ class LevelEditor(NodePath, PandaObject):
|
|||||||
|
|
||||||
def setDNATargetOrientation(self, orientation):
|
def setDNATargetOrientation(self, orientation):
|
||||||
if (self.DNATarget != None) and (orientation != None):
|
if (self.DNATarget != None) and (orientation != None):
|
||||||
oldCode = self.DNATarget.getCode()[:-3]
|
oldCode = self.DNATarget.getCode()[:-2]
|
||||||
self.DNATarget.setCode(oldCode + '_' + orientation)
|
self.DNATarget.setCode(oldCode+orientation)
|
||||||
self.replaceSelected()
|
self.replaceSelected()
|
||||||
|
|
||||||
def setBuildingStyle(self, style):
|
def setBuildingStyle(self, style):
|
||||||
@ -2989,19 +2990,25 @@ class LevelStyleManager:
|
|||||||
aspectRatio = (direct.dr.width / float(direct.dr.height))
|
aspectRatio = (direct.dr.width / float(direct.dr.height))
|
||||||
# Attach the color chips to the new menu and adjust sizes
|
# Attach the color chips to the new menu and adjust sizes
|
||||||
for i in range (numItems):
|
for i in range (numItems):
|
||||||
# Create the node and set its color
|
# Create a text node--just a card, really--of the right color.
|
||||||
node = OnscreenText(' ')
|
tn = TextNode()
|
||||||
node.setColor(colorList[i])
|
tn.freeze()
|
||||||
bounds = node.getBounds()
|
tn.setFont(getDefaultFont())
|
||||||
center = bounds.getCenter()
|
tn.setTransform(Mat4.scaleMat(0.07, 0.07, 0.07 * aspectRatio))
|
||||||
center = center * (sf * node.getScale()[0])
|
tn.setCardColor(colorList[i])
|
||||||
|
tn.setCardActual(0, 1.1111, 0, 0.8333)
|
||||||
|
tn.setText(' ')
|
||||||
|
tn.thaw()
|
||||||
|
|
||||||
# Reposition it
|
# Reposition it
|
||||||
node.setPos((radius * math.cos(i * angle)) - center[0],
|
card = tn.getCardTransformed()
|
||||||
(radius * aspectRatio * math.sin(i * angle)) -
|
center = (card[1] - card[0], card[3] - card[2])
|
||||||
center[2])
|
|
||||||
node.setScale(node.getScale() * sf)
|
node = newColorMenu.attachNewNode(tn)
|
||||||
# Add it to the wallColorMenu
|
node.setScale(sf)
|
||||||
node.reparentTo(newColorMenu)
|
node.setPos(radius * math.cos(i * angle) - center[0], 0.0,
|
||||||
|
((radius * aspectRatio * math.sin(i * angle)) -
|
||||||
|
center[1]))
|
||||||
# Scale the whole shebang down by 0.5
|
# Scale the whole shebang down by 0.5
|
||||||
newColorMenu.setScale(0.5)
|
newColorMenu.setScale(0.5)
|
||||||
# Create and return resulting pie menu
|
# Create and return resulting pie menu
|
||||||
@ -3094,24 +3101,28 @@ class LevelStyleManager:
|
|||||||
aspectRatio = direct.dr.width/float(direct.dr.height)
|
aspectRatio = direct.dr.width/float(direct.dr.height)
|
||||||
# Add items
|
# Add items
|
||||||
for i in range (numItems):
|
for i in range (numItems):
|
||||||
# Create onscreen text node for each item
|
# Create text node for each item
|
||||||
if (textList[i] != None):
|
if (textList[i] != None):
|
||||||
node = OnscreenText(str(textList[i]))
|
tn = TextNode()
|
||||||
else:
|
tn.freeze()
|
||||||
node = None
|
tn.setFont(getDefaultFont())
|
||||||
if node:
|
tn.setTransform(Mat4.scaleMat(0.07, 0.07, 0.07 * aspectRatio))
|
||||||
|
tn.setTextColor(0, 0, 0, 1)
|
||||||
|
tn.setCardColor(1, 1, 1, 1)
|
||||||
|
tn.setCardAsMargin(0.1, 0.1, 0.1, 0.1)
|
||||||
|
tn.setText(str(textList[i]))
|
||||||
|
tn.thaw()
|
||||||
|
|
||||||
# Reposition it
|
# Reposition it
|
||||||
bounds = node.getBounds()
|
card = tn.getCardTransformed()
|
||||||
center = bounds.getCenter()
|
center = (card[1] - card[0], card[3] - card[2])
|
||||||
center = center * (sf * node.getScale()[0])
|
|
||||||
node.freeze()
|
node = newMenu.attachNewNode(tn)
|
||||||
node.setPos(radius * math.cos(i * angle) - center[0],
|
node.setScale(sf)
|
||||||
|
node.setPos(radius * math.cos(i * angle) - center[0], 0.0,
|
||||||
((radius * aspectRatio * math.sin(i * angle)) -
|
((radius * aspectRatio * math.sin(i * angle)) -
|
||||||
center[2]))
|
center[1]))
|
||||||
node.setScale(node.getScale() * sf)
|
|
||||||
node.thaw()
|
|
||||||
# Add it to the newMenu
|
|
||||||
node.reparentTo(newMenu)
|
|
||||||
# Scale the whole shebang down by 0.5
|
# Scale the whole shebang down by 0.5
|
||||||
newMenu.setScale(0.5)
|
newMenu.setScale(0.5)
|
||||||
# Create and return a pie menu
|
# Create and return a pie menu
|
||||||
|
Loading…
x
Reference in New Issue
Block a user