#pragma once /* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #pragma once namespace AzToolsFramework { /** * This bus can be used to send commands to the editor. */ class EditorLayerPythonRequests : public AZ::ComponentBus { public: /* * Gets a CVar value as a string. */ virtual const char* GetCVar(const char* pName) = 0; /* * Sets a CVar value from any simple value. */ virtual void SetCVar(const char* pName, const AZStd::any& value) = 0; /* * Sets a CVar value from a string. */ virtual void SetCVarFromString(const char* pName, const char* pValue) = 0; /* * Sets a CVar value from an integer. */ virtual void SetCVarFromInteger(const char* pName, int pValue) = 0; /* * Sets a CVar value from a float. */ virtual void SetCVarFromFloat(const char* pName, float pValue) = 0; /* * Runs a console command. */ virtual void PyRunConsole(const char* text) = 0; /* * Enters the editor game mode. */ virtual void EnterGameMode() = 0; /* * Queries if it's in the game mode or not. */ virtual bool IsInGameMode() = 0; /* * Exits the editor game mode. */ virtual void ExitGameMode() = 0; /* * Enters the editor AI/Physics simulation mode. */ virtual void EnterSimulationMode() = 0; /* * Queries if the editor is currently in the AI/Physics simulation mode or not. */ virtual bool IsInSimulationMode() = 0; /* * Exits the editor AI/Physics simulation mode. */ virtual void ExitSimulationMode() = 0; /* * Runs a lua script. */ virtual void RunLua(const char* text) = 0; /* * Runs a script file. A relative path from the editor user folder or an absolute path should be given as an argument. */ virtual void RunFile(const char* pFile) = 0; /* * Runs a script file with parameters. A relative path from the editor user folder or an absolute path should be given as an argument. The arguments should be separated by whitespace. */ virtual void RunFileParameters(const char* pFile, const char* pArguments) = 0; /* * Executes a given string as an editor command. */ virtual void ExecuteCommand(const char* cmdline) = 0; /* * Shows a confirmation message box with ok|cancel and shows a custom message. */ virtual bool MessageBoxOkCancel(const char* pMessage) = 0; /* * Shows a confirmation message box with yes|no and shows a custom message. */ virtual bool MessageBoxYesNo(const char* pMessage) = 0; /* * Shows a confirmation message box with only ok and shows a custom message. */ virtual bool MessageBoxOk(const char* pMessage) = 0; /* * Shows an edit box and returns the value as string. */ virtual AZStd::string EditBox(AZStd::string_view pTitle) = 0; /* * Shows an edit box and checks the custom value to use the return value with other functions correctly. */ virtual AZStd::any EditBoxCheckDataType(const char* pTitle) = 0; /* * Shows an open file box and returns the selected file path and name. */ virtual AZStd::string OpenFileBox() = 0; /* * Gets axis. */ virtual const char* GetAxisConstraint() = 0; /* * Sets axis. */ virtual void SetAxisConstraint(AZStd::string_view pConstrain) = 0; /* * Gets edit mode. */ virtual const char* GetEditMode() = 0; /* * Sets edit mode. */ virtual void SetEditMode(AZStd::string_view pEditMode) = 0; /* * Finds a pak file name for a given file. */ virtual const char* GetPakFromFile(const char* filename) = 0; /* * Prints the message to the editor console window. */ virtual void Log(const char* pMessage) = 0; /* * Undoes the last operation. */ virtual void Undo() = 0; /* * Redoes the last undone operation. */ virtual void Redo() = 0; /* * Shows a 2d label on the screen at the given position and given color. */ virtual void DrawLabel(int x, int y, float size, float r, float g, float b, float a, const char* pLabel) = 0; /* * Shows a combo box listing each value passed in, returns string value selected by the user. */ virtual AZStd::string ComboBox(AZStd::string title, AZStd::vector values, int selectedIdx = 0) = 0; /* * Sets the current hidemask to 'all'. */ virtual void SetHidemaskAll() = 0; /* * Sets the current hidemask to 'none'. */ virtual void SetHidemaskNone() = 0; /* * Inverts the current hidemask. */ virtual void SetHidemaskInvert() = 0; /* * Assigns a specified value to a specific object type in the current hidemask. */ virtual void SetHidemask(const char* pName, bool bAdd) = 0; /* * Gets the value of a specific object type in the current hidemask. */ virtual bool GetHidemask(const char* pName) = 0; }; using EditorLayerPythonRequestBus = AZ::EBus; }