AWDParser2: Is there any unique and static asset identification in AWD? (beyond the IAsset.id)

Software: Away3D 4.x

rdoi, Member
Posted: 01 October 2013 08:54 PM   Total Posts: 86

The situation:

First load an AwayBuilder created AWD file in my application, then associate some extra data to some meshes, and finally save these data to an external database.

Later, when the same AWD is loaded again, I want to recognize and reassociate these extra data to the same meshes.

So related to AWDParser2, the first idea was using the fancy IAsset.id (GUID) of the loaded mesh instance, but soon I realized it changes everytime I load the AWD file.

Is there a way to retrieve/expose the asset AWDBlock.id without rewritting the default parser?

I could be using the Entity.extra field or Entity.name to implement some custom association, but I don’t have much control over the AWD files, nor I can rewrite them.

So, Is there any unique and static asset identification method in AWD that I could safely retrieve every time I load the awd file?

   

Avatar
80prozent, Sr. Member
Posted: 03 October 2013 12:33 PM   Total Posts: 430   [ # 1 ]

Hi

I am not shure i understand the question 100 %.

In AWD there is only the Asset-Block-ID.
The block-id will always be in nummeric order (so first block has id 2, 10th block in the file has id 10).

what you are looking for is a way to reference assets across multiple AWDs ?

its one of the stuff i have been thinking about a lot, but not yet have a good solution.

for now, the only way that would work, is to just use the AWD-filePath + asset.name to reference it. (you have to be carefull that every asset inside one awd-file have a unique name)

so, when loading a awd, you can listen for the asset-completeEvent.
For each asset that is completed, you can use the filepath to the AWD + the asset name to look up the extra-stuff from your databank.

hope that makes any sense

 Signature 

sorry…i hope my actionscript is better than my english…

   

rdoi, Member
Posted: 03 October 2013 08:45 PM   Total Posts: 86   [ # 2 ]

Hi there,

No, I don’t need a object reference across AWDs (although it would be a nice bonus).

Yes, what I am looking for is something like the AssetBlockID, but (I believe) it is not exposed outside the parser, nor it is in the event.asset received in AssetCompletedEvent. And I would like to avoid messing with the default AWD2Parser or create a custom AWDEncoder to avoid any future incompatibility.

Long story short: If the GUID assigned to the asset.id get saved (and retrieved) in the AWD, it would solve my problem. Also, I think it would help a lot when the Builder grows to a complete level designer tool, enabling some nice cross-file references.

I am not sure yet, but I think I will adopt the naming convention, or maybe a “manual id” in the extra field, and add it as a required step to the AwayBuilder workflow.

Thanks for your help anyway.

   

Avatar
80prozent, Sr. Member
Posted: 04 October 2013 10:12 AM   Total Posts: 430   [ # 3 ]

Hi

Ok i think i know understand better

Atm, i think its like this:

when a asset is loaded, the assetlibrary assigns the asset.id to it.
This asset.id is not the same as the blockID of the assets AWDBlock.
This asset.id is a unique number containing a timestamp (to make it unique). This asset.id is used in AwayBuilder to translate between the assetVO (the virtualObjects used in the AwayBuilder GUI) and the actual away3d-assets.
This asset.id is not saved into the AWD (yet). When loading a AWD, each asset will get a new asset.id assigned.

You are right: this asset ids should be saved to allow for referencing between multiple AWD-files (loading levels).

 

 Signature 

sorry…i hope my actionscript is better than my english…

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X