23 name_{ std::move(
name ) }
27 if (
auto m = obj->mesh() )
28 cloneMesh_ = std::make_shared<Mesh>( *m );
33 ChangeMeshAction( std::string
name,
const std::shared_ptr<ObjectMesh>& obj, std::shared_ptr<Mesh> newMesh ) :
35 name_{ std::move(
name ) }
38 cloneMesh_ = objMesh_->updateMesh( std::move( newMesh ) );
41 virtual std::string
name()
const override
51 cloneMesh_ = objMesh_->updateMesh( cloneMesh_ );
60 [[nodiscard]]
virtual size_t heapBytes()
const override
66 std::shared_ptr<ObjectMesh> objMesh_;
67 std::shared_ptr<Mesh> cloneMesh_;
81 name_{ std::move(
name ) }
85 uvCoords_ = obj->getUVCoords();
92 name_{ std::move(
name ) }
96 uvCoords_ = std::move( newUvCoords );
97 obj->updateUVCoords( uvCoords_ );
101 virtual std::string
name()
const override
111 objMesh_->updateUVCoords( uvCoords_ );
122 return name_.capacity() + uvCoords_.heapBytes();
126 VertUVCoords uvCoords_;
127 std::shared_ptr<ObjectMeshHolder> objMesh_;
141 name_{ std::move(
name ) }
144 textures_ = obj->getTextures();
150 name_{ std::move(
name ) }
154 textures_ = std::move( newTextures );
155 obj->updateTextures( textures_ );
159 virtual std::string
name()
const override
168 obj_->updateTextures( textures_ );
183 std::shared_ptr<ObjectMeshHolder> obj_;
197 name_{ std::move(
name ) }
201 if (
auto m = objMesh_->mesh() )
202 clonePoints_ = m->points;
208 name_{ std::move(
name ) }
210 clonePoints_ = std::move( newCoords );
214 virtual std::string
name()
const override
224 if (
auto m = objMesh_->varMesh() )
226 std::swap( m->points, clonePoints_ );
239 return name_.capacity() + clonePoints_.heapBytes();
242 const std::shared_ptr<ObjectMesh> &
obj()
const {
return objMesh_; }
246 std::shared_ptr<ObjectMesh> objMesh_;
247 VertCoords clonePoints_;
261 name_{ std::move(
name ) }
265 if (
auto m = objMesh_->mesh() )
266 cloneTopology_ = m->topology;
272 name_{ std::move(
name ) }
274 cloneTopology_ = std::move( newTopology );
278 virtual std::string
name()
const override
288 if (
auto m = objMesh_->varMesh() )
290 std::swap( m->topology, cloneTopology_ );
303 return name_.capacity() + cloneTopology_.
heapBytes();
307 std::shared_ptr<ObjectMesh> objMesh_;
322 name_{ std::move(
name ) }
326 texturePerFace_ = obj->getTexturePerFace();
333 name_{ std::move(
name ) }
337 texturePerFace_ = std::move( newTexturePerFace );
338 obj->updateTexturePerFace( texturePerFace_ );
342 virtual std::string
name()
const override
352 objMesh_->updateTexturePerFace( texturePerFace_ );
363 return name_.capacity() + texturePerFace_.
heapBytes();
368 std::shared_ptr<ObjectMeshHolder> objMesh_;
Undo action for ObjectMesh mesh change.
Definition MRChangeMeshAction.h:16
virtual std::string name() const override
Definition MRChangeMeshAction.h:41
ChangeMeshAction(std::string name, const std::shared_ptr< ObjectMesh > &obj, std::shared_ptr< Mesh > newMesh)
use this constructor to remember object's mesh and immediately set new mesh
Definition MRChangeMeshAction.h:33
ChangeMeshAction(std::string name, const std::shared_ptr< ObjectMesh > &obj)
use this constructor to remember object's mesh before making any changes in it
Definition MRChangeMeshAction.h:21
virtual void action(HistoryAction::Type) override
This function is called on history action (undo, redo, etc.)
Definition MRChangeMeshAction.h:46
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRChangeMeshAction.h:60
static void setObjectDirty(const std::shared_ptr< ObjectMesh > &obj)
Definition MRChangeMeshAction.h:54
Undo action for ObjectMesh points only (not topology) change.
Definition MRChangeMeshAction.h:190
static void setObjectDirty(const std::shared_ptr< ObjectMesh > &obj)
Definition MRChangeMeshAction.h:231
ChangeMeshPointsAction(std::string name, const std::shared_ptr< ObjectMesh > &obj)
use this constructor to remember object's mesh points before making any changes in it
Definition MRChangeMeshAction.h:195
ChangeMeshPointsAction(std::string name, const std::shared_ptr< ObjectMesh > &obj, VertCoords &&newCoords)
use this constructor to remember object's mesh points and immediate set new value
Definition MRChangeMeshAction.h:206
virtual std::string name() const override
Definition MRChangeMeshAction.h:214
const std::shared_ptr< ObjectMesh > & obj() const
Definition MRChangeMeshAction.h:242
virtual void action(HistoryAction::Type) override
This function is called on history action (undo, redo, etc.)
Definition MRChangeMeshAction.h:219
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRChangeMeshAction.h:237
const VertCoords & clonePoints() const
Definition MRChangeMeshAction.h:243
Undo action for ObjectMeshHolder texturePerFace change.
Definition MRChangeMeshAction.h:315
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRChangeMeshAction.h:361
virtual std::string name() const override
Definition MRChangeMeshAction.h:342
virtual void action(HistoryAction::Type) override
This function is called on history action (undo, redo, etc.)
Definition MRChangeMeshAction.h:347
ChangeMeshTexturePerFaceAction(std::string name, const std::shared_ptr< ObjectMeshHolder > &obj)
use this constructor to remember object's texturePerFace data before making any changes in them
Definition MRChangeMeshAction.h:320
ChangeMeshTexturePerFaceAction(std::string name, const std::shared_ptr< ObjectMeshHolder > &obj, Vector< TextureId, FaceId > &&newTexturePerFace)
use this constructor to remember object's texturePerFace data and immediate set new value
Definition MRChangeMeshAction.h:331
static void setObjectDirty(const std::shared_ptr< ObjectMeshHolder > &obj)
Definition MRChangeMeshAction.h:355
Undo action for ObjectMesh topology only (not points) change.
Definition MRChangeMeshAction.h:254
virtual void action(HistoryAction::Type) override
This function is called on history action (undo, redo, etc.)
Definition MRChangeMeshAction.h:283
static void setObjectDirty(const std::shared_ptr< ObjectMesh > &obj)
Definition MRChangeMeshAction.h:295
virtual std::string name() const override
Definition MRChangeMeshAction.h:278
ChangeMeshTopologyAction(std::string name, const std::shared_ptr< ObjectMesh > &obj, MeshTopology &&newTopology)
use this constructor to remember object's mesh topology and immediate set new value
Definition MRChangeMeshAction.h:270
ChangeMeshTopologyAction(std::string name, const std::shared_ptr< ObjectMesh > &obj)
use this constructor to remember object's mesh points before making any changes in it
Definition MRChangeMeshAction.h:259
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRChangeMeshAction.h:301
Undo action for ObjectMeshHolder uvCoords change.
Definition MRChangeMeshAction.h:74
ChangeMeshUVCoordsAction(std::string name, const std::shared_ptr< ObjectMeshHolder > &obj, VertUVCoords &&newUvCoords)
use this constructor to remember object's uv-coordinates and immediate set new value
Definition MRChangeMeshAction.h:90
virtual void action(HistoryAction::Type) override
This function is called on history action (undo, redo, etc.)
Definition MRChangeMeshAction.h:106
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRChangeMeshAction.h:120
virtual std::string name() const override
Definition MRChangeMeshAction.h:101
static void setObjectDirty(const std::shared_ptr< ObjectMeshHolder > &obj)
Definition MRChangeMeshAction.h:114
ChangeMeshUVCoordsAction(std::string name, const std::shared_ptr< ObjectMeshHolder > &obj)
use this constructor to remember object's uv-coordinates before making any changes in them
Definition MRChangeMeshAction.h:79
Definition MRChangeMeshAction.h:134
static void setObjectDirty(const std::shared_ptr< ObjectMeshHolder > &obj)
Definition MRChangeMeshAction.h:171
ChangeTextureAction(std::string name, const std::shared_ptr< ObjectMeshHolder > &obj, Vector< MeshTexture, TextureId > &&newTextures)
use this constructor to remember object's textures and immediate set new value
Definition MRChangeMeshAction.h:148
virtual void action(HistoryAction::Type) override
This function is called on history action (undo, redo, etc.)
Definition MRChangeMeshAction.h:164
ChangeTextureAction(std::string name, const std::shared_ptr< ObjectMeshHolder > &obj)
use this constructor to remember object's textures before making any changes in them
Definition MRChangeMeshAction.h:139
virtual std::string name() const override
Definition MRChangeMeshAction.h:159
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRChangeMeshAction.h:177
Definition MRHistoryAction.h:12
Type
Definition MRHistoryAction.h:19
Definition MRMesh/MRMeshTopology.h:18
MRMESH_API size_t heapBytes() const
returns the amount of memory this object occupies on heap
Definition MRObjectMeshHolder.h:30
Definition MRObjectMesh.h:11
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
size_t heapBytes() const
returns the amount of memory this object occupies on heap
Definition MRMesh/MRVector.h:142
size_t heapBytes(const std::vector< T > &vec)
returns the amount of memory given vector occupies on heap
Definition MRHeapBytes.h:15
@ DIRTY_POSITION
Definition MRVisualObject.h:90
@ DIRTY_TEXTURE
Definition MRVisualObject.h:97
@ DIRTY_TEXTURE_PER_FACE
Definition MRVisualObject.h:103
@ DIRTY_FACE
Definition MRVisualObject.h:99
@ DIRTY_ALL
Definition MRVisualObject.h:109
@ DIRTY_UV
Definition MRVisualObject.h:91