コード例 #1
0
        private void Awake()
        {
            m_tool   = IOC.Resolve <IProBuilderTool>();
            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");
            }
        }
コード例 #2
0
        private void Awake()
        {
            m_editorsMap = IOC.Resolve <IEditorsMap>();
            m_editor     = IOC.Resolve <IRuntimeEditor>();
            m_editor.Object.ComponentAdded += OnComponentAdded;

            GameObject[] selectedObjects = m_editor.Selection.gameObjects;
            foreach (GameObject go in m_editor.Selection.gameObjects)
            {
                ExposeToEditor exposeToEditor = go.GetComponent <ExposeToEditor>();
                if (exposeToEditor.GetType().Name == typeof(MyExposeToEditor).Name)
                {
                    MyExposeToEditor myExposeToEditor = (MyExposeToEditor)exposeToEditor;
                    if (myExposeToEditor.CanRename)
                    {
                        Header.SetActive(true);
                    }
                    else
                    {
                        Header.SetActive(false);
                    }
                }
            }
            InputName.text = GetObjectName(selectedObjects);
            InputName.onEndEdit.AddListener(OnEndEditName);

            m_selectedGameObjects = m_editor.Selection.gameObjects.Select(go => new GameObjectWrapper(go)).ToArray();
            IsActiveEditor.Init(m_selectedGameObjects, Strong.PropertyInfo((GameObjectWrapper x) => x.IsActive), string.Empty);


            m_editor.IsBusy = true;
            LayersEditor.LoadLayers(layersInfo =>
            {
                m_editor.IsBusy = false;
                List <RangeOptions.Option> layers = new List <RangeOptions.Option>();

                foreach (LayersInfo.Layer layer in layersInfo.Layers)
                {
                    if (!string.IsNullOrEmpty(layer.Name))
                    {
                        layers.Add(new RangeOptions.Option(string.Format("{0}: {1}", layer.Index, layer.Name), layer.Index));
                    }
                }

                LayerEditor.Options = layers.ToArray();
                LayerEditor.Init(m_editor.Selection.gameObjects, Strong.PropertyInfo((GameObject x) => x.layer), string.Empty);

                List <List <Component> > groups = GetComponentGroups(selectedObjects);
                for (int i = 0; i < groups.Count; ++i)
                {
                    List <Component> group = groups[i];
                    CreateComponentEditor(group);
                }

                UnityEventHelper.AddListener(EditLayersButton, btn => btn.onClick, OnEditLayersClick);
            });
        }
コード例 #3
0
        protected override void Awake()
        {
            base.Awake();

            ILocalization lc = IOC.Resolve <ILocalization>();

            m_lockWidthToHeightEditor.Init(this, this, Strong.PropertyInfo((TerrainPaintTreesEditor x) => x.LockWidthToHeight), null, lc.GetString("ID_RTTerrain_TerrainPaintTreesEditor_LockWidthToHeight", "Lock Width to Height"), null, null, null, false);
            m_minHeightEditor.Init(this, this, Strong.PropertyInfo((TerrainPaintTreesEditor x) => x.MinHeight), null, lc.GetString("ID_RTTerrain_TerrainPaintTreesEditor_MinTreeHeight", "Min Tree Height"), null, null, null, false);
            m_maxHeightEditor.Init(this, this, Strong.PropertyInfo((TerrainPaintTreesEditor x) => x.MaxHeight), null, lc.GetString("ID_RTTerrain_TerrainPaintTreesEditor_MaxTreeHeight", "Max Tree Height"), null, null, null, false);
            m_minWidthEditor.Init(this, this, Strong.PropertyInfo((TerrainPaintTreesEditor x) => x.MinWidth), null, lc.GetString("ID_RTTerrain_TerrainPaintTreesEditor_MinTreeWidth", "Min Tree Width"), null, null, null, false);
            m_maxWidthEditor.Init(this, this, Strong.PropertyInfo((TerrainPaintTreesEditor x) => x.MaxWidth), null, lc.GetString("ID_RTTerrain_TerrainPaintTreesEditor_MaxTreeWidth", "Max Tree Width"), null, null, null, false);
        }
