ReadingComplete
#2
If you are reading 3ds file from code, there is really no need to use ReadingComplete.

Because reading is synchronous you can just call ReadFile method and when it returns the reading is complete. The event is primary used for use in XAML (for Model3ds or using Reader3ds in XAML as resource) - there you need an event to know when loading of 3ds file is complete.


The problem with your code is that the read Model3DGroup is stored into modelGroup field from the ReadFile method:

modelGroup = newReader3ds.ReadFile(loadWho.FileName, Viewport1);

But the ReadingComplete event is fired just before the return statement in ReadFile - so your modelLoaded method is called before the modelGroup is set.

As already said - just forget the ReadingComplete and call the modelLoaded after the ReadFile.


By the way I am working on new version of Reader3ds where you will have ProgressChanged event to show progress while reading more complex files (just like it already exist in ReaderWmf and ReaderSvg).

Also there will be no need to use Reader3ds.MissingTextureException any more - it will be replaced by much better ResolveTextureFileCallback delegate.

The new version could be available in a week or two so stay in touch.
Andrej Benedik
  


Messages In This Thread
ReadingComplete - by Bryan Gabric - 09-24-2010, 05:59 PM
RE: ReadingComplete - by abenedik - 09-25-2010, 09:34 PM
RE: ReadingComplete - by Bryan Gabric - 09-27-2010, 07:33 PM
RE: ReadingComplete - by abenedik - 12-03-2010, 02:46 PM
RE: ReadingComplete - by kellador26 - 12-03-2010, 03:31 AM

Forum Jump:


Users browsing this thread:
2 Guest(s)