SCNScene rendering question

2014-10-14 Thread Livio Isaia
Hi all,
hope it’s the right place to post the question.

I have a figure of a penguin in a .dae file exported from blender which has 
armature and bones. It all works except that the figure is shown straggled in 
the middle of the body, where is the origin of the root bone
Is there a way to manipulate the data in order to have a normal figure?

(Hope it’s clear...)

Thanks to all in advance,
regards,
livio

ps:
nodes scheme:

Tux_Armature
right flipper
forearm
hand
left flipper
forearm
hand
body
right leg
foot
left leg
foot
head
bill
pupil
pupil
eyes
Tux
geometry...
skinner = Tux_Armature



___

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

Swift - Basic query regarding managedObjectContext method invocation from app delegate

2014-10-14 Thread Devarshi Kulshreshtha
I am trying to implement reset functionality in core data based sample app.

I think that there are two ways to implement reset functionality:

Approach 1: Delete sqlite file and then re-insert data

Approach 2: Retrieve all data in managedObjectContext, delete
retrieved data  and then re-insert data

I tried 'Approach 1' first, here is the code snippet:

@IBAction func resetData(sender: AnyObject) {

let appDelegate = UIApplication.sharedApplication().delegate
as AppDelegate

// delete old db if it exists
var url =
appDelegate.applicationDocumentsDirectory.URLByAppendingPathComponent(MyApp.sqlite)

let defaultFileManager = NSFileManager.defaultManager()

if defaultFileManager.fileExistsAtPath(url.path!) {
defaultFileManager.removeItemAtURL(url, error: nil)
}

let managedObjectContext = appDelegate.managedObjectContext!

var menuCategory : MenuCategories =
NSEntityDescription.insertNewObjectForEntityForName(MenuCategories,
inManagedObjectContext: managedObjectContext) as MenuCategories


appDelegate.saveContext()
}

Then I added a break point in appDelegate's managedObjectContext lazy
initialization method, here is the related code snippet:

lazy var managedObjectContext: NSManagedObjectContext? = {

let coordinator = self.persistentStoreCoordinator
if coordinator == nil {
return nil
}
var managedObjectContext = NSManagedObjectContext()
managedObjectContext.persistentStoreCoordinator = coordinator
return managedObjectContext
}()

First time when I performed reset action, the program counter (PC)
stopped on the added break point, but next time when I performed reset
action then the PC did not stop on the break point and app crashed for
obvious reasons:

Error Domain=NSCocoaErrorDomain Code=4 The operation couldn’t be
completed. (Cocoa error 4.) UserInfo=0x78f54ff0
{NSUnderlyingError=0x78f69250 The operation couldn’t be completed. No
such file or directory

Now my question is -

Why second time managedObjectContext initialization method was not invoked?

I know that I need to go back and learn Swift basics - the hard way,
perhaps there is some obvious reasons which I am missing, please
suggest.

___

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: Table of TextViews

2014-10-14 Thread Charles Jenkins
Can I ask you folks to look over and comment on this code? I think I’ve set up 
the text view and text container correctly to track the size of the text they 
contain, and I can notify my table view delegate when their size changes. The 
problem I’m having is that the table view delegate can note and log the size 
change and everything works well--as long as I don’t really do anything with 
the information. But if the table view delegate notifies the table that the 
corresponding row size changed, everything goes crazy.  

I’m going to take this step by step. Would you comment on my NSTextView 
subclass and tell me if something is wrong in the way I’ve set it up to size 
itself, notify itself, or pass along size-change notifications?

The code below is from three separate source files, but I’m sure you can tell 
which is which.

@protocol SizeWatcher NSObject

// Notify of actual size change, along with variables to
// answer the most common questions receiver will want to
// ask:
//Did width grow? Shrink? Remain the same?
//Did height grow? Shrink? Remain the same?
//What is the view's new frame/bounds?

-(void)sizeChangedForView:(NSView*)view
  widthChange:(CGFloat)wc
 heightChange:(CGFloat)hc;

@end

#import SizeWatcher.h

@interface CJAutosizingTextView : NSTextView

-(void)addSizeWatcher:(id)obj;
-(void)removeSizeWatcher:(id)obj;
-(void)removeAllSizeWatchers;

-(void)setLayoutManager:(NSLayoutManager*)lm;

@end

#import CJAutosizingTextView.h

@interface CJAutosizingTextView ()

@property NSRect oldFrame;
@property NSMutableArray* sizeWatchers;

@end

@implementation CJAutosizingTextView

@synthesize oldFrame;
@synthesize sizeWatchers;

-(instancetype)initWithFrame:(NSRect)frameRect
andLayoutManager:(NSLayoutManager*)lm
{
  self = [super initWithFrame:frameRect];
  if ( self != nil ) {

sizeWatchers = nil;
oldFrame = frameRect;

NSTextContainer* tc = [[NSTextContainer alloc] init];
self.textContainer = tc;

NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
   selector:@selector(frameChanged:)
   name:NSViewFrameDidChangeNotification
 object:self];

self.layoutManager = lm;

// Make text container and text view automatically
// size themselves vertically to fit the text

tc.widthTracksTextView = YES;
tc.heightTracksTextView = NO;

self.horizontallyResizable = NO;
self.verticallyResizable = YES;

// Allow superview to resize text view's width

self.autoresizingMask = NSViewWidthSizable;

  }
  return self;
}

