コード例 #1
0
        public BaseEditor CreateEditorObject(BaseEditor parent, string objectTypeString, Mogre.NameValuePairList param, bool addToTreeList, bool display)
        {
            if (parent == null)
            {
                Mogre.NameValuePairList.Iterator ni;
                if ((ni = param.Find("ParentNode")) != param.End())
                {
                    parent = FindObject(ni.Value, 0);
                }

                if (parent == null)
                {
                    if (SceneManager == null)
                    {
                        parent = this.rootEditor;
                    }
                    else
                    {
                        parent = SceneManagerEditor;
                    }
                }
            }

            BaseEditorFactory factory = GetEditorObjectFactory(objectTypeString);

            if (factory == null)
            {
                return(null);
            }

            BaseEditor obj = factory.CreateObject(ref parent, param);

            if (obj == null)
            {
                return(null);
            }

            RegisterObjectName(obj.Name, obj);

            parent.AddChild(obj);

            if (addToTreeList)
            {
                object handle = this.system.InsertTreeItem(parent.TreeItemHandle, obj.Name, obj.ObjectTypeID, System.Windows.Media.Colors.Black);
                obj.TreeItemHandle = handle;
            }

            if (display)
            {
                obj.Load();
                obj.UpdateTreeView();
            }

            IsSceneModified = true;
            return(obj);
        }
コード例 #2
0
        private void DoSelect(Ray mouseRay)
        {
            BaseEditor currentSelection = MogitorsRoot.Instance.Selected;
            BaseEditor newSelection     = GetObjectUnderMouse(mouseRay, true, true);

            if (newSelection != null && newSelection != currentSelection)
            {
                newSelection.UpdateTreeView();

                EditorAxis = AxisType.None;
            }
            else if (newSelection == null && currentSelection != null)
            {
                ClearSelection();
            }
        }