Skip to content

Commit

Permalink
Merge pull request #638 from ICRAR/eagle-1145
Browse files Browse the repository at this point in the history
added a new setting for the changing of node categories
  • Loading branch information
M-Wicenec authored Oct 12, 2023
2 parents fe26bd5 + 591d8d7 commit 35909fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/Setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export class Setting {
static readonly SNAP_TO_GRID: string = "SnapToGrid";
static readonly SNAP_TO_GRID_SIZE: string = "SnapToGridSize";
static readonly SHOW_INSPECTOR_WARNINGS: string = "ShowInspectorWarnings";
static readonly SHOW_ALL_CATEGORY_OPTIONS: string = "ShowAllCategoryOptions";
}

export namespace Setting {
Expand Down Expand Up @@ -402,6 +403,7 @@ const settings : SettingsGroup[] = [
new Setting(true, "Create Applications for Construct Ports", Setting.CREATE_APPLICATIONS_FOR_CONSTRUCT_PORTS, "When loading old graph files with ports on construct nodes, move the port to an embedded application",false, Setting.Type.Boolean, true,true,true, true, true),
new Setting(true, "Skip 'closes loop' edges in JSON output", Setting.SKIP_CLOSE_LOOP_EDGES, "We've recently added edges to the LinkDataArray that 'close' loop constructs and set the 'group_start' and 'group_end' automatically. In the short-term, such edges are not supported by the translator. This setting will keep the new edges during saving/loading, but remove them before sending the graph to the translator.", false, Setting.Type.Boolean, true, true, true,true,true),
new Setting(true, "Print Undo state to JS Console", Setting.PRINT_UNDO_STATE_TO_JS_CONSOLE, "Prints the state of the undo memory whenever a change occurs. The state is written to the browser's javascript console", false, Setting.Type.Boolean, false,false ,false, false, false),
new Setting(true, "Display all Category options", Setting.SHOW_ALL_CATEGORY_OPTIONS, "Displays all category options when changing the category of a node", false, Setting.Type.Boolean, false,false ,false, false, false),
]
)
];
25 changes: 15 additions & 10 deletions src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1081,19 +1081,24 @@ export class Utils {
const result: Category[] = [];
for (const [categoryName, categoryData] of Object.entries(CategoryData.cData)){

if (categoryData.categoryType !== categoryType){
continue;
}

// if input ports required, skip nodes with too few
if (numRequiredInputs > categoryData.maxInputs){
continue;
}
if(!Setting.findValue(Setting.SHOW_ALL_CATEGORY_OPTIONS)){

if (categoryData.categoryType !== categoryType){
continue;
}

// if input ports required, skip nodes with too few
if (numRequiredInputs > categoryData.maxInputs){
continue;
}

// if output ports required, skip nodes with too few
if (numRequiredOutputs > categoryData.maxOutputs){
continue;
// if output ports required, skip nodes with too few
if (numRequiredOutputs > categoryData.maxOutputs){
continue;
}
}

result.push(categoryName as Category);
}

Expand Down

0 comments on commit 35909fc

Please sign in to comment.