protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            base.OnValueChanged(sender, args);
            if (this.isInvokingDirectChild) return;

            // Find the direct descendant editor on the path to the changed one
            PropertyEditor directChild = args.Editor;
            while (directChild != null && !this.HasPropertyEditor(directChild))
                directChild = directChild.ParentEditor;
            if (directChild == args.Editor) return;

            // If an editor has changed that was NOT a direct descendant, fire the appropriate notifier events.
            // Otherwise, there will be changed events for the child objects, but no-one knows they belong to
            // the Resource that is selected here.
            // Direct descendants are not a problem, because we'll run into the default member setter method
            // that already takes care of this.
            if (directChild != null && directChild != args.Editor && directChild.EditedMember != null)
            {
                // We don't actually fire notifier events, but perform an UndoRedoAction, which will
                // do this among other things. Not sure if this is still required, but let's leave it like
                // this for now.
                this.isInvokingDirectChild = true;
                if (directChild.EditedMember is PropertyInfo)
                    UndoRedoManager.Do(new EditPropertyAction(this.ParentGrid, directChild.EditedMember as PropertyInfo, this.GetValue(), null));
                else if (directChild.EditedMember is FieldInfo)
                    UndoRedoManager.Do(new EditFieldAction(this.ParentGrid, directChild.EditedMember as FieldInfo, this.GetValue(), null));
                this.isInvokingDirectChild = false;
            }
        }
        protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            if (_isInvokingDirectChild) return;

            // Find the direct descendant editor on the path to the changed one
            var directChild = args.Editor;
            while (directChild != null && !HasPropertyEditor(directChild))
                directChild = directChild.ParentEditor;

            if (directChild == args.Editor)
                return;

            if (directChild != null && directChild != args.Editor && directChild.EditedMember != null)
            {
                try
                {
                    _isInvokingDirectChild = true;
                    if (directChild.EditedMember is PropertyInfo || directChild.EditedMember is FieldInfo)
                        NotifyScriptComponentsChanged();
                }
                finally
                {
                    _isInvokingDirectChild = false;
                }
            }

            UpdatePrefabModifiedState(directChild);
        }
Esempio n. 3
0
 protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
 {
     base.OnValueChanged(sender, args);
     if (args.Editor.EditedMember != null &&
         args.Editor.EditedMember.IsEquivalent(ReflectionInfo.Property_Pixmap_Atlas))
     {
         this.PerformGetValue();
         (this.ParentEditor as PixmapPropertyEditor).UpdatePreview();
     }
 }
 private void CompressSelectedTextures(PropertyEditorValueEventArgs args)
 {
     foreach (var texture in GetValue().Cast<Texture>())
     {
         if ((bool) args.Value)
         {
             CompressTexture(texture);
         }
         else
         {
             texture.BasePixmap.Res.DeleteCompressedPixelData();
             DualityEditorApp.NotifyObjPropChanged(this, new ObjectSelection(texture.BasePixmap.Res));
         }
     }
 }
Esempio n. 5
0
 private void CompressSelectedTextures(PropertyEditorValueEventArgs args)
 {
     foreach (var texture in GetValue().Cast <Texture>())
     {
         if ((bool)args.Value)
         {
             CompressTexture(texture);
         }
         else
         {
             texture.BasePixmap.Res.DeleteCompressedPixelData();
             DualityEditorApp.NotifyObjPropChanged(this, new ObjectSelection(texture.BasePixmap.Res));
         }
     }
 }
        protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            base.OnValueChanged(sender, args);

            if (args.Editor.EditedMember == ReflectionInfo.Property_Texture_Compressed)
            {
                CompressSelectedTextures(args);
            }
            else if (args.Editor.EditedMember == ReflectionInfo.Property_Texture_PremultiplyAlpha)
            {
                foreach (var texture in GetValue().Cast<Texture>())
                {
                    if (texture.BasePixmap.Res.ProcessedLayer.IsCompressed)
                    {
                        CompressTexture(texture);
                    }
                }
            }
        }
Esempio n. 7
0
        protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            base.OnValueChanged(sender, args);

            // Did we edit an editor that's not a direct child of this one?
            bool indirectDescendant = !this.HasPropertyEditor(args.Editor);

            // If an editor has changed that was NOT a direct descendant, fire the appropriate notifier events.
            // Otherwise, there will be changed events for the child objects, but no-one knows they belong to
            // the Resource that is selected here.
            // Direct descendants are not a problem, because we'll run into our own setter method that takes care
            // of this.
            if (indirectDescendant)
            {
                DualityEditorApp.NotifyObjPropChanged(this.ParentGrid,
                                                      new ObjectSelection(this.GetValue()),
                                                      ReflectionInfo.Property_Resource_AssetInfo);
            }
        }
Esempio n. 8
0
        protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            base.OnValueChanged(sender, args);

            if (args.Editor.EditedMember == ReflectionInfo.Property_Texture_Compressed)
            {
                CompressSelectedTextures(args);
            }
            else if (args.Editor.EditedMember == ReflectionInfo.Property_Texture_PremultiplyAlpha)
            {
                foreach (var texture in GetValue().Cast <Texture>())
                {
                    if (texture.BasePixmap.Res.ProcessedLayer.IsCompressed)
                    {
                        CompressTexture(texture);
                    }
                }
            }
        }
