Thread Tools Display Modes
11-07-13, 06:16 AM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Model texture

Is there any way to change the model's texture via API? Or at least load the default/random texture to them? Multi textured models still show up textureless.
  Reply With Quote
11-07-13, 06:24 AM   #2
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
If I'm not mistaken, the way to display these models is with the SetDisplayInfo method.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
11-07-13, 06:49 AM   #3
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Yep. With SetDisplayInfo you have access to around 50,000 models.
Don't forget about the DressUpModel.
http://wowprogramming.com/docs/widgets/DressUpModel

Lua Code:
  1. --dodat
  2.     DressUpModel:Dress() -- Updates the model to reflect the character's currently equipped items
  3.     DressUpModel:TryOn(itemID) or DressUpModel:TryOn("itemName") or DressUpModel:TryOn("itemLink") -- Updates the model to reflect the character's appearance after equipping a specific item
  4.     DressUpModel:Undress() -- Updates the model to reflect the character's appearance without any equipped items
  5.     DressUpModel:UndressSlot() -- This function is not yet documented

Used in:
http://wowprogramming.com/utils/xmlb...odelFrames.lua
http://wowprogramming.com/utils/xmlb...rDollFrame.lua

To get a hang of it I would check the auction house dressup model frame or the transmog model frame. If you can equip stuff there has to be any sort of api that allows you to do so.

A simple way to do it could be:
Lua Code:
  1. --dodat
  2. local dum = CreateFrame("DressUpModel", "MyModelFrame", UIParent, "ModelWithControlsTemplate")
  3. dum:SetPoint("CENTER")
  4. dum:SetSize(172,400)
  5. dum:SetUnit("player")
  6. dum:Undress()
  7. dum:TryOn(19019)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 11-07-13 at 07:04 AM.
  Reply With Quote
11-07-13, 07:48 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Thats not really what i want to do. I have a slider which displays all the creatures from the game. (0-1100)
Some of them displays properly, but the multi texture ones shows up as a white mdoel, i would like to randomly select a texture for the white textures and show them as it.
  Reply With Quote
11-07-13, 08:14 AM   #5
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Originally Posted by Resike View Post
Thats not really what i want to do. I have a slider which displays all the creatures from the game. (0-1100)
Some of them displays properly, but the multi texture ones shows up as a white mdoel, i would like to randomly select a texture for the white textures and show them as it.
I don't think you can do it like that.
You can, however, go over all the SetDisplayInfo textured model numbers (~50k like zork said) and check which model file each of them is from, and use that info to display a given model with a random texture.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
11-07-13, 09:06 AM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Malsomnus View Post
I don't think you can do it like that.
You can, however, go over all the SetDisplayInfo textured model numbers (~50k like zork said) and check which model file each of them is from, and use that info to display a given model with a random texture.
Why can i only get info from 50k models?
  Reply With Quote
11-07-13, 09:16 AM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Malsomnus View Post
I don't think you can do it like that.
You can, however, go over all the SetDisplayInfo textured model numbers (~50k like zork said) and check which model file each of them is from, and use that info to display a given model with a random texture.
I'm pretty sure it's doable, since i'm really close to code it, i just need more data.
  Reply With Quote
11-07-13, 09:19 AM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Actually you have enough options.
Lua Code:
  1. model:SetUnit() --unitid
  2. model:SetModel() --modelpath, may have caching issues
  3. model:SetDisplayInfo() --index, no caching issues

Plus if you have a base model you can try using dressupmodel to dress it.

Additionally you can check some other model addons for code review:
http://www.wowinterface.com/download...imeTester.html
http://www.curse.com/addons/wow/mogit
http://www.curse.com/addons/wow/mountviewer
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 11-07-13 at 09:24 AM.
  Reply With Quote
11-07-13, 09:25 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by zork View Post
Actually you have enough options.
Lua Code:
  1. model:SetUnit() --unitid
  2. model:SetModel() --modelpath, may have caching issues
  3. model:SetDisplayInfo() --index, no caching issues

Plus if you have a base model you can try using dressupmodel to dress it.
The problem is not there, but even with the 60k extracted modeldisplayinfo around 5-10% of my models still white. Is it worth if i try to get info from 60k+ displayinfo models? 60-90k seems to return "" values.

None of the addons above compelx enough to match my needs, pretty much all of them have basic model functions.

Last edited by Resike : 11-07-13 at 09:28 AM.
  Reply With Quote
11-07-13, 09:28 AM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
There are no models above 60k atm.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
11-07-13, 12:25 PM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
I think i suceeded, however i need help about how could i create scrollable dropdown menus.
  Reply With Quote
11-12-13, 06:30 AM   #12
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
So here it is:

http://www.youtube.com/watch?v=egzorLE4h8E

Currently it still have many issues, and it's not even close to be a release, but i think i'm finally getting somewhere.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Model texture


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off