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,
|
||||
publish: body.publish,
|
||||
url: body.url,
|
||||
defaultCad: true,
|
||||
});
|
||||
|
||||
if (!started) {
|
||||
|
||||
@@ -44,8 +44,6 @@ export interface ImportOptions {
|
||||
dryRun?: boolean;
|
||||
/** Publish new imports instead of leaving as draft */
|
||||
publish?: boolean;
|
||||
/** Assign CAD when no category matched */
|
||||
defaultCad?: boolean;
|
||||
onLog?: (line: string) => void;
|
||||
}
|
||||
|
||||
@@ -238,9 +236,25 @@ async function importProject(
|
||||
const tags = detail.tags || [];
|
||||
let categoryIds = await resolveCategoryIds([...mediums, ...cats]);
|
||||
|
||||
if (categoryIds.length === 0 && opts.defaultCad !== false) {
|
||||
const cad = await prisma.category.findUnique({ where: { slug: "cad" } });
|
||||
if (cad) categoryIds = [cad.id];
|
||||
// Infer from software / description when ArtStation has no useful medium tags
|
||||
if (categoryIds.length === 0) {
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user