public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Contract.Requires(propertyItem != null); // this.Config.GroupPlugins.ListPlugins var prj = (AppProject)propertyItem.Instance; var gr = (GroupListAppSolutions)prj.Parent.Parent; var lst = new List <AppProject>(); foreach (var t in gr.ListAppSolutions) { foreach (var tt in t.ListAppProjects) { if (prj.Guid == tt.Guid) { continue; } lst.Add(tt); } } //if (instance.ListGenerators.Count == 1) // propertyItem.Value = instance.ListGenerators[0].Guid; ComboBox cbx = new ComboBox(); cbx.DisplayMemberPath = "Name"; cbx.SelectedValuePath = "Guid"; var _binding_lst = new Binding(); // bind to the Value property of the PropertyItem _binding_lst.Source = lst; _binding_lst.ValidatesOnExceptions = false; _binding_lst.ValidatesOnDataErrors = false; _binding_lst.Mode = BindingMode.OneWay; BindingOperations.SetBinding(cbx, ComboBox.ItemsSourceProperty, _binding_lst); var _binding = new Binding("Value"); // bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(cbx, ComboBox.SelectedValueProperty, _binding); return(cbx); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { m_PropertyItem = propertyItem; _control = new Xceed.Wpf.Toolkit.PropertyGrid.Editors.PropertyGridEditorDoubleUpDown(); //_control.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; //_control.Margin = new Thickness(0, 0, 0, 0); _control.Increment = 0.00001; _control.Maximum = 180; _control.Minimum = -180; _control.Value = (double)propertyItem.Value; _control.LostFocus += OnLostFocus; _control.KeyUp += OnKeyUp; _control.ValueChanged += OnValueChanged; _control.MouseUp += OnMouseUp; _control.TouchUp += OnTouchUp; _control.PreviewMouseUp += OnMouseUp; _control.PreviewTouchUp += OnTouchUp; f = false; return(_control); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Contract.Requires(propertyItem != null); DataType dt = null; if (propertyItem.Instance is DataType) { dt = (DataType)propertyItem.Instance; } else if (propertyItem.Instance is Property) { dt = ((Property)propertyItem.Instance).DataType; } else { throw new Exception(); } ComboBox cbx = new ComboBox(); cbx.DisplayMemberPath = "Name"; cbx.SelectedValuePath = "Guid"; var _binding_lst = new Binding("ListObjects"); // bind to the Value property of the PropertyItem _binding_lst.Source = dt; _binding_lst.ValidatesOnExceptions = false; _binding_lst.ValidatesOnDataErrors = false; _binding_lst.Mode = BindingMode.OneWay; BindingOperations.SetBinding(cbx, ComboBox.ItemsSourceProperty, _binding_lst); var _binding = new Binding("Value"); // bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(cbx, ComboBox.SelectedValueProperty, _binding); return(cbx); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Contract.Requires(propertyItem != null); sln = (AppSolution)propertyItem.Instance; Grid grd = new Grid(); var cd1 = new ColumnDefinition(); cd1.Width = new GridLength(1, GridUnitType.Star); var cd2 = new ColumnDefinition(); cd2.Width = new GridLength(1, GridUnitType.Auto); grd.ColumnDefinitions.Add(cd1); grd.ColumnDefinitions.Add(cd2); textBox = new PropertyGridEditorTextBox(); textBox.Watermark = "Select file"; var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(textBox, PropertyGridEditorTextBox.TextProperty, _binding); Button b = new Button(); b.Content = "..."; b.Click += B_Click; Grid.SetColumn(textBox, 0); Grid.SetColumn(b, 1); grd.Children.Add(textBox); grd.Children.Add(b); return(grd); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Contract.Requires(propertyItem != null); // this.Config.GroupPlugins.ListPlugins ITreeConfigNode instance = (ITreeConfigNode)propertyItem.Instance; IConfig cnfg = instance.GetConfig(); ComboBox cbx = new ComboBox(); cbx.DisplayMemberPath = "Name"; cbx.SelectedValuePath = "Guid"; var _binding_lst = new Binding("ListPlugins"); // bind to the Value property of the PropertyItem _binding_lst.Source = cnfg.GroupPlugins; _binding_lst.ValidatesOnExceptions = false; _binding_lst.ValidatesOnDataErrors = false; _binding_lst.Mode = BindingMode.OneWay; BindingOperations.SetBinding(cbx, ComboBox.ItemsSourceProperty, _binding_lst); // //var en = cnfg.GroupPlugins.ListPlugins.GetEnumerator(); //if (en.MoveNext()) //{ // var plg = en.Current; // if (!en.MoveNext()) // { // propertyItem.Value = plg.Guid; // } //} var _binding = new Binding("Value"); // bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(cbx, ComboBox.SelectedValueProperty, _binding); return(cbx); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Contract.Requires(propertyItem != null); PluginsGroup instance = (PluginsGroup)propertyItem.Instance; ComboBox cbx = new ComboBox(); cbx.DisplayMemberPath = "GroupInfo"; cbx.SelectedValuePath = "GroupGuid"; var _binding_lst = new Binding("ListPluginsGroups"); // bind to the Value property of the PropertyItem _binding_lst.Source = instance; _binding_lst.ValidatesOnExceptions = false; _binding_lst.ValidatesOnDataErrors = false; _binding_lst.Mode = BindingMode.OneWay; BindingOperations.SetBinding(cbx, ComboBox.ItemsSourceProperty, _binding_lst); var _binding = new Binding("Value"); // bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(cbx, ComboBox.SelectedValueProperty, _binding); return(cbx); }
private void PropertyGridValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem item = e.OriginalSource as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; switch ((PropertyOrders)item.PropertyOrder) { case PropertyOrders.PO_Meshes: { uint mesh_id = 0; for (; mesh_id < MeshItemsSource.items.Count; ++mesh_id) { if (MeshItemsSource.items[(int)mesh_id].DisplayName == (e.NewValue as string)) { break; } } this.UpdateMeshProperties(mesh_id); core_.SelectMesh(mesh_id); this.UpdateHistroy(); } break; case PropertyOrders.PO_Ambient: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.AmbientMaterial(mtl_id, properties_obj_.ambient); this.UpdateHistroy(); } break; case PropertyOrders.PO_Diffuse: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.DiffuseMaterial(mtl_id, properties_obj_.diffuse); this.UpdateHistroy(); } break; case PropertyOrders.PO_Specular: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.SpecularMaterial(mtl_id, properties_obj_.specular); this.UpdateHistroy(); } break; case PropertyOrders.PO_Shininess: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.ShininessMaterial(mtl_id, properties_obj_.shininess); this.UpdateHistroy(); } break; case PropertyOrders.PO_Emit: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.EmitMaterial(mtl_id, properties_obj_.emit); this.UpdateHistroy(); } break; case PropertyOrders.PO_Opacity: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.OpacityMaterial(mtl_id, properties_obj_.opacity); this.UpdateHistroy(); } break; case PropertyOrders.PO_DiffuseTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.DiffuseTexture(mtl_id, this.RelativePath(properties_obj_.diffuse_tex)); this.UpdateHistroy(); } break; case PropertyOrders.PO_SpecularTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.SpecularTexture(mtl_id, this.RelativePath(properties_obj_.specular_tex)); this.UpdateHistroy(); } break; case PropertyOrders.PO_ShininessTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.ShininessTexture(mtl_id, this.RelativePath(properties_obj_.shininess_tex)); this.UpdateHistroy(); } break; case PropertyOrders.PO_NormalTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.NormalTexture(mtl_id, this.RelativePath(properties_obj_.normal_tex)); this.UpdateHistroy(); } break; case PropertyOrders.PO_HeightTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.HeightTexture(mtl_id, this.RelativePath(properties_obj_.height_tex)); this.UpdateHistroy(); } break; case PropertyOrders.PO_EmitTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.EmitTexture(mtl_id, this.RelativePath(properties_obj_.emit_tex)); this.UpdateHistroy(); } break; case PropertyOrders.PO_OpacityTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.OpacityTexture(mtl_id, this.RelativePath(properties_obj_.opacity_tex)); this.UpdateHistroy(); } break; case PropertyOrders.PO_DetailMode: if (selected_mesh_id_ > 0) { uint mode = 0; for (; mode < DetailModeItemsSource.items.Count; ++mode) { if (DetailModeItemsSource.items[(int)mode].DisplayName == (e.NewValue as string)) { break; } } uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.DetailMode(mtl_id, mode); this.UpdateHistroy(); } break; case PropertyOrders.PO_HeightOffset: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.HeightOffset(mtl_id, properties_obj_.height_offset); this.UpdateHistroy(); } break; case PropertyOrders.PO_HeightScale: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.HeightScale(mtl_id, properties_obj_.height_scale); this.UpdateHistroy(); } break; case PropertyOrders.PO_EdgeTessHint: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.EdgeTessHint(mtl_id, properties_obj_.edge_tess_hint); this.UpdateHistroy(); } break; case PropertyOrders.PO_InsideTessHint: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.InsideTessHint(mtl_id, properties_obj_.inside_tess_hint); this.UpdateHistroy(); } break; case PropertyOrders.PO_MinTess: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.MinTess(mtl_id, properties_obj_.min_tess); this.UpdateHistroy(); } break; case PropertyOrders.PO_MaxTess: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.MaxTess(mtl_id, properties_obj_.max_tess); this.UpdateHistroy(); } break; default: break; } }
private void PropertyGridValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem item = e.OriginalSource as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; switch ((TextureProperties)item.PropertyOrder) { case TextureProperties.TP_TextureType: case TextureProperties.TP_ArraySize: case TextureProperties.TP_NumMipmaps: case TextureProperties.TP_Width: case TextureProperties.TP_Height: case TextureProperties.TP_Depth: case TextureProperties.TP_Format: break; case TextureProperties.TP_ArrayIndex: active_array_index_ = properties_obj_.ArrayIndex; core_.ArrayIndex(active_array_index_); break; case TextureProperties.TP_Face: if (KlayGE.TexViewerCoreWrapper.TextureType.TT_Cube == core_.Type()) { for (int i = 0; i < ZoomSource.zooms.Length; ++i) { if (TextureFaceSource.items[i].DisplayName == properties_obj_.Face) { active_face_ = (uint)i; core_.Face(active_face_); break; } } } break; case TextureProperties.TP_DepthIndex: active_depth_index_ = properties_obj_.DepthIndex; core_.DepthIndex(active_depth_index_); break; case TextureProperties.TP_MipmapLevel: active_mipmap_level_ = properties_obj_.MipmapLevel; core_.MipmapLevel(active_mipmap_level_); this.UpdateMatrix(); if (core_.Depth(active_mipmap_level_) > 1) { TexturDepthIndexSource.items.Clear(); for (uint i = 0; i < core_.Depth(active_mipmap_level_); ++i) { TexturDepthIndexSource.items.Add(i.ToString()); } } active_depth_index_ = Math.Min(active_depth_index_, core_.Depth(active_mipmap_level_)); break; case TextureProperties.TP_Stops: stops_ = properties_obj_.Stops; core_.Stops(stops_); break; case TextureProperties.TP_Zoom: for (int i = 0; i < ZoomSource.zooms.Length; ++i) { if (ZoomSource.items[i].DisplayName == properties_obj_.Zoom) { old_zoom_index_ = zoom_index_; zoom_index_ = i; this.UpdateMatrix(); break; } } break; default: break; } }
public override FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { var fe = base.ResolveEditor(propertyItem); return(fe); }
protected override void SetControlProperties(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Editor.IsReadOnly = true; base.SetControlProperties(propertyItem); Editor.PreviewMouseUp += Editor_MouseDown; }
private void PropertyGridValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem item = e.OriginalSource as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; switch ((PropertyOrders)item.PropertyOrder) { case PropertyOrders.PO_Meshes: { uint mesh_id = 0; for (; mesh_id < MeshItemsSource.items.Count; ++mesh_id) { if (MeshItemsSource.items[(int)mesh_id].DisplayName == (e.NewValue as string)) { break; } } if (core_.SelectedMesh() != mesh_id) { this.ExecuteCommand(new MtlEditorCommandSelectMesh(core_, mesh_id)); this.UpdateMeshProperties(mesh_id); } } break; case PropertyOrders.PO_Ambient: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); float[] ambient = ColorToFloatPtr(properties_obj_.ambient); float[] old_ambient = core_.AmbientMaterial(mtl_id); if (!this.FloatEqual(old_ambient[0], ambient[0]) || !this.FloatEqual(old_ambient[1], ambient[1]) || !this.FloatEqual(old_ambient[2], ambient[2])) { this.ExecuteCommand(new MtlEditorCommandSetAmbientMaterial(core_, mtl_id, ambient)); } } break; case PropertyOrders.PO_Diffuse: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); float[] diffuse = ColorToFloatPtr(properties_obj_.diffuse); float[] old_diffuse = core_.DiffuseMaterial(mtl_id); if (!this.FloatEqual(old_diffuse[0], diffuse[0]) || !this.FloatEqual(old_diffuse[1], diffuse[1]) || !this.FloatEqual(old_diffuse[2], diffuse[2])) { this.ExecuteCommand(new MtlEditorCommandSetDiffuseMaterial(core_, mtl_id, diffuse)); } } break; case PropertyOrders.PO_Specular: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); float[] specular = ColorToFloatPtr(properties_obj_.specular); float[] old_specular = core_.SpecularMaterial(mtl_id); if (!this.FloatEqual(old_specular[0], specular[0]) || !this.FloatEqual(old_specular[1], specular[1]) || !this.FloatEqual(old_specular[2], specular[2])) { this.ExecuteCommand(new MtlEditorCommandSetSpecularMaterial(core_, mtl_id, specular)); } } break; case PropertyOrders.PO_Shininess: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (core_.ShininessMaterial(mtl_id) != properties_obj_.shininess) { this.ExecuteCommand(new MtlEditorCommandSetShininessMaterial(core_, mtl_id, properties_obj_.shininess)); } } break; case PropertyOrders.PO_Emit: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); float[] emit = ColorToFloatPtr(properties_obj_.emit); float[] old_emit = core_.EmitMaterial(mtl_id); if (!this.FloatEqual(old_emit[0], emit[0]) || !this.FloatEqual(old_emit[1], emit[1]) || !this.FloatEqual(old_emit[2], emit[2])) { this.ExecuteCommand(new MtlEditorCommandSetEmitMaterial(core_, mtl_id, emit)); } } break; case PropertyOrders.PO_Opacity: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (!this.FloatEqual(core_.OpacityMaterial(mtl_id), properties_obj_.opacity)) { this.ExecuteCommand(new MtlEditorCommandSetOpacityMaterial(core_, mtl_id, properties_obj_.opacity)); } } break; case PropertyOrders.PO_DiffuseTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); string diffuse_tex = RelativePath(properties_obj_.diffuse_tex); if (core_.DiffuseTexture(mtl_id) != diffuse_tex) { this.ExecuteCommand(new MtlEditorCommandSetDiffuseTexture(core_, mtl_id, diffuse_tex)); } } break; case PropertyOrders.PO_SpecularTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); string specular_tex = RelativePath(properties_obj_.specular_tex); if (core_.SpecularTexture(mtl_id) != specular_tex) { this.ExecuteCommand(new MtlEditorCommandSetSpecularTexture(core_, mtl_id, specular_tex)); } } break; case PropertyOrders.PO_ShininessTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); string shininess_tex = RelativePath(properties_obj_.shininess_tex); if (core_.ShininessTexture(mtl_id) != shininess_tex) { this.ExecuteCommand(new MtlEditorCommandSetShininessTexture(core_, mtl_id, shininess_tex)); } } break; case PropertyOrders.PO_NormalTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); string normal_tex = RelativePath(properties_obj_.normal_tex); if (core_.NormalTexture(mtl_id) != normal_tex) { this.ExecuteCommand(new MtlEditorCommandSetNormalTexture(core_, mtl_id, normal_tex)); } } break; case PropertyOrders.PO_HeightTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); string height_tex = RelativePath(properties_obj_.height_tex); if (core_.HeightTexture(mtl_id) != height_tex) { this.ExecuteCommand(new MtlEditorCommandSetHeightTexture(core_, mtl_id, height_tex)); } } break; case PropertyOrders.PO_EmitTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); string emit_tex = RelativePath(properties_obj_.emit_tex); if (core_.EmitTexture(mtl_id) != emit_tex) { this.ExecuteCommand(new MtlEditorCommandSetEmitTexture(core_, mtl_id, emit_tex)); } } break; case PropertyOrders.PO_OpacityTex: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); string opacity_tex = RelativePath(properties_obj_.opacity_tex); if (core_.OpacityTexture(mtl_id) != opacity_tex) { this.ExecuteCommand(new MtlEditorCommandSetOpacityTexture(core_, mtl_id, opacity_tex)); } } break; case PropertyOrders.PO_DetailMode: if (selected_mesh_id_ > 0) { uint mode = 0; for (; mode < DetailModeItemsSource.items.Count; ++mode) { if (DetailModeItemsSource.items[(int)mode].DisplayName == (e.NewValue as string)) { break; } } uint mtl_id = core_.MaterialID(selected_mesh_id_); if (core_.DetailMode(mtl_id) != mode) { this.ExecuteCommand(new MtlEditorCommandSetDetailMode(core_, mtl_id, mode)); } } break; case PropertyOrders.PO_HeightOffset: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (!this.FloatEqual(core_.HeightOffset(mtl_id), properties_obj_.height_offset)) { this.ExecuteCommand(new MtlEditorCommandSetHeightOffset(core_, mtl_id, properties_obj_.height_offset)); } } break; case PropertyOrders.PO_HeightScale: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (!this.FloatEqual(core_.HeightScale(mtl_id), properties_obj_.height_scale)) { this.ExecuteCommand(new MtlEditorCommandSetHeightScale(core_, mtl_id, properties_obj_.height_scale)); } } break; case PropertyOrders.PO_EdgeTessHint: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (!this.FloatEqual(core_.EdgeTessHint(mtl_id), properties_obj_.edge_tess_hint)) { this.ExecuteCommand(new MtlEditorCommandSetEdgeTessHint(core_, mtl_id, properties_obj_.edge_tess_hint)); } } break; case PropertyOrders.PO_InsideTessHint: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (!this.FloatEqual(core_.InsideTessHint(mtl_id), properties_obj_.inside_tess_hint)) { this.ExecuteCommand(new MtlEditorCommandSetInsideTessHint(core_, mtl_id, properties_obj_.inside_tess_hint)); } } break; case PropertyOrders.PO_MinTess: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (!this.FloatEqual(core_.MinTess(mtl_id), properties_obj_.min_tess)) { this.ExecuteCommand(new MtlEditorCommandSetMinTess(core_, mtl_id, properties_obj_.min_tess)); } } break; case PropertyOrders.PO_MaxTess: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); if (!this.FloatEqual(core_.MaxTess(mtl_id), properties_obj_.max_tess)) { this.ExecuteCommand(new MtlEditorCommandSetMaxTess(core_, mtl_id, properties_obj_.max_tess)); } } break; default: break; } }
private void PropertyGridValueChanged(object sender, Xceed.Wpf.Toolkit.PropertyGrid.PropertyValueChangedEventArgs e) { Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem item = e.OriginalSource as Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem; switch (item.PropertyOrder) { case MESHES_ORDER: { uint mesh_id = 0; for (; mesh_id < MeshItemsSource.items.Count; ++mesh_id) { if (MeshItemsSource.items[(int)mesh_id].DisplayName == (e.NewValue as string)) { break; } } this.UpdateMeshProperties(mesh_id); core_.SelectMesh(mesh_id); this.UpdateHistroy(); } break; case AMBIENT_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.AmbientMaterial(mtl_id, properties_obj_.ambient); this.UpdateHistroy(); } break; case DIFFUSE_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.DiffuseMaterial(mtl_id, properties_obj_.diffuse); this.UpdateHistroy(); } break; case SPECULAR_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.SpecularMaterial(mtl_id, properties_obj_.specular); this.UpdateHistroy(); } break; case SHININESS_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.ShininessMaterial(mtl_id, properties_obj_.shininess); this.UpdateHistroy(); } break; case EMIT_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.EmitMaterial(mtl_id, properties_obj_.emit); this.UpdateHistroy(); } break; case OPACITY_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.OpacityMaterial(mtl_id, properties_obj_.opacity); this.UpdateHistroy(); } break; case DIFFUSE_TEX_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.DiffuseTexture(mtl_id, this.RelativePath(properties_obj_.diffuse_tex)); this.UpdateHistroy(); } break; case SPECULAR_TEX_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.SpecularTexture(mtl_id, this.RelativePath(properties_obj_.specular_tex)); this.UpdateHistroy(); } break; case SHININESS_TEX_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.ShininessTexture(mtl_id, this.RelativePath(properties_obj_.shininess_tex)); this.UpdateHistroy(); } break; case NORMAL_TEX_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.NormalTexture(mtl_id, this.RelativePath(properties_obj_.normal_tex)); this.UpdateHistroy(); } break; case HEIGHT_TEX_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.HeightTexture(mtl_id, this.RelativePath(properties_obj_.height_tex)); this.UpdateHistroy(); } break; case EMIT_TEX_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.EmitTexture(mtl_id, this.RelativePath(properties_obj_.emit_tex)); this.UpdateHistroy(); } break; case OPACITY_TEX_ORDER: if (selected_mesh_id_ > 0) { uint mtl_id = core_.MaterialID(selected_mesh_id_); core_.OpacityTexture(mtl_id, this.RelativePath(properties_obj_.opacity_tex)); this.UpdateHistroy(); } break; default: break; } }