Beispiel #1
0
    override public bool DrawInspector(NPipeEditFlags flags)
    {
        bool changed = base.DrawInspector(flags);

        NPVoxIModelFactory modelFactory = Input as NPVoxIModelFactory;

        if (modelFactory != null)
        {
            string[] socketNames = modelFactory.GetProduct().SocketNames;
            if (socketNames == null || socketNames.Length == 0)
            {
                GUILayout.Label("No Socket");
            }
            else
            {
                string newSocketName = NPipeGUILayout.Toolbar(socketNames, socketNames, SocketName);
                if (SocketName != newSocketName)
                {
                    SocketName = newSocketName;
                    changed    = true;
                }
            }
        }

        if (changed && (string.IsNullOrEmpty(InstanceName) || InstanceName.StartsWith("SocketT ")))
        {
            InstanceName = "SocketT " + SocketName;
        }

        return(changed);
    }
Beispiel #2
0
    void OnGUI()
    {
        if (m_context != null && m_context.IsValid)
        {
            EnableSceneObjects(true);

            // store previous UI states to process state switches later
            int cameraTypePrevious = m_cameraType;

            // Setup styles
            GUIStyle noStretch = new GUIStyle();
            noStretch.stretchWidth  = false;
            noStretch.stretchHeight = false;
            GUILayoutOption[] noFill          = { GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(false) };
            GUILayoutOption[] fill            = { GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true) };
            float             widthWideButton = 203f;

            // Draw GUI
            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(false));

            // Draw navigation tool bar
            GUILayout.BeginVertical(noStretch, noFill);
            GUILayout.Label(m_title, noFill);
            GUILayout.Space(8.0f);
            m_cameraType = NPipeGUILayout.Toolbar("Camera: ", m_cameraType, new string[] { "Free", "Orbit" }, noFill);
            GUILayout.Space(8.0f);
            GUILayout.Label("Sensitivity:", noFill);
            float fLabelWidthSliders = 50.0f;
            m_sensitivityOrient = NPipeGUILayout.HorizontalSlider("Rotate:", fLabelWidthSliders, m_sensitivityOrient, 0.01f, 1.0f, GUILayout.Width(100.0f)); GUILayout.Space(-6);
            m_sensitivityDrag   = NPipeGUILayout.HorizontalSlider("Pan:", fLabelWidthSliders, m_sensitivityDrag, 0.01f, 0.1f, GUILayout.Width(100.0f)); GUILayout.Space(-6);
            m_sensitivityZoom   = NPipeGUILayout.HorizontalSlider("Zoom:", fLabelWidthSliders, m_sensitivityZoom, 0.01f, 1.0f, GUILayout.Width(100.0f)); GUILayout.Space(-6);

            GUILayout.Space(16.0f);

            GUILayout.BeginHorizontal(noStretch, GUILayout.ExpandWidth(false));
            if (GUILayout.Button(m_previewGUIDrawOutlines ? "Hide Outlines" : "Show Outlines", GUILayout.Width(widthWideButton * 0.5f - 2)))
            {
                m_previewGUIDrawOutlines = !m_previewGUIDrawOutlines;
            }
            if (GUILayout.Button(m_previewGUIDrawNormals ? "Hide Normals" : "Show Normals", GUILayout.Width(widthWideButton * 0.5f - 2)))
            {
                m_previewGUIDrawNormals = !m_previewGUIDrawNormals;
            }
            GUILayout.EndHorizontal();

            // Draw internal gui
            OnGUIInternal();

            GUILayout.EndVertical();

            // Draw preview
            GUILayout.Box("", fill);
            m_sceneRect = GUILayoutUtility.GetLastRect();
            DrawScene(m_sceneRect);
            GUILayout.EndHorizontal();

            EnableSceneObjects(false);

            UpdateInput();

            // Process GUI state switches
            if (cameraTypePrevious != m_cameraType)
            {
                InitCamera();
            }
        }
        else
        {
            GUILayout.Label("Invalid preview context!");
        }
    }