Esempio n. 9
0
        protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            base.OnValueChanged(sender, args);
            if (this.isInvokingDirectChild)
            {
                return;
            }

            // Find the direct descendant editor on the path to the changed one
            PropertyEditor directChild = args.Editor;

            while (directChild != null && !this.HasPropertyEditor(directChild))
            {
                directChild = directChild.ParentEditor;
            }
            if (directChild == args.Editor)
            {
                return;
            }

            // If an editor has changed that was NOT a direct descendant, fire the appropriate notifier events.
            // Otherwise, there will be changed events for the child objects, but no-one knows they belong to
            // the Resource that is selected here.
            // Direct descendants are not a problem, because we'll run into the default member setter method
            // that already takes care of this.
            if (directChild != null && directChild != args.Editor && directChild.EditedMember != null)
            {
                // We don't actually fire notifier events, but perform an UndoRedoAction, which will
                // do this among other things. Not sure if this is still required, but let's leave it like
                // this for now.
                this.isInvokingDirectChild = true;
                if (directChild.EditedMember is PropertyInfo)
                {
                    UndoRedoManager.Do(new EditPropertyAction(this.ParentGrid, directChild.EditedMember as PropertyInfo, this.GetValue(), null));
                }
                else if (directChild.EditedMember is FieldInfo)
                {
                    UndoRedoManager.Do(new EditFieldAction(this.ParentGrid, directChild.EditedMember as FieldInfo, this.GetValue(), null));
                }
                this.isInvokingDirectChild = false;
            }
        }
Esempio n. 10
0
        protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            base.OnValueChanged(sender, args);
            if (this.isInvokingDirectChild)
            {
                return;
            }

            // Find the direct descendant editor on the path to the changed one
            PropertyEditor directChild = args.Editor;

            while (directChild != null && !this.HasPropertyEditor(directChild))
            {
                directChild = directChild.ParentEditor;
            }
            if (directChild == args.Editor)
            {
                return;
            }

            // If an editor has changed that was NOT a direct descendant, fire the appropriate notifier events.
            // Always remember: If we don't emit a PropertyChanged event, PrefabLinks won't update their change lists!
            if (directChild != null && directChild != args.Editor && directChild.EditedMember != null)
            {
                this.isInvokingDirectChild = true;
                if (directChild.EditedMember is PropertyInfo)
                {
                    UndoRedoManager.Do(new EditPropertyAction(this.ParentGrid, directChild.EditedMember as PropertyInfo, this.GetValue(), null));
                }
                else if (directChild.EditedMember is FieldInfo)
                {
                    UndoRedoManager.Do(new EditFieldAction(this.ParentGrid, directChild.EditedMember as FieldInfo, this.GetValue(), null));
                }
                this.isInvokingDirectChild = false;
            }

            this.UpdatePrefabModifiedState(directChild);
        }
Esempio n. 11
0
		protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
		{
			base.OnValueChanged(sender, args);
			if (this.isInvokingDirectChild) return;

			// Find the direct descendant editor on the path to the changed one
			PropertyEditor directChild = args.Editor;
			while (directChild != null && !this.HasPropertyEditor(directChild))
				directChild = directChild.ParentEditor;
			if (directChild == args.Editor) return;

			// If an editor has changed that was NOT a direct descendant, fire the appropriate notifier events.
			// Always remember: If we don't emit a PropertyChanged event, PrefabLinks won't update their change lists!
			if (directChild != null && directChild != args.Editor && directChild.EditedMember != null)
			{
				this.isInvokingDirectChild = true;
				if (directChild.EditedMember is PropertyInfo)
					UndoRedoManager.Do(new EditPropertyAction(this.ParentGrid, directChild.EditedMember as PropertyInfo, this.GetValue(), null));
				else if (directChild.EditedMember is FieldInfo)
					UndoRedoManager.Do(new EditFieldAction(this.ParentGrid, directChild.EditedMember as FieldInfo, this.GetValue(), null));
				this.isInvokingDirectChild = false;
			}
		}
 protected override void OnEditingFinished(PropertyEditorValueEventArgs e)
 {
     base.OnEditingFinished(e);
     UndoRedoManager.Finish();
 }
Esempio n. 13
0
 protected override void OnEditingFinished(PropertyEditorValueEventArgs e)
 {
     base.OnEditingFinished(e);
     UndoRedoManager.Finish();
 }
        protected override void OnValueChanged(object sender, PropertyEditorValueEventArgs args)
        {
            base.OnValueChanged(sender, args);

            // Did we edit an editor that's not a direct child of this one?
            bool indirectDescendant = !this.HasPropertyEditor(args.Editor);

            // If an editor has changed that was NOT a direct descendant, fire the appropriate notifier events.
            // Otherwise, there will be changed events for the child objects, but no-one knows they belong to
            // the Resource that is selected here.
            // Direct descendants are not a problem, because we'll run into our own setter method that takes care
            // of this.
            if (indirectDescendant)
            {
                DualityEditorApp.NotifyObjPropChanged(this.ParentGrid,
                    new ObjectSelection(this.GetValue()),
                    ReflectionInfo.Property_Resource_AssetInfo);
            }
        }
 private void OnScriptChanged(object sender, PropertyEditorValueEventArgs propertyEditorValueEventArgs)
 {
     UpdateScriptPropertyEditors(GetValue().Cast<ScriptComponent>());
 }