<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: automatic script sourcing on maya launch</title>
	<atom:link href="http://www.onoff.ch/2008/06/25/automatic-script-sourcing-on-maya-launch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.onoff.ch/2008/06/25/automatic-script-sourcing-on-maya-launch/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automatic-script-sourcing-on-maya-launch</link>
	<description>Ramblings of a design brain with a tech heart.</description>
	<lastBuildDate>Sun, 30 Oct 2011 22:51:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: Spot</title>
		<link>http://www.onoff.ch/2008/06/25/automatic-script-sourcing-on-maya-launch/comment-page-1/#comment-8131</link>
		<dc:creator>Spot</dc:creator>
		<pubDate>Fri, 23 Oct 2009 14:47:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.onoff.ch/?p=376#comment-8131</guid>
		<description>thanks for your detailed explanations! definitely very helpful.</description>
		<content:encoded><![CDATA[<p>thanks for your detailed explanations! definitely very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: brubin1</title>
		<link>http://www.onoff.ch/2008/06/25/automatic-script-sourcing-on-maya-launch/comment-page-1/#comment-8130</link>
		<dc:creator>brubin1</dc:creator>
		<pubDate>Fri, 23 Oct 2009 13:24:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.onoff.ch/?p=376#comment-8130</guid>
		<description>hmmm,
source order in maya is a bit more complex than that....

first up - if you have set system based environment variables to wherever your maya installation resides, -which is normally done by the maya installer when your installation goes as intended- then maya finds the following folder containing MEL scripts in this order:

- program-folder:  print(`getenv &quot;MAYA_LOCATION&quot;`+&quot;/scripts/*&quot;);
- user script-directory: print( `internalVar -userAppDir`+&quot;scripts&quot;);
- maya version specific script-directory: print( `internalVar -userScriptDir`);

although the may-version specific scripts-folder gets sourced last i prefer to put my scripts in the second location, because i don&#039;t need to copy any scripts to any new directory when another maya-version comes out- this directory gets sourced by them all!

so there&#039;s really no need to specifically source a scripts like that, unless of course you want to RUN the script on maya-startup!
that&#039;s something competely different, though!

it is considered good practice however not to run scripts by simply sourcing them. that has to do with the automatic sourcing process described above: every script in those folders get sourced on maya startup- make no mistake about that! so, better do it like this:
eval( &quot;source \&quot;&quot;+`internalVar -uad` + &quot;scripts/nicescript.mel\&quot;&quot;) ;

and if this were a shelfbutton, or if you wanted to run it on startup,  you would add the call to the function as well:
nicescript();

in early versions of maya your version of the &#039;source&#039; command worked like you typed it; nowadays &#039;source&#039; often fails for reasons that escape me right now, but with &#039;eval&#039; i never had these problems!

HIH
b.</description>
		<content:encoded><![CDATA[<p>hmmm,<br />
source order in maya is a bit more complex than that&#8230;.</p>
<p>first up &#8211; if you have set system based environment variables to wherever your maya installation resides, -which is normally done by the maya installer when your installation goes as intended- then maya finds the following folder containing MEL scripts in this order:</p>
<p>- program-folder:  print(`getenv &#8220;MAYA_LOCATION&#8221;`+&#8221;/scripts/*&#8221;);<br />
- user script-directory: print( `internalVar -userAppDir`+&#8221;scripts&#8221;);<br />
- maya version specific script-directory: print( `internalVar -userScriptDir`);</p>
<p>although the may-version specific scripts-folder gets sourced last i prefer to put my scripts in the second location, because i don&#8217;t need to copy any scripts to any new directory when another maya-version comes out- this directory gets sourced by them all!</p>
<p>so there&#8217;s really no need to specifically source a scripts like that, unless of course you want to RUN the script on maya-startup!<br />
that&#8217;s something competely different, though!</p>
<p>it is considered good practice however not to run scripts by simply sourcing them. that has to do with the automatic sourcing process described above: every script in those folders get sourced on maya startup- make no mistake about that! so, better do it like this:<br />
eval( &#8220;source \&#8221;"+`internalVar -uad` + &#8220;scripts/nicescript.mel\&#8221;") ;</p>
<p>and if this were a shelfbutton, or if you wanted to run it on startup,  you would add the call to the function as well:<br />
nicescript();</p>
<p>in early versions of maya your version of the &#8216;source&#8217; command worked like you typed it; nowadays &#8216;source&#8217; often fails for reasons that escape me right now, but with &#8216;eval&#8217; i never had these problems!</p>
<p>HIH<br />
b.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

