Thread Tools Display Modes
09-10-10, 05:48 AM   #1
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Extract model properties

Hi all!

I'm still trying to get the bugs out of my 3d models, and for that I need to be able to extract the height, width and depth of every model in WoW. Is it possible to extract this info from the MPQ's and if yes, how?

An example can be found in the _NPCScan addon, like this:
Code:
--- @description Key is lowercase, value = "[Scale]|[X]|[Y]|[Z]", where any parameter can be left empty
me.ModelCameras = {
	[ [[creature\spectraltigerferal\spectraltigerferal.m2]] ] = "||-.25|1"; -- Gondria
	[ [[creature\abyssaloutland\abyssal_outland.m2]] ] = "|.3|1|-8"; -- Kraator
	[ [[creature\ancientofarcane\ancientofarcane.m2]] ] = "1.25"; -- Old Crystalbark
	[ [[creature\arcanegolem\arcanegolem.m2]] ] = ".6|.25"; -- Ever-Core the Punisher
	[ [[creature\bonegolem\bonegolem.m2]] ] = "|.4|.6"; -- Crippler
	[ [[creature\bonespider\bonespider.m2]] ] = "||-1"; -- Terror Spinner
	[ [[creature\crocodile\crocodile.m2]] ] = ".7||-.5"; -- Goretooth
	[ [[creature\dragon\northrenddragon.m2]] ] = ".5||20|-14"; -- Hemathion, Vyragosa
	[ [[creature\fungalmonster\fungalmonster.m2]] ] = ".5|.2|1"; -- Bog Lurker
	[ [[creature\mammoth\mammoth.m2]] ] = ".35|.9|2.7"; -- Tukemuth
	[ [[creature\mountaingiantoutland\mountaingiant_bladesedge.m2]] ] = ".19|-.2|1.2"; -- Morcrush
	[ [[creature\northrendfleshgiant\northrendfleshgiant.m2]] ] = "||2"; -- Putridus the Ancient
	[ [[creature\protodragon\protodragon.m2]] ] = "1.3||-3"; -- Time-Lost Proto Drake
	[ [[creature\satyr\satyr.m2]] ] = ".7|.3|.5"; -- Ambassador Jerrikar
	[ [[creature\wight\wight.m2]] ] = ".7"; -- Griegen
	[ [[creature\zuldrakgolem\zuldrakgolem.m2]] ] = ".45|.1|1.3"; -- Zul'drak Sentinel
};
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
09-10-10, 10:08 AM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
iirc, that's not the height, width, and depth of the models. That's a custom point for the camera on the model. MazzleUI had a huge database for every model in the game which took him and those helping him a long time to compile. ZMobDB allows users to change the position of the camera for a model and then stores that data in the sv's (last I checked, at least).
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-16-10, 05:58 AM   #3
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by Seerah View Post
iirc, that's not the height, width, and depth of the models. That's a custom point for the camera on the model. MazzleUI had a huge database for every model in the game which took him and those helping him a long time to compile. ZMobDB allows users to change the position of the camera for a model and then stores that data in the sv's (last I checked, at least).
I know, but I thought, if I can extract model height/width/depth of the models I can calculate these values from them.
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
09-16-10, 02:24 PM   #4
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
It seems like Blizzard has done a fair bit of work on PlayerModels in the beta. Most of the models in that list from _NPCScan don't need custom camera offsets anymore; they look fine with no change. Also, Blizzard added a couple interesting methods:
  • PlayerModel:SetDisplayInfo(displayID) - (unrelated) Can show an NPC's visual without needing to have seen the mob before. The only way to get displayID is through the DBCs though.
  • ...

Well I was about to log in and print them, but the beta's offline. I can't remember the method name, but there was one function that seemed like it had potential. Something like SetPortraitZoom... It took a value from (-inf, inf) where 0 showed a full body portrait, 1 showed only the head (I might have these backwards), and any value in between would smoothly shift between the two. Values above one would continue to shrink the model towards the bottom of the frame, and negative values would shrink the model towards the top. I ran a Wacky Waving Inflatable Arm Flailing Tube-Man zoom demo and it looks fine; It doesn't interrupt animations and doesn't seem to affect performance much. I'm looking forward to dramatic zooming portraits!

