Ejemplo n.º 1
0
    /* ********************************************************* */
    //! Replace Material

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blend Operation for the target
     * @param	masking
     *      masking for the target
     * @param	nameShadcer
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	material
     *      New material<br>
     *      null == Remove material (however can't be removed that Project has)
     * @param	flagGlobal
     *      true == Replace material that Project(DataProject) has.<br>
     *      false == Replace material that only this Animation-Object has.
     * @retval	Return-Value
     *      Originally set material<br>
     *      null == Not exist or Error
     *
     * Search and replace material with the specified content among materials currently held.<br>
     * Material to be replaced is identified by "indexCellMap", "operationBlend", "masking", and "shader".<br>
     * If the material cannot be found, this function will return error.<br>
     * <br>
     * Note that changes the material to "material" for drawing, which is determined by "indexCellMap", "operationBlend", "masking", and "nameShader".<br>
     * "indexCellMap", "operationBlend", "masking", and "nameShader" are not parameters of the material to be changed, but keys to identify the material used in the original animation.<br>
     */
    public UnityEngine.Material MaterialReplace(int indexCellMap,
                                                Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                                Library_SpriteStudio6.KindMasking masking,
                                                string nameShader,
                                                UnityEngine.Material material,
                                                bool flagGlobal = false
                                                )
    {
        if (null == DataEffect)
        {
            return(null);
        }
        if (0 > indexCellMap)
        {
            return(null);
        }

        if (false == flagGlobal)
        {
            if (true == TextureCheckOverride(indexCellMap))
            {                   /* Texture Overrided */
                return(CacheMaterial.MaterialReplaceEffect(indexCellMap,
                                                           operationBlend,
                                                           masking,
                                                           nameShader,
                                                           material
                                                           )
                       );
            }

            return(null);
        }

        if (null == material)
        {
            /* MEMO: Prohibited to remove material that Project has. */
            return(null);
        }
        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }
        Script_SpriteStudio6_DataProject dataProject = DataEffect.DataProject;

        if (null == dataProject)
        {
            return(null);
        }

        /* MEMO: The texture used in calculating hashcode to identify  material must be it stored in the project. */
        return(dataProject.MaterialReplaceEffect(indexCellMap,
                                                 operationBlend,
                                                 masking,
                                                 nameShader,
                                                 material
                                                 )
               );
    }
Ejemplo n.º 2
0
    /* ----------------------------------------------- Functions */
    #region Functions
    /* ********************************************************* */
    //! Get Material

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blend Operation for the target
     * @param	masking
     *      masking for the target
     * @param	nameShadcer
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	shader
     *      Shader applied<br>
     *      null == Default(Standard) shader
     * @param	flagCreateNew
     *      true == If not exist, create.
     *      false == If not exist, return null.
     * @retval	Return-Value
     *      Instance of Material
     *      null == Not exist or Error
     *
     * Search material with the specified content among materials currently held.<br>
     * Materials (held by Animation-Object) are affected by currently playback state
     *      since materials are dynamically generated.<br>
     * Materials will not be created until Play-Cursor reachs actually using material,
     *      and once it is created, those will be retained until Animation-Object is destroyed.<br>
     */
    public UnityEngine.Material MaterialGet(int indexCellMap,
                                            Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                            Library_SpriteStudio6.KindMasking masking,
                                            string nameShader,
                                            UnityEngine.Shader shader,
                                            bool flagCreateNew
                                            )
    {
        if (null == DataEffect)
        {
            return(null);
        }
        if (0 > indexCellMap)
        {
            return(null);
        }

        if (true == TextureCheckOverride(indexCellMap))
        {               /* Texture Overrided */
            return(CacheMaterial.MaterialGetEffect(indexCellMap,
                                                   operationBlend,
                                                   masking,
                                                   nameShader,
                                                   shader,
                                                   TableTexture,
                                                   flagCreateNew
                                                   )
                   );
        }

        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }

        Script_SpriteStudio6_DataProject dataProject = DataEffect.DataProject;

        if (null == dataProject)
        {
            return(null);
        }
        return(dataProject.MaterialGetEffect(indexCellMap,
                                             operationBlend,
                                             masking,
                                             nameShader,
                                             shader,
                                             flagCreateNew
                                             )
               );
    }
