public void OnComponentAdded(Component component) { if (component == null) { return; } Type type = component.GetType(); for (int i = 0; i < m_props.Count; ++i) { RuntimeAnimationProperty property = m_props[i]; if (property.ComponentType == type && property.ComponentIsNull) { ResolveComponent(property, Target); //property.Component = component; m_propertiesTreeView.DataBindItem(property); if (property.Children != null) { foreach (RuntimeAnimationProperty childProperty in property.Children) { childProperty.Component = property.Component; m_propertiesTreeView.DataBindItem(childProperty); } } } } }
private void OnTextureSelected(Texture2D texture, bool create) { TerrainLayer layer; if (create) { layer = new TerrainLayer() { name = "TerrainLayer" }; layer.diffuseTexture = texture; List <TerrainLayer> layers = TerrainData.terrainLayers.ToList(); layers.Add(layer); TerrainData.terrainLayers = layers.ToArray(); m_layersList.Add(layer); } else { layer = (TerrainLayer)m_layersList.SelectedItem; layer.diffuseTexture = texture; m_layersList.DataBindItem(layer); } }
public void UpdateProjectItem(ProjectItem item) { VirtualizingItemContainer itemContainer = m_treeView.GetItemContainer(item); if (itemContainer != null) { m_treeView.DataBindItem(item, itemContainer); } }
public void UpdateProjectItem(ProjectItem projectItem) { VirtualizingTreeViewItem treeViewItem = m_treeView.GetTreeViewItem(projectItem); if (treeViewItem != null) { m_treeView.DataBindItem(projectItem, treeViewItem); } }
public void UpdateProjectItem(ProjectItem projectItem) { VirtualizingTreeViewItem treeViewItem = m_treeView.GetTreeViewItem(projectItem); ItemContainerData containerData = m_treeView.GetItemContainerData(projectItem); if (treeViewItem != null && containerData != null) { m_treeView.DataBindItem(projectItem, containerData, treeViewItem); } }
public virtual void InsertItems(ProjectItem[] items, bool selectAndScrollIntoView) { if (m_folders == null) { return; } items = items.Where(item => m_folders.Contains(item.Parent) && CanDisplayItem(item)).ToArray(); if (items.Length == 0) { return; } m_items = m_items.Union(items).ToList(); List <ProjectItem> sorted = m_items.Where(item => item.IsFolder).OrderBy(item => item.Name).Union(m_items.Where(item => !item.IsFolder).OrderBy(item => item.Name)).ToList(); ProjectItem selectItem = null; for (int i = 0; i < sorted.Count; ++i) { if (items.Contains(sorted[i])) { m_listBox.Insert(i, sorted[i]); selectItem = sorted[i]; } else { VirtualizingItemContainer itemContainer = m_listBox.GetItemContainer(sorted[i]); if (itemContainer != null) { m_listBox.DataBindItem(sorted[i], itemContainer); } } if (!m_idToItem.ContainsKey(sorted[i].ItemID)) { m_idToItem.Add(sorted[i].ItemID, sorted[i]); } } m_items = sorted; if (selectItem != null) { if (selectAndScrollIntoView) { m_listBox.SelectedItem = selectItem; m_listBox.ScrollIntoView(selectItem); } } }
private void OnTextureSelected(Texture2D texture, bool create) { float[,,] oldAlphamaps = GetAlphamaps(); TerrainLayer[] oldLayers = TerrainData.terrainLayers.ToArray(); TerrainLayer layer; if (create) { layer = new TerrainLayer() { name = "TerrainLayer" }; layer.diffuseTexture = texture; List <TerrainLayer> layers = TerrainData.terrainLayers.ToList(); layers.Add(layer); TerrainData.terrainLayers = layers.ToArray(); m_layersList.Add(layer); if (layers.Count == 1) { float[,,] alphaMaps = TerrainData.GetAlphamaps(0, 0, TerrainData.alphamapWidth, TerrainData.alphamapHeight); int amapY = alphaMaps.GetLength(0); int amapX = alphaMaps.GetLength(1); for (int y = 0; y < amapY; y++) { for (int x = 0; x < amapX; x++) { alphaMaps[y, x, 0] = 1; } } TerrainData.SetAlphamaps(0, 0, alphaMaps); } } else { layer = (TerrainLayer)m_layersList.SelectedItem; layer.diffuseTexture = texture; m_layersList.DataBindItem(layer); } RecordState(oldAlphamaps, oldLayers); }
private void OnSelectionChanged(UnityEngine.Object[] unselectedObjects) { GameObject[] selected = Editor.Selection.gameObjects; if (selected != null && selected.Length > 0) { m_isProBuilderMeshSelected = selected.Where(go => go.GetComponent <PBMesh>() != null).Any(); m_isNonProBuilderMeshSelected = selected.Where(go => go.GetComponent <PBMesh>() == null).Any(); } else { m_isProBuilderMeshSelected = false; m_isNonProBuilderMeshSelected = false; } int index = m_commandsList.VisibleItemIndex; int count = m_commandsList.VisibleItemsCount; for (int i = 0; i < count; ++i) { m_commandsList.DataBindItem(m_commands[i]); } }