コード例 #1
0
        public BlackboardProvider(GraphData graph)
        {
            m_Graph     = graph;
            m_InputRows = new Dictionary <Guid, BlackboardRow>();

            blackboard = new Blackboard()
            {
                scrollable        = true,
                subTitle          = FormatPath(graph.path),
                editTextRequested = EditTextRequested,
                addItemRequested  = AddItemRequested,
                moveItemRequested = MoveItemRequested
            };

            m_PathLabel = blackboard.hierarchy.ElementAt(0).Q <Label>("subTitleLabel");
            m_PathLabel.RegisterCallback <MouseDownEvent>(OnMouseDownEvent);

            m_PathLabelTextField = new TextField {
                visible = false
            };
            m_PathLabelTextField.Q("unity-text-input").RegisterCallback <FocusOutEvent>(e => { OnEditPathTextFinished(); });
            m_PathLabelTextField.Q("unity-text-input").RegisterCallback <KeyDownEvent>(OnPathTextFieldKeyPressed);
            blackboard.hierarchy.Add(m_PathLabelTextField);

            m_PropertySection = new BlackboardSection {
                headerVisible = false
            };
            foreach (var property in graph.properties)
            {
                AddInputRow(property);
            }
            blackboard.Add(m_PropertySection);
        }
コード例 #2
0
        //public Action onDragFinished
        //{
        //    get { return m_WindowDraggable.OnDragFinished; }
        //    set { m_WindowDraggable.OnDragFinished = value; }
        //}

        //public Action onResizeFinished
        //{
        //    get { return m_ResizeBorderFrame.OnResizeFinished; }
        //    set { m_ResizeBorderFrame.OnResizeFinished = value; }
        //}

        public BlackboardProvider(string assetName, AbstractMaterialGraph graph)
        {
            m_Graph        = graph;
            m_ExposedIcon  = Resources.Load("GraphView/Nodes/BlackboardFieldExposed") as Texture2D;
            m_PropertyRows = new Dictionary <Guid, BlackboardRow>();

            blackboard = new Blackboard()
            {
                scrollable        = true,
                title             = assetName,
                editTextRequested = EditTextRequested,
                addItemRequested  = AddItemRequested,
                moveItemRequested = MoveItemRequested
            };

            // m_WindowDraggable = new WindowDraggable(blackboard.shadow.Children().First().Q("header"));
            // blackboard.AddManipulator(m_WindowDraggable);

            // m_ResizeBorderFrame = new ResizeBorderFrame(blackboard) { name = "resizeBorderFrame" };
            // blackboard.shadow.Add(m_ResizeBorderFrame);

            m_Section = new BlackboardSection {
                headerVisible = false
            };
            foreach (var property in graph.properties)
            {
                AddProperty(property);
            }
            blackboard.Add(m_Section);
        }
コード例 #3
0
        public BlackboardProvider(GraphData graph)
        {
            m_Graph     = graph;
            m_InputRows = new Dictionary <ShaderInput, BlackboardRow>();

            blackboard = new Blackboard()
            {
                scrollable        = true,
                subTitle          = FormatPath(graph.path),
                editTextRequested = EditTextRequested,
                addItemRequested  = AddItemRequested,
                moveItemRequested = MoveItemRequested
            };

            var styleSheet = Resources.Load <StyleSheet>($"Styles/{k_styleName}");

            blackboard.styleSheets.Add(styleSheet);

            m_PathLabel = blackboard.hierarchy.ElementAt(0).Q <Label>("subTitleLabel");
            m_PathLabel.RegisterCallback <MouseDownEvent>(OnMouseDownEvent);

            m_PathLabelTextField = new TextField {
                visible = false
            };
            m_PathLabelTextField.Q("unity-text-input").RegisterCallback <FocusOutEvent>(e => { OnEditPathTextFinished(); });
            m_PathLabelTextField.Q("unity-text-input").RegisterCallback <KeyDownEvent>(OnPathTextFieldKeyPressed);
            blackboard.hierarchy.Add(m_PathLabelTextField);

            m_PropertySection = new BlackboardSection {
                title = "Properties"
            };
            foreach (var property in graph.properties)
            {
                AddInputRow(property);
            }
            blackboard.Add(m_PropertySection);

            m_KeywordSection = new BlackboardSection {
                title = "Keywords"
            };
            foreach (var keyword in graph.keywords)
            {
                AddInputRow(keyword);
            }
            blackboard.Add(m_KeywordSection);
        }
