mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
DirectDialog--removal of model-loading by default and a bug-fix
Signed-off-by: rdb <git@rdb.name>
This commit is contained in:
parent
223620e27e
commit
2e555db30e
@ -94,8 +94,9 @@ class DirectDialog(DirectFrame):
|
|||||||
('text', '', None),
|
('text', '', None),
|
||||||
('text_align', TextNode.ALeft, None),
|
('text_align', TextNode.ALeft, None),
|
||||||
('text_scale', 0.06, None),
|
('text_scale', 0.06, None),
|
||||||
('image', DGG.getDefaultDialogGeom(), None),
|
('image', None, None),
|
||||||
('relief', None, None),
|
('relief', DGG.RAISED, None),
|
||||||
|
('borderWidth', (0.01, 0.01), None),
|
||||||
('buttonTextList', [], DGG.INITOPT),
|
('buttonTextList', [], DGG.INITOPT),
|
||||||
('buttonGeomList', [], DGG.INITOPT),
|
('buttonGeomList', [], DGG.INITOPT),
|
||||||
('buttonImageList', [], DGG.INITOPT),
|
('buttonImageList', [], DGG.INITOPT),
|
||||||
@ -210,10 +211,16 @@ class DirectDialog(DirectFrame):
|
|||||||
bounds = self.stateNodePath[0].getTightBounds()
|
bounds = self.stateNodePath[0].getTightBounds()
|
||||||
if image:
|
if image:
|
||||||
image.reparentTo(self.stateNodePath[0])
|
image.reparentTo(self.stateNodePath[0])
|
||||||
l = bounds[0][0]
|
if bounds is None:
|
||||||
r = bounds[1][0]
|
l = 0
|
||||||
b = bounds[0][2]
|
r = 0
|
||||||
t = bounds[1][2]
|
b = 0
|
||||||
|
t = 0
|
||||||
|
else:
|
||||||
|
l = bounds[0][0]
|
||||||
|
r = bounds[1][0]
|
||||||
|
b = bounds[0][2]
|
||||||
|
t = bounds[1][2]
|
||||||
# Center text and geom around origin
|
# Center text and geom around origin
|
||||||
# How far is center of text from origin?
|
# How far is center of text from origin?
|
||||||
xOffset = -(l+r)*0.5
|
xOffset = -(l+r)*0.5
|
||||||
@ -246,10 +253,16 @@ class DirectDialog(DirectFrame):
|
|||||||
bl = br = bb = bt = 0
|
bl = br = bb = bt = 0
|
||||||
for button in self.buttonList:
|
for button in self.buttonList:
|
||||||
bounds = button.stateNodePath[0].getTightBounds()
|
bounds = button.stateNodePath[0].getTightBounds()
|
||||||
bl = min(bl, bounds[0][0])
|
if bounds is None:
|
||||||
br = max(br, bounds[1][0])
|
bl = 0
|
||||||
bb = min(bb, bounds[0][2])
|
br = 0
|
||||||
bt = max(bt, bounds[1][2])
|
bb = 0
|
||||||
|
bt = 0
|
||||||
|
else:
|
||||||
|
bl = min(bl, bounds[0][0])
|
||||||
|
br = max(br, bounds[1][0])
|
||||||
|
bb = min(bb, bounds[0][2])
|
||||||
|
bt = max(bt, bounds[1][2])
|
||||||
bl -= bpad[0]
|
bl -= bpad[0]
|
||||||
br += bpad[0]
|
br += bpad[0]
|
||||||
bb -= bpad[1]
|
bb -= bpad[1]
|
||||||
@ -303,6 +316,7 @@ class DirectDialog(DirectFrame):
|
|||||||
# reduce bottom by pad, button height and 2*button pad
|
# reduce bottom by pad, button height and 2*button pad
|
||||||
b = min(b - self['midPad'] - bpad[1] - bHeight - bpad[1], b) - pad[1]
|
b = min(b - self['midPad'] - bpad[1] - bHeight - bpad[1], b) - pad[1]
|
||||||
t = t + self['topPad'] + pad[1]
|
t = t + self['topPad'] + pad[1]
|
||||||
|
self['frameSize'] = (l, r, b, t)
|
||||||
self['image_scale'] = (r - l, 1, t - b)
|
self['image_scale'] = (r - l, 1, t - b)
|
||||||
# Center frame about text and buttons
|
# Center frame about text and buttons
|
||||||
self['image_pos'] = ((l+r)*0.5, 0.0, (b+t)*0.5)
|
self['image_pos'] = ((l+r)*0.5, 0.0, (b+t)*0.5)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user