1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] UI - Adjusting Frames

Discussion in 'Triggers & Scripts' started by xorkatoss, Dec 4, 2019 at 5:55 PM.

  1. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,527
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    Hello everybody, I began trying to create a custom UI for my map and I have stumbled upon a wall quite early in the process.

    I moved the Unit Portrait (aka ORIGIN_FRAME_PORTRAIT ) to the top left and I made a border and background to go along with it.

    The problem I have is that the 3D model keeps going through the background and it just won't work.

    heroport.gif

    Code (vJASS):
    function Trig_GameUI_Init_Actions takes nothing returns nothing

        local framehandle port = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0)

        call BlzHideOriginFrames(true)
        call BlzFrameSetAllPoints(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0))

        call BlzFrameSetVisible(port, true)
        call BlzFrameSetVisible(BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME,0), true)

        call BlzFrameClearAllPoints(port)
        call BlzFrameSetAbsPoint(port, FRAMEPOINT_CENTER, 0.155, 0.525)

    endfunction

    //===========================================================================
    function InitTrig_GameUI takes nothing returns nothing
        set gg_trg_GameUI = CreateTrigger(  )
        call TriggerRegisterTimerEventSingle( gg_trg_GameUI, 0.10 )
        call TriggerAddAction( gg_trg_GameUI, function Trig_GameUI_Init_Actions )
    endfunction
    Code (vJASS):
    function Trig_silver_Actions takes nothing returns nothing

        local framehandle HeroBackground = BlzCreateFrameByType("BACKDROP", "HeroBackground", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0), "", 0)
        local framehandle HeroBorder = BlzCreateFrameByType("BACKDROP", "HeroBorder", BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0) , "", 0)
        local framehandle port = BlzGetOriginFrame(ORIGIN_FRAME_PORTRAIT,0)

        //======Hero Portrait Border=====\\
        call BlzFrameSetSize(HeroBorder , 0.13, 0.13)
        call BlzFrameSetAbsPoint(HeroBorder , FRAMEPOINT_CENTER, 0.074, 0.527)
        call BlzFrameSetTexture(HeroBorder , "UI\\Widgets\\Glues\\SinglePlayerSkirmish-MinimapCover3.blp",0, true)

        //======Hero Portrait Background=====\\
        call BlzFrameSetSize(HeroBackground , 0.13, 0.13)
        call BlzFrameSetAbsPoint(HeroBackground , FRAMEPOINT_CENTER, 0.074, 0.527)
        call BlzFrameSetTexture(HeroBackground , "UI\\Widgets\\EscMenu\\Human\\human-options-button-background-disabled.blp",0, true)

    //    call BlzFrameSetAlpha(HeroBackground, 150)


    //===== Making "HeroBackground" the Parent of ORIGIN_FRAME_PORTRAIT causes the portrait to move
    //===== above the background image but it still passes through when animation is played.

        call BlzFrameSetParent(port, HeroBackground)

    //===== FrameSetLevel seems to not work for ORIGIN_FRAME_PORTRAIT
    //    call BlzFrameSetLevel(port, 10)


    endfunction

    //===========================================================================
    function InitTrig_Borders takes nothing returns nothing
        set gg_trg_Borders = CreateTrigger(  )
        call TriggerRegisterTimerEventSingle( gg_trg_Borders, 0.20 )
        call TriggerAddAction( gg_trg_Borders, function Trig_silver_Actions )
    endfunction

    Feel free to use the test map, any help to resolve this problem is appreciated!
     

    Attached Files:

  2. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,358
    Resources:
    17
    Tools:
    2
    Maps:
    2
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    17
    based on something Hate said:
    BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0) is deeper than BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0).
    When using the world as parent for the background it should be deeper Layerwise hopefuly below that portait.
    local framehandle HeroBackground = BlzCreateFrameByType("BACKDROP", "HeroBackground", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 0)


    Other option could be to increase the FrameLevel of the portait's parent using BlzFrameSetLevel.
    call BlzFrameSetLevel(BlzFrameGetParent(port), 5)
     
  3. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,527
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    @Tasyen
    Code (vJASS):
    local framehandle HeroBackground = BlzCreateFrameByType("BACKDROP", "HeroBackground", BlzGetOriginFrame(ORIGIN_FRAME_WORLD_FRAME, 0), "", 0)
    wow dude that actually helped thanks!

    also:
    Code (vJASS):
    //===== FrameSetLevel seems to not work for ORIGIN_FRAME_PORTRAIT
    //    call BlzFrameSetLevel(port, 10)
    I already tried changing the level but it didn't work so I just disabled it.
     
  4. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,358
    Resources:
    17
    Tools:
    2
    Maps:
    2
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    17
    Hence I said: Parent of Portrait -> BlzFrameGetParent(port)
     
  5. xorkatoss

    xorkatoss

    Joined:
    Jul 12, 2010
    Messages:
    1,527
    Resources:
    7
    Models:
    5
    Maps:
    1
    Spells:
    1
    Resources:
    7
    @Tasyen ahh right my bad I didn't read it all lol...

    but still the parent of "port" was HeroBackground as I showed in these lines:
    Code (vJASS):
    //===== Making "HeroBackground" the Parent of ORIGIN_FRAME_PORTRAIT causes the portrait to move
    //===== above the background image but it still passes through when animation is played.

        call BlzFrameSetParent(port, HeroBackground)

    And I tried changing the level for both but still couldn't find a solution, the UI native are so complex >_<

    I never would have solved it if you didn't help me :)