-(instancetype)initWithFrame:(NSRect)frameRect
{
  return [self initWithFrame:frameRect andLayoutManager:nil];
}

-(void)dealloc
{
  NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
  [nc removeObserver:self
name:NSViewFrameDidChangeNotification
  object:self];
}

// NSTextView already has a layoutManager: selector to read the
// text container's layout manager. Here we add a convenient
// setter companion

-(void)setLayoutManager:(NSLayoutManager*)lm
{
  self.textContainer.layoutManager = lm;
}

// Maintain the array of size watchers

-(void)addSizeWatcher:(id)obj
{
  if ( [obj conformsToProtocol:@protocol(SizeWatcher)] ) {
if ( sizeWatchers == nil ) {
  sizeWatchers = [[NSMutableArray alloc] initWithCapacity:1];
}
[self.sizeWatchers addObject:obj];
  }
}

-(void)removeSizeWatcher:(id)obj
{
  if ( sizeWatchers != nil ) {
[sizeWatchers removeObject:obj];
  }
}

-(void)removeAllSizeWatchers
{
  if ( sizeWatchers != nil ) {
[sizeWatchers removeAllObjects];
  }
}

// When I'm notified that my frame changes, see if the new frame's
// size change and, if so, notify all size watchers

-(void)frameChanged:(NSNotification*)note
{
  // Begin with test that's probably unnecessary, but just to be sure...
  if ( [note object] == self ) {
NSRect newFrame = self.frame;
CGFloat wd = newFrame.size.width - oldFrame.size.width;
CGFloat hd = newFrame.size.width - oldFrame.size.width;
oldFrame = newFrame;
if ( wd != 0.0 || hd != 0.0 ) {
  // Notify watchers of actual size change
  for ( NSObjectSizeWatcher* obj in sizeWatchers ) {
[obj sizeChangedForView:self widthChange:wd heightChange:hd];
  }
}
  }
}

@end

--  

Charles

___

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: Table of TextViews

2014-10-14 Thread Charles Jenkins
Oops. When I pulled out this example code from the rest of my project, I 
mistyped something. Here is a corrected line: 

CGFloat hd = newFrame.size.height - oldFrame.size.height; 

-- 

Charles


On Tuesday, October 14, 2014 at 8:49, Charles Jenkins wrote:

 Can I ask you folks to look over and comment on this code?
 
 -- 
 
 Charles
 

___

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: Swift - Basic query regarding managedObjectContext method invocation from app delegate

