ScriptSpot

Forum topic · General Scripting

DETECT THE STATUS OF THE TEXTURES

By artrender.info · 2013-02-25

Description

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

Comments (16)

SOLVED

artrender.info · 2013-02-25

Thx all who participated!

THE ONLY DIFFERENCE BETWEEN THESE 2 FUNCTIONS

artrender.info · 2013-02-25

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 

IN THIS FUNCTION

artrender.info · 2013-02-25


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

ERROR

artrender.info · 2013-02-25

I get this error

Attachments

barigazy · 2013-02-25

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

barigazy · 2013-02-25

I edited last fn

EVEN TONS OF IFs don't help

artrender.info · 2013-02-25


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

THANKS A LOT

artrender.info · 2013-02-25

BUT ANYWAY I get

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

In asset tracking I don't have UNKNOWN at all

BUT THIS FUNCTION IS WORKING

artrender.info · 2013-02-25


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!

barigazy · 2013-02-25

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
)
)
)
)

also UNKNOWN

artrender.info · 2013-02-25


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

gives unknown as well

I get UNKNOWN STATUS, and don't know why

artrender.info · 2013-02-25


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
     
   )
  )
 )

barigazy · 2013-02-25

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

hmm

artrender.info · 2013-02-25

you mean instead of

 if m.filename!=undefined  

????

error

artrender.info · 2013-02-25

ATSOps.GetFileSystemStatus m.filename

Attachments