3d model viewer addon
EDIT: The addon is available here: https://www.curseforge.com/wow/addon...d-model-viewer
Hello everyone, I'm new and I need your help to make my first addon because I'm a noob :D I would like to make an addon that shows the 3d model of the selected target (Players, NPCs, creatures, etc). I need to make a button near the target portrait frame, it appears when I select a target and disapear when I unselect it. Then once I click the button there's the 3d model of the target that appears in the middle of the screen with no background and I can rotate it and make zooms with the mouse middle button. Then to close the view on the target 3d model I just need to press the portrait button again. Would you please share with me some of your knowledge and feed me with basic code so I can realize this project. Thanks a lot. Also, is this possible to do this with a macro? |
It's a bit rough but something like: (you can paste the code into the website to create/download as an addon). The Show/Hide button is on the target frame (and assumes you are using the default UI).
Lua Code:
|
Impressive, I'm amazed to see how short the code is. I tested it and it works amazing but I believe it would be even better if you learn me how to do this:
- Make the right clic can go trough the 3d model to be able to do actions like moving the camera while running and select other targets. - Use the mouse middle click on the 3d model to move it where I want in the 3d view frame. Then after that I think the addon will be finished :) |
You can move the frame out of the way but arbitrarily clicking something behind it won't work.
If you replace SetPortraitZoom with SetPosition you can move/zoom the model inside the frame. You can select/view the methods available for the various UI widgets here. Depending on what you are actually trying to achieve there probably needs to be far more work beyond this rough outline than I have time for. Original post contains all the updated code. |
Thank you. I just tried to add a button at the bottom left corner of the model frame to rezize as wish but it didn't worked... so I wrote few lines to add 2 buttons that change the size of the model frame and the model, the buttons showed but they did nothing. At least the positive thing for now is that I understand a bit when I read the code and learned how to modify few things in the script lol.
I fear to ask too much but I would like to add more options to this addon to make it even better if you accept: - A button ("BG") that toggle between no background and a 50% transparency black background (Default is with the background). - 2 buttons ("+" and "-") that resize the model frame (and the 3d model at the same time). Each click on + make it bigger and bigger, and - do the opposite. - Once the model frame is locked, mouse middle click can be used to rotate the 3d model in all directions (not only left and right that mouse left click already does) to get views from above, bellow, ... That's all but I guess that's a lot ^^ |
The first two are pretty simple, the last one not so much as it's beyond the scope of the PlayerModel widget and into things I've not played with yet.
Updated the code in the original post and added a "Bg" button and, when unlocked, the frame can be re-sized by holding down the alt-key and dragging the bottom right corner. You can extract the code for the default UI and might get some useful information from their Wardrobe and Collections addons. |
That's incredible! I can't thank you enough for this wonderful addon, it will help to have a closer look on the living beings of Azeroth :)
I came here asking for some basic code to start my addon then you litterally wrote everything, I don't mind that because you learned me new things. So it's yours, I just take that sweet code to play with it. But... I believe such a good addon must live longer and be shared with the rest of the community, can you please share it here and on Curseforge? I think you'll be the best person able to keep it up to date since you are an LUA professional. |
Certainly no professional :).
If you install a debugger it should be reasonably straight forward to keep the code in order should anything break (I don't think there's anything earth shattering in what's there). Handy to have for any addon development. BugGrabber and BugSack work together. |
Okay, I'll install those addons too.
Can I share it on Curseforge? I would like to credit you in the addon description if you accept. |
You can do with it as you please, I have no need for credit. Just happy to help you get started.
|
Hi, first i really like this addon but i have a request: Any chance to make this addon work in a key bind? I don't use blizzard default ui and i think this is the best way i can use this addon.
Thank you for your working! |
You can paste the following to the bottom of the addons Core.lua file to show/hide the model using: /3dv
Code:
SLASH_3DV1 = "/3dv" |
Thank you soo much!!!! Worked!!!
|
All times are GMT -6. The time now is 08:06 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI