private void OnEnable() { if (m_editor != null) { m_editor.Selection.SelectionChanged += OnSelectionChanged; } if (m_terrainTool != null) { m_terrainTool.IsEnabled = true; } UpdateFlags(); m_commandsList.DataBindVisible(); }
private void EndRecordDetailProperties() { IRTE editor = IOC.Resolve <IRTE>(); Terrain terrain = Terrain; int index = m_treeList.SelectedIndex; GameObject prefab = Prefab; float bendFactor = BendFactor; m_treeList.DataBindVisible(); editor.Undo.CreateRecord(record => { TreePrototype selectedTree = terrain.terrainData.treePrototypes[index]; if (selectedTree != null) { selectedTree.prefab = prefab; selectedTree.bendFactor = bendFactor; Refresh(terrain, index, selectedTree); if (m_treeList != null) { m_treeList.Items = terrain.terrainData.treePrototypes; m_treeList.SelectedIndex = index; } } return(true); }, record => { TreePrototype selectedTree = terrain.terrainData.treePrototypes[index]; if (selectedTree != null) { selectedTree.prefab = m_initialPrefab; selectedTree.bendFactor = m_initialBendFactor; Refresh(terrain, index, selectedTree); if (m_treeList != null) { m_treeList.Items = terrain.terrainData.detailPrototypes; m_treeList.SelectedIndex = index; } } return(true); }); }
private void OnProBuilderToolSelectionChanged() { 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; } m_commandsList.DataBindVisible(); }
private void OnSelectionChanged(UnityEngine.Object[] unselectedObjects) { UpdateFlags(); m_commandsList.DataBindVisible(); }
private void UpdateFlagsAndDataBindVisible() { UpdateFlags(); m_commandsList.DataBindVisible(); }
private void EndRecordDetailProperties() { IRTE editor = IOC.Resolve <IRTE>(); Terrain terrain = Terrain; int index = m_detailsList.SelectedIndex; Texture2D detailTexture = DetailTexture; GameObject detail = Detail; DetailRenderMode renderMode = RenderMode; float bendFactor = BendFactor; Color dryColor = DryColor; Color healthyColor = HealthyColor; float maxHeight = MaxHeight; float maxWidth = MaxWidth; float minHeight = MinHeight; float minWidth = MinWidth; float noiseSpread = NoiseSpread; m_detailsList.DataBindVisible(); editor.Undo.CreateRecord(record => { DetailPrototype selectedDetail = terrain.terrainData.detailPrototypes[index]; if (selectedDetail != null) { selectedDetail.prototypeTexture = detailTexture; selectedDetail.prototype = detail; selectedDetail.renderMode = renderMode; selectedDetail.bendFactor = bendFactor; selectedDetail.dryColor = dryColor; selectedDetail.healthyColor = healthyColor; selectedDetail.maxHeight = maxHeight; selectedDetail.maxWidth = maxWidth; selectedDetail.minHeight = minHeight; selectedDetail.minWidth = minWidth; selectedDetail.noiseSpread = noiseSpread; Refresh(terrain, index, selectedDetail); if (m_detailsList != null) { m_detailsList.Items = terrain.terrainData.detailPrototypes.Select(p => new DetailPrototypeWrapper(p)); m_detailsList.SelectedIndex = index; } } return(true); }, record => { DetailPrototype selectedDetail = terrain.terrainData.detailPrototypes[index]; if (selectedDetail != null) { selectedDetail.prototypeTexture = m_initialDetailTexture; selectedDetail.prototype = m_initialDetail; selectedDetail.renderMode = m_initialRenderMode; selectedDetail.bendFactor = m_initialBendFactor; selectedDetail.dryColor = m_initialDryColor; selectedDetail.healthyColor = m_initialHealthyColor; selectedDetail.maxHeight = m_initialMaxHeight; selectedDetail.maxWidth = m_initialMaxWidth; selectedDetail.minHeight = m_initialMinHeight; selectedDetail.minWidth = m_initialMinWidth; selectedDetail.noiseSpread = m_initialNoiseSpread; Refresh(terrain, index, selectedDetail); if (m_detailsList != null) { m_detailsList.Items = terrain.terrainData.detailPrototypes.Select(p => new DetailPrototypeWrapper(p)); m_detailsList.SelectedIndex = index; } } return(true); }); }