搅拌机2.7 MacOS cons

2024-06-28 20:21:59 发布

您现在位置:Python中文网/ 问答频道 /正文

我在mac(OS 10.9.2)上使用Blender2.7,主机无法正常打开。如果我打开blender.app/Contents/MacOS/blender,我得到了一个新的终端窗口,但它充满了易读和难以辨认的字符,如“œ˙ÌÄamp;{H_196;PAGEZERO_UuTextÃÃÃÔ。Blender也不会记录打印语句或错误。在

有人知道怎么回事吗?在

谢谢!在

编辑:我也是终端新手,我尝试使用/Contents/MacOS目录中的“open blender”:p。如果您在父目录中输入“./blender”,它就可以正常工作了。在

如果有人能解释一下发生了什么,或者键入“./filename”和“open filename”之间的区别,那就太棒了。在


Tags: 目录app终端osmaccontentsmacosopen
2条回答

Blender有它需要运行的各种资源,这些资源与二进制文件位于同一个文件夹中,它从当前工作目录开始,以便在启动Blender时找到它们。在

在您输入命令的终端中,有一个序列(在PATH变量中定义)用于搜索命令,在命令前面加上./表示在当前工作目录中运行命令,而不是在路径列表中搜索它。在

命令open是为了在一个合适的编辑器中打开可编辑的文件,它似乎认为可以用终端来处理它,除了新的终端将在您的主目录中启动,从而使blender无法找到它的资源。我使用OSX已经有几年了,但它也可能试图将blender二进制文件作为shell脚本运行。不管是哪种方式,open都不能处理可运行的二进制文件,也不是设计用来处理的。在

所以区别在于open blender就像说你想编辑文件,但是{}实际上是从命令行运行一个应用程序。在

你也会发现创建一个applescript非常容易,它告诉终端更改工作目录并启动blender。这可以很容易地保存为一个应用程序,您可以从finder启动。我认为这是(未经测试的)-

tell application "Terminal"
 do script "cd /Applications/blender/blender.app/Contents/MacOS && ./blender"
end tell

如果你只想在运行脚本时得到python输出,你可以尝试the script here-它允许你在blender的python控制台中运行一个脚本来捕捉输出。在

当您需要特定于blender的python脚本帮助时,请访问blender.stackexchange

很抱歉,如果这个答案不太符合您的问题,但与主题有关:

听好所有mac用户的话,这里有一些东西给你:

利用我自己的“恼火”经历和this guy (sambler)的想法的帮助,我制作了一个简单的应用程序,目的是用终端打开搅拌机。在

-请尝试一下,它很容易安装而且非常方便-

here是应用程序,如果您需要它并且在这里。。。在

…是如何使用它:

  1. 导航到blender.app用finder。在

enter image description here

  1. 右击搅拌机并选择“显示包装内容”。在

enter image description here

  1. Download应用程序并解压缩。在

enter image description here

  1. 将应用程序拖到blender的“内容”文件夹中。在

enter image description here

  1. 将应用程序拖到停靠点并首次打开。在

enter image description here

  1. (可选)在房间里跳舞,歌唱你有这样一个应用程序是多么幸运。在





或者这里是applescript的来源:(目前,有很多有用的评论)

set myPath to ((path to current application) as string)  find the path to blenderOpen.app
set myPath to ((characters 1 through ((length of myPath) - 1) of myPath) as string)  rip off the last ":"
set charDelete to (last character of myPath)   rip off the "blenderOpen.app"
repeat until charDelete = ":"   rip off the "blenderOpen.app"
    set myPath to ((characters 1 through ((length of myPath) - 1) of myPath) as string)   rip off the "blenderOpen.app"
    set charDelete to (last character of myPath)   rip off the "blenderOpen.app"
end repeat
set myPath to myPath & "MacOS"  find the blender runtime by appending this path

set myPath to quoted form of the POSIX path of myPath   convert path so terminal understands
(*
why this little if statement down below?
This if statement is here because if a user
opens terminal and runs some command,
then afterwards runs our script,
we want to use a new window so as not
to interfere with the user.
However, if WE open terminal,
than we want to use the window 
that terminal just made for us.
*)

if testterminal() then
    tell application "Terminal" to do script "cd " & myPath & " && ./blender"   tell terminal to open new window, and open blender, Voila!!!
else
    tell application "Terminal" to tell front window to do script "cd " & myPath & " && ./blender"   tell terminal to open blender, in the current window, Voila!!!
end if


return myPath
on testterminal()
    tell application "System Events" to (name of processes) contains "Terminal"
end testterminal

相关问题 更多 >