/// <summary>
        /// Creates drawables for a <see cref="CubismModel"/>.
        /// </summary>
        /// <param name="unmanagedModel">Handle to unmanaged model.</param>
        /// <returns>Drawables root.</returns>
        internal static GameObject CreateParameters(CubismUnmanagedModel unmanagedModel)
        {
            var root = new GameObject("Parameters");


            // Create parameters.
            var unmanagedParameters = unmanagedModel.Parameters;
            var buffer = new CubismParameter[unmanagedParameters.Count];


            for (var i = 0; i < buffer.Length; ++i)
            {
                var proxy = new GameObject();


                buffer[i] = proxy.AddComponent <CubismParameter>();


                buffer[i].transform.SetParent(root.transform);
                buffer[i].Reset(unmanagedModel, i);
            }


            return(root);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes instance for first use.
        /// </summary>
        /// <param name="moc">Moc to instantiate from.</param>
        private void Reset(CubismMoc moc)
        {
            Moc           = moc;
            name          = moc.name;
            TaskableModel = new CubismTaskableModel(moc);


            // Create and initialize proxies.
            var parameters = CubismParameter.CreateParameters(TaskableModel.UnmanagedModel);
            var parts      = CubismPart.CreateParts(TaskableModel.UnmanagedModel);
            var drawables  = CubismDrawable.CreateDrawables(TaskableModel.UnmanagedModel);


            parameters.transform.SetParent(transform);
            parts.transform.SetParent(transform);
            drawables.transform.SetParent(transform);


            Parameters = parameters.GetComponentsInChildren <CubismParameter>();
            Parts      = parts.GetComponentsInChildren <CubismPart>();
            Drawables  = drawables.GetComponentsInChildren <CubismDrawable>();
        }
Esempio n. 3
0
        /// <summary>
        /// Creates drawables for a <see cref="CubismModel"/>.
        /// </summary>
        /// <param name="unmanagedModel">Handle to unmanaged model.</param>
        /// <returns>Drawables root.</returns>
        internal static GameObject CreateParameters(IntPtr unmanagedModel)
        {
            var root = new GameObject("Parameters");


            // Create drawables.
            var buffer = new CubismParameter[csmGetParameterCount(unmanagedModel)];


            for (var i = 0; i < buffer.Length; ++i)
            {
                var proxy = new GameObject();


                buffer[i] = proxy.AddComponent <CubismParameter>();


                buffer[i].transform.SetParent(root.transform);
                buffer[i].Reset(unmanagedModel, i);
            }


            return(root);
        }