<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>XSIBlog</title>
	
	<link>http://www.xsi-blog.com</link>
	<description>People and thoughts behind XSI in production...</description>
	<pubDate>Tue, 02 Dec 2008 17:29:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/xsi-blog/content" type="application/rss+xml" /><item>
		<title>Decorating your Python code</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/417414981/357</link>
		<comments>http://www.xsi-blog.com/archives/357#comments</comments>
		<pubDate>Sat, 11 Oct 2008 03:16:25 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=357</guid>
		<description><![CDATA[I have touched on Python decorators in the past in this article (although that decorator was a bit convoluted). Decorators can be extremely useful in many situations and here are a few that I propose may help streamline script development.
Note: For those of you who would like a bit of background information on decorators you [...]]]></description>
			<content:encoded><![CDATA[<p>I have touched on Python decorators in the past in <a href="http://www.xsi-blog.com/archives/265" >this article</a> (although that decorator was a bit convoluted). Decorators can be extremely useful in many situations and here are a few that I propose may help streamline script development.</p>
<p>Note: For those of you who would like a bit of background information on decorators you can <a href="http://www.python.org/dev/peps/pep-0318/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.python.org');">check out this page</a>.</p>
<p><b>Keeping things quiet</b></p>
<p>Let&#8217;s look at the code and we&#8217;ll go for a few explanations afterward.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">def</span> suspendXSILogging<span style="color: black;">&#40;</span>func<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> closure<span style="color: black;">&#40;</span><span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
        logPrefs = getXSILoggingPrefs<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            ret = func<span style="color: black;">&#40;</span><span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">Exception</span>, e:
            setXSILoggingPrefs<span style="color: black;">&#40;</span>logPrefs<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">raise</span>
        setXSILoggingPrefs<span style="color: black;">&#40;</span>logPrefs<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> ret
    <span style="color: #ff7700;font-weight:bold;">return</span> closure</pre></td></tr></table></div>

<p>The first function <code>suspendXSILogging</code> can be used as a decorator and will disable all logging features of XSI. This has the advantage of making large scripts that may be command dependent a bit quicker.</p>
<p>You could always implement a plugin with a custom command but sometimes a script is simpler. Even in the command context this decorator could be useful if you wanted part of the command to log to the script editor while keeping other parts silent.</p>
<p>Another advantage of this decorator is that it puts your original function in a large trap that, if an error should occur, will make sure that logging is reset to the users original preferences.</p>
<p><b>Time for decorating</b></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">def</span> timeExecution<span style="color: black;">&#40;</span>func<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> closure<span style="color: black;">&#40;</span><span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
        startTime = <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            ret = func<span style="color: black;">&#40;</span><span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">Exception</span>, e:
            delta = <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - startTime
            log.<span style="color: black;">error</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Failed in %f seconds'</span> <span style="color: #66cc66;">%</span> delta<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">raise</span>
        delta = <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - startTime
        log.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Finished in %f seconds'</span> <span style="color: #66cc66;">%</span> delta<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> ret
    <span style="color: #ff7700;font-weight:bold;">return</span> closure</pre></td></tr></table></div>

<p>This second function, timeExecution, can decorate almost any function and will print to the script editor the amount of time the decorated function took to execute. This can be used as a debugging or performance tracking tool or as a way to provide feedback to your users. Again, a trap is implemented that will log execution time even if an error occurs.</p>
<p>Please not that this decorator uses a <a href="http://www.xsi-blog.com/archives/348" >logging system described here</a>. If you would rather use simple logging you should replace <code>log.info(</code> instances by <code>log(</code>, <code>xsi.LogMessage(</code> or <code>Application.LogMessage(</code> depending on your scripting habits.</p>
<p><b>Usage example</b></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="python">@timeExecution
@suspendXSILogging
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #808080; font-style: italic;"># Do some fun useful stuff - well... more useful than this!</span>
    xsi.<span style="color: black;">CreatePrim</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Cube&quot;</span>, <span style="color: #483d8b;">&quot;MeshSurface&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span>, <span style="color: #483d8b;">&quot;&quot;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>You can chain decorators without hesitation like in this example, one thing to note in this particular case is that you&#8217;ll want <code>timeExecution</code> higher in the decorator chain than <code>suspendXSILogging</code> otherwise the time information will never make it to the script editor. Duh!</p>
<p><b>Support code</b></p>
<p>Before I sign off on this latest article, here are two functions that, if useful on their own, are essential to the functioning of the suspendXSILogging decorator.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">def</span> getXSILoggingPrefs<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    prefs = xsi.<span style="color: black;">Preferences</span>
    vals = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> n <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">'scripting.cmdlog'</span>, <span style="color: #483d8b;">'scripting.msglog'</span>, <span style="color: #483d8b;">'scripting.msglogverbose'</span><span style="color: black;">&#93;</span>:
        vals<span style="color: black;">&#91;</span>n<span style="color: black;">&#93;</span> = prefs.<span style="color: black;">GetPreferenceValue</span><span style="color: black;">&#40;</span>n<span style="color: black;">&#41;</span>
        prefs.<span style="color: black;">SetPreferenceValue</span><span style="color: black;">&#40;</span>n, <span style="color: #008000;">False</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> vals
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> setXSILoggingPrefs<span style="color: black;">&#40;</span>vals<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">for</span> key, val <span style="color: #ff7700;font-weight:bold;">in</span> vals.<span style="color: black;">iteritems</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        xsi.<span style="color: black;">Preferences</span>.<span style="color: black;">SetPreferenceValue</span><span style="color: black;">&#40;</span>key, val<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Cheers!</p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=L2826Q"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=L2826Q" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=3CEqm"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=3CEqm" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=LK3AM"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=LK3AM" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=Vh4bM"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=Vh4bM" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=6aUnM"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=6aUnM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/417414981" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/357/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/357</feedburner:origLink></item>
		<item>
		<title>Logging and being proactive</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/411630245/348</link>
		<comments>http://www.xsi-blog.com/archives/348#comments</comments>
		<pubDate>Sun, 05 Oct 2008 04:37:57 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=348</guid>
		<description><![CDATA[You write tools for artists under a deadline (yours and theirs). You live in a production oriented world. Unit testing, beta testing and anticipating can only go so far, and that is only if you have time to properly test. You have to accept that eventually, your code will break. How it breaks and how [...]]]></description>
			<content:encoded><![CDATA[<p>You write tools for artists under a deadline (yours and theirs). You live in a production oriented world. Unit testing, beta testing and anticipating can only go so far, and that is only if you have time to properly test. You have to accept that eventually, your code will break. How it breaks and how you react to such a break becomes as important as your capacity to create the tool in the first place.</p>
<p>You&#8217;ve probably seen the following idiom used many times on this website and in other places that do XSI scripting in Python:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">from</span> win32com.<span style="color: black;">client</span> <span style="color: #ff7700;font-weight:bold;">import</span> constants as c
xsi = Application
log = xsi.<span style="color: black;">LogMessage</span></pre></td></tr></table></div>

<p>It is a shortcut that allows you to use log as if it was the native LogMessage call:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="python">log<span style="color: black;">&#40;</span><span style="color: #483d8b;">'This is an info message.'</span>, c.<span style="color: black;">siInfo</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Here is a way to extend this by using the standard logging module in a way that can help you be more proactive. I suggest you get familiar with the <a href="http://docs.python.org/library/logging.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/docs.python.org');">logging module</a> from the standard <a href="http://docs.python.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/docs.python.org');">Python docs</a>, it&#8217;s bound to eventually be helpful.</p>
<p><strong>Logging in XSI</strong></p>
<p>Here is a construct I&#8217;ve started using lately that I am starting to enjoy, its advantages are:</p>
<ul>
<li>Concise and self documenting</li>
<li>It has a trap to catch any unexpected error and log it</li>
<li>Logs both to the script editor and to file</li>
<li>Easily extensible to other logging mechanisms (email, event viewer)</li>
<li>You can pass non string messages and it will convert to string for you (Yay!)</li>
<li>Easily useable in scripts and other modules</li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">from</span> hookolo.<span style="color: black;">xsi</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #66cc66;">*</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	log.<span style="color: black;">comment</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'comment'</span><span style="color: black;">&#41;</span>
	log.<span style="color: black;">debug</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'debug'</span><span style="color: black;">&#41;</span>
	log.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'info'</span><span style="color: black;">&#41;</span>
	log.<span style="color: black;">warning</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'warning'</span><span style="color: black;">&#41;</span>
	log.<span style="color: black;">error</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'error'</span><span style="color: black;">&#41;</span>
	log.<span style="color: black;">fatal</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'fatal'</span><span style="color: black;">&#41;</span>
	log.<span style="color: black;">critical</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'critical'</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">Exception</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Totally unexpected exception!'</span><span style="color: black;">&#41;</span>
&nbsp;
run<span style="color: black;">&#40;</span><span style="color: #483d8b;">'demoScript'</span>, main<span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>The code above would produce the following output in XSI&#8217;s script editor.</p>
<pre># comment
# VERBOSE : debug
# INFO : info
# WARNING : warning
# ERROR : error
# ERROR : fatal
# FATAL : critical
# ERROR : Trap reached in demoScript
# Traceback (most recent call last):
#   File "C:\hookolo\libs\hookolo\xsi\__init__.py", line 18, in run
#     func(*args, **kwargs)
#   File "&lt;script Block &gt;", line 11, in main
# Exception: Totally unexpected exception!
# ERROR : Traceback (most recent call last):
#   File "&lt;script Block &gt;", line 13, in &lt;module&gt;
#     run('demoScript', main)
#   File "C:\hookolo\libs\hookolo\xsi\__init__.py", line 21, in run
#     raise StopScriptError('Check the logs!')
# StopScriptError: Check the logs!
#  - [line 13]</pre>
<p>The calls to log.comment, log.debug, log.info, log.warning, log.error and log.critical are all self explanatory as they are all equivalent to LogMessage calls with the appropriate severity argument. The call log.fatal is an addition of my own who&#8217;s severity is equivalent or just a tiny bit lower than critical. Fatal errors will not pop a dialog box.</p>
<p>In the setup I have here, both fatal and critical, will be logged to a file in the users&#8217; XSI_HOME directory that looks like follows.</p>
<pre>2008-10-04 23:46:13,720 - hookolo.xsi - FATAL - fatal
2008-10-04 23:46:13,720 - hookolo.xsi - CRITICAL - critical
2008-10-04 23:46:13,720 - hookolo.xsi - FATAL - Trap reached in demoScript
Traceback (most recent call last):
  File "C:\hookolo\libs\hookolo\xsi\__init__.py", line 18, in run
    func(*args, **kwargs)
  File "&lt;script Block &gt;", line 11, in main
Exception: Totally unexpected exception!</pre>
<p>By having a file like this, I don&#8217;t have to wade through XSI&#8217;s scripting log as I have a file that only includes important script errors. I also don&#8217;t have to worry about a user coming to me and saying: &#8220;Your script exploded.&#8221; Followed by the inevitable: &#8220;No, I don&#8217;t remember the error and I don&#8217;t have it in my scripting window anymore.&#8221; Now I can just open up this file from their XSI_HOME directory and look for myself.</p>
<p>The usage of a main() function and a run() function allows to build a trap for any unexpected errors that might occur and allow for logging. By putting the runner in a library we can benefit from it with very little hassle in even the tiniest of scripts.</p>
<p><strong>Pushing the envelope</strong></p>
<p>A system such as this one could even easily be extended to allow for sending of fatal and critical errors via email. You would know that a script failed even before the artist had walked the corridor to your office to tell you about the failure. This extension wouldn&#8217;t even be that hard as the logging module includes an SMTPHandler for just this purpose.</p>
<p><strong>Support code</strong></p>
<p>Here is the library that makes this all possible.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
</pre></td><td class="code"><pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">types</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> win32com.<span style="color: black;">client</span> <span style="color: #ff7700;font-weight:bold;">import</span> constants as c
<span style="color: #ff7700;font-weight:bold;">from</span> win32com.<span style="color: black;">client</span> <span style="color: #ff7700;font-weight:bold;">import</span> Dispatch
&nbsp;
__all__ = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'xsi'</span>, <span style="color: #483d8b;">'log'</span>, <span style="color: #483d8b;">'c'</span>, <span style="color: #483d8b;">'run'</span>, <span style="color: #483d8b;">'XSIError'</span><span style="color: black;">&#93;</span>
&nbsp;
COMPANY_NAME = <span style="color: #483d8b;">'Hookolo'</span>
COMPANY_PREFIX = <span style="color: #483d8b;">'hookolo'</span>
&nbsp;
xsi = Dispatch<span style="color: black;">&#40;</span><span style="color: #483d8b;">'XSI.Application'</span><span style="color: black;">&#41;</span>.<span style="color: black;">Application</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> run<span style="color: black;">&#40;</span>scriptName, func, <span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">try</span>:
		func<span style="color: black;">&#40;</span><span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">except</span>:
		log.<span style="color: black;">log</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">45</span>, <span style="color: #483d8b;">'Trap reached in %s'</span> <span style="color: #66cc66;">%</span> scriptName, exc_info=<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">raise</span> StopScriptError<span style="color: black;">&#40;</span><span style="color: #483d8b;">'Check the logs!'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> XSILogger<span style="color: black;">&#40;</span><span style="color: #dc143c;">logging</span>.<span style="color: black;">Logger</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">def</span> fatal<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, msg, <span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
		<span style="color: #008000;">self</span>.<span style="color: black;">log</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">45</span>, msg, <span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">def</span> comment<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, msg, <span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>:
		<span style="color: #008000;">self</span>.<span style="color: black;">log</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span>, msg, <span style="color: #66cc66;">*</span>args, <span style="color: #66cc66;">**</span>kwargs<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> XSIHandler<span style="color: black;">&#40;</span><span style="color: #dc143c;">logging</span>.<span style="color: black;">Handler</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">def</span> emit<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, record<span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> record.<span style="color: black;">levelno</span> == <span style="color: #dc143c;">logging</span>.<span style="color: black;">CRITICAL</span>:
			xsiLvl = c.<span style="color: black;">siFatal</span>
		<span style="color: #ff7700;font-weight:bold;">elif</span> record.<span style="color: black;">levelno</span> <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #dc143c;">logging</span>.<span style="color: black;">ERROR</span>, <span style="color: #ff4500;">45</span><span style="color: black;">&#93;</span>:
			xsiLvl = c.<span style="color: black;">siError</span>
		<span style="color: #ff7700;font-weight:bold;">elif</span> record.<span style="color: black;">levelno</span> == <span style="color: #dc143c;">logging</span>.<span style="color: black;">WARNING</span>:
			xsiLvl = c.<span style="color: black;">siWarning</span>
		<span style="color: #ff7700;font-weight:bold;">elif</span> record.<span style="color: black;">levelno</span> == <span style="color: #dc143c;">logging</span>.<span style="color: black;">INFO</span>:
			xsiLvl = c.<span style="color: black;">siInfo</span>
		<span style="color: #ff7700;font-weight:bold;">elif</span> record.<span style="color: black;">levelno</span> == <span style="color: #dc143c;">logging</span>.<span style="color: black;">DEBUG</span>:
			xsiLvl = c.<span style="color: black;">siVerbose</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			xsiLvl = c.<span style="color: black;">siComment</span>
&nbsp;
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">isinstance</span><span style="color: black;">&#40;</span>record.<span style="color: black;">msg</span>, <span style="color: #dc143c;">types</span>.<span style="color: black;">StringTypes</span><span style="color: black;">&#41;</span>:
			msg = <span style="color: #008000;">self</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>record<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			record.<span style="color: black;">msg</span> = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>record.<span style="color: black;">msg</span><span style="color: black;">&#41;</span>
			msg = <span style="color: #008000;">self</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span>record<span style="color: black;">&#41;</span>
&nbsp;
		xsi.<span style="color: black;">LogMessage</span><span style="color: black;">&#40;</span>msg, xsiLvl<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> getLogger<span style="color: black;">&#40;</span>name=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">if</span> name <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:
		<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">logging</span>.<span style="color: black;">getLogger</span><span style="color: black;">&#40;</span>COMPANY_PREFIX + <span style="color: #483d8b;">'.xsi'</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">else</span>:
		<span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">logging</span>.<span style="color: black;">getLogger</span><span style="color: black;">&#40;</span>COMPANY_PREFIX + <span style="color: #483d8b;">'.xsi.'</span> + name<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">hasattr</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>, <span style="color: #483d8b;">'XSI_LOGGING_CONFIGURED'</span><span style="color: black;">&#41;</span>:
	<span style="color: #dc143c;">logging</span>.<span style="color: black;">setLoggerClass</span><span style="color: black;">&#40;</span>XSILogger<span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">logging</span>.<span style="color: black;">addLevelName</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">45</span>, <span style="color: #483d8b;">'FATAL'</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">logging</span>.<span style="color: black;">addLevelName</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">5</span>, <span style="color: #483d8b;">'COMMENT'</span><span style="color: black;">&#41;</span>
	log = <span style="color: #dc143c;">logging</span>.<span style="color: black;">getLogger</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	xsiHandler = XSIHandler<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	xsiHandler.<span style="color: black;">setLevel</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
	fileHandler = <span style="color: #dc143c;">logging</span>.<span style="color: black;">FileHandler</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">environ</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'XSI_USERHOME'</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'xsiScriptLog.txt'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	fileHandler.<span style="color: black;">setFormatter</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">logging</span>.<span style="color: black;">Formatter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%(asctime)s - %(name)s - %(levelname)s - %(message)s&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	fileHandler.<span style="color: black;">setLevel</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">45</span><span style="color: black;">&#41;</span>
	log.<span style="color: black;">addHandler</span><span style="color: black;">&#40;</span>xsiHandler<span style="color: black;">&#41;</span>
	log.<span style="color: black;">addHandler</span><span style="color: black;">&#40;</span>fileHandler<span style="color: black;">&#41;</span>
	log.<span style="color: black;">setLevel</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">sys</span>.<span style="color: black;">XSI_LOGGING_CONFIGURED</span> = <span style="color: #008000;">True</span>
&nbsp;
log = getLogger<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> XSIError<span style="color: black;">&#40;</span><span style="color: #008000;">Exception</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> StopScriptError<span style="color: black;">&#40;</span>XSIError<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">pass</span></pre></td></tr></table></div>


<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=KKr9QC"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=KKr9QC" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=wRXlm"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=wRXlm" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=wqhMM"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=wqhMM" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=1EtXM"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=1EtXM" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=wZ3aM"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=wZ3aM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/411630245" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/348/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/348</feedburner:origLink></item>
		<item>
		<title>Gerstner Waves 102</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/407918618/342</link>
		<comments>http://www.xsi-blog.com/archives/342#comments</comments>
		<pubDate>Wed, 01 Oct 2008 04:57:23 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=342</guid>
		<description><![CDATA[During the Gerstner Wave 101 video I alluded to stacking multiple waves together to create more complex surfaces. The idea is that for each successive wave or octave that is added onto the effect, the number of waves be greater, the amplitude be smaller and the speed be slower.
Note: To see your full effect, make [...]]]></description>
			<content:encoded><![CDATA[<p>During the <a title="Gerstner Waves 101" href="http://www.xsi-blog.com/archives/336"  target="_self">Gerstner Wave 101</a> video I alluded to stacking multiple waves together to create more complex surfaces. The idea is that for each successive wave or octave that is added onto the effect, the number of waves be greater, the amplitude be smaller and the speed be slower.</p>
<p><strong>Note</strong>: To see your full effect, make sure when you stack multiple waves onto each other, that the mute and solo checkboxes be clear and that the &#8220;last wave&#8221; checkbox be only active on the Gerstner Wave compound plugged lowest into the terminal node or your ICE tree.</p>
<p style="text-align: center;">[There is a video that cannot be displayed in this feed. <a href="http://www.xsi-blog.com/archives/342" >Visit the blog entry to see the video.]</a></p>
<p style="text-align: left;">If you wish to purchase this set of wave tools, you can <a title="Purchase Gerstner Waves" href="/0001-purchase" target="_self">go here</a>.</p>
<p style="text-align: left;">Have fun!</p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=g7Rltv"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=g7Rltv" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=cxnxl"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=cxnxl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=xTpWL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=xTpWL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=YwGbL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=YwGbL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=5xj4L"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=5xj4L" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/407918618" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/342/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/342</feedburner:origLink></item>
		<item>
		<title>Gerstner Waves 101</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/407294432/336</link>
		<comments>http://www.xsi-blog.com/archives/336#comments</comments>
		<pubDate>Tue, 30 Sep 2008 14:04:35 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=336</guid>
		<description><![CDATA[With the set of Gerstner Waves available for purchase it was obvious that there should be some usage videos posted here so here is the first one describing how to install it and the basic parameters. Of course the compound installation methodology applies to any compound you might download off the Softimage Community Site or [...]]]></description>
			<content:encoded><![CDATA[<p>With the set of <a href="/0001-purchase">Gerstner Waves available for purchase</a> it was obvious that there should be some usage videos posted here so here is the first one describing how to install it and the basic parameters. Of course the compound installation methodology applies to any compound you might download off the <a href="http://community.softimage.com/index.php" onclick="javascript:pageTracker._trackPageview('/outbound/article/community.softimage.com');">Softimage Community Site</a> or from anywhere else.</p>
<p style="text-align: center;">[There is a video that cannot be displayed in this feed. <a href="http://www.xsi-blog.com/archives/336" >Visit the blog entry to see the video.]</a></p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=ZvftVr"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=ZvftVr" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=Z2AWl"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=Z2AWl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=yB4DL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=yB4DL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=wVbQL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=wVbQL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=NO6HL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=NO6HL" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/407294432" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/336/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/336</feedburner:origLink></item>
		<item>
		<title>Gerstner Waves for sale</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/407263352/330</link>
		<comments>http://www.xsi-blog.com/archives/330#comments</comments>
		<pubDate>Tue, 30 Sep 2008 13:25:04 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=330</guid>
		<description><![CDATA[After some hard work and some great feedback from a few people I&#8217;ve decided to put my Gerstner wave compounds up for sale.
At their current price of 40$ they&#8217;re a steal, as far as I&#8217;m concerned.
If you want to get your mitts on your own copy, check out the purchase page where you can securely [...]]]></description>
			<content:encoded><![CDATA[<p>After some hard work and some great feedback from a few people I&#8217;ve decided to put my Gerstner wave compounds up for sale.</p>
<p>At their current price of 40$ they&#8217;re a steal, as far as I&#8217;m concerned.</p>
<p>If you want to get your mitts on your own copy, check out the <a href="/0001-purchase">purchase page</a> where you can securely buy via credit card or PayPal.</p>
<p>For those of you who don&#8217;t care about waves but would still like to show your appreciation for XSIBlog you can still <a href="http://www.xsi-blog.com/?page_id=98" >donate</a>.</p>
<p>Cheers,<br />
Patrick</p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=Z9sc1B"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=Z9sc1B" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=gaLpl"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=gaLpl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=nzBEL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=nzBEL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=ka3XL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=ka3XL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=8ndsL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=8ndsL" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/407263352" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/330/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/330</feedburner:origLink></item>
		<item>
		<title>Why settle for one Python when you can have two</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/399477501/294</link>
		<comments>http://www.xsi-blog.com/archives/294#comments</comments>
		<pubDate>Mon, 22 Sep 2008 04:38:45 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=294</guid>
		<description><![CDATA[For the first time I was confronted this week with running XSI 32bits and XSI 64bits on the same Windows x64 system. I&#8217;d tried it in the past just as a challenge to get it to work but now the crew I was working with actually had some production needs for it.
It was so simple [...]]]></description>
			<content:encoded><![CDATA[<p>For the first time I was confronted this week with running XSI 32bits and XSI 64bits on the same Windows x64 system. I&#8217;d tried it in the past just as a challenge to get it to work but now the crew I was working with actually had some production needs for it.</p>
<p>It was so simple I can probably qualify it as being the biggest non event of my past few months&#8230; This same subject has been <a title="XSI WIKI" href="http://softimage.wiki.avid.com/index.php/INFO:_Python_on_64-bit_Vista" onclick="javascript:pageTracker._trackPageview('/outbound/article/softimage.wiki.avid.com');" target="_blank">talked about</a> <a title="XSI Community" href="http://community.softimage.com/showthread.php?t=773" onclick="javascript:pageTracker._trackPageview('/outbound/article/community.softimage.com');" target="_blank">a few times</a> in the past but because historically it has been so complicated (read impossible), I thought I&#8217;d rehash it here. Here are some no nonsense steps to make it happen:</p>
<ul>
<li>On Vista64 or XP64 install XSI 7.0 32 and XSI 7.0 64</li>
<li>Install VC++ redistributables (<a title="2005 x86" href="http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&amp;displaylang=en" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.microsoft.com');" target="_blank">2005/32</a>, <a title="2005 x64" href="http://www.microsoft.com/downloads/details.aspx?familyid=90548130-4468-4bbc-9673-d6acabd5d13b&amp;displaylang=en" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.microsoft.com');" target="_blank">2005/64</a>, <a title="2008 x86" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&amp;displaylang=en" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.microsoft.com');" target="_blank">2008/32</a>, <a title="2008 x64" href="http://www.microsoft.com/downloads/details.aspx?familyid=bd2a6171-e2d6-4230-b809-9a8d7548c1b6&amp;displaylang=en" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.microsoft.com');" target="_blank">2008/64</a>)</li>
<li>Install <a title="Python 2.6 x86" href="http://www.python.org/ftp/python/2.6/python-2.6rc2.msi" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.python.org');" target="_blank">Python 2.6 32 bits</a></li>
<li><a title="Python 2.6 x64" href="http://www.python.org/ftp/python/2.6/python-2.6rc2.amd64.msi" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.python.org');" target="_blank">Install Python 2.6 x64</a></li>
<li><a title="PyWin32 32bits" href="http://downloads.sourceforge.net/pywin32/pywin32-212.win32-py2.6.exe?modtime=1217537338&amp;big_mirror=0&amp;filesize=6134129" onclick="javascript:pageTracker._trackPageview('/outbound/article/downloads.sourceforge.net');" target="_blank">Install PyWin32 32 bits</a></li>
<li><a title="PyWin32 x64" href="http://downloads.sourceforge.net/pywin32/pywin32-212.win-amd64-py2.6.exe?modtime=1217537366&amp;big_mirror=0&amp;filesize=6659180" onclick="javascript:pageTracker._trackPageview('/outbound/article/downloads.sourceforge.net');" target="_blank">Install PyWin32 x64</a></li>
</ul>
<p>Notes:</p>
<ul>
<li>Install your two different Pythons in two different directories (I used C:\Python26-x86 and C:\Python26-x64)</li>
<li>Python 2.6 is at RC2 as of this writing but is very solid. Release shoudn&#8217;t be too far off (scheduled for Oct 1st).</li>
<li>For Vista users, turn UAC off for these installs.</li>
</ul>
<p>Now whenever you launch one version or another of XSI you should set the system path to include the path to the appropriate version of Python. One nice way to do this is to use the UserTools to edit setenv.bat and add a line like the following at the top of the file:</p>
<p>set PATH=C:\Python26-x64;%PATH%</p>
<p>This is also a nice place to set your PYTHONPATH environment variable for any custom libraries as well. Most libs you develop yourself are likely to be 100% pure Python. As such they are usable by both the 32 and 64 bit interpreters and can be kept in a single central location and included by both versions. Some libraries that you download might require specific binary builds and you&#8217;ll need to install those twice, one for each Python version.</p>
<p>Why am I talking specifically about Python 2.6 even if it is only at RC2? I&#8217;m a strong advocate of moving to this new version as soon as you can, given any libraries you need for your tools are also available for the new version. This version adds or implements a lot of stuff that will be in Python 3.0 without breaking 2.x compatibility (too much). As such it becomes a great way to smooth your transition to the future version of the language. If you want to get up to speed with what is coming up in Python 2.6, you can check it out <a title="Python 2.6" href="http://docs.python.org/dev/whatsnew/2.6.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/docs.python.org');" target="_blank">here</a>.</p>
<p>Have fun!</p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=MOgKCJ"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=MOgKCJ" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=uXFGl"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=uXFGl" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=QOECL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=QOECL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=06mtL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=06mtL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=0WAHL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=0WAHL" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/399477501" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/294/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/294</feedburner:origLink></item>
		<item>
		<title>ICE Kinematics</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/382392287/280</link>
		<comments>http://www.xsi-blog.com/archives/280#comments</comments>
		<pubDate>Wed, 03 Sep 2008 14:54:28 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=280</guid>
		<description><![CDATA[Quite a few people have been asking how the unsupported feature of ICE Kinematics can be enabled in XSI.
The video below will give you a rundown on how to activate the feature within the context of a really simple example of getting a ball to float and bounce around on the top of a particle [...]]]></description>
			<content:encoded><![CDATA[<p>Quite a few people have been asking how the unsupported feature of ICE Kinematics can be enabled in XSI.</p>
<p>The video below will give you a rundown on how to activate the feature within the context of a really simple example of getting a ball to float and bounce around on the top of a particle fountain.</p>
<p>Please note that ICE Kinematics are an unsupported feature that you would be using at your own risk. I&#8217;ve had a fair bit of success with it but if it goes boom and you loose time and assets, I will say: I told you so!</p>
<p>Have fun!</p>
<p style="text-align: center;">[There is a video that cannot be displayed in this feed. <a href="http://www.xsi-blog.com/archives/280" >Visit the blog entry to see the video.]</a></p>
<p style="text-align: left;">By the way&#8230; The line you have to add in the setenv.bat file that you can&#8217;t read in the video is:</p>
<p style="text-align: left;">set XSI_UNSUPPORTED_ICE_KINEMATICS=1</p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=mECVjL"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=mECVjL" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=r5NO5l"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=r5NO5l" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=3UkpJL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=3UkpJL" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=mmD28L"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=mmD28L" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=iQ96fL"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=iQ96fL" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/382392287" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/280/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/280</feedburner:origLink></item>
		<item>
		<title>Gerstner Waves in ICE</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/370737766/273</link>
		<comments>http://www.xsi-blog.com/archives/273#comments</comments>
		<pubDate>Thu, 21 Aug 2008 08:24:13 +0000</pubDate>
		<dc:creator>Patrick Boucher</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=273</guid>
		<description><![CDATA[Here is me playing around with Gerstner waves in XSI&#8217;s ICE.
[See post to watch QuickTime movie]
For about the past five years I&#8217;ve been doing pipeline stuff. ICE has gotten me yearning for production work again.
]]></description>
			<content:encoded><![CDATA[<p>Here is me playing around with <a title="Gerstner" href="http://en.wikipedia.org/wiki/Franti%C5%A1ek_Josef_Gerstner" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" target="_blank">Gerstner</a> waves in XSI&#8217;s ICE.</p>
[See post to watch QuickTime movie]
<p>For about the past five years I&#8217;ve been doing pipeline stuff. ICE has gotten me yearning for production work again.</p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=OBn1Ao"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=OBn1Ao" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=kzLeo"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=kzLeo" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=NQQyO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=NQQyO" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=effKO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=effKO" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=V3dAO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=V3dAO" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/370737766" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/273/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/273</feedburner:origLink></item>
		<item>
		<title>Previewing Shadowmaps</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/328090526/269</link>
		<comments>http://www.xsi-blog.com/archives/269#comments</comments>
		<pubDate>Sun, 06 Jul 2008 14:30:21 +0000</pubDate>
		<dc:creator>Stefano Jannuzzo</dc:creator>
		
		<category><![CDATA[Rendering]]></category>

		<category><![CDATA[.zt]]></category>

		<category><![CDATA[imf_disp]]></category>

		<category><![CDATA[mentalray]]></category>

		<category><![CDATA[mi2]]></category>

		<category><![CDATA[ray3]]></category>

		<category><![CDATA[shadowmaps]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=269</guid>
		<description><![CDATA[It is sometimes desirable to be able to check the shadow maps look.
Since XSI does not allow for shadow maps paths, this is how you can do (a ray3 standalone license is required).
After setting up a shadow mapped light, export a single frame archive (mi2) ascii file.
Edit the file with a text editor, and look [...]]]></description>
			<content:encoded><![CDATA[<p>It is sometimes desirable to be able to check the shadow maps look.</p>
<p>Since XSI does not allow for shadow maps paths, this is how you can do (a ray3 standalone license is required).</p>
<p>After setting up a shadow mapped light, export a single frame archive (mi2) ascii file.</p>
<p>Edit the file with a text editor, and look for the light options section. There you find the shadowmap settings.</p>
<p>To have the map written, just add a line with the &#8220;shadowmap file&#8221; statement, followed by the path for the file (.zt format mandatory).</p>
<pre>light "Spot_Root/Spot/Light" = "Spot_Root/Spot/Light/soft_light"
origin 0 0 0
direction 0 0 -1
spread 0.866025
shadowmap on
shadowmap resolution 500
shadowmap softness 0.002
shadowmap samples 20
#the following line added
shadowmap file "C:\temp\sm.zt"
energy 7500 7500.01 7500
...
end light
</pre>
<p>Save the file and render it with ray3.</p>
<p>To just render the shadow map and not the image, you can use the handy &#8220;-shadowmap only&#8221; option. In my case, being the archive file named C:\temp\out.mi2, I run</p>
<pre>ray3 C:\temp\out.mi2 -shadowmap only -verbose on</pre>
<p>Once finished, you should find the map on disk (C:\temp\sm.zt in my case), and view it by</p>
<pre>imf_disp C:\temp\sm.zt</pre>
<p>This is a simple sphere over a grid</p>
<p><a href="http://www.xsi-blog.com/userContent/upload/2008/07/sm.jpg" ><img class="alignnone size-medium wp-image-270" title="Shadow Maped Sphere" src="http://www.xsi-blog.com/userContent/upload/2008/07/sm-276x300.jpg" alt="Shadow Maped Sphere" width="276" height="300" /></a></p>
<p>The grid does not show up, not being a shadow caster itself.</p>
<p>So you can now check the shadow map extent, which is particularly interesting for infinite lights, being determined by the extent of the parts of the scene that cast shadows (for spot light sources, only the cone spread parameter matters).</p>
<p>Also, by left clicking on the image, you can read the z value for each pixel, and finally (maybe) understand the obscure bias option ;).</p>

<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=WO8PXd"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=WO8PXd" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=IvLno"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=IvLno" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=MxJoO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=MxJoO" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=fPOXO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=fPOXO" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=tvoiO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=tvoiO" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/328090526" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/269/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/269</feedburner:origLink></item>
		<item>
		<title>Slickening up the build cycle for compiled plugins</title>
		<link>http://feeds.feedburner.com/~r/xsi-blog/content/~3/315350046/268</link>
		<comments>http://www.xsi-blog.com/archives/268#comments</comments>
		<pubDate>Thu, 19 Jun 2008 11:16:24 +0000</pubDate>
		<dc:creator>Kim Aldis</dc:creator>
		
		<category><![CDATA[C++]]></category>

		<category><![CDATA[Programming / Scripting]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=268</guid>
		<description><![CDATA[1. compile with copy, 2. oops, error, file in use, 3. switch to XSI, 4. dig down and unload plugin, 5. switch to VS, 6. compile &#8230;&#8230;. yaddda &#8230;.. you know the drill. 
For years I&#8217;ve been doing this and for years I&#8217;ve been meaning to get around to making it slicker but somehow there [...]]]></description>
			<content:encoded><![CDATA[<p>1. compile with copy, 2. oops, error, file in use, 3. switch to XSI, 4. dig down and unload plugin, 5. switch to VS, 6. compile &#8230;&#8230;. yaddda &#8230;.. you know the drill. </p>
<p>For years I&#8217;ve been doing this and for years I&#8217;ve been meaning to get around to making it slicker but somehow there was never time. So the other day it rained - fit to burst - and I had a day inside with nothing else to do and this is what I ended up with.</p>
<p>Earlier attempts ended up in a puddle on the floor because for some reason the only links I could find to VSS command line building pointed me at VCBuild.exe, which is just a plain old mess. This time, though, I found a link to a list of command line options for devenv.exe - what you run to bring up the VS IDE - at the excelent <a href="http://www.codeproject.com/KB/dotnet/builditemincontextmenu.aspx" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.codeproject.com');">codeproject.com</a> and these are much more straightforward.</p>
<p>The process is fairly simple: </p>
<p>1. unload the plugin.<br />
2. run a command line build using system()<br />
3. copy over the dll (my build has this built in)<br />
4. reload the plugin.<br />
5. test<br />
6. package</p>
<p>Step 2 involves a little bit of wrastling with .bat command line, um, features but really the code (at the end of this article) is quite simple. Because it&#8217;s scripted you can build entire plugin sets and package them in one go. The whole process takes only seconds because it&#8217;s self contained and it&#8217;s dead easy to stuff in some test code. You can easily slip back to the IDE when you need it and it makes working with a preferred text editor easier if that&#8217;s your bag.</p>
<p>There&#8217;s also the advantage that the build inherits the paths to libraries from the XSI version you&#8217;re working with. No more .bat file wrappers. Neat!</p>
<p>This example code is just a list of functions:</p>
<p>Build( solutionName, PluginName, forceRebuild   ); // do the actual build.<br />
GetConfig(); //gets the platform type (32/64)<br />
Package(  PluginName );  // package. Output name is hard coded in the example. </p>
<p>I stuff the plugin names in an array so I can build a bunch of them in one.</p>
<p>I also have a custom property I use with a dropdown list of my main projects along with build and package buttons.</p>
<p>And finally, I figure I might, next time it rains, get this working alongside package location. Who knows.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
</pre></td><td class="code"><pre class="javascript"><span style="color: #003366; font-weight: bold;">var</span> sPlugins <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;TinyCurveExtrude&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;TinyCap&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> slnName <span style="color: #339933;">=</span> sPlugins<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> sPluginName <span style="color: #339933;">=</span> slnName <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;Plugin&quot;</span><span style="color: #339933;">;</span>
&nbsp;
Build<span style="color: #009900;">&#40;</span> slnName<span style="color: #339933;">,</span> sPluginName<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">Package</span><span style="color: #009900;">&#40;</span> sPluginName <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// build the solution. doRebuild is a boolean, forces a complete compile and build if true.</span>
<span style="color: #006600; font-style: italic;">//</span>
<span style="color: #003366; font-weight: bold;">function</span> Build<span style="color: #009900;">&#40;</span> slnName<span style="color: #339933;">,</span> sPluginName<span style="color: #339933;">,</span> doRebuild <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> oPlugin <span style="color: #339933;">=</span> Application.<span style="color: #006600;">Plugins</span><span style="color: #009900;">&#40;</span> sPluginName <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> sPluginFileName <span style="color: #339933;">=</span> oPlugin.<span style="color: #006600;">FileName</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>oPlugin <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		logmessage<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Can't find plugin to unload: &quot;</span> <span style="color: #339933;">+</span> sPluginName<span style="color: #339933;">,</span> siError <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	Logmessage<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Unloading Plugin &quot;</span> <span style="color: #339933;">+</span> sPluginFileName <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
	Application.<span style="color: #006600;">UnloadPlugin</span><span style="color: #009900;">&#40;</span> sPluginFileName <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> Cmd <span style="color: #339933;">=</span> BuildCmdRoot<span style="color: #009900;">&#40;</span> slnName <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> sConfig <span style="color: #339933;">=</span> GetConfig<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> sOpt <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>doRebuild<span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #3366CC;">&quot; /rebuild &quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot; /build &quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> sConfig <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		system<span style="color: #009900;">&#40;</span> Cmd <span style="color: #339933;">+</span> sOpt <span style="color: #339933;">+</span> sConfig <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; &amp;amp; pause&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		Logmessage<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Build Failed&quot;</span><span style="color: #339933;">,</span> siError <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	LogMessage<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;ReLoading Plugin: &quot;</span> <span style="color: #339933;">+</span> sPluginFileName <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	Application.<span style="color: #006600;">LoadPlugin</span><span style="color: #009900;">&#40;</span> sPluginFileName <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> 
<span style="color: #006600; font-style: italic;">// get the platform type, 32 or 64 bit. Release is hard coded</span>
<span style="color: #006600; font-style: italic;">//</span>
<span style="color: #003366; font-weight: bold;">function</span> GetConfig<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> sPlatform <span style="color: #339933;">=</span> Application.<span style="color: #006600;">Platform</span><span style="color: #339933;">;</span>
	Logmessage<span style="color: #009900;">&#40;</span> sPlatform <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> sPlatform.<span style="color: #006600;">match</span><span style="color: #009900;">&#40;</span> <span style="color: #009966; font-style: italic;">/win64/i</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>Release x64|x64<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> sPlatform.<span style="color: #006600;">match</span><span style="color: #009900;">&#40;</span> <span style="color: #009966; font-style: italic;">/win32/i</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>Release|Win32<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	Logmessage<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;Unsupported Platform: &quot;</span> <span style="color: #339933;">+</span> sPlatform<span style="color: #339933;">,</span> siError <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// build the devenv.ex command line</span>
<span style="color: #006600; font-style: italic;">// NOTE: this is set to work on a 64 bit system. Take out the (x86) and spaces </span>
<span style="color: #006600; font-style: italic;">// for 32 bit. Cross compile works well enough but you'll need the 64 bit libs</span>
<span style="color: #003366; font-weight: bold;">function</span> BuildCmdRoot<span style="color: #009900;">&#40;</span> sTargetName <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> slnRoot <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;c:<span style="color: #000099; font-weight: bold;">\\</span>fatty<span style="color: #000099; font-weight: bold;">\\</span>DEV<span style="color: #000099; font-weight: bold;">\\</span>CPP&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> vcVars <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;call <span style="color: #000099; font-weight: bold;">\&quot;</span>C:<span style="color: #000099; font-weight: bold;">\\</span>Program Files (x86)<span style="color: #000099; font-weight: bold;">\\</span>Microsoft Visual Studio 8<span style="color: #000099; font-weight: bold;">\\</span>VC<span style="color: #000099; font-weight: bold;">\\</span>vcvarsall.bat<span style="color: #000099; font-weight: bold;">\&quot;</span> x86&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> slnPath <span style="color: #339933;">=</span> slnRoot <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>&quot; + sTargetName + &quot;</span>\\<span style="color: #3366CC;">&quot; + sTargetName + &quot;</span>.<span style="color: #006600;">sln</span><span style="color: #3366CC;">&quot;
	var Cmd = vcVars + &quot;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span> devenv <span style="color: #3366CC;">&quot; + slnPath;
	return Cmd;
}
&nbsp;
// Package.
// ToDo: rebuild for package location.
//
function Package( sPluginName ) {
	logmessage( &quot;</span>Packaging ... <span style="color: #3366CC;">&quot; );
&nbsp;
	var sOutputPath = &quot;</span>C<span style="color: #339933;">:/</span>Fatty<span style="color: #339933;">/</span>Dev<span style="color: #339933;">/</span>CPP<span style="color: #339933;">/</span>Release<span style="color: #3366CC;">&quot;
&nbsp;
	var sPlatform = Application.Platform;
&nbsp;
	var oPlugin = Application.Plugins( sPluginName );
	var sPluginFileName = oPlugin.FileName;
&nbsp;
	var oAddOn = Application.CreateAddon();
&nbsp;
	oAddOn.AddItem( siPluginAddonItemType, oPlugin.FileName );
&nbsp;
	oAddOn.DefaultInstallationPath = siUserAddonPath;
	oAddOn.SubDirectory = sPluginName;
&nbsp;
	var sPluginFileName = sOutputPath + &quot;</span><span style="color: #339933;">/</span><span style="color: #3366CC;">&quot; + sPluginName + &quot;</span>_<span style="color: #3366CC;">&quot; + sPlatform + &quot;</span>.<span style="color: #006600;">xsiaddon</span><span style="color: #3366CC;">&quot;
&nbsp;
	oAddOn.Save( sPluginFileName );
&nbsp;
	logmessage( &quot;</span>Packaged to<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot; + sPluginFileName  );
}
</span</pre></td></tr></table></div>


<p><a href="http://feeds.feedburner.com/~a/xsi-blog/content?a=Dlb8dF"><img src="http://feeds.feedburner.com/~a/xsi-blog/content?i=Dlb8dF" border="0"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=iU6co"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=iU6co" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=7hGzO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=7hGzO" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=AhrgO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=AhrgO" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/xsi-blog/content?a=AzSaO"><img src="http://feeds.feedburner.com/~f/xsi-blog/content?i=AzSaO" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/xsi-blog/content/~4/315350046" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.xsi-blog.com/archives/268/feed</wfw:commentRss>
		<feedburner:origLink>http://www.xsi-blog.com/archives/268</feedburner:origLink></item>
	</channel>
</rss>
