mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-03-08 01:53:30 +01:00
fix: Change "dynamicports" in "nodelibrary.json" output to be simpler
This commit is contained in:
@@ -1167,6 +1167,24 @@ EventDispatcher.instance.on(
|
|||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
function mapNodeType(value) {
|
||||||
|
const dto = { ...value };
|
||||||
|
|
||||||
|
if (value.dynamicports) {
|
||||||
|
dto.dynamicports = value.dynamicports.map((rule) => {
|
||||||
|
if (['conditionalports/basic', 'conditionalports/extended'].includes(rule.name)) {
|
||||||
|
return {
|
||||||
|
condition: rule.condition,
|
||||||
|
inputs: rule.ports.map((port) => port.name)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return rule;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
NodeLibrary.instance.on('libraryUpdated', () => {
|
NodeLibrary.instance.on('libraryUpdated', () => {
|
||||||
const library = NodeLibrary.instance.library;
|
const library = NodeLibrary.instance.library;
|
||||||
|
|
||||||
@@ -1177,7 +1195,7 @@ NodeLibrary.instance.on('libraryUpdated', () => {
|
|||||||
const compactLibrary = {
|
const compactLibrary = {
|
||||||
typecasts: library.typecasts,
|
typecasts: library.typecasts,
|
||||||
dynamicports: library.dynamicports,
|
dynamicports: library.dynamicports,
|
||||||
nodetypes: library.nodetypes,
|
nodetypes: library.nodetypes.map(mapNodeType),
|
||||||
// NOTE: Let's save the node index for now, most likely this is something we will just ignore.
|
// NOTE: Let's save the node index for now, most likely this is something we will just ignore.
|
||||||
nodeIndex: library.nodeIndex,
|
nodeIndex: library.nodeIndex,
|
||||||
projectsettings: library.projectsettings
|
projectsettings: library.projectsettings
|
||||||
|
|||||||
Reference in New Issue
Block a user