Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: How to use PCore's "Save Log" to build a LW Python reference manual

  1. #1
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817

    How to use PCore's "Save Log" to build a LW Python reference manual

    Hi, guys,

    I've been for some time trying to figure out how to export the results of help() in PCore to a text file. I spent so much time trying to figure out how to use Python to do it that I completely overlooked the "Save Log" button on the lower-left-hand corner of the PCore interface. (D'oh!)

    So, I figured I should write down how to do it here.

    1. Launch PCore
    2. type "import lwsdk" in the commandline to import the lwsdk module into PCore
    3. change the number of Max Lines from 100 to 10000
    4. type "help(lwsdk)" into the commandline. The help info for LWInterfaceInfo will appear.
    5. Use the "Save Log" button to save the results of "help(lwsdk)" to a to a text file.
    6. Click on "Clear Log" to clear the buffer.
    7. repeat steps 4-6 to extract the help data for other lwsdk functions like LWMessageFuncs and save them to text files.


    Based on the content of lwsdk.txt, these functions are available in the lwsdk Python module:

    Code:
        Color
        ContextMenuFuncs
        Control
        DTBakeZone
        DTDrawFuncs
        DTEventParam
        DTKeySelect
        DTMenuCallbacks
        DTMouseParam
        DTToolCallbacks
        DrawFuncs
        DyBitfieldHint
        DyChoiceHint
        DyReqChoiceDesc
        DyReqControlDesc
        DyReqStringDesc
        DyReqTextDesc
        DyValCustom
        DyValFVector
        DyValFloat
        DyValIVector
        DyValInt
        DyValPointer
        DyValString
        DynaMonitorFuncs
        DynaStringHint
        DynaValue
        EDBoundCv
        EDEdgeInfo
        EDPointInfo
        EDPolygonInfo
        HostDisplayInfo
        IChannelFactory
        IChannel
        ICommandSequenceFactory
        ICommandSequence
        ICustomObjFactory
        ICustomObj
        IDisplacementFactory
        IDisplacement
        IFactoryFuncs
        IGenericFactory
        IGeneric
        IGizmoFuncs
        IHandlerFuncs
        IImageFilterFactory
        IImageFilter
        IInterfaceFuncs
        IItemFuncs
        IItemMotionFactory
        IItemMotion
        ILayoutToolFactory
        ILayoutToolFuncs
        ILayoutTool
        IMasterFactory
        IMaster
        IObjReplacementFactory
        IObjReplacement
        IPlugin
        IRenderFuncs
        IShaderFactory
        IShader
        LSURFuncs
        LWAnimFrameAccess
        LWBackdropInfo
        LWBlockIdent
        LWBoneInfo
        LWCHANGEFUNCS
        LWCameraAccess
        LWCameraEvaluationFuncs
        LWCameraInfo
        LWCameraRay
        LWChannelAccess
        LWChannelInfo
        LWColorPickLocal
        LWColorSpaceFuncs
        LWComRing
        LWCompInfo
        LWComponentTimingInfo
        LWCustomObjAccess
        LWDisplacementAccess
        LWDopetrackProxy
        LWEnvelopeFuncs
        LWEnvironmentAccess
        LWEventNotifyPluginChange
        LWFileIOFuncs
        LWFileReqLocal
        LWFilterAccess
        LWFogInfo
        LWFontListFuncs
        LWFrameInfo
        LWFrameTimingInfo
        LWGPolMeshInfo
        LWGizmo
        LWGlobalPool
        LWGlobalService
        LWIllumination
        LWImageList
        LWImageLoaderLocal
        LWImageProtocol
        LWImageSaverLocal
        LWImageUtil
        LWInstancerAccess
        LWInterfaceInfo
        LWItemInfo
        LWItemInstanceInfo
        LWItemInstancerFuncs
        LWItemMotionAccess
        LWLMonFuncs
        LWLayoutGeneric
        LWLightAccess
        LWLightEvaluationFuncs
        LWLightInfo
        LWListInfo
        LWLoadState
        LWMTUtilFuncs
        LWMasterAccess
        LWMeshEditTool
        LWMeshInfo
        LWMessageFuncs
        LWMicropol
        LWModCommand
        LWMonitor
        LWNameChangeData
        LWNodalAccess
        LWNodalMaterial
        LWNodeDrawFuncs
        LWNodeEditorFuncs
        LWNodeFuncs
        LWNodeInputFuncs
        LWNodeOGLTextureOutput
        LWNodeOutputFuncs
        LWNodeUtilityFuncs
        LWObjReplacementAccess
        LWObjectFuncs
        LWObjectImport
        LWObjectInfo
        LWPCoreConsole
        LWPSBufDesc
        LWPSysFuncs
        LWPanAreaDesc
        LWPanChoiceDesc
        LWPanControlDesc
        LWPanLWItemDesc
        LWPanListBoxDesc
        LWPanMenuDesc
        LWPanMultiListBoxDesc
        LWPanPopupDesc
        LWPanRangeDesc
        LWPanStringDesc
        LWPanTextDesc
        LWPanTreeDesc
        LWPanXPanDesc
        LWPanelMenuFuncs
        LWPanels
        LWPhoton
        LWPixelAccess
        LWPixelRGB24
        LWPixelRGBA32
        LWPixelRGBADBL
        LWPixelRGBAFP
        LWPixelRGBDBL
        LWPixelRGBFP
        LWPolyType
        LWPolygonTypeAccess
        LWPreviewFuncs
        LWPreviewLight
        LWPtypeWireDrawAccess
        LWRasterFuncs
        LWRayIllumination
        LWRayTraceData
        LWRootNode
        LWSaveState
        LWSceneConverter
        LWSceneInfo
        LWServerInfo
        LWShaderAccess
        LWShelfFuncs
        LWStateQueryFuncs
        LWSurfEdFuncs
        LWSurfaceFuncs
        LWTEXTFUNCS
        LWTextureAccess
        LWTextureFuncs
        LWTimeInfo
        LWTimer
        LWToolEvent
        LWToolFuncs
        LWTool
        LWTxtrEdFuncs
        LWTxtrParamDesc
        LWTxtrParamFuncs
        LWVParmFuncs
        LWVRayFuncs
        LWValCustom
        LWValFVector
        LWValFloat
        LWValIVector
        LWValInt
        LWValPointer
        LWValString
        LWValue
        LWVertexIndexes
        LWViewportInfo
        LWViewportObjectAccess
        LWViewportObjectCamera
        LWViewportObjectMenu
        LWVolumeAccess
        LWVolumeSample
        LWVolumetricEvaluationFuncs
        LWWireDrawAccess
        LWXPDrawFuncs
        LWXPanelControl
        LWXPanelDataDesc
        LWXPanelFuncs
        MeshEditOp
        ModuleDescriptor
        Panel
        PvSample
        SEApply
        SEBank
        SEColumn
        SEVMap
        SceneEditorGlobal
        ServerRecord
        ServerTagInfo
        Vector
        display_Metrics
        st_LWHumanInterfaceDeviceAccess
        st_LWHumanInterfaceDeviceCreateContext
        st_LWHumanInterfaceDeviceHandler
        st_LWHumanInterfaceHIDAccess
        st_LWHumanInterfaceHIDCreateContext
        st_LWHumanInterfaceHIDHandler
        st_LWHumanInterfaceHIDReceiveAccess
        st_LWHumanInterfaceManagerAccess
        st_LWHumanInterfaceManagerHandler
        st_LWHumanInterfaceTrackAccess
    Here's a sample saved log after typing in "help(lwsdk.LWInterfaceInfo)":

    Code:
    >>> help(lwsdk.LWInterfaceInfo)
    Help on class LWInterfaceInfo in module pcore:
    class LWInterfaceInfo(__builtin__.object)
     |  Proxy of C++ PCore::LWInterfaceInfo class
     |  
     |  Methods defined here:
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args)
     |      __init__(self) -> LWInterfaceInfo
     |      __init__(self, LWInterfaceInfo source_) -> LWInterfaceInfo
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  defaultItemTypeColor(self, *args)
     |      defaultItemTypeColor(self, LWItemType itemtype, float color, int set)
     |  
     |  itemColor(self, *args)
     |      itemColor(self, LWItemID item) -> int
     |  
     |  itemColorRgba(self, *args)
     |      itemColorRgba(self, LWItemID item, unsigned int state, float rgba)
     |  
     |  itemFlags(self, *args)
     |      itemFlags(self, LWItemID item) -> unsigned int
     |  
     |  itemIconScale(self, *args)
     |      itemIconScale(self, LWItemID item) -> float
     |  
     |  itemVis(self, *args)
     |      itemVis(self, LWItemID item) -> int
     |  
     |  schemaPos(self, *args)
     |      schemaPos(self, LWItemID item, double x, double y)
     |  
     |  selected_items(self)
     |      selected_items(self) -> PyObject
     |  
     |  setItemColorCustom(self, *args)
     |      setItemColorCustom(self, LWItemID item, double color)
     |  
     |  setItemColorIndex(self, *args)
     |      setItemColorIndex(self, LWItemID item, int color)
     |  
     |  valid(self)
     |      valid(self) -> bool
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  alertLevel
     |      LWInterfaceInfo_alertLevel_get(LWInterfaceInfo self) -> int
     |  
     |  autoKeyCreate
     |      LWInterfaceInfo_autoKeyCreate_get(LWInterfaceInfo self) -> int
     |  
     |  boxThreshold
     |      LWInterfaceInfo_boxThreshold_get(LWInterfaceInfo self) -> int
     |  
     |  curTime
     |      LWInterfaceInfo_curTime_get(LWInterfaceInfo self) -> LWTime
     |  
     |  displayFlags
     |      LWInterfaceInfo_displayFlags_get(LWInterfaceInfo self) -> unsigned int
     |  
     |  dynaUpdate
     |      LWInterfaceInfo_dynaUpdate_get(LWInterfaceInfo self) -> int
     |  
     |  generalFlags
     |      LWInterfaceInfo_generalFlags_get(LWInterfaceInfo self) -> unsigned int
     |  
     |  previewEnd
     |      LWInterfaceInfo_previewEnd_get(LWInterfaceInfo self) -> LWFrame
     |  
     |  previewStart
     |      LWInterfaceInfo_previewStart_get(LWInterfaceInfo self) -> LWFrame
     |  
     |  previewStep
     |      LWInterfaceInfo_previewStep_get(LWInterfaceInfo self) -> LWFrame
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_LWInterfaceInfo>
     |      delete_LWInterfaceInfo(LWInterfaceInfo self)
     |  
     |  __swig_getmethods__ = {'alertLevel': <built-in function LWInterfaceInf...
     |  
     |  __swig_setmethods__ = {'alertLevel': <built-in function LWInterfaceInf...
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

    Python is my smashing board. LightWave is my S.M.A.K.

  2. #2
    Code Muppet evenflcw's Avatar
    Join Date
    Feb 2003
    Location
    Stockholm, Sweden
    Posts
    2,642
    Hmm... this is a good idea. For sure one could probably use python itself to process, format and create such a document. But really NT is the one that should do this (and add doc strings). But likely some kind poor bastard will do it in their place.
    Last edited by evenflcw; 04-05-2012 at 10:41 PM.

  3. #3
    Kamehameha Chameleon BigHache's Avatar
    Join Date
    Sep 2006
    Location
    Future Past Life
    Posts
    1,899
    There's also a ton of stuff in the PCore file if you get help on that too. It's over 18k lines though and took 30 min? on my i5 to process.

  4. #4
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817

    Lightbulb

    Quote Originally Posted by BigHache View Post
    There's also a ton of stuff in the PCore file if you get help on that too. It's over 18k lines though and took 30 min? on my i5 to process.
    That's good to know. What should I type into PCore to get help on the PCore file? Typing "help(PCore)" and other variations did not work.
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

    Python is my smashing board. LightWave is my S.M.A.K.

  5. #5
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817
    Quote Originally Posted by evenflcw View Post
    Hmm... this is a good idea. For sure one could probably use python itself to process, format and create such a document. But really NT is the one that should do this (and add doc strings). But likely some kind poor bastard will do it in their place.
    I'll be that bastard...

    This HTML document only contains the LWFunctions so far, but it's a start...

    LightWave 11 Python Wordbook
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

    Python is my smashing board. LightWave is my S.M.A.K.

  6. #6
    Code Muppet evenflcw's Avatar
    Join Date
    Feb 2003
    Location
    Stockholm, Sweden
    Posts
    2,642
    Nicely done. Thanks.

  7. #7
    Kamehameha Chameleon BigHache's Avatar
    Join Date
    Sep 2006
    Location
    Future Past Life
    Posts
    1,899
    Sweet, looking good Jen.

    Try using all lowercase since it's case-sensitive. I have to use single quotes, looks like you don't though?

    help('pcore')

    Make sure to up your Max Lines to 19000, and get a sammich.

  8. #8
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817

    It's working now...

    Quote Originally Posted by BigHache View Post
    Sweet, looking good Jen.

    Try using all lowercase since it's case-sensitive. I have to use single quotes, looks like you don't though?

    help('pcore')
    Thanks. It's working now.

    I was using no quotes at all in-between the parentheses. PCore humored me for the other modules, but it looks like it's strict about help for 'pcore.'

    Make sure to up your Max Lines to 19000, and get a sammich.
    Yup. I'm letting it think about it right now in the background while I work on other stuff in the foreground.
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

    Python is my smashing board. LightWave is my S.M.A.K.

  9. #9
    Kamehameha Chameleon BigHache's Avatar
    Join Date
    Sep 2006
    Location
    Future Past Life
    Posts
    1,899
    Oh you know, I think someone posted the pcore file in the pre-release forums. Meh.

  10. #10
    Super Member dwburman's Avatar
    Join Date
    Feb 2003
    Location
    Washington State, USA
    Posts
    2,880
    This might be a little easier to work with.

    http://dl.dropbox.com/u/45975558/LW1...nWordbook3.htm

    I basically put the list of names (functions?) into columns and added some CSS to make it a bit easier on the eyes. I probably took a bit too much time changing some of the structure (primarily removing formatting commands from the body and replacing them with hooks for the CSS).

    Code:
    It would have gone a bit faster if the < and > symbols were 
    search and replaced with their HTML equivalents ( &lt; and &gt; ) 
    before HTML tags were added. :)
    [mr] Dana W. Burman | http://dwburman.com
    Motion Graphics for sale at Pond5 Stock Footage
    Check out my tutorials at Liberty3d.com & my YouTube channel!

  11. #11
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817

    Smile

    Quote Originally Posted by dwburman View Post
    This might be a little easier to work with.

    http://dl.dropbox.com/u/45975558/LW1...nWordbook3.htm

    I basically put the list of names (functions?) into columns and added some CSS to make it a bit easier on the eyes. I probably took a bit too much time changing some of the structure (primarily removing formatting commands from the body and replacing them with hooks for the CSS).
    That looks great! Thank you for sharing this.
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

    Python is my smashing board. LightWave is my S.M.A.K.

  12. #12
    Super Member dwburman's Avatar
    Join Date
    Feb 2003
    Location
    Washington State, USA
    Posts
    2,880
    You're welcome. Feel free to download and post it wherever. I don't know if I'll leave it in my dropbox or not.
    [mr] Dana W. Burman | http://dwburman.com
    Motion Graphics for sale at Pond5 Stock Footage
    Check out my tutorials at Liberty3d.com & my YouTube channel!

  13. #13
    Kamehameha Chameleon BigHache's Avatar
    Join Date
    Sep 2006
    Location
    Future Past Life
    Posts
    1,899
    Indeed, thank you both. I've started writing a pdf book, but I need more info to keep it going. This is also a great resource.

  14. #14
    aka Ken9 DuneBoy's Avatar
    Join Date
    Sep 2005
    Location
    Los Angeles, CA
    Posts
    280
    Building on Dana's work, I've added a 'View SDK Doc' link under all the applicable entries.

    Just put the file in the SDK's html folder and now you can quickly get access to the proper SDK document which explains how the C API equivalent works.

    http://dl.dropbox.com/u/13236441/Kou...ordbookWSL.htm

    I have the Word-to-URL list and python script (to update the html file) if anyone wants them.

    ken
    Ken Nign

  15. #15
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817

    Nice work!

    Quote Originally Posted by DuneBoy View Post
    Building on Dana's work, I've added a 'View SDK Doc' link under all the applicable entries.

    Just put the file in the SDK's html folder and now you can quickly get access to the proper SDK document which explains how the C API equivalent works.

    http://dl.dropbox.com/u/13236441/Kou...ordbookWSL.htm

    I have the Word-to-URL list and python script (to update the html file) if anyone wants them.

    ken
    Thank you for posting this. This helps a lot.
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

    Python is my smashing board. LightWave is my S.M.A.K.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •