Skip to content

Commit

Permalink
renamed fnc
Browse files Browse the repository at this point in the history
  • Loading branch information
ampersand38 committed Feb 17, 2023
1 parent a37a33d commit dd35e08
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 42 deletions.
2 changes: 1 addition & 1 deletion addons/editor/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ PREP(addGroupIcons);
PREP(addModIcons);
PREP(declutterEmptyTree);
PREP(fixSideButtons);
PREP(handleCuratorMoveCamTo);
PREP(handleKeyDown);
PREP(handleLoad);
PREP(handleModeButtons);
Expand All @@ -14,3 +13,4 @@ PREP(handleSearchKeyUp);
PREP(handleSideButtons);
PREP(handleTreeButtons);
PREP(handleUnload);
PREP(moveCamToSelection);
41 changes: 0 additions & 41 deletions addons/editor/functions/fnc_handleCuratorMoveCamTo.sqf

This file was deleted.

53 changes: 53 additions & 0 deletions addons/editor/functions/fnc_moveCamToSelection.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include "script_component.hpp"
/*
* Author: Ampersand
* Moves the curator camera to the selected object.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call zen_editor_fnc_moveCamToSelection
*
* Public: No
*/

#define FOCUS_ALT 1
#define FOCUS_CQB 2
#define FOCUS_ALTCQB 3

private _selectedObjects = SELECTED_OBJECTS;
if (count _selectedObjects == 0) exitWith {};

private _selectedObject = _selectedObjects select 0;
private _objectPos = getPosWorld _selectedObject;
private _objectDir = getDir _selectedObject;
((0 boundingBoxReal _selectedObject) select 1) params ["", "_y", "_z"];

private _minDistance = switch (GVAR(moveCamToSelection)) do {
case (FOCUS_ALT): {
20
};
case (FOCUS_CQB): {
0.5
};
case (FOCUS_ALTCQB): {
// Toggle between far and close views on subsequent activations with the same object selected
if (isNil QGVAR(curatorMovedCamTo) || {_selectedObject != GVAR(curatorMovedCamTo)}) then {
GVAR(curatorMovedCamTo) = _selectedObject;
20
} else {
GVAR(curatorMovedCamTo) = nil;
0.5
}
};
};

private _curatorPos = _objectPos getPos [_minDistance max _y, _objectDir + 180];
_curatorPos set [2, (_objectPos select 2) + (_minDistance max _z)];
curatorCamera setPosASL _curatorPos;
curatorCamera setDir _objectDir;
curatorCamera setVectorUp (vectorDir curatorCamera vectorAdd [0, 0, 1 + 1 / _minDistance]);

0 comments on commit dd35e08

Please sign in to comment.