[Opensim-users] How to change a prim's texture

matan keret matan504 at gmail.com
Thu Nov 12 11:23:43 UTC 2009


Hi,

I'm working on realXtend platform (ModreX) and OpenSim-0.6.7, coding
in IronPython 2.0.3.
I've got an image that i'de like to put as a texture of a prim.

the code that i used is:

#       the code that comes before what I've pasted next fetches an image
attachment from an e-mail using:
#       image = part.get_payload(decode = True)

#       now the code that tries to make it a texture:
        asset.FullID = str(uuid.uuid1())
        asset.Name = "DynamicImage" + str(Util.RandomClass.Next(1, 10000))
        asset.Type = 0
        asset.Description = "Mail image"
        asset.Local = False
        asset.Temporary = False

#       image is an 'str' type, but is actually an image. converting to
byteArray type
        byteArray = Array[Byte](tuple(Byte(ord(c)) for c in image))
        asset.Data = byteArray

        self.MyWorld.CS.World.AssetService.Store(asset)
        j2kdecoder.syncdecode(asset.FullID, asset.Data)
        self.MyWorld.CS.World.AssetService.Store(asset)

#       now the decoded image is stored. trying to present texture
        id = str(asset.FullID)

#       this next command doesn't work for me. i get white texture on all
faces instead of my image
        LSLObject.llSetTexture(self, id, -1)

or if you'de like to see the code in pastebin: http://pastebin.org/52980


This doesn't work for me, as i get some white texture in the end.
I don't know what am I doing wrong..  :-(

Thank you,
  Matan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-users/attachments/20091112/0a9d46e0/attachment.html>


More information about the Opensim-users mailing list