Okay... Getting somewhere!
import sysimport os.pathfrom win32com.client import makepy
tlbs =
['/path/to/Softimage_2013_SP1/Application/bin/Converter.tlb','/path/to/Softimage_2013_SP1/Application/bin/LightRig.tlb','/path/to/Softimage_2013_SP1/Application/bin/XSIDial.tlb','/path/to/Softimage_2013_SP1/Application/bin/dotXSI_ie.tlb','/path/to/Softimage_2013_SP1/Application/bin/dsauto.tlb','/path/to/Softimage_2013_SP1/Application/bin/enums.tlb','/path/to/Softimage_2013_SP1/Application/bin/ophelper.tlb','/path/to/Softimage_2013_SP1/Application/bin/si3dobjectmodel.tlb','/path/to/Softimage_2013_SP1/Application/bin/si3dobjectmodel10.tlb','/path/to/Softimage_2013_SP1/Application/bin/siobjectmodel.tlb','/path/to/Softimage_2013_SP1/Application/bin/xsiutils.tlb']
for path in tlbs:
baseFolder = r'/path/somewhere/to/save/pyfiles/'
sys.argv = ["makepy", "-o", "%s/%s.py" % (baseFolder,
os.path.basename(path).split('.')[0]), path]
makepy.main()
This gets me some files I can introspect for methods and such.
On Wed, Jan 30, 2013 at 10:20 PM, Alan Fregtman <[email protected]>wrote:
> Reviving this old thread out of interest...
>
> So, with that sample code, we can introspect predefined global objects
> like Application and XSIUtils. That's cool, but for example, another object
> type like... "Parameter".... that's a class but I can't create it. I can't
> do win32com.client.Dispatch("Parameter") and
> XSIFactory.CreateObject("Parameter") won't work either.
>
> Is there any way I can somehow create the object on the fly, knowing its
> class type, some other way so that I can query its methods and properties?
>
>
> ps: Raff, could you elaborate how you AL guys got your introspection going
> for non-predefined globals?
>
>
>
> On Fri, Jan 4, 2013 at 6:15 AM, Andy Nicholas <[email protected]>wrote:
>
>> You guys should check this out. It might give you a good start...
>>
>>
>> http://xsisupport.com/2012/10/06/saturday-snippet-getting-a-list-of-properties-and-methods-with-python-introspection/
>>
>>
>>
>> On 04 January 2013 at 00:54 jo benayoun <[email protected]> wrote:
>>
>>
>> > The Softimage API (object model) is not visible because its all about
>> dynamic
>> > dispatching at runtime. This is like thinking your editor will be
>> natively
>> > enough smart to detect attributes you would add dynamically when
>> overriding
>> > the __getattr__ method of a class.
>> > Happily for us the dispatching is cached somewhere and even
>> introspectable by
>> > using the pythoncom/pywin32 API. With a little effort and sticking with
>> > python, one would have no problem in developing a plugin for this text
>> editor
>> > specially if sublime API is as convenient as it is claimed. The first
>> step is
>> > to learn how to use correctly the pywin32 package and what it does
>> under the
>> > hood to fully understand what the 'ultimate' solution could be.
>> > --jo
>> >
>> >
>> >
>> >
>> >
>> > 2013/1/3 César Sáez <[email protected] <mailto:[email protected]> >
>> > > > You're right, sublime/any-other-editor can't see that softimage
>> > > > variables.
>> > > If you're using 'Application' (or any 'implicit variable' like
>> that) your
>> > > script will fail on import, sipyutils module (or your own version of
>> it) is
>> > > the way to go IMHO.
>> > >
>> > >
>> > > On Thu, Jan 3, 2013 at 9:18 PM, Alan Fregtman <
>> [email protected]
>> > > <mailto:[email protected]> > wrote:
>> > > > > > But it won't be able to find global XSI objects just like
>> that,
>> > > > > > right? "Application" is defined by the axscript module,
>> but I
>> > > > > > feel like SI internally dispatches it in a way I don't
>> think
>> > > > > > Sublime could "see" it.
>> > > >
>> > > >
>> > > >
>> > > > On Thu, Jan 3, 2013 at 1:40 PM, César Sáez <[email protected]
>> > > > <mailto:[email protected]> > wrote:
>> > > > > > > > You have to add your environment paths to the 'env'
>> tag in
>> > > > > > > > your python.sublime-build config file, this way if
>> you have
>> > > > > > > > a shortcuts module it will instrospect it.
>> > > > > El 03/01/2013 17:34, "Gene Crucean" <
>> [email protected]
>> > > > > <mailto:[email protected]> > escribió:
>> > > > > > > > > > Hehe I was trying to figure out the same thing.
>> > > > > >
>> > > > > > On Thu, Jan 3, 2013 at 8:09 AM, Alan Fregtman
>> > > > > > <[email protected] <mailto:[email protected]> >
>> wrote:
>> > > > > > > > > > > > I use SublimeCodeIntel too but it's not
>> aware
>> > > > > > > > > > > > of XSI globals like Application,
>> XSIUtils and
>> > > > > > > > > > > > so on, so it won't introspect them.
>> > > > > > > How would one hack it to be more aware of such?
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > On Wed, Jan 2, 2013 at 9:19 PM, César Sáez
>> > > > > > > <[email protected] <mailto:[email protected]> > wrote:
>> > > > > > > > > > > > > > SublimeCodeIntel does a great job
>> > > > > > > > > > > > > > autocompleting python modules and
>> import
>> > > > > > > > > > > > > > statements (via introspoction,
>> works with
>> > > > > > > > > > > > > > your own modules too), it's not
>> softimage
>> > > > > > > > > > > > > > specific but helps alot.
>> > > > > > > >
>> > > > > > > > Another cool package is the SublimeLinter, it
>> > > > > > > > highlight potential errors in your code (IDE-like). I have
>> no idea
>> > > > > > > > how far I was from PEP8 until I start using it, now my code
>> is way
>> > > > > > > > cleaner and easy to the eyes :)
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > On Thu, Jan 3, 2013 at 12:22 AM, Raffaele
>> Fragapane
>> > > > > > > > <[email protected] <mailto:
>> [email protected]>
>> > > > > > > > > wrote:
>> > > > > > > > > > > > > > > > You actually can introspect
>> > > > > > > > > > > > > > > > recursively almost the
>> entirety of
>> > > > > > > > > > > > > > > > the scripting API and
>> generate a
>> > > > > > > > > > > > > > > > dummy set of libraries from
>> there.
>> > > > > > > > > > > > > > > > That will offer
>> autocompletion in
>> > > > > > > > > > > > > > > > most IDEs.
>> > > > > > > > >
>> > > > > > > > > We've had that running here in AL for a
>> while
>> > > > > > > > > thanks to Aloys' efforts a long time ago and it's worked
>> without
>> > > > > > > > > a hitch for years.
>> > > > > > > > >
>> > > > > > > > > On Thu, Jan 3, 2013 at 10:18 AM, Gene
>> Crucean
>> > > > > > > > > <[email protected]
>> > > > > > > > > <mailto:[email protected]> > wrote:
>> > > > > > > > > > > > > > > > > > It would be completely
>> > > > > > > > > > > > > > > > > > bitchin if it
>> autocompleted
>> > > > > > > > > > > > > > > > > > the entire sdk... and
>> not
>> > > > > > > > > > > > > > > > > > just simple commonly
>> used
>> > > > > > > > > > > > > > > > > > snippets.
>> > > > > > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > > > > > >
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > > Gene Crucean - Emmy winning - Oscar nominated VFX
>> Supervisor
>> > > > > > / iOS-OSX Developer / Filmmaker / Photographer
>> > > > > > ** Freelance for hire **
>> > > > > > www.genecrucean.com <http://www.genecrucean.com>
>> > > > > >
>> > > > > > ~~ Please use my website's contact form on
>> > > > > > www.genecrucean.com <http://www.genecrucean.com/> for any
>> personal
>> > > > > > emails. Thanks. I may not get them at this address. ~~
>> > > > > >
>> > > > > >
>> > > > > > > > > >
>> > > > >
>> > > > > > > >
>> > > >
>> > > >
>> > > > > >
>> > >
>> > >
>> > > >
>>
>>
>