[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2315] trunk/py/scripts/addons/modules/ extensions_framework/util.py: extensions_framework: add getSequenceTexturePath function to utils module
Campbell Barton
ideasman42 at gmail.com
Thu Sep 8 00:12:05 CEST 2011
best replace "/" with os.sep, but generally, I'm not sure its a good
idea to duplicate this code in python, think its worth looking into
how blender does it and adding a call in bpy.paths which re-uses C
code.
On Thu, Sep 8, 2011 at 12:28 AM, Doug Hammond
<doughammond at hamsterfight.co.uk> wrote:
> Revision: 2315
> http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2315
> Author: dougal2
> Date: 2011-09-07 14:28:37 +0000 (Wed, 07 Sep 2011)
> Log Message:
> -----------
> extensions_framework: add getSequenceTexturePath function to utils module
>
> Modified Paths:
> --------------
> trunk/py/scripts/addons/modules/extensions_framework/util.py
>
> Modified: trunk/py/scripts/addons/modules/extensions_framework/util.py
> ===================================================================
> --- trunk/py/scripts/addons/modules/extensions_framework/util.py 2011-09-07 12:59:19 UTC (rev 2314)
> +++ trunk/py/scripts/addons/modules/extensions_framework/util.py 2011-09-07 14:28:37 UTC (rev 2315)
> @@ -230,3 +230,41 @@
> hrs = td.days*24 + td.seconds/3600.0
>
> return '%i:%02i:%02i' % (hrs, min%60, td.seconds%60)
> +
> +def getSequenceTexturePath(it, f):
> + import bpy.path
> + import os.path
> + import string
> + fd = it.image_user.frame_duration
> + fs = it.image_user.frame_start
> + fo = it.image_user.frame_offset
> + cyclic = it.image_user.use_cyclic
> + ext = os.path.splitext(it.image.filepath)[-1]
> + fb = bpy.path.display_name_from_filepath(it.image.filepath)
> + dn = os.path.dirname(it.image.filepath)
> + rf = fb[::-1]
> + nl = 0
> + for i in range (len(fb)):
> + if rf[i] in string.digits:
> + nl += 1
> + else:
> + break
> + head = fb[:len(fb)-nl]
> + fnum = f
> + if fs != 1:
> + if f != fs:
> + fnum -= (fs-1)
> + elif f == fs:
> + fnum = 1
> + if fnum <= 0:
> + if cyclic:
> + fnum = fd - abs(fnum) % fd
> + else:
> + fnum = 1
> + elif fnum > fd:
> + if cyclic:
> + fnum = fnum % fd
> + else:
> + fnum = fd
> + fnum += fo
> + return dn + "/" + head + str(fnum).rjust(nl, "0") + ext
>
> _______________________________________________
> Bf-extensions-cvs mailing list
> Bf-extensions-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-extensions-cvs
>
--
- Campbell
More information about the Bf-extensions-cvs
mailing list