Friday, January 28, 2011

28 January 2011

We had a discussion with Kevin today to talk about the things we need to complete before our internship ends. There were 3 main things:

- Research on Animation and model preparation
- Research on the Compare issue
- Work on axis resetting for translation (Probably with the use of quartenions? We would have to seek help from Calvin regarding this.)

Hence, after the discussion, we went on with our research for the animations.

Thursday, January 27, 2011

27 January 2011

Got quite a few things done today :)

We managed to solve the locking issue with the use of a NSTimer. Every time a user receives data, this timer would be started and would fire off in 1 second. If at anytime before the timer fires off and the user receives another set of data, the timer would be reset to fire off in 1 second again. Once the 1 second is over and no data has been received, we would then enable the user interactions. Here's how we got it done:

- (void)unlock
{
NSLog(@"UNLOCK");
self.view.userInteractionEnabled = YES;
interactingDeviceName.hidden = YES;

// End ignoring user interaction if already ignoring
if ([[UIApplication sharedApplication] isIgnoringInteractionEvents])
[[UIApplication sharedApplication] endIgnoringInteractionEvents];

timer = nil;
[timer invalidate];
[timer release];
}

- (void)lock
{
NSLog(@"LOCK");
self.view.userInteractionEnabled = NO;

// Start ignoring user interaction if not already ignoring
if (![[UIApplication sharedApplication] isIgnoringInteractionEvents])
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];

if ([timer isValid]) // Set timer's fireDate to current date + 1 sec
[timer setFireDateNSDate dateWithTimeIntervalSinceNow:1.0]];
else // Create timer with that fires in 1 second.
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(unlock) userInfo:nil repeats:NO];
}

Once locking was done, we worked on showing a label on all connected devices to show who is actually performing the current interactions. We also did a few fixes for our node button labels for them to be hidden whenever the user performs another action.

Then Kevin came in and tested out the whole flow. We were then told to make some edits:
- Segmentation for 3 buttons (adding in the "Compare" button to our current UISegmentedControl)
- Swapping the pinch gesture to do scaling, and the double tap gesture to do explode

We managed to get that done too, and we'll be testing out the flow of mirroring tomorrow.

Wednesday, January 26, 2011

26 January 2011

Continued from where Zac have stopped at yesterday, which is to send the model's current state from the server to the client that has just connected. This is to ensure both the server and the client are viewing the same thing at the same time. At first, we tried to add the last ModelTransformation of every node into an array and send it out to the client who has just connected. However, this didn't seem to work really well.

Then, we decided to use another approach. We would retrieve all the current transformation values for every node the moment a client has connected, and then send these information in an NSDictionary for every node to the client. However, we encountered an issue where the translation for the exploded view is not being applied. It is applied only when we debug step by step. We resolved this issue by performing the operation to explode the nodes after a delay of 0.5 seconds.

Next, we went on to work on locking. Locking here is to ensure that when one user interacts with the model, other connected users would not be able to interrupt until the interaction is complete. Whenever a user touches on the screen (touchesBegan), we would send a dictionary to all other connected users to disable their user interaction. Upon touchesEnded, we would once again send another dictionary to then enable their user interaction.

At first, we thought that this would work. However, it seems that our data that is being sent over to connected users for unlocking is always "stuck", which could be due to the data size being too small. Hence, the other users are always locked out. We tried looking for a solution but to no avail. Got to continue working on this tomorrow.

Monday, January 24, 2011

24 January 2011

Continued from last Friday's work. I first worked on the downloading of models loaded by the server if the model cannot be found in the client's directory. When I completed this, I met some problems with the SVN. I wasn't allowed to do a commit and was told that there were some conflicts, even though there were none. Even the "Resolved" button is disabled. It was probably because I resolved the conflicts on Friday, but did not click on the "Resolved" button - cannot confirm that this is the case though. Spent some time trying to checkout and whole new copy and add in whatever I have done to that copy.

After that, I went on to work on the sending of node transformations from the server to the client and vice versa. At first I tried sending the ModelTransformation object over in a dictionary, and apparently the NSKeyArchiver is unable to encode this class. Hence, I had to retrieve the values one by one and put them into NSNumbers or NSStrings. Once that was done, I just had to get the logic proper for setting of the transformations.

Left a little note in Zac's notebook to update him on what I have done, since he's not here today. He's got this NS diver's vocational assessment going on.