<?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>duber&#039;s blog &#187; 3ds Max</title>
	<atom:link href="http://blog.duber.cz/category/3ds-max/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.duber.cz</link>
	<description>the blog of duber studio™</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:31:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Having fun with Nuke</title>
		<link>http://blog.duber.cz/3ds-max/having-fun-with-nuke</link>
		<comments>http://blog.duber.cz/3ds-max/having-fun-with-nuke#comments</comments>
		<pubDate>Sun, 29 Jan 2012 14:06:45 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[Nuke]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=988</guid>
		<description><![CDATA[As with my previous post, I&#8217;m preparing a few handy tools for 3ds Max artists using Mari and Nuke. This bit is the fun part with Nuke: live communication between 3ds Max and Nuke. Stay tuned!]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.duber.cz/wp-content/uploads/fun_times_with_nuke.png" rel="lightbox[988]"><img src="http://blog.duber.cz/wp-content/uploads/fun_times_with_nuke.png" alt="Nuke" title="Nuke" width="560" height="200" class="alignnone size-full wp-image-989" /></a></p>
<p>As with my <a href="http://blog.duber.cz/3ds-max/having-fun-with-mari">previous post</a>, I&#8217;m preparing a few handy tools for 3ds Max artists using Mari and Nuke. This bit is the fun part with Nuke: live communication between 3ds Max and Nuke.</p>
<p>Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/3ds-max/having-fun-with-nuke/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Having fun with Mari</title>
		<link>http://blog.duber.cz/3ds-max/having-fun-with-mari</link>
		<comments>http://blog.duber.cz/3ds-max/having-fun-with-mari#comments</comments>
		<pubDate>Sat, 28 Jan 2012 23:14:26 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[Mari]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=984</guid>
		<description><![CDATA[I&#8217;m starting to write a useful set of tools for Mari and 3ds Max users. This is the very beginning &#8211; establishing reliable communication from 3ds Max&#8217;s MAXScript console directly to Mari. I&#8217;ll keep you posted.]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.duber.cz/wp-content/uploads/fun_times_with_mari.png" rel="lightbox[984]"><img src="http://blog.duber.cz/wp-content/uploads/fun_times_with_mari.png" alt="Mari" title="Mari" width="560" height="310" class="alignnone size-full wp-image-985" /></a></p>
<p>I&#8217;m starting to write a useful set of tools for Mari and 3ds Max users. This is the very beginning &#8211; establishing reliable communication from 3ds Max&#8217;s MAXScript console directly to Mari. <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;ll keep you posted.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/3ds-max/having-fun-with-mari/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The power of regular expressions</title>
		<link>http://blog.duber.cz/3ds-max/the-power-of-regular-expressions</link>
		<comments>http://blog.duber.cz/3ds-max/the-power-of-regular-expressions#comments</comments>
		<pubDate>Tue, 10 Jan 2012 00:47:43 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[dotNET]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[opinions]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=956</guid>
		<description><![CDATA[I don&#8217;t think I have to praise regular expressions here, however, I wanted to point out one extremely useful case where regular expressions were pretty much the single most useful, fastest and not so obvious choice in my 3ds Max pipeline. The thing with 3ds Max is that regular expressions are foreign to MAXScripters and [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t think I have to praise regular expressions here, however, I wanted to point out one extremely useful case where regular expressions were pretty much the single most useful, fastest and not so obvious choice in my 3ds Max pipeline.</p>
<p>The thing with 3ds Max is that regular expressions are foreign to MAXScripters and they don&#8217;t usually use them. I too am more used to regex in Python or IronPython than MAXScript. However, since we do have access to .NET in MAXScript, we can use its <a href="http://msdn.microsoft.com/en-us/library/6f7hht7k.aspx">Regex class</a> inside MAXScript.</p>
<p>Why I&#8217;m mentioning this and why could it be useful to you? I bumped into a little issue with my pipeline&#8217;s handling of rendered files. They assume to be exactly the same as I set them up in 3ds Max, which is logical and correct. However, since I started using Deadline&#8217;s SMTD script for submitting my files to the render farm, which takes care of handling the path remapping and storing, it also accidentally took care of letter casing. So, in the end, my render files were being saved all upper cased: &#8220;\\SERVER\PROJECT\RENDERS\ABC.EXR&#8221; instead of what I set in the Render Dialog: &#8220;\\SERVER\Project\Renders\ABC.exr&#8221;. The reason was simple, I used simple MAXScript substituteString() method to re-map my local paths to my server, UNC, paths and I converted everything to upper case just in case I got a mismatch:
<pre>substituteString (toUpper srcPath) @"D:" @"\\RAMMSTEIN\__UNMANAGED_PROJECTS__"</pre>
<p><span id="more-956"></span></p>
<p>This wouldn&#8217;t be such an issue in a Windows environment, however, when you start dealing with path and file names in Python and you start mixing up casing, you can easily get burnt.</p>
<p>So, the only option left in Python would be to use the re module and search or replace strings based on regular expression matching. In MAXScript, however, we don&#8217;t natively have a re module and its methods, but luckily for us, we can use .NET, so that the previous method written in MAXScript using regex would look like this:</p>
<pre>regex = dotNetClass "System.Text.RegularExpressions.Regex"
regex.Replace srcPath @"^(D[:])" @"\\RAMMSTEIN\__UNMANAGED_PROJECTS__"</pre>
<p></br>This replaces the capital letter D in the source path <em>srcPath</em> with the UNC server path exactly the same way as the substituteString method above. However, since this is a regular expression engine you&#8217;re using, you can modify the search in order to match any casing, should that be your choice.</p>
<p>There are two ways of doing that. The ultimate way I chose in the end was to modify the search pattern to @&#8221;^([D|d][:])&#8221;, which matches both &#8220;D:&#8221; and &#8220;d:&#8221; in the source path and then replaces it with the UNC path at the end.</p>
<p>The other option you can use, should you choose to, is the <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regexoptions.aspx">RegexOptions Enumeration</a> argument at the very end of the method call. If you want to ignore casing, just use this:</p>
<pre>regex = dotNetClass "System.Text.RegularExpressions.Regex"
regexOpt = dotNetClass "System.Text.RegularExpressions.RegexOptions"
regex.Replace @"d:\testProject\projFolder\something.exr" @"^(D[:])"
@"\\MyServer\__myProjects__" regexOpt.IgnoreCase</pre>
<p></br>Tadaaa! It&#8217;s as simple as that. <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> No path splitting, no case testing, just a single line of a regular expression call (not counting the class call) and you&#8217;re done. Besides you can use this at a much greater scale with far more complex regex search strings for anything you like directly inside MAXScript.</p>
<p>Note that I&#8217;m replacing a D: drive letter in the source paths since that is my projects local drive. You can use whatever you want, hell, you can replace any and all drive letters in one regex call, if you want:
<pre>@"^([A-Z|a-z][:])"</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/3ds-max/the-power-of-regular-expressions/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shotgun and 3ds Max, practical example</title>
		<link>http://blog.duber.cz/software/shotgun-and-3ds-max-practical-example</link>
		<comments>http://blog.duber.cz/software/shotgun-and-3ds-max-practical-example#comments</comments>
		<pubDate>Mon, 05 Dec 2011 22:50:24 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[dotNET]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=943</guid>
		<description><![CDATA[Here&#8217;s a video demonstrating the power and practical usage of Shotgun (data) brought over to 3ds Max natively via our Python plugin, duberPython.]]></description>
			<content:encoded><![CDATA[<p><img src="" /></p>
<p>Here&#8217;s a video demonstrating the power and practical usage of Shotgun (data) brought over to 3ds Max natively via our Python plugin, <a href="http://blog.duber.cz/?s=duberpython">duberPython</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/software/shotgun-and-3ds-max-practical-example/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://blog.duber.cz/wp-content/gallery/vids/duberPython_Shotgun_demo.mp4" length="58014303" type="video/mp4" />
		</item>
		<item>
		<title>duberPython runs the latest IronPython 2.7.1 without issues!</title>
		<link>http://blog.duber.cz/3ds-max/duberpython-runs-the-latest-ironpython-2-7-1-without-issues</link>
		<comments>http://blog.duber.cz/3ds-max/duberpython-runs-the-latest-ironpython-2-7-1-without-issues#comments</comments>
		<pubDate>Thu, 27 Oct 2011 17:06:10 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[showcase]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=914</guid>
		<description><![CDATA[Just a quick shout about the compatibility of duberPython and the latest and greatest IronPython 2.7.1 release (released a couple of days ago). All working smoothly and quickly, as expected. Should you need more info on duberPython or what we&#8217;re doing with it and Shotgun or Tactic, just drop me a line and I&#8217;ll be [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.duber.cz/wp-content/uploads/envVersion.png" alt="duberPython" title="duberPython" width="560" height="300" class="alignnone size-full wp-image-915" /></p>
<p>Just a quick shout about the compatibility of duberPython and the latest and greatest IronPython 2.7.1 release (released a couple of days ago). All working smoothly and quickly, as expected. <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Should you need more info on duberPython or what we&#8217;re doing with it and <a href="http://shotgunsoftware.com/">Shotgun</a> or <a href="http://www.southpawtech.com/">Tactic</a>, just drop me a line and I&#8217;ll be more than happy to show you how cool duberPython is. <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/3ds-max/duberpython-runs-the-latest-ironpython-2-7-1-without-issues/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using .NET controls in .NET Forms in MAXScript</title>
		<link>http://blog.duber.cz/3ds-max/using-net-controls-in-net-forms-in-maxscript</link>
		<comments>http://blog.duber.cz/3ds-max/using-net-controls-in-net-forms-in-maxscript#comments</comments>
		<pubDate>Sun, 11 Sep 2011 12:57:25 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[dotNET]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=886</guid>
		<description><![CDATA[If you&#8217;re used to scripting your GUIs in Max with the standard rollouts via &#8220;createDialog &#8230;&#8221;, you might be a little confused and lost when you first try to use a 100% .NET Form object instead. Whatever your reason might be for using .NET Forms instead of standard dialogs, you&#8217;ll still want to: Create the [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re used to scripting your GUIs in Max with the standard rollouts via &#8220;createDialog &#8230;&#8221;, you might be a little confused and lost when you first try to use a 100% .NET Form object instead.</p>
<p>Whatever your reason might be for using .NET Forms instead of standard dialogs, you&#8217;ll still want to:</p>
<ul>
<li>Create the main form and define its properties</li>
<li>Define other UI controls, such as buttons, checkboxes etc&#8230;</li>
<li>Define event handlers for specific control objects</li>
<li>Initialize and display the entire Form with all the controls and functionality tied in</li>
</ul>
<p>All this is done a little differently in the .NET realm than what you&#8217;re used to in MAXScript. But before you start, check out <a href="http://paulneale.com/tutorials/dotNet/dotNet.htm">Paul Neale&#8217;s great .NET tutorials on his site</a>. Paul provides some great info for anyone trying to use .NET controls in their scripts.</p>
<p>Now, there is one thing I bumped into, you can actually use .NET objects in MAXScript rollouts, however, you cannot use regular max controls in .NET Forms! So, trying to assign a standard button to a .NET Form will result in an error.</p>
<p>You might think that this creates a burden on the TD to actually <em>skin</em> and customize the .NET controls to look like native 3ds Max GUI elements. You can do this, of course, but it&#8217;d really be a lot of additional work to hassle around with color classes, HWNDs etc&#8230; you actually don&#8217;t need to worry about this as there is an Assembly available in standard Max installations. It&#8217;s a little .dll, found in the root of Max, called <strong>MaxCustomControls.dll</strong>. This Assembly contains some of the more exotic controls, such as SceneExplorer, but it also contains a complete Form control that has already been modified so it reflects your 3ds Max environment, including all the colors, themes and even an initialization method for showing the control as a part of the max process/window.</p>
<p><span id="more-886"></span></p>
<p>Anyways, back to the topic. You can easily instantiate the MaxForm control as follows:</p>
<p><code>maxForm = dotNetObject "MaxCustomControls.MaxForm"</code></p>
<p>This way you have the System.Windows.Forms Form fully tailored to 3ds Max, without any additional work. Standard methods and properties of the .NET Form control are supported, of course. So, all you need now is to start adding controls to it. This is done differently than what you&#8217;re used to in rollouts. By simply instantiating buttons, checkboxes, or whatever, inside the scope of the script (because there is no rollout scope) isn&#8217;t enough, obviously. For this, there is a Controls property, inherited from the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection.aspx">Control.ControlCollection class</a>, that has a few useful methods. The one you&#8217;ll need to add controls to the parent object is, naturally, .Add()</p>
<p>Here&#8217;s a simple example of declaring a .NET Button and adding it to the MaxForm object:</p>
<p><code>myButton = dotNetObject "System.Windows.Forms.Button"<br />
maxForm.controls.Add(myButton)</code></p>
<p>Easy stuff! Especially if you&#8217;re used to C# or even IronPython. The little confusing part comes when you want to actually assign event handlers to your controls. This is done completely differently from regular rollout event handlers, but it&#8217;s also different from C# or IPy. Normally in C# or IPy what you do is assign a method to a event property on individual controls:</p>
<p><code>myButton.Click += doSomething</code></p>
<p>This doesn&#8217;t work in MAXScript, however, so you have to opt for a specifically tailored solution to this issue, which is the <strong>dotNet.addEventHandler</strong> method. It accepts three arguments: the object to which you&#8217;re adding the eventHandler, the name of the event it should respond to and finally the method you&#8217;ll want the object to call when the given event occurs. So, the same example as above in MAXScript looks like this:</p>
<p><code>dotNet.addEventHandler myButton "Click" doSomething</code></p>
<p>The doSomething function has to accept two arguments, the sender and the argument list used inside the function to properly identify what object is calling it and what arguments you used (i.e. right click etc&#8230;)</p>
<p>Now, finally, you have pretty much everything you need to start building rich .NET GUIs for your scripts. The last thing to do now is to call the Form object with all its controls, methods, handlers etc&#8230; and show it. By default, a Form object has a regular Show() method to display the Form, but, this will result in showing an independent window that &#8220;falls behind&#8221; 3ds Max when you click anywhere in Max. This isn&#8217;t desirable for UI controls. Luckily, as I mentioned earlier, the MaxForm object has a special ShowModeless() method that will display the Form and tie it to the 3ds Max handle (HWND). Here&#8217;s the last piece of the puzzle. Please note that I&#8217;ve also added the dotNet.setLifeTimeControl method to show you that it&#8217;s generally a good idea to let the .NET garbage collector take care of the .NET objects, instead of the Max&#8217;s one.</p>
<p><code>maxForm.showModeless()<br />
dotNet.setLifeTimeControl maxForm #dotNet</code></p>
<p>That&#8217;s it for now. Happy scripting with .NET! <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/3ds-max/using-net-controls-in-net-forms-in-maxscript/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating 3ds Max deployments</title>
		<link>http://blog.duber.cz/misc/creating-3ds-max-deployments</link>
		<comments>http://blog.duber.cz/misc/creating-3ds-max-deployments#comments</comments>
		<pubDate>Mon, 27 Jun 2011 17:46:52 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[miscellaneous]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=799</guid>
		<description><![CDATA[A very informative post on the Autodesk forums about making 3ds Max deployments. I planned to do a similar how-to here, on this blog, in the future. Possibly a videotutorial, so, stay tuned&#8230;]]></description>
			<content:encoded><![CDATA[<p>A very informative post on the Autodesk forums about making <a href="http://area.autodesk.com/blogs/maxstation/n34_creating_a_deployment_image_which_includes_service_pack_1">3ds Max deployments</a>.</p>
<p>I planned to do a similar how-to here, on this blog, in the future. Possibly a videotutorial, so, stay tuned&#8230; <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/misc/creating-3ds-max-deployments/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Shotgun and 3ds Max integration preview</title>
		<link>http://blog.duber.cz/3ds-max/shotgun-and-3ds-max-integration-preview</link>
		<comments>http://blog.duber.cz/3ds-max/shotgun-and-3ds-max-integration-preview#comments</comments>
		<pubDate>Thu, 28 Apr 2011 23:01:26 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[showcase]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=780</guid>
		<description><![CDATA[If you&#8217;re interested in a live demo or more information about the duber Python and Shotgun integration in 3ds Max, drop me a line via e-mail at: ldubeda[at]duber.cz]]></description>
			<content:encoded><![CDATA[<p><img src="" /></p>
<p>If you&#8217;re interested in a live demo or more information about the duber Python and Shotgun integration in 3ds Max, drop me a line via e-mail at: ldubeda[at]duber.cz</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/3ds-max/shotgun-and-3ds-max-integration-preview/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://blog.duber.cz/wp-content/gallery/vids/Shotgun_Integration_Preview.mp4" length="32328407" type="video/mp4" />
		</item>
		<item>
		<title>Using Dictionary data types in 3ds Max</title>
		<link>http://blog.duber.cz/software/using-dictionary-data-types-in-3ds-max</link>
		<comments>http://blog.duber.cz/software/using-dictionary-data-types-in-3ds-max#comments</comments>
		<pubDate>Thu, 28 Apr 2011 19:43:44 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[maxscript]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=770</guid>
		<description><![CDATA[I&#8217;ve had a few customers and clients asked me specifically about getting Dictionaries from 3ds Max to Python using our 3ds Max Python plugin, but I wasn&#8217;t able to answer with an elegant or productive way of handling these data types in the MAXScript environment. Until recently, I&#8217;ve been handling Dictionaries two ways: String parsing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a few customers and clients asked me specifically about getting Dictionaries from 3ds Max to Python using our <a href="http://blog.duber.cz/3ds-max/duberpython-features-demonstration">3ds Max Python plugin</a>, but I wasn&#8217;t able to answer with an elegant or productive way of handling these data types in the MAXScript environment.</p>
<p>Until recently, I&#8217;ve been handling Dictionaries two ways:</p>
<ol>
<li>String parsing (i.e. a very primitive way of handling foreign data types, not really recommended)</li>
<li>Manual wrapping (i.e. passing in a List or Array object and converting it back to a Dictionary object)</li>
</ol>
<p>String parsing is the worst possible way of handling such an issue. It&#8217;s very cumbersome, highly unintuitive and with MAXScript string capabilities, extremely difficult. Manual wrapping, on the other hand, is rather more elegant, faster and you can use other, known, data types to construct your future Dictionary and have that converted in Python natively. The down side is, you have to be very careful with the way you&#8217;re handling the future Dictionary. The thing is, only a tuple of list pairs can be successfully converted to a Dictionary in Python. This is a bit limiting as we don&#8217;t have any specific way to tell what is a Tuple and what is a List in our Python implementation in MAXScript as there are no such data types available. So, what I did was I had an Array sent to Python (an actual .NET Array object, by the way) I had that converted first to a Tuple, which is pretty straight forward and then have that converted to a Dictionary. Worked fine, but it was a bit difficult to construct more complex Dictionaries, especially nested Dictionaries, in MAXScript.</p>
<p><span id="more-770"></span></p>
<p>Recently I was writing some .NET code and I bumped into Collections namespace. I then investigated further the Hashtable objects and realized I could substitute Dictionaries in MAXScript with Hashtables using .NET classes and objects! Obviously, again, it&#8217;s not as elegant as native Python, but it&#8217;s closer than manual wrapping of Lists and Arrays!</p>
<p>All you need to do is instantiate a Hashtable object in MAXScript:</p>
<pre>HT = dotNetObject "System.Collections.Hashtable"</pre>
<p>and then you can call the .Add() method for adding the Key Value pairs! Pretty cool! Also, you can access the Values or Keys similarly to Python&#8217;s Dictionaries:</p>
<pre>HT.Add "Key" "Value"
HT.Item["Key"]</pre>
<p>This is far more productive and intuitive than my previous methods!</p>
<p>Also, then you can pass the Hashtable object directly to IronPython and have it converted to the native Dictionary object using the dict() method, without any issues! Again, this is a much straight forward way of doing such a, rather, complex data type conversion.</p>
<p>I&#8217;m currently implementing this approach to my Shotgun wrapper I use with our Python plugin. All seems to be working perfectly fine!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/software/using-dictionary-data-types-in-3ds-max/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Character encoding in MAXScript</title>
		<link>http://blog.duber.cz/3ds-max/character-encoding-in-maxscript</link>
		<comments>http://blog.duber.cz/3ds-max/character-encoding-in-maxscript#comments</comments>
		<pubDate>Thu, 14 Apr 2011 22:16:35 +0000</pubDate>
		<dc:creator>loocas</dc:creator>
				<category><![CDATA[3ds Max]]></category>
		<category><![CDATA[maxscript]]></category>
		<category><![CDATA[technical]]></category>

		<guid isPermaLink="false">http://blog.duber.cz/?p=753</guid>
		<description><![CDATA[Since Max 2008 (I believe) we have the great SciTE MAXScript editor in Max. It&#8217;s an awesome IDE. Very flexible, very lightweight, fast and powerful. Sure, there are much more robust or more beefed up IDEs out there, but for an integrated, dedicated, MAXScript IDE, it&#8217;s simply awesome. It&#8217;s so good I installed SciTE standalone [...]]]></description>
			<content:encoded><![CDATA[<p>Since Max 2008 (I believe) we have the great SciTE MAXScript editor in Max. It&#8217;s an awesome IDE. Very flexible, very lightweight, fast and powerful. Sure, there are much more robust or more beefed up IDEs out there, but for an integrated, dedicated, MAXScript IDE, it&#8217;s simply awesome. It&#8217;s so good I installed SciTE standalone and use it as an IDE for my Python and other scripting tasks.</p>
<p>So, I&#8217;ve been trying to unify my code page across the SciTE editors (the standalone and the integrated Max&#8217;s editor) and settled on a standard UTF-8 encoding, which seemed to work just great. However, I just bumped into a very strange bug where Deadline reported a &#8220;<em>bad syntax</em>&#8221; error on my jobs which were using PostLoad scripts to automatically repath all my assets in my scenes.</p>
<p>The worst part was, the scripts were perfectly fine. They worked just fine in my local Max sessions, but they refused to work when run on the farm. I accidentaly discovered that it was related to the file&#8217;s encoding. When I resaved the file in Notepad (on my server) using the ANSI character encoding, the jobs suddenly started to work.</p>
<p>So, if you&#8217;re using a UTF-8 encoding in your SciTE editors, including and especially in the integrated Pro Editor in 3ds Max, make sure to save the scripts in a different encoding before executing them on the render farm.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.duber.cz/3ds-max/character-encoding-in-maxscript/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

