예제 #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");
            }
        }
        private void Awake()
        {
            m_terrainEditor = GetComponentInParent <TerrainEditor>();
            m_editor        = IOC.Resolve <IRTE>();
            m_editor.Selection.SelectionChanged     += OnEditorSelectionChanged;
            m_terrainCutoutRenderer                  = IOC.Resolve <ITerrainCutoutMaskRenderer>();
            m_terrainCutoutRenderer.ObjectImageLayer = m_editor.CameraLayerSettings.ResourcePreviewLayer;

            m_source = FindObjectOfType <TerrainBrushSource>();
            if (m_source == null)
            {
                m_source = new GameObject("TerrainBrushSource").AddComponent <TerrainBrushSource>();
            }

            if (m_brushesList != null)
            {
                m_brushesList.SelectionChanged += OnBrushesSelectionChanged;
                m_brushesList.ItemDataBinding  += OnBrushesDataBinding;
                m_brushesList.CanDrag           = false;
                m_brushesList.CanEdit           = false;
                m_brushesList.CanRemove         = false;
                m_brushesList.CanReorder        = false;
                m_brushesList.CanReparent       = false;
                m_brushesList.CanSelectAll      = false;
                m_brushesList.CanUnselectAll    = false;
            }

            if (m_brushSizeEditor != null)
            {
                BrushSize = 2.5f;

                m_brushSizeEditor.Min = 0.5f;
                m_brushSizeEditor.Max = 40;
                m_brushSizeEditor.Init(this, this, Strong.MemberInfo((TerrainBrushEditor x) => x.BrushSize));
            }

            if (m_opacityEditor != null)
            {
                BrushOpacity = 100;

                m_opacityEditor.Min = 0;
                m_opacityEditor.Max = 100;
                m_opacityEditor.Init(this, this, Strong.MemberInfo((TerrainBrushEditor x) => x.BrushOpacity));
            }

            if (m_createButton != null)
            {
                m_createButton.onClick.AddListener(OnCreateButtonClick);
            }

            if (m_addButton != null)
            {
                m_addButton.onClick.AddListener(OnAddButtonClick);
            }

            if (m_deleteButton != null)
            {
                m_deleteButton.onClick.AddListener(OnDeleteButtonClick);
            }
        }
예제 #3
0
 protected override void OnTerrainChanged()
 {
     base.OnTerrainChanged();
     if (m_heightEditor != null && TerrainEditor.Terrain != null && TerrainEditor.Terrain.terrainData != null)
     {
         m_heightEditor.Min = 0;
         m_heightEditor.Max = TerrainEditor.Terrain.terrainData.size.y;
         m_height           = m_heightEditor.Max / 3;
         m_heightEditor.Init(this, this, Strong.PropertyInfo((TerrainStampEditor x) => x.Height), null, m_localization.GetString("ID_RTTerrain_TerrainStampEditor_Height", "Height"));
     }
 }
예제 #4
0
 protected override void OnTerrainChanged()
 {
     base.OnTerrainChanged();
     if (m_heightEditor != null && TerrainEditor.Terrain != null && TerrainEditor.Terrain.terrainData != null)
     {
         m_heightEditor.Min = 0;
         m_heightEditor.Max = TerrainEditor.Terrain.terrainData.size.y;
         m_height           = m_heightEditor.Max / 3;
         m_heightEditor.Init(this, this, Strong.PropertyInfo((TerrainStampEditor x) => x.Height));
     }
 }
        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);
            }
        }
예제 #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);
            }
        }