Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
fix: import dense STL meshes
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ permissions:
|
|||||||
|
|
||||||
## Create a release
|
## Create a release
|
||||||
|
|
||||||
Push a tag such as `v1.0.5`, or run `Desktop Release` with `workflow_dispatch` and enter `1.0.5`.
|
Push a tag such as `v1.0.6`, or run `Desktop Release` with `workflow_dispatch` and enter `1.0.6`.
|
||||||
|
|
||||||
The workflow builds these packages:
|
The workflow builds these packages:
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: "Version to release (for example 1.0.5)"
|
description: "Version to release (for example 1.0.6)"
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<a href="https://github.com/Formsmith746/SketchForge-3D/stargazers"><img alt="Star SketchForge on GitHub" src="https://img.shields.io/github/stars/Formsmith746/SketchForge-3D?style=flat&logo=github"></a>
|
<a href="https://github.com/Formsmith746/SketchForge-3D/stargazers"><img alt="Star SketchForge on GitHub" src="https://img.shields.io/github/stars/Formsmith746/SketchForge-3D?style=flat&logo=github"></a>
|
||||||
<a href="https://github.com/sponsors/Formsmith746"><img alt="Sponsor SketchForge on GitHub" src="https://img.shields.io/badge/GitHub-Sponsor-ea4aaa?logo=githubsponsors&logoColor=white"></a>
|
<a href="https://github.com/sponsors/Formsmith746"><img alt="Sponsor SketchForge on GitHub" src="https://img.shields.io/badge/GitHub-Sponsor-ea4aaa?logo=githubsponsors&logoColor=white"></a>
|
||||||
<img alt="Local first" src="https://img.shields.io/badge/local--first-no%20account-0ea5e9">
|
<img alt="Local first" src="https://img.shields.io/badge/local--first-no%20account-0ea5e9">
|
||||||
<img alt="Version v1.0.5" src="https://img.shields.io/badge/version-v1.0.5-2563eb">
|
<img alt="Version v1.0.6" src="https://img.shields.io/badge/version-v1.0.6-2563eb">
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ type ResourceSignature = {
|
|||||||
const resourceSignatureCache = new WeakMap<object, ResourceSignature>();
|
const resourceSignatureCache = new WeakMap<object, ResourceSignature>();
|
||||||
const stringSignatureCache = new Map<string, ResourceSignature>();
|
const stringSignatureCache = new Map<string, ResourceSignature>();
|
||||||
const MAX_CACHED_STRING_SIGNATURES = 64;
|
const MAX_CACHED_STRING_SIGNATURES = 64;
|
||||||
|
const STREAMED_NUMERIC_ARRAY_LENGTH = 10_000;
|
||||||
|
const STREAMED_NUMERIC_ARRAY_MARKER = "$sketchforgeFloat64Array";
|
||||||
const COMPACT_RESOURCE_KEYS = new Set([
|
const COMPACT_RESOURCE_KEYS = new Set([
|
||||||
"cadDisplayEdges",
|
"cadDisplayEdges",
|
||||||
"edgeTreatmentHistory",
|
"edgeTreatmentHistory",
|
||||||
@@ -47,10 +49,136 @@ function signatureFromSerialized(serialized: string): ResourceSignature {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type StreamingHashState = {
|
||||||
|
hashA: number;
|
||||||
|
hashB: number;
|
||||||
|
units: number;
|
||||||
|
estimatedBytes: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
function streamingHashState(): StreamingHashState {
|
||||||
|
return { hashA: 2166136261, hashB: 5381, units: 0, estimatedBytes: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendHashUnit(state: StreamingHashState, unit: number) {
|
||||||
|
state.hashA = Math.imul(state.hashA ^ unit, 16777619);
|
||||||
|
state.hashB = Math.imul(state.hashB, 33) ^ unit;
|
||||||
|
state.units += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendHashText(state: StreamingHashState, value: string) {
|
||||||
|
for (let index = 0; index < value.length; index += 1) {
|
||||||
|
appendHashUnit(state, value.charCodeAt(index));
|
||||||
|
}
|
||||||
|
state.estimatedBytes += value.length * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendHashNumber(state: StreamingHashState, value: number, view: DataView) {
|
||||||
|
view.setFloat64(0, value, true);
|
||||||
|
appendHashUnit(state, view.getUint32(0, true));
|
||||||
|
appendHashUnit(state, view.getUint32(4, true));
|
||||||
|
state.estimatedBytes += 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
function signatureFromStreamingState(state: StreamingHashState, prefix: string): ResourceSignature {
|
||||||
|
return {
|
||||||
|
fingerprint: `${prefix}:${state.units}:${state.hashA >>> 0}:${state.hashB >>> 0}`,
|
||||||
|
estimatedBytes: state.estimatedBytes,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function largeNumericArraySignature(value: unknown) {
|
||||||
|
if (!Array.isArray(value) || value.length <= STREAMED_NUMERIC_ARRAY_LENGTH) return null;
|
||||||
|
const state = streamingHashState();
|
||||||
|
const view = new DataView(new ArrayBuffer(8));
|
||||||
|
appendHashText(state, `float64-array:${value.length}:`);
|
||||||
|
for (let index = 0; index < value.length; index += 1) {
|
||||||
|
const number = value[index];
|
||||||
|
if (typeof number !== "number") return null;
|
||||||
|
appendHashNumber(state, number, view);
|
||||||
|
}
|
||||||
|
return signatureFromStreamingState(state, "float64-v1");
|
||||||
|
}
|
||||||
|
|
||||||
|
function signatureFromStreamedValue(resource: object) {
|
||||||
|
const state = streamingHashState();
|
||||||
|
const view = new DataView(new ArrayBuffer(8));
|
||||||
|
const active = new WeakSet<object>();
|
||||||
|
|
||||||
|
const appendValue = (value: unknown, arrayValue = false): void => {
|
||||||
|
if (value === null || (arrayValue && (value === undefined || typeof value === "function" || typeof value === "symbol"))) {
|
||||||
|
appendHashText(state, "null;");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof value === "string") {
|
||||||
|
appendHashText(state, `string:${value.length}:`);
|
||||||
|
appendHashText(state, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof value === "number") {
|
||||||
|
appendHashText(state, "number:");
|
||||||
|
appendHashNumber(state, value, view);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof value === "boolean") {
|
||||||
|
appendHashText(state, value ? "true;" : "false;");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof value === "bigint") {
|
||||||
|
throw new TypeError("Cannot serialize a BigInt resource");
|
||||||
|
}
|
||||||
|
if (value === undefined || typeof value === "function" || typeof value === "symbol") {
|
||||||
|
appendHashText(state, "undefined;");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (active.has(value)) throw new TypeError("Cannot fingerprint a circular resource");
|
||||||
|
active.add(value);
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
appendHashText(state, `array:${value.length}:`);
|
||||||
|
for (let index = 0; index < value.length; index += 1) appendValue(value[index], true);
|
||||||
|
} else {
|
||||||
|
const record = value as Record<string, unknown>;
|
||||||
|
const keys = Object.keys(record).filter((key) => {
|
||||||
|
const item = record[key];
|
||||||
|
return item !== undefined && typeof item !== "function" && typeof item !== "symbol";
|
||||||
|
});
|
||||||
|
appendHashText(state, `object:${keys.length}:`);
|
||||||
|
for (const key of keys) {
|
||||||
|
appendHashText(state, `key:${key.length}:`);
|
||||||
|
appendHashText(state, key);
|
||||||
|
appendValue(record[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
active.delete(value);
|
||||||
|
};
|
||||||
|
|
||||||
|
appendValue(resource);
|
||||||
|
return signatureFromStreamingState(state, "stream-v1");
|
||||||
|
}
|
||||||
|
|
||||||
|
function signatureWithStreamedNumericArrays(resource: object) {
|
||||||
|
let streamedBytes = 0;
|
||||||
|
const serialized = JSON.stringify(resource, (_key, value: unknown) => {
|
||||||
|
const signature = largeNumericArraySignature(value);
|
||||||
|
if (!signature) return value;
|
||||||
|
streamedBytes += signature.estimatedBytes;
|
||||||
|
return { [STREAMED_NUMERIC_ARRAY_MARKER]: signature.fingerprint };
|
||||||
|
});
|
||||||
|
const signature = signatureFromSerialized(serialized);
|
||||||
|
return { ...signature, estimatedBytes: signature.estimatedBytes + streamedBytes };
|
||||||
|
}
|
||||||
|
|
||||||
function objectResourceSignature(resource: object) {
|
function objectResourceSignature(resource: object) {
|
||||||
const cached = resourceSignatureCache.get(resource);
|
const cached = resourceSignatureCache.get(resource);
|
||||||
if (cached) return cached;
|
if (cached) return cached;
|
||||||
const signature = signatureFromSerialized(JSON.stringify(resource));
|
let signature: ResourceSignature;
|
||||||
|
try {
|
||||||
|
signature = signatureWithStreamedNumericArrays(resource);
|
||||||
|
} catch (error) {
|
||||||
|
if (!(error instanceof RangeError) || !/string length/i.test(error.message)) throw error;
|
||||||
|
signature = signatureFromStreamedValue(resource);
|
||||||
|
}
|
||||||
resourceSignatureCache.set(resource, signature);
|
resourceSignatureCache.set(resource, signature);
|
||||||
return signature;
|
return signature;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type { GridSize, ProjectAsset, ProjectAssetSourceFormat, SketchOperation,
|
|||||||
export const SKF_SCHEMA_ID = "com.sketchforge.project";
|
export const SKF_SCHEMA_ID = "com.sketchforge.project";
|
||||||
export const SKF_FORMAT_VERSION = 1;
|
export const SKF_FORMAT_VERSION = 1;
|
||||||
export const SKF_MINIMUM_READER_VERSION = 1;
|
export const SKF_MINIMUM_READER_VERSION = 1;
|
||||||
export const SKF_CREATED_WITH_VERSION = "1.0.5";
|
export const SKF_CREATED_WITH_VERSION = "1.0.6";
|
||||||
export const SKF_MEDIA_TYPE = "application/vnd.sketchforge.project+zip";
|
export const SKF_MEDIA_TYPE = "application/vnd.sketchforge.project+zip";
|
||||||
|
|
||||||
export const SKF_LIMITS = {
|
export const SKF_LIMITS = {
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.0.6
|
||||||
|
|
||||||
|
- Fixed dense STL imports failing with `Invalid string length` while creating their initial undo-history fingerprint.
|
||||||
|
- Streamed large numeric mesh arrays into deterministic hashes instead of converting millions of coordinates to one oversized JSON string.
|
||||||
|
|
||||||
## 1.0.5
|
## 1.0.5
|
||||||
|
|
||||||
- Made the rotation handles larger and aligned their arrow glyphs with the model faces as the camera moves, including stable behavior on long objects.
|
- Made the rotation handles larger and aligned their arrow glyphs with the model faces as the camera moves, including stable behavior on long objects.
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "sketchforge",
|
"name": "sketchforge",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "sketchforge",
|
"name": "sketchforge",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tailwindcss/postcss": "^4.1.8",
|
"@tailwindcss/postcss": "^4.1.8",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sketchforge",
|
"name": "sketchforge",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "A local-first 3D design editor.",
|
"description": "A local-first 3D design editor.",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { appendEditorHistorySnapshot, boundedEditorHistory, editorHistoryEntry, editorHistoryForExport, hydrateEditorHistoryState, projectShapesFingerprint } from "@/lib/editorHistory";
|
import { appendEditorHistorySnapshot, boundedEditorHistory, editorHistoryEntry, editorHistoryForExport, hydrateEditorHistoryState, immutableResourceFingerprint, projectShapesFingerprint } from "@/lib/editorHistory";
|
||||||
import type { WorkplaneShape } from "@/types/sketchforge";
|
import type { WorkplaneShape } from "@/types/sketchforge";
|
||||||
|
|
||||||
function box(overrides: Partial<WorkplaneShape> = {}): WorkplaneShape {
|
function box(overrides: Partial<WorkplaneShape> = {}): WorkplaneShape {
|
||||||
@@ -93,6 +93,37 @@ describe("editor history snapshots", () => {
|
|||||||
}])).toBe(baseline);
|
}])).toBe(baseline);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("stream-hashes large mesh arrays and detects changes at the end", () => {
|
||||||
|
const positions = Array.from({ length: 10_001 }, (_, index) => Math.fround(Math.sin(index) * 100));
|
||||||
|
const resource = {
|
||||||
|
positions,
|
||||||
|
normals: positions.map((value) => Math.fround(value / 100)),
|
||||||
|
baseWidth: 200,
|
||||||
|
baseDepth: 150,
|
||||||
|
baseHeight: 80,
|
||||||
|
triangleCount: Math.floor(positions.length / 9),
|
||||||
|
sourceFormat: "stl",
|
||||||
|
};
|
||||||
|
const changedPositions = [...positions];
|
||||||
|
changedPositions[changedPositions.length - 1] += 1;
|
||||||
|
|
||||||
|
expect(immutableResourceFingerprint({ ...resource, positions: [...positions], normals: [...resource.normals] }))
|
||||||
|
.toBe(immutableResourceFingerprint(resource));
|
||||||
|
expect(immutableResourceFingerprint({ ...resource, positions: changedPositions }))
|
||||||
|
.not.toBe(immutableResourceFingerprint(resource));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("falls back to direct field hashing when serialization exceeds the string limit", () => {
|
||||||
|
const resource = {
|
||||||
|
positions: [0, 0, 0, 1, 0, 0, 0, 1, 0],
|
||||||
|
toJSON() {
|
||||||
|
throw new RangeError("Invalid string length");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(immutableResourceFingerprint(resource)).toMatch(/^stream-v1:/);
|
||||||
|
});
|
||||||
|
|
||||||
it("keeps unlimited history and applies preset or custom action limits", () => {
|
it("keeps unlimited history and applies preset or custom action limits", () => {
|
||||||
const entries = Array.from({ length: 140 }, (_, index) => ({
|
const entries = Array.from({ length: 140 }, (_, index) => ({
|
||||||
...editorHistoryEntry([box({ id: `box-${index}`, x: index })], []),
|
...editorHistoryEntry([box({ id: `box-${index}`, x: index })], []),
|
||||||
|
|||||||
Reference in New Issue
Block a user