@doufunao123/asset-gateway 0.25.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +87 -15
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { AssetForgeError } from "@doufunao123/assetforge-sdk";
|
|
|
15
15
|
|
|
16
16
|
// src/meta.ts
|
|
17
17
|
var CLI_NAME = "asset-gateway";
|
|
18
|
-
var CLI_VERSION = "0.25.
|
|
18
|
+
var CLI_VERSION = "0.25.1";
|
|
19
19
|
var CLI_DESCRIPTION = "Universal asset generation gateway CLI";
|
|
20
20
|
var DEFAULT_GATEWAY_URL = "https://asset.origingame.dev";
|
|
21
21
|
|
|
@@ -1802,7 +1802,13 @@ async function saveProcess3dOutput(data, operation, outputDir, format) {
|
|
|
1802
1802
|
function createProcess3dCommand() {
|
|
1803
1803
|
const command = new Command8("process3d").description("3D model post-processing via Meshy AI");
|
|
1804
1804
|
command.addCommand(
|
|
1805
|
-
new Command8("remesh").description("Remesh a model and optionally change format or polygon count").option("--task-id <id>", "Meshy task ID").option("--model-url <url>", "Model URL to remesh without an existing task").requiredOption("--format <fmt>", "Target format: glb, fbx, obj, usdz, stl, 3mf").option("--polycount <n>", "Target polygon count").option("--topology <type>", "Topology type: triangle or quad").option("--auto-size", "Estimate real-world size automatically").option("--
|
|
1805
|
+
new Command8("remesh").description("Remesh a model and optionally change format or polygon count").option("--task-id <id>", "Meshy task ID").option("--model-url <url>", "Model URL to remesh without an existing task").requiredOption("--format <fmt>", "Target format: glb, fbx, obj, usdz, stl, 3mf").option("--polycount <n>", "Target polygon count (Meshy target_polycount; result polycount may vary 1.5-2x)").option("--topology <type>", "Topology type: triangle or quad").option("--auto-size", "Estimate real-world size automatically (Meshy auto_size is unreliable on small objects)").option("--resize-height <meters>", "Resize the mesh so its bounding box height equals this many meters").option(
|
|
1806
|
+
"--origin-at <point>",
|
|
1807
|
+
"Move the origin: bottom, top, center, bottom-center, top-center"
|
|
1808
|
+
).option("--output-dir <dir>", "Directory to save output", ".").option(
|
|
1809
|
+
"--async",
|
|
1810
|
+
"Submit asynchronously; return job_id immediately without waiting. Poll with: asset-gateway job status <id>"
|
|
1811
|
+
).action(async function(options) {
|
|
1806
1812
|
try {
|
|
1807
1813
|
if (!options.taskId && !options.modelUrl) {
|
|
1808
1814
|
throw new Error("Either --task-id or --model-url is required");
|
|
@@ -1812,9 +1818,29 @@ function createProcess3dCommand() {
|
|
|
1812
1818
|
target_formats: [options.format]
|
|
1813
1819
|
};
|
|
1814
1820
|
if (options.modelUrl) params.model_url = options.modelUrl;
|
|
1815
|
-
if (options.polycount) params.
|
|
1821
|
+
if (options.polycount) params.target_polycount = Number(options.polycount);
|
|
1816
1822
|
if (options.topology) params.topology = options.topology;
|
|
1817
1823
|
if (options.autoSize) params.auto_size = true;
|
|
1824
|
+
if (options.resizeHeight !== void 0) {
|
|
1825
|
+
const value = Number(options.resizeHeight);
|
|
1826
|
+
if (!Number.isFinite(value)) {
|
|
1827
|
+
throw new Error("--resize-height must be a number (meters)");
|
|
1828
|
+
}
|
|
1829
|
+
params.resize_height = value;
|
|
1830
|
+
}
|
|
1831
|
+
if (options.originAt) params.origin_at = options.originAt;
|
|
1832
|
+
if (options.async) {
|
|
1833
|
+
const ack = await ctx.client.process3d(
|
|
1834
|
+
{
|
|
1835
|
+
task_id: options.taskId ?? "",
|
|
1836
|
+
operation: "remesh",
|
|
1837
|
+
params: toJsonObject2(params)
|
|
1838
|
+
},
|
|
1839
|
+
{ async: true }
|
|
1840
|
+
);
|
|
1841
|
+
printSuccess("process3d.remesh", ack, ctx);
|
|
1842
|
+
return;
|
|
1843
|
+
}
|
|
1818
1844
|
const data = await ctx.client.process3d({
|
|
1819
1845
|
task_id: options.taskId ?? "",
|
|
1820
1846
|
operation: "remesh",
|
|
@@ -1829,8 +1855,16 @@ function createProcess3dCommand() {
|
|
|
1829
1855
|
})
|
|
1830
1856
|
);
|
|
1831
1857
|
command.addCommand(
|
|
1832
|
-
new Command8("retexture").description("Regenerate textures for an existing Meshy model").requiredOption("--task-id <id>", "Meshy task ID").option("--prompt <text>", "Text style prompt for the new material pass").option("--style-image <input>", "Texture style reference image URL or local file path").option("--pbr", "Enable PBR materials").option("--hd-texture", "Request 4K texture output").option("--ai-model <name>", "Meshy model: meshy-5, meshy-6, latest").option("--output-dir <dir>", "Directory to save output", ".").
|
|
1858
|
+
new Command8("retexture").description("Regenerate textures for an existing Meshy model").requiredOption("--task-id <id>", "Meshy task ID").option("--prompt <text>", "Text style prompt for the new material pass").option("--style-image <input>", "Texture style reference image URL or local file path").option("--pbr", "Enable PBR materials").option("--hd-texture", "Request 4K texture output (requires --ai-model meshy-6)").option("--ai-model <name>", "Meshy model: meshy-5, meshy-6, latest").option("--output-dir <dir>", "Directory to save output", ".").option(
|
|
1859
|
+
"--async",
|
|
1860
|
+
"Submit asynchronously; return job_id immediately without waiting. Poll with: asset-gateway job status <id>"
|
|
1861
|
+
).action(async function(options) {
|
|
1833
1862
|
try {
|
|
1863
|
+
if (options.hdTexture && options.aiModel && options.aiModel !== "meshy-6") {
|
|
1864
|
+
throw new Error(
|
|
1865
|
+
"--hd-texture requires --ai-model meshy-6 (got '" + options.aiModel + "')"
|
|
1866
|
+
);
|
|
1867
|
+
}
|
|
1834
1868
|
const ctx = createContext(this);
|
|
1835
1869
|
const params = {};
|
|
1836
1870
|
if (options.prompt) params.text_style_prompt = options.prompt;
|
|
@@ -1838,11 +1872,17 @@ function createProcess3dCommand() {
|
|
|
1838
1872
|
if (options.pbr) params.pbr = true;
|
|
1839
1873
|
if (options.hdTexture) params.hd_texture = true;
|
|
1840
1874
|
if (options.aiModel) params.ai_model = options.aiModel;
|
|
1841
|
-
const
|
|
1875
|
+
const request = {
|
|
1842
1876
|
task_id: options.taskId,
|
|
1843
1877
|
operation: "retexture",
|
|
1844
1878
|
params: toJsonObject2(params)
|
|
1845
|
-
}
|
|
1879
|
+
};
|
|
1880
|
+
if (options.async) {
|
|
1881
|
+
const ack = await ctx.client.process3d(request, { async: true });
|
|
1882
|
+
printSuccess("process3d.retexture", ack, ctx);
|
|
1883
|
+
return;
|
|
1884
|
+
}
|
|
1885
|
+
const data = await ctx.client.process3d(request);
|
|
1846
1886
|
const localPath = await saveProcess3dOutput(data, "retexture", options.outputDir);
|
|
1847
1887
|
if (localPath) data.local_path = localPath;
|
|
1848
1888
|
printSuccess("process3d.retexture", data, ctx);
|
|
@@ -1852,7 +1892,10 @@ function createProcess3dCommand() {
|
|
|
1852
1892
|
})
|
|
1853
1893
|
);
|
|
1854
1894
|
command.addCommand(
|
|
1855
|
-
new Command8("rig").description("Rig a Meshy model for character animation").option("--task-id <id>", "Meshy task ID").option("--height <meters>", "Estimated character height in meters").option("--model-url <url>", "Model URL to rig without an existing task").option("--output-dir <dir>", "Directory to save output", ".").
|
|
1895
|
+
new Command8("rig").description("Rig a Meshy model for character animation").option("--task-id <id>", "Meshy task ID").option("--height <meters>", "Estimated character height in meters").option("--model-url <url>", "Model URL to rig without an existing task").option("--output-dir <dir>", "Directory to save output", ".").option(
|
|
1896
|
+
"--async",
|
|
1897
|
+
"Submit asynchronously; return job_id immediately without waiting. Poll with: asset-gateway job status <id>"
|
|
1898
|
+
).action(async function(options) {
|
|
1856
1899
|
try {
|
|
1857
1900
|
if (!options.taskId && !options.modelUrl) {
|
|
1858
1901
|
throw new Error("Either --task-id or --model-url is required");
|
|
@@ -1861,11 +1904,17 @@ function createProcess3dCommand() {
|
|
|
1861
1904
|
const params = {};
|
|
1862
1905
|
if (options.height) params.height_meters = Number(options.height);
|
|
1863
1906
|
if (options.modelUrl) params.model_url = options.modelUrl;
|
|
1864
|
-
const
|
|
1907
|
+
const request = {
|
|
1865
1908
|
task_id: options.taskId ?? "",
|
|
1866
1909
|
operation: "rig",
|
|
1867
1910
|
params: toJsonObject2(params)
|
|
1868
|
-
}
|
|
1911
|
+
};
|
|
1912
|
+
if (options.async) {
|
|
1913
|
+
const ack = await ctx.client.process3d(request, { async: true });
|
|
1914
|
+
printSuccess("process3d.rig", ack, ctx);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
const data = await ctx.client.process3d(request);
|
|
1869
1918
|
const localPath = await saveProcess3dOutput(data, "rig", options.outputDir);
|
|
1870
1919
|
if (localPath) data.local_path = localPath;
|
|
1871
1920
|
printSuccess("process3d.rig", data, ctx);
|
|
@@ -1875,7 +1924,10 @@ function createProcess3dCommand() {
|
|
|
1875
1924
|
})
|
|
1876
1925
|
);
|
|
1877
1926
|
command.addCommand(
|
|
1878
|
-
new Command8("animate").description("Apply a preset animation to a rigged Meshy character").requiredOption("--task-id <id>", "Meshy rigging task ID").requiredOption("--action-id <n>", "Animation preset ID (see docs for full list)").option("--fps <n>", "Target frame rate: 24, 25, 30, or 60").option("--output-dir <dir>", "Directory to save output", ".").
|
|
1927
|
+
new Command8("animate").description("Apply a preset animation to a rigged Meshy character").requiredOption("--task-id <id>", "Meshy rigging task ID").requiredOption("--action-id <n>", "Animation preset ID (see docs for full list)").option("--fps <n>", "Target frame rate: 24, 25, 30, or 60").option("--output-dir <dir>", "Directory to save output", ".").option(
|
|
1928
|
+
"--async",
|
|
1929
|
+
"Submit asynchronously; return job_id immediately without waiting. Poll with: asset-gateway job status <id>"
|
|
1930
|
+
).action(async function(options) {
|
|
1879
1931
|
try {
|
|
1880
1932
|
const ctx = createContext(this);
|
|
1881
1933
|
const params = {
|
|
@@ -1884,11 +1936,17 @@ function createProcess3dCommand() {
|
|
|
1884
1936
|
if (options.fps) {
|
|
1885
1937
|
params.fps = Number(options.fps);
|
|
1886
1938
|
}
|
|
1887
|
-
const
|
|
1939
|
+
const request = {
|
|
1888
1940
|
task_id: options.taskId,
|
|
1889
1941
|
operation: "animate",
|
|
1890
1942
|
params: toJsonObject2(params)
|
|
1891
|
-
}
|
|
1943
|
+
};
|
|
1944
|
+
if (options.async) {
|
|
1945
|
+
const ack = await ctx.client.process3d(request, { async: true });
|
|
1946
|
+
printSuccess("process3d.animate", ack, ctx);
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
const data = await ctx.client.process3d(request);
|
|
1892
1950
|
const localPath = await saveProcess3dOutput(data, "animate", options.outputDir);
|
|
1893
1951
|
if (localPath) data.local_path = localPath;
|
|
1894
1952
|
printSuccess("process3d.animate", data, ctx);
|
|
@@ -1898,19 +1956,33 @@ function createProcess3dCommand() {
|
|
|
1898
1956
|
})
|
|
1899
1957
|
);
|
|
1900
1958
|
command.addCommand(
|
|
1901
|
-
new Command8("refine").description("Refine a Meshy preview model into a higher quality result").requiredOption("--task-id <id>", "Meshy preview task ID").option("--pbr", "Enable PBR materials").option("--hd-texture", "Request 4K texture output").option("--texture-prompt <text>", "Optional texture prompt for the refinement pass").option("--ai-model <name>", "Meshy model: meshy-5, meshy-6, latest").option("--output-dir <dir>", "Directory to save output", ".").
|
|
1959
|
+
new Command8("refine").description("Refine a Meshy preview model into a higher quality result").requiredOption("--task-id <id>", "Meshy preview task ID").option("--pbr", "Enable PBR materials").option("--hd-texture", "Request 4K texture output (requires --ai-model meshy-6)").option("--texture-prompt <text>", "Optional texture prompt for the refinement pass").option("--ai-model <name>", "Meshy model: meshy-5, meshy-6, latest").option("--output-dir <dir>", "Directory to save output", ".").option(
|
|
1960
|
+
"--async",
|
|
1961
|
+
"Submit asynchronously; return job_id immediately without waiting. Poll with: asset-gateway job status <id>"
|
|
1962
|
+
).action(async function(options) {
|
|
1902
1963
|
try {
|
|
1964
|
+
if (options.hdTexture && options.aiModel && options.aiModel !== "meshy-6") {
|
|
1965
|
+
throw new Error(
|
|
1966
|
+
"--hd-texture requires --ai-model meshy-6 (got '" + options.aiModel + "')"
|
|
1967
|
+
);
|
|
1968
|
+
}
|
|
1903
1969
|
const ctx = createContext(this);
|
|
1904
1970
|
const params = {};
|
|
1905
1971
|
if (options.pbr) params.pbr = true;
|
|
1906
1972
|
if (options.hdTexture) params.hd_texture = true;
|
|
1907
1973
|
if (options.texturePrompt) params.texture_prompt = options.texturePrompt;
|
|
1908
1974
|
if (options.aiModel) params.ai_model = options.aiModel;
|
|
1909
|
-
const
|
|
1975
|
+
const request = {
|
|
1910
1976
|
task_id: options.taskId,
|
|
1911
1977
|
operation: "refine",
|
|
1912
1978
|
params: toJsonObject2(params)
|
|
1913
|
-
}
|
|
1979
|
+
};
|
|
1980
|
+
if (options.async) {
|
|
1981
|
+
const ack = await ctx.client.process3d(request, { async: true });
|
|
1982
|
+
printSuccess("process3d.refine", ack, ctx);
|
|
1983
|
+
return;
|
|
1984
|
+
}
|
|
1985
|
+
const data = await ctx.client.process3d(request);
|
|
1914
1986
|
const localPath = await saveProcess3dOutput(data, "refine", options.outputDir);
|
|
1915
1987
|
if (localPath) data.local_path = localPath;
|
|
1916
1988
|
printSuccess("process3d.refine", data, ctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doufunao123/asset-gateway",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"description": "Universal asset generation gateway CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"node": ">=20"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@doufunao123/assetforge-sdk": "^0.11.
|
|
30
|
+
"@doufunao123/assetforge-sdk": "^0.11.1",
|
|
31
31
|
"commander": "^13.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|