Re: Accessing UserDataBlob from Mental Ray

Date : Wed, 14 Jun 2006 12:11:37 +0200
To : XSI(at)Softimage.COM
From : Philipp Oeser <philipp.oeser(at)liga01.de>
Subject : Re: Accessing UserDataBlob from Mental Ray
Eh...where was my "C for dummies"-book again?  :-[
Thanks Mathieu, trying out right now...

Greetings
Philipp


Mathieu Leclaire schrieb:
try:

miInteger iDataSize;
mi_query(miQ_DATA_PARAM_SIZE, NULL, tTheData, &iDataSize);
mi_info( "*****Data Size: %d", iDataSize);

char* sDataString = new char[iDataSize];
mi_query(miQ_DATA_PARAM, NULL, tTheData, sDataString);
mi_info( "*****Data String: %s", sDataString);


...and don't forget to release the memory once you don't need sDataString anymore calling:

delete [] sDataString;


...I beleive that should work... try it out and let me know. To explain: allocate memory with new... since it's a pointer, mi_query without the & and release the memory at the end.


Mathieu Leclaire R&D Programmer Hybride Technologies


-----Original Message----- From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf Of Philipp Oeser Sent: Tuesday, June 13, 2006 8:13 AM To: xsi(at)Softimage.COM Subject: Accessing UserDataBlob from Mental Ray


Hi, second try at getting particle positions over to MentalRay (first was to read theParticleUserData directly but still cant do it). So this time: with own UserData. But I am having problems with retrieving the UserData from within a shader in MR. All I get is the first character of a string... so if I put "example" in a blob-string, in MentalRay I only get "e". I hope this is just some newbie C-thing or something, so if you can help me out, I'd be really happy :)

So, in XSI i ad d the blob to my selection (in this case just a grid)
and save a string with:
(this is just scripting, not C++, so as I understood I can only save
strings with it...)
............................................................................
...................

set oSel = Selection(0)
set oBlob = oSel.AddProperty( "UserDataBlob", , "data" )
oBlob.Value = "example"
SetValue oBlob&".RenderData", True
SetValue oBlob&".UserDataID", 1111111
............................................................................
...................


And, in MentalRay : ............................................................................ ...................

char *sTheData = "grid/data";
miTag tTheData = mi_api_name_lookup(sTheData);

miInteger iDataSize;
mi_query(miQ_DATA_PARAM_SIZE, NULL, tTheData, &iDataSize);
mi_info( "*****Data Size: %d", iDataSize);

char* sDataString;
mi_query(miQ_DATA_PARAM, NULL, tTheData, &sDataString);
mi_info( "*****Data String: %s", sDataString);
............................................................................
...................

The Data Size comes over nicely but the String ist truncated to the
first character. So, as I said I'm pretty unstable in C and dont have a
good understanding of what a blob is, so if you can point me in the
right direction or tell me where i make mistakes, you'll save my day :)

Greetz
Philipp
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi



---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi


--- Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body: unsubscribe xsi


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.