ScriptSpot home

Forum topic · General Scripting

DETECT THE STATUS OF THE TEXTURES

By artrender · 2013-02-25

Description

Like in asset browser: Missing, Network, OK, Found etc

Comments (16)
artrender

SOLVED

Thx all who participated!

artrender

THE ONLY DIFFERENCE BETWEEN THESE 2 FUNCTIONS

the only difference, there is doesFileExist function which will skip textures that can actually return #Found (such as the ones that have no path and those where the path is wrong but the file itself is in the (sub)folder of the folder the maxfile is inside)

but the problem is with

     mystatus=ATSOps.GetFileSystemStatus  m.filename 
artrender

IN THIS FUNCTION


fn getmapsfromselection = 
 (
  for s in selection do 
  (
   if s.material!=undefined then 
   (
    newbitmaps=getclassinstances Bitmaptexture target:s.material
                      for b in newbitmaps do 
     if (finditem bitmaps_for_selection b==0) then append bitmaps_for_selection b
   )
  )

  for m in bitmaps_for_selection do
  (
   if m.filename!=undefined then 
   (
     mystatus=ATSOps.GetFileSystemStatus  m.filename
     print mystatus
     
   )
  )
 )

it was array with the textures

artrender

ERROR

I get this error

Attachments
Reply to artrender
Branko Živković

Yep. I don't know what's bitmaps_for_selection.
Array variable or something else?

Branko Živković

I edited last fn

artrender

EVEN TONS OF IFs don't help


if (atsops.GetFileSystemStatus m.filename)[1] == #missing
myStatus = "missing"
if (atsops.GetFileSystemStatus m.filename)[1] == #Ok
myStatus = "Ok"
if (atsops.GetFileSystemStatus m.filename)[1] == #Found
myStatus = "Found"
if (atsops.GetFileSystemStatus m.filename)[1] == #NetworkPath
myStatus = "NetworkPath"
if (atsops.GetFileSystemStatus m.filename)[1] == #Unknown
myStatus = "Unknown"
print myStatus

anyway UNKNOWN

artrender

THANKS A LOT

BUT ANYWAY I get

#(#UNKNOWN)
#(#UNKNOWN)
#(#UNKNOWN)

In asset tracking I don't have UNKNOWN at all

artrender

BUT THIS FUNCTION IS WORKING


atsops.GetFiles &fileList
-- Get missing files
missingFiles = for val in fileList where ((atsops.GetFileSystemStatus val)[1] == #missing) collect val

I don't know what's the problem!

Reply to artrender
Branko Živković

I clean up code a bit

fn getmapsfromselection bmpForSel:&bitmaps_for_selection = if selection.count != 0 do
(
for s in selection where s.material != null do
(
newbitmaps = getclassinstances Bitmaptexture target:s.material
if newbitmaps.count != 0 do
(
for b in newbitmaps where (finditem bmpForSel b == 0) do append bmpForSel b
--or u can use this : for b in newbitmaps do appendIfUnique bmpForSel b
)
if bmpForSel.count != 0 do
(
for m in bmpForSel where doesFileExist m.filename do
(
mystatus = ATSOps.GetFileSystemStatus (m.filename)
format "%\n" mystatus
)
)
)
)

artrender

also UNKNOWN


mystatus=(ATSOps.GetFileSystemStatus m.filename)[1]
     print mystatus

gives unknown as well

artrender

I get UNKNOWN STATUS, and don't know why


fn getmapsfromselection = 
 (
  for s in selection do 
  (
   if s.material!=undefined then 
   (
    newbitmaps=getclassinstances Bitmaptexture target:s.material
                      for b in newbitmaps do 
     if (finditem bitmaps_for_selection b==0) then append bitmaps_for_selection b
   )
  )

  for m in bitmaps_for_selection do
  (
   if m.filename!=undefined then 
   (
     mystatus=ATSOps.GetFileSystemStatus  m.filename
     print mystatus
     
   )
  )
 )

Reply to artrender
Branko Živković

I'm not in front of my PC.
When you check bitmap path is better to use
if doesFileExist m.filename do ...

artrender

error

ATSOps.GetFileSystemStatus m.filename

Attachments