private void SetPropertyValueCore(SceneNodeProperty parentProperty, SceneNode valueAsSceneNode) { parentProperty.SetValue(valueAsSceneNode.DocumentNode); if (!valueAsSceneNode.TrueTargetType.IsClass) { return; } SceneNodePropertyCollection propertyCollection = (SceneNodePropertyCollection)parentProperty.get_PropertyValue().get_SubProperties(); propertyCollection.Rebuild(); if (((PropertyEntryCollection)propertyCollection).get_Count() <= 0 || !((SceneNodeProperty)this.PropertyValue.get_ParentProperty()).SceneNodeObjectSet.IsViewRepresentationValid) { return; } PropertyValueEditorCommands.get_ShowExtendedPinnedEditor().Execute(null, (IInputElement)this); }
private void SetPropertyValueCore(SceneNodeProperty parentProperty, SceneNode valueAsSceneNode) { parentProperty.SetValue((object)valueAsSceneNode.DocumentNode); if (!valueAsSceneNode.TrueTargetType.IsClass) { return; } SceneNodePropertyCollection propertyCollection = (SceneNodePropertyCollection)parentProperty.PropertyValue.SubProperties; propertyCollection.Rebuild(); if (propertyCollection.Count <= 0 || !((SceneNodeProperty)this.PropertyValue.ParentProperty).SceneNodeObjectSet.IsViewRepresentationValid) { return; } PropertyValueEditorCommands.ShowExtendedPinnedEditor.Execute((object)null, (IInputElement)this); }
public override void SelectElement(SceneElement element, SceneNodeProperty editingProperty) { if (element == null || editingProperty == null) { return; } string description = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.PropertyChangeUndoDescription, new object[1] { (object)((PropertyEntry)editingProperty).get_PropertyName() }); using (SceneEditTransaction editTransaction = editingProperty.SceneNodeObjectSet.ViewModel.CreateEditTransaction(description)) { element.EnsureNamed(); editingProperty.SetValue((object)element.Name); editTransaction.Commit(); } }
public void SelectElement(SceneElement element, SceneNodeProperty editingProperty) { ISchema schemaForDataSource = SchemaManager.GetSchemaForDataSource((SceneNode)element); using (SceneEditTransaction editTransaction = element.ViewModel.CreateEditTransaction(StringTable.CreateElementPropertyBindingUndo)) { BindingSceneNode elementNameBinding = MiniBindingDialog.CreateElementNameBinding(new DataSchemaNodePath(schemaForDataSource, schemaForDataSource.Root), (SceneNode)element, editingProperty.PropertyTypeId); if (elementNameBinding != null) { editingProperty.SetValue((object)elementNameBinding.DocumentNode); editTransaction.Commit(); } else { editTransaction.Cancel(); } } }
private void AddMaterial() { MaterialBaseEditor materialEditor = this.materialListView.CurrentItem as MaterialBaseEditor; if (materialEditor != null) { DocumentNode documentNode = this.ViewModel.CreateSceneNode(materialEditor.Type).DocumentNode; SceneNodeProperty propertyForParent = this.GetSceneNodePropertyForParent(materialEditor); using (this.ViewModel.ForceBaseValue()) { if (propertyForParent == null) { bool isMixed; DocumentNode valueAsDocumentNode = this.editingProperty.GetLocalValueAsDocumentNode(true, out isMixed); if (!isMixed) { this.editingProperty.SetValue((object)this.ViewModel.CreateSceneNode(typeof(MaterialGroup)).DocumentNode); SceneNodeProperty sceneNodeProperty = this.editingProperty.SceneNodeObjectSet.CreateSceneNodeProperty(this.editingProperty.Reference.Append(MaterialGroupNode.ChildrenProperty), (AttributeCollection)null); sceneNodeProperty.SetValue((object)this.ViewModel.CreateSceneNode(typeof(MaterialCollection)).DocumentNode); sceneNodeProperty.AddValue((object)valueAsDocumentNode); sceneNodeProperty.AddValue((object)documentNode); sceneNodeProperty.OnRemoveFromCategory(); } } else { int index = ((IndexedClrPropertyReferenceStep)materialEditor.MaterialProperty.Reference.LastStep).Index; propertyForParent.InsertValue(index + 1, (object)documentNode); propertyForParent.OnRemoveFromCategory(); } } this.Rebuild(); this.materialListView.MoveCurrentToNext(); } else { using (this.ViewModel.ForceBaseValue()) this.editingProperty.SetValue((object)this.ViewModel.CreateSceneNode(typeof(DiffuseMaterial)).DocumentNode); this.Rebuild(); } }
public static void CreateAndSetElementNameBinding(SceneNodeProperty sceneNodeProperty, SceneNode nodeToTarget) { BehaviorHelper.CreateAndSetElementNameBinding(sceneNodeProperty.PropertyName, nodeToTarget, (Action <BindingSceneNode>)(bindingNode => sceneNodeProperty.SetValue((object)bindingNode.DocumentNode))); }