Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-01-28 14:48:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-01-28 14:48:06 +0300
commit18ea9b6443a4029c729fc29c55d53f3a9e849ca8 (patch)
tree71dd0273e0b994870b48e2156d9c1ea9edb58ae0 /release
parent72cb4548a76dba3fc39c0d8bb36e65f115d0ab22 (diff)
move bpy.load_scripts --> bpy.utils.load_scripts
added sequencer strip length display in seconds
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy/__init__.py72
-rw-r--r--release/scripts/modules/bpy/utils.py74
-rw-r--r--release/scripts/ui/space_sequencer.py6
3 files changed, 80 insertions, 72 deletions
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py
index 1b248658afd..8d654fb3978 100644
--- a/release/scripts/modules/bpy/__init__.py
+++ b/release/scripts/modules/bpy/__init__.py
@@ -36,74 +36,6 @@ ops = _ops_module.ops_fake_module
import sys as _sys
-def load_scripts(reload_scripts=False):
- import os
- import traceback
- import time
-
-
- t_main = time.time()
-
- loaded_modules = set()
-
- def test_import(module_name):
- if module_name in loaded_modules:
- return None
- if "." in module_name:
- print("Ignoring '%s', can't import files containing multiple periods." % module_name)
- return None
-
- try:
- t = time.time()
- ret = __import__(module_name)
- if app.debug:
- print("time %s %.4f" % (module_name, time.time() - t))
- return ret
- except:
- traceback.print_exc()
- return None
-
- def test_reload(module):
- try:
- reload(module)
- except:
- traceback.print_exc()
-
- if reload_scripts:
- # reload modules that may not be directly included
- for type_class_name in dir(types):
- type_class = getattr(types, type_class_name)
- module_name = getattr(type_class, "__module__", "")
-
- if module_name and module_name != "bpy.types": # hard coded for C types
- loaded_modules.add(module_name)
-
- for module_name in loaded_modules:
- print("Reloading:", module_name)
- test_reload(_sys.modules[module_name])
-
- for base_path in utils.script_paths():
- for path_subdir in ("ui", "op", "io"):
- path = os.path.join(base_path, path_subdir)
- if os.path.isdir(path):
- if path not in _sys.path: # reloading would add twice
- _sys.path.insert(0, path)
- for f in sorted(os.listdir(path)):
- if f.endswith(".py"):
- # python module
- mod = test_import(f[0:-3])
- elif "." not in f:
- # python package
- mod = test_import(f)
- else:
- mod = None
-
- if reload_scripts and mod:
- print("Reloading:", mod)
- test_reload(mod)
-
- if app.debug:
- print("Time %.4f" % (time.time() - t_main))
def _main():
@@ -119,14 +51,14 @@ def _main():
# if "-d" in sys.argv: # Enable this to measure startup speed
if 0:
import cProfile
- cProfile.run('import bpy; bpy.load_scripts()', 'blender.prof')
+ cProfile.run('import bpy; bpy.utils.load_scripts()', 'blender.prof')
import pstats
p = pstats.Stats('blender.prof')
p.sort_stats('cumulative').print_stats(100)
else:
- load_scripts()
+ utils.load_scripts()
_main()
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index 855751a0743..55116281d0a 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -25,6 +25,80 @@ not assosiated with blenders internal data.
import bpy as _bpy
import os as _os
+import sys as _sys
+
+def load_scripts(reload_scripts=False, refresh_scripts=False):
+ import traceback
+ import time
+
+ t_main = time.time()
+
+ loaded_modules = set()
+
+ def test_import(module_name):
+ if module_name in loaded_modules:
+ return None
+ if "." in module_name:
+ print("Ignoring '%s', can't import files containing multiple periods." % module_name)
+ return None
+
+ try:
+ t = time.time()
+ ret = __import__(module_name)
+ if _bpy.app.debug:
+ print("time %s %.4f" % (module_name, time.time() - t))
+ return ret
+ except:
+ traceback.print_exc()
+ return None
+
+ def test_reload(module):
+ try:
+ reload(module)
+ except:
+ traceback.print_exc()
+
+ if reload_scripts:
+ # reload modules that may not be directly included
+ for type_class_name in dir(types):
+ type_class = getattr(types, type_class_name)
+ module_name = getattr(type_class, "__module__", "")
+
+ if module_name and module_name != "bpy.types": # hard coded for C types
+ loaded_modules.add(module_name)
+
+ for module_name in loaded_modules:
+ print("Reloading:", module_name)
+ test_reload(_sys.modules[module_name])
+
+ for base_path in script_paths():
+ for path_subdir in ("ui", "op", "io"):
+ path = _os.path.join(base_path, path_subdir)
+ if _os.path.isdir(path):
+
+ # needed to load scripts after the users script path changes
+ # we should also support a full reload but since this is now unstable it can be postponed.
+ if refresh_scripts and path in _sys.path:
+ continue
+
+ if path not in _sys.path: # reloading would add twice
+ _sys.path.insert(0, path)
+ for f in sorted(_os.listdir(path)):
+ if f.endswith(".py"):
+ # python module
+ mod = test_import(f[0:-3])
+ elif "." not in f:
+ # python package
+ mod = test_import(f)
+ else:
+ mod = None
+
+ if reload_scripts and mod:
+ print("Reloading:", mod)
+ test_reload(mod)
+
+ if _bpy.app.debug:
+ print("Time %.4f" % (time.time() - t_main))
def expandpath(path):
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py
index 99298cc3988..9a63903300e 100644
--- a/release/scripts/ui/space_sequencer.py
+++ b/release/scripts/ui/space_sequencer.py
@@ -310,7 +310,7 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
def draw(self, context):
layout = self.layout
-
+ render_data = context.scene.render_data
strip = act_strip(context)
split = layout.split(percentage=0.3)
@@ -344,7 +344,9 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel):
col.enabled = not strip.lock
col.prop(strip, "channel")
col.prop(strip, "start_frame")
- col.prop(strip, "length")
+ subrow = col.split(percentage=0.66)
+ subrow.prop(strip, "length")
+ subrow.label(text="%.2f sec" % (strip.length / (render_data.fps / render_data.fps_base)))
col = layout.column(align=True)
col.label(text="Offset:")