void on_visible_clicked(PanelRow row) { bool set_visible = !SceneUtil.IsVisible(row.SO); SceneUtil.SetVisible(row.SO, set_visible); row.visibleButton.image.sprite = (set_visible) ? visible_on : visible_off; }
public void Update() { if (initialized == false && CC.ActiveScene != null) { CC.ActiveScene.SelectionChangedEvent += ActiveScene_SelectionChangedEvent; CC.ActiveScene.ChangedEvent += ActiveScene_ChangedEvent; initialized = true; List <PrintMeshSO> initial = CC.ActiveScene.FindSceneObjectsOfType <PrintMeshSO>(); foreach (var so in initial) { PanelRow newRow = add_new_row(so as PrintMeshSO); SORows.Add(so, newRow); } update_selection(); } foreach (var so in pending_updates) { if (SORows.ContainsKey(so)) { update_row(so); } } pending_updates.Clear(); }
void update_object_name(string s, object target) { if (string.IsNullOrEmpty(s) == false) { PanelRow row = target as PanelRow; row.SO.Name = s; row.label.text = row.SO.Name; } }
private void update_row(SceneObject so) { PanelRow row = SORows[so]; if (row.label.text != so.Name) { row.label.text = so.Name; } // how to know visibliity state? //bool visible = SceneUtil.IsVisible(so); }
private void ReLayoutWhenNeeded() { foreach (TablePanelRow PanelRow in this.columnsWidthsPerRow.Keys.ToArray()) { PanelRow.CheckMargin(); } foreach (TablePanelRow PanelRow in this.rowsToLayout.ToArray()) //to array is used to read out the complete enumeration. it is modified during layout { PanelRow.NotifyLayoutNeeded(); } this.rowsToLayout.Clear(); }
void on_row_single_clicked(PanelRow row) { bool is_selected = CC.ActiveScene.IsSelected(row.SO); if (is_selected && click_ctrl_down) { CC.ActiveScene.Deselect(row.SO); } else { bool bAdd = click_ctrl_down || click_shift_down; CC.ActiveScene.Select(row.SO, bAdd == false); } }
void on_row_clicked(PanelRow row) { bool bShiftDown = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); bool bCtrlDown = Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); click_shift_down = bShiftDown; click_ctrl_down = bCtrlDown; on_row_single_clicked(row); //if (click_count == 0) { // click_shift_down = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift); // StartCoroutine(ClickOrDoubleClick(row, on_row_single_clicked, on_row_double_clicked)); //} //click_count++; }
private PanelRow add_new_row(PrintMeshSO so) { PanelRow row = new PanelRow(); row.SO = so; row.panel = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("SceneBrowserPrintSOPanel")); this.gameObject.AddChild(row.panel, false); row.label = UnityUIUtil.FindText(row.panel, "SONameLabel"); row.label.text = so.Name; row.rowButton = UnityUIUtil.FindButtonAndAddClickHandler(row.panel, "RowButton", () => { on_row_clicked(row); }); row.rowButton.image.color = defaultRowColor; row.visibleButton = UnityUIUtil.FindButtonAndAddClickHandler(row.panel, "VisibleButton", () => { on_visible_clicked(row); }); return(row); }
private void ActiveScene_ChangedEvent(object sender, SceneObject so, SceneChangeType type) { if (so is PrintMeshSO == false) { return; } if (type == SceneChangeType.Added) { PanelRow newRow = add_new_row(so as PrintMeshSO); SORows.Add(so, newRow); pending_updates.Add(so); // in case name changes after this event posts } else if (type == SceneChangeType.Removed) { PanelRow row; if (SORows.TryGetValue(so, out row)) { GameObject.Destroy(row.panel); SORows.Remove(so); } } }
void on_row_double_clicked(PanelRow row) { CotangentUI.GetStringFromDialog("Rename", "Enter the new object name", row, (s) => { return(!string.IsNullOrEmpty(s)); }, update_object_name, null); }