diff --git a/source/EngineGpuKernels/CellFunctionProcessor.cuh b/source/EngineGpuKernels/CellFunctionProcessor.cuh index e39d43fc4..34f807351 100644 --- a/source/EngineGpuKernels/CellFunctionProcessor.cuh +++ b/source/EngineGpuKernels/CellFunctionProcessor.cuh @@ -87,9 +87,10 @@ __inline__ __device__ void CellFunctionProcessor::resetFetchedActivities(Simulat auto otherExecutionOrderNumber = cell->connections[i].cell->executionOrderNumber; auto otherInputExecutionOrderNumber = cell->connections[i].cell->inputExecutionOrderNumber; auto otherOutputBlocked = cell->connections[i].cell->outputBlocked; - bool flowToCell = - cell->inputExecutionOrderNumber == otherExecutionOrderNumber && !otherOutputBlocked - && cell->executionOrderNumber > otherInputExecutionOrderNumber; + bool flowToCell = !(cudaSimulationParameters.features.legacyModes && cudaSimulationParameters.legacyCellDirectionalConnection) + ? cell->inputExecutionOrderNumber == otherExecutionOrderNumber && !otherOutputBlocked + && cell->executionOrderNumber > otherInputExecutionOrderNumber + : false; if (otherInputExecutionOrderNumber == cell->executionOrderNumber && !flowToCell) { if (maxOtherExecutionOrderNumber == -1) { maxOtherExecutionOrderNumber = otherExecutionOrderNumber; @@ -134,8 +135,8 @@ __inline__ __device__ Activity CellFunctionProcessor::calcInputActivity(Cell* ce if (connectedCell->outputBlocked || connectedCell->livingState != LivingState_Ready ) { continue; } - if (connectedCell->inputExecutionOrderNumber == cell->executionOrderNumber && connectedCell->executionOrderNumber > cell->executionOrderNumber - && !cell->outputBlocked) { + if (!(cudaSimulationParameters.features.legacyModes && cudaSimulationParameters.legacyCellDirectionalConnection) && connectedCell->inputExecutionOrderNumber == cell->executionOrderNumber + && connectedCell->executionOrderNumber > cell->executionOrderNumber && !cell->outputBlocked) { continue; } if (connectedCell->executionOrderNumber == cell->inputExecutionOrderNumber) { diff --git a/source/EngineGpuKernels/MuscleProcessor.cuh b/source/EngineGpuKernels/MuscleProcessor.cuh index d3817dc8b..26169f4ab 100644 --- a/source/EngineGpuKernels/MuscleProcessor.cuh +++ b/source/EngineGpuKernels/MuscleProcessor.cuh @@ -118,7 +118,7 @@ __device__ __inline__ void MuscleProcessor::movement(SimulationData& data, Simul cell->vel += direction; cell->cellFunctionData.muscle.lastMovementX = direction.x; cell->cellFunctionData.muscle.lastMovementY = direction.y; - if (!cudaSimulationParameters.features.legacyModes || !cudaSimulationParameters.legacyCellFunctionMuscleNoActivityReset) { + if (!(cudaSimulationParameters.features.legacyModes && cudaSimulationParameters.legacyCellFunctionMuscleNoActivityReset)) { activity.channels[0] = 0; activity.origin = ActivityOrigin_Unknown; } diff --git a/source/EngineInterface/LegacyAuxiliaryDataParserService.cpp b/source/EngineInterface/LegacyAuxiliaryDataParserService.cpp index cdc9e9937..c94dcb80e 100644 --- a/source/EngineInterface/LegacyAuxiliaryDataParserService.cpp +++ b/source/EngineInterface/LegacyAuxiliaryDataParserService.cpp @@ -173,6 +173,7 @@ void LegacyAuxiliaryDataParserService::activateParametersAndFeaturesForLegacyFil if (programVersion.empty()) { parameters.features.legacyModes = true; parameters.legacyCellFunctionMuscleNoActivityReset = true; + parameters.legacyCellDirectionalConnection = true; } //******************* diff --git a/source/EngineInterface/SimulationParameters.cpp b/source/EngineInterface/SimulationParameters.cpp index 398048a74..11a22430a 100644 --- a/source/EngineInterface/SimulationParameters.cpp +++ b/source/EngineInterface/SimulationParameters.cpp @@ -204,5 +204,6 @@ bool SimulationParameters::operator==(SimulationParameters const& other) const && legacyCellFunctionMuscleMovementAngleFromSensor == other.legacyCellFunctionMuscleMovementAngleFromSensor && muscleMovementVisualization == other.muscleMovementVisualization && legacyCellFunctionMuscleNoActivityReset == other.legacyCellFunctionMuscleNoActivityReset + && legacyCellDirectionalConnection == other.legacyCellDirectionalConnection ; } \ No newline at end of file diff --git a/source/EngineInterface/SimulationParameters.h b/source/EngineInterface/SimulationParameters.h index 37548fe63..6760f71a0 100644 --- a/source/EngineInterface/SimulationParameters.h +++ b/source/EngineInterface/SimulationParameters.h @@ -204,6 +204,7 @@ struct SimulationParameters bool legacyCellFunctionMuscleMovementAngleFromSensor = false; bool legacyCellFunctionMuscleNoActivityReset = false; + bool legacyCellDirectionalConnection = false; bool operator==(SimulationParameters const& other) const; bool operator!=(SimulationParameters const& other) const { return !operator==(other); } diff --git a/source/Gui/SimulationParametersWindow.cpp b/source/Gui/SimulationParametersWindow.cpp index 1e42f4200..74f73fc62 100644 --- a/source/Gui/SimulationParametersWindow.cpp +++ b/source/Gui/SimulationParametersWindow.cpp @@ -1592,6 +1592,13 @@ void _SimulationParametersWindow::processBase() .tooltip("If activated, the activity in channel #0 is not set to 0 in muscle cells which are in movement mode. Thus the output of this type " "of muscles can be reused for other muscle cells."), parameters.legacyCellFunctionMuscleNoActivityReset); + AlienImGui::Checkbox( + AlienImGui::CheckboxParameters() + .name("Allow bidirectional connections") + .textWidth(RightColumnWidth) + .defaultValue(origParameters.legacyCellDirectionalConnection) + .tooltip("If activated, two connected cells can receive each other's input if the 'input execution number' matches."), + parameters.legacyCellDirectionalConnection); AlienImGui::EndTreeNode(); } }