Hi,
I got nervous when all my imported models became white after updating my project to v1.9.2.
So I did a simple test program to confirm that it was nothing wrong in my code.
Here is the test code:
from direct.showbase.ShowBase import ShowBase
from math import pi, sin, cos
class MyApp(ShowBase):
def __init__(self):
# Open Panda3D
ShowBase.__init__(self)
useEgg = False
if useEgg:
# Load Egg file
model = self.loader.loadModel("cube.egg")
else:
# Loadd obj file
model = self.loader.loadModel("cube.obj")
# Export to bam
model.writeBamFile("cube.bam")
# Apply color
model.setColor(1,0,0,1)
# Reparent the model to render.
model.reparentTo(self.render)
# Move
model.setPos(1,0,0)
# Loadd bam file created from egg
modelbam = self.loader.loadModel("cube.bam")
# Apply color
modelbam.setColor(0,1,0,1)
# Reparent the model to render.
modelbam.reparentTo(self.render)
# Move
modelbam.setPos(-1,0,0)
# Add the spinCameraTask procedure to the task manager.
self.setFrameRateMeter(True)
self.taskMgr.add(self.spinCameraTask, "SpinCameraTask")
# Define a procedure to move the camera.
def spinCameraTask(self, task):
angleDegrees = task.time * 6.0
angleRadians = angleDegrees * (pi / 180.0)
self.camera.setPos(10 * sin(angleRadians), -10.0 * cos(angleRadians), 1)
self.camera.setHpr(angleDegrees, 0, 0)
return task.cont
if __name__ == '__main__':
App = MyApp()
App.run()
If I run it with v1.8.1, models imported from both egg and obj files are colored, even after being exported to bam and imported again.
If I run the same code in 1.9.2 (and even 1.10) the egg model works, but the obj model cannot be colored, neither after being exported to bam and imported again.
Is it a bug? or I am missiing something?
Regards,
Mikel
cube.obj (2.6 KB)
cube.egg (2.28 KB)