Graphics

 View Only
  • 1.  Using Framebuffer to get previous Scene Score information.

    Posted 06-04-2025 08:48
      |   view attached

    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 xpScene
    Dim prevObj As xpBaseObject
    Dim curObj As xpBaseObject
    Dim prevText As xpTextObject
    Dim curText As xpTextObject
    Dim i As Integer
    Dim val As Integer
    Dim success As Boolean
    
    ' Get the previous scene in the sequencer
    If 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
        Next
    Else
        Self.LogMessage("No previous scene found.")
    End If
    
    If IsNumeric(prevText.Text) Then
        val = CInt(prevText.Text)
    Else
        Self.LogMessage("Invalid value in previous scene for CumulativeScoreStore" & i & ": " & prevText.Text)
        val = 0
    End If


    ------------------------------
    Salvador Rooijmans
    Multi Media Designer
    DMDesign
    Willemstad, Curacao
    ------------------------------

    Attachment(s)

    xpp
    SFD_2025.xpp   1.20 MB 1 version


  • 2.  RE: Using Framebuffer to get previous Scene Score information.

    Posted 07-02-2025 09:39

    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
    ------------------------------


  • 3.  RE: Using Framebuffer to get previous Scene Score information.

    Posted 07-03-2025 05:23

    Hi.
    Try this script. Set it into OnBeforOnline

            Dim fb As xpOutputFrameBuffer
            engine.GetOutputFrameBuffer(FramebufferIndex, fb)
            Dim sourceScene As xpScene
            If fb.GetSceneOnLayer(Layer, sourceScene) Then
                If self.Name = sourceScene.Name Then
                    Dim sourceObj As xpTextObject
                    Dim targetObj As xpTextObject
                    For i As Integer = 0 To 4
                        sourceScene.GetObjectByName("CumulativeScoreStore" & CStr(i), sourceObj)
                        self.GetObjectByName("BaseScore" & CStr(i), targetObj)
                        targetObj.Text = sourceObj.Text
                    Next
                End If
            End If


    ------------------------------
    Roman Yaroshenko
    chief specialist
    RBC-TV
    Moscow Russian Federation
    ------------------------------