Anyway, my point was that if you do try to write a script for getting optimal camera positions, do it on the beta or PTR, since it's so different.

Last edited by Saiket : 09-16-10 at 02:26 PM.
  Reply With Quote
09-20-10, 06:28 AM   #5
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
PlayerModel:SetDisplayInfo(displayID) - (unrelated) Can show an NPC's visual without needing to have seen the mob before. The only way to get displayID is through the DBCs though.
HOLY COW. Is it finally possible to display models you have not in your cache?

I'm dying fo a solution on displaying any kind of wisp model. Everyhting I tried didn't work out.

Best I had was

(1)
Code:
local m = CreateFrame("Model",nil,UIParent)
m:SetModel("Creatures\\Wisp\\Wisp.mdx")
Or

(2)
Code:
local m = CreateFrame("PlayerModel",nil,UIParent)
--http://www.wowhead.com/npc=16701
local creatureID = 16701 --use ID from Wisp Pet
m:SetCreature(creatureID)
(1) Problem: I have the model but with huge white squares, I guess that is beacause I had no skin specified that would be applied to that model. If would do that if I knew how to apply skins to models in LUA. No clue atm.

(2) Works, but only when the pet is cached.

Questions:
- Can I apply skinds to models? If yes how.

So this should bring me my wisp...
Code:
local m = CreateFrame("PlayerModel",nil,UIParent)
--http://www.wowhead.com/npc=16701
local creatureID = 16701 --use ID from Wisp Pet
m:SetDisplayInfo(creatureID)
Link to wisp pet: http://www.wowhead.com/npc=16701

Interesting is this aswell:
http://www.wowhead.com/spell=24740

It applies "Apply Aura: Change Model (3681)"
That leads to: http://www.wowhead.com/npc=3681

I finally want my wisp animation. Damn'it.
__________________
| 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 : 09-20-10 at 06:44 AM.
  Reply With Quote
09-20-10, 08:11 AM   #6
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 154
View source from the creature's page on WowHead and search for "displayId:" (the 3D view button uses it). Spirit of Summer is DisplayID 16587, and the wisp is 10045.
  Reply With Quote
09-20-10, 08:16 AM   #7
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Thanks, that 3D model tip is awesome.

I will gather them up:

Code:
summer pet:       modelviewer.show({ type: 1, typeid: 16701, displayid: 16587 })
wisp:             modelviewer.show({ type: 1, typeid: 3681, displayid: 10045 })
forrest wisp:     modelviewer.show({ type: 1, typeid: 15624, displayid: 12432 })
ancient wisp:     modelviewer.show({ type: 1, typeid: 17946, displayid: 17607 })
electromental:    modelviewer.show({ type: 1, typeid: 21729, displayid: 20594 })
shen'dralar wisp: modelviewer.show({ type: 1, typeid: 14361, displayid: 10045 })
restless soul:    modelviewer.show({ type: 1, typeid: 11122, displayid: 1825 })
night elf wisp:   modelviewer.show({ type: 1, typeid: 20069, displayid: 19304 })
Will be interesting to see if they all look the same. On screenshots they differ but that may be another story.

*edit*

It is finally working!

Code:
 local addon = CreateFrame("Frame", nil, UIParent)
 
  addon:RegisterEvent("PLAYER_LOGIN")
  
  addon:SetScript("OnEvent", function (s,e,...)
    if(e=="PLAYER_LOGIN") then
      addon:initme()
    end 
  end)

  local displayid = {}
  displayid[1] = 16587;
  displayid[2] = 10045;
  displayid[3] = 12432;
  displayid[4] = 17607;
  displayid[5] = 20594;
  displayid[6] = 10045;
  displayid[7] = 1825;
  displayid[8] = 19304;

  function addon:initme()
    local m2 = CreateFrame("PlayerModel", "TestaniModel2",UIParent)
    m2:SetSize(256,256)
    m2:SetPoint("CENTER",256,0)
    m2:SetFacing(math.pi); --math.pi = 180° 
    m2:SetDisplayInfo(displayid[1])
  end
__________________
| 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 : 09-20-10 at 10:19 AM.
  Reply With Quote
09-20-10, 12:20 PM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Model viewer
http://www.wowinterface.com/download...delViewer.html

