Hi Salvador,
I just reviewed your project, and from what I understand, you want to retrieve the content of a text field from a previous scene in the sequencer. This approach can be quite complex to implement. Instead, I recommend using a dedicated "control" scene where you can centrally read or write the score you need.
Here's an example to illustrate this approach :
' -- Initialization
Dim myOutput As xpOutputFrameBuffer
Dim mySceneControle As xpScene
Dim myControlText As xpTextObject
Dim mySceneText As xpTextObject
Dim baseObj As xpBaseObject
Dim controlObj As xpBaseObject
Dim myTakeItem As xpTakeItem
Dim myResult As Boolean
Dim i As Integer
' -- Get the FrameBuffer used by the current scene
Self.GetTakeItem(myTakeItem)
Dim fbIndex As Integer = myTakeItem.FrameBufferIndex()
Engine.GetOutputFramebuffer(fbIndex, myOutput)
' -- Check if the ControleScore scene is present on layer 10
myResult = myOutput.GetSceneOnLayer(10, mySceneControle)
Engine.WriteToLog("Control scene present on layer 10? " & myResult)
If myResult Then
For i = 0 To 9
' Look for the score object in the control scene
myResult = mySceneControle.GetObjectByName("CumulativeScoreStore" & i, controlObj)
If myResult Then
myControlText = CType(controlObj, xpTextObject)
' Look for the score object in the current scene
myResult = Self.GetObjectByName("BaseScore" & i, baseObj)
If myResult Then
mySceneText = CType(baseObj, xpTextObject)
mySceneText.Text = myControlText.Text
Engine.WriteToLog("BaseScore" & i & " updated with " & myControlText.Text)
Else
Engine.WriteToLog("BaseScore" & i & " object not found in Scorekaart2.")
End If
Else
Engine.WriteToLog("CumulativeScoreStore" & i & " object not found in ControleScore.")
End If
Next
Else
Engine.WriteToLog("⚠ ControleScore scene missing from layer 10.")
End If
------------------------------
Alan LAMY
Intégrateur graphique
Paris France
------------------------------
-------------------------------------------
Message d'origine:
Envoyé: 06-02-2025 15:48
Depuis: sal roy
Sujet: Using Framebuffer to get previous Scene Score information.
Hi,
I am trying to get a value from a previous scene Text object named CumulativeScoreStore and add that to the text object value for BaseScore in the current scene.
I tried different methods(FrameBuffer, TakeID etc.) but can'y seem to get it to work. Any help would sincerely be appreciated. Below some codes that i have tried.
Thanks
Salvador
Dim sequencer As xpSequencer sequencer = Engine.Sequencer Dim currentTakeItem As xpTakeItem currentTakeItem = sequencer.GetTakeItem(sequencer.GetTakeID()) Dim currentIndex As Integer currentIndex = sequencer.GetTakeItemIndex(currentTakeItem) If currentIndex > 0 Then Dim previousTakeItem As xpTakeItem previousTakeItem = sequencer.GetTakeItem(currentIndex - 1) Dim previousScene As xpScene previousScene = previousTakeItem.GetScene() Dim cumulativeScoreText As xpTextObject previousScene.GetObjectByName("cumulativeScore", cumulativeScoreText) Dim cumulativeScore As Integer cumulativeScore = CInt(cumulativeScoreText.Text) Dim baseScoreText As xpTextObject Self.GetObjectByName("BaseScore0", baseScoreText) baseScoreText.Text = CStr(cumulativeScore) End If
also tried
Dim sourceFB As xpOutputFrameBuffer Dim targetFB As xpOutputFrameBuffer Dim sourceScene As xpScene Dim targetScene As xpScene Dim sourceObj As xpTextObject Dim targetObj As xpTextObject ' Get FrameBuffer 5 (index 4) as source If Not Engine.GetOutputFrameBuffer(4, sourceFB) Then Engine.DebugMessage("Error: Couldn't access source FrameBuffer", 0) Exit Sub End If ' Get FrameBuffer 5 (index 4) as target If Not Engine.GetOutputFrameBuffer(4, targetFB) Then Engine.DebugMessage("Error: Couldn't access target FrameBuffer", 0) Exit Sub End If ' Get scenes from both FrameBuffers sourceScene = sourceFB.Scene targetScene = targetFB.Scene If sourceScene Is Nothing Or targetScene Is Nothing Then Engine.DebugMessage("Error: Missing scene on one of the FrameBuffers", 0) Exit Sub End If ' Transfer score value If sourceScene.GetObjectByName("CumulativeScoreStore0", sourceObj) And _ targetScene.GetObjectByName("BaseScore0", targetObj) Then targetObj.Text = "TEST!" End If
and tried
Dim prevScene As xpSceneDim prevObj As xpBaseObjectDim curObj As xpBaseObjectDim prevText As xpTextObjectDim curText As xpTextObjectDim i As IntegerDim val As IntegerDim success As Boolean' Get the previous scene in the sequencerIf Self.GetTakeItemByIndex( -1 , PrevScene) Then Self.LogMessage("Previous scene found.") For i = 0 To 9 ' Get CumulativeScoreStore from previous scene success = prevScene.GetObjectByName("CumulativeScoreStore" & i, prevObj) If success Then prevText = CType(prevObj, xpTextObject) val = CInt(prevText.Text) ' Set BaseScore in current scene success = Self.GetObjectByName("BaseScore" & i, curObj) If success Then curText = CType(curObj, xpTextObject) curText.Text = val.ToString() Self.LogMessage("Copied CumulativeScoreStore" & i & " (" & val & ") to BaseScore" & i) Else Self.LogMessage("BaseScore" & i & " not found in current scene.") End If Else Self.LogMessage("CumulativeScoreStore" & i & " not found in previous scene.") End If NextElse Self.LogMessage("No previous scene found.")End IfIf IsNumeric(prevText.Text) Then val = CInt(prevText.Text)Else Self.LogMessage("Invalid value in previous scene for CumulativeScoreStore" & i & ": " & prevText.Text) val = 0End If
------------------------------
Salvador Rooijmans
Multi Media Designer
DMDesign
Willemstad, Curacao
------------------------------