2014-10-14 Thread Jerry Krinock

 On 2014 Oct 14, at 05:42, Devarshi Kulshreshtha devarshi.bluec...@gmail.com 
 wrote:
 
 I am trying to implement reset functionality in core data based sample app.
 
 I think that there are two ways to implement reset functionality:
 
 Approach 1: Delete sqlite file and then re-insert data

As you’ve seen, this is tricky to do without relying on some 
Apple-impleentation-dependent behaviors.

 Approach 2: Retrieve all data in managedObjectContext, delete
 retrieved data  and then re-insert data

Performance may be unacceptable, and people will disrespect your code :)

* * *

How about a third approach: perform a managed object context reset(), followed 
by a save().  Does that work?

Finally, if you’re in the modern world of Yosemite or iOS8, maybe some of the 
new direct database access methods will do what you want.


___

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

Custom NSView for Selection Rect...

2014-10-14 Thread Peters, Brandon
I am using a custom NSView as a selection rect. I also have a NSScrollView with 
a custom NSClipView and a document view. Should I make the selection rect 
(custom view) a subview of the document view or the clip view? What is best 
practice for this?
___

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: Custom NSView for Selection Rect...

2014-10-14 Thread Graham Cox

On 15 Oct 2014, at 8:21 am, Peters, Brandon bap...@my.fsu.edu wrote:

 I am using a custom NSView as a selection rect. I also have a NSScrollView 
 with a custom NSClipView and a document view. Should I make the selection 
 rect (custom view) a subview of the document view or the clip view? What is 
 best practice for this?

If you are determined to do it this way, it should be a subview of your content 
(document).

But I don't think you should do it this way. Since you already have a custom 
view containing your content, why not just give it a selection rect property 
that you use to draw the selection after (i.e. on top of) all the other 
content? Chances are it'll be much simpler to figure out what objects the 
selection rect is touching or enclosing, and driving it using the mouse, etc. 
With a separate view, you'll likely end up with a much more complicated way to 
determine these things. K.I.S.S.

Also, what's the reason for the custom clip view?

--Graham



___

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: Custom NSView for Selection Rect...

2014-10-14 Thread Peters, Brandon
Graham,

I will look into your suggestion. Also, I want the ability to draw the 
selection box “outside” of the image, similar to what the Preview application 
allows.


On Oct 14, 2014, at 8:02 PM, Graham Cox graham@bigpond.com wrote:

 
 On 15 Oct 2014, at 8:21 am, Peters, Brandon bap...@my.fsu.edu wrote:
 
 I am using a custom NSView as a selection rect. I also have a NSScrollView 
 with a custom NSClipView and a document view. Should I make the selection 
 rect (custom view) a subview of the document view or the clip view? What is 
 best practice for this?
 
 If you are determined to do it this way, it should be a subview of your 
 content (document).
 
 But I don't think you should do it this way. Since you already have a custom 
 view containing your content, why not just give it a selection rect 
 property that you use to draw the selection after (i.e. on top of) all the 
 other content? Chances are it'll be much simpler to figure out what objects 
 the selection rect is touching or enclosing, and driving it using the mouse, 
 etc. With a separate view, you'll likely end up with a much more complicated 
 way to determine these things. K.I.S.S.
 
 Also, what's the reason for the custom clip view?
 
 --Graham
 
 


___

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

Setting the Selected Segment of a Segmented Control

2014-10-14 Thread Daniel Blakemore
I have a simple problem.  I am programmatically setting the selected
segment of a segmented control.  Then the segmented control is changing
which segment appears selected on screen.

You might be saying to yourself, this seems correct.  You would also be
correct.

What is incorrect is that while the control *appears* to have changed, my
code knows nothing of this.

I have an action added for the control event UIControlEventValueChanged
which is called as expected when you tap the control.

HOWEVER, when changing the control programmatically, no such event is
generated.  This leaves my app in an inconsistent state.

For reference, see this example project
https://github.com/danblakemore/SegmentedNope.