*edit*

There are actually some Blizzards scripts that use SetDisplayInfo oder SetPortraitZoom

SetDisplayInfo
http://github.com/tekkub/wow-ui-sour...Frame.lua#L401

SetPortraitZoom
http://github.com/tekkub/wow-ui-sour...rent.lua#L2814
http://github.com/tekkub/wow-ui-sour...Frame.xml#L255
http://github.com/tekkub/wow-ui-sour...Frame.xml#L853

There seems to be a new API function aswell for questgivers that will contain their displayid. Will return -1 if not found.

Code:
local questPortrait, questPortraitText, questPortraitName = GetQuestPortraitGiver();
Actually there are three more that could be of the same type
Code:
GetQuestPortraitTurnIn
GetQuestLogPortraitGiver
GetQuestLogPortraitTurnIn
http://www.wowwiki.com/Global_functions/Cataclysm

There seems to be a new config option aswell

Code:
QuestLogShouldShowPortrait
That would explain why they added the new stuff. You may know the quest giver but you will not have any clue of the turn in person by the moment you take the quest. That one is not cached yet.

What's kinde of interesting is that the tutorialframe works with SetCreature.

http://github.com/tekkub/wow-ui-sour...e.lua#L795-798

A little dataming reveals this in TutorialFrame.lua

Code:
local TUTORIAL_QUEST_ARRAY = {
	["HUMAN"] = {questID = 7, displayNPC = 197, killCreature = 49871},
	["DWARF"] = {questID = 24469, displayNPC = 37081, killCreature = 37070},
	["NIGHTELF"] = {questID = 456, displayNPC = 2079, killCreature = 2031},
	["GNOME"] = {questID = 27670, displayNPC = 15744, killCreature = 46363},
	["ORC"] = {questID = 25126, displayNPC = 3143, killCreature = 3098, killQuestSecond = true},
	["SCOURGE"] = {questID = 26799, displayNPC = 1569, killCreature = 1501},
	["TAUREN"] = {questID = 14452, displayNPC = 9937, killCreature = 36943, killQuestSecond = true},

	["TROLLWARRIOR"] = nil,

	["DRAENEI"] = nil,
	["BLOODELF"] = nil,
	["WORGEN"] = nil,
	["GOBLIN"] = nil,
};
CURRENT_TUTORIAL_QUEST_INFO = TUTORIAL_QUEST_ARRAY["HUMAN"];
And this information is then used in SetCreature.

Code:
	local displayNPC = CURRENT_TUTORIAL_QUEST_INFO.displayNPC;
	local killCreature = CURRENT_TUTORIAL_QUEST_INFO.killCreature;
	if (displayData.displayNPC and displayNPC) then
		TutorialNPCModel:SetCreature(displayNPC);
		TutorialNPCModel:Show();
	elseif (displayData.killCreature and killCreature) then
		TutorialNPCModel:SetCreature(killCreature);
		TutorialNPCModel:Show();
	end
I will test the model with SetCreatureIDs later. Because if you should display a killcreature that is currently unknown to you (not cached) it should not work.

Even more cool stuff found in UIParent.lua
Code:
function Model_OnMouseWheel(self, delta, maxZoom)
    if (not maxZoom) then
        maxZoom = MODELFRAME_MAX_PET_ZOOM;
    end
    if (not self.zoomLevel) then
        self.zoomLevel = 0;
    end
    self.zoomLevel = self.zoomLevel + delta*0.15;
    if (self.zoomLevel > maxZoom) then
        self.zoomLevel = maxZoom;
    end
    if (0 > self.zoomLevel) then
        self.zoomLevel = 0;
    end
    self:SetPortraitZoom(self.zoomLevel);
end
Usage:
Code:
<Scripts>
  <OnLoad>
    Model_OnLoad(self);
    self:SetCamDistanceScale(1.3);
  </OnLoad>
  <OnEvent function="Model_OnEvent"/>
  <OnUpdate function="Model_OnUpdate"/>
  <OnMouseUp function="Model_OnMouseUp"/>
  <OnMouseDown function="Model_OnMouseDown"/>
  <OnMouseWheel>
    Model_OnMouseWheel(self, delta, MODELFRAME_MAX_PET_ZOOM);
  </OnMouseWheel>
