Thanks everyone. After reading the links you provided and Stephen's blog, I
understand it better now.

I used to use (0) with ApplyOp and other commands, assuming the return
value was always the first. Never cared too much in learning why my code
was working :P
But with SIImportMatLib (0) just didn't work. It seems to be the item
attribute I guess, and the value attribute is (1).
I didn't know I could get the attribute by it's name. Good to know.

Now I need to pay more attention to the return values in the SDK guide.

Thanks again !

M.Yara


On Fri, Apr 26, 2013 at 4:38 AM, Alan Fregtman <[email protected]>wrote:

> I stand corrected. Cheers Matt.
>
>
>
> On Thu, Apr 25, 2013 at 2:32 PM, Matt Lind <[email protected]>wrote:
>
>> *>> ISIVTCollection* collections exist because *Python was not in
>> Softimage since the very beginning*,****
>>
>> ** **
>>
>> Not true, Alan.  Python WAS available in the beginning (along with
>> VBscript, Jscript, and PerlScript).  People chose not to use Python.****
>>
>> ** **
>>
>> When ‘Sumatra’ (XSI) was being developed, all the internal scripts and
>> scripting examples written were in VBScript which supports output arguments
>> much like by-reference passing of arguments in C++.  It wasn’t until I and
>> a few other users spoke up during early versions that Jscript did not
>> support this feature.  Around XSI 1.5 or XSI 2.0, Softimage stopped writing
>> commands using ISITVCollections as output arguments and started moving
>> towards the paradigm used today of supplying a command or method with a
>> numeric suffix to account for these language specific situations
>> (PolygonMesh.Get() vs. PolygonMesh.Get2() for example).****
>>
>> ** **
>>
>> There were no Jscript examples in the documentation either – everything
>> was VBscript.  I had to poke around in the dark to find the issues whether
>> it be ISITVCollections, arrays vs. VB Safe Arrays, reading/writing RGBA
>> color values, inability to make custom spreadsheet queries, and so on.
>> Yes, it was very frustrating.  Eventually Softimage got the hint people
>> preferred using Jscript over VBscript, so the documentation started to
>> reflect that in later versions.  Today Python users are merely going
>> through the same growing pains as there wasn’t a significant audience until
>> XSI v6 or later.  The language has been around for more than 20 years, only
>> recently has it gotten traction in our industry.  Perl used to be the
>> language of choice where Python is used today.  Perlscript was an early
>> choice for XSI as well, but fell out of favor early on when it ran into the
>> same speed bumps Jscript and but didn’t have enough squeaky wheels to fight
>> for the cause.****
>>
>> ** **
>>
>> Part of the original design decision was probably due to the product
>> being waaaaaay behind schedule and developers were looking for the least
>> cost way to get things done.  That meant focusing on getting one language
>> working.  VBscript was the internal technology of Microsoft, who then owned
>> Softimage, and it interacted with many other windows applications.  Problem
>> was many of the features 3D users wanted to use were not friendly to
>> VBscript, or were not in mass adoption (HTML pages for netview, for
>> example).  Jscript could be used in the entire application, was available
>> on other platforms, and had decent methods for working with strings.
>> VBscript was restricted to Microsoft platforms via MainWin.  Another early
>> feature, that was since dropped, was the ability to compile scripts into
>> executables – it was friendlier in Jscript than VBScript.  Jscript was also
>> a much more widely used language than VBScript, making it easier to find
>> examples and documentation, as well as more similar to C++ to make
>> prototyping plugins easier.****
>>
>> ** **
>>
>> Long story short ****
>>
>> ** **
>>
>> The main issue is the short sighted approach of the SDK design focusing
>> heavily on COM/OLE automation and exposing the capabilities to one language
>> in the scripting environment (VBscript) without testing against the
>> others.  If a product is going to advertise multi-language support, then
>> the SDK and documentation should reflect that wholly.  However in defense,
>> if you write code effectively, chances are your code is 90% focused on
>> interacting with the Softimage API and not leveraging the features of your
>> chosen language so much.****
>>
>> ** **
>>
>> ** **
>>
>> Matt****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> *From:* [email protected] [mailto:
>> [email protected]] *On Behalf Of *Alan Fregtman
>> *Sent:* Thursday, April 25, 2013 6:45 AM
>> *To:* XSI Mailing List
>> *Subject:* Re: scripting: returning value in SIImportMatLib****
>>
>> ** **
>>
>> *ISIVTCollection* collections exist because *Python was not in Softimage
>> since the very beginning*, so a few of the SDK command implementations
>> used these so-called "output arguments" feature (since a big chunk of the
>> core commands are written in VBScript, which supports it.) The special
>> collection object was a way of getting them to be accessible automatically
>> without having to go back and add new commands.****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> >>* ** Either way, I don't think the new SDK docs really show what
>> arguments are the ones returned*****
>>
>> ** **
>>
>> Perhaps not clearly, but they *do* show. For example:****
>>
>>
>> http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/si_cmds/PickElement.html
>> ****
>>
>> ** **
>>
>> Note how in the 2nd paragraph they mention output arguments, then in the
>> Parameters list, for "*PickedElement*", "*ButtonPressed*" and "*
>> ModifierPressed*" the Description of the parameter reads *"Returns
>> the..."*. That's how you know it's an *output argument*; because it's
>> trying to return something.****
>>
>> ** **
>>
>> The Parameter name for the output argument is the key for the
>> ISIVTCollection returned, so in this it might be something like *
>> Application.PickElement(...)("PickedElement")* for example.****
>>
>> ** **
>>
>> ** **
>>
>> Cheers,****
>>
>> ** **
>>
>>    -- Alan****
>>
>> ** **
>>
>> ** **
>>
>> On Thu, Apr 25, 2013 at 9:10 AM, Eric Thivierge <[email protected]>
>> wrote:****
>>
>> Yeah certain commands aren't, let's say, specifically compatible with
>> Python or other scripting languages that don't support output arguments.
>> That's an ugly explanation but is pretty much how I think of it. Either
>> way, I don't think the new SDK docs really show what arguments are the ones
>> returned so it may be a bit tough to know but if you take a look at the
>> various code around and maybe some of the older docs you'll see how it
>> works.
>>
>> This may help too in Python:
>>
>> http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=files/ISIVTCollection.htm,topicNumber=d30e53970
>> ****
>>
>>
>>
>> On 25/04/2013 7:57 AM, David Barosin wrote:****
>>
>> Look at these links - they help explain what ISIVTCollections are and
>> when they are returned.
>>
>> http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=files/outarg_bylang.htm,topicNumber=d30e53710
>>
>> http://download.autodesk.com/global/docs/softimage2013/en_us/sdkguide/index.html?url=files/ISIVTCollection.htm,topicNumber=d30e53970
>> ****
>>
>> ** **
>>
>> ** **
>>
>> On Thu, Apr 25, 2013 at 7:36 AM, Martin <[email protected]> wrote:****
>>
>> Hi list, ****
>>
>> ** **
>>
>> I have a question about SIImportMatLib command. ****
>>
>> ** **
>>
>> I was trying to get the return value in jscript without success until I
>> checked Eric's  ET_PassManager code where he is using****
>>
>> ** **
>>
>> oMatLib = xsi.SIImportMatLib(strMatLibPath)("Value")****
>>
>> ** **
>>
>> and the oMatLib gets the return value.****
>>
>> ** **
>>
>> It works (in jscript too) and I'm using it now, but why does it work?****
>>
>> I mean, where this ("Value") thing comes from? ****
>>
>> When should I use it?****
>>
>> Thanks****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>> M.Yara****
>>
>> ** **
>>
>> ** **
>>
>> ** **
>>
>
>

Reply via email to