mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -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,
|
def setGeom(self, geom,
|
||||||
parent = NodePath(),
|
parent = NodePath(),
|
||||||
transform = TransformState.makeIdentity(),
|
transform = None,
|
||||||
sort = 0,
|
sort = 0,
|
||||||
color = None):
|
color = None):
|
||||||
# Get the original parent, transform, and sort, if any, so we can
|
# Get the original parent, transform, and sort, if any, so we can
|
||||||
# preserve them across this call.
|
# preserve them across this call.
|
||||||
if not self.isEmpty():
|
if not self.isEmpty():
|
||||||
parent = self.getParent()
|
parent = self.getParent()
|
||||||
transform = self.getTransform()
|
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()
|
sort = self.getSort()
|
||||||
if self.hasColor():
|
if color == None and self.hasColor():
|
||||||
color = self.getColor()
|
color = self.getColor()
|
||||||
|
|
||||||
self.removeNode()
|
self.removeNode()
|
||||||
@ -92,7 +96,8 @@ class OnscreenGeom(PandaObject, NodePath):
|
|||||||
self.reparentTo(parent, sort)
|
self.reparentTo(parent, sort)
|
||||||
|
|
||||||
if not self.isEmpty():
|
if not self.isEmpty():
|
||||||
self.setTransform(transform)
|
if transform:
|
||||||
|
self.setTransform(transform.compose(self.getTransform()))
|
||||||
|
|
||||||
# Set color, if specified
|
# Set color, if specified
|
||||||
if color:
|
if color:
|
||||||
|
@ -75,13 +75,17 @@ class OnscreenImage(PandaObject, NodePath):
|
|||||||
|
|
||||||
def setImage(self, image,
|
def setImage(self, image,
|
||||||
parent = NodePath(),
|
parent = NodePath(),
|
||||||
transform = TransformState.makeIdentity(),
|
transform = None,
|
||||||
sort = 0):
|
sort = 0):
|
||||||
# Get the original parent, transform, and sort, if any, so we can
|
# Get the original parent, transform, and sort, if any, so we can
|
||||||
# preserve them across this call.
|
# preserve them across this call.
|
||||||
if not self.isEmpty():
|
if not self.isEmpty():
|
||||||
parent = self.getParent()
|
parent = self.getParent()
|
||||||
transform = self.getTransform()
|
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()
|
sort = self.getSort()
|
||||||
|
|
||||||
self.removeNode()
|
self.removeNode()
|
||||||
@ -113,7 +117,7 @@ class OnscreenImage(PandaObject, NodePath):
|
|||||||
else:
|
else:
|
||||||
print 'OnscreenImage: model %s not found' % image[0]
|
print 'OnscreenImage: model %s not found' % image[0]
|
||||||
|
|
||||||
if not self.isEmpty():
|
if transform and not self.isEmpty():
|
||||||
self.setTransform(transform)
|
self.setTransform(transform)
|
||||||
|
|
||||||
def getImage(self):
|
def getImage(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user