<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: An interesting concept behind Structs in MAXScript</title>
	<atom:link href="http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript</link>
	<description>the official duber studio™ blog</description>
	<lastBuildDate>Tue, 27 Jul 2010 05:22:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: loocas</title>
		<link>http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript/comment-page-1#comment-3099</link>
		<dc:creator>loocas</dc:creator>
		<pubDate>Tue, 08 Dec 2009 20:49:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript#comment-3099</guid>
		<description>Thanks a lot, Mathieson! It makes perfect sense. I appretiate it. :)</description>
		<content:encoded><![CDATA[<p>Thanks a lot, Mathieson! It makes perfect sense. I appretiate it. <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathieson</title>
		<link>http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript/comment-page-1#comment-3098</link>
		<dc:creator>Mathieson</dc:creator>
		<pubDate>Tue, 08 Dec 2009 19:11:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript#comment-3098</guid>
		<description>You don&#039;t have to initialize the variables explicitly, as you have done in your example.  Rather than &quot;clsInst = tstStruct myVar:0.&quot; you can simply do &quot;clsInst = tstStruct()&quot; and then the declaration inside the struct should kick in and automatically initialize.

The problem before was that you were trying to access a value from the struct definition, rather than from an instance of the struct.  The variable cannot store a value until an instance of the struct is created, as all it is is the definition.

When I use structs for creating tools, I usually store an instance of the struct into the same variable name as the struct, immediately after I have defined the struct.  Not a good idea if you plan on creating multiple instances of the struct, for instance when using to store data inside of a script, but usually when creating a tool I only create a single instance anyways.

struct tstStruct
(
	myVar = 0.,

	fn printHello =
	(
		print &quot;HELLO WORLD&quot;
	)
)
tstStruct = tstStruct()
tstStruct.myVar

Hope that helps out.  I&#039;d hate it if I had to initialize every variable individually. :)</description>
		<content:encoded><![CDATA[<p>You don&#8217;t have to initialize the variables explicitly, as you have done in your example.  Rather than &#8220;clsInst = tstStruct myVar:0.&#8221; you can simply do &#8220;clsInst = tstStruct()&#8221; and then the declaration inside the struct should kick in and automatically initialize.</p>
<p>The problem before was that you were trying to access a value from the struct definition, rather than from an instance of the struct.  The variable cannot store a value until an instance of the struct is created, as all it is is the definition.</p>
<p>When I use structs for creating tools, I usually store an instance of the struct into the same variable name as the struct, immediately after I have defined the struct.  Not a good idea if you plan on creating multiple instances of the struct, for instance when using to store data inside of a script, but usually when creating a tool I only create a single instance anyways.</p>
<p>struct tstStruct<br />
(<br />
	myVar = 0.,</p>
<p>	fn printHello =<br />
	(<br />
		print &#8220;HELLO WORLD&#8221;<br />
	)<br />
)<br />
tstStruct = tstStruct()<br />
tstStruct.myVar</p>
<p>Hope that helps out.  I&#8217;d hate it if I had to initialize every variable individually. <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: César Sáez</title>
		<link>http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript/comment-page-1#comment-3097</link>
		<dc:creator>César Sáez</dc:creator>
		<pubDate>Tue, 08 Dec 2009 19:10:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.duber.cz/3ds-max/an-interesting-concept-behind-structs-in-maxscript#comment-3097</guid>
		<description>You need python, a truly object oriented programing language :-)</description>
		<content:encoded><![CDATA[<p>You need python, a truly object oriented programing language <img src='http://blog.duber.cz/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
