PDA

View Full Version : Accessing bitmap file path.


BebeteLANUITE
02-10-2006, 09:55 AM
Hello.

I try to make a simple tool that find material by bitmap name in the scene.
I made a simple chunk of code to make a list of all bitmaps in the scene (but it make list of xrefs too :( ).



Rollout Prog "By Map Name"
(
button Allmap "Find maps" width:230
progressbar GatherBar color:blue
combobox maplist "Finding Bitmaps:" height:15
edittext pathdisp ""
listbox matlist "Corresponding Materials:" width:140
bitmap matprev "preview:" color:[0,0,0] height:60 width:60 pos:[165,322]
dropdownlist slotnum "Slot:" height:25 width:50 pos:[170,390] items:(for i in 1 to 24 collect i as string)
button sendslot "Send" width:60 pos:[165,438]
button selobjects "Display Objects" width:140 pos:[13,465]

on Allmap pressed do
(
global mapfiles = #()
fn addmap mapfile =
(
local mapfileN = mapfile as name
local index = finditem mapfiles mapfileN
if index == 0 do append mapfiles mapfileN
)--end fn
global SceneMapAd = enumeratefiles addmap
--sort mapfiles
global SceneMaps = for mapfile in mapfiles collect filenamefrompath (mapfile as string) --print (mapfile as string)
Sort SceneMaps
maplist.items = SceneMaps
)--end on Allmap

on maplist selected item do
(
pathdisp.text = GetFileNamePath maplist.selected --don't work

)--end on maplist

on slotnum selected slot do
(
mateditor.open()
medit.SetActiveMtlSlot slot true
)--end on slotnum

)--end Rollout
Newf = newrolloutfloater "Find Material" 250 550
addrollout prog newf



How i want it works:
- I click on the "gather maps" button and all the bitmap names in the scene are displayed in the combobox. (This part works but i don't want the xrefs)
- I type a name in the edittext of the combobox to find the bitmap i want.
- I select a bitmap name: Automatically the full path of the selected bitmap is displayed in "Path" edittext and the materials name that use this bitmap are displayed in the "corresponding materials" listbox. Also, the first item is this listbox is automatically selected and a preview of the material appear in "preview" bitmap (i don't know if it's possible to have a small preview like in material editor slots.)
- after i choose the material i want (the preview update to show me the selected material).
- I choose a slot in "slotnum" dropdownlist. Automatically the material editor open with the choosen slot selected. (this part works)
- I pressed on "send" button and the selected material is send to the selected slot to be modified.
- If i press the "display objects" button, the "select objects" dialog appears with objects that use the material selected in. In case of find and select the objects.

In fact, i don't know how to link: bitmap name, bitmap name path, material which use the bitmap together to quickly find one by other (ex: find material by bitmap name).
I ask to myself if i must make a search system which search for the material by comparing the bitmap name.

Could you help me to realize this tool ? (bobo ? ;) )

Thank you a lot for your help ;)

BebeteLANUITE
02-15-2006, 10:50 AM
nobody has a solution ? :(

BebeteLANUITE
02-15-2006, 10:52 AM
i found a way to make the path display when i click on a map in the combobox's list. :thumbsup:. I just forget a double equal "==". :p

CGTalk Moderation
02-15-2006, 10:52 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.