Пример #1
0
        internal bool SetPlacement(ButtonPart part, StageObject parent)
        {
            if (part.Character == null) return false;
            if (!part.CxForm.IsIdentity) CxForm = part.CxForm;
            Matrix = new VGMatrix(part.Matrix);

            if (part.Character != Character)
            {
                Object = part.Character.MakeInstance(this, parent.Root);
                if (Object == null) return false;
                Object.SetParent(parent);
                Character = part.Character;

                if (Object is IInstanceable)
                {
                    var obj = Object as IInstanceable;
                    obj.Load();
                }
            }

            return Object != null;
        }
Пример #2
0
        internal bool SetPlacement(PlaceObject2Tag tag, StageObject parent)
        {
            bool load = false;

            // TODO: Morph ratio
            if (tag.HasCxForm) CxForm = tag.CxForm;
            if (tag.HasMatrix) Matrix = new VGMatrix(tag.Matrix);
            if (tag.HasCharacter)
            {
                var character = parent.Root.Document[tag.CharacterID];
                if (character == null) return false;

                var newInstance = character.MakeInstance(this, parent.Root);
                if (newInstance == null) return false;

                Removed();
                Character = character;
                Object = newInstance;
                Object.SetParent(parent);
                load = true;
            }

            if (tag.HasClipDepth) ClipDepth = tag.ClipDepth;
            if (Object is IInstanceable)
            {
                var obj = Object as IInstanceable;
                if (tag.HasName) obj.SetName(tag.Name);
                if (tag.HasActions) obj.SetClipActions(tag.Actions);
                if (load) obj.Load();
            }

            return Object != null;
        }