Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/addon/osl.py
| Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | def update_script_node(node, report): | ||||
| elif node.mode == 'INTERNAL' and node.script: | elif node.mode == 'INTERNAL' and node.script: | ||||
| # internal script, we will store bytecode in the node | # internal script, we will store bytecode in the node | ||||
| script = node.script | script = node.script | ||||
| osl_path = bpy.path.abspath(script.filepath, library=script.library) | osl_path = bpy.path.abspath(script.filepath, library=script.library) | ||||
| if script.is_in_memory or script.is_dirty or script.is_modified or not os.path.exists(osl_path): | if script.is_in_memory or script.is_dirty or script.is_modified or not os.path.exists(osl_path): | ||||
| # write text datablock contents to temporary file | # write text datablock contents to temporary file | ||||
| osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=False) | osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=False) | ||||
| osl_file.write(script.as_string()) | osl_file.write(script.as_string() + "\n") | ||||
| osl_file.close() | osl_file.close() | ||||
| ok, oso_path = osl_compile(osl_file.name, report) | ok, oso_path = osl_compile(osl_file.name, report) | ||||
| 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) | ||||
| Show All 35 Lines | |||||