} // AddControls /// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Plane asset, Window owner, bool assetCreation) { GroupBox groupGeneral = CommonControls.Group("General", owner); var widthTextBox = CommonControls.TextBox("Width", groupGeneral, asset.Width.ToString(), asset, "Width"); var heightTextBox = CommonControls.TextBox("Height", groupGeneral, asset.Height.ToString(), asset, "Height"); groupGeneral.AdjustHeightFromChildren(); } // AddControls
} // AddControls /// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Cone asset, Window owner, bool assetCreation) { GroupBox groupGeneral = CommonControls.Group("General", owner); var radiusTextBox = CommonControls.TextBox("Radius", groupGeneral, asset.Radius.ToString(), asset, "Radius"); var lengthTextBox = CommonControls.TextBox("Length", groupGeneral, asset.Length.ToString(), asset, "Length"); var slicesTextBox = CommonControls.TextBox("Slices", groupGeneral, asset.Slices.ToString(), asset, "Slices"); groupGeneral.AdjustHeightFromChildren(); } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(LookupTable asset, Window owner, ComboBox comboBoxResource) { // In asset creation I need to look on the CurrentCreatedAsset property to have the last asset. // I can't use CurrentCreatedAsset in edit mode. // However I can use asset for creation (maybe in a disposed state but don't worry) and edit mode, // and only update the values when I know that CurrentCreatedAsset changes. #region Group Image var groupImage = CommonControls.Group("Image", owner); AssetContentManager userContentManager = AssetContentManager.CurrentContentManager; AssetContentManager.CurrentContentManager = UserInterfaceManager.UserInterfaceContentManager; var imageBoxImage = CommonControls.ImageBox(LookupTable.LookupTableToTexture(asset), groupImage); AssetContentManager.CurrentContentManager = userContentManager; groupImage.AdjustHeightFromChildren(); #endregion #region Group Properties GroupBox groupProperties = CommonControls.Group("Properties", owner); var sizeTextBox = CommonControls.TextBox("Size", groupProperties, asset.Size.ToString()); sizeTextBox.Enabled = false; groupProperties.AdjustHeightFromChildren(); #endregion // If it is asset creation time. if (comboBoxResource != null) { comboBoxResource.ItemIndexChanged += delegate { imageBoxImage.Texture.Dispose(); userContentManager = AssetContentManager.CurrentContentManager; AssetContentManager.CurrentContentManager = UserInterfaceManager.UserInterfaceContentManager; imageBoxImage.Texture = LookupTable.LookupTableToTexture((LookupTable)AssetWindow.CurrentCreatedAsset); AssetContentManager.CurrentContentManager = userContentManager; sizeTextBox.Text = ((LookupTable)AssetWindow.CurrentCreatedAsset).Size.ToString(); }; // If the user creates the asset (press the create button) then update the changeable properties. owner.Closed += delegate { imageBoxImage.Texture.Dispose(); }; } } // AddControls
/// <summary> /// Creates the configuration controls of this asset. /// </summary> public static void AddControls(Texture asset, Window owner, ComboBox comboBoxResource) { // In asset creation I need to look on the CurrentCreatedAsset property to have the last asset. // I can't use CurrentCreatedAsset in edit mode. // However I can use asset for creation (maybe in a disposed state but don't worry) and edit mode, // and only update the values when I know that CurrentCreatedAsset changes. #region Group Image var groupImage = CommonControls.Group("Image", owner); var imageBoxImage = CommonControls.ImageBox(asset, groupImage); groupImage.AdjustHeightFromChildren(); #endregion #region Group Properties GroupBox groupProperties = CommonControls.Group("Properties", owner); var widthTextBox = CommonControls.TextBox("Width", groupProperties, asset.Width.ToString()); widthTextBox.Enabled = false; var heightTextBox = CommonControls.TextBox("Height", groupProperties, asset.Height.ToString()); heightTextBox.Enabled = false; #region Prefered Sampler State var comboBoxPreferredSamplerState = CommonControls.ComboBox("Prefered Sampler State", groupProperties); comboBoxPreferredSamplerState.Items.Add("AnisotropicClamp"); comboBoxPreferredSamplerState.Items.Add("AnisotropicWrap"); comboBoxPreferredSamplerState.Items.Add("LinearClamp"); comboBoxPreferredSamplerState.Items.Add("LinearWrap"); comboBoxPreferredSamplerState.Items.Add("PointClamp"); comboBoxPreferredSamplerState.Items.Add("PointWrap"); comboBoxPreferredSamplerState.ItemIndexChanged += delegate { asset.PreferredSamplerState = GetSamplerState(comboBoxPreferredSamplerState.ItemIndex); }; comboBoxPreferredSamplerState.Draw += delegate { if (comboBoxPreferredSamplerState.ListBoxVisible) return; // Identify current index if (asset.PreferredSamplerState == SamplerState.AnisotropicClamp) comboBoxPreferredSamplerState.ItemIndex = 0; else if (asset.PreferredSamplerState == SamplerState.AnisotropicWrap) comboBoxPreferredSamplerState.ItemIndex = 1; else if (asset.PreferredSamplerState == SamplerState.LinearClamp) comboBoxPreferredSamplerState.ItemIndex = 2; else if (asset.PreferredSamplerState == SamplerState.LinearWrap) comboBoxPreferredSamplerState.ItemIndex = 3; else if (asset.PreferredSamplerState == SamplerState.PointClamp) comboBoxPreferredSamplerState.ItemIndex = 4; else if (asset.PreferredSamplerState == SamplerState.PointWrap) comboBoxPreferredSamplerState.ItemIndex = 5; else { if (customSamplerState == null) { comboBoxPreferredSamplerState.Items.Add("Custom"); customSamplerState = asset.PreferredSamplerState; } comboBoxPreferredSamplerState.ItemIndex = 6; } }; #endregion groupProperties.AdjustHeightFromChildren(); #endregion // If it is asset creation time. if (comboBoxResource != null) { comboBoxResource.ItemIndexChanged += delegate { // Update properties if the resource changes. imageBoxImage.Texture = ((Texture)AssetWindow.CurrentCreatedAsset); widthTextBox.Text = ((Texture)AssetWindow.CurrentCreatedAsset).Width.ToString(); heightTextBox.Text = ((Texture)AssetWindow.CurrentCreatedAsset).Height.ToString(); }; // If the user creates the asset (pressed the create button) then update the changeable properties. owner.Closed += delegate { if (owner.ModalResult != ModalResult.Cancel) ((Texture)AssetWindow.CurrentCreatedAsset).PreferredSamplerState = GetSamplerState(comboBoxPreferredSamplerState.ItemIndex); }; } } // AddControls