Skip to content

CURA-12544 saving and loading painted files in cura #7

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions python/MeshData.sip
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Ultimaker B.V.
// Copyright (c) 2025 Ultimaker B.V.
// pySavitar is released under the terms of the LGPLv3 or higher.

class MeshData
Expand All @@ -17,4 +17,10 @@ public:
void setVerticesFromBytes(const bytearray& data);

void setFacesFromBytes(const bytearray& data);
};

bytearray getUVCoordinatesPerVertexAsBytes(const Scene* scene) const;

void setUVCoordinatesPerVertexAsBytes(const bytearray& data, const std::string& texture_path, Scene* scene);

std::string getTexturePath(const Scene* scene) const;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no way to set a texture path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually set it by using setUVCoordinatesPerVertexAsBytes, and I didn't need a direct setter so didn't create it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, you set the texture path by calling the setUVCoordinatesPerVertexAsBytes function? I would expect to have to function, something akin to setUV and setTextureImage. You're saying setUVCoordinatesPerVertexAsBytes does both?

Copy link
Contributor Author

@wawanbreton wawanbreton Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed... The UV coordinates are actually stored in two places:

  • The coordinates themselves are stored in the global resources
  • The mesh stores indices of the coordinates for each of its faces

Then the texture is also stored in a separate resource, linked from the coordinates. So in order to simplify the management and avoid mistakes, I decided to add it all to a single call. But maybe I should rename the function then, because it does more than advertised.

};
6 changes: 3 additions & 3 deletions python/SceneNode.sip
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022 Ultimaker B.V.
// Copyright (c) 2025 Ultimaker B.V.
// pySavitar is released under the terms of the LGPLv3 or higher.

class SceneNode
Expand All @@ -20,8 +20,8 @@ public:
std::string getName();
void setName(std::string name);

std::string getId();
void setId(std::string id);
int getId();
void setId(const int id);

const std::map<std::string, MetadataEntry>& getSettings() const;
void setSetting(const std::string& key, MetadataEntry& entry);
Expand Down