Click or drag to resize
Reader3dsThrowMissingTextureException Property
Gets or sets if Reader3ds.MissingTextureException is thrown if the texture is not found. If false then if the MissingTextureFileName is set it is used, if not set the simple SolidColorBrush material is used instead of texture (color is read from material). Default value is false.

Namespace: Ab3d
Assembly: Ab3d.Reader3ds (in Ab3d.Reader3ds.dll) Version: 9.0.5590.1040
Syntax
C#
public bool ThrowMissingTextureException { get; set; }

Property Value

Type: Boolean
Remarks

ThrowMissingTextureException is obsolete.

The property can be still used but it is recommended to use ResolveTextureFileCallback and ResolveAllTextureFiles instead. With their usage it is not needed to read the file twice to get the missing texture file and also it is possible to get all the missing files and not just the first one.

This property can be used in a viewer application when an exception must be shown if the texture file is not found. The exception is of type MissingTextureException that has the MissingTextureFileName property with missing file name. The following code is a sample of using ThrowMissingTextureException (the same code can also be found in my Viewer3d):

Ab3d.Reader3ds newReader3ds;
Model3DGroup buttonModel3DGroup;

newReader3ds = new Ab3d.Reader3ds();
newReader3ds.ThrowMissingTextureException = true;

try
{
    buttonModel3DGroup = newReader3ds.ReadFile("c:\\models\\button.3ds");
}
catch (Reader3ds.MissingTextureException e)
{
    MessageBox.Show("Missing texture: " + e.MissingTextureFileName);
    newReader3ds.ThrowMissingTextureException = false;
    buttonModel3DGroup = newReader3ds.ReadFile("c:\\models\\button.3ds");
}

The first time the Reader3ds is used the ThrowMissingTextureException is set to true. If the 3ds file has a missing texture the MissingTextureException is caught in catch. The missing file name is read and user can be informed about it. Then the ThrowMissingTextureException is set to false and the file is read again. This time the exception is not thrown and the model can be read.

Materials with textures have its Brush property set to the ImageBrush. But if the texture is not found a SolidColorBrush is used instead.

See Also