haxis/Plugins/SkillTree/Source/SkillTreeEditor/Private/SkillTreeEditorViewportClie...

79 lines
2.4 KiB
C++

// Project Lab - NHTV IGAD
//////////////////////////////////////////
// Author: Yoshi van Belkom - 130118
//////////////////////////////////////////
// The Skill Tree Editor main viewport.
// Can be used for editing a Skill Tree
// and a Skill.
//////////////////////////////////////////
#pragma once
#include "SkillTreeEditorViewport.h"
#include "SceneViewport.h"
#include "AssetEditorModeManager.h"
#include "PreviewScene.h"
#include "ScopedTransaction.h"
#include "AssetData.h"
#include "SkillTreeObject.h"
class FSkillTreeEditorViewportClient : public FEditorViewportClient
{
public:
FSkillTreeEditorViewportClient( TWeakPtr<FSkillTreeEditorViewport> a_skillTreeEditor, TWeakPtr<class SEditorViewport> a_skillTreeEditorViewportPtr );
// FViewportClient interface
virtual void Draw( const FSceneView* a_view, FPrimitiveDrawInterface* a_drawInterface ) override;
virtual void DrawCanvas( FViewport& a_viewport, FSceneView& a_view, FCanvas& a_canvas ) override;
virtual void Tick( float a_deltaSeconds ) override;
// End of FViewportClient interface
// FEditorViewportClient interface
virtual void ProcessClick( FSceneView& a_view, HHitProxy* a_hitProxy, FKey a_key, EInputEvent a_event, uint32 a_hitX, uint32 a_hitY ) override;
virtual void MouseMove( FViewport* a_viewport, int32 a_mouseX, int32 a_mouseY ) override;
virtual FLinearColor GetBackgroundColor() const override;
// End of FEditorViewportClient interface
//virtual void RequestFocusOnSelection( bool a_instant );
void EnterViewMode() { InternalActivateNewMode( ); }
bool IsInViewMode() const { return true; }
void UpdateRelatedSpritesList();
void ActivateEditMode();
// Set the current state of the Viewport.
void IsSkill( bool a_state )
{
m_state = a_state;
}
private:
// The ID of the current hovered Skill.
int32 m_hoverY = -1;
// The current state of the Viewport.
// True = Skill
// False = Skill Tree
bool m_state = false;
// The Viewport screen size.
FIntPoint m_screenSize;
// The preview scene.
FPreviewScene m_ownedPreviewScene;
// Skill Tree Editor that owns this viewport.
TWeakPtr<FSkillTreeEditorViewport> m_skillTreeEditorPtr;
// Pointer back to the Skill Tree viewport control that owns this.
TWeakPtr<class SEditorViewport> m_skillTreeEditorViewportPtr;
// The radius of the Hexagons.
float m_hexSize = 20;
void InternalActivateNewMode();
};