</Scripts>
Lua conversion
Code:
model:SetScript("OnMouseWheel", function(s,d,...)
  Model_OnMouseWheel(s,d)
end)
So there is another option
Code:
SetCamDistanceScale
__________________
| 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 : 09-21-10 at 09:23 AM.
  Reply With Quote
09-21-10, 11:03 AM   #9
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Exactly as I thought. After deleting the Cache and using SetCreature only 1 single model was found, the npc I was standing next to. (Far outside of Ironforge).

Additionally those two work really awesome together:
Code:
    m:SetCamDistanceScale(2)
    m:SetScript("OnMouseWheel", function(s,d,...)
      Model_OnMouseWheel(s,d)
    end)
Mousewheel does the SetPortraitZooml thing. Default zoomlevel is 0 and playing with distancescale scales the model aswell.

Finally my glows are back in the game. Fun times coming up!
__________________
| 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 : 09-21-10 at 11:07 AM.
  Reply With Quote
09-21-10, 11:29 AM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Ok tested a bit, gonna update the modelviewer in some hours...

Check the tooltip for values:



New version is online!

http://www.wowinterface.com/download...o.php?id=18079

It allows you to manipulate the model to check what values work best.

@nightcracker
Saiket is correct. A SetPortraitZoom value of 1 will focus any model available to show the face unless the SetCameraDistance value is not that much out of place.
__________________
| 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 : 09-21-10 at 03:33 PM.
  Reply With Quote
09-22-10, 02:22 AM   #11
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Oh, but I don't want a face portrait, I want a full body portrait

Also, does this mean were finally shipping cache files with our UI's now?
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
09-22-10, 12:28 PM   #12
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Did you try Model:SetCamera(1)?
http://wowprogramming.com/docs/widgets/Model/SetCamera
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-24-10, 06:28 AM   #13
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Originally Posted by Seerah View Post
Are you kidding me?

Ofcourse I did, my 3d models are working fine except that some models are either too big or have an offset so I have to move/scale the camera. That was what my initial post was about.
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
09-24-10, 08:14 AM   #14
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
No, I'm not "kidding" you. Your original post said nothing about having used SetCamera. No one is psychic, and no one knows everything - maybe you didn't try it. Get over it. Excuse me for trying to help.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-24-10, 12:13 PM   #15
SinusPi
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 13
tagging!

Okay, modelviewer is bad ass, thumbs up Zork for making it. Bloody useful.

However, there's a huge thing it's missing, and I'll gladly do my part in making it true if need be. That is: tagging. Of some sort, anyway. The models range from characters to environment fixtures to light effects, and it'd be tremendous help if the viewer could display models in a particular group only.

Of course, if that data cannot be mined from any DBC file, then it'd require manual tagging - and this is what I'd code in myself, if you were interested, a simple pushbutton doohickey allowing for quick tagging of the models displayed. Then, you could have people submit chunks of tagged data to compile into one big model database.

Interested? Already on it? Minable?
  Reply With Quote
09-24-10, 05:53 PM   #16
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I like the idea. Would be only possible if a table with all displayIDs for that type is in the background. Otherwise the calculation of the pages would be impossible.

Just checked. I think have an even easier solution. What I did is
Code:
    print(displayid..": "..self:GetModel())
Now what's interesting is the string that is returned from getmodel. It contains the complete path to the model used for the skin. The path could be splitted into pieces. My suggestion is to get rid of the navigation depth and just use every single foldername as a tag.

Example for displayid: 17120
Character\Human\female\humanfemale.m2

This would basically would add sth like this to the savedvariables:

Code:
[tags] = {
  [character] = {
    "17210" = true,
  },
  [human] = {
    "17210" = true,
  },
  [female] = {
    "17210" = true,
  },

}
Sth like that. Later I create a temporary table based on selected tags.

If you would like to generate that list feel free to do so. I will edit the viewer once that is in place. Maybe it's even possible to gather all data, save it to a temp table aswell and when that is done calculate all the tags and save stuff to the savedvariable.



Code for the addon would be sth like this:

