Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBS model exporter: add a single anchor group to a groupless model #546

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@
"icon": "icon.png",
"author": "McHorse",
"description": "Adds actions to export/import models in BBS format, which is used by BBS machinima studio.",
"version": "1.2.2",
"version": "1.2.3",
"variant": "both",
"tags": ["Exporter", "Importer"],
"min_version": "4.8.0",
Expand Down
36 changes: 30 additions & 6 deletions plugins/bbs_exporter/bbs_exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,41 @@

/* Model exporter code */

function areThereObjects(objects)
{
for (let i = 0; i < objects.length; i++)
{
if (objects[i].type === "group")
{
return true;
}
}

return false;
}

function createHierarchy(objects)
{
var groups = {};
var createAnchor = !areThereObjects(objects);

for (let i = 0; i < objects.length; i++)
if (createAnchor)
{
var object = objects[i];
var group = new Group();

if (object.type === "group")
group.children = objects;
groups.anchor = createModelGroup(group, groups);
}
else
{
for (let i = 0; i < objects.length; i++)
{
groups[object.name] = createModelGroup(object, groups);
var object = objects[i];

if (object.type === "group")
{
groups[object.name] = createModelGroup(object, groups);
}
}
}

Expand Down Expand Up @@ -584,8 +608,8 @@
title: "BBS Model Ex/importer",
author: "McHorse",
description: "Adds actions to export/import models in BBS format, which is used by BBS machinima studio.",
icon: "fa-file-export",
version: "1.2.2",
icon: "icon.png",
version: "1.2.3",
min_version: "4.8.0",
variant: "both",
has_changelog: true,
Expand Down
13 changes: 13 additions & 0 deletions plugins/bbs_exporter/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,18 @@
]
}
]
},
"1.2.3": {
"title": "1.2.3",
"date": "2024-05-21",
"author": "McHorse",
"categories": [
{
"title": "Enhancements",
"list": [
"When exporting the model that has no groups, a single group called anchor will be added to successfully export the model without groups"
]
}
]
}
}
Loading