[Opensim-dev] creating some Asset

Justin Clark-Casey jjustincc at googlemail.com
Thu Sep 10 13:45:12 UTC 2009


Daniel Herzog wrote:
> Hi all,
> 
>  
> 
> I’m trying to map a picture stored in an image file to a texture 
> situated on a prim in Opensim via code. For that reason I have looked to 
> the osMakeNotecard() function in OSSL_Api.cs to get an overview which 
> steps are needed to upload an object to an inventory.
> 
>  
> 
> The first thing they do is to create an AssetBase followed by a 
> TaskInventoryItem that could be added to the inventory of the specified 
> prim. For me it seems that the AssetBase object has the data of the 
> object that should be added (for me: the data of the image) and is 
> connected with the TaskInventoryItem in the next step.
> 
>  
> 
> To get started, I have created an AssetBase object as well as an 
> TaskInventoryItem as shown in the osMakeNotecard function. To fill my 
> AssetBase object with some data, I have used the LoadAsset function 
> found in AssetLoadeFileSystem.cs (in addition I have also tried to get 
> the data of an image file with the function shown below). As a result I 
> see the new TaskItem in the inventory list of my prim as an image but 
> unfortunately with no content. What might be the reason for that empty 
> image?

These seems to be broadly the right track.  Two things to consider

1)  Have you converted your image to Jpeg2000 format (as required by SL)?  Grep 
for OpenJPEG.DecodeToImage in the code for examples of how to do this

2)  If so, check that the uploaded asset in the database actually contains your 
image data.

> 
>  
> 
> Furthermore, is this the right way by creating an AssetBase and a 
> TaskInventoryItem to get an image on a prim via code? Are there any 
> other possibilities?
> 

It sounds right, but you might want to examine the item upload code in

ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs

which I'm guessing more closely matches what you want to do.

>  
> 
> Thanks in advance,
> 
> Daniel
> 
>  
> 
> -----------------------------------------------
> 
>  
> 
> private byte[] BildToByteArray(Image Bild, 
> System.Drawing.Imaging.ImageFormat Bildformat)
> 
>         {
> 
>             MemoryStream IS = new MemoryStream();
> 
>             Bild.Save(IS, Bildformat);
> 
>             IS.Flush();
> 
>             return IS.ToArray();
> 
>        }
> 
>  
> 
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Opensim-dev mailing list
> Opensim-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/opensim-dev


-- 
justincc
Justin Clark-Casey
http://justincc.org



More information about the Opensim-dev mailing list