コード例 #4
0
        private void Awake()
        {
            m_editor = IOC.Resolve <IRuntimeEditor>();

            m_terrainEditor = GetComponentInParent <TerrainEditor>();
            m_terrainEditor.TerrainChanged += OnTerrainChanged;

            m_terrainTool = IOC.Resolve <ITerrainTool>();

            m_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;

            if (m_xSpacingEditor != null)
            {
                m_xSpacingEditor.Min = 5;
                m_xSpacingEditor.Max = 40;
                m_xSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainTool x) => x.XSpacing), null, "X Space");
            }

            if (m_zSpacingEditor != null)
            {
                m_zSpacingEditor.Min = 5;
                m_zSpacingEditor.Max = 40;
                m_zSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainTool x) => x.ZSpacing), null, "Z Space");
            }

            if (m_zTestEditor != null)
            {
                m_zTestEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainTool x) => x.EnableZTest), null, "Z Test");
            }

            if (m_handlesToggle != null)
            {
                m_handlesToggle.onValueChanged.AddListener(OnHandlesToggleValueChanged);
            }
        }
コード例 #5
0
        protected override void AwakeOverride()
        {
            WindowType = RuntimeWindowType.Custom;
            base.AwakeOverride();

            m_localization = IOC.Resolve <ILocalization>();

            m_tool                   = IOC.Resolve <IMeshDeformerTool>();
            m_tool.ModeChanged      += OnModeChanged;
            m_tool.SelectionChanged += OnSelectionChanged;

            m_runtimeEditor = IOC.Resolve <IRuntimeEditor>();
            m_runtimeEditor.SceneLoading += OnSceneLoading;
            m_runtimeEditor.SceneLoaded  += OnSceneLoaded;
            m_runtimeEditor.Selection.SelectionChanged += OnEditorSelectionChanged;
            m_runtimeEditor.Undo.UndoCompleted         += OnEditorUndo;
            m_runtimeEditor.Undo.RedoCompleted         += OnEditorRedo;
            m_runtimeEditor.Undo.StateChanged          += OnEditorUndoStateChanged;

            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;

            UnityEventHelper.AddListener(m_toggleObject, o => o.onValueChanged, OnObjectMode);
            UnityEventHelper.AddListener(m_toggleControlPoints, o => o.onValueChanged, OnControlPointMode);
            UnityEventHelper.AddListener(m_toggleSettings, o => o.onValueChanged, OnSettings);

            m_showTerminalPointsEditor.Init(m_tool, Strong.PropertyInfo((IMeshDeformerTool x) => x.ShowTerminalPoints), m_localization.GetString("ID_RTDeformer_View_ShowTerminalPoints"));

            m_showOriginalMeshEditor.Init(m_tool, Strong.PropertyInfo((IMeshDeformerTool x) => x.ShowOriginal), m_localization.GetString("ID_RTDeformer_View_ShowOriginal"));

            m_pointsPerSegmentEditor.Min = 0;
            m_pointsPerSegmentEditor.Max = 10;
            m_pointsPerSegmentEditor.Init(m_tool, Strong.PropertyInfo((IMeshDeformerTool x) => x.PointsPerSegment), m_localization.GetString("ID_RTDeformer_View_PointsPerSegment"));
        }
コード例 #6
0
        private void Awake()
        {
            m_editor = IOC.Resolve <IRuntimeEditor>();

            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;

            m_localization    = IOC.Resolve <ILocalization>();
            m_terrainTool     = IOC.Resolve <ITerrainSelectionHandlesTool>();
            m_customSelection = IOC.Resolve <ICustomSelectionComponent>();
            m_customSelection.Selection.SelectionChanged += OnTerrainToolSelectionChanged;

            if (m_xSpacingEditor != null)
            {
                m_xSpacingEditor.Min = 5;
                m_xSpacingEditor.Max = 40;
                m_xSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainSelectionHandlesTool x) => x.XSpacing), null, m_localization.GetString("ID_RTTerrain_SelectionHandles_XSpacing", "X Space"), null, null, () => m_terrainTool.Refresh(), false);
            }

            if (m_zSpacingEditor != null)
            {
                m_zSpacingEditor.Min = 5;
                m_zSpacingEditor.Max = 40;
                m_zSpacingEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainSelectionHandlesTool x) => x.ZSpacing), null, m_localization.GetString("ID_RTTerrain_SelectionHandles_ZSpacing", "Z Space"), null, null, () => m_terrainTool.Refresh(), false);
            }

            if (m_zTestEditor != null)
            {
                m_zTestEditor.Init(m_terrainTool, m_terrainTool, Strong.PropertyInfo((ITerrainSelectionHandlesTool x) => x.EnableZTest), null, m_localization.GetString("ID_RTTerrain_SelectionHandles_ZTest", "Z Test"));
            }
        }
コード例 #7
0
        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);
            }
        }