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

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