Following the code in ObjectDefinitionReader I managed to read object names but as it turns out I'm having a very hard time finding a way to actually map those names to the objects, i.e. finding what name belongs to what object. I read somewhere in the forum where Grarrick had pointed out that the key lies in TKE_Tag opcodes and these tags can be used for such later mappings, but I can't figure out how to use these tags. I was wondering if he or anyone else can point me the right direction and maybe some implementation details. Any helps would be greatly appreciated.
What I do is as follows:
The DWFDefinedObjectInstance->name() corresponds to the hoops TKE_Open_Segment Handler "GetSegment"
Basically I create a map of DWFDefinedObjectInstance->name() to all the properties, and as I process the Hoops Scene Graph, in eash OpenSegment::Execute function, lookup the map with the value returned by GetSegment();
If you want the 2d Whip location for the mapping, set a action event for set_object_node_action, and in the first parameter of the callback is WT_Object_Node, which has a object_node_name(), and voila, this corresponds back to the map I created.
Now regarding the hoops scenegraph, some contain libraries at the front of the scenegraph, and you will have to not assign details to these, but later on, transpose them to the correct location, and then assign the properties. ie "?Include Library" indicates the start of the include library. See the hoops documentation for more details regarding this. I just thought I would warn you on some of the pitfuls I hit as trying to figure all this out.
I Hope this helps.
The include libraries are exactly another problem I'm currently facing. I thought I would construct a map of segment names (acquired via GetSegment()) and object properties in the TKE_Open_Segment handler and then in each pass of TKE_Include_Segment search that map and find the pair that this TKE_Include_Segment references, and then copy the properties into it, but as it turns out, this doesn't work correctly. Maybe I should review some parts.
I try to implement your method names.
Thanks in advance.
I have tried to followed same procidure but i am not able to get DWFObjectDefiantion any component (except one given in ObjectDefinitionReader sample).Plese find details on :
(Sorry for spamming, i am replying here to reach you all quickly.. since this is where my whole project got struct)...
Is there any other way to map Include Segment number with DWF Data. I have even tried Content Defination -> DWFInstance but failed to map data since both nodeID from instance & include seg id are different.
am i missing some thing in whole process. Attached sample code on above post. Please help me out.
Thanks in advance.
Thank you for your question.
For 3D DWF, DWF Toolkit uses the opcode TKE_Tag to map an instance. The TKE_Tag count equals the instance node id. Then the named segment which includes the TKE_Tag will be mapped to the instance.
DWF Toolkit provides Object Definition and Content Definition (see sample ReadContentDefinition in DWF Toolkit) to record the instances. For the attached file “Blower_Frame.dwf”, instances are stored in Content Definition.
Please let me know if you have any further questions.
ADR/DWF Customer Support
PSEB-GE- ACRD PSEB