Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Run a python script automatically when a specific scene open, and ONLY then

Run a python script automatically when a specific scene open, and ONLY then

Anonymous
Not applicable
2,880 Views
3 Replies
Message 1 of 4

Run a python script automatically when a specific scene open, and ONLY then

Anonymous
Not applicable

Hello!,

 

I have a script that reads 2 float numbers from a csv file and place this numbers in a floatConstant shader in hypershade. I want every time that a specific scene open (this scene have the hypershade with the shaders embedded) the script running too.

 

First of all I tried to put the script as "userSetup.py" in the Maya script folder and with an If- statement check if the "right" scene open. But nothing happend.

 

Do anybody  have ever face this problem??

 

Thanks in advance!

 

Dimitris

 

0 Likes
2,881 Views
3 Replies
Replies (3)
Message 2 of 4

mspeer
Consultant
Consultant

Hi!

 

You could try "scriptJob" to achieve what you want, but i recommend to directly apply a Mel script node to the scene.

http://help.autodesk.com/view/MAYAUL/2018/ENU/?guid=GUID-1008E969-3AB8-479C-B2F4-FF5F589A23C6

0 Likes
Message 3 of 4

Anonymous
Not applicable

Hi!

 

First of all thank you for your front response. I tried with "scriptJob" but maybe I did  something wrong and it didn't work.

 

About the MEL script node, the problem is that my script is written in python. If i want to make a script node i have to translate from python to MEL, which is difficult.

 

I thought about to create a shelf button with the script and make a script node to run  this shelf button, but i don't know if it's possible (???)

 

Dimitris

 

0 Likes
Message 4 of 4

mspeer
Consultant
Consultant
0 Likes