DrawBoundingBoxes() публичный статический Метод

public static DrawBoundingBoxes ( Transform transform, Skeleton skeleton ) : void
transform UnityEngine.Transform
skeleton Spine.Skeleton
Результат void
Пример #1
0
        void OnSceneGUI(SceneView sceneView)
        {
            if (skeleton == null || skeletonRenderer == null || !skeletonRenderer.valid || isPrefab)
            {
                return;
            }

            var transform = skeletonRenderer.transform;

            if (showPaths)
            {
                SpineHandles.DrawPaths(transform, skeleton);
            }
            if (showConstraints)
            {
                SpineHandles.DrawConstraints(transform, skeleton);
            }
            if (showBoneNames)
            {
                SpineHandles.DrawBoneNames(transform, skeleton);
            }
            if (showShapes)
            {
                SpineHandles.DrawBoundingBoxes(transform, skeleton);
            }

            if (bone != null)
            {
                SpineHandles.DrawBone(skeletonRenderer.transform, bone, 1.5f, Color.cyan);
                Handles.Label(bone.GetWorldPosition(skeletonRenderer.transform) + (Vector3.down * 0.15f), bone.Data.Name, SpineHandles.BoneNameStyle);
            }
        }
        public void OnSceneGUI()
        {
            var skeletonRenderer = (SkeletonRenderer)target;
            var skeleton         = skeletonRenderer.skeleton;
            var transform        = skeletonRenderer.transform;

            if (skeleton == null)
            {
                return;
            }

            if (showPaths)
            {
                SpineHandles.DrawPaths(transform, skeleton);
            }
            SpineHandles.DrawBones(transform, skeleton);
            if (showConstraints)
            {
                SpineHandles.DrawConstraints(transform, skeleton);
            }
            if (showBoneNames)
            {
                SpineHandles.DrawBoneNames(transform, skeleton);
            }
            if (showShapes)
            {
                SpineHandles.DrawBoundingBoxes(transform, skeleton);
            }
        }
        public void DoRenderPreview(bool drawHandles)
        {
            if (this.PreviewUtilityCamera.activeTexture == null || this.PreviewUtilityCamera.targetTexture == null)
            {
                return;
            }

            GameObject go = previewGameObject;

            if (requiresRefresh && go != null)
            {
                go.GetComponent <Renderer>().enabled = true;

                if (!EditorApplication.isPlaying)
                {
                    skeletonAnimation.Update((Time.realtimeSinceStartup - animationLastTime));
                }

                animationLastTime = Time.realtimeSinceStartup;

                if (!EditorApplication.isPlaying)
                {
                    skeletonAnimation.LateUpdate();
                }

                var thisPreviewUtilityCamera = this.PreviewUtilityCamera;

                if (drawHandles)
                {
                    Handles.SetCamera(thisPreviewUtilityCamera);
                    Handles.color = OriginColor;

                    float scale = skeletonDataAsset.scale;
                    Handles.DrawLine(new Vector3(-1000 * scale, 0, 0), new Vector3(1000 * scale, 0, 0));
                    Handles.DrawLine(new Vector3(0, 1000 * scale, 0), new Vector3(0, -1000 * scale, 0));
                }

                thisPreviewUtilityCamera.Render();

                if (drawHandles)
                {
                    Handles.SetCamera(thisPreviewUtilityCamera);
                    SpineHandles.DrawBoundingBoxes(skeletonAnimation.transform, skeletonAnimation.skeleton);
                    if (SkeletonDataAssetInspector.showAttachments)
                    {
                        SpineHandles.DrawPaths(skeletonAnimation.transform, skeletonAnimation.skeleton);
                    }
                }

                go.GetComponent <Renderer>().enabled = false;
            }
        }
        void DoRenderPreview(bool drawHandles)
        {
            if (this.PreviewUtilityCamera.activeTexture == null || this.PreviewUtilityCamera.targetTexture == null)
            {
                return;
            }

            GameObject go = this.m_previewInstance;

            if (m_requireRefresh && go != null)
            {
                go.GetComponent <Renderer>().enabled = true;

                if (!EditorApplication.isPlaying)
                {
                    m_skeletonAnimation.Update((Time.realtimeSinceStartup - m_lastTime));
                }

                m_lastTime = Time.realtimeSinceStartup;

                if (!EditorApplication.isPlaying)
                {
                    m_skeletonAnimation.LateUpdate();
                }

                var c = this.PreviewUtilityCamera;

                if (drawHandles)
                {
                    Handles.SetCamera(c);
                    Handles.color = m_originColor;

                    Handles.DrawLine(new Vector3(-1000 * m_skeletonDataAsset.scale, 0, 0), new Vector3(1000 * m_skeletonDataAsset.scale, 0, 0));
                    Handles.DrawLine(new Vector3(0, 1000 * m_skeletonDataAsset.scale, 0), new Vector3(0, -1000 * m_skeletonDataAsset.scale, 0));
                }

                c.Render();

                if (drawHandles)
                {
                    Handles.SetCamera(c);
                    SpineHandles.DrawBoundingBoxes(m_skeletonAnimation.transform, m_skeletonAnimation.skeleton);
                    if (showAttachments)
                    {
                        SpineHandles.DrawPaths(m_skeletonAnimation.transform, m_skeletonAnimation.skeleton);
                    }
                }

                go.GetComponent <Renderer>().enabled = false;
            }
        }