コード例 #4
0
        //public Action onDragFinished
        //{
        //    get { return m_WindowDraggable.OnDragFinished; }
        //    set { m_WindowDraggable.OnDragFinished = value; }
        //}

        //public Action onResizeFinished
        //{
        //    get { return m_ResizeBorderFrame.OnResizeFinished; }
        //    set { m_ResizeBorderFrame.OnResizeFinished = value; }
        //}

        public BlackboardProvider(string assetName, AbstractMaterialGraph graph)
        {
            m_Graph        = graph;
            m_ExposedIcon  = Resources.Load <Texture2D>("GraphView/Nodes/BlackboardFieldExposed");
            m_PropertyRows = new Dictionary <Guid, BlackboardRow>();

            blackboard = new Blackboard()
            {
                scrollable        = true,
                title             = assetName.Split('/').Last(),
                subTitle          = FormatPath(graph.path),
                editTextRequested = EditTextRequested,
                addItemRequested  = AddItemRequested,
                moveItemRequested = MoveItemRequested
            };

            m_PathLabel = blackboard.shadow.ElementAt(0).Q <Label>("subTitleLabel");
            m_PathLabel.RegisterCallback <MouseDownEvent>(OnMouseDownEvent);

            m_PathLabelTextField = new TextField {
                visible = false
            };
            m_PathLabelTextField.RegisterCallback <FocusOutEvent>(e => { OnEditPathTextFinished(); });
            m_PathLabelTextField.RegisterCallback <KeyDownEvent>(OnPathTextFieldKeyPressed);
            blackboard.shadow.Add(m_PathLabelTextField);

            // m_WindowDraggable = new WindowDraggable(blackboard.shadow.Children().First().Q("header"));
            // blackboard.AddManipulator(m_WindowDraggable);

            // m_ResizeBorderFrame = new ResizeBorderFrame(blackboard) { name = "resizeBorderFrame" };
            // blackboard.shadow.Add(m_ResizeBorderFrame);

            m_Section = new BlackboardSection {
                headerVisible = false
            };
            foreach (var property in graph.properties)
            {
                AddProperty(property);
            }
            blackboard.Add(m_Section);
        }
コード例 #5
0
        public BlackboardProvider(GraphData graph)
        {
            m_Graph        = graph;
            m_PropertyRows = new Dictionary <Guid, BlackboardRow>();

            blackboard = new Blackboard()
            {
                scrollable        = true,
                subTitle          = FormatPath(graph.path),
                editTextRequested = EditTextRequested,
                addItemRequested  = AddItemRequested,
                moveItemRequested = MoveItemRequested
            };

            m_PathLabel = blackboard.hierarchy.ElementAt(0).Q <Label>("subTitleLabel");
            m_PathLabel.RegisterCallback <MouseDownEvent>(OnMouseDownEvent);

            m_PathLabelTextField = new TextField {
                visible = false
            };
            m_PathLabelTextField.Q("unity-text-input").RegisterCallback <FocusOutEvent>(e => { OnEditPathTextFinished(); });
            m_PathLabelTextField.Q("unity-text-input").RegisterCallback <KeyDownEvent>(OnPathTextFieldKeyPressed);
            blackboard.hierarchy.Add(m_PathLabelTextField);

            // m_WindowDraggable = new WindowDraggable(blackboard.shadow.Children().First().Q("header"));
            // blackboard.AddManipulator(m_WindowDraggable);

            // m_ResizeBorderFrame = new ResizeBorderFrame(blackboard) { name = "resizeBorderFrame" };
            // blackboard.shadow.Add(m_ResizeBorderFrame);

            m_Section = new BlackboardSection {
                headerVisible = false
            };
            foreach (var property in graph.properties)
            {
                AddProperty(property);
            }
            blackboard.Add(m_Section);
        }