away3d / away3d-core-fp11

Away3D engine for Flash Player 11
http://www.away3d.com
Other
640 stars 273 forks source link

NamedAssetBase's namespace should be DEFAULT_NAMESPACE by default (or AssetLibrary.removeAssetFromDict() should auto-default) #698

Open esidegallery opened 10 years ago

esidegallery commented 10 years ago

I am using a third-party loader to create BitmapTextures and manually adding them to an AssetBundle.

However, when manually creating an instance of NamedAssetBase, its _namespace property is null, rather than DEFAULT_NAMESPACE.

I've found this to cause issues with AssetLibraryBundle further down the line when manually adding and removing assets: i.e. in AssetLibraryBundle.addAsset(), if the asset's namespace is null it is added to the dictionary's DEFAULT_NAMESPACE ("default"). However, in AssetLibraryBundle.removeAssetFromDict() the assets namespace isn't defaulted, and therefore the asset is not found and not removed.

I've found a workaround, which is to call texture.resetAssetPath(texture.name, NamedAssetBase.DEFAULT_NAMESPACE, false); before adding it to the bundle, but this shouldn't have to be the case.