- Joined
- Aug 16, 2007
- Messages
- 881
ModelPathExtractor allow one to get the model path as string of Widgets, Units, Items and Destructables.
Demo map and example images attached.
Based of Version 1.0a,
doesn't have functions:
Link: [vJASS] - ModelPathExtractor
Credits to Wrda
# 1.0a
Release
# 1.1a
Added optional library WidgetType by Pyrogasm
Added function GetModelPath (requires WidgetType)
Added function GetModelPathWithSkin (requires WidgetType)
Added disabled function GetDestructableModelPathWithSkin in case Blizzard implements BlzGetDestructableSkin native in the future
# 1.2a
Updated WidgetType library to v1.1
Added link to this page and date in documentation
Any feedback appreciated!
Demo map and example images attached.
JASS:
library ModelPathExtractor initializer Init requires optional WidgetType
//===========================================================================
//
// ModelPathExtractor, 1.2a | 2023-12-30
// by lolreported
// https://www.hiveworkshop.com/threads/vjass-lua-modelpathextractor.352061/
//
// Credits appreciated, but not required.
//
//
// This library provides an easy way to get the model path as string from
// any widget, unit, item or destructable.
//
// Uses BlzSetItemSkin and BlzGetItemStringField natives in order to get the model path.
// BlzSetItemSkin skinId doesn't care what type of id is given.
//
//
// Optional Requirement(s):
// WidgetType by Pyrogasm and lolreported
// https://www.hiveworkshop.com/threads/vjass-lua-modelpathextractor.352061/post-3606079
//
//
// Generic API
// function GetModelPathByType takes integer anyType returns string // returns the model path of any type id/skin id
//
// Note: Functions below are wrapper functions of GetModelPathByType for convenience
//
// function GetModelPath takes widget whichWidget returns string // returns the default model path of any widget (requires WidgetType library)
// function GetModelPathWithSkin takes widget whichWidget returns string // returns the current model path of any widget (requires WidgetType library)
//
// Unit API
// function GetUnitModelPathByType takes integer unitType returns string // returns the model path of unit-type
// function GetUnitModelPath takes unit whichUnit returns string // returns the default model path
// function GetUnitModelPathWithSkin takes unit whichUnit returns string // returns the current model path
//
// Item API
// function GetItemModelPathByType takes integer itemType returns string // returns the model path of item-type
// function GetItemModelPath takes item whichItem returns string // returns the default model path
// function GetItemModelPathWithSkin takes item whichItem returns string // returns the current model path
//
// Destructable API
// function GetDestructableModelPathByType takes integer destructableType returns string // returns the model path of destructable-type
// function GetDestructableModelPath takes destructable whichDestructable returns string // returns the default model path
//
//
//===========================================================================
globals
private item i = null
endglobals
private function Init takes nothing returns nothing
// Create the item to be used with model path extraction and then hide it forever.
set i = CreateItem('ratf', 0, 0)
call SetItemVisible(i, false)
endfunction
// GENERIC
function GetModelPathByType takes integer anyType returns string
call BlzSetItemSkin(i, anyType)
return BlzGetItemStringField(i, ITEM_SF_MODEL_USED)
endfunction
static if LIBRARY_WidgetType then
function GetModelPath takes widget whichWidget returns string
return GetModelPathByType(GetWidgetTypeId(whichWidget))
endfunction
function GetModelPathWithSkin takes widget whichWidget returns string
return GetModelPathByType(GetWidgetSkin(whichWidget))
endfunction
endif
// UNIT
function GetUnitModelPathByType takes integer unitType returns string
return GetModelPathByType(unitType)
endfunction
function GetUnitModelPath takes unit whichUnit returns string
return GetModelPathByType(GetUnitTypeId(whichUnit))
endfunction
function GetUnitModelPathWithSkin takes unit whichUnit returns string
return GetModelPathByType(BlzGetUnitSkin(whichUnit))
endfunction
// ITEM
function GetItemModelPathByType takes integer itemType returns string
return GetModelPathByType(itemType)
endfunction
function GetItemModelPath takes item whichItem returns string
return GetModelPathByType(GetItemTypeId(whichItem))
endfunction
function GetItemModelPathWithSkin takes item whichItem returns string
return GetModelPathByType(BlzGetItemSkin(whichItem))
endfunction
// DESTRUCTABLE
function GetDestructableModelPathByType takes integer destructableType returns string
return GetModelPathByType(destructableType)
endfunction
function GetDestructableModelPath takes destructable whichDestructable returns string
return GetModelPathByType(GetDestructableTypeId(whichDestructable))
endfunction
//function GetDestructableModelPathWithSkin takes destructable whichDestructable returns string
// return GetModelPathByType(BlzGetDestructableSkin(whichDestructable)) // native BlzGetDestructableSkin Not Implemented
//endfunction
endlibrary
Based of Version 1.0a,
doesn't have functions:
- GetModelPath
- GetModelPathWithSkin
- GetDestructableModelPathWithSkin
Link: [vJASS] - ModelPathExtractor
Credits to Wrda
# 1.0a
Release
# 1.1a
Added optional library WidgetType by Pyrogasm
Added function GetModelPath (requires WidgetType)
Added function GetModelPathWithSkin (requires WidgetType)
Added disabled function GetDestructableModelPathWithSkin in case Blizzard implements BlzGetDestructableSkin native in the future
# 1.2a
Updated WidgetType library to v1.1
Added link to this page and date in documentation
Any feedback appreciated!
Attachments
Last edited: