AnyPortrait > Script > Mesh, Mesh Group Transform

Mesh, Mesh Group Transform


It guides you through functions such as changing the color or texture of a mesh, or controlling its position.
In the editor, the mesh and mesh group data is converted to apOptTransform after bake.
Referencing apOptTransform in the scene is the same as referencing a mesh or mesh group.
Functions for batch conversion of textures and Draw Call Batching are also provided.


public apOptTransform GetOptTransform ( string transformName )
public apOptTransform GetOptTransform ( int rootUnitIndex, string transformName )
Description

   Finds and returns apOptTransform by name.
   The name of apOptTransform is the name of the mesh or mesh group.
   If you do not specify a root unit index, first perform a full search from the root unit that is currently being rendered.


Parameters

   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)


Return

   apOptTransform : apOptTransform retrieved. Return null if not


public Transform GetOptTransformSocket ( apOptTransform optTransform )
public Transform GetOptTransformSocket ( string transformName )
public Transform GetOptTransformSocket ( int rootUnitIndex, string transformName )
Description

   Refers to a socket in apOptTransform.
   Please refer to related page about socket.


Parameters

   apOptTransform optTransform : apOptTransform containing socket
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)


Return

   Transform : Socket Transform of apOptTransform. Return null if not


public bool SetOptTransformPosition ( apOptTransform optTransform, Vector3 position,
                Space space, float weight = 1.0f )
public bool SetOptTransformPosition ( string transformName, Vector3 position,
                Space space, float weight = 1.0f )
public bool SetOptTransformPosition ( int rootUnitIndex, string transformName, Vector3 position,
                Space space, float weight = 1.0f )
Description

   Controls the position of apOptTransform.
   You can interpolate using weights.


Parameters

   apOptTransform optTransform : apOptTransform to control
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   Vector3 position : Position to move
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with original position


Return

   bool : Return false if it refers to apOptTransform that does not exist


public bool SetOptTransformRotation ( apOptTransform optTransform, float angle,
                Space space, float weight = 1.0f )
public bool SetOptTransformRotation ( string transformName, float angle,
                Space space, float weight = 1.0f )
public bool SetOptTransformRotation ( int rootUnitIndex, string transformName, float angle,
                Space space, float weight = 1.0f )
Description

   Controls the angle of rotation of apOptTransform.
   You can interpolate using weights.


Parameters

   apOptTransform optTransform : apOptTransform to control
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   float angle : Angle to rotate (Degree)
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with original rotation angle


Return

   bool : Return false if it refers to apOptTransform that does not exist


public bool SetOptTransformScale ( apOptTransform optTransform, Vector3 scale,
                Space space, float weight = 1.0f )
public bool SetOptTransformScale ( string transformName, Vector3 scale,
                Space space, float weight = 1.0f )
public bool SetOptTransformScale ( int rootUnitIndex, string transformName, Vector3 scale,
                Space space, float weight = 1.0f )
Description

   Controls the size of apOptTransform.
   You can interpolate using weights


Parameters

   apOptTransform optTransform : apOptTransform to control
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   Vector3 scale : Scale value
   Space space : World refers to the coordinate system of the scene, and Self refers to the coordinate system of apPortrait.
   float weight : Interpolation weight with original size


Return

   bool : Return false if it refers to apOptTransform that does not exist


public void SetMeshImage ( apOptTransform optTransform, Texture2D texture )
public void SetMeshImage ( string transformName, Texture2D texture )
public void SetMeshImage ( int rootUnitIndex, string transformName, Texture2D texture )
public void SetMeshImage ( apOptTransform optTransform, string imageName )
public void SetMeshImage ( string transformName, string imageName )
public void SetMeshImage ( int rootUnitIndex, string transformName, string imageName )
Description

   Replaces the texture of the apOptTransform.
   If the texture is replaced, the draw call may increase.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   Texture2D texture : Texture to replace
   string imageName : When replacing an image stored in the AnyPortrait editor, the name of the image


public void SetMeshColor ( apOptTransform optTransform, Color color2X )
public void SetMeshColor ( string transformName, Color color2X )
public void SetMeshColor ( int rootUnitIndex, string transformName, Color color2X )
Description

   Sets the color of the apOptTransform.
   Colors are calculated as 2X Multiply, so the default is gray (0.5, 0.5, 0.5, 1).
   If the color is not the default, the draw call may increase.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   Color color2X : Color to replace (2X Multiply)


public void SetMeshAlpha ( apOptTransform optTransform, float alpha )
public void SetMeshAlpha ( string transformName, float alpha )
public void SetMeshAlpha ( int rootUnitIndex, string transformName, float alpha )
Description

   Sets the alpha (transparency) of the color of apOptTransform.
   The default value is 1; otherwise, the draw call may increase.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   float alpha : Alpha to replace


public void SetMeshCustomImage ( apOptTransform optTransform, Texture2D texture, string propertyName )
public void SetMeshCustomImage ( apOptTransform optTransform, Texture2D texture, int propertyNameID )
public void SetMeshCustomImage ( string transformName, Texture2D texture, int propertyNameID )
public void SetMeshCustomImage ( int rootUnitIndex, string transformName, Texture2D texture, int propertyNameID )
...
1.4.5
Description

   Replaces the texture of the apOptTransform.
   If the texture is replaced, the draw call may increase.
   When targeting "_MainTex", please use the "SetMeshImage" function.
   Instead of optTransform, you can specify the target by entering transformName and rootUnitIndex.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   Texture2D texture : Texture to replace
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomColor ( apOptTransform optTransform, Color color, string propertyName )
public void SetMeshCustomColor ( apOptTransform optTransform, Color color, int propertyNameID )
public void SetMeshCustomColor ( string transformName, Color color, int propertyNameID )
public void SetMeshCustomColor ( int rootUnitIndex, string transformName, Color color, int propertyNameID )
...
1.4.5
Description

   Sets the color of the apOptTransform.
   If the color is not the default, the draw call may increase.
   When targeting "_Color", use the "SetMeshColor" function.
   Instead of optTransform, you can specify the target by entering transformName and rootUnitIndex.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   Color color : Color to replace
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomAlpha ( apOptTransform optTransform, float alpha, string propertyName )
public void SetMeshCustomAlpha ( apOptTransform optTransform, float alpha, int propertyNameID )
public void SetMeshCustomAlpha ( string transformName, float alpha, int propertyNameID )
public void SetMeshCustomAlpha ( int rootUnitIndex, string transformName, float alpha, int propertyNameID )
...
1.4.5
Description

   Sets the alpha (transparency) of the color of apOptTransform.
   The default value is 1; otherwise, the draw call may increase.
   When targeting "_Color", use the "SetMeshAlpha" function.
   Instead of optTransform, you can specify the target by entering transformName and rootUnitIndex.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   float alpha : Alpha to replace
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomFloat ( apOptTransform optTransform, float floatValue, string propertyName )
public void SetMeshCustomFloat ( apOptTransform optTransform, float floatValue, int propertyNameID )
public void SetMeshCustomFloat ( string transformName, float floatValue, int propertyNameID )
public void SetMeshCustomFloat ( int rootUnitIndex, string transformName, float floatValue, int propertyNameID )
...
1.4.5
Description

   Sets the value of the Float property of the material of apOptTransform.
   When this function is called, the draw call may increase.
   Instead of optTransform, you can specify the target by entering transformName and rootUnitIndex.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   float floatValue : Float Value
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomInt ( apOptTransform optTransform, int intValue, string propertyName )
public void SetMeshCustomInt ( apOptTransform optTransform, int intValue, int propertyNameID )
public void SetMeshCustomInt ( string transformName, int intValue, int propertyNameID )
public void SetMeshCustomInt ( int rootUnitIndex, string transformName, int intValue, int propertyNameID )
...
1.4.5
Description

   Sets the value of the Int property of the material of apOptTransform.
   When this function is called, the draw call may increase.
   Instead of optTransform, you can specify the target by entering transformName and rootUnitIndex.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   int intValue : Int Value
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomVector4 ( apOptTransform optTransform, Vector4 vector4Value, string propertyName )
public void SetMeshCustomVector4 ( apOptTransform optTransform, Vector4 vector4Value, int propertyNameID )
public void SetMeshCustomVector4 ( string transformName, Vector4 vector4Value, int propertyNameID )
public void SetMeshCustomVector4 ( int rootUnitIndex, string transformName, Vector4 vector4Value, int propertyNameID )
...
1.4.5
Description

   Sets the value of the Vector4 property of the material of apOptTransform.
   When this function is called, the draw call may increase.
   Instead of optTransform, you can specify the target by entering transformName and rootUnitIndex.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)
   Vector4 vector4Value : Vector4 Value
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomTextureOffset ( apOptTransform optTransform, Vector2 textureOffsetValue, string propertyName )
1.1.4
Description

   Sets the value of the Offset property of the texture of the material of apOptTransform.
   When this function is called, the draw call may increase.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   Vector2 textureOffsetValue : Texture Offset Value
   string propertyName : Shader property name


public void SetMeshCustomTextureScale ( apOptTransform optTransform, Vector2 textureScaleValue, string propertyName )
1.1.4
Description

   Sets the value of the Scale property of the texture of the material of apOptTransform.
   When this function is called, the draw call may increase.


Parameters

   apOptTransform optTransform : apOptTransform to refer
   Vector2 textureScaleValue : Texture Scale Value
   string propertyName : Shader property name


public void ShowMesh ( apOptTransform optTransform )
public void ShowMesh ( string transformName )
public void ShowMesh ( int rootUnitIndex, string transformName )
Description

   Makes the apOptTransform containing the mesh rendered.


Parameters

   apOptTransform optTransform : apOptTransform to render
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)


public void HideMesh ( apOptTransform optTransform )
public void HideMesh ( string transformName )
public void HideMesh ( int rootUnitIndex, string transformName )
Description

   Hides the apOptTransform containing the mesh from rendering.


Parameters

   apOptTransform optTransform : apOptTransform to hide
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)


public apOptTextureData GetOptTextureData ( string optTextureName )
Description

   If the apOptTransform meshes use the same texture, it is possible to control them all in apOptTextureData.
   If you use the apOptTextureData functions to modify the material properties of the texture, color, etc.,
    all meshes that use this texture will be automatically changed.
   Batch change functions
   - SetMeshTextureAll(Texture2D texture)
   - SetCustomImageAll(Texture2D texture, string propertyName)
   - SetCustomImageAll(Texture2D texture, int propertyNameID)
   - SetMeshColorAll(Color color)
   - SetCustomColorAll(Color color, string propertyName)
   - SetCustomColorAll(Color color, int propertyNameID)
   - SetCustomFloatAll(float floatValue, string propertyName)
   - SetCustomFloatAll(float floatValue, int propertyNameID)
   - SetCustomIntAll(int intValue, string propertyName)
   - SetCustomIntAll(int intValue, int propertyNameID)
   - SetCustomVector4All(Vector4 vector4Value, string propertyName)
   - SetCustomVector4All(Vector4 vector4Value, int propertyNameID)


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)


Return

   apOptTextureData : Referenced apOptTextureData. Return null if not