This worked in iOS 7.  It now does not.  What has changed?

--
Daniel Blakemore
Pixio Software
___

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: Custom NSView for Selection Rect...

2014-10-14 Thread Graham Cox

On 15 Oct 2014, at 11:42 am, Peters, Brandon bap...@my.fsu.edu wrote:

 Graham,
 
 I will look into your suggestion. Also, I want the ability to draw the 
 selection box “outside” of the image, similar to what the Preview application 
 allows.


I think there probably isn't one best way to do this, it depends on your 
other requirements, and how you've implemented them.

Your content view might include both its content and parts of the background 
that surround it, or you might have different views that create this situation. 
Your content might be zoomable and you don't want the selection to zoom with 
it, or you do; in different cases different solutions will be easiest. A 
separate view that overlays the selection rect might well be a good solution in 
some cases, or maybe a transparent overlay view that covers your entire 
document but only draws the selection rect somewhere inside that. Each approach 
has its merits and drawbacks.

--Graham



___

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: Setting the Selected Segment of a Segmented Control

2014-10-14 Thread Richard Charles
Not sure about iOS but on OS X programmatically calling

[NSSegmentedControl setSelectedSegment:]

does not trigger the target / action message.

You need to programmatically respond after setting the selected segment.

Richard Charles

On Oct 14, 2014, at 6:55 PM, Daniel Blakemore dblakem...@pixio.com wrote:

 I have a simple problem.  I am programmatically setting the selected
 segment of a segmented control.  Then the segmented control is changing
 which segment appears selected on screen.
 
 You might be saying to yourself, this seems correct.  You would also be
 correct.
 
 What is incorrect is that while the control *appears* to have changed, my
 code knows nothing of this.
 
 I have an action added for the control event UIControlEventValueChanged
 which is called as expected when you tap the control.
 
 HOWEVER, when changing the control programmatically, no such event is
 generated.  This leaves my app in an inconsistent state.
 
 For reference, see this example project
 https://github.com/danblakemore/SegmentedNope.
 
 This worked in iOS 7.  It now does not.  What has changed?
 
 --
 Daniel Blakemore
 Pixio Software
 ___

___

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

NSTableColumn identifier - can't be set in latest IB?

2014-10-14 Thread Graham Cox
Hi all,

I've recently updated to Xcode 6 (6.0.1 to be exact) and I'm trying to set up a 
NSTableView. There appears to be no place to set the identifier property of 
NSTableColumn in the latest version of IB. There is a restoration ID but that 
doesn't seem to be the same thing. Am I missing something?

--Graham



___

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: Swift - Basic query regarding managedObjectContext method invocation from app delegate

2014-10-14 Thread Devarshi Kulshreshtha
I know about NSBatchUpdateRequest and NSAsynchronousFetchRequest, is
there any other fun part in modern world which can help me in my
requirement, excited to know ;)

On Wed, Oct 15, 2014 at 1:13 AM, Jerry Krinock je...@ieee.org wrote:

 On 2014 Oct 14, at 05:42, Devarshi Kulshreshtha 
 devarshi.bluec...@gmail.com wrote:

 I am trying to implement reset functionality in core data based sample app.

 I think that there are two ways to implement reset functionality:

 Approach 1: Delete sqlite file and then re-insert data

 As you’ve seen, this is tricky to do without relying on some 
 Apple-impleentation-dependent behaviors.

 Approach 2: Retrieve all data in managedObjectContext, delete
 retrieved data  and then re-insert data

 Performance may be unacceptable, and people will disrespect your code :)

 * * *

 How about a third approach: perform a managed object context reset(), 
 followed by a save().  Does that work?

 Finally, if you’re in the modern world of Yosemite or iOS8, maybe some of the 
 new direct database access methods will do what you want.


 ___

 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/devarshi.bluechip%40gmail.com

 This email sent to devarshi.bluec...@gmail.com



-- 
Thanks,

Devarshi

___

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