MCPcopy Create free account
hub / github.com/chrxh/alien / processNode

Method processNode

source/Gui/GenomeEditorWindow.cpp:506–779  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506void GenomeEditorWindow::processNode(
507 TabData& tab,
508 CellGenomeDescription& cell,
509 std::optional<ShapeGeneratorResult> const& shapeGeneratorResult,
510 bool isFirst,
511 bool isLast)
512{
513 auto type = cell.getCellFunctionType();
514 auto isFirstOrLast = isFirst || isLast;
515
516 AlienImGui::DynamicTableLayout table(DynamicTableColumnWidth);
517 if (table.begin()) {
518 if (AlienImGui::CellFunctionCombo(
519 AlienImGui::CellFunctionComboParameters().name("Function").textWidth(ContentTextWidth).tooltip(Const::getCellFunctionTooltip(type)), type)) {
520 applyNewCellFunction(cell, type);
521 }
522 table.next();
523 AlienImGui::ComboColor(AlienImGui::ComboColorParameters().name("Color").textWidth(ContentTextWidth).tooltip(Const::GenomeColorTooltip), cell.color);
524 if (!isFirstOrLast) {
525 table.next();
526 auto referenceAngle = shapeGeneratorResult ? shapeGeneratorResult->angle : cell.referenceAngle;
527 if (AlienImGui::InputFloat(
528 AlienImGui::InputFloatParameters().name("Angle").textWidth(ContentTextWidth).format("%.1f").tooltip(Const::GenomeAngleTooltip), referenceAngle)) {
529 updateGeometry(tab.genome, tab.genome.header.shape);
530 tab.genome.header.shape = ConstructionShape_Custom;
531 }
532 cell.referenceAngle = referenceAngle;
533 }
534 table.next();
535 AlienImGui::InputFloat(
536 AlienImGui::InputFloatParameters().name("Energy").textWidth(ContentTextWidth).format("%.1f").tooltip(Const::GenomeEnergyTooltip), cell.energy);
537 table.next();
538 AlienImGui::InputInt(
539 AlienImGui::InputIntParameters().name("Execution number").textWidth(ContentTextWidth).tooltip(Const::GenomeExecutionNumberTooltip),
540 cell.executionOrderNumber);
541 table.next();
542 AlienImGui::InputOptionalInt(
543 AlienImGui::InputIntParameters().name("Input execution number").textWidth(ContentTextWidth).tooltip(Const::GenomeInputExecutionNumberTooltip),
544 cell.inputExecutionOrderNumber);
545 table.next();
546 AlienImGui::Checkbox(
547 AlienImGui::CheckboxParameters().name("Block output").textWidth(ContentTextWidth).tooltip(Const::GenomeBlockOutputTooltip), cell.outputBlocked);
548 table.next();
549 auto numRequiredAdditionalConnections =
550 shapeGeneratorResult ? shapeGeneratorResult->numRequiredAdditionalConnections : cell.numRequiredAdditionalConnections;
551 if (!isFirst && numRequiredAdditionalConnections) {
552 numRequiredAdditionalConnections = std::min(*numRequiredAdditionalConnections + 1, MAX_CELL_BONDS);
553 }
554 if (AlienImGui::InputOptionalInt(
555 AlienImGui::InputIntParameters().name("Required connections").textWidth(ContentTextWidth).tooltip(Const::GenomeRequiredConnectionsTooltip),
556 numRequiredAdditionalConnections)) {
557 updateGeometry(tab.genome, tab.genome.header.shape);
558 tab.genome.header.shape = ConstructionShape_Custom;
559 }
560 if (!isFirst && numRequiredAdditionalConnections) {
561 numRequiredAdditionalConnections = *numRequiredAdditionalConnections - 1;
562 }
563 cell.numRequiredAdditionalConnections = numRequiredAdditionalConnections;

Callers

nothing calls this directly

Calls 14

getCellFunctionTooltipFunction · 0.85
applyNewCellFunctionFunction · 0.85
InputIntParametersClass · 0.85
CheckboxParametersClass · 0.85
ComboParametersClass · 0.85
beginMethod · 0.80
nextMethod · 0.80
formatMethod · 0.80

Tested by

no test coverage detected