Thanks a lot. I use Sublime Text (www.sublimetext.com/) for simple scripts like these in the tutorial. For more complex ones I use PyCharm (www.jetbrains.com/pycharm/).
I wanna change to blinn with some dark color in it. I tried to copy the blinn setattr ( Mel command ) to startup file but it didnt work. any help? plus I'd want anti aliasing to be turned on by on startup as well please
As for blinn not working, have you create separate py file with your shader setup and then imported that into userSetup.py? Command for changing color would look like this. cmds.setAttr('blinn_grey.color', 0.25, 0.25, 0.25) As for viewport AA you can use: cmds.setAttr('hardwareRenderingGlobals.multiSampleEnable', 1)
nice script but it's not working for me in 2020. The only thing that happens is that animbot stops his autostart ^^ I will dig deeper into it on a later point. Thx for sharing!
Can you help me with this?? (Solved: Soln in Replies) Failed to execute userSetup.py Traceback (most recent call last): File "C:/Users/samar/Documents/maya/2016/scripts\userSetup.py", line 2, in import jj_startup File "C:/Users/samar/Documents/maya/2016/scripts\jj_startup.py", line 5 cmds.autoSave(enable=True,destination=1,folder='F:\xtemp\Maya_File_Recovery')
Hi Samarth, it's very strange as that line of code seems correct to me. Can you try to type that line again in the script and make sure that folder actually exists? cmds.autoSave(enable=True, destination=1, folder='F:\xtemp\Maya_File_Recovery')
@@JanJinda Actually I did not need the autosave feature it was already working for me...So I removed autosave and undo functions from both the files and now it has a new error similar to the previous one. I've posted the screenshot of the code and error here imgur.com/a/gtajms2
Ah right, sure. You are getting indentation error. Select everything after def defaultShader(): and press TAB. It'll insert an indent. It basically says that everything which is indented is a part of the defaultShader function. Right now there nothing in there, therefore you are getting that error. import maya.cmds as cmds def defaultShader(): cmds.shadingNode('blinn', asShader=True, name='xyzblinn') cmds.connectAttr('xyzblinn.outColor', 'initialShadingGroup.surfaceShader', force=True) print 'Default lambert changed'
@@JanJinda Thanks man It worked :) Though I was getting same error when adding TAB to those lines so I added two spaces after those lines instead of hitting Tab key and it worked :)
No worries, I'm glad it works for you. It usually gives an error when spaces are mixed with TABs. Proper scripting editors are taking care of that themselves tough. It should be either TAB or four spaces.
Thanks for the tutorial.
What editor you have used to write scripts?
Thanks a lot. I use Sublime Text (www.sublimetext.com/) for simple scripts like these in the tutorial. For more complex ones I use PyCharm (www.jetbrains.com/pycharm/).
I wanna change to blinn with some dark color in it. I tried to copy the blinn setattr ( Mel command ) to startup file but it didnt work. any help? plus I'd want anti aliasing to be turned on by on startup as well please
As for blinn not working, have you create separate py file with your shader setup and then imported that into userSetup.py?
Command for changing color would look like this.
cmds.setAttr('blinn_grey.color', 0.25, 0.25, 0.25)
As for viewport AA you can use:
cmds.setAttr('hardwareRenderingGlobals.multiSampleEnable', 1)
@@JanJinda Might try that thanks dude👍
No problem
Does this work with Maya 2022? I've followed your script but nothing happened. Maybe because of python3?
It won’t work with 2022 because of python 3 indeed. I’ll update it in upcoming months.
@@JanJinda Thanks ill keep an lookout for it 🙂
Me too :))
nice script but it's not working for me in 2020. The only thing that happens is that animbot stops his autostart ^^
I will dig deeper into it on a later point. Thx for sharing!
2020 should be fine. Check if OBJ plug-in is enabled in preferences. 2022 does not work as it’s Python 2 for now. I’ll update it soon
Can you help me with this?? (Solved: Soln in Replies)
Failed to execute userSetup.py
Traceback (most recent call last):
File "C:/Users/samar/Documents/maya/2016/scripts\userSetup.py", line 2, in
import jj_startup
File "C:/Users/samar/Documents/maya/2016/scripts\jj_startup.py", line 5
cmds.autoSave(enable=True,destination=1,folder='F:\xtemp\Maya_File_Recovery')
Hi Samarth, it's very strange as that line of code seems correct to me. Can you try to type that line again in the script and make sure that folder actually exists?
cmds.autoSave(enable=True, destination=1, folder='F:\xtemp\Maya_File_Recovery')
@@JanJinda Actually I did not need the autosave feature it was already working for me...So I removed autosave and undo functions from both the files and now it has a new error similar to the previous one. I've posted the screenshot of the code and error here imgur.com/a/gtajms2
Ah right, sure. You are getting indentation error. Select everything after def defaultShader(): and press TAB. It'll insert an indent. It basically says that everything which is indented is a part of the defaultShader function. Right now there nothing in there, therefore you are getting that error.
import maya.cmds as cmds
def defaultShader():
cmds.shadingNode('blinn', asShader=True, name='xyzblinn')
cmds.connectAttr('xyzblinn.outColor', 'initialShadingGroup.surfaceShader', force=True)
print 'Default lambert changed'
@@JanJinda Thanks man It worked :) Though I was getting same error when adding TAB to those lines so I added two spaces after those lines instead of hitting Tab key and it worked :)
No worries, I'm glad it works for you. It usually gives an error when spaces are mixed with TABs. Proper scripting editors are taking care of that themselves tough. It should be either TAB or four spaces.