Infer ArtStation categories from Blender/sculpt tools
Stop defaulting imports to CAD; map Blender to 3D Modeling and sculpt tools (Nomad/ZBrush) to 3D Sculpting.
This commit is contained in:
@@ -306,7 +306,6 @@ export async function adminMetaRoutes(app: FastifyInstance) {
|
|||||||
dryRun: body.dryRun,
|
dryRun: body.dryRun,
|
||||||
publish: body.publish,
|
publish: body.publish,
|
||||||
url: body.url,
|
url: body.url,
|
||||||
defaultCad: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!started) {
|
if (!started) {
|
||||||
|
|||||||
@@ -44,8 +44,6 @@ export interface ImportOptions {
|
|||||||
dryRun?: boolean;
|
dryRun?: boolean;
|
||||||
/** Publish new imports instead of leaving as draft */
|
/** Publish new imports instead of leaving as draft */
|
||||||
publish?: boolean;
|
publish?: boolean;
|
||||||
/** Assign CAD when no category matched */
|
|
||||||
defaultCad?: boolean;
|
|
||||||
onLog?: (line: string) => void;
|
onLog?: (line: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,9 +236,25 @@ async function importProject(
|
|||||||
const tags = detail.tags || [];
|
const tags = detail.tags || [];
|
||||||
let categoryIds = await resolveCategoryIds([...mediums, ...cats]);
|
let categoryIds = await resolveCategoryIds([...mediums, ...cats]);
|
||||||
|
|
||||||
if (categoryIds.length === 0 && opts.defaultCad !== false) {
|
// Infer from software / description when ArtStation has no useful medium tags
|
||||||
const cad = await prisma.category.findUnique({ where: { slug: "cad" } });
|
if (categoryIds.length === 0) {
|
||||||
if (cad) categoryIds = [cad.id];
|
const hay = `${software.join(" ")} ${detail.title} ${detail.description || ""}`.toLowerCase();
|
||||||
|
let slug: string | null = null;
|
||||||
|
if (
|
||||||
|
hay.includes("nomad sculpt") ||
|
||||||
|
hay.includes("zbrush") ||
|
||||||
|
(detail.title.toLowerCase().includes("mogwai") && hay.includes("sculpt"))
|
||||||
|
) {
|
||||||
|
slug = "3d-sculpting";
|
||||||
|
} else if (hay.includes("blender") || hay.includes("maya") || hay.includes("3d model")) {
|
||||||
|
slug = "3d-modeling";
|
||||||
|
} else if (hay.includes("solidworks") || hay.includes("fusion 360") || /\bcad\b/.test(hay)) {
|
||||||
|
slug = "cad";
|
||||||
|
}
|
||||||
|
if (slug) {
|
||||||
|
const cat = await prisma.category.findUnique({ where: { slug } });
|
||||||
|
if (cat) categoryIds = [cat.id];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log(
|
log(
|
||||||
|
|||||||
Reference in New Issue
Block a user