fix focus lockin & sketch3d new gui

This commit is contained in:
IlyaShurupov 2024-10-20 12:01:42 +03:00
parent aecc75828b
commit 2460c9ce8d
44 changed files with 1015 additions and 322 deletions

View file

@ -283,6 +283,14 @@ PencilBrush::~PencilBrush() {
if (mStroke) delete mStroke;
}
void PencilBrush::finish(Project* proj) {
if (mStroke) {
ensureReady(mStroke, &proj->mCamera);
proj->mLayers[proj->mActiveLayer]->strokes.pushBack(mStroke);
mStroke = nullptr;
}
}
Layer::~Layer() {
for (auto str : strokes) {
delete str.data();
@ -316,6 +324,20 @@ void Project::sample(halnf pressure, halnf cameraRatio, Vec2F relativeCameraPos)
}
}
void Project::setPencil() {
if (auto idx = mBrushes.presents(mActiveBrush)) {
mBrushes.getSlotVal(idx)->finish(this);
}
mActiveBrush = "pencil";
}
void Project::setEraser() {
if (auto idx = mBrushes.presents(mActiveBrush)) {
mBrushes.getSlotVal(idx)->finish(this);
}
mActiveBrush = "eraser";
}
Project::~Project() {
for (auto brush : mBrushes) {
delete brush->val;