对 Cocoa 应用程序和 Quartz Composer 中的 Movie Loader 补丁之间的绑定问题感到非常困惑

发布于 2024-11-15 14:02:30 字数 777 浏览 5 评论 0原文

我已经编程有一段时间了,但最近才决定开始为 Mac OS X 进行开发。我觉得在过去的一周里我已经掌握了 Objective-C 和 Cocoa 开发的基础知识。我正计划制作图形应用程序,因此目前正在学习如何通过 Cocoa 应用程序控制 Quartz 合成。我浏览了苹果提供的教程(使用 Mac Engravings 合成),并且能够很好地创建它。为了确保我真正理解我学到的东西,我决定创建自己的作品并将其链接到稍微复杂的 Cocoa 应用程序。

本质上,我有一个通过 Movie Loader 补丁加载电影或图像的组合,此时它在输出之前对帧应用各种过滤器。在我的 Cocoa 应用程序中,我编写了代码(或者更确切地说是从其他苹果示例复制并粘贴),让用户使用 NSOpenPanel 对象选择文件。他们选择的文件的文件路径被放置在我使用 Interface Builder 放置在应用程序窗口中的文本框中。我将所述文本框的值绑定到我的合成中的“Movie_Location”键,这是我正在使用的电影加载器补丁中发布的输入。但是,无论我做什么,电影和图像都不会加载到此合成中。唯一显示的是我在 Quartz Composer 的输入中保存的默认图像(如果我在发布之前将其留空,则什么也不显示)。

我已经在合成中添加了一个 Clear Color 补丁,并将其绑定到 UI 中的色井,这成功地改变了我的显示器中的颜色,所以我知道合成和我的 Cocoa 应用程序正在通信。此时我已经花了很多时间试图弄清楚发生了什么,但我几乎要放弃了。电影加载器是否有任何我不知道的奇怪行为,或者是否有一些我似乎遗漏的明显行为?我真的很感激任何人的帮助或建议。

感谢您阅读本文...

最好, 萨米人

I've been programming for a while, but just recently decided to start developing for Mac OS X. I feel like I've come to grips with the basics of Objective-C and Cocoa development over the past week. I'm planning on making graphics apps, and as such am currently in the process of learning how to control Quartz compositions through a Cocoa app. I went through the tutorial that apple offers (with the Mac Engravings composition), and was able to create that just fine. In order to make sure that I truly understood what I learned, I decided to create my own composition and link it to a slightly more complicated Cocoa application.

Essentially, I have a composition that loads a movie or image through a Movie Loader patch, at which point it applies various filters to the frames before outputting it. In my Cocoa app, I've written code (or rather copied and pasted from other apple examples) that lets a user pick a file using an NSOpenPanel object. The filepath of the file they pick gets placed in a text-box that I placed in the app's window using Interface Builder. I binded the value of said text-box to the "Movie_Location" key in my composition, which is a published input in the Movie Loader patch that I'm using. However, no matter what I do, movies and images aren't loaded into this composition no matter what I try. The only thing that gets displayed is the default image that I have saved in that input from Quartz Composer (or nothing if I leave it blank before publishing).

I've added a Clear Color patch to the composition and binded that to a colorwell in my UI, and that successfully changes the color in my display, so I know that the composition and my Cocoa app are communicating. I've spent numerous hours at this point trying to figure out what's going on, and I've just about given up. Does the Movie Loader have any weird behaviors that I'm not aware of, or is there something obvious that I seem to be missing? I'd really appreciate any help or advice from anybody.

Thanks for reading through this...

Best,
Sami

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

咆哮 2024-11-22 14:02:30

我认为有两件事是这样做的原因:

  1. 文件路径的格式不正确。尝试检查反斜杠、冒号等。
  2. 该框不会更新值。尝试逐字单击文本字段并按 Enter 键。

这就是我在没有看到你的石英成分和/或代码的情况下所能想到的。

编辑:

在常规属性中选中另一个连续框。

There are two things I can think of as reasons why it is doing this:

  1. The file path isn't formatted incorrectly. Try checking backslashes, colons, etc.
  2. The box isn't updating the value. Try literally clicking in the text field and hitting enter.

That's all I can think of without seeing your quartz composition and/or code.

EDIT:

Check the other continuous box, in the general properties.

蹲墙角沉默 2024-11-22 14:02:30

我昨天就明白了这一点。 spudwaffle 的第二个想法是发生了什么事。如果我输入一个文件路径并按回车键,它就会工作得很好。我通过删除绑定并使用补丁控制器提供的 setValue:keyInPath: 函数来使其正常工作。也就是说,有什么方法可以强制文本框更新吗?我记得在检查器的绑定子菜单中看到了“持续更新”或类似的按钮,但我的代码也无法与该检查一起使用。

感谢那些试图帮助我的人!我真的很感激。

最好的,
萨米人

I figured this out yesterday. spudwaffle's second idea is what was going on. If I were to type a filepath in and hit enter, it would work just fine. I got this to work properly by just removing the bind and instead using the setValue:keyInPath: function that a patch controller offers. That said, is there some way to force a text-box to update? I remember seeing a "continuously update" or something like that button within the bind sub-menu in the inspector, but my code didn't work with that checked either.

Thanks to those of you that tried to help me! I really appreciate it.

Best,
Sami

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文