17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 06:19:19 +02:00
Files
maszyna/scene/sceneeditor.h
jerrrrycho b6186ced21 refactor(sonar): assorted small fixes
- empty() instead of size() comparisons (cpp:S1155)
- member initialisers in declaration order (cpp:S3229)
- no redundant c_str() when a std::string is accepted (cpp:S7121)
- contains() on associative containers (cpp:S6171)
- const reference instead of a copying range-for (cpp:S6032)
- starts_with() for prefix checks (cpp:S6178)
- no std::move on temporaries (cpp:S5274)
- has_value() on std::optional (cpp:S7172)
- bool literals for bool members (cpp:S5820)
- inline only on the definition (cpp:S3548)
- explicit base access specifier (cpp:S5965)
- explicit element access instead of dereferencing an array (cpp:S7116)
- rely on the C++20 rewritten operator!= (cpp:S6186)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 17:50:12 +02:00

64 lines
1.8 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "scene/scenenode.h"
namespace scene {
// TODO: move the snapshot to history stack
struct node_snapshot {
scene::basic_node *node;
std::string data;
explicit node_snapshot( scene::basic_node *Node ) :
node( Node ) {
if( Node != nullptr ) {
Node->export_as_text( data ); } };
};
inline bool operator==( node_snapshot const &Left, node_snapshot const &Right ) { return Left.node == Right.node && Left.data == Right.data; }
class basic_editor {
public:
// methods
void
translate( scene::basic_node *Node, glm::dvec3 const &Location, bool const Snaptoground );
void
translate( scene::basic_node *Node, float const Offset );
void
rotate( scene::basic_node *Node, glm::vec3 const &Angle, float const Quantization );
private:
// methods
void
translate_node( scene::basic_node *Node, glm::dvec3 const &Location );
void
translate_node( scene::basic_node *Node, float const Offset );
void
translate_instance( TAnimModel *Instance, glm::dvec3 const &Location ) const;
void
translate_instance( TAnimModel *Instance, float const Offset ) const;
void
translate_memorycell( TMemCell *Memorycell, glm::dvec3 const &Location ) const;
void
translate_memorycell( TMemCell *Memorycell, float const Offset ) const;
void
rotate_node( scene::basic_node *Node, glm::vec3 const &Angle );
void
rotate_instance( TAnimModel *Instance, glm::vec3 const &Angle ) const;
};
} // scene
//---------------------------------------------------------------------------