View Full Version : where is maya looking...

04 April 2006, 05:54 AM
If I have a nodeIconButton and the image is set to "myIcons\\icon1.bmp", where is it looking? I have placed my "myIcons" directory in every folder I can think of with no success.
If I give an absolute path, it works, but this relative path is confusing this beginner mel guy.

04 April 2006, 06:15 AM
OK found the problem, but it had nothing to do with location.
however it is pointing to the bin file which I assumed.

I see that the real problem is that when I make my UI, once it fails to load the icons, then the next time it tries to open the dialog it fails even if icons are there now. Is there some type of cache that I can block or something. Why doesn't it update the new stuff? I am sure it is something simple... just started mel.



04 April 2006, 06:50 AM
wow, I just tried to read my last post and it confuses me.

Let me clear things up.

I see that the real problem is that when I make my UI if some of the nodeIconButton's icons don't exist then it gives me a warning and just fills the button in with a blank icon. Now lets say all icons exist in the directory, and I try running the script again. Now even though the icon files exist, maya doesn't replace the blank icon from the previous time. I guess I am wondering how to solve this. Do I have to destroy the buttons before remaking the UI? I am not sure what to do here.

edit1: If I close maya and relaunch the script, All Icons appear.
edit2:Here is the error it gives when it doesn't load icon.
// Warning: File not found: D:/3D/Maya/scripts/cr_icons/i9.bmp //
but the file does exist. D:/3D/Maya/scripts/cr_icons/i9.bmp

I have tried refreshing the control with -edit image1 and have also tried deleting control.
no success.
It seems that MAYA might not be releasing error'd open file handles. Is there a way to release this?


04 April 2006, 08:59 AM
Maya is a bitch when it comes to icons...
Try renaming the icons from *.bmp to *.BMP

04 April 2006, 01:15 PM
Thanks, I will try it.

Right now I have fixed the problem by having a proc that builds my scroll area with my iconButtons. Then I just delete the scroll area and redraw it... Kind of sucks but works for now. I really hope it is a .bmp->.BMP problem.

Anyone have any luck setting a scroll position. I can get the x,y pos before I delete it like so:

int $scrollPos[2] = `scrollLayout -q -scrollAreaValue $scrCtl`;

but when I redraw it I cannot set the scroll pos. Here is how I set it, let me know if this is right:

//$scrollCtrl is my control string returned by scrollLayout creation
// $scrY and $scrX are == to $scrollPos[0] & $scrollPos[1] respectively
scrollLayout -e -sbp "down" $scrY -sbp "right" $scrX $scrollCtrl ;
// I have even just tried the down
scrollLayout -e -sbp "down" $scrY $scrollCtrl ;

04 April 2006, 01:19 AM
the .BMP didn't work...

04 April 2006, 11:01 AM
The bmp trick did it for me and I have not had any bad feedback either...
I was thinking:
Have you tried to use a formLayout to attach the scrollLayout at the top AND bottom?

04 April 2006, 01:24 AM
Im sorry I am unfamiliar with the terms of mel yet, this is my second attempt at scripting and maya in general. Please bear with me. I don't entirely understand your question. I will do some UI research right now and learn about what you posted. (but This isn't the problem... read on)

I actually did a SIMPLE (separate) test and it works with both .bmp or .BMP (I am on WinXP pro). So the problem must be somewhere deeper in the code.

I think the reason it may not be working is that it has to render the icon file first and then load it. I think the call is not finishing before it tries to load the icon. I am using this:
string $img = `render -x 50 -y 50`;
Is there some type of a timer or thread I can launch to check for this icon and then update it. I will place a refresh button for now and see if that works. Thanks for your help so far, I really appriciate it.

04 April 2006, 08:01 AM
Maya works in mysterious ways :)
You are rendering an image to disk to later use it as an icon?

04 April 2006, 06:01 PM
>>You are rendering an image to disk to later use it as an icon?

Made a simple timer, here it is anyone who wants it.
Found some code online and made it work for this situation.
Here is the link:

global proc int cr_TimerFileCheck(string $fName, string $progTitle, int $expTime)
created by: Chris Reid
date: 2006-April-06
description:this script takes a filename, progress title (window title), and expirationTime as args.
filename - is self explanatory.
progress title - this is the title of the window running the progress bar.
expirationTime - integer of how many seconds to check for.

dgtimer -on -reset;
$startTime = `timerX`;
print("StartTime: "+$startTime+"\n");
float $elapsedTime = 0;
float $mult = 100/$expTime;// %of time alloded

string $stat = "Calculating: 0%";// current progress status

-title $progTitle
-progress ((int)$elapsedTime)
-status $stat
-isInterruptable true;

int $ret = 0; /*******return values **********
** [0::TimedOut]
** [1::ProgressEnd/TimedOut=100%]
** [2::ESCaped/Cancelled]
** [3::FileFound]
waitCursor -state on;

while($elapsedTime < $expTime)
{ $elapsedTime = `timerX -startTime $startTime`;// want a pause: `pause -sec 1`;

// Check if end condition has been reached
if ( `progressWindow -query -progress` >= 100 )

// Check if the dialog has been cancelled
if ( `progressWindow -query -isCancelled` )

if(`filetest -r $fName`)
{$ret = 3;break;}
//if($ret>0) break;

$stat = "Calculating: "+($elapsedTime*$mult)+"%";
progressWindow -edit
-progress ((int)($elapsedTime*$mult))
-status $stat;

progressWindow -endProgress;
dgtimer -off;

waitCursor -state off;
return $ret;

CGTalk Moderation
04 April 2006, 06:01 PM
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.