public void SetMeshImageAll ( string optTextureName, Texture2D texture )
public void SetMeshCustomImageAll ( string optTextureName, Texture2D texture, string propertyName )
public void SetMeshCustomImageAll ( string optTextureName, Texture2D texture, int propertyNameID )
1.4.3
Description

   Batchly replace textures in all meshes that use apOptTextureData.
   When targeting "_MainTex", use "SetMeshImageAll" function instead of "SetMeshCustomImageAll" function.


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)
   Texture2D texture : Texture to replace
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshColorAll ( Color color2X )
public void SetMeshColorAll ( string optTextureName, Color color2X )
public void SetMeshCustomColorAll ( Color color, string propertyName )
public void SetMeshCustomColorAll ( Color color, int propertyNameID )
public void SetMeshCustomColorAll ( string optTextureName, Color color, string propertyName )
public void SetMeshCustomColorAll ( string optTextureName, Color color, int propertyNameID )
1.4.3
Description

   Batchly replace the colors of all the meshes.
   Entering optTextureName sets the color for meshes that use the corresponding apOptTextureData.
   When you modify mainColor, it uses 2X Multiply color by default.
   When targeting "_Color", use "SetMeshColorAll" function instead of "SetMeshCustomColorAll" function.


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)
   Color color : Color to replace
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshAlphaAll ( float alpha )
public void SetMeshAlphaAll ( string optTextureName, float alpha )
public void SetMeshCustomAlphaAll ( float alpha, string propertyName )
public void SetMeshCustomAlphaAll ( float alpha, int propertyNameID )
public void SetMeshCustomAlphaAll ( string optTextureName, float alpha, string propertyName )
public void SetMeshCustomAlphaAll ( string optTextureName, float alpha, int propertyNameID )
1.4.3
Description

   Batchly replace alpha (transparency) of all meshes.
   ​Entering optTextureName sets the alpha of meshes that use the apOptTextureData.
   When targeting "_Color", use "SetMeshAlphaAll" function instead of "SetMeshCustomAlphaAll" function.


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)
   float alpha : Alpha to replace
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomFloatAll ( float floatValue, string propertyName )
public void SetMeshCustomFloatAll ( float floatValue, int propertyNameID )
public void SetMeshCustomFloatAll ( string optTextureName, float floatValue, string propertyName )
public void SetMeshCustomFloatAll ( string optTextureName, float floatValue, int propertyNameID )
1.4.3
Description

   Batchly set Float property values ​​for all meshes.
   ​Entering optTextureName sets the value of the property for meshes that use apOptTextureData.


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)
   float floatValue : Float Value
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomIntAll ( int intValue, string propertyName )
public void SetMeshCustomIntAll ( int intValue, int propertyNameID )
public void SetMeshCustomIntAll ( string optTextureName, int intValue, string propertyName )
public void SetMeshCustomIntAll ( string optTextureName, int intValue, int propertyNameID )
1.4.3
Description

   Batchly set Int property values ​​for all meshes.
   ​Entering optTextureName sets the value of the property for meshes that use apOptTextureData.


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)
   int intValue : Int Value
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomVector4All ( Vector4 vector4Value, string propertyName )
public void SetMeshCustomVector4All ( Vector4 vector4Value, int propertyNameID )
public void SetMeshCustomVector4All ( string optTextureName, Vector4 vector4Value, string propertyName )
public void SetMeshCustomVector4All ( string optTextureName, Vector4 vector4Value, int propertyNameID )
1.4.3
Description

   Batchly set Vector4 property values ​​for all meshes.
   ​Entering optTextureName sets the value of the property for meshes that use apOptTextureData.


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)
   Vector4 vector4Value : Vector4 Value
   string propertyName : Shader property name
   int propertyNameID : Shader property ID (use the Shader.PropertyToID function to get the ID)


public void SetMeshCustomTextureOffsetAll ( Vector2 textureOffsetValue, string propertyName )
public void SetMeshCustomTextureScaleAll ( Vector2 textureScaleValue, string propertyName )
1.3.5
Description

   Change the value of Offset or Scale of custom texture property of all meshes.


Parameters

   Vector2 textureOffsetValue : Offset of the texture propertie
   Vector2 textureScaleValue : Scale of the texture propertie
   string propertyName : Texture property name


public void ResetMeshMaterialToBatch ( apOptTransform optTransform )
public void ResetMeshMaterialToBatch ( string transformName )
public void ResetMeshMaterialToBatch ( int rootUnitIndex, string transformName )
Description

   Returns the material property of the apOptTransform to the value of the Bake state.
   Draw calls may be reduced, which may improve performance.


Parameters

   apOptTransform optTransform : Target apOptTransform
   int rootUnitIndex : Root Unit Index (if not, search all)
   string transformName : The name of the apOptTransform (the name of the mesh or mesh group on the editor)


public void ResetMeshMaterialToBatchAll ()
Description

   Returns the material property of all apOptTransform to the value of the Bake state.
   Draw calls may be reduced, which may improve performance.​


public void ResetMeshMaterialToBatchByTextureName ( string optTextureName )
1.1.4
Description

   Returns all material properties using the requested texture to the value of the Bake state.
   Draw calls may be reduced, which may improve performance.


Parameters

   string optTextureName : The name of the apOptTexture to reference. (Name of the Image of the editor.)


public void MergeMaterials ( params apPortrait[] otherPortraits )
1.3.5
Description

   Reduces draw calls by merging materials, including the character the function is called on and other characters input as arguments.
   apPortraits with merged materials share the behavior of the functions changing materials in a batch.
   When materials are merged, the behavior of some functions change.
   When this function is called, the "ResetMeshMaterialToBatchAll()" function is executed inside.
   For more information, please refer to the related page.


Parameters

   params apPortrait[] otherPortraits : Enter other apPortraits. You can enter one or more or none by the params keyword.


public void UnmergeMaterials ()
1.3.5
Description

   Unmerge materials.
   All apPortraits connected to this apPortrait are treated in the same way, so you only need to call this function once.
   When this function is called, the "ResetMeshMaterialToBatchAll()" function is executed inside.