Announcement

Collapse
No announcement yet.

controlling image scale properties in a script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • controlling image scale properties in a script

    Hello and thank you for any help,


    I have a TripleEditor to control the scaling of an image, I have the following script, but it doesn't have any effect once I change the values
    the sub is attached to the events of the tripleEditor, I plugged in the sub on all three on value changed and still nothing, if someone could please shed some light as to what i am doing wrong

    Code:
    Sub OTSImageScaleLimits(Sender)
        imageXval = CInt(T18OTSImageScale.XValue)
        imageYval = CInt(T18OTSImageScale.YValue)
        If imageXval < 1 then
            T18OTSImageScale.XValue = "1"
        End If
        If imageYval < 1 then
            T18OTSImageScale.YValue = "1"
        End If
    End Sub

    Gracias






  • #2
    Did you try the ImageProportions plugin? that can save you some time.
    ChrisFlye made this baby for us some time ago and we use that for Social Media content to get the proportions right on the various images.
    Hope this helps.
    Code:
    sub OnInitParameters()
        RegisterPushButton("aspect", "ASPECT", 1)
    end sub
    
    sub OnExecAction(IButton as integer)
        test_aspect
    end sub
    
    sub test_aspect()
            dim retval as array[string]
            dim ret as string
            dim xnew as double
            dim ynew as double
            dim c as container = this
            
                    'command to get the actual image values
                    ret= sendcommand("#"&c.texture.vizid&"*INFO GET")
                
                    'split x and y into array
                    ret.split(" ",retval)
                    dim x= Cdbl(retval[0])
                    dim y= Cdbl(retval[1])
            
                if x > y then
                    'width greater than length is landscape
                    xnew = 1.0
                    ynew = y / x
    
                elseif x < y then
                    'length greater than width is portrait
                    xnew = x / y
                    ynew = 1.0
    
                else
                    'otherwise image is square
                    xnew = 1.0
                    ynew = 1.0    
    
                end if
                    c.scaling.x = xnew
                    c.scaling.y = ynew
                    
                    println x
                    println y
    end sub
    
    sub oninit()
        test_aspect()
    end sub

    Comment


    • #3
      Hi Lars,

      Is this script used with a shape and vertex mapped? When i run it with just an image and the script it looks like the image is getting squeezed? For example a 1920x1080 image gets squeezed from the top so the aspect is off.

      Comment


      • #4
        We have a noggi with a fixed size, this acts as my boundry for max X and max Y size. The size of the texture is then Vertex mapped and resize based on the aspect.
        Aspect.PNG

        Comment

        Working...
        X