public ObjectDuplicationAction(List <GameObject> sourceObjects)
 {
     if (sourceObjects != null && sourceObjects.Count != 0)
     {
         _sourceParents = GameObjectExtensions.GetParentsFromObjectCollection(sourceObjects);
     }
 }
Beispiel #2
0
        public static List <ObjectSelectionBox> CalculateFromParentsToBottom(IEnumerable <GameObject> selectedObjects)
        {
            List <GameObject> parents = GameObjectExtensions.GetParentsFromObjectCollection(selectedObjects);
            var objectSelectionBoxes  = new List <ObjectSelectionBox>(20);

            foreach (var parent in parents)
            {
                Box hierarchyModelSpaceBox = parent.GetHierarchyModelSpaceBox();
                if (hierarchyModelSpaceBox.IsValid())
                {
                    objectSelectionBoxes.Add(new ObjectSelectionBox(hierarchyModelSpaceBox, parent.transform.localToWorldMatrix));
                }
            }
            return(objectSelectionBoxes);
        }
Beispiel #3
0
        /// <summary>
        /// When the collection of controlled objects must be transformed by the gizmo, we will
        /// only apply the transformation to those objects that don't have a parent which resides
        /// inside the controlled object collection. If we don't do this, results are not very
        /// pleasing because we would apply the same transformation twice to the children: once
        /// by transforming the child itself, and a second time, by transforming its parent. This
        /// function returns a list with all the top parents (objects that don't have a parent
        /// inside the controlled object collection) that reside in the controlled object collection.
        /// </summary>
        /// <remarks>
        /// If the controlled objects collection hasn't been setup properly, the method will return
        /// an empty list of objects.
        /// </remarks>
        protected List <GameObject> GetParentsFromControlledObjects(bool filterOnlyCanBeManipulated)
        {
            // When the controlled game object collection hasn't been setup properly, return an empty list
            if (ControlledObjects == null)
            {
                return(new List <GameObject>());
            }

            if (!filterOnlyCanBeManipulated)
            {
                return(GameObjectExtensions.GetParentsFromObjectCollection(ControlledObjects));
            }
            else
            {
                List <GameObject> objectsWhichCanBeManipulated = GetControlledObjectsWhichCanBeManipulated();
                return(GameObjectExtensions.GetParentsFromObjectCollection(objectsWhichCanBeManipulated));
            }
        }