Amaan Akram wrote:
> Hi Ben,
>
> Thanks very much for sending the code. It seems perfectly
> straightforward, but unfortunately, it does not work for me.
>
> Your code integrated just fine, queried the proper object, but it
> heads straight to the following line of code
> if( !found_userdata )
> {
> mi_error("base object data not found");
> return( miTRUE );
> }
>
> This is all a bit new to me and a bit strange. When I put userdata on
> the state->instance object (the geometry shader primitive), I can
> query the userdata just fine at:
> <object_name>/Polygon Mesh_Inst(0) level.
>
> But when the userdata is placed on an object other than the geo shader
> primitive, the userdata gets placed in <object_name>[i] level. I
> confirmed this by outputting to an .mi file (as suggested by Philipp).
> So when I query an object at this level (<object_name>[i]), I can read
> the userdata just fine.
>
> I must admit I am quite new at this whole shader writing thing & I am
> not able to figure out why userdata gets put in a separate place in
> the scene DAG when we are dealing with object tags other than
> state->instance (which is where the wireframe example in the SDK
> fetches its userdata from).
>
> Thanks!
> Amaan
>
> Ben Rogall wrote:
>> Here's a chunk of code from my Binder addon. It's from the geoshader
>> and the spdl points to the null object with the UserDataBlob (for
>> some reason it's never worked for me to just put the blob under the
>> geoshader primitive itself).
>>
>> ------------------------------------------------------------------------------------------------
>>
>> miTag dataTag;
>> miUint dataLabel;
>> miBoolean found_userdata = miFALSE;
>> void * p_userdata = NULL;
>>
>> miTag * objects = ¶ms->objects[ params->i_objects ];
>>
>> miTag objtag = miNULLTAG;
>> if(!mi_query(miQ_INST_ITEM, NULL, objects[ 0 ], (void *)&objtag))
>> {
>> mi_error("objtag not found");
>> return( miTRUE );
>> }
>>
>> mi_query(miQ_INST_DATA, NULL, objects[ 0 ], (void *)&dataTag);
>>
>>
>> for( ; ; )
>> {
>> if(!mi_query( miQ_DATA_LABEL, NULL, dataTag, (void
>> *)&dataLabel ))
>> break;
>>
>> if( dataLabel == 6789 ) //found userdatablob
>> {
>> found_userdata = miTRUE;
>> mi_query( miQ_DATA_PARAM, NULL, dataTag, &p_userdata ); //
>> get pointer to the blob
>>
>> break;
>> }
>>
>> if( !mi_query( miQ_DATA_NEXT, NULL, dataTag, (void *)&dataTag ) )
>> break;
>> }
>>
>> if( !found_userdata )
>> {
>> mi_error("base object data not found");
>> return( miTRUE );
>> }
>>
>> -----------------------------------------------------------------------------------------------
>>
>>
>> Hope it helps,
>> Ben
>>
>>
>>
>>
>>
>> Amaan Akram wrote:
>>> Hi Philipp,
>>>
>>> Thanks for replying
>>>
>>> Yes, when I put a userdatablob on the geoshader primitive itself,
>>> and run the following command, I get access to the user data set in
>>> XSI.
>>> mi_query( miQ_INST_DATA, NULL, state->instance, (void
>>> *)&userdata_tag );
>>>
>>>
>>> My geoshader's SPDL has an object list defined where I go and select
>>> the object with the userdatablob defined. This is what I am doing in
>>> my code where I can't get any user data back
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> //get miTag to the object selected in the Object List in the
>>> geoshader SPDL
>>> ...
>>> ...
>>> //traverse scene DAG and arrive at the parent of the object instance
>>> ...
>>> ...
>>> miTag child_tag;
>>> mi_query( miQ_GROUP_KID, NULL, parent_tag, &child_tag,
>>> child_index );
>>> int tagtype = mi_db_type(child_type);
>>> if(tagtype==miSCENE_INSTANCE)
>>> {
>>> mi_query( miQ_INST_DATA, NULL, child, (void
>>> *)&userdata_tag );
>>> if(!userdata_tag)
>>> mi_warning("null userdata");
>>> }
>>> ------------------------------------------------------------------------------
>>>
>>>
>>> Any ideas? :(
>>>
>>> Thanks
>>> Amaan
>>>
>>
>> ---
>> 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