mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
preserve transform of input geom/image
This commit is contained in:
parent
2d5ecf1cab
commit
2b6af7a68f
@ -70,16 +70,20 @@ class OnscreenGeom(PandaObject, NodePath):
|
||||
|
||||
def setGeom(self, geom,
|
||||
parent = NodePath(),
|
||||
transform = TransformState.makeIdentity(),
|
||||
transform = None,
|
||||
sort = 0,
|
||||
color = None):
|
||||
# Get the original parent, transform, and sort, if any, so we can
|
||||
# preserve them across this call.
|
||||
if not self.isEmpty():
|
||||
parent = self.getParent()
|
||||
if transform == None:
|
||||
# If we're replacing a previous image, we throw away
|
||||
# the new image's transform in favor of the original
|
||||
# image's transform.
|
||||
transform = self.getTransform()
|
||||
sort = self.getSort()
|
||||
if self.hasColor():
|
||||
if color == None and self.hasColor():
|
||||
color = self.getColor()
|
||||
|
||||
self.removeNode()
|
||||
@ -92,7 +96,8 @@ class OnscreenGeom(PandaObject, NodePath):
|
||||
self.reparentTo(parent, sort)
|
||||
|
||||
if not self.isEmpty():
|
||||
self.setTransform(transform)
|
||||
if transform:
|
||||
self.setTransform(transform.compose(self.getTransform()))
|
||||
|
||||
# Set color, if specified
|
||||
if color:
|
||||
|
@ -75,12 +75,16 @@ class OnscreenImage(PandaObject, NodePath):
|
||||
|
||||
def setImage(self, image,
|
||||
parent = NodePath(),
|
||||
transform = TransformState.makeIdentity(),
|
||||
transform = None,
|
||||
sort = 0):
|
||||
# Get the original parent, transform, and sort, if any, so we can
|
||||
# preserve them across this call.
|
||||
if not self.isEmpty():
|
||||
parent = self.getParent()
|
||||
if transform == None:
|
||||
# If we're replacing a previous image, we throw away
|
||||
# the new image's transform in favor of the original
|
||||
# image's transform.
|
||||
transform = self.getTransform()
|
||||
sort = self.getSort()
|
||||
|
||||
@ -113,7 +117,7 @@ class OnscreenImage(PandaObject, NodePath):
|
||||
else:
|
||||
print 'OnscreenImage: model %s not found' % image[0]
|
||||
|
||||
if not self.isEmpty():
|
||||
if transform and not self.isEmpty():
|
||||
self.setTransform(transform)
|
||||
|
||||
def getImage(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user