Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Move camera to object #709

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions addons/editor/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ PREP(addGroupIcons);
PREP(addModIcons);
PREP(declutterEmptyTree);
PREP(fixSideButtons);
PREP(handleCuratorMoveCamTo);
PREP(handleKeyDown);
PREP(handleLoad);
PREP(handleModeButtons);
Expand Down
1 change: 1 addition & 0 deletions addons/editor/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
["zen_curatorDisplayLoaded", LINKFUNC(handleLoad)] call CBA_fnc_addEventHandler;
["zen_curatorDisplayUnloaded", LINKFUNC(handleUnload)] call CBA_fnc_addEventHandler;
[QGVAR(modeChanged), LINKFUNC(fixSideButtons)] call CBA_fnc_addEventHandler;
addUserActionEventHandler ["curatorMoveCamTo", "Deactivate", LINKFUNC(handleCuratorMoveCamTo)];
31 changes: 31 additions & 0 deletions addons/editor/functions/fnc_handleCuratorMoveCamTo.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "script_component.hpp"
/*
* Author: Ampersand
* Handles the behaviour of the curatorMoveCamTo user action.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call zen_editor_fnc_handleCuratorMoveCamTo
*
* Public: No
*/

private _selectedObjects = curatorSelected select 0;
mharis001 marked this conversation as resolved.
Show resolved Hide resolved
if (count _selectedObjects == 0) exitWith {};

private _selectedObject = _selectedObjects select 0;
if (isNil QGVAR(curatorMovedCamTo) || {_selectedObject != GVAR(curatorMovedCamTo)}) exitWith {
GVAR(curatorMovedCamTo) = _selectedObject;
};

// Second activation of curatorMoveCamTo on same object
(0 boundingBoxReal GVAR(curatorMovedCamTo)) params ["_p1", "_p2"];
// Move camera to top-rear of object bounding box for CQB view
mharis001 marked this conversation as resolved.
Show resolved Hide resolved
curatorCamera setPosASL (GVAR(curatorMovedCamTo) modelToWorldVisualWorld [0, _p1 select 1, _p2 select 2]);
curatorCamera setDir getDir GVAR(curatorMovedCamTo);
GVAR(curatorMovedCamTo) = nil;