for i=1; i<40000 do
local self = mymodel --etc...
self:SetModel("Interface\\Buttons\\talktomequestionmark.mdx") --in case setdisplayinfo fails
self:SetDisplayInfo(i)
--print(id..": "..self:GetModel())
--do stuff
end
__________________
| 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 : 09-24-10 at 06:45 PM.
  Reply With Quote
09-25-10, 04:29 AM   #17
SinusPi
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 13
Yup, done.

Here's the tag database - it's pretty freakin' huge, and perhaps could be compacted somehow, but I don't think it's worth the effort - the viewer is only a development/exploration tool and wouldn't be expected to operate at minimum resource requirements, I guess.

http://www.mediafire.com/file/j8dsa863xnz5pjk/tags.zip

Also, I did some cosmetic modifications to your addon, use these if you wish - the first hides models that are missing (though some models show up as blank but are there if you zoom in or out):
Code:
   local function rIMV_setModel(self,id)
  
    self:Show()  --sinus

    self:ClearModel()
    --m:SetModel("Interface\\Buttons\\talktomequestionmark.mdx") --in case setdisplayinfo fails 
    self:SetDisplayInfo(id)

    if self:GetModel()==self then self:Hide() end  -- sinus: hide missing models

    self.id = id
    self.p:SetText(id)

  end
Also, just for some extra info, I added
Code:
    GameTooltip:AddDoubleLine("GetModel", self:GetModel(), 1, 1, 1, 1, 1, 1)
in the tooltip routine. Kinda useful.
  Reply With Quote
09-25-10, 05:31 AM   #18
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Post me the script you used to generate the result aswell please.

I added the GetModel now aswell. It is indeed useful.
Code:
  --bring the model to life and set the displayID
  local function rIMV_setModel(self,id)
  
    self:ClearModel()
    local defaultmodel = "interface\\buttons\\talktomequestionmark.m2"
    self:SetModel(defaultmodel) --in case setdisplayinfo fails 
    self:SetDisplayInfo(id)
    local model = self:GetModel()
    if model == defaultmodel then
      self.model = ""
      self:EnableMouse(false)
    else
      self.model = model
      self:EnableMouse(true)
    end
    self.id = id
    self.p:SetText(id)

  end
Using self:Hide() is a bad. Because it diabled them and on the next couple of pages you will have zero models left. Because all become hidden.

That is my idea:


Not sure if it will work out though. Plus is that you can copy stuff out of TinyPad.

Code:
  
  -- rIngameModelExtractor
  -- zork 2010



  -----------------------------
  -- FUNCTIONS
  -----------------------------
  
  local tags = {}
  
  local function rIME_createModelOutput()
    
    local m = CreateFrame("PlayerModel", "rIME_Icon", UIParent)
    local defaultmodel = "interface\\buttons\\talktomequestionmark.m2"
    --m:Hide()
    
    local txt = ""
    for i=1, 40 do
      m:ClearModel()
      m:SetModel(defaultmodel) --in case setdisplayinfo fails 
      m:SetDisplayInfo(i)
      local model = m:GetModel()
      if model ~= defaultmodel then
        txt = txt.."displayid: "..i.." model: "..model.."\n"
      end
    end
    
    TinyPadEditBox:SetText(txt)
  end

  --tooltip for icon func
  local function rIME_showIconTooltip(self)
    GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
    --GameTooltip:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -90, 90)
    GameTooltip:AddLine("rIngameModelExtractor", 0, 1, 0.5, 1, 1, 1)
    if TinyPadFrame then
      GameTooltip:AddLine("Click start extracting!", 1, 1, 1, 1, 1, 1)
    else
      GameTooltip:AddLine("TinyPad is not loaded!", 1, 0.3, 0.3, 1, 1, 1)
    end
    GameTooltip:AddLine("Hold down ALT to drag the icon!", 1, 1, 1, 1, 1, 1)
    GameTooltip:Show()
  end

  --create icon func
  local function rIME_createIcon()
    local i = CreateFrame("PlayerModel", "rIME_Icon", UIParent)
    i:SetSize(64,64)
    i:SetPoint("CENTER",0,0)
    i:SetDisplayInfo(29190)
    i:SetCamDistanceScale(0.5)
  
    i:SetMovable(true)
    i:SetUserPlaced(true)
    i:EnableMouse(true)
    i:RegisterForDrag("LeftButton","RightButton")
    i:SetScript("OnDragStart", function(s) if IsAltKeyDown() then s:StartMoving() end end)
    i:SetScript("OnDragStop", function(s) s:StopMovingOrSizing() end)
    i:SetScript("OnMouseDown", function()
      if not IsAltKeyDown() then
        TinyPadFrame:Show()
        if TinyPadEditBox and TinyPadEditBox:IsVisible() and TinyPadEditBox:IsShown() then
          rIME_createModelOutput()
        end
      end
    end)
  
    i:SetScript("OnEnter", function(s) rIME_showIconTooltip(s) end)
    i:SetScript("OnLeave", function(s) GameTooltip:Hide() end)
  
  end
  
  -----------------------------
  -- LOADUP
  -----------------------------

  --rIME_init func
  local function rIME_init()
  
    rIME_createIcon()

  end
  
  --PLAYER_LOGIN EVENT HOOK  
  local a = CreateFrame("Frame")
  
  a:SetScript("OnEvent", function (s,e,...)
    if(e=="PLAYER_LOGIN") then
      rIME_init()
    end 
  end)
  
  a:RegisterEvent("PLAYER_LOGIN")
