void UMaterialGraphNode_Base::AllocateDefaultPins() { check(Pins.Num() == 0); CreateInputPins(); CreateOutputPins(); }
void UK2Node_GetClassDefaults::OnClassPinChanged() { TArray<UEdGraphPin*> OldPins = Pins; TArray<UEdGraphPin*> OldOutputPins; // Gather all current output pins for(int32 PinIndex = 0; PinIndex < OldPins.Num(); ++PinIndex) { UEdGraphPin* OldPin = OldPins[PinIndex]; if(OldPin->Direction == EGPD_Output) { Pins.Remove(OldPin); OldOutputPins.Add(OldPin); } } // Clear the current output pin settings (so they don't carry over to the new set) ShowPinForProperties.Empty(); // Create output pins for the new class type UClass* InputClass = GetInputClass(); CreateOutputPins(InputClass); // Destroy the previous set of output pins DestroyPinList(OldOutputPins); // Notify the graph that the node has been changed if(UEdGraph* Graph = GetGraph()) { Graph->NotifyGraphChanged(); } }
tResult StateControllerNew::Init(cFilter::tInitStage eStage, IException **__exception_ptr) { RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr)); if (StageFirst == eStage) { RETURN_IF_FAILED(CreateDescriptions(__exception_ptr)); RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); } else if (StageNormal == eStage) { controllerMode = static_cast<tControllerMode::ControllerModeEnum>(GetPropertyInt(CONTROLLER_MODE_PROPERTY)); logger.Log(cString::Format("StateController running in %s mode.", tControllerMode::ToString(controllerMode).c_str()).GetPtr()); if (tControllerMode::Manual == controllerMode && waitTimer == NULL) { tInt waitTime = 500 * 1000; // 500ms interval waitTimer = _kernel->TimerCreate(tTimeStamp(waitTime), 0, static_cast<IRunnable *>(this), NULL, NULL, 0, 0, cString::Format("%s.timer", OIGetInstanceName())); } } else if (StageGraphReady == eStage) { currentManeuverID = 0; sectionListIndex = -1; maneuverListIndex = -1; SetState(tCarState::Startup); } RETURN_NOERROR; }
//############################################################################# tResult cMovementAnalyzer::Init(tInitStage eStage, ucom::IException **__exception_ptr) { switch (eStage) { case StageFirst: { // create pins RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); break; } case StageNormal: { break; } case StageGraphReady: { m_bIDsSignalSet = tFalse; break; } } RETURN_NOERROR; }
void UK2Node_GetClassDefaults::ReallocatePinsDuringReconstruction(TArray<UEdGraphPin*>& OldPins) { Super::ReallocatePinsDuringReconstruction(OldPins); // Recreate output pins based on the previous input class UEdGraphPin* OldClassPin = FindClassPin(OldPins); if(UClass* InputClass = GetInputClass(OldClassPin)) { CreateOutputPins(InputClass); } }
void UAnimGraphNode_Base::InternalPinCreation(TArray<UEdGraphPin*>* OldPins) { // preload required assets first before creating pins PreloadRequiredAssets(); const UAnimationGraphSchema* Schema = GetDefault<UAnimationGraphSchema>(); if (const UStructProperty* NodeStruct = GetFNodeProperty()) { // Display any currently visible optional pins { FA3NodeOptionalPinManager OptionalPinManager(this, OldPins); OptionalPinManager.AllocateDefaultPins(NodeStruct->Struct, NodeStruct->ContainerPtrToValuePtr<uint8>(this)); } // Create the output pin, if needed CreateOutputPins(); } }
tResult LightMessageLogger::Init(tInitStage eStage, __exception) { RETURN_IF_FAILED(cAsyncDataTriggeredFilter::Init(eStage, __exception_ptr)); if (eStage == StageFirst) { RETURN_IF_FAILED(tActionStruct_object.StageFirst(__exception_ptr)); RETURN_IF_FAILED(tFeedbackStruct_object.StageFirst(__exception_ptr)); // create and register the input and output pin RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); } else if (eStage == StageNormal) { /* read property whether debug mode is required */ debugModeEnabled = tBool(GetPropertyBool(LMLO_DEBUG_TO_CONSOLE)); carIsCarOne = tBool(GetPropertyBool(LMLO_CAR_NAME)); // invert car names if protperty is enabled if(!carIsCarOne) { cString tmp_own_car_name = own_car_name; own_car_name = respondent_car_name; respondent_car_name = tmp_own_car_name; } // clear file content logfile_content.content.clear(); new_content_counter = 1; // clear file fstream chat_file; chat_file.open("/home/aadc/AADC/utilities/Kuer/data.json", ios::out | ios::trunc); chat_file << ""; chat_file.close(); } else if (eStage == StageGraphReady) { // get size of media samples that has to be assigned later RETURN_IF_FAILED(tActionStruct_object.StageGraphReady()); RETURN_IF_FAILED(tFeedbackStruct_object.StageGraphReady()); } RETURN_NOERROR; }
tResult FunctionDriver::Init(tInitStage eStage, __exception) { RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr)); if (eStage == StageFirst) { // create all the pins RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); } else if (eStage == StageNormal) { speed = tFloat32(GetPropertyFloat(SPEED_PROPERTY)); sinWidth = tFloat32(GetPropertyFloat(SINWIDTH_PROPERTY)); sinLength = tFloat32(GetPropertyFloat(SINLENGTH_PROPERTY)); } RETURN_NOERROR; }
tResult MarkerEvaluator::Init(tInitStage eStage, __exception) { RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr)); if (eStage == StageFirst) { RETURN_IF_FAILED(CreateDescriptions(__exception_ptr)); RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); } else if (eStage == StageNormal) { } else if (eStage == StageGraphReady) { } RETURN_NOERROR; }
tResult YawToSteer::Init(tInitStage eStage, __exception) { RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr)); if (eStage == StageFirst) { RETURN_IF_FAILED(CreateDescriptions(__exception_ptr)); RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); } else if (eStage == StageNormal) { compensationValue = GetPropertyFloat(STEERING_COMPANSATION_FACTOR_PROPERTY); deviationThreshold = GetPropertyFloat(DEVIATION_THRESHOLD_PROPERTY); abruptVariationThreshold = GetPropertyFloat(ABRUPT_VARIATION_THRESHOLD_PROPERTY); } else if (eStage == StageGraphReady) { m_bIDsSignalSet = tFalse; } RETURN_NOERROR; }
void UK2Node_GetClassDefaults::PostPlacedNewNode() { // Always exclude object array properties for new nodes. // @TODO - Could potentially expose object reference values if/when we have support for 'const' input pins. bExcludeObjectArrays = true; if(UEdGraphPin* ClassPin = FindClassPin(Pins)) { // Default to the owner BP's generated class for "normal" BPs if this is a new node const UBlueprint* OwnerBlueprint = GetBlueprint(); if(OwnerBlueprint != nullptr && OwnerBlueprint->BlueprintType == BPTYPE_Normal) { ClassPin->DefaultObject = OwnerBlueprint->GeneratedClass; } if(UClass* InputClass = GetInputClass(ClassPin)) { CreateOutputPins(InputClass); } } }
tResult TemporalImage::Init(tInitStage eStage, __exception) { RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr)); if (eStage == StageFirst) { RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); } else if (eStage == StageNormal) { bufferSize = tUInt(GetPropertyInt(BUFFER_SIZE_PROPERTY)); method = tUInt8(GetPropertyInt(METHOD_PROPERTY)); buffer = vector<Mat>(bufferSize); for (unsigned int i = 0; i < buffer.size(); ++i) { buffer[i] = Mat(0, 0, 0); } } else if (eStage == StageGraphReady) { cObjectPtr<IMediaType> mediaType; RETURN_IF_FAILED(videoInputPin.GetMediaType(&mediaType)); cObjectPtr<IMediaTypeVideo> videoType; RETURN_IF_FAILED(mediaType->GetInterface(IID_ADTF_MEDIA_TYPE_VIDEO, (tVoid **) &videoType)); videoInputFormat = *(videoType->GetFormat()); videoOutputFormat = *(videoType->GetFormat()); videoOutputPin.SetFormat(&videoOutputFormat, NULL); logger.Log(cString::Format("Input format: %d x %d @ %d Bit", videoInputFormat.nWidth, videoInputFormat.nHeight, videoInputFormat.nBitsPerPixel).GetPtr(), false); logger.Log(cString::Format("Output format: %d x %d @ %d Bit", videoOutputFormat.nWidth, videoOutputFormat.nHeight, videoOutputFormat.nBitsPerPixel).GetPtr(), false); } RETURN_NOERROR; }
tResult ROI::Init(tInitStage eStage, __exception) { RETURN_IF_FAILED(cFilter::Init(eStage, __exception_ptr)); if (eStage == StageFirst) { RETURN_IF_FAILED(InitDescriptions(__exception_ptr)); RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); } else if (eStage == StageNormal) { hoodScanLineNumber = GetPropertyInt(HOOD_SCANLINE_NUMBER_PROPERTY); roomScanLineNumber = GetPropertyInt(ROOM_SCANLINE_NUMBER_PROPERTY); maxHoodDetectionCount = GetPropertyInt(MAX_HOOD_DETECTION_COUNT_PROPERTY); rgbVideoManipulation = GetPropertyInt(RGB_VIDEO_MANIPULATION_PROPERTY); depthVideoManipulation = GetPropertyInt(DEPTH_VIDEO_MANIPULATION_PROPERTY); isHoodDetectionEnabled = GetPropertyBool(DETECT_HOOD_PROPERTY); isRoomDetectionEnabled = GetPropertyBool(DETECT_ROOM_PROPERTY); roomHeightManipulation = GetPropertyFloat(ROOM_HEIGHT_MANIPULATION_PROPERTY); logger.Log(cString::Format("roomHeightManipulation: %d", roomHeightManipulation).GetPtr(), false); logger.Log(cString::Format("hoodScanLineNumber: %d", hoodScanLineNumber).GetPtr(), false); logger.Log(cString::Format("roomScanLineNumber: %d", roomScanLineNumber).GetPtr(), false); logger.Log(cString::Format("processingWidthPercentage: %d", processingWidthPercentage).GetPtr(), false); logger.Log(cString::Format("maxHoodDetectionCount: %d", maxHoodDetectionCount).GetPtr(), false); logger.Log(cString::Format("rgbVideoManipulation: %d", rgbVideoManipulation).GetPtr(), false); logger.Log(cString::Format("depthVideoManipulation: %d", depthVideoManipulation).GetPtr(), false); logger.Log(cString::Format("isHoodDetectionEnabled: %d", isHoodDetectionEnabled).GetPtr(), false); logger.Log(cString::Format("isRoomDetectionEnabled: %d", isRoomDetectionEnabled).GetPtr(), false); } else if (eStage == StageGraphReady) { // init RGB Video cObjectPtr<IMediaType> rgbMediaType; RETURN_IF_FAILED(rgbVideoInputPin.GetMediaType(&rgbMediaType)); cObjectPtr<IMediaTypeVideo> rgbVideoType; RETURN_IF_FAILED(rgbMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_VIDEO, (tVoid **) &rgbVideoType)); rgbVideoInputFormat = *(rgbVideoType->GetFormat()); rgbVideoOutputFormat = *(rgbVideoType->GetFormat()); rgbVideoOutputPin.SetFormat(&rgbVideoOutputFormat, NULL); // init Depth Video cObjectPtr<IMediaType> depthMediaType; RETURN_IF_FAILED(depthVideoInputPin.GetMediaType(&depthMediaType)); cObjectPtr<IMediaTypeVideo> depthVideoType; RETURN_IF_FAILED(depthMediaType->GetInterface(IID_ADTF_MEDIA_TYPE_VIDEO, (tVoid **) &depthVideoType)); depthVideoInputFormat = *(depthVideoType->GetFormat()); depthVideoOutputFormat = *(depthVideoType->GetFormat()); depthVideoOutputPin.SetFormat(&depthVideoOutputFormat, NULL); logger.Log(cString::Format("RGB Input format: %d x %d @ %d Bit", rgbVideoInputFormat.nWidth, rgbVideoInputFormat.nHeight, rgbVideoInputFormat.nBitsPerPixel).GetPtr(), false); logger.Log(cString::Format("RGB Output format: %d x %d @ %d Bit", rgbVideoOutputFormat.nWidth, rgbVideoOutputFormat.nHeight, rgbVideoOutputFormat.nBitsPerPixel).GetPtr(), false); logger.Log(cString::Format("Depth Input format: %d x %d @ %d Bit", depthVideoInputFormat.nWidth, depthVideoInputFormat.nHeight, depthVideoInputFormat.nBitsPerPixel).GetPtr(), false); logger.Log(cString::Format("Depth Output format: %d x %d @ %d Bit", depthVideoOutputFormat.nWidth, depthVideoOutputFormat.nHeight, depthVideoOutputFormat.nBitsPerPixel).GetPtr(), false); if (depthVideoOutputFormat.nBitsPerPixel != 8) { THROW_ERROR_DESC(depthVideoOutputFormat.nBitsPerPixel, "Wrong depth video format. Use HTWK_Grayscale in front of this filter."); } // init processing parameters processingData.processingWidth = depthVideoInputFormat.nWidth * (processingWidthPercentage / 100.0); processingData.startOffset = (depthVideoInputFormat.nWidth - processingData.processingWidth) / 2; processingData.hoodScanLineStepWidth = processingData.processingWidth / (hoodScanLineNumber - 1); processingData.roomScanLineStepWidth = processingData.processingWidth / (roomScanLineNumber - 1); logger.Log(cString::Format("hoodScanLineNumber: %d", hoodScanLineNumber).GetPtr(), false); logger.Log(cString::Format("processingWidthPercentage: %d", processingWidthPercentage).GetPtr(), false); logger.Log(cString::Format("processingWidth: %d", processingData.processingWidth).GetPtr(), false); logger.Log(cString::Format("startOffset: %d", processingData.startOffset).GetPtr(), false); logger.Log(cString::Format("hoodScanLineStepWidth: %d", processingData.hoodScanLineStepWidth).GetPtr(), false); logger.Log(cString::Format("roomScanLineStepWidth: %d", processingData.roomScanLineStepWidth).GetPtr(), false); } RETURN_NOERROR; }
tResult StateControlManagementSlim::Init(tInitStage eStage, __exception) { RETURN_IF_FAILED(cAsyncDataTriggeredFilter::Init(eStage, __exception_ptr)); // pins need to be created at StageFirst if (eStage == StageFirst) { //LOG_WARNING("StateControlManagement: StageFirst;"); /* get Information regarding input and output pins for specific types */ RETURN_IF_FAILED(TActionStruct_object.StageFirst(__exception_ptr)); RETURN_IF_FAILED(TFeedbackStruct_object.StageFirst(__exception_ptr)); // create and register the input pin RETURN_IF_FAILED(CreateInputPins(__exception_ptr)); RETURN_IF_FAILED(CreateOutputPins(__exception_ptr)); m_bDebugModeEnabled = GetPropertyBool("Debug Output to Console"); #ifdef WRITE_DEBUG_OUTPUT_TO_FILE // creating logfile log file for SCM //LOG_WARNING("SCM: debug mode: 'logging' for scm-data enabled, writing to /opt/scm_log-'date-and-time'.log"); time_t rawtime; struct tm * timeinfo; time(&rawtime); timeinfo = localtime(&rawtime); // cString fileDate = cString(asctime(timeinfo)); // fileDate.Replace(" ", "_"); // fileDate.Replace(":", "_"); // cString logFilename = "/opt/scm_log_" + fileDate + ".log"; // logFilename.Replace("\n", ""); // scm_logfile.open(logFilename, ios::out | ios::trunc); // scm_logfile << "# SCM data log, recorded at: " << asctime(timeinfo) << std::endl; //scm_logfile.close(); size_t N = 80; char dateAndTime[N]; strftime(dateAndTime, N, "%Y_%m_%d-%H_%M_%S", timeinfo); cString dateAndTime_str = cString(dateAndTime); cString logFilename = "/opt/scm_log_" + cString(dateAndTime) + ".log"; logFilename.Replace("\n", ""); LOG_WARNING("SCM: debug mode: 'logging' for scm-data enabled, writing to '" + logFilename + "'."); scm_logfile.open(logFilename, ios::out | ios::trunc); scm_logfile << "# SCM data log, recorded at: " << asctime(timeinfo) << std::endl; #endif /* StateController Management*/ i16CurrentScmManeuverID = -1; i16CurrentScmStepID = -1; i8CurrentActLvlMode = NOT_INITIALIZED; } else if (eStage == StageNormal) { //LOG_WARNING("StateControlManagement: StageNormal;"); m_bPrintStrucModeEnabled = GetPropertyBool("Print Structure to Console"); // load xml files for defining the structure of the StateController tResult scmLoadstate = LoadSCMStructureData(); if(scmLoadstate < 0) { LOG_ERROR(adtf_util::cString::Format("SCM: Structure could not be loaded!")); } THROW_IF_FAILED(scmLoadstate); if(m_bDebugModeEnabled && scmLoadstate == 0){ LOG_WARNING(adtf_util::cString::Format("SCM: Structure loaded successfully!")); } /* Initialization of SCM after successfully loading structure*/ i16CurrentScmManeuverID = 0; i16CurrentScmStepID = 0; /* START StateControl Management in startup-state, wait for first PASSIVE request to start, * e.g. verification of loaded maneuver list from JuryCommunication */ i8CurrentActLvlMode = PASSIVE; if(m_bDebugModeEnabled) LOG_WARNING(adtf_util::cString::Format("SCM: initialized maneuverID, stepID and actLvlmode:Passive")); } else if(eStage == StageGraphReady) { //LOG_WARNING("StateControlManagement: StageGraphReady;"); // IDs for ActionStruct and FeedbackStruct are set RETURN_IF_FAILED(TActionStruct_object.StageGraphReady()); RETURN_IF_FAILED(TFeedbackStruct_object.StageGraphReady()); /* START StateControl Management in startup-state (maneuver 0, step 0) in passive mode, wait for response from JCom * that maneuver list was successfully loaded */ if(m_bDebugModeEnabled) LOG_WARNING(adtf_util::cString::Format("SCM: waiting for feedback from JCom regarding loaded maneuverlist.")); } RETURN_NOERROR; }