Ejemplo n.º 1
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Stroke stroke = element as LW_Stroke;

            if (stroke != null)
            {
                m_GlobalWidth = stroke.m_GlobalWidth;
                if (stroke.m_VariableWidths != null)
                {
                    m_VariableWidths = new List <LW_WidthStop>(stroke.m_VariableWidths);
                }
                else
                {
                    m_VariableWidths = null;
                }
                m_SpaceWidthsEvenly = stroke.m_SpaceWidthsEvenly;
                m_SpaceColorsEvenly = stroke.m_SpaceColorsEvenly;
                m_ScreenSpace       = stroke.m_ScreenSpace;
                m_Linecap           = stroke.m_Linecap;
                m_Linejoin          = stroke.m_Linejoin;
                m_MiterLimit        = stroke.m_MiterLimit;
                m_Justification     = stroke.m_Justification;
                m_Angle             = stroke.m_Angle;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 2
0
        internal virtual void CopyPropertiesFrom(LW_Element element)
        {
            if (element == null || this == null)
            {
                return;
            }

                        #if UNITY_EDITOR || DEVELOPMENT
            if (s_Debug)
            {
                Debug.Log("CopyElementPropertiesFrom: " + element.name + " to: " + name);
            }
                        #endif

            hideFlags = element.hideFlags;
            name      = element.name;
            //name = element.name + " (Copy)";

            //m_Id = element.m_Id;
            //m_Id = GetHashCode();
            m_IsVisible = element.m_IsVisible;

            // NonSerialized
            m_ElementDirty           = element.m_ElementDirty;
            m_OnElementDirtyCallback = element.m_OnElementDirtyCallback;

            UnregisterChildren();
            RegisterChildren();
        }
Ejemplo n.º 3
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Marker marker = element as LW_Marker;

            if (marker != null)
            {
                m_Graphic            = marker.m_Graphic;
                m_Position           = marker.m_Position;
                m_EulerRotation      = marker.m_EulerRotation;
                m_Scale              = marker.m_Scale;
                m_ScaleWithStroke    = marker.m_ScaleWithStroke;
                m_Stroke             = marker.m_Stroke;
                m_VariableScales     = marker.m_VariableScales;
                m_AtStart            = marker.m_AtStart;
                m_AtMiddle           = marker.m_AtMiddle;
                m_AtEnd              = marker.m_AtEnd;
                m_FlipEnd            = marker.m_FlipEnd;
                m_FaceForward        = marker.m_FaceForward;
                m_PlacementMode      = marker.m_PlacementMode;
                m_FixedSpacingLength = marker.m_FixedSpacingLength;
                m_FixedJustification = marker.m_FixedJustification;
                m_NumberOfMarkers    = marker.m_NumberOfMarkers;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 4
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_PaintStyle style = element as LW_PaintStyle;

            if (style != null)
            {
                m_Material    = style.m_Material;
                m_MainTexture = style.m_MainTexture;
                m_PaintMode   = style.m_PaintMode;
                m_UvMode      = style.m_UvMode;
                m_UvTiling    = style.m_UvTiling;
                m_UvOffset    = style.m_UvOffset;
                if (style.m_GradientColors != null)
                {
                    m_GradientColors = new List <LW_ColorStop>(style.m_GradientColors);
                }
                else
                {
                    m_GradientColors = null;
                }
                m_GradientPosition     = style.m_GradientPosition;
                m_GradientRotation     = style.m_GradientRotation;
                m_GradientScale        = style.m_GradientScale;
                m_GradientSpreadMethod = style.m_GradientSpreadMethod;
                m_GradientUnits        = style.m_GradientUnits;
                m_GradientStart        = style.m_GradientStart;
                m_GradientEnd          = style.m_GradientEnd;
                m_Opacity = style.m_Opacity;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 5
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_PointsShape <T> shape = element as LW_PointsShape <T>;

            if (shape != null)
            {
                m_Points = new List <T>(shape.m_Points);
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 6
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Collider collider = element as LW_Collider;

            if (collider != null)
            {
                m_ColliderType = collider.m_ColliderType;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 7
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Fill fill = element as LW_Fill;

            if (fill != null)
            {
                m_FillRule       = fill.m_FillRule;
                m_LandscapeDepth = fill.m_LandscapeDepth;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 8
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Line line = element as LW_Line;

            if (line != null)
            {
                m_Start = line.m_Start;
                m_End   = line.m_End;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 9
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Circle circle = element as LW_Circle;

            if (circle != null)
            {
                m_Center = circle.m_Center;
                m_Radius = circle.m_Radius;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 10
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Ellipse ellipse = element as LW_Ellipse;

            if (ellipse != null)
            {
                m_Center  = ellipse.m_Center;
                m_RadiusX = ellipse.m_RadiusX;
                m_RadiusY = ellipse.m_RadiusY;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 11
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Polygon polygon = element as LW_Polygon;

            if (polygon != null)
            {
                m_Center = polygon.m_Center;
                m_Radius = polygon.m_Radius;
                m_Sides  = polygon.m_Sides;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 12
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Style style = element as LW_Style;

            if (style != null)
            {
                m_SegmentationMultiplier   = style.m_SegmentationMultiplier;
                m_SimplificationMultiplier = style.m_SimplificationMultiplier;
                m_LateralOffset            = style.m_LateralOffset;
                m_VerticalOffset           = style.m_VerticalOffset;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 13
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Star star = element as LW_Star;

            if (star != null)
            {
                m_Center  = star.m_Center;
                m_RadiusX = star.m_RadiusX;
                m_RadiusY = star.m_RadiusY;
                m_Sides   = star.m_Sides;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Copy polyline.
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 public override LW_Element Copy(LW_Element element = null)
 {
     if (element != null && element is LW_Polyline3D)
     {
         element.CopyPropertiesFrom(this);
     }
     else
     {
         element = Copy(CreateInstance <LW_Polyline3D>());
         //element.UnregisterChildren();
         //element.RegisterChildren();
     }
     return(element);
 }
Ejemplo n.º 15
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Rectangle rectangle = element as LW_Rectangle;

            if (rectangle != null)
            {
                m_Center  = rectangle.m_Center;
                m_Width   = rectangle.m_Width;
                m_Height  = rectangle.m_Height;
                m_RadiusX = rectangle.m_RadiusX;
                m_RadiusY = rectangle.m_RadiusY;
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 16
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            LW_Shape shape = element as LW_Shape;

            if (shape != null)
            {
                m_ReverseDirection = shape.m_ReverseDirection;
                m_IsClosed         = shape.m_IsClosed;
                                #if UNITY_EDITOR
                m_EditorColor = shape.m_EditorColor;
                                #endif
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Creates a copy of this element or Copies the properties of this element on to a provided element.
        /// </summary>
        /// <param name="element">The element to apply this elements properties on to. if null a new element is created.</param>
        /// <returns></returns>
        public virtual LW_Element Copy(LW_Element element = null)
        {
                        #if UNITY_EDITOR || DEVELOPMENT
            if (s_Debug)
            {
                Debug.Log("Copy: " + name);
            }
                        #endif

            if (element != null)
            {
                element.CopyPropertiesFrom(this);
            }
            return(element);
        }
Ejemplo n.º 18
0
 internal override void CopyPropertiesFrom(LW_Element element)
 {
     if (element is LW_Graphic)
     {
         LW_Graphic graphic = element as LW_Graphic;
         m_Position      = graphic.m_Position;
         m_EulerRotation = graphic.m_EulerRotation;
         m_Scale         = graphic.m_Scale;
         if (m_Styles != null)
         {
             m_Styles.CopyPropertiesFrom(graphic.m_Styles);
         }
         RebuildShape();
     }
     base.CopyPropertiesFrom(element);
 }
Ejemplo n.º 19
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            if (element is LW_Styles)
            {
                LW_Styles styles = element as LW_Styles;

                bool stylesMatch = m_StylesList != null && styles.m_StylesList != null && m_StylesList.Count == styles.m_StylesList.Count;
                if (stylesMatch)
                {
                    for (int i = 0; i < m_StylesList.Count; i++)
                    {
                        if (m_StylesList[i].GetType() != styles.m_StylesList[i].GetType() || m_StylesList[i] == styles.m_StylesList[i])
                        {
                            stylesMatch = false;
                            break;
                        }
                    }
                }
                if (stylesMatch)
                {
                    for (int i = 0; i < m_StylesList.Count; i++)
                    {
                        m_StylesList[i].CopyPropertiesFrom(styles.m_StylesList[i]);
                    }
                }
                else
                {
                    if (m_StylesList != null)
                    {
                        for (int i = 0; i < m_StylesList.Count; i++)
                        {
                            if (m_StylesList[i] != null)
                            {
                                LW_Utilities.SafeDestroy(m_StylesList[i]);
                            }
                        }
                        m_StylesList.Clear();
                    }
                    if (styles.m_StylesList != null)
                    {
                        if (m_StylesList == null)
                        {
                            m_StylesList = new List <LW_Style>(styles.m_StylesList.Count);
                        }
                        else if (m_StylesList.Capacity < styles.m_StylesList.Count)
                        {
                            m_StylesList.Capacity = styles.m_StylesList.Count;
                        }

                        for (int i = 0; i < styles.m_StylesList.Count; i++)
                        {
                            if (styles.m_StylesList[i] != null)
                            {
                                LW_Style copiedElement = styles.m_StylesList[i].Copy() as LW_Style;
                                m_StylesList.Add(copiedElement);
                            }
                        }
                    }
                }
            }
            base.CopyPropertiesFrom(element);
        }
Ejemplo n.º 20
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            if (element is LW_Group)
            {
                LW_Group group = element as LW_Group;

                bool groupMatches = m_GraphicsList != null && group.m_GraphicsList != null && m_GraphicsList.Count == group.m_GraphicsList.Count;
                if (groupMatches)
                {
                    for (int i = 0; i < m_GraphicsList.Count; i++)
                    {
                        if (m_GraphicsList[i].GetType() != group.m_GraphicsList[i].GetType() || m_GraphicsList[i] == group.m_GraphicsList[i])
                        {
                            groupMatches = false;
                            break;
                        }
                    }
                }
                if (groupMatches)
                {
                    for (int i = 0; i < m_GraphicsList.Count; i++)
                    {
                        m_GraphicsList[i].CopyPropertiesFrom(group.m_GraphicsList[i]);
                    }
                }
                else
                {
                    if (m_GraphicsList != null)
                    {
                        for (int i = 0; i < m_GraphicsList.Count; i++)
                        {
                            if (m_GraphicsList[i] != null)
                            {
                                LW_Utilities.SafeDestroy(m_GraphicsList[i]);
                            }
                        }
                        m_GraphicsList = null;
                    }
                    if (group.m_GraphicsList != null)
                    {
                        if (m_GraphicsList == null)
                        {
                            m_GraphicsList = new List <LW_Graphic>(group.m_GraphicsList.Count);
                        }
                        else if (m_GraphicsList.Capacity < group.m_GraphicsList.Count)
                        {
                            m_GraphicsList.Capacity = group.m_GraphicsList.Count;
                        }

                        for (int i = 0; i < group.m_GraphicsList.Count; i++)
                        {
                            if (group.m_GraphicsList[i] != null)
                            {
                                LW_Graphic copiedElement = group.m_GraphicsList[i].Copy() as LW_Graphic;
                                m_GraphicsList.Add(copiedElement);
                            }
                        }
                    }
                }
            }
            base.CopyPropertiesFrom(element);
        }