提交 c50154c9 编写于 作者: J Jonathan Thomas

Added multi-line support to Animated titles, and unicode support (although the...

Added multi-line support to Animated titles, and unicode support (although the Blender fonts don't show all unicode characters yet)
上级 da9541a0
......@@ -25,6 +25,7 @@
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
"""
import codecs
import os
import uuid
import shutil
......@@ -128,7 +129,7 @@ class BlenderTreeView(QTreeView):
# create spinner
widget = QTextEdit()
widget.setText(_(param["default"]))
widget.setText(_(param["default"]).replace("\\n", "\n"))
widget.textChanged.connect(functools.partial(self.text_value_changed, widget, param))
elif param["type"] == "dropdown":
......@@ -202,7 +203,7 @@ class BlenderTreeView(QTreeView):
value = widget.toPlainText()
except:
pass
self.params[param["name"]] = value
self.params[param["name"]] = value.replace("\n", "\\n")
log.info(value)
def dropdown_index_changed(self, widget, param, index):
......@@ -492,13 +493,13 @@ class BlenderTreeView(QTreeView):
if type(v) == int or type(v) == float or type(v) == list or type(v) == bool:
user_params += "params['{}'] = {}\n".format(k, v)
if type(v) == str:
user_params += "params['{}'] = r'{}'\n".format(k, v.replace("'", r"\'"))
user_params += "params['{}'] = u'{}'\n".format(k, v.replace("'", r"\'"))
for k, v in self.get_project_params(is_preview).items():
if type(v) == int or type(v) == float or type(v) == list or type(v) == bool:
user_params += "params['{}'] = {}\n".format(k, v)
if type(v) == str:
user_params += "params['{}'] = r'{}'\n".format(k, v.replace("'", r"\'"))
user_params += "params['{}'] = u'{}'\n".format(k, v.replace("'", r"\'"))
user_params += "#END INJECTING PARAMS\n"
# Force the Frame to 1 frame (for previewing)
......@@ -509,17 +510,15 @@ class BlenderTreeView(QTreeView):
user_params += "\n\n#END ONLY RENDER 1 FRAME FOR PREVIEW\n"
# Open new temp .py file, and inject the user parameters
f = open(path, 'r')
with open(path, 'r') as f:
script_body = f.read()
f.close()
# modify script variable
script_body = script_body.replace("#INJECT_PARAMS_HERE", user_params)
# Write update script
f = open(path, 'w')
with codecs.open(path, "w", encoding="UTF-8") as f:
f.write(script_body)
f.close()
def update_image(self, image_path):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册