PlayerModel:SetTransform bug
Alright, I've come across a really bizarre bug. Hoping someone can provide some insight cause I'm at a loss lol.
I'm trying to display some spell effects on the screen using the PlayerModel frame. I'd also like to adjust how it's displayed using SetTransform. What's going wrong is that when I initially enter the game (from the character select screen) the model won't display if I'm calling SetTransform. If I reload the UI using /reload it will display. Whenever I exit and reenter the game the same problem happens. If I don't use SetTransform the model displays perfectly fine immediately after entering the game without requiring a /reload. To reproduce it I put together a test addon that has nothing but a single file with the code below. I also went ahead and disabled all the other addons in case one of them was causing a problem. It's still happening, but I figured it's worth having someone else try it out to see if it works for them. You should see a fire animation play in the middle of your screen. Code:
local frame = CreateFrame("PlayerModel", nil, UIParent, nil) |
Have you tried to delay the set so the game has time to "get ready". Something like:
Lua Code:
|
Models and SetTransform especially are riddled with bugs, so don't use it if you can.
Try calling SetTransform a little later than SetModel, like in the next render frame or just after 30ms Also don't use SetTransform on anything you're going to publish, because it gives different results depending on client resolution |
I am currently struggeling with the PlayerModel frame myself.
(See https://www.wowinterface.com/forums/...ad.php?t=57514) Where did you even find a documentation of SetTransform()? |
Thanks for the responses, was a huge help. You were both right about needing to delay calling SetTransform after setting the model. Went with a timer with a duration of 0.01, did the trick just fine. I also discovered that SetTransform needs to be called whenever the model is changed with SetModel. The transform values seem to get reset. Something else I noticed is that there might be an issue with using frame:Show() and frame:SetTransform() at the same time. Didn't test it further since a timer of 0.01 updates faster than anyone would notice, but I thought I'd still mention it in case someone comes across this thread in the future.
d87: could you provide some more insight about it being different based on the client resolution? What kind of differences are there? If you know of a thread or something where SetTransform's quirks are discussed that'd be awesome. LudiusMaximus: I feel your pain. Not sure why SetTransform isn't on the wiki yet. I discovered it while digging around WeakAura's files to figure out what they were doing since I was having so many problems myself. I don't see them doing any of the timing stuff that I ended up having to do, but maybe they're just doing it in a different part of the code I didn't look at. Here's the actual SetTransform implementation I'm using; might give you some insight: Code:
local offset = (0.205 * size) / 1000 |
Quote:
Also if you scale SetTransform model's frame, model won't scale with it. Normal PlayerModel is doing that I don't know any threads, it's just something i found when i wanted to use it in my addon |
Hmmm interesting, wouldn't have thought of that so I'm glad you brought it up. I'm wondering if it'd be possible to adjust the offset based on the player's aspect ratio? Might give that a shot cause I'd really prefer using SetTransform.
Good to know about the scaling issue too. Thanks again! |
All times are GMT -6. The time now is 03:14 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI