|
|
|
@ -12,6 +12,9 @@ bl_info = {
|
|
|
|
|
|
|
|
|
|
import bpy |
|
|
|
|
from bpy.types import Operator, Panel |
|
|
|
|
import site |
|
|
|
|
import subprocess |
|
|
|
|
import sys |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def import_module(self, module): |
|
|
|
@ -19,10 +22,6 @@ def import_module(self, module):
|
|
|
|
|
try: |
|
|
|
|
exec("import " + module) |
|
|
|
|
except ModuleNotFoundError: |
|
|
|
|
import site |
|
|
|
|
import subprocess |
|
|
|
|
import sys |
|
|
|
|
|
|
|
|
|
app_path = site.USER_SITE |
|
|
|
|
if app_path not in sys.path: |
|
|
|
|
sys.path.append(app_path) |
|
|
|
@ -39,13 +38,6 @@ def import_module(self, module):
|
|
|
|
|
try: |
|
|
|
|
exec("import " + module) |
|
|
|
|
except ModuleNotFoundError: |
|
|
|
|
# print("Installation of the " + module + " module failed") |
|
|
|
|
# self.report( |
|
|
|
|
# {"INFO"}, |
|
|
|
|
# "Installing " |
|
|
|
|
# + module |
|
|
|
|
# + " module failed! Try to run Blender as administrator.", |
|
|
|
|
# ) |
|
|
|
|
return False |
|
|
|
|
return True |
|
|
|
|
|
|
|
|
@ -64,8 +56,29 @@ class SequencerImportMovieOperator(Operator):
|
|
|
|
|
|
|
|
|
|
def execute(self, context): |
|
|
|
|
scene = context.scene |
|
|
|
|
|
|
|
|
|
subprocess.check_call( |
|
|
|
|
[ |
|
|
|
|
pybin, |
|
|
|
|
"-m", |
|
|
|
|
"pip", |
|
|
|
|
"install", |
|
|
|
|
"git+https://github.com/modelscope/modelscope.git", |
|
|
|
|
"--user", |
|
|
|
|
] |
|
|
|
|
) |
|
|
|
|
try: |
|
|
|
|
import modelscope |
|
|
|
|
except ModuleNotFoundError: |
|
|
|
|
print("Installation of the modelscope module failed") |
|
|
|
|
self.report( |
|
|
|
|
{"INFO"}, |
|
|
|
|
"Installing modelscope module failed! Try to run Blender as administrator.", |
|
|
|
|
) |
|
|
|
|
return False |
|
|
|
|
import_module(self, "open_clip_torch") |
|
|
|
|
if import_module(self, "modelscope"): |
|
|
|
|
import_module(self, "pytorch-lightning") |
|
|
|
|
|
|
|
|
|
from modelscope.pipelines import pipeline |
|
|
|
|
from modelscope.outputs import OutputKeys |
|
|
|
|
|
|
|
|
@ -110,7 +123,7 @@ def register():
|
|
|
|
|
bpy.utils.register_class(SequencerPanel) |
|
|
|
|
bpy.types.Scene.my_movie_filename = bpy.props.StringProperty( |
|
|
|
|
name="My Movie Filename", default="" |
|
|
|
|
) # , update=bpy.ops.sequencer.import_movie) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def unregister(): |
|
|
|
|