Пример #1
0
        /// <summary>
        /// Creates parts for a <see cref="CubismModel"/>.
        /// </summary>
        /// <param name="unmanagedModel">Handle to unmanaged model.</param>
        /// <returns>Parts root.</returns>
        internal static GameObject CreateParts(CubismUnmanagedModel unmanagedModel)
        {
            var root = new GameObject("Parts");


            // Create parts.
            var unmanagedParts = unmanagedModel.Parts;
            var buffer         = new CubismPart[unmanagedParts.Count];


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


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


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


            return(root);
        }
Пример #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>();
        }
Пример #3
0
        /// <summary>
        /// Creates parts for a <see cref="CubismModel"/>.
        /// </summary>
        /// <param name="unmanagedModel">Handle to unmanaged model.</param>
        /// <returns>Parts root.</returns>
        internal static GameObject CreateParts(IntPtr unmanagedModel)
        {
            var root = new GameObject("Parts");


            // Create drawables.
            var buffer = new CubismPart[csmGetPartCount(unmanagedModel)];


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


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


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


            return(root);
        }