Ejemplo n.º 3
0
        /* ********************************************************* */
        //! Get Material-Table's index

        /*!
         * @param	indexCellMap
         *      index of CellMap
         * @param	operationBlend
         *      Kind of Blending
         * @param	masking
         *      Kind of Masking
         * @retval	Return-Value
         *      index of Material-Table
         *
         * Get material's index in Material-Table.<br>
         * Caution that this function does not check upper-limit of "indexCellMap".
         */
        public static int IndexGetTable(int indexCellMap,
                                        Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                        Library_SpriteStudio6.KindMasking masking
                                        )
        {
            if ((0 > indexCellMap) ||
                (Library_SpriteStudio6.KindOperationBlendEffect.INITIATOR > operationBlend) || (Library_SpriteStudio6.KindOperationBlendEffect.TERMINATOR_TABLEMATERIAL <= operationBlend) ||
                (Library_SpriteStudio6.KindMasking.THROUGH > masking) || (Library_SpriteStudio6.KindMasking.TERMINATOR <= masking)
                )
            {
                return(-1);
            }

            return((((indexCellMap * (int)Library_SpriteStudio6.KindMasking.TERMINATOR) + (int)masking) * (int)Library_SpriteStudio6.KindOperationBlendEffect.TERMINATOR_TABLEMATERIAL) + ((int)operationBlend + (int)Library_SpriteStudio6.KindOperationBlendEffect.INITIATOR));
        }
Ejemplo n.º 4
0
    /* ----------------------------------------------- Functions */
    #region Functions
    /* ********************************************************* */
    //! Get Material

    /*!
     * @param	indexCellMap
     *      Serial-number of using CellMap
     * @param	operationBlend
     *      Blend Operation for the target
     * @retval	Return-Value
     *      Material
     *
     * Get specified material in TableMaterial.
     */
    public UnityEngine.Material MaterialGet(int indexCellMap,
                                            Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                            Library_SpriteStudio6.KindMasking masking
                                            )
    {
        if (TableCellMap.Length <= indexCellMap)
        {
            return(null);
        }

        int indexMaterial = Material.IndexGetTable(indexCellMap, operationBlend, masking);

        if (0 > indexMaterial)
        {
            return(null);
        }

        return(TableMaterial[indexMaterial]);
    }
Ejemplo n.º 5
0
    /* ********************************************************* */
    //! Replace Material (for "Effect")

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blending Operation
     * @param	masking
     *      Masking type
     * @param	nameShadcer
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	material
     *      New material
     * @retval	Return-Value
     *      true == Success<br>
     *      false == Failure (Error)
     *
     * Replaces already defined material for purpose identified by
     *      "shader", "texture", "operaTionBlend" ​and "masking"
     *      with "materialNew".<br>
     * <br>
     * If target material cannot be found, this function will fail.
     */
    internal UnityEngine.Material MaterialReplaceEffect(int indexCellMap,
                                                        Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                                        Library_SpriteStudio6.KindMasking masking,
                                                        string nameShader,
                                                        UnityEngine.Material material
                                                        )
    {
        if (null == CacheMaterialEffect)
        {
            return(null);
        }

        return(CacheMaterialEffect.MaterialReplaceEffect(indexCellMap,
                                                         operationBlend,
                                                         masking,
                                                         nameShader,
                                                         material
                                                         )
               );
    }
Ejemplo n.º 6
0
    /* ********************************************************* */
    //! Get Material (for "Effect")

    /*!
     * @param	indexCellMap
     *      CellMap's index
     * @param	operationBlend
     *      Blending Operation
     * @param	masking
     *      Masking type
     * @param	nameShader
     *      Shader's name in animation-data
     *      null == Default(Standard) shader's name
     * @param	shader
     *      Shader
     * @param	flagCreateNew
     *      true == If not exist, create.
     *      false == If not exist, return null.
     * @retval	Return-Value
     *      Instance of Material
     *      null == Error
     *
     * Get specified-spec material (for "Effect").<br>
     * <br>
     * If existing, return that has already created (Will not create
     *      multiple of same material).<br>
     * If not existing, material will be created and returned.<br>
     */
    internal UnityEngine.Material MaterialGetEffect(int indexCellMap,
                                                    Library_SpriteStudio6.KindOperationBlendEffect operationBlend,
                                                    Library_SpriteStudio6.KindMasking masking,
                                                    string nameShader,
                                                    Shader shader,
                                                    bool flagCreateNew
                                                    )
    {
        if (null == CacheMaterialEffect)
        {
            return(null);
        }

        return(CacheMaterialEffect.MaterialGetEffect(indexCellMap,
                                                     operationBlend,
                                                     masking,
                                                     nameShader,
                                                     shader,
                                                     TableTexture,
                                                     flagCreateNew
                                                     )
               );
    }