Skip to content

Add a ExtCam dedicated pageHandler to dynamically display camera's ID/Name#179

Open
nico97118 wants to merge 2 commits into
FirstPersonKSP:masterfrom
nico97118:work/jsisteerablecam_public_getters
Open

Add a ExtCam dedicated pageHandler to dynamically display camera's ID/Name#179
nico97118 wants to merge 2 commits into
FirstPersonKSP:masterfrom
nico97118:work/jsisteerablecam_public_getters

Conversation

@nico97118
Copy link
Copy Markdown

@nico97118 nico97118 commented May 9, 2026

I've seen some commented code that were trying to set the camera ID in a persistent variable.
I assume this was motivated by the idea to display the camera ID in MFDs

I've tried to play a bit around this topic and I figure out there were no easy way to access camera's ID or Transform from the text overlay. This brings up issue of finding the right persistent variable (or plugin getter) when several MFDs exists in the scene (almost every time, actually).

Therefore, after digging a bit. I changed the strategy :
I created another module meant to be used as a pageHandler. In Addition with the existing JSISteerableCamera module used as backgroudHandler

  • It is still possible to use the previously used textOverlay.
  • It is possible to forward the previously used textOverlay to the pageHandler (JSICameraStatusPage') to keep the flexibility provided by text overlays -> This will search and replace the CameraStatusToken(.i.e."CAMERA_STATUS"`) in the overlay with the actual camera name or ID, depending on the configuration of the module.
  • If the internal module JSICameraStatusPage is used in a page, it override the text =attribute of this page.

I'm aware that this PR might not be as clean as I wish since I'm not really experienced in KSP modding. But I'm feeling this might be a good starting point for discussions. And see if such a feature would interest anyone.

Exemple


Here is a config extract for an MFD (ALCORMFD40x20) :

// --------------------Page 07	'External Cameras'----------------------------------------

		PAGE
		{
			name = pExtCam-1-40x20
			button = buttonR7
			textureInterlayURL = ASET/ASET_Props/MFDs/ALCORMFD40x20/bg01
			// text = ASET/ASET_Props/MFDs/ALCORMFD40x20/ALCORExtraCamsOverlay.txt			
			PAGEHANDLER
			{
				name = JSICameraStatusPage
				method = ShowStatus
				getHandlerReferencesMethod = GetHandlerReferences
				overlayTemplatePath = ASET/ASET_Props/MFDs/ALCORMFD40x20/ALCORExtraCamsOverlay.txt	
				prefix = 
				idLabel = ID
				nameLabel = Camera
				unknownText = N/A
				showId = false
				showName = true
			}
			BACKGROUNDHANDLER
			{
				name = JSISteerableCamera
				method = RenderCamera
				pageActiveMethod = PageActive
				cameraInfoVarName = EXTcam
				skipMissingCameras = true
				showNoSignal = yes
				buttonClickMethod = ClickProcessor
				buttonReleaseMethod = ReleaseProcessor
				cameraTransform = ExtCam1|ExtCam2|ExtCam3|ExtCam4|ExtCam5|ExtCam6|ExtCam7|ExtCam8|ALCORExt_A_CamTransform|ALCORExt_B_CamTransform|ALCORExt_C_CamTransform|ALCORExt_D_CamTransform|ALCORExt_E_CamTransform
				fovLimits = 90,5|90,5|90,5|90,5|90,5|90,5|90,5|90,5|90,15|90,15|110,5|110,5|90,5
				{...}
			}
		} 

Notice that I commented the original text field (but I could left it as is, since it is override by the pageHandler.
Also, note that I copied its path to forward it to JSICameraStatusPage through overlayTemplatePath so my display stays the same.

I only added __CAMERA_STATUS__ in the overlay orignal fine at the place I wanted to display the camera's name.

@nico97118
Copy link
Copy Markdown
Author

Hi @JonnyOThan

I just found out the latest release of this project was made on the branch mechjeb and not on master.
I must admit it is a bit confusing for me. Is the branch mechjeb a feature branch that you plan to merge on master at some point ?

Shall I rebase this PR on mechjeb branch ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant