public override void SetNodeValue(TTargetType value)
 {
     using (var transaction = ActionService?.CreateTransaction())
     {
         Node.Update(Converter(value), NodeIndex.Empty);
         ActionService?.SetName(transaction, $"Update property {PropertyName}");
     }
 }
 private static void SetMaterial(IObjectNode materialNode, Index index, Material value)
 {
     if (materialNode.Indices.Contains(index))
     {
         materialNode.Update(value, index);
     }
     else
     {
         materialNode.Add(value, index);
     }
 }
Exemple #3
0
 public override void UpdateValue(object newValue)
 {
     try
     {
         Container.Update(newValue, Index);
     }
     catch (Exception e)
     {
         throw new NodePresenterException("An error occurred while updating the value of the node, see the inner exception for more information.", e);
     }
 }
Exemple #4
0
 protected static bool UpdateCollection([NotNull] IObjectNode node, object value, Index index)
 {
     if (IsIndexExisting(node, index))
     {
         node.Update(value, index);
         return(true);
     }
     if (IsIndexValid(node, index))
     {
         node.Add(value, index);
         return(true);
     }
     return(false);
 }
Exemple #5
0
 /// <summary>
 /// Setter for the virtual node's value.
 /// </summary>
 /// <param name="undoRedoService"></param>
 /// <param name="propertyContainerNode">The node containing the property.</param>
 /// <param name="propertyIndex">The index of the property in the node.</param>
 /// <param name="value">The value to set.</param>
 private static void Setter(IUndoRedoService undoRedoService, [NotNull] IObjectNode propertyContainerNode, NodeIndex propertyIndex, object value)
 {
     using (undoRedoService?.CreateTransaction())
     {
         if (!propertyContainerNode.Indices.Contains(propertyIndex))
         {
             // Note: update would probably work, but we want to remove the property when Undo
             propertyContainerNode.Add(value, propertyIndex);
         }
         else
         {
             propertyContainerNode.Update(value, propertyIndex);
         }
     }
 }
Exemple #6
0
        /// <inheritdoc/>
        protected override void ProcessIdentifiableItems(IIdentifiable identifiable, IObjectNode collection, NodeIndex index)
        {
            if (!targetIds.Contains(identifiable.Id))
            {
                return;
            }

            if (PropertyGraphDefinition.IsTargetItemObjectReference(collection, index, identifiable))
            {
                if (shouldClearReference?.Invoke(collection, index) ?? true)
                {
                    collection.Update(null, index);
                }
            }
        }
Exemple #7
0
 protected virtual void ReplaceItem(IObjectNode collection, NodeIndex index, object newItem)
 {
     collection.Update(newItem, index);
 }