Results 1 to 3 of 3

Thread: How do I get the preview start/end frames?

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

    Question How do I get the preview start/end frames?

    Hi,

    I am trying to get the start and end frames of the timeline/preview. When I use the following code in PCore, I get a "property" object instead of a double:

    Code:
    import lwsdk
    
    x = lwsdk.LWInterfaceInfo
    print x.previewStart
    This prints out "<property object at 0x000000BC89908>" instead of a time in seconds or a frame number. What methods could I use to get the values stored in this property object?

    Jen
    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
    Red Mage Celshader's Avatar
    Join Date
    Feb 2003
    Location
    Burbank, California
    Posts
    1,817
    Well, typing "help(property)" uncovered this:

    Code:
    >>> help(property)
    Help on class property in module __builtin__:
    class property(object)
     |  property(fget=None, fset=None, fdel=None, doc=None) -> property attribute
     |  
     |  fget is a function to be used for getting an attribute value, and likewise
     |  fset is a function for setting, and fdel a function for del'ing, an
     |  attribute.  Typical use is to define a managed attribute x:
     |  class C(object):
     |      def getx(self): return self._x
     |      def setx(self, value): self._x = value
     |      def delx(self): del self._x
     |      x = property(getx, setx, delx, "I'm the 'x' property.")
     |  
     |  Decorators make defining new properties or modifying existing ones easy:
     |  class C(object):
     |      @property
     |      def x(self): return self._x
     |      @x.setter
     |      def x(self, value): self._x = value
     |      @x.deleter
     |      def x(self): del self._x
     |  
     |  Methods defined here:
     |  
     |  __delete__(...)
     |      descr.__delete__(obj)
     |  
     |  __get__(...)
     |      descr.__get__(obj[, type]) -> value
     |  
     |  __getattribute__(...)
     |      x.__getattribute__('name') <==> x.name
     |  
     |  __init__(...)
     |      x.__init__(...) initializes x; see help(type(x)) for signature
     |  
     |  __set__(...)
     |      descr.__set__(obj, value)
     |  
     |  deleter(...)
     |      Descriptor to change the deleter on a property.
     |  
     |  getter(...)
     |      Descriptor to change the getter on a property.
     |  
     |  setter(...)
     |      Descriptor to change the setter on a property.
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  fdel
     |  
     |  fget
     |  
     |  fset
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __new__ = <built-in method __new__ of type object>
     |      T.__new__(S, ...) -> a new object with type S, a subtype of T
    I'm not yet sure what argument to use with fget(), though.
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

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

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

    My bad. This works...

    My bad. I forgot to use parentheses on LWInterfaceInfo.

    This works:

    Code:
    import lwsdk
    x = lwsdk.LWInterfaceInfo()
    print x.previewStart
    print x.previewEnd
    Jen's 3D -- LightWave stuff.
    Jen's 2D -- my comic book.

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

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
  •