protected override void AwakeOverride() { WindowType = RuntimeWindowType.Custom; base.AwakeOverride(); m_wm = IOC.Resolve <IWindowManager>(); m_wm.WindowCreated += OnWindowCreated; m_wm.WindowDestroyed += OnWindowDestroyed; m_proBuilderToolGO = new GameObject("ProBuilderTool"); m_proBuilderToolGO.transform.SetParent(Editor.Root, false); m_proBuilderTool = m_proBuilderToolGO.AddComponent <ProBuilderTool>(); m_proBuilderToolGO.AddComponent <MaterialPaletteManager>(); m_proBuilderTool.ModeChanged += OnProBuilderToolModeChanged; m_proBuilderTool.SelectionChanged += OnProBuilderToolSelectionChanged; CreateToolbar(); m_toolbar.gameObject.SetActive(m_useToolbar); Editor.Undo.Store(); Editor.Selection.SelectionChanged += OnSelectionChanged; m_commandsList.ItemClick += OnItemClick; m_commandsList.ItemDataBinding += OnItemDataBinding; m_commandsList.ItemExpanding += OnItemExpanding; m_commandsList.ItemBeginDrag += OnItemBeginDrag; m_commandsList.ItemDrop += OnItemDrop; m_commandsList.ItemDragEnter += OnItemDragEnter; m_commandsList.ItemDragExit += OnItemDragExit; m_commandsList.ItemEndDrag += OnItemEndDrag; m_commandsList.CanEdit = false; m_commandsList.CanReorder = false; m_commandsList.CanReparent = false; m_commandsList.CanSelectAll = false; m_commandsList.CanUnselectAll = true; m_commandsList.CanRemove = false; }
protected virtual IEnumerator Start() { m_probuilderWindow = GetComponentInParent <RuntimeWindow>(); m_editor = IOC.Resolve <IRTE>(); m_proBuilderTool = IOC.Resolve <IProBuilderTool>(); m_paletteManager = IOC.Resolve <IMaterialPaletteManager>(); m_localization = IOC.Resolve <ILocalization>(); TreeView.ItemDataBinding += OnItemDataBinding; TreeView.ItemDrop += OnItemDrop; TreeView.SelectionChanged += OnSelectionChanged; TreeView.CanEdit = false; TreeView.CanReorder = true; TreeView.CanReparent = false; TreeView.CanSelectAll = false; TreeView.CanUnselectAll = true; TreeView.CanRemove = false; if (m_paletteManager != null) { m_paletteManager.PaletteChanged += OnPaletteChanged; m_paletteManager.MaterialAdded += OnMaterialAdded; m_paletteManager.MaterialCreated += OnMaterialCreated; m_paletteManager.MaterialRemoved += OnMaterialRemoved; yield return(new WaitUntil(() => m_paletteManager.IsReady)); yield return(new WaitWhile(() => m_editor.IsBusy)); if (CreateMaterialButton != null) { CreateMaterialButton.onClick.AddListener(CreateMaterial); } TreeView.Items = m_paletteManager.Palette.Materials; } }
private void OnDestroy() { if (m_useGizmosToggle != null) { m_useGizmosToggle.isOn = false; m_useGizmosToggle.onValueChanged.RemoveListener(OnUseGizmosValueChanged); } Tool = null; if (m_editor != null) { m_editor.Undo.UndoCompleted -= OnUpdateVisualState; m_editor.Undo.RedoCompleted -= OnUpdateVisualState; m_editor.Undo.StateChanged -= OnUpdateVisualState; } if (m_btnGroupFaces != null) { m_btnGroupFaces.onClick.RemoveListener(OnGroupFaces); } if (m_btnUngroupFaces != null) { m_btnUngroupFaces.onClick.RemoveListener(OnUngroupFaces); } if (m_selectFaceGroup != null) { m_selectFaceGroup.onClick.RemoveListener(OnSelectFaceGroup); } if (m_resetUVs != null) { m_resetUVs.onClick.RemoveListener(OnResetUVs); } }
private void OnDestroy() { Tool = null; if (m_btnGroupFaces != null) { m_btnGroupFaces.onClick.RemoveListener(OnGroupFaces); } if (m_btnUngroupFaces != null) { m_btnUngroupFaces.onClick.RemoveListener(OnUngroupFaces); } if (m_selectFaceGroup != null) { m_selectFaceGroup.onClick.RemoveListener(OnSelectFaceGroup); } if (m_resetUVs != null) { m_resetUVs.onClick.RemoveListener(OnResetUVs); } }
protected virtual void Start() { m_tool = IOC.Resolve <IProBuilderTool>(); m_tool.ModeChanged += OnModeChanged; }
private void Awake() { m_tool = IOC.Resolve <IProBuilderTool>(); m_editor = IOC.Resolve <IRTE>(); }
private void OnDestroy() { Tool = null; }
private void Awake() { Tool = IOC.Resolve <IProBuilderTool>(); }
private void Awake() { m_tool = IOC.Resolve <IProBuilderTool>(); m_tool.UVEditingModeChanged += OnUVEditingModeChanged; m_editor = IOC.Resolve <IRuntimeEditor>(); m_editor.Undo.UndoCompleted += OnUpdateVisualState; m_editor.Undo.RedoCompleted += OnUpdateVisualState; m_editor.Undo.StateChanged += OnUpdateVisualState; if (m_useGizmosToggle != null) { m_useGizmosToggle.onValueChanged.AddListener(OnUseGizmosValueChanged); } if (m_fillModeEditor != null) { m_fillModeEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.fill), null, "Fill"); } if (m_anchorEditor != null) { m_anchorEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.anchor), null, "Anchor"); } if (m_offsetEditor != null) { m_offsetEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.offset), null, "Offset"); } if (m_rotationEditor != null) { m_rotationEditor.Min = 0; m_rotationEditor.Max = 360; m_rotationEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.rotation), null, "Rotation"); } if (m_tilingEditor != null) { m_tilingEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.scale), null, "Tiling"); } if (m_worldSpaceEditor != null) { m_worldSpaceEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.useWorldSpace), null, "World Space"); } if (m_flipUEditor != null) { m_flipUEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.flipU), null, "Flip U"); } if (m_flipVEditor != null) { m_flipVEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.flipV), null, "Flip V"); } if (m_swapUVEditor != null) { m_swapUVEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.swapUV), null, "Swap UV"); } if (m_btnGroupFaces != null) { m_btnGroupFaces.onClick.AddListener(OnGroupFaces); } if (m_btnUngroupFaces != null) { m_btnUngroupFaces.onClick.AddListener(OnUngroupFaces); } if (m_selectFaceGroup != null) { m_selectFaceGroup.onClick.AddListener(OnSelectFaceGroup); } if (m_resetUVs != null) { m_resetUVs.onClick.AddListener(OnResetUVs); } OnUpdateVisualState(); }
private void Awake() { Tool = IOC.Resolve <IProBuilderTool>(); m_editor = IOC.Resolve <IRuntimeEditor>(); m_localization = IOC.Resolve <ILocalization>(); if (m_fillModeEditor != null) { m_fillModeEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.fill), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_Fill", "Fill")); } if (m_anchorEditor != null) { m_anchorEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.anchor), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_Anchor", "Anchor")); } if (m_offsetEditor != null) { m_offsetEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.offset), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_Offset", "Offset")); } if (m_rotationEditor != null) { m_rotationEditor.Min = 0; m_rotationEditor.Max = 360; m_rotationEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.rotation), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_Rotation", "Rotation")); } if (m_tilingEditor != null) { m_tilingEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.scale), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_Tiling", "Tiling")); } if (m_worldSpaceEditor != null) { m_worldSpaceEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.useWorldSpace), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_WorldSpace", "World Space")); } if (m_flipUEditor != null) { m_flipUEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.flipU), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_FlipU", "Flip U")); } if (m_flipVEditor != null) { m_flipVEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.flipV), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_FlipV", "Flip V")); } if (m_swapUVEditor != null) { m_swapUVEditor.Init(m_tool.UV, m_tool.UV, Strong.PropertyInfo((PBAutoUnwrapSettings x) => x.swapUV), null, m_localization.GetString("ID_RTBuilder_UVEditorAuto_SwapUV", "Swap UV")); } if (m_btnGroupFaces != null) { m_btnGroupFaces.onClick.AddListener(OnGroupFaces); } if (m_btnUngroupFaces != null) { m_btnUngroupFaces.onClick.AddListener(OnUngroupFaces); } if (m_selectFaceGroup != null) { m_selectFaceGroup.onClick.AddListener(OnSelectFaceGroup); } if (m_resetUVs != null) { m_resetUVs.onClick.AddListener(OnResetUVs); } }