<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technical Art for Games &#187; Mac</title>
	<atom:link href="http://adammechtley.com/tag/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://adammechtley.com</link>
	<description>Tips, Tutorials, and Tools - by Adam Mechtley</description>
	<lastBuildDate>Thu, 12 Jan 2012 02:11:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Using SVN and UAS to Synchronize Library Code in Unity</title>
		<link>http://adammechtley.com/2011/01/using-svn-and-uas-to-synchronize-library-code-in-unity/</link>
		<comments>http://adammechtley.com/2011/01/using-svn-and-uas-to-synchronize-library-code-in-unity/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 02:01:33 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Unity]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Unity Asset Server]]></category>

		<guid isPermaLink="false">http://adammechtley.com/?p=853</guid>
		<description><![CDATA[So, you&#8217;ve bought Unity Pro and the Unity Asset server. If you&#8217;re like me, in spite of its disadvantages, you really like the UAS. It&#8217;s integrated into the editor and does a much cleaner job of versioning on serialized assets than does external version control, because it operates on the project&#8217;s Library folder rather than [...]]]></description>
			<content:encoded><![CDATA[<p>So, you&#8217;ve bought <a title="Unity game engine" href="http://unity3d.com/unity/">Unity Pro</a> and the <a title ="Unity Asset Server" href="http://unity3d.com/unity/features/unity-asset-http://unity3d.com/unity/features/unity-asset-server">Unity Asset server</a>. If you&#8217;re like me, in spite of its disadvantages, you really like the UAS. It&#8217;s integrated into the editor and does a much cleaner job of versioning on serialized assets than does external version control, because it operates on the project&#8217;s Library folder rather than requiring you to generate and synchronize all of the sidecar data. However, there are some key things it cannot do.</p>
<p>I don&#8217;t have very complicated needs like branching and so on, but I do have a library of common code that I share across projects. This library contains a bunch of useful stuff that doesn&#8217;t rely on any game systems: things like helper classes, math classes, serialization for built-in types, and so on. The trouble is, I&#8217;m often working simultaneously on a bunch of projects that share my library (or worse still <em>parts</em> of my library), and so it can be a pain in the neck to push the changes out across all my projects. As such, I took the time to set up a system using Subversion working on top of my UAS projects in order to synchronize my library code.</p>
<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/qf80-kcDIyQ?hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/qf80-kcDIyQ?hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object><br />
<span id="more-853"></span><br />
Apart from Unity, you obviously need Subversion. If you&#8217;re on OS X, this is part of Snow Leopard, so you&#8217;re good to go. Because I&#8217;m not especially adept at all the setup, and because there are plenty of <a title="Setting up Subversion in Snow Leopard" href="http://www.mosacrea.com/howto-setup-a-svn-server-under-mac-os-x-10-6-in-less-than-1-min/">really good tutorials</a>, I won&#8217;t go through all the details. Basically, you need to prepare a repository somewhere and get a good SVN client. If you&#8217;re on OS X, I really recommend <a title = "Cornerstone SVN client for OS X" href="http://www.zennaware.com/cornerstone/index.php">Cornerstone</a>. It&#8217;s not open source, but it does some key things I need:</p>
<ol>
<li>It has a great GUI. Apart from letting you do things easily, it also allows you to set up each working copy to show when it is out of sync, so I know which Unity projects needs to pull down new library updates.</li>
<li>The GUI lets you effortlessly modify your snvignore settings, allowing you to exclude all of your non-library code from your SVN repo. For example, I only want to include folders like <strong>Assets/ Scripts/Library</strong>, and <strong>Assets/Editor/Library</strong>, so I want to be able to easily exclude my per-project code and assets from the SVN repo.</li>
<li>It lets me take advantage of sparse checkout features in SVN. This feature was actually the deciding factor for me, as I distribute <a title="Adam Mechtley's Unity Asset Store Tools" href="http://adammechtley.com/2011/01/unity-asset-store-updates/">packages in the Unity Asset Store</a> with limited copies of my library code. For example, my <a title="Adam Mechtley's Biped Editor for Unity" href="http://adammechtley.com/2010/11/biped-editor-released-2/">Biped Editor package</a> contains library code for my VectorHelpers class, but not FloatMatrix. This requirement was also part of the reason I opted for SVN instead of Git. Maybe it&#8217;s possible to manage it easily with Git, but it wasn&#8217;t something I was up for fighting against!</li>
</ol>
<p>The basic requirement to make this work as painlessly as possible is to have parallel structure in your Unity projects. I have a generally parallel structure, but because of Asset Store requirements, for example, my library code needs to be in folders like <strong>Assets/PackageName/ Scripts/Library</strong>, whereas all of my games are simply <strong>Assets/ Scripts/Library</strong>. Because of this issue, instead of making my <strong>Assets</strong> folder top-level in my repo, the repo simply has <strong>Scripts/Library</strong>, <strong>Editor/Library</strong>, and <strong>Plugins/Library</strong> at the top level. The problem in the video, as you can see, is that all of my working copies for my games are called Assets, whereas having <strong>Assets</strong> as the top-level folder in my repo would allow Cornerstone to display my Unity project folder names in the working copy list, so I wouldn&#8217;t have to look in the inspector to double-check what project I&#8217;m in. Depending on your SVN client, you may or may not experience this problem. Probably the absolute easiest way to set your project up is to have an <strong>Assets/Library</strong> and an <strong>Assets/Game</strong> folder in your project, the latter of which contains all of your actual per-game stuff. Using this organization, you would only have to apply svnignore to the <strong>Assets/Game</strong> folder in your working copy, instead of having to add all of your individual project folders. I leave it up to you to know what is best for your needs, but it suffices to say &#8220;stop and think about it before you pull the trigger.&#8221; Once you&#8217;ve picked out your organization system, export your library code as a unitypackage from Unity&#8217;s main menu.</p>
<p>At this point, create a new, empty Unity project and make it a working copy of your new SVN repo. In my case, I had to point to my project folder and call the working copy Assets because of my organizational structure. Again, if your repo will contain <strong>Assets</strong>, your project folder can be your working copy folder, but you&#8217;ve probably already figured that out.</p>
<p>Now, import your unitypackage into this empty project using the one you just created. This will populate your project with your library code.</p>
<p>Finally, check your library into the repo and voila! Now you have a common code library under version control sitting on top of your Unity project, which is managed using the Asset Server.</p>
<p>Now, if you set up a new project, just always make it a working copy of your repo first thing. If you dump all of your game assets into a folder that is already ignored (e.g., <strong>Assets/Game</strong>), then you shouldn&#8217;t have further work to do. Otherwise, make sure you remember to ignore your non-library folders when you commit any library code changes to your SVN repo. Using a client like Cornerstone, any new folders will show up in bold in your working copy view, and you can easily ignore them from the inspector or using the RMB context menu.</p>
<p>If you want to get extant projects set up on your SVN repo, you may want to first rename your extant project folders whose names conflict with those on the repo. You can then make your project a working copy and move over anything from your renamed folders that you need to keep and ignore or commit to the repo.</p>
<p>I hope some of you find this helpful, but if not at least I&#8217;ve documented it for myself!</p>
]]></content:encoded>
			<wfw:commentRss>http://adammechtley.com/2011/01/using-svn-and-uas-to-synchronize-library-code-in-unity/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Setting up your PYTHONPATH environment variable globally on OSX</title>
		<link>http://adammechtley.com/2009/10/setting-up-your-pythonpath-environment-variable-globally-on-osx/</link>
		<comments>http://adammechtley.com/2009/10/setting-up-your-pythonpath-environment-variable-globally-on-osx/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 18:29:00 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[General Interest]]></category>
		<category><![CDATA[Maya Python]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Maya]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://www.adammechtley.com/?p=459</guid>
		<description><![CDATA[Here&#8217;s another time-saver for OSX users. Don&#8217;t use environment.plist for global environment variables! When you want to add locations to your Python path, you have a couple of different options. Ryan talked about this in greater detail on his site, so I won&#8217;t go into the details for all of these. If you want to [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s another time-saver for OSX users. Don&#8217;t use <a href="http://developer.apple.com/mac/library/qa/qa2001/qa1067.html">environment.plist</a> for global environment variables!<br />
<span id="more-459"></span><br />
When you want to add locations to your Python path, you have a couple of different options. Ryan talked about this in <a title="Importing modules and changing your Python path for Maya" href="http://www.rtrowbridge.com/blog/2008/11/27/maya-python-import-scripts/">greater detail</a> on his site, so I won&#8217;t go into the details for all of these. If you want to permanently add locations to your path, you have three general alternatives:</p>
<ol>
<li>Use sys.path.append() in your userSetup.py file</li>
<li>Set the value for PYTHONPATH in your maya.env file</li>
<li>Set the value for PYTHONPATH at the system level</li>
</ol>
<p><a href="http://download.autodesk.com/us/maya/2010help/index.html?url=Python_Python_in_Maya.htm,topicNumber=d0e181290"><br />
Autodesk&#8217;s documentation</a> can help you figure out the first two methods reasonably well, and they work fine for most situations. However, if you have locations you want to use with Maya as well as other interpreters, the third option may be helpful. While doing this on Windows is relatively easy, it is a little painful on Mac OSX.</p>
<p>Most Google searching will send you to some variation on <a title="The bad way to set up an environment variable on OSX" href="http://www.astro.washington.edu/users/rowen/AquaEnvVar.html">this technique</a>, whereby you create an environment.plist file containing the value for your PYTHONPATH variable and place it in a folder ~/.MacOSX. Maybe this will work for you, but maybe it won&#8217;t. It didn&#8217;t work for me. What&#8217;s the problem?</p>
<p>Apparently, when you start an application from Spotlight as opposed to Finder, it has a different parent process—one that does not use the environment.plist file. I have gotten used to using Spotlight to start all of my applications and to perform the majority of my menu operations because it saves me huge amounts of time while working (and I don&#8217;t want to have to remember where stuff is). Fortunately, there is a fix that will ensure your environment variables will be properly set in all contexts. I suggest you <a title="How to set up a global environment variable in OSX the right way" href="http://www.digitaledgesw.com/node/31">read about the details</a> if you are interested, but if you just want to work then use the following solution:</p>
<ol>
<li>If you do not have a launchd.conf file in /etc then create one</li>
<li>Edit launchd.conf to contain a line like this: <code>setenv PYTHONPATH /Users/Shared/Autodesk/maya/scripts</code></li>
<li>Reboot</li>
</ol>
<p>You can now confirm that this has worked by opening Terminal from Spotlight and entering the <code>set</code> command.</p>
]]></content:encoded>
			<wfw:commentRss>http://adammechtley.com/2009/10/setting-up-your-pythonpath-environment-variable-globally-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

