expose texture unique id after loading URD file, so you can restore to the original texture after changing it to a custom texture. See also getTextureUid.py example.

This commit is contained in:
Erwin Coumans
2018-07-08 11:23:12 +02:00
parent bfc85ff1fd
commit 127b82ec1b
8 changed files with 227 additions and 26 deletions

View File

@@ -0,0 +1,19 @@
import pybullet as p
p.connect(p.GUI)
plane = p.loadURDF("plane.urdf")
visualData = p.getVisualShapeData(plane, p.VISUAL_SHAPE_DATA_TEXTURE_UNIQUE_IDS)
print(visualData)
curTexUid = visualData[0][8]
print(curTexUid)
texUid = p.loadTexture("tex256.png")
print("texUid=",texUid)
p.changeVisualShape(plane,-1,textureUniqueId=texUid)
for i in range (100):
p.getCameraImage(320,200)
p.changeVisualShape(plane,-1,textureUniqueId=curTexUid)
for i in range (100):
p.getCameraImage(320,200)