forked from bartvdbraak/blender
Fix python error when OSL file has wrong extension.
This commit is contained in:
parent
7812d821a5
commit
2ce9bab8ce
@ -41,6 +41,8 @@ def update_script_node(node, report):
|
|||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
oso_file_remove = False
|
||||||
|
|
||||||
if node.mode == 'EXTERNAL':
|
if node.mode == 'EXTERNAL':
|
||||||
# compile external script file
|
# compile external script file
|
||||||
script_path = bpy.path.abspath(node.filepath, library=node.id_data.library)
|
script_path = bpy.path.abspath(node.filepath, library=node.id_data.library)
|
||||||
@ -49,7 +51,6 @@ def update_script_node(node, report):
|
|||||||
if script_ext == ".oso":
|
if script_ext == ".oso":
|
||||||
# it's a .oso file, no need to compile
|
# it's a .oso file, no need to compile
|
||||||
ok, oso_path = True, script_path
|
ok, oso_path = True, script_path
|
||||||
oso_file_remove = False
|
|
||||||
elif script_ext == ".osl":
|
elif script_ext == ".osl":
|
||||||
# compile .osl file
|
# compile .osl file
|
||||||
ok, oso_path = osl_compile(script_path, report)
|
ok, oso_path = osl_compile(script_path, report)
|
||||||
@ -65,7 +66,6 @@ def update_script_node(node, report):
|
|||||||
elif os.path.dirname(node.filepath) == "":
|
elif os.path.dirname(node.filepath) == "":
|
||||||
# module in search path
|
# module in search path
|
||||||
oso_path = node.filepath
|
oso_path = node.filepath
|
||||||
oso_file_remove = False
|
|
||||||
ok = True
|
ok = True
|
||||||
else:
|
else:
|
||||||
# unknown
|
# unknown
|
||||||
@ -88,12 +88,10 @@ def update_script_node(node, report):
|
|||||||
osl_file.close()
|
osl_file.close()
|
||||||
|
|
||||||
ok, oso_path = osl_compile(osl_file.name, report)
|
ok, oso_path = osl_compile(osl_file.name, report)
|
||||||
oso_file_remove = False
|
|
||||||
os.remove(osl_file.name)
|
os.remove(osl_file.name)
|
||||||
else:
|
else:
|
||||||
# compile text datablock from disk directly
|
# compile text datablock from disk directly
|
||||||
ok, oso_path = osl_compile(osl_path, report)
|
ok, oso_path = osl_compile(osl_path, report)
|
||||||
oso_file_remove = False
|
|
||||||
|
|
||||||
if ok:
|
if ok:
|
||||||
# read bytecode
|
# read bytecode
|
||||||
|
Loading…
Reference in New Issue
Block a user