How to sample MTLPixelFormatR32Float in Metal buffers and/or textures?
Hi, I have float array data that I want to use to create images in Metal. My plan is to apply one or more shaders to the data, then render it into a new RGB texture and continue from there. I’m using MTLPixelFormatR32Float as the source pixel format with success. In all the kernel examples I see the sampler returns a float4, which is appropriate for an RGBA format. But my source data/format has no color. What is the equivalent for sampling single float values? I’m currently putting the source data into a 2D texture. Given the use case above, does it make sense to use a MTLBuffer instead and then render that into a new 2D MTLTexture? Thanks! Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Is the list alive?
Hi, I thought that this list disappeared over the New Year, but it turns out it was just a period of slow traffic. While the frequency of posts has diminished from its heyday, I still find this list very useful. I occasionally skim the subject headings in the digest, but the real value is in the archive. It’s not uncommon for me to search past posts for a method name and find, if not the answer I’m looking for, something that points me in the right direction. I very much dislike the UI for Apple’s developer forums, and it feels like the history of comments there is not as deep. The signal to noise ratio here is extremely high. (What I *really* miss is cocoabuilder.com…) Here’s hoping this list sticks around for a while! Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Animate layout changes in NSCollectionView?
Hi, I have a 10.11+ NSCollectionView and a custom layout, and I’d like to animate the items in the collection when the bounds change. This does not involve inserting or deleting items or changing the layout, just repositioning them when the view changes size. It’s exactly this question: https://stackoverflow.com/questions/52091074/how-to-animate-a-relayout-of-nscollectionviewlayout-on-bounds-change I see the code belongs in - (void)prepareForAnimatedBoundsChange:(NSRect)oldBounds; - (void)finalizeAnimatedBoundsChange; but it’s not clear to me what to put in these methods. Thanks, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dynamically change NSCollectionView items based on view width
Pro-tip: when updating a legacy NSCollectionView to a modern implementation and you leave the old one in another view “just in case", update your “collectionView” outlet to point to the new one. Sigh. “Never mind.” — Roseanne Roseannadanna ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dynamically change NSCollectionView items based on view width
Hi Mike, On Apr 7, 2019, at 4:20 PM, Mike Abdullah wrote: > The obvious first question to me is: is your notification actually firing? Yes, it fires upon every frame change so I know exactly when the view’s width becomes is less than my threshold. I am observing changes in self.view.superview where “self" is my view controller, “self.view” is the scroll view containing the clip view and collection view. What is strange is that when I place a breakpoint in the block (from observerForName:object:queue:usingBlock) both collectionView.indexPathsForVisibleItems and collectionView.visibleItems return empty arrays, despite the fact I can see the items in the view. I had also thought to try deleting the items (via deleteItemsAtIndexPaths:) and adding them again, and reloadItemsAtIndexPaths: providing paths for the two items in the view. Nothing is triggering collectionView:itemForRepresentedObjectAtIndexPath: again. Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dynamically change NSCollectionView items based on view width
Hello, I have a 10.11+ NSCollectionView. I have two representations (subclasses of NSCollectionViewItem) of the data - one large and one small. When the view is resized to be narrower than the large representation, I’d like to swap the views to the smaller versions. Similarly, when the window is widened enough to accommodate at least a single of the larger views, I’d like the views to change again. I’ve not been able to make this work. I have set up an NSViewBoundsDidChangeNotification so I know when the width of the view crosses the threshold. I’ve tried: - [collectionView reloadData] - [collectionView.collectionViewLayout invalidateLayout] (on the NSCollectionViewFlowLayout) I think I just want to invalidate all of the already created views and get the collection view to call makeItemWithIdentifier:forIndexPath: again. One option I haven’t explored is to handle the change within a single NSCollectionViewItem subclass (two views in the one .xib), but since the representations are sufficiently different (e.g different number of subviews) I’m worried about running into auto layout issues during the transition. Also it feels messier. Bonus points for how to accomplish this with animation! Thanks, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bothersome "NSView-Encapsulated-Layout-Height" constraint?
On Aug 30, 2018, at 9:23 PM, Quincey Morris wrote: > “Encapsulated layout height” sounds like one of the constraints that IB adds > to your layout when it’s under-constrained at design time. Are you adding the > other constraints at run time? I’m not adding any constraints at run time. IB isn’t reporting anything as under-constrained. I tried to add a height constraint to the NSTableCellView, but that constraint is greyed out (and I found would have conflicted with the NSView-Encapsulated-Layout-Height anyway). Thanks, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bothersome "NSView-Encapsulated-Layout-Height" constraint?
Hi Rob, On Aug 30, 2018, at 8:34 PM, Rob Petrovec wrote: > You need to implement -outlineView:heightOfRowByItem: to return the height > you want for each row. Hope that helps. Sorry, in my email I wrote "outlineView:rowViewForItem:” when I meant to say "outlineView:heightOfRowByItem:”, which I have returning 20 or 24. This correctly changes the row height (it is being called), but the highlighting remains at 12 pixels regardless of value. Thanks, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bothersome "NSView-Encapsulated-Layout-Height" constraint?
Hi, I’ve been hitting my head against a wall for more time than I’d like to admit on what should be a simple problem - maybe someone can spot it immediately… I’m implementing a view-based source list style NSOutlineView (I’m trying to mimic the Finder sidebar). My header items are a different row height than the items underneath. I’ve implemented outlineView:rowViewForItem: (returns 24 for headers, 20 for items). The rows are spaced as expected in the column, but they are not drawn correctly. The cell is cropped to 12 pixels, as seen here: https://imgur.com/a/7KKgtZX I expect the highlighting to extend to the full height of the row. I tried to force this by adding two constraints, 2 pixels above and below the image, then got this: 2018-08-30 14:55:36.807612-0400 Nightlight[78272:15775715] [Layout] Unable to simultaneously satisfy constraints: ( "", "", "", "" ) This shows where the problem is: a height constraint on the row of 12 with the name "NSView-Encapsulated-Layout-Height”. This is the exact height I see being drawn. I have no idea where this is coming from or how to fix it though. Any help welcome - it’s annoying because this seems like such simple thing! Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Recommended way to save NSPredicates in Core Data store?
Hi, I'm building an interface that contains an NSPredicateEditor (think iTunes smart playlists), and I want to save the predicate in a Core Data store. What is the recommended way to do this? Serialize the NSPredicate object and save it as a blob? Break apart the predicate into one or more NSExpressions (left hand value, operator, right hand value) and reconstruct the predicate? I can think of several possibilities, but am wondering what is the path of least resistance (and, I suppose, most binding-friendly!). Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Animating source view design advice.
Hi, Thanks Corbin for the reply. For some reason I completely forgot that NSOutlineView was a subclass of NSTableView. Yes, of course that is the best (and should have been obvious!) solution. Cheers, Demitri --- On May 30, 2012, at 2:57 PM, Corbin Dunn wrote: > On May 30, 2012, at 11:37 AM, Demitri Muna > wrote: > >> Just because I hate orphaned questions (as no one answered), I thought I'd >> answer my own question. >> >> Most examples that use Core Data/bindings/array controllers use a table view >> as the source view, but I wanted something more flexible with my own custom >> view that involved a little animation. Although NSTableCellView makes this a >> little easier, it still felt shoehorned into a table view. > > Really? Why? It fits quite perfectly with the view based tableview. > >> I think the best answer is the realization that I don't need a table view at >> all to use the machinery above, > > I think the best solution is to use a view based NSOutlineView with variable > row heights and custom background drawing on the NSTableRowView. > > FWIW, Xcode uses NSOutlineView (non-view based at the current time). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Animating source view design advice.
Just because I hate orphaned questions (as no one answered), I thought I'd answer my own question. Most examples that use Core Data/bindings/array controllers use a table view as the source view, but I wanted something more flexible with my own custom view that involved a little animation. Although NSTableCellView makes this a little easier, it still felt shoehorned into a table view. I think the best answer is the realization that I don't need a table view at all to use the machinery above, and that one can simply have an array of NSViews managed by an array controller (in a scroll view). Everything else (e.g. master/detail, bindings) just falls into place after that. The most illustrative example was mmalc's "Graphics Bindings", located here: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html Although that link will only be valid for about a month before MobileMe ends. :) Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Animating source view design advice.
Hi, I would like to create a source view like Xcode 4's project navigator view. It will have "parent" views (e.g. the project) with a twist down triangle that, when clicked, will reveal the contents (e.g. files) in an animation that slides down. Many of these parent views can exist at the top level. When one is revealed, the ones below will slide down as well. What is the best way to implement this? Is a table view with NSTableCellView's a reasonable approach? I'm wondering if that is the case since the items (when opened) will easily have differing heights depending on the number of children. Is an NSOutlineView more appropriate here (at least I get the sliding animation for free). One complication is that I'd like to be able to select the parent view in the same way that you can in Xcode (that brings up the project/targets inspector) to bring up a "summary" detail view. I don't need a full implementation (not that I'd turn it away if one is available!), but a high-level view of the best approach to do this would be greatly appreciated! Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSRuleEditor with variable-height rows?
Hi, I was wondering if it might be possible to implement an NSRuleEditor with variable-height rows. There is a "rowHeight" property that can be set, but that sets the same height for all rows. I can override it with a subclass, but I don't see any obvious way to know which row height is being requested. Any ideas or suggestions would be greatly welcome! Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bulletproof way to create a new CGBitmapContext from an existing image?
Hi Steve and David, Thank you both for your comments; they were very helpful. I had thought that I had to match the context to the image I was going to use, but that's clearly wrong. I had missed that link to the supported pixel formats - that's very informative. Steve's comment also suggested to me (if this will help) another trick. I created the context with the *cropped* image size. When I draw the image in the context, I specify a rect positioned such that the context region contains the bit I want cropped, i.e. specify a rect that is larger than the bounds of the context. CG scales it as appropriate, but I only get the bit that I want. Again, thanks very much for the help! Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Page flip effect using Core Animation?
Hello, I'm beginning to delve into Core Animation, and am trying to implement what (I think) should be a very simple effect. I want to rotate a 50x50 layer around an axis defined by one of the edges which is fixed. The best analogy is looking down on a book and turning a page, the edge of the page being fixed in the binding. I have this so far: CGFloat angle = DegreesToRadians(-180); CATransform3D transform = CATransform3DIdentity; layer.anchorPoint = CGPointMake(1.0, 0.5); // turn page to right transform = CATransform3DRotate(transform, angle, 0, 1, 0); // y-axis rotation transform = CATransform3DTranslate(transform, -25, 0, 0); transform.m34 = 0.01f; // for pretty 3D effect layer.transform = transform; This is close in that the final and initial states are right, but the translation I added to get that makes the "page" move off the binding in the process. Also, why is the value -25 the right one to move the layer to the right position? I would have thought that it would be -50 (i.e. the width). Any help greatly appreciated! Cheers, Demitri ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]