상속: OutlinerNode, IDisplayable
예제 #1
0
 private String GetObjectImageKey(OutlinerObject obj)
 {
     if (obj.Class == OutlinerScene.XrefObjectType)
         return (obj.IsGroupHead) ? "xref_group" : "xref";
     else if (obj.IsGroupHead)
         return "group";
     else if (obj.SuperClass == OutlinerScene.GeometryType)
     {
         if (obj.Class == OutlinerScene.TargetType)
             return "helper";
         else if (obj.Class == OutlinerScene.BoneType || obj.Class == OutlinerScene.BipedType)
             return "bone";
         else if (obj.Class == OutlinerScene.PfSourceType || obj.Class == OutlinerScene.PCloudType ||
                  obj.Class == OutlinerScene.PArrayType || obj.Class == OutlinerScene.PBlizzardType ||
                  obj.Class == OutlinerScene.PSprayType || obj.Class == OutlinerScene.PSuperSprayType ||
                  obj.Class == OutlinerScene.PSnowType)
             return "particle";
         // Assumption: Only PowerNurbs classes start with "Pwr_"
         else if (obj.Class == OutlinerScene.NurbsCvSurfType || obj.Class == OutlinerScene.NurbsPtSurfType || obj.Class.StartsWith(OutlinerScene.PowerNurbsPrefixType))
             return "nurbs";
         else if (obj.Class == OutlinerScene.PatchQuadType || obj.Class == OutlinerScene.PatchTriType || obj.Class == OutlinerScene.PatchEditableType)
             return "nurbs";
         else
             return "geometry";
     }
     else if (obj.SuperClass == OutlinerScene.SpacewarpType)
         return "spacewarp";
     else if (obj.SuperClass == OutlinerScene.HelperType)
         if (obj.Class == OutlinerScene.ContainerType)
             return (obj.ChildNodesCount > 0) ? "container" : "container_closed";
         else if (obj.Class == OutlinerScene.PBirthTextureType || obj.Class == OutlinerScene.PSpeedByIconType ||
                  obj.Class == OutlinerScene.PGroupSelectionType || obj.Class == OutlinerScene.PFindTargetType ||
                  obj.Class == OutlinerScene.PInitialStateType || obj.Class == OutlinerScene.ParticlePaintType)
             return "particle";
         else
             return "helper";
     else
         // shape, light, camera
         return obj.SuperClass;
 }
예제 #2
0
      internal void SetObjectMaterial(OutlinerObject obj, Int32 newMatHandle)
      {
         if (ListMode == OutlinerListMode.Material)
         {
            OutlinerMaterial oldMat = obj.Material;

            RemoveNodeFromTree(obj, false);
            Scene.SetObjectMaterialHandle(obj, newMatHandle);
            AddObjectToTree(obj);

            if (oldMat != null && oldMat.ChildNodes.Count == 0)
            {
               RemoveNodeFromTree(oldMat, true);
               if (!oldMat.IsUnassigned)
                  Scene.RemoveMaterial(oldMat);
            }

            // Reselect the node if necessary.
            if (IsNodeSelected(obj))
            {
               SelectNode(obj, true);
               _selectionChanged = false;
               BeginTimedEnsureSelectionVisible(EnsureSelectionVisibleAction.MaterialChanged);
            }
         }
         else
         {
            Scene.SetObjectMaterialHandle(obj, newMatHandle);
            if (_treeViewNodeSorter is Outliner.NodeSorters.MaterialSorter) BeginTimedSort();
         }
      }
예제 #3
0
 public ObjectDragDropHandler(Outliner.TreeView tree, OutlinerObject data)
     : base(tree, null)
 {
     Data = data;
 }
예제 #4
0
      internal void LinkObject(OutlinerObject obj, Int32 newParentHandle, Boolean group, Boolean isGroupMember)
      {
         RemoveNodeFromTree(obj, false);

         OutlinerNode oldParent = obj.Parent;

         Scene.SetObjectParentHandle(obj, newParentHandle);

         if (oldParent != null)
            ApplyFilter(oldParent, true, false, false);

         if (group)
            obj.SetIsGroupMemberRec(isGroupMember);

         AddObjectToTree(obj);

         RestoreExpandedStates();

         if (IsNodeSelected(obj))
         {
            SelectNode(obj, true);
            _selectionChanged = false;
            if (ListMode == OutlinerListMode.Hierarchy)
               BeginTimedEnsureSelectionVisible(EnsureSelectionVisibleAction.HierarchyChanged);
         }
      }
예제 #5
0
      internal void SetObjectLayer(OutlinerObject obj, Int32 newLayerHandle)
      {
         if (ListMode == OutlinerListMode.Layer)
         {
            BeginTimedUpdate();
            BeginTimedSort();

            RemoveNodeFromTree(obj, false);
            Scene.SetObjectLayerHandle(obj, newLayerHandle);
            AddObjectToTree(obj);

            if (IsNodeSelected(obj))
            {
               SelectNode(obj, true);
               _selectionChanged = false;
               BeginTimedEnsureSelectionVisible(EnsureSelectionVisibleAction.LayerChanged);
            }
         }
         else
         {
            Scene.SetObjectLayerHandle(obj, newLayerHandle);
            if (_treeViewNodeSorter is Outliner.NodeSorters.LayerSorter) BeginTimedSort();
         }
      }
예제 #6
0
 private void SetIsGroupMemberRec(OutlinerObject o, Boolean isGroupMember)
 {
     o.IsGroupMember = isGroupMember;
     foreach (OutlinerNode c in o.ChildNodes)
     {
         if (c is OutlinerObject)
             SetIsGroupMemberRec((OutlinerObject)c, isGroupMember);
     }
 }
예제 #7
0
      internal void AddObjectToTree(OutlinerObject obj)
      {
         if (obj == null)
            return;

         if (!Filter.ShowNode(obj))
            return;

         TreeNodeCollection parentCollection = null;

         if (ListMode == OutlinerListMode.Hierarchy)
         {
            if (obj.IsRootNode)
               parentCollection = this.Nodes;
            else
            {
               obj = (OutlinerObject)GetHighestParentToAdd(obj);
               TreeNode tn;
               if (obj.IsRootNode)
                  parentCollection = this.Nodes;
               else
               {
                  OutlinerNode parentNode = obj.Parent;
                  if (parentNode != null && _treeNodes.TryGetValue(parentNode, out tn))
                     parentCollection = tn.Nodes;
               }
            }
         }
         else if (ListMode == OutlinerListMode.Layer)
         {
            OutlinerLayer layer = obj.Layer;
            TreeNode layerTreeNode;
            if (layer != null && _treeNodes.TryGetValue(layer, out layerTreeNode))
               parentCollection = layerTreeNode.Nodes;
         }
         else if (ListMode == OutlinerListMode.Material)
         {
            OutlinerMaterial m = obj.Material;
            if (m != null)
            {
               TreeNode matNode;
               if (_treeNodes.TryGetValue(m, out matNode))
                  parentCollection = matNode.Nodes;
               else
                  AddMaterialToTree(m);
            }
         }

         if (parentCollection != null && obj != null)
         {
            BeginTimedUpdate();
            BeginTimedSort();
            AddObjectsToTreeNodeCollection(parentCollection, new List<OutlinerNode>(1) { obj }, (ListMode == OutlinerListMode.Hierarchy));
         }
      }
예제 #8
0
 public void SetObjectParentHandle(OutlinerObject obj, Int32 newParentHandle)
 {
     removeHandleFromListInDict(obj.Handle, objects_by_parentHandle, obj.ParentHandle);
     addHandleToListInDict(obj.Handle, objects_by_parentHandle, newParentHandle);
     obj.ParentHandle = newParentHandle;
 }
예제 #9
0
 private Boolean CanAddObject(OutlinerObject obj)
 {
     return !objects.ContainsKey(obj.Handle)
        && (obj.Name != ThreeDxConnexionCamName || obj.SuperClass != CameraType)
        && !hidden_particle_classes.Contains(obj.Class);
 }
예제 #10
0
 public void SetObjectLayerHandle(OutlinerObject obj, Int32 newLayerHandle)
 {
     removeHandleFromListInDict(obj.Handle, objects_by_layerHandle, obj.LayerHandle);
     addHandleToListInDict(obj.Handle, objects_by_layerHandle, newLayerHandle);
     obj.LayerHandle = newLayerHandle;
 }
예제 #11
0
 public void SetObjectMaterialHandle(OutlinerObject obj, Int32 newMaterialHandle)
 {
     removeHandleFromListInDict(obj.Handle, objects_by_materialHandle, obj.MaterialHandle);
     addHandleToListInDict(obj.Handle, objects_by_materialHandle, newMaterialHandle);
     obj.MaterialHandle = newMaterialHandle;
 }
예제 #12
0
 public void RemoveObject(OutlinerObject obj)
 {
     objects.Remove(obj.Handle);
     removeHandleFromListInDict(obj.Handle, objects_by_parentHandle, obj.ParentHandle);
     removeHandleFromListInDict(obj.Handle, objects_by_layerHandle, obj.LayerHandle);
     removeHandleFromListInDict(obj.Handle, objects_by_materialHandle, obj.MaterialHandle);
 }
