<?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>Softimage Blog &#187; VBScript</title>
	<atom:link href="http://www.softimageblog.com/archives/category/scripting/vbscript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.softimageblog.com</link>
	<description>People and thoughts behind Softimage in production...</description>
	<lastBuildDate>Mon, 21 Jun 2010 20:40:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting SDK help from an external editor</title>
		<link>http://www.softimageblog.com/archives/79#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=getting-sdk-help-from-an-external-editor</link>
		<comments>http://www.softimageblog.com/archives/79#comments</comments>
		<pubDate>Fri, 23 Dec 2005 12:01:04 +0000</pubDate>
		<dc:creator>Andy Nicholas</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=79</guid>
		<description><![CDATA[If your editor supports the launching of external programs and allows you to insert text to the command line based on your current selection, then you can get context sensitive help from the XSI SDK help file. This will work for both the C++ and scripting SDKs. This snippet shows how to perform this in the Crimson Editor but it will work equally well in any other well supported editor that has this feature.
]]></description>
			<content:encoded><![CDATA[<p>If your editor supports the launching of external programs and allows you to insert text to the command line based on your current selection, then you can get context sensitive help from the XSI SDK help file. This will work for both the C++ and scripting SDKs. This snippet shows how to perform this in the Crimson Editor but it will work equally well in any other well supported editor that has this feature.</p>
<p><span id="more-79"></span>- &#8211; - &#8211; - &#8211; - &#8211; - </p>
<p>If you tend to only use commands in your scripts, then I recommend this method (which only works for commands):</p>
<p>In your editor, find where the settings are for launching external applications via a keyboard shortcut. For Crimson Editor, you can find this in the &#8220;Tools->Conf. User Tools&#8221; menu.</p>
<p>Enter the command as:</p>
<pre>C:\WINDOWS\hh.exe</pre>
<p>And the argument as:</p>
<pre>mk:@MSITStore:C:\Softimage\XSI_5.0\Doc\XSISDK\xsidevref.chm::/$(CurrWord).htm</pre>
<p>Note that you&#8217;ll need to set the path to the help file so that it&#8217;s correct on your system. Also, if you&#8217;re not using Crimson Editor, then you&#8217;ll need to change where it says <code>$(CurrWord)</code> to the correct macro for your editor, so that it adds the currently selected word to your command argument.</p>
<p>Now just associate this tool with a shortcut key, e.g. F1, and you should now be able to launch the  SDK help with a single key press to get instant reference for your command. As I said above, this only works for commands, since it relies on the naming convention of the compiled help.</p>
<p>- &#8211; - &#8211; - &#8211; - &#8211; -</p>
<p>If you want to have general context sensitive help that will work with any method, property, or command in your script, then you need to download KeyHH.exe from <a href="http://www.keyworks.net">www.keyworks.net</a>.</p>
<p>Once you&#8217;ve installed it, just use these settings:</p>
<p>Enter the command as:</p>
<pre>C:\WINDOWS\keyhh.exe</pre>
<p>And the argument as:</p>
<pre>-myhelp -#klink "$(CurrWord)" C:\Softimage\XSI_5.0\Doc\XSISDK\xsidevref.chm</pre>
<p>As mentioned above, you&#8217;ll need to change the path to work for your help file and change the <code>$(CurrWord)</code> macro to suit your editor.</p>
<p>When you launch this command, it will open the help file in Index view using the word selected in the editor. Unfortunately it doesn&#8217;t display the help page automatically, and you still need to double click the entry, but it beats the heck out of having to type it!</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=79&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/79/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Debugging made easier</title>
		<link>http://www.softimageblog.com/archives/78#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=debugging-made-easier</link>
		<comments>http://www.softimageblog.com/archives/78#comments</comments>
		<pubDate>Thu, 22 Dec 2005 10:26:01 +0000</pubDate>
		<dc:creator>Andy Nicholas</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=78</guid>
		<description><![CDATA[The hyperlinks generated in the Script Editor when an script error is thrown can be very helpful in finding exactly where a problem has occurred. The only issue is that if you are using an external editor, the line number is not communicated to the editor to make it automatically scroll to the line of code that produced the error.

Most standalone text editors allow for a command line parameter to indicate which line number to position the cursor when opening a new file. By making a quick change to one of XSI''s scripts, we can communicate this to the external editor. To make this change, follow the steps below. ]]></description>
			<content:encoded><![CDATA[<p>The hyperlinks generated in the Script Editor when an script error is thrown can be very helpful in finding exactly where a problem has occurred. The only issue is that if you are using an external editor, the line number is not communicated to the editor to make it automatically scroll to the line of code that produced the error.<br />
<span id="more-78"></span></p>
<p>Most standalone text editors allow for a command line parameter to indicate which line number to position the cursor when opening a new file. By making a quick change to one of XSI&#8217;&#8217;s scripts, we can communicate this to the external editor. To make this change, follow the steps below. </p>
<p><em>(By the way, I take no responsibility if something goes wrong and you have to reinstall XSI to get everything working again!)</em></p>
<ol>
<li>Navigate to C:\Softimage\&#8230;\Application\Commands</li>
<li>Create a backup copy of &#8220;SDKHelpers.js&#8221; and call it something like &#8220;SDKHelpers.js_backup&#8221;.<br />
<em>Note: it is important to change the file extension to something other than &#8220;js&#8221; as otherwise it will try to install the same commands twice and you&#8221;ll get a conflict.</em></li>
<li>Navigate to line 106. It should be inside the &#8220;ShowFileForEdit_Execute&#8221; function at the line which says :<br />
<code>if ( -1 != strExternalEditor.search( /%s/ ) )</code></li>
<li>Replace everything inside that &#8220;if&#8221; clause, i.e:
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;// (Mis)use the XSIUtils.Translate() API<br />
&nbsp;&nbsp;&nbsp;&nbsp;// to replace a %s token in the string with the file<br />
&nbsp;&nbsp;&nbsp;&nbsp;// name.  This gives us lots of flexibility for supporting<br />
&nbsp;&nbsp;&nbsp;&nbsp;// different command line options for showing an external editor</code></p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;strCmd = XSIUtils.Translate( strExternalEditor, "None", in_file ) ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;logmessage( "Launching " + 	strCmd, siVerbose ) ;<br />
&nbsp;&nbsp;&nbsp;&nbsp;XSIUtils.LaunchProcess( strCmd, false ) ;<br />
</code></p>
<p>With this:</p>
<p><code>&nbsp;&nbsp;&nbsp;&nbsp;strExternalEditor = strExternalEditor.replace(/%s/,in_file);<br />
&nbsp;&nbsp;&nbsp;&nbsp;if ( strExternalEditor.search( /%l/ ) != -1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strExternalEditor = strExternalEditor.replace(/%l/,in_linenum);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;XSIUtils.LaunchProcess(strExternalEditor);<br />
</code></p>
</li>
<li>Save the file and restart XSI.</li>
</ol>
<p>You can now use %l (that&#8217;&#8217;s a lowercase L) in the filename for your external editor to pass the line number at the correct position in the command line options. Note that the original script already allowed for a %s parameter to be passed as a location to insert the filename to edit, and we have retained that functionality.</p>
<p>So for example, for JEdit you would use this in the external editor setting in the Script Editor Preferences:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<code>c:\jedit\jedit %s +line:%l</code></p>
<p>Personally, I use Crimson Editor, and my external editor setting is:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<code>C:\Program Files\Crimson Editor\cedt.exe /L:%l %s</code></p>
<p>Now if a script throws an error, you can click on it and your external editor will open the file at the correct line. This should make it a lot easier to use your external editor with XSI.</p>
<p>Have a good Christmas break!</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=78&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/78/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>The ScriptedSequencer</title>
		<link>http://www.softimageblog.com/archives/69#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-scriptedsequencer</link>
		<comments>http://www.softimageblog.com/archives/69#comments</comments>
		<pubDate>Sun, 27 Nov 2005 20:10:21 +0000</pubDate>
		<dc:creator>Andrea Interguglielmi</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[JScript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[VBScript]]></category>

		<guid isPermaLink="false">http://www.xsi-blog.com/?p=69</guid>
		<description><![CDATA[When it comes to math, sometimes is hard to visualize what you are doing, if you are working with vectors and transformations the debugging process can be slow and tedious, you cannot even use primitives to trace positions and rotations if you are writing scripted operators.
My workflow was to write quick run-once scripts in the [...]]]></description>
			<content:encoded><![CDATA[<p>When it comes to math, sometimes is hard to visualize what you are doing, if you are working with vectors and transformations the debugging process can be slow and tedious, you cannot even use primitives to trace positions and rotations if you are writing scripted operators.</p>
<p>My workflow was to write quick run-once scripts in the script editor, use curves and nulls to be sure that everything was ok and then write the scripted operator. But, if scripting is meant to make your life easier, this case makes you change your mind a bit. So I decided to take advantage of both c++ and scripting by wrapping some simple OpenGL drawing functions and exposing them to scripting.</p>
<p>Since the result seems to be quite handy, I decided to make this little utility available on XSIBlog. Lionhead, the company I work for, kindly allowed me to publish it.</p>
<p><span id="more-69"></span>So here is the ScriptedSequencer, a small utility to draw vectors and rotation axis on screen.</p>
<p><img style="width: 416px; height: 303px; border-width: 0px" src="/userContent/ainterguglielmi/scriptedSequencer/sequencer.jpg" border="0" /></p>
<p>The tool uses a JScript object to wrap some c++ registered commands, you can use this object from Python and VBScript as well.</p>
<p>First get an instance of the object:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> s <span style="color: #339933;">=</span> NewSequencer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>then call one of the drawing functions:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> vec <span style="color: #339933;">=</span> XSIMath.<span style="color: #660066;">CreateVector3</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
vec.<span style="color: #660066;">Set</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> s.<span style="color: #660066;">DrawVector</span><span style="color: #009900;">&#40;</span>vec<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>to erase the stack and start again use:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">s.<span style="color: #660066;">Flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>All the drawings are collected by the c++ plug-in and then rendered at the right time using the GraphicSequencer, so you don&#8217;t have to care about synchronizing with the viewport&#8217;s OpenGL rendering, which means in other words that you can draw OpenGL stuff from wherever you are, run once scripts, scripted operators or compiled plug-ins at any moment.</p>
<p>As it is nothing more than a debugging utility it doesn&#8217;t support multiple clients, it means that every time you&#8217;ll flush the stack all the drawings drawn by every script will be flushed at once.</p>
<p>By typing <code>NewSequencer().Help()</code> you&#8217;ll get a quick help about the sequencer object and its methods.</p>
<p>I hope you&#8217;ll find it useful to debug your scripts!</p>
<p>Please note that this utility is not released by Lionhead Ltd., it is not covered by any guarantee and nobody is responsible in any way for any possible troubleshoot.</p>
<p>Download the ScriptedSequencer addon and a sample scene <a href="/userContent/upload/ScriptedSequencer1.zip">here</a> (XSI 5.X required).</p>
<p>You are more than welcome to report possible bugs or give me suggestions, just drop me a line at <a href="mailto:andrea@ray-t.net">andrea@ray-t.net</a>.</p>
<img src="http://www.softimageblog.com/?ak_action=api_record_view&id=69&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.softimageblog.com/archives/69/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
