com.threerings.opengl.model.config
Class ModelConfig.Imported

java.lang.Object
  extended by com.threerings.util.DeepObject
      extended by com.threerings.opengl.model.config.ModelConfig.Implementation
          extended by com.threerings.opengl.model.config.ModelConfig.Imported
All Implemented Interfaces:
Exportable, Copyable, Cloneable
Direct Known Subclasses:
ArticulatedConfig, StaticConfig, StaticSetConfig
Enclosing class:
ModelConfig

public static class ModelConfig.Imported
extends ModelConfig.Implementation

Superclass of the imported implementations (this is not abstract because in order for the exporter to create a prototype of MaterialMapping, it must be able to instantiate this class).


Nested Class Summary
 class ModelConfig.Imported.MaterialMapping
          Represents a mapping from texture name to material.
 
Field Summary
protected  boolean _reload
          Indicates that updateFromSource(com.threerings.editor.util.EditorContext, boolean) should reload the data.
protected  String _source
          The resource from which we read the model data.
 float boundsExpansion
          A fixed amount by which to expand the bounds (to account for skinning).
 boolean generateTangents
          If true, generate tangent attributes for meshes.
 boolean ignoreRootTransforms
          If true, ignore the transforms of the top-level children.
 InfluenceFlagConfig influences
          The influences allowed to affect this model.
 ModelConfig.Imported.MaterialMapping[] materialMappings
          The mappings from texture name to material.
 float scale
          The model scale.
 
Constructor Summary
ModelConfig.Imported()
           
 
Method Summary
protected  void createDefaultMaterialMappings()
          Creates default material mappings for any unmapped textures.
protected static GeometryMaterial[] getGeometryMaterials(GlContext ctx, ModelConfig.VisibleMesh[] meshes, ModelConfig.Imported.MaterialMapping[] materialMappings)
          Creates the array of resolved geometry/material pairs.
protected  ModelConfig.Imported.MaterialMapping getMaterialMapping(String texture, String tag)
          Returns the material mapping for the specified texture (if any).
 Model.Implementation getModelImplementation(GlContext ctx, Scope scope, Model.Implementation impl)
          Creates or updates a model implementation for this configuration.
 GeometryConfig getParticleGeometry(GlContext ctx)
          Returns the GeometryConfig to use when this model is selected for use within a particle system (or null if it cannot be used).
 ConfigReference<MaterialConfig> getParticleMaterial(GlContext ctx)
          Returns a reference to the material to use when this model is selected for use within a particle system.
protected  ModelConfig.VisibleMesh getParticleMesh()
          Returns the ModelConfig.VisibleMesh to use when this model is selected for use within a particle system (or null if it cannot be used).
 String getSource()
          Returns the source file.
protected  void getTextures(TreeSet<String> textures)
          Populates the supplied set with the names of all referenced textures.
protected  void getTextureTagPairs(TreeSet<ComparableTuple<String,String>> pairs)
          Populates the supplied set with the names of all referenced texture/tag pairs.
 void setSource(String source)
          Sets the source file from which to load the animation data.
 void updateFromSource(EditorContext ctx, boolean force)
          Updates this implementation from its external source, if any.
protected  void updateFromSource(ModelDef def)
          Updates from a parsed model definition.
 
Methods inherited from class com.threerings.opengl.model.config.ModelConfig.Implementation
getConfigManager, getOriginal, getUpdateReferences, invalidate
 
Methods inherited from class com.threerings.util.DeepObject
clone, copy, copy, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

scale

@Editable(min=0.0,
          step=0.01,
          hgroup="s")
public float scale
The model scale.


boundsExpansion

@Editable(min=0.0,
          step=0.01,
          hgroup="s")
public float boundsExpansion
A fixed amount by which to expand the bounds (to account for skinning).


ignoreRootTransforms

@Editable(hgroup="i")
public boolean ignoreRootTransforms
If true, ignore the transforms of the top-level children.


generateTangents

@Editable(hgroup="i")
public boolean generateTangents
If true, generate tangent attributes for meshes.


influences

@Editable
public InfluenceFlagConfig influences
The influences allowed to affect this model.


materialMappings

@Editable(depends="source")
public ModelConfig.Imported.MaterialMapping[] materialMappings
The mappings from texture name to material.


_source

protected String _source
The resource from which we read the model data.


_reload

@DeepOmit
protected transient boolean _reload
Indicates that updateFromSource(com.threerings.editor.util.EditorContext, boolean) should reload the data.

Constructor Detail

ModelConfig.Imported

public ModelConfig.Imported()
Method Detail

setSource

@Editable(editor="resource",
          nullable=true)
@FileConstraints(description="m.exported_models",
                 extensions=".mxml",
                 directory="exported_model_dir")
public void setSource(String source)
Sets the source file from which to load the animation data.


getSource

@Editable
public String getSource()
Returns the source file.


updateFromSource

public void updateFromSource(EditorContext ctx,
                             boolean force)
Description copied from class: ModelConfig.Implementation
Updates this implementation from its external source, if any.

Overrides:
updateFromSource in class ModelConfig.Implementation
force - if true, reload the source data even if it has already been loaded.

getModelImplementation

public Model.Implementation getModelImplementation(GlContext ctx,
                                                   Scope scope,
                                                   Model.Implementation impl)
Description copied from class: ModelConfig.Implementation
Creates or updates a model implementation for this configuration.

Specified by:
getModelImplementation in class ModelConfig.Implementation
scope - the model's expression scope.
impl - an existing implementation to reuse, if possible.
Returns:
either a reference to the existing implementation (if reused), a new implementation, or null if no implementation could be created.

getParticleGeometry

public GeometryConfig getParticleGeometry(GlContext ctx)
Description copied from class: ModelConfig.Implementation
Returns the GeometryConfig to use when this model is selected for use within a particle system (or null if it cannot be used).

Overrides:
getParticleGeometry in class ModelConfig.Implementation

getParticleMaterial

public ConfigReference<MaterialConfig> getParticleMaterial(GlContext ctx)
Description copied from class: ModelConfig.Implementation
Returns a reference to the material to use when this model is selected for use within a particle system.

Overrides:
getParticleMaterial in class ModelConfig.Implementation

getParticleMesh

protected ModelConfig.VisibleMesh getParticleMesh()
Returns the ModelConfig.VisibleMesh to use when this model is selected for use within a particle system (or null if it cannot be used).


updateFromSource

protected void updateFromSource(ModelDef def)
Updates from a parsed model definition.


createDefaultMaterialMappings

protected void createDefaultMaterialMappings()
Creates default material mappings for any unmapped textures.


getMaterialMapping

protected ModelConfig.Imported.MaterialMapping getMaterialMapping(String texture,
                                                                  String tag)
Returns the material mapping for the specified texture (if any).


getTextures

protected void getTextures(TreeSet<String> textures)
Populates the supplied set with the names of all referenced textures.


getTextureTagPairs

protected void getTextureTagPairs(TreeSet<ComparableTuple<String,String>> pairs)
Populates the supplied set with the names of all referenced texture/tag pairs.


getGeometryMaterials

protected static GeometryMaterial[] getGeometryMaterials(GlContext ctx,
                                                         ModelConfig.VisibleMesh[] meshes,
                                                         ModelConfig.Imported.MaterialMapping[] materialMappings)
Creates the array of resolved geometry/material pairs.