예제 #13
0
 public void AddObject(Int32 handle, Int32 parentHandle, Int32 layerHandle, Int32 materialHandle,
     String name, String objClass, String objSuperClass,
     Boolean isGroupHead, Boolean isGroupMember,
     Boolean isHidden, Boolean isFrozen, Boolean boxMode)
 {
     OutlinerObject obj = new OutlinerObject(this, ++objectCounter, handle, parentHandle, layerHandle, materialHandle, name, objClass, objSuperClass, isGroupHead, isGroupMember, isHidden, isFrozen, boxMode);
        this.AddObject(obj);
 }
예제 #14
0
        public void AddObject(OutlinerObject obj)
        {
            if (CanAddObject(obj))
            {
                objects.Add(obj.Handle, obj);

                addHandleToListInDict(obj.Handle, objects_by_parentHandle, obj.ParentHandle);
                addHandleToListInDict(obj.Handle, objects_by_layerHandle, obj.LayerHandle);
                addHandleToListInDict(obj.Handle, objects_by_materialHandle, obj.MaterialHandle);
            }
        }
예제 #15
0
 public GroupDragDropHandler(Outliner.TreeView tree, OutlinerObject data)
     : base(tree, data)
 {
 }
예제 #16
0
      internal void SelectNode(OutlinerNode node, TreeNode tn, Boolean select)
      {
         if (node == null || tn == null)
            return;

         if (select)
         {
            this.Style.SetNodeColor(tn, NodeColor.Selected);

            if (!_selectedNodes.Contains(node))
            {
               _selectedNodes.Add(node);
               if (node is OutlinerObject)
                  _lastSelectedObject = (OutlinerObject)node;
            }

            HighlightParents(node);

            _selectionChanged = true;

            _mostRecentSelectedNode = tn;
         }
         else
         {
            _selectedNodes.Remove(node);
            _selectionChanged = true;

            if (IsParentOfSelectedNode(tn, true))
               Style.SetNodeColor(tn, NodeColor.ParentOfSelected);
            else
               Style.SetNodeColor(tn, NodeColor.Default);

            RemoveParentHighlights(node);
         }
      }
예제 #17
0
 private void setObjectLayerRecursive(OutlinerObject obj)
 {
     Tree.Scene.SetObjectLayerHandle(obj, Data.Handle);
     foreach(OutlinerNode cn in obj.ChildNodes)
         setObjectLayerRecursive((OutlinerObject)cn);
 }
예제 #18
0
        private Boolean ObjectIsVisible(OutlinerObject obj)
        {
            // If the filter is disabled, all objects are shown.
            if (!Enabled && NameFilter == String.Empty) return true;

            if (NameFilter != String.Empty)
            {
                if (!Regex.IsMatch(obj.Name, NameFilter, _nameFilterOptions))
                    return false;
                else if (!Enabled)
                    return true;
            }

            if (!ShowHidden || !ShowFrozen)
            {
                OutlinerLayer objLayer = obj.Layer;
                if (!ShowHidden && (obj.IsHidden || (objLayer != null && objLayer.IsHidden))) return false;
                if (!ShowFrozen && (obj.IsFrozen || (objLayer != null && objLayer.IsFrozen))) return false;
            }

            if (!ShowXRefs && obj.Class == OutlinerScene.XrefObjectType) return false;
            if (!ShowGroups && (obj.IsGroupHead || obj.IsGroupMember)) return false;

            if (!ShowShapes && obj.SuperClass == OutlinerScene.ShapeType) return false;
            if (!ShowLights && obj.SuperClass == OutlinerScene.LightType) return false;
            if (!ShowCameras && obj.SuperClass == OutlinerScene.CameraType) return false;
            if (!ShowHelpers && obj.SuperClass == OutlinerScene.HelperType && !obj.IsGroupHead) return false;
            if (!ShowSpaceWarps && obj.SuperClass == OutlinerScene.SpacewarpType) return false;

            if ((!ShowBones || !ShowParticles || !ShowGeometry || !ShowHelpers) && obj.SuperClass == OutlinerScene.GeometryType)
            {
                if (obj.Class == OutlinerScene.BoneType || obj.Class == OutlinerScene.BipedType)
                    return ShowBones;
                else if (obj.Class == OutlinerScene.TargetType)
                    return ShowHelpers;
                else if (obj.Class == OutlinerScene.PfSourceType || obj.Class == OutlinerScene.PCloudType ||
                         obj.Class == OutlinerScene.PArrayType || obj.Class == OutlinerScene.PBlizzardType ||
                         obj.Class == OutlinerScene.PSprayType || obj.Class == OutlinerScene.PSuperSprayType ||
                         obj.Class == OutlinerScene.PSnowType)
                    return ShowParticles;
                else
                    return ShowGeometry;
            }

            return true;
        }