TinyPad is a dependency.
__________________
| 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 : 09-25-10 at 06:24 AM.
  Reply With Quote
09-25-10, 06:51 AM   #19
SinusPi
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 13
But there's also a :Show() at the start of the function, it works as expected

I didn't use a standalone script, I just added a "logging" function to your rIMV_setModel function and skipped through pages. I'm lazy. ;P I edited it out already, sorry ^^;

And meanwhile, I also added full filtering support, though it's slash-command based. Oh, and the data I gathered must be loaded under a 'IMVtags' variable for this to work.

Code:
  local filtered
Code:
  local function rIMV_setModel(self,id)
  
    self:Show()  --sinus

    self:ClearModel()
    --m:SetModel("Interface\\Buttons\\talktomequestionmark.mdx") --in case setdisplayinfo fails 
    local dispinfo = filtered and (filtered[id] or 0) or id
    self:SetDisplayInfo(dispinfo)

    if self:GetModel()==self then self:Hide() end  -- sinus: hide missing models

    self.id = dispinfo
    self.p:SetText(dispinfo)

  end
Code:
SLASH_IMV1 = "/imv"
function SlashCmdList.IMV(text)
    tag = text:trim()
    if IMVtags[tag] then
        filtered={}
        for id=1,40000 do if IMVtags[tag][id] then tinsert(filtered,id) end end
        print("Filtering by tag '"..tag.."', result: "..#filtered)
    elseif tag:find("%*") then
        tag="^"..tag:replace("*",".*").."$"
        filtered={}
        local unpruned={}
        for t,data in pairs(IMVtags) do
            if t:find(tag) then
                for id,t in pairs(data) do unpruned[id]=true end
            end
        end
        for id=1,40000 do if unpruned[id] then tinsert(filtered,id) end end
        print("Filtering by pattern '"..tag.."', result: "..#filtered)
    elseif tag=="?" then
        local s=""
        for tag,n in pairs(IMVtags) do if s~="" then s=s..", " end  s=s..tag end
        print("Tags: "..s)
        return
    else
        filtered=nil
        print("Filtering off (use '?' to list tags)")
    end

    if tag=="" or (filtered and #filtered>0) then
        rIMV_HolderFrame:Show()
        rIMV_createAllModels(rIMV_HolderFrame)
        rIMV_HolderFrame:EnableMouse(true)
        rIMV_HolderFrame.ag1:Play()
    end
end
This enables commands such as:
/imv (no filtering)
/imv creature (one tag)
/imv spell* (spells,spellportals etc.)
/imv ? (lists HUGE tags list)
  Reply With Quote
09-25-10, 08:34 AM   #20
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
I don't like lazy people.
The filter options are nice.

Extracted the displayid list as csv
http://code.google.com/p/rothui/down...q=#makechanges

Current max displayid: 36877
Model count: 32540

~4300 models are not set, or have displayids that do not return a model.

I'm not that skilled in using savedvariables or using tables. Normally I just do graphics.
__________________
| 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 : 09-25-10 at 08:42 AM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Extract model properties

Thread Tools
Display Modes

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