Просмотр исходного кода

Added weighted animation blending support to the skeletal animation system, fixed HDR post processing material to use the latest material system, fixed retina support in Polycode Player, fixed labels offsetting incorrectly by a pixel due to texture padding.

Ivan Safrin 12 лет назад
Родитель
Сommit
49763db246

BIN
Assets/Default asset pack/hdr.pak


+ 2 - 8
Assets/Default asset pack/hdr/hdr.mat

@@ -45,18 +45,13 @@
 		</material>	
 		<material name="HDRProcessBloom" screen="true">
 			<rendertargets type="rgba_fp16">
-				<rendertarget id="base_target"  sizeMode="normalized" width="1.0" height="1.0"/>			
 				<rendertarget id="bloomtarget"  sizeMode="pixels" width="512" height="512"/>
 				<rendertarget id="bloomtarget2"  sizeMode="pixels" width="512" height="512"/>				
 				<rendertarget id="bloomtarget_final"  sizeMode="pixels" width="512" height="512"/>
 			</rendertargets>
-			<shader name="PassThrough">
-				<targettextures>
-					<targettexture mode="out" id="base_target"/>
-				</targettextures>
-			</shader>	
 			<shader name="ExtractBloom">
 				<targettextures>			
+					<targettexture mode="color" name="screenColorBuffer"/>
 					<targettexture mode="out" id="bloomtarget"/>
 				</targettextures>
 			</shader>									
@@ -72,10 +67,9 @@
 					<targettexture mode="out" id="bloomtarget_final"/>					
 				</targettextures>													
 			</shader>
-			
 			<shader name="HDRProcessShaderBloom">
 				<targettextures>
-					<targettexture mode="in" name="baseTexture" id="base_target"/>								
+					<targettexture mode="color" name="baseTexture"/>								
 					<targettexture mode="in" name="bloomTexture" id="bloomtarget_final"/>				
 				</targettextures>													
 			</shader>			

+ 4 - 5
Core/Contents/Include/PolyBone.h

@@ -48,7 +48,6 @@ namespace Polycode {
 			* @return Name of the bone.
 			*/
 			const String& getName() const;
-			void Render();
 
 			/**
 			* Sets the parent bone of this bone.
@@ -149,11 +148,11 @@ namespace Polycode {
 			Matrix4 restMatrix;
 			Matrix4 baseMatrix;
 		
-		
-		
+            Quaternion baseRotation;
+            Vector3 baseScale;
+            Vector3 basePosition;
+        
 		protected:
-			Mesh *boneMesh;
-		
 			Bone* parentBone;
 			std::vector<Bone*> childBones;
 			String boneName;

+ 1 - 1
Core/Contents/Include/PolyLabel.h

@@ -103,7 +103,7 @@ namespace Polycode {
 		
 			bool _optionsChanged;
 			GlyphData labelData;
-	
+	        
 			std::vector<ColorRange> colorRanges;
 		
 			int baseLineOffset;

+ 9 - 1
Core/Contents/Include/PolyMatrix4.h

@@ -114,7 +114,15 @@ namespace Polycode {
 			*/
 			//@{
 
-
+        
+            inline Matrix4 operator * (Number n) const {
+                return Matrix4(
+                           n*m[0][0], n*m[0][1], n*m[0][2], n*m[0][3],
+                           n*m[1][0], n*m[1][1], n*m[1][2], n*m[1][3],
+                           n*m[2][0], n*m[2][1], n*m[2][2], n*m[2][3],
+                           n*m[3][0], n*m[3][1], n*m[3][2], n*m[3][3]);
+            }
+        
 			inline Vector3 operator * ( const Vector3 &v2 ) const
 			{
 				return Vector3(v2.x*m[0][0] + v2.y*m[1][0] + v2.z*m[2][0] + m[3][0],

+ 3 - 0
Core/Contents/Include/PolyMesh.h

@@ -252,6 +252,9 @@ namespace Polycode {
             Vertex *getVertex(unsigned int index) const;
 
             Vertex *getActualVertex(unsigned int index) const;
+
+            unsigned int getActualVertexCount() const;
+        
         
 			/**
 			* Sets the vertex buffer for the mesh.

+ 2 - 1
Core/Contents/Include/PolyServer.h

@@ -54,8 +54,9 @@ namespace Polycode {
 		
 		ServerClientEvent *handlePacket(Packet *packet);
 		
-		unsigned int clientID;
+		unsigned int    clientID;
 		PeerConnection *connection;
+        bool clientReady;
 	};
 		
 	class _PolyExport ServerEvent : public Event {

+ 33 - 11
Core/Contents/Include/PolySkeleton.h

@@ -40,10 +40,14 @@ namespace Polycode {
 	class _PolyExport BoneTrack : public PolyBase {
 		public:
 			BoneTrack(Bone *bone, Number length);
+        
+            void initTweens();
 			~BoneTrack();
+        
 			void Play(bool once=false);
 			void Stop();
 			void Update();
+            void Reset();
 		
 			void setSpeed(Number speed);
 			
@@ -75,13 +79,11 @@ namespace Polycode {
 			Vector3 QuatYVec;			
 			Vector3 QuatZVec;		
 		
+            Number weight;
 			
 		protected:
 		
 			Number length;
-		
-			bool initialized;
-		
 			Bone *targetBone;
 			std::vector <BezierPathTween*> pathTweens;
 		
@@ -115,6 +117,9 @@ namespace Polycode {
 			* Stops the animation.
 			*/			
 			void Stop();
+        
+            void Reset();
+        
 			void Update();
 
 			/**
@@ -123,8 +128,15 @@ namespace Polycode {
 			*/					
 			void setSpeed(Number speed);
 			
+            void setWeight(Number newWeight);
+            Number getWeight() const;
+        
+            bool isPlaying() const;
+        
 		protected:
 			
+            Number weight;
+            bool playing;
 			String name;
 			Number duration;
 			std::vector<BoneTrack*> boneTracks;
@@ -165,10 +177,18 @@ namespace Polycode {
 			* @param animName Name of animation to play.
 			* @param once If true, will only play the animation once.
 			*/
-			void playAnimation(const String& animName, bool once = false);
-						
-			void playAnimationByIndex(int index, bool once = false);		
+			void playAnimationByName(const String& animName, Number weight = 1.0, bool once = false, bool restartIfPlaying = false);
 			
+
+            void playAnimation(SkeletonAnimation *animation, Number weight = 1.0, bool once = false, bool restartIfPlaying = false);
+        
+            void setBaseAnimationByName(const String &animName);
+            void setBaseAnimation(SkeletonAnimation *animation);
+        
+            void stopAllAnimations();
+        
+            SkeletonAnimation *getBaseAnimation();
+        
 			/**
 			* Loads in a new animation from a file and adds it to the skeleton.
 			* @param name Name of the new animation.
@@ -181,6 +201,11 @@ namespace Polycode {
 			* @param Name of animation to return.
 			*/
 			SkeletonAnimation *getAnimation(const String& name) const;
+
+        
+            void stopAnimationByName(const String &name);
+            void stopAnimation(SkeletonAnimation *animation);
+        
 			void Update();
 			
 			/**
@@ -206,16 +231,13 @@ namespace Polycode {
 			*/
 			Bone *getBone(int index) const;
 		
-			/**
-			* Returns the current animation.
-			*/
-			SkeletonAnimation *getCurrentAnimation() const { return currentAnimation; }
 		
 		protected:
 		
 			Entity *bonesEntity;
 		
-			SkeletonAnimation *currentAnimation;
+            SkeletonAnimation *baseAnimation;
+            std::vector<SkeletonAnimation*> playingAnimations;
 			std::vector<Bone*> bones;
 			std::vector<SkeletonAnimation*> animations;
 	};

+ 0 - 19
Core/Contents/Source/PolyBone.cpp

@@ -31,18 +31,10 @@ using namespace Polycode;
 
 Bone::Bone(const String& boneName) : Entity() {
 	this->boneName = boneName;
-//	boneMesh = new ScenePrimitive(ScenePrimitive::TYPE_BOX, 0.1, 0.1, 0.1);
-	this->depthTest = false;
 	parentBone = NULL;
 	boneMatrix.identity();
-//	addChild(boneMesh);
-	
-	boneMesh = new Mesh(Mesh::QUAD_MESH);
-	boneMesh->createBox(0.2,0.2,0.2);
-	
 }
 
-
 Bone::~Bone() {
 
 }
@@ -134,14 +126,3 @@ void Bone::setRestMatrix(const Matrix4& matrix) {
 const String& Bone::getName() const {
 	return boneName;
 }
-
-void Bone::Render() {
-
-	CoreServices::getInstance()->getRenderer()->setTexture(NULL);	
-//	renderer->pushDataArrayForMesh(boneMesh, RenderDataArray::COLOR_DATA_ARRAY);
-	renderer->pushDataArrayForMesh(boneMesh, RenderDataArray::VERTEX_DATA_ARRAY);
-	renderer->pushDataArrayForMesh(boneMesh, RenderDataArray::TEXCOORD_DATA_ARRAY);	
-	renderer->pushDataArrayForMesh(boneMesh, RenderDataArray::NORMAL_DATA_ARRAY);		
-	renderer->drawArrays(boneMesh->getMeshType());	
-
-}

+ 1 - 1
Core/Contents/Source/PolyClient.cpp

@@ -63,7 +63,7 @@ void Client::handlePacket(Packet *packet, PeerConnection *connection) {
 			case PACKET_TYPE_SETCLIENT_ID: {
 				clientID = (unsigned short)*packet->data;
 				ClientEvent *newEvent = new ClientEvent();
-				sendReliableData(serverAddress, (char*)&clientID, sizeof(unsigned short), PACKET_TYPE_CLIENT_READY);				
+				sendReliableData(serverAddress, (char*)&clientID, sizeof(unsigned short), PACKET_TYPE_CLIENT_READY);
 				dispatchEvent(newEvent, ClientEvent::EVENT_CLIENT_READY);				
 			} break;
 			case PACKET_TYPE_DISONNECT:

+ 5 - 3
Core/Contents/Source/PolyLabel.cpp

@@ -420,16 +420,18 @@ void Label::setText(const String& text) {
 	unsigned int textWidth = (bbox.xMax -  bbox.xMin)+1;
 	unsigned int textHeight = (bbox.yMax -  bbox.yMin)+1;
 
+	baseLineOffset = bbox.yMin;
+	xAdjustOffset = bbox.xMin;
+	baseLineAdjust = bbox.yMax;
+    
 	if(textWidth % 2 ){
 		textWidth++;
 	}
 	if(textHeight % 2 ){
 		textHeight++;
+        baseLineAdjust++;
 	}
 
-	baseLineOffset = bbox.yMin;
-	xAdjustOffset = bbox.xMin;
-	baseLineAdjust = bbox.yMax;
 	
 	createEmpty(textWidth,textHeight);	
 	renderGlyphs(&labelData);

+ 4 - 0
Core/Contents/Source/PolyMesh.cpp

@@ -555,6 +555,10 @@ void Mesh::createSphere(Number radius, int segmentsH, int segmentsW) {
     arrayDirtyMap[RenderDataArray::TANGENT_DATA_ARRAY] = true;		
 }
 
+unsigned int Mesh::getActualVertexCount() const {
+    return vertices.size();    
+}
+
 unsigned int Mesh::getVertexCount() {
     if(indexedMesh) {
         return indices.size();

+ 1 - 1
Core/Contents/Source/PolySceneLabel.cpp

@@ -61,7 +61,7 @@ void SceneLabel::setLabelActualHeight(Number actualHeight) {
     this->actualHeight = actualHeight;
     
     if(actualHeight > 0.0) {
-        labelScale = actualHeight/((Number)label->getSize());
+        labelScale = actualHeight/((Number)label->getSize()) * CoreServices::getInstance()->getRenderer()->getBackingResolutionScaleX();
     } else {
         labelScale = 1.0;
     }

+ 8 - 4
Core/Contents/Source/PolyServer.cpp

@@ -28,7 +28,7 @@ using namespace Polycode;
 using std::vector;
 
 ServerClient::ServerClient() {
-	
+    clientReady	= false;
 }
 
 ServerClient::~ServerClient() {
@@ -106,6 +106,7 @@ void Server::handlePeerConnection(PeerConnection *connection) {
 	clients.push_back(newClient);	
 
 	unsigned short clientID = newClient->clientID;
+    printf("SENDING PACKET_TYPE_SETCLIENT_ID\n");
 	sendReliableData(newClient->connection->address, (char*)&clientID, sizeof(unsigned short), PACKET_TYPE_SETCLIENT_ID);
 
 }
@@ -147,9 +148,12 @@ void Server::handlePacket(Packet *packet, PeerConnection *connection) {
 	switch (packet->header.type) {
 		case PACKET_TYPE_CLIENT_READY:
 		{
-			ServerEvent *event = new ServerEvent();
-			event->client = client;
-			dispatchEvent(event, ServerEvent::EVENT_CLIENT_CONNECTED);					
+            if(!client->clientReady) {
+                client->clientReady = true;
+                ServerEvent *event = new ServerEvent();
+                event->client = client;
+                dispatchEvent(event, ServerEvent::EVENT_CLIENT_CONNECTED);
+            }
 		}
 		break;
 		case PACKET_TYPE_DISONNECT:

+ 200 - 128
Core/Contents/Source/PolySkeleton.cpp

@@ -27,6 +27,7 @@
 #include "PolySceneLabel.h"
 #include "PolySceneLine.h"
 #include "PolyTween.h"
+#include "PolyTweenManager.h"
 #include "OSBasics.h"
 
 using namespace Polycode;
@@ -36,12 +37,11 @@ Skeleton *Skeleton::BlankSkeleton() {
 }
 
 Skeleton::Skeleton(const String& fileName) : Entity() {
+    baseAnimation = NULL;
 	loadSkeleton(fileName);
-	currentAnimation = NULL;
 }
 
 Skeleton::Skeleton() {
-	currentAnimation = NULL;	
 }
 
 Skeleton::~Skeleton() {
@@ -63,37 +63,48 @@ Bone *Skeleton::getBone(int index) const {
 	return bones[index];
 }
 
-void Skeleton::playAnimationByIndex(int index, bool once) {
-	if(index > animations.size()-1)
-		return;
-		
-	SkeletonAnimation *anim = animations[index];
-	if(!anim)
-		return;
-	
-	if(anim == currentAnimation && !once)
-		return;
-	
-	if(currentAnimation)
-		currentAnimation->Stop();
-	
-	currentAnimation = anim;
-	anim->Play(once);	
+void Skeleton::setBaseAnimationByName(const String &animName) {
+	SkeletonAnimation *anim = getAnimation(animName);
+	if(anim) {
+        setBaseAnimation(anim);
+    }
 }
 
-void Skeleton::playAnimation(const String& animName, bool once) {
+void Skeleton::setBaseAnimation(SkeletonAnimation *animation){
+    baseAnimation = animation;
+    baseAnimation->setWeight(1.0);
+    animation->Play(false);
+}
+
+
+void Skeleton::playAnimationByName(const String& animName, Number weight, bool once, bool restartIfPlaying) {
 	SkeletonAnimation *anim = getAnimation(animName);
-	if(!anim)
-		return;
-	
-	if(anim == currentAnimation && !once)
-		return;
-	
-	if(currentAnimation)
-		currentAnimation->Stop();
-		
-	currentAnimation = anim;
-	anim->Play(once);
+	if(anim) {
+        playAnimation(anim, weight, once, restartIfPlaying);
+    }
+}
+
+void Skeleton::playAnimation(SkeletonAnimation *animation, Number weight, bool once, bool restartIfPlaying) {
+    
+    if(weight > 1.0) {
+        weight = 1.0;
+    }
+    if(weight < 0.0) {
+        weight = 0.0;
+    }
+    
+    animation->setWeight(weight);
+    
+    if(animation->isPlaying()) {
+        if(restartIfPlaying) {
+            animation->Reset();
+        }
+        return;
+    }
+    
+    animation->Reset();
+    playingAnimations.push_back(animation);
+    animation->Play(once);
 }
 
 SkeletonAnimation *Skeleton::getAnimation(const String& name) const {
@@ -105,10 +116,25 @@ SkeletonAnimation *Skeleton::getAnimation(const String& name) const {
 }
 
 void Skeleton::Update() {
-
-	if(currentAnimation != NULL) {
-		currentAnimation->Update();
-	}
+    
+    for(int i=0; i < bones.size(); i++) {
+        bones[i]->setRotationByQuaternion(bones[i]->baseRotation);
+        bones[i]->setPosition(bones[i]->basePosition);
+        bones[i]->setScale(bones[i]->baseScale);
+    }
+    
+    if(baseAnimation) {
+        baseAnimation->Update();
+    }
+    
+    for(int i=0; i < playingAnimations.size(); i++) {
+        playingAnimations[i]->Update();
+    }
+    
+    for(int i=0; i < bones.size(); i++) {
+        bones[i]->rebuildTransformMatrix();
+        bones[i]->setBoneMatrix(bones[i]->getTransformMatrix());
+    }
 }
 
 void Skeleton::loadSkeleton(const String& fileName) {
@@ -152,6 +178,13 @@ void Skeleton::loadSkeleton(const String& fileName) {
 		
 		bones.push_back(newBone);
 		
+		Quaternion bq;
+		bq.set(rq[0], rq[1], rq[2], rq[3]);
+        
+        newBone->baseRotation = bq;
+        newBone->baseScale = Vector3(s[0], s[1], s[2]);
+        newBone->basePosition = Vector3(t[0], t[1], t[2]);
+        
 		newBone->setPosition(t[0], t[1], t[2]);
 		newBone->setRotationQuat(rq[0], rq[1], rq[2], rq[3]);
 		newBone->setScale(s[0], s[1], s[2]);
@@ -174,31 +207,48 @@ void Skeleton::loadSkeleton(const String& fileName) {
 	}
 
 	Bone *parentBone;
-//	Entity *bProxy;
 	
 	for(int i=0; i < bones.size(); i++) {
 		if(bones[i]->parentBoneId != -1) {
 			parentBone = bones[bones[i]->parentBoneId];
 			parentBone->addChildBone(bones[i]);
 			bones[i]->setParentBone(parentBone);
-			parentBone->addChild(bones[i]);			
-//			addEntity(bones[i]);										
-			
-			SceneLine *connector = new SceneLine(bones[i], parentBone);
-			connector->depthTest = false;
-			bonesEntity->addChild(connector);				
-			connector->setColor(((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),((Number)(rand() % RAND_MAX)/(Number)RAND_MAX),1.0f);
+			parentBone->addChild(bones[i]);
 		} else {
-//			bProxy = new Entity();
-//			addEntity(bProxy);			
-//			bProxy->addEntity(bones[i]);
 			bonesEntity->addChild(bones[i]);
 		}
-	//	bones[i]->visible = false;			
 	}
 	OSBasics::close(inFile);
 }
 
+SkeletonAnimation *Skeleton::getBaseAnimation() {
+    return baseAnimation;
+}
+
+void Skeleton::stopAllAnimations() {
+    for(int i=0; i < playingAnimations.size(); i++) {
+        playingAnimations[i]->Stop();
+    }
+    playingAnimations.clear();
+}
+
+void Skeleton::stopAnimationByName(const String &name) {
+	SkeletonAnimation *anim = getAnimation(name);
+	if(anim) {
+        stopAnimation(anim);
+    }
+}
+
+void Skeleton::stopAnimation(SkeletonAnimation *animation) {
+    for(int i=0; i < playingAnimations.size(); i++) {
+        if(playingAnimations[i] == animation) {
+            playingAnimations[i]->Stop();            
+            playingAnimations.erase(playingAnimations.begin()+i);
+            return;
+        }
+    }
+}
+
 void Skeleton::addAnimation(const String& name, const String& fileName) {
 	OSFILE *inFile = OSBasics::open(fileName.c_str(), "rb");
 	if(!inFile) {
@@ -208,25 +258,35 @@ void Skeleton::addAnimation(const String& name, const String& fileName) {
 		unsigned int activeBones,boneIndex,numPoints,numCurves, curveType;	
 		float length;
 		OSBasics::read(&length, 1, sizeof(float), inFile);
+    
 		SkeletonAnimation *newAnimation = new SkeletonAnimation(name, length);
-		
+    
+        printf("LOADING %s\n", name.c_str());
+    
 		OSBasics::read(&activeBones, sizeof(unsigned int), 1, inFile);
 		
 		//	Logger::log("activeBones: %d\n", activeBones);		
 		for(int j=0; j < activeBones; j++) {
 			OSBasics::read(&boneIndex, sizeof(unsigned int), 1, inFile);
+            if(boneIndex > bones.size()-1) {
+                printf("WARNING: INCORRECT BONE INDEX!\n");
+                continue;
+            }
 			BoneTrack *newTrack = new BoneTrack(bones[boneIndex], length);
 			
+            printf("TRACK FOR BONE %s\n", bones[boneIndex]->getName().c_str());
+            
 			BezierCurve *curve;
 			float vec1[2]; //,vec2[2],vec3[2];
 			
 			OSBasics::read(&numCurves, sizeof(unsigned int), 1, inFile);
-			//			Logger::log("numCurves: %d\n", numCurves);					
+			//			Logger::log("numCurves: %d\n", numCurves);
+            printf("numCurves: %d\n", numCurves);
 			for(int l=0; l < numCurves; l++) {
 				curve = new BezierCurve();
 				OSBasics::read(&curveType, sizeof(unsigned int), 1, inFile);
 				OSBasics::read(&numPoints, sizeof(unsigned int), 1, inFile);
-				for(int k=0; k < numPoints; k++) {					
+				for(int k=0; k < numPoints; k++) {
 					OSBasics::read(vec1, sizeof(float), 2, inFile);					
 					curve->addControlPoint2d(vec1[1], vec1[0]);
 					//					curve->addControlPoint(vec1[1]-10, vec1[0], 0, vec1[1], vec1[0], 0, vec1[1]+10, vec1[0], 0);
@@ -264,7 +324,7 @@ void Skeleton::addAnimation(const String& name, const String& fileName) {
 						break;
 				}
 			}
-			
+			newTrack->initTweens();
 			newAnimation->addBoneTrack(newTrack);
 		}
 		animations.push_back(newAnimation);
@@ -278,6 +338,7 @@ void Skeleton::bonesVisible(bool val) {
 }
 
 BoneTrack::BoneTrack(Bone *bone, Number length) {
+    weight = 0.0;
 	this->length = length;
 	targetBone = bone;
 	scaleX = NULL;
@@ -290,7 +351,6 @@ BoneTrack::BoneTrack(Bone *bone, Number length) {
 	LocX = NULL;			
 	LocY = NULL;
 	LocZ = NULL;
-	initialized = false;
 }
 
 BoneTrack::~BoneTrack() {
@@ -306,99 +366,85 @@ BoneTrack::~BoneTrack() {
 	delete LocZ;
 }
 
+void BoneTrack::Reset() {
+    for(int i=0; i < pathTweens.size(); i++) {
+        if(pathTweens[i]->isComplete()) {
+            CoreServices::getInstance()->getTweenManager()->addTween(pathTweens[i]);
+        }
+        pathTweens[i]->Reset();
+    }
+    if(quatTween->isComplete()) {
+        CoreServices::getInstance()->getTweenManager()->addTween(quatTween);
+    }
+    quatTween->Reset();
+}
 
 void BoneTrack::Stop() {
-	if(initialized) {
-		for(int i=0; i < pathTweens.size(); i++) {
-			pathTweens[i]->Pause(true);
-		}	
-		quatTween->Pause(true);		
-	}
+    for(int i=0; i < pathTweens.size(); i++) {
+        pathTweens[i]->Pause(true);
+    }
+    quatTween->Pause(true);
 }
 
-void BoneTrack::Play(bool once) {
-
-	if(!initialized ) {
-	// TODO: change it so that you can set the tweens to not manually restart so you can calculate the
-	// time per tween
-	
-		Number durTime = length; //(LocX->getControlPoint(LocX->getNumControlPoints()-1)->p2.x);//25.0f;
-					
-	BezierPathTween *testTween;		
+void BoneTrack::initTweens() {
+    
+    BezierPathTween *tween;
 	if(LocX) {
-		testTween = new BezierPathTween(&LocXVec, LocX, Tween::EASE_NONE, durTime, !once);
-		pathTweens.push_back(testTween);
+		tween = new BezierPathTween(&LocXVec, LocX, Tween::EASE_NONE, length, true);
+		pathTweens.push_back(tween);
 	}
-	if(LocY) {		
-		testTween = new BezierPathTween(&LocYVec, LocY, Tween::EASE_NONE, durTime, !once);
-		pathTweens.push_back(testTween);
+	if(LocY) {
+		tween = new BezierPathTween(&LocYVec, LocY, Tween::EASE_NONE, length, true);
+		pathTweens.push_back(tween);
 	}
-		
+    
 	if(LocZ) {
-		testTween = new BezierPathTween(&LocZVec, LocZ, Tween::EASE_NONE, durTime, !once);
-		pathTweens.push_back(testTween);
+		tween = new BezierPathTween(&LocZVec, LocZ, Tween::EASE_NONE, length, true);
+		pathTweens.push_back(tween);
 	}
-	testTween = new BezierPathTween(&ScaleXVec, scaleX, Tween::EASE_NONE, durTime, !once);
-	pathTweens.push_back(testTween);
-	testTween = new BezierPathTween(&ScaleYVec, scaleY, Tween::EASE_NONE, durTime, !once);
-	pathTweens.push_back(testTween);
-	testTween = new BezierPathTween(&ScaleZVec, scaleZ, Tween::EASE_NONE, durTime, !once);
-	pathTweens.push_back(testTween);
-		
-		
-	if(QuatW)
-		quatTween = new QuaternionTween(&boneQuat, QuatW, QuatX, QuatY, QuatZ, Tween::EASE_NONE, durTime, !once);
+	tween = new BezierPathTween(&ScaleXVec, scaleX, Tween::EASE_NONE, length, true);
+	pathTweens.push_back(tween);
+	tween = new BezierPathTween(&ScaleYVec, scaleY, Tween::EASE_NONE, length, true);
+	pathTweens.push_back(tween);
+	tween = new BezierPathTween(&ScaleZVec, scaleZ, Tween::EASE_NONE, length, true);
+	pathTweens.push_back(tween);
+    
+	if(QuatW) {
+        quatTween = new QuaternionTween(&boneQuat, QuatW, QuatX, QuatY, QuatZ, Tween::EASE_NONE, length, true);
+    }
+}
 
-	initialized = true;
-	} else {
-		for(int i=0; i < pathTweens.size(); i++) {
-			pathTweens[i]->Reset();
+void BoneTrack::Play(bool once) {
+    for(int i=0; i < pathTweens.size(); i++) {
+            pathTweens[i]->Reset();
 			pathTweens[i]->Pause(false);
-		}	
-		quatTween->Reset();
-		quatTween->Pause(false);
-	}
+            pathTweens[i]->repeat = !once;
+    }
+    if(quatTween) {
+        quatTween->Reset();
+        quatTween->Pause(false);
+        quatTween->repeat = !once;
+    }
 }
 
 
 void BoneTrack::Update() {
-
 	if(!targetBone)
 		return;
-
-	Matrix4 newMatrix;
-	newMatrix = boneQuat.createMatrix();
-
-	
-	Matrix4 scaleMatrix;
-	scaleMatrix.m[0][0] *= ScaleXVec.y;
-	scaleMatrix.m[1][1] *= ScaleYVec.y;
-	scaleMatrix.m[2][2] *= ScaleZVec.y;
-	
-
-	Matrix4 posMatrix;
-
-	if(LocX)
-		posMatrix.m[3][0] = LocXVec.y;		
-	else
-		posMatrix.m[3][0] = targetBone->getBaseMatrix()[3][0];
-
-	if(LocY)
-		posMatrix.m[3][1] = LocYVec.y;		
-	else
-		posMatrix.m[3][1] = targetBone->getBaseMatrix()[3][1];
-	
-	if(LocZ)
-		posMatrix.m[3][2] = LocZVec.y;		
-	else
-		posMatrix.m[3][2] = targetBone->getBaseMatrix()[3][2];
-	
-	
-	newMatrix = scaleMatrix*newMatrix*posMatrix;	
-	
-	targetBone->setBoneMatrix(newMatrix);
-	targetBone->setTransformByMatrixPure(newMatrix);		
-
+    
+    if(quatTween->isComplete()) {
+        return;
+    }
+    
+    Quaternion rotationQuat = targetBone->getRotationQuat();
+    rotationQuat = Quaternion::Slerp(weight, rotationQuat, boneQuat, true);
+    targetBone->setRotationByQuaternion(rotationQuat);
+
+    Vector3 trackPosition = Vector3(LocXVec.y, LocYVec.y, LocZVec.y);
+    targetBone->setPosition((trackPosition * weight) + (targetBone->getPosition() * (1.0 - weight)));
+
+    Vector3 trackScale = Vector3(ScaleXVec.y, ScaleYVec.y, ScaleZVec.y);
+    Vector3 newScale = ((trackScale - Vector3(1.0, 1.0, 1.0)) * weight) + Vector3(1.0, 1.0, 1.0);
 }
 
 void BoneTrack::setSpeed(Number speed) {
@@ -412,8 +458,23 @@ void BoneTrack::setSpeed(Number speed) {
 SkeletonAnimation::SkeletonAnimation(const String& name, Number duration) {
 	this->name = name;
 	this->duration = duration;
+    this->weight = 1.0;
+    this->playing = false;
+}
+
+bool SkeletonAnimation::isPlaying() const {
+    return playing;
+}
+
+void SkeletonAnimation::setWeight(Number newWeight) {
+    weight = newWeight;
 }
 
+Number SkeletonAnimation::getWeight() const {
+    return weight;
+}
+
+
 void SkeletonAnimation::setSpeed(Number speed) {
 	for(int i=0; i < boneTracks.size(); i++) {
 		boneTracks[i]->setSpeed(speed);
@@ -422,24 +483,35 @@ void SkeletonAnimation::setSpeed(Number speed) {
 
 void SkeletonAnimation::Update() {
 	for(int i=0; i < boneTracks.size(); i++) {
+        boneTracks[i]->weight = weight;
 		boneTracks[i]->Update();
 	}
 }
 
+void SkeletonAnimation::Reset() {
+	for(int i=0; i < boneTracks.size(); i++) {
+		boneTracks[i]->Reset();
+	}
+}
+
 void SkeletonAnimation::Stop() {
+    playing = false;
 	for(int i=0; i < boneTracks.size(); i++) {
 		boneTracks[i]->Stop();
 	}
 }
 
 void SkeletonAnimation::Play(bool once) {
+    playing = true;
 	for(int i=0; i < boneTracks.size(); i++) {
 		boneTracks[i]->Play(once);
 	}
 }
 
 SkeletonAnimation::~SkeletonAnimation() {
-
+    for(int i=0; i < boneTracks.size(); i++) {
+        delete boneTracks[i];
+    }
 }
 
 const String& SkeletonAnimation::getName() const {

+ 1 - 0
Core/Contents/Source/PolyTween.cpp

@@ -99,6 +99,7 @@ void Tween::updateTween(Number elapsed) {
 void Tween::Reset() {
 	tweenTime = 0;
 	complete = false;
+    *targetVal = startVal;
 }
 
 Number Tween::interpolateTween() {

+ 4 - 3
IDE/Contents/Source/PolycodeRemoteDebugger.cpp

@@ -101,11 +101,11 @@ void PolycodeRemoteDebugger::handleEvent(Event *event) {
 			case ServerEvent::EVENT_CLIENT_DISCONNECTED:		
 			{
 				for(int i=0;i<debuggerClients.size();i++) {
-					if(debuggerClients[i]->client == serverEvent->client) {		
+					if(debuggerClients[i]->client == serverEvent->client) {
 						DebuggerClient *client = debuggerClients[i];
 						debuggerClients.erase(debuggerClients.begin()+i);	
 						delete client;
-						PolycodeConsole::print("Remote debugger client disconnected...\n");						
+						PolycodeConsole::print("Remote debugger client disconnected...\n");
 					}
 				}
 			}	
@@ -115,7 +115,8 @@ void PolycodeRemoteDebugger::handleEvent(Event *event) {
 			{
 				DebuggerClient *newClient = new DebuggerClient();
 				newClient->client = serverEvent->client;
-				PolycodeConsole::print("Remote debugger client connected...\n");printf("CLIENT CONNECTED\n");		
+				PolycodeConsole::print("Remote debugger client connected...\n");
+                printf("CLIENT CONNECTED\n");
 				debuggerClients.push_back(newClient);				
 			}
 				break;

+ 80 - 626
Player/Contents/Platform/Darwin/MyDocument.xib

@@ -1,626 +1,80 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
-	<data>
-		<int key="IBDocument.SystemTarget">1070</int>
-		<string key="IBDocument.SystemVersion">11E53</string>
-		<string key="IBDocument.InterfaceBuilderVersion">2182</string>
-		<string key="IBDocument.AppKitVersion">1138.47</string>
-		<string key="IBDocument.HIToolboxVersion">569.00</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string key="NS.object.0">2182</string>
-		</object>
-		<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<string>NSView</string>
-			<string>NSCustomObject</string>
-			<string>NSScrollView</string>
-			<string>NSWindowTemplate</string>
-			<string>NSTextView</string>
-			<string>NSScroller</string>
-			<string>NSOpenGLView</string>
-		</object>
-		<object class="NSArray" key="IBDocument.PluginDependencies">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-		</object>
-		<object class="NSMutableDictionary" key="IBDocument.Metadata">
-			<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
-			<integer value="1" key="NS.object.0"/>
-		</object>
-		<object class="NSMutableArray" key="IBDocument.RootObjects" id="580458321">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<object class="NSCustomObject" id="512844837">
-				<string key="NSClassName">MyDocument</string>
-			</object>
-			<object class="NSCustomObject" id="613418571">
-				<string key="NSClassName">FirstResponder</string>
-			</object>
-			<object class="NSWindowTemplate" id="275939982">
-				<int key="NSWindowStyleMask">7</int>
-				<int key="NSWindowBacking">2</int>
-				<string key="NSWindowRect">{{133, 235}, {507, 413}}</string>
-				<int key="NSWTFlags">1081606144</int>
-				<string key="NSWindowTitle">Window</string>
-				<string key="NSWindowClass">NSWindow</string>
-				<string key="NSViewClass">View</string>
-				<nil key="NSUserInterfaceItemIdentifier"/>
-				<string key="NSWindowContentMinSize">{94, 86}</string>
-				<object class="NSView" key="NSWindowView" id="568628114">
-					<reference key="NSNextResponder"/>
-					<int key="NSvFlags">256</int>
-					<object class="NSMutableArray" key="NSSubviews">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSOpenGLView" id="692884500">
-							<reference key="NSNextResponder" ref="568628114"/>
-							<int key="NSvFlags">1298</int>
-							<object class="NSPSMatrix" key="NSDrawMatrix"/>
-							<string key="NSFrameSize">{507, 413}</string>
-							<reference key="NSSuperview" ref="568628114"/>
-							<reference key="NSWindow"/>
-							<reference key="NSNextKeyView"/>
-							<object class="NSOpenGLPixelFormat" key="NSPixelFormat">
-								<object class="NSMutableData" key="NSPixelAttributes">
-									<bytes key="NS.bytes">AAAAYAAAAAA</bytes>
-								</object>
-							</object>
-						</object>
-					</object>
-					<string key="NSFrameSize">{507, 413}</string>
-					<reference key="NSSuperview"/>
-					<reference key="NSWindow"/>
-					<reference key="NSNextKeyView" ref="692884500"/>
-				</object>
-				<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
-				<string key="NSMinSize">{94, 108}</string>
-				<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
-				<bool key="NSWindowIsRestorable">YES</bool>
-			</object>
-			<object class="NSCustomObject" id="796877042">
-				<string key="NSClassName">NSApplication</string>
-			</object>
-			<object class="NSWindowTemplate" id="244300403">
-				<int key="NSWindowStyleMask">8223</int>
-				<int key="NSWindowBacking">2</int>
-				<string key="NSWindowRect">{{685, 247}, {480, 270}}</string>
-				<int key="NSWTFlags">1685585920</int>
-				<string key="NSWindowTitle">Console</string>
-				<string key="NSWindowClass">NSPanel</string>
-				<nil key="NSViewClass"/>
-				<nil key="NSUserInterfaceItemIdentifier"/>
-				<object class="NSView" key="NSWindowView" id="400597707">
-					<nil key="NSNextResponder"/>
-					<int key="NSvFlags">256</int>
-					<object class="NSMutableArray" key="NSSubviews">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSScrollView" id="870149412">
-							<reference key="NSNextResponder" ref="400597707"/>
-							<int key="NSvFlags">274</int>
-							<object class="NSMutableArray" key="NSSubviews">
-								<bool key="EncodedWithXMLCoder">YES</bool>
-								<object class="NSClipView" id="43194815">
-									<reference key="NSNextResponder" ref="870149412"/>
-									<int key="NSvFlags">2304</int>
-									<object class="NSMutableArray" key="NSSubviews">
-										<bool key="EncodedWithXMLCoder">YES</bool>
-										<object class="NSTextView" id="864285269">
-											<reference key="NSNextResponder" ref="43194815"/>
-											<int key="NSvFlags">2322</int>
-											<string key="NSFrameSize">{440, 14}</string>
-											<reference key="NSSuperview" ref="43194815"/>
-											<object class="NSTextContainer" key="NSTextContainer" id="568862706">
-												<object class="NSLayoutManager" key="NSLayoutManager">
-													<object class="NSTextStorage" key="NSTextStorage">
-														<object class="NSMutableString" key="NSString">
-															<characters key="NS.bytes"/>
-														</object>
-														<nil key="NSDelegate"/>
-													</object>
-													<object class="NSMutableArray" key="NSTextContainers">
-														<bool key="EncodedWithXMLCoder">YES</bool>
-														<reference ref="568862706"/>
-													</object>
-													<int key="NSLMFlags">134</int>
-													<nil key="NSDelegate"/>
-												</object>
-												<reference key="NSTextView" ref="864285269"/>
-												<double key="NSWidth">440</double>
-												<int key="NSTCFlags">1</int>
-											</object>
-											<object class="NSTextViewSharedData" key="NSSharedData">
-												<int key="NSFlags">67121125</int>
-												<int key="NSTextCheckingTypes">0</int>
-												<nil key="NSMarkedAttributes"/>
-												<object class="NSColor" key="NSBackgroundColor">
-													<int key="NSColorSpace">1</int>
-													<bytes key="NSRGB">MCAwIDAgMAA</bytes>
-												</object>
-												<object class="NSDictionary" key="NSSelectedAttributes">
-													<bool key="EncodedWithXMLCoder">YES</bool>
-													<object class="NSArray" key="dict.sortedKeys">
-														<bool key="EncodedWithXMLCoder">YES</bool>
-														<string>NSBackgroundColor</string>
-														<string>NSColor</string>
-													</object>
-													<object class="NSArray" key="dict.values">
-														<bool key="EncodedWithXMLCoder">YES</bool>
-														<object class="NSColor">
-															<int key="NSColorSpace">6</int>
-															<string key="NSCatalogName">System</string>
-															<string key="NSColorName">selectedTextBackgroundColor</string>
-															<object class="NSColor" key="NSColor">
-																<int key="NSColorSpace">3</int>
-																<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
-															</object>
-														</object>
-														<object class="NSColor">
-															<int key="NSColorSpace">6</int>
-															<string key="NSCatalogName">System</string>
-															<string key="NSColorName">selectedTextColor</string>
-															<object class="NSColor" key="NSColor">
-																<int key="NSColorSpace">3</int>
-																<bytes key="NSWhite">MAA</bytes>
-															</object>
-														</object>
-													</object>
-												</object>
-												<object class="NSColor" key="NSInsertionColor">
-													<int key="NSColorSpace">1</int>
-													<bytes key="NSRGB">MSAxIDEAA</bytes>
-												</object>
-												<object class="NSDictionary" key="NSLinkAttributes">
-													<bool key="EncodedWithXMLCoder">YES</bool>
-													<object class="NSArray" key="dict.sortedKeys">
-														<bool key="EncodedWithXMLCoder">YES</bool>
-														<string>NSColor</string>
-														<string>NSCursor</string>
-														<string>NSUnderline</string>
-													</object>
-													<object class="NSArray" key="dict.values">
-														<bool key="EncodedWithXMLCoder">YES</bool>
-														<object class="NSColor">
-															<int key="NSColorSpace">1</int>
-															<bytes key="NSRGB">MCAwIDEAA</bytes>
-														</object>
-														<object class="NSCursor">
-															<string key="NSHotSpot">{8, -8}</string>
-															<int key="NSCursorType">13</int>
-														</object>
-														<integer value="1"/>
-													</object>
-												</object>
-												<nil key="NSDefaultParagraphStyle"/>
-												<nil key="NSTextFinder"/>
-												<int key="NSPreferredTextFinderStyle">1</int>
-											</object>
-											<int key="NSTVFlags">6</int>
-											<string key="NSMaxSize">{482, 10000000}</string>
-											<string key="NSMinize">{223, 8}</string>
-											<nil key="NSDelegate"/>
-										</object>
-									</object>
-									<string key="NSFrameSize">{440, 230}</string>
-									<reference key="NSSuperview" ref="870149412"/>
-									<reference key="NSNextKeyView" ref="864285269"/>
-									<reference key="NSDocView" ref="864285269"/>
-									<object class="NSColor" key="NSBGColor">
-										<int key="NSColorSpace">3</int>
-										<bytes key="NSWhite">MQA</bytes>
-									</object>
-									<object class="NSCursor" key="NSCursor">
-										<string key="NSHotSpot">{4, 5}</string>
-										<object class="NSImage" key="NSImage">
-											<int key="NSImageFlags">79691776</int>
-											<object class="NSArray" key="NSReps">
-												<bool key="EncodedWithXMLCoder">YES</bool>
-												<object class="NSArray">
-													<bool key="EncodedWithXMLCoder">YES</bool>
-													<integer value="5"/>
-													<object class="NSURL">
-														<nil key="NS.base"/>
-														<object class="NSMutableString" key="NS.relative">
-															<characters key="NS.bytes">file://localhost/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff</characters>
-														</object>
-													</object>
-												</object>
-											</object>
-											<object class="NSColor" key="NSColor">
-												<int key="NSColorSpace">3</int>
-												<bytes key="NSWhite">MCAwAA</bytes>
-											</object>
-										</object>
-									</object>
-									<int key="NScvFlags">2</int>
-								</object>
-								<object class="NSScroller" id="267236878">
-									<reference key="NSNextResponder" ref="870149412"/>
-									<int key="NSvFlags">-2147483392</int>
-									<string key="NSFrame">{{-100, -100}, {15, 249}}</string>
-									<reference key="NSSuperview" ref="870149412"/>
-									<reference key="NSTarget" ref="870149412"/>
-									<string key="NSAction">_doScroller:</string>
-									<double key="NSCurValue">1</double>
-									<double key="NSPercent">0.85256409645080566</double>
-								</object>
-								<object class="NSScroller" id="97652107">
-									<reference key="NSNextResponder" ref="870149412"/>
-									<int key="NSvFlags">-2147483392</int>
-									<string key="NSFrame">{{-100, -100}, {87, 18}}</string>
-									<reference key="NSSuperview" ref="870149412"/>
-									<int key="NSsFlags">1</int>
-									<reference key="NSTarget" ref="870149412"/>
-									<string key="NSAction">_doScroller:</string>
-									<double key="NSCurValue">1</double>
-									<double key="NSPercent">0.94565218687057495</double>
-								</object>
-							</object>
-							<string key="NSFrame">{{20, 20}, {440, 230}}</string>
-							<reference key="NSSuperview" ref="400597707"/>
-							<reference key="NSNextKeyView" ref="43194815"/>
-							<int key="NSsFlags">133648</int>
-							<reference key="NSVScroller" ref="267236878"/>
-							<reference key="NSHScroller" ref="97652107"/>
-							<reference key="NSContentView" ref="43194815"/>
-						</object>
-					</object>
-					<string key="NSFrame">{{7, 11}, {480, 270}}</string>
-				</object>
-				<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
-				<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
-				<bool key="NSWindowIsRestorable">YES</bool>
-			</object>
-		</object>
-		<object class="IBObjectContainer" key="IBDocument.Objects">
-			<object class="NSMutableArray" key="connectionRecords">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">substanceView</string>
-						<reference key="source" ref="512844837"/>
-						<reference key="destination" ref="692884500"/>
-					</object>
-					<int key="connectionID">100022</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">window</string>
-						<reference key="source" ref="512844837"/>
-						<reference key="destination" ref="275939982"/>
-					</object>
-					<int key="connectionID">100023</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">mainView</string>
-						<reference key="source" ref="512844837"/>
-						<reference key="destination" ref="692884500"/>
-					</object>
-					<int key="connectionID">100024</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">consoleWindow</string>
-						<reference key="source" ref="512844837"/>
-						<reference key="destination" ref="244300403"/>
-					</object>
-					<int key="connectionID">100027</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">consoleTextView</string>
-						<reference key="source" ref="512844837"/>
-						<reference key="destination" ref="864285269"/>
-					</object>
-					<int key="connectionID">100032</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">delegate</string>
-						<reference key="source" ref="275939982"/>
-						<reference key="destination" ref="512844837"/>
-					</object>
-					<int key="connectionID">17</int>
-				</object>
-			</object>
-			<object class="IBMutableOrderedSet" key="objectRecords">
-				<object class="NSArray" key="orderedObjects">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-					<object class="IBObjectRecord">
-						<int key="objectID">0</int>
-						<object class="NSArray" key="object" id="0">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-						</object>
-						<reference key="children" ref="580458321"/>
-						<nil key="parent"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-2</int>
-						<reference key="object" ref="512844837"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">File's Owner</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-1</int>
-						<reference key="object" ref="613418571"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">First Responder</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">5</int>
-						<reference key="object" ref="275939982"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="568628114"/>
-						</object>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">Window</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">6</int>
-						<reference key="object" ref="568628114"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="692884500"/>
-						</object>
-						<reference key="parent" ref="275939982"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-3</int>
-						<reference key="object" ref="796877042"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">Application</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">100021</int>
-						<reference key="object" ref="692884500"/>
-						<reference key="parent" ref="568628114"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">100025</int>
-						<reference key="object" ref="244300403"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="400597707"/>
-						</object>
-						<reference key="parent" ref="0"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">100026</int>
-						<reference key="object" ref="400597707"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="870149412"/>
-						</object>
-						<reference key="parent" ref="244300403"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">100028</int>
-						<reference key="object" ref="870149412"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="267236878"/>
-							<reference ref="97652107"/>
-							<reference ref="864285269"/>
-						</object>
-						<reference key="parent" ref="400597707"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">100029</int>
-						<reference key="object" ref="267236878"/>
-						<reference key="parent" ref="870149412"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">100030</int>
-						<reference key="object" ref="97652107"/>
-						<reference key="parent" ref="870149412"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">100031</int>
-						<reference key="object" ref="864285269"/>
-						<reference key="parent" ref="870149412"/>
-					</object>
-				</object>
-			</object>
-			<object class="NSMutableDictionary" key="flattenedProperties">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<object class="NSArray" key="dict.sortedKeys">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-					<string>-1.IBPluginDependency</string>
-					<string>-2.IBPluginDependency</string>
-					<string>-3.IBPluginDependency</string>
-					<string>100021.CustomClassName</string>
-					<string>100021.IBPluginDependency</string>
-					<string>100025.IBPluginDependency</string>
-					<string>100025.NSWindowTemplate.visibleAtLaunch</string>
-					<string>100026.IBPluginDependency</string>
-					<string>100028.IBPluginDependency</string>
-					<string>100029.IBPluginDependency</string>
-					<string>100030.IBPluginDependency</string>
-					<string>100031.IBPluginDependency</string>
-					<string>5.IBPluginDependency</string>
-					<string>5.IBWindowTemplateEditedContentRect</string>
-					<string>5.NSWindowTemplate.visibleAtLaunch</string>
-					<string>6.IBPluginDependency</string>
-				</object>
-				<object class="NSArray" key="dict.values">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>PolycodeView</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<boolean value="NO"/>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>{{553, 417}, {507, 413}}</string>
-					<boolean value="YES"/>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-				</object>
-			</object>
-			<object class="NSMutableDictionary" key="unlocalizedProperties">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<reference key="dict.sortedKeys" ref="0"/>
-				<reference key="dict.values" ref="0"/>
-			</object>
-			<nil key="activeLocalization"/>
-			<object class="NSMutableDictionary" key="localizations">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<reference key="dict.sortedKeys" ref="0"/>
-				<reference key="dict.values" ref="0"/>
-			</object>
-			<nil key="sourceID"/>
-			<int key="maxID">100032</int>
-		</object>
-		<object class="IBClassDescriber" key="IBDocument.Classes">
-			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<object class="IBPartialClassDescription">
-					<string key="className">MyDocument</string>
-					<string key="superclassName">NSDocument</string>
-					<object class="NSMutableDictionary" key="actions">
-						<string key="NS.key.0">showConsoleWindow:</string>
-						<string key="NS.object.0">id</string>
-					</object>
-					<object class="NSMutableDictionary" key="actionInfosByName">
-						<string key="NS.key.0">showConsoleWindow:</string>
-						<object class="IBActionInfo" key="NS.object.0">
-							<string key="name">showConsoleWindow:</string>
-							<string key="candidateClassName">id</string>
-						</object>
-					</object>
-					<object class="NSMutableDictionary" key="outlets">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>consoleTextView</string>
-							<string>consoleWindow</string>
-							<string>mainView</string>
-						</object>
-						<object class="NSArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>NSTextView</string>
-							<string>NSWindow</string>
-							<string>PolycodeView</string>
-						</object>
-					</object>
-					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>consoleTextView</string>
-							<string>consoleWindow</string>
-							<string>mainView</string>
-						</object>
-						<object class="NSArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<object class="IBToOneOutletInfo">
-								<string key="name">consoleTextView</string>
-								<string key="candidateClassName">NSTextView</string>
-							</object>
-							<object class="IBToOneOutletInfo">
-								<string key="name">consoleWindow</string>
-								<string key="candidateClassName">NSWindow</string>
-							</object>
-							<object class="IBToOneOutletInfo">
-								<string key="name">mainView</string>
-								<string key="candidateClassName">PolycodeView</string>
-							</object>
-						</object>
-					</object>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/MyDocument.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSDocument</string>
-					<object class="NSMutableDictionary" key="actions">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>printDocument:</string>
-							<string>revertDocumentToSaved:</string>
-							<string>runPageLayout:</string>
-							<string>saveDocument:</string>
-							<string>saveDocumentAs:</string>
-							<string>saveDocumentTo:</string>
-						</object>
-						<object class="NSArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-							<string>id</string>
-						</object>
-					</object>
-					<object class="NSMutableDictionary" key="actionInfosByName">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>printDocument:</string>
-							<string>revertDocumentToSaved:</string>
-							<string>runPageLayout:</string>
-							<string>saveDocument:</string>
-							<string>saveDocumentAs:</string>
-							<string>saveDocumentTo:</string>
-						</object>
-						<object class="NSArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<object class="IBActionInfo">
-								<string key="name">printDocument:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-							<object class="IBActionInfo">
-								<string key="name">revertDocumentToSaved:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-							<object class="IBActionInfo">
-								<string key="name">runPageLayout:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-							<object class="IBActionInfo">
-								<string key="name">saveDocument:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-							<object class="IBActionInfo">
-								<string key="name">saveDocumentAs:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-							<object class="IBActionInfo">
-								<string key="name">saveDocumentTo:</string>
-								<string key="candidateClassName">id</string>
-							</object>
-						</object>
-					</object>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/NSDocument.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">PolycodeView</string>
-					<string key="superclassName">NSOpenGLView</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/PolycodeView.h</string>
-					</object>
-				</object>
-			</object>
-		</object>
-		<int key="IBDocument.localizationMode">0</int>
-		<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
-			<integer value="3000" key="NS.object.0"/>
-		</object>
-		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-		<int key="IBDocument.defaultPropertyAccessControl">3</int>
-	</data>
-</archive>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A2093" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="MyDocument">
+            <connections>
+                <outlet property="consoleTextView" destination="100031" id="100032"/>
+                <outlet property="consoleWindow" destination="100025" id="100027"/>
+                <outlet property="mainView" destination="100021" id="100024"/>
+                <outlet property="substanceView" destination="100021" id="100022"/>
+                <outlet property="window" destination="5" id="100023"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" deferred="NO" oneShot="NO" releasedWhenClosed="NO" wantsToBeColor="NO" animationBehavior="default" id="5" userLabel="Window">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="133" y="235" width="507" height="413"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
+            <value key="minSize" type="size" width="94" height="86"/>
+            <view key="contentView" id="6">
+                <rect key="frame" x="0.0" y="0.0" width="507" height="413"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <openGLView useAuxiliaryDepthBufferStencil="NO" allowOffline="YES" wantsBestResolutionOpenGLSurface="YES" id="100021" customClass="PolycodeView">
+                        <rect key="frame" x="0.0" y="0.0" width="507" height="413"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                    </openGLView>
+                </subviews>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="17"/>
+            </connections>
+        </window>
+        <customObject id="-3" userLabel="Application"/>
+        <window title="Console" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="100025" customClass="NSPanel">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" utility="YES" HUD="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="685" y="247" width="480" height="270"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
+            <view key="contentView" id="100026">
+                <rect key="frame" x="7" y="11" width="480" height="270"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="100028">
+                        <rect key="frame" x="20" y="20" width="440" height="230"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="TeC-4x-Wzk">
+                            <rect key="frame" x="0.0" y="0.0" width="440" height="230"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                            <subviews>
+                                <textView editable="NO" importsGraphics="NO" findStyle="panel" continuousSpellChecking="YES" allowsUndo="YES" usesRuler="YES" usesFontPanel="YES" verticallyResizable="YES" allowsNonContiguousLayout="YES" spellingCorrection="YES" smartInsertDelete="YES" id="100031">
+                                    <rect key="frame" x="0.0" y="0.0" width="440" height="230"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                    <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/>
+                                    <size key="minSize" width="440" height="230"/>
+                                    <size key="maxSize" width="482" height="10000000"/>
+                                    <color key="insertionPointColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                    <size key="minSize" width="440" height="230"/>
+                                    <size key="maxSize" width="482" height="10000000"/>
+                                </textView>
+                            </subviews>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        </clipView>
+                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="YES" id="100030">
+                            <rect key="frame" x="-100" y="-100" width="87" height="18"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                        </scroller>
+                        <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="100029">
+                            <rect key="frame" x="-100" y="-100" width="15" height="249"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                        </scroller>
+                    </scrollView>
+                </subviews>
+            </view>
+        </window>
+    </objects>
+</document>

+ 78 - 533
Player/Contents/Platform/Darwin/Standalone/MainMenu.xib

@@ -1,533 +1,78 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
-	<data>
-		<int key="IBDocument.SystemTarget">1070</int>
-		<string key="IBDocument.SystemVersion">11E53</string>
-		<string key="IBDocument.InterfaceBuilderVersion">2182</string>
-		<string key="IBDocument.AppKitVersion">1138.47</string>
-		<string key="IBDocument.HIToolboxVersion">569.00</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string key="NS.object.0">2182</string>
-		</object>
-		<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<string>NSMenuItem</string>
-			<string>NSWindowTemplate</string>
-			<string>NSView</string>
-			<string>NSMenu</string>
-			<string>NSCustomObject</string>
-			<string>NSOpenGLView</string>
-		</object>
-		<object class="NSArray" key="IBDocument.PluginDependencies">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-		</object>
-		<object class="NSMutableDictionary" key="IBDocument.Metadata">
-			<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
-			<integer value="1" key="NS.object.0"/>
-		</object>
-		<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<object class="NSCustomObject" id="1021">
-				<string key="NSClassName">NSApplication</string>
-			</object>
-			<object class="NSCustomObject" id="1014">
-				<string key="NSClassName">FirstResponder</string>
-			</object>
-			<object class="NSCustomObject" id="1050">
-				<string key="NSClassName">NSApplication</string>
-			</object>
-			<object class="NSMenu" id="649796088">
-				<string key="NSTitle">AMainMenu</string>
-				<object class="NSMutableArray" key="NSMenuItems">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-					<object class="NSMenuItem" id="694149608">
-						<reference key="NSMenu" ref="649796088"/>
-						<string key="NSTitle">Polycode</string>
-						<string key="NSKeyEquiv"/>
-						<int key="NSKeyEquivModMask">1048576</int>
-						<int key="NSMnemonicLoc">2147483647</int>
-						<object class="NSCustomResource" key="NSOnImage" id="35465992">
-							<string key="NSClassName">NSImage</string>
-							<string key="NSResourceName">NSMenuCheckmark</string>
-						</object>
-						<object class="NSCustomResource" key="NSMixedImage" id="502551668">
-							<string key="NSClassName">NSImage</string>
-							<string key="NSResourceName">NSMenuMixedState</string>
-						</object>
-						<string key="NSAction">submenuAction:</string>
-						<object class="NSMenu" key="NSSubmenu" id="110575045">
-							<string key="NSTitle">Polycode</string>
-							<object class="NSMutableArray" key="NSMenuItems">
-								<bool key="EncodedWithXMLCoder">YES</bool>
-								<object class="NSMenuItem" id="1046388886">
-									<reference key="NSMenu" ref="110575045"/>
-									<string key="NSTitle">Services</string>
-									<string key="NSKeyEquiv"/>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="35465992"/>
-									<reference key="NSMixedImage" ref="502551668"/>
-									<string key="NSAction">submenuAction:</string>
-									<object class="NSMenu" key="NSSubmenu" id="752062318">
-										<string key="NSTitle">Services</string>
-										<object class="NSMutableArray" key="NSMenuItems">
-											<bool key="EncodedWithXMLCoder">YES</bool>
-										</object>
-										<string key="NSName">_NSServicesMenu</string>
-									</object>
-								</object>
-								<object class="NSMenuItem" id="646227648">
-									<reference key="NSMenu" ref="110575045"/>
-									<bool key="NSIsDisabled">YES</bool>
-									<bool key="NSIsSeparator">YES</bool>
-									<string key="NSTitle"/>
-									<string key="NSKeyEquiv"/>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="35465992"/>
-									<reference key="NSMixedImage" ref="502551668"/>
-								</object>
-								<object class="NSMenuItem" id="755159360">
-									<reference key="NSMenu" ref="110575045"/>
-									<string key="NSTitle">Hide StandalonePlayer</string>
-									<string key="NSKeyEquiv">h</string>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="35465992"/>
-									<reference key="NSMixedImage" ref="502551668"/>
-								</object>
-								<object class="NSMenuItem" id="342932134">
-									<reference key="NSMenu" ref="110575045"/>
-									<string key="NSTitle">Hide Others</string>
-									<string key="NSKeyEquiv">h</string>
-									<int key="NSKeyEquivModMask">1572864</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="35465992"/>
-									<reference key="NSMixedImage" ref="502551668"/>
-								</object>
-								<object class="NSMenuItem" id="908899353">
-									<reference key="NSMenu" ref="110575045"/>
-									<string key="NSTitle">Show All</string>
-									<string key="NSKeyEquiv"/>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="35465992"/>
-									<reference key="NSMixedImage" ref="502551668"/>
-								</object>
-								<object class="NSMenuItem" id="1056857174">
-									<reference key="NSMenu" ref="110575045"/>
-									<bool key="NSIsDisabled">YES</bool>
-									<bool key="NSIsSeparator">YES</bool>
-									<string key="NSTitle"/>
-									<string key="NSKeyEquiv"/>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="35465992"/>
-									<reference key="NSMixedImage" ref="502551668"/>
-								</object>
-								<object class="NSMenuItem" id="632727374">
-									<reference key="NSMenu" ref="110575045"/>
-									<string key="NSTitle">Quit StandalonePlayer</string>
-									<string key="NSKeyEquiv">q</string>
-									<int key="NSKeyEquivModMask">1048576</int>
-									<int key="NSMnemonicLoc">2147483647</int>
-									<reference key="NSOnImage" ref="35465992"/>
-									<reference key="NSMixedImage" ref="502551668"/>
-								</object>
-							</object>
-							<string key="NSName">_NSAppleMenu</string>
-						</object>
-					</object>
-				</object>
-				<string key="NSName">_NSMainMenu</string>
-			</object>
-			<object class="NSWindowTemplate" id="972006081">
-				<int key="NSWindowStyleMask">15</int>
-				<int key="NSWindowBacking">2</int>
-				<string key="NSWindowRect">{{335, 390}, {480, 360}}</string>
-				<int key="NSWTFlags">1685585920</int>
-				<string key="NSWindowTitle"/>
-				<string key="NSWindowClass">NSWindow</string>
-				<nil key="NSViewClass"/>
-				<nil key="NSUserInterfaceItemIdentifier"/>
-				<object class="NSView" key="NSWindowView" id="439893737">
-					<reference key="NSNextResponder"/>
-					<int key="NSvFlags">256</int>
-					<object class="NSMutableArray" key="NSSubviews">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSOpenGLView" id="634251339">
-							<reference key="NSNextResponder" ref="439893737"/>
-							<int key="NSvFlags">1298</int>
-							<object class="NSPSMatrix" key="NSDrawMatrix"/>
-							<string key="NSFrameSize">{480, 360}</string>
-							<reference key="NSSuperview" ref="439893737"/>
-							<reference key="NSWindow"/>
-							<object class="NSOpenGLPixelFormat" key="NSPixelFormat">
-								<object class="NSMutableData" key="NSPixelAttributes">
-									<bytes key="NS.bytes">AAAAYAAAAAA</bytes>
-								</object>
-							</object>
-						</object>
-					</object>
-					<string key="NSFrameSize">{480, 360}</string>
-					<reference key="NSSuperview"/>
-					<reference key="NSWindow"/>
-					<reference key="NSNextKeyView" ref="634251339"/>
-				</object>
-				<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
-				<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
-				<bool key="NSWindowIsRestorable">YES</bool>
-			</object>
-			<object class="NSCustomObject" id="976324537">
-				<string key="NSClassName">StandalonePlayerAppDelegate</string>
-			</object>
-			<object class="NSCustomObject" id="755631768">
-				<string key="NSClassName">NSFontManager</string>
-			</object>
-		</object>
-		<object class="IBObjectContainer" key="IBDocument.Objects">
-			<object class="NSMutableArray" key="connectionRecords">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<object class="IBConnectionRecord">
-					<object class="IBActionConnection" key="connection">
-						<string key="label">terminate:</string>
-						<reference key="source" ref="1050"/>
-						<reference key="destination" ref="632727374"/>
-					</object>
-					<int key="connectionID">449</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">delegate</string>
-						<reference key="source" ref="1021"/>
-						<reference key="destination" ref="976324537"/>
-					</object>
-					<int key="connectionID">495</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBActionConnection" key="connection">
-						<string key="label">hide:</string>
-						<reference key="source" ref="1014"/>
-						<reference key="destination" ref="755159360"/>
-					</object>
-					<int key="connectionID">367</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBActionConnection" key="connection">
-						<string key="label">hideOtherApplications:</string>
-						<reference key="source" ref="1014"/>
-						<reference key="destination" ref="342932134"/>
-					</object>
-					<int key="connectionID">368</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBActionConnection" key="connection">
-						<string key="label">unhideAllApplications:</string>
-						<reference key="source" ref="1014"/>
-						<reference key="destination" ref="908899353"/>
-					</object>
-					<int key="connectionID">370</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">window</string>
-						<reference key="source" ref="976324537"/>
-						<reference key="destination" ref="972006081"/>
-					</object>
-					<int key="connectionID">532</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBOutletConnection" key="connection">
-						<string key="label">mainView</string>
-						<reference key="source" ref="976324537"/>
-						<reference key="destination" ref="634251339"/>
-					</object>
-					<int key="connectionID">534</int>
-				</object>
-			</object>
-			<object class="IBMutableOrderedSet" key="objectRecords">
-				<object class="NSArray" key="orderedObjects">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-					<object class="IBObjectRecord">
-						<int key="objectID">0</int>
-						<object class="NSArray" key="object" id="0">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-						</object>
-						<reference key="children" ref="1048"/>
-						<nil key="parent"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-2</int>
-						<reference key="object" ref="1021"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">File's Owner</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-1</int>
-						<reference key="object" ref="1014"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">First Responder</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">-3</int>
-						<reference key="object" ref="1050"/>
-						<reference key="parent" ref="0"/>
-						<string key="objectName">Application</string>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">29</int>
-						<reference key="object" ref="649796088"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="694149608"/>
-						</object>
-						<reference key="parent" ref="0"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">371</int>
-						<reference key="object" ref="972006081"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="439893737"/>
-						</object>
-						<reference key="parent" ref="0"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">372</int>
-						<reference key="object" ref="439893737"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="634251339"/>
-						</object>
-						<reference key="parent" ref="972006081"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">420</int>
-						<reference key="object" ref="755631768"/>
-						<reference key="parent" ref="0"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">494</int>
-						<reference key="object" ref="976324537"/>
-						<reference key="parent" ref="0"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">533</int>
-						<reference key="object" ref="634251339"/>
-						<reference key="parent" ref="439893737"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">56</int>
-						<reference key="object" ref="694149608"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="110575045"/>
-						</object>
-						<reference key="parent" ref="649796088"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">57</int>
-						<reference key="object" ref="110575045"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="755159360"/>
-							<reference ref="908899353"/>
-							<reference ref="632727374"/>
-							<reference ref="646227648"/>
-							<reference ref="1046388886"/>
-							<reference ref="1056857174"/>
-							<reference ref="342932134"/>
-						</object>
-						<reference key="parent" ref="694149608"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">145</int>
-						<reference key="object" ref="342932134"/>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">149</int>
-						<reference key="object" ref="1056857174"/>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">131</int>
-						<reference key="object" ref="1046388886"/>
-						<object class="NSMutableArray" key="children">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<reference ref="752062318"/>
-						</object>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">130</int>
-						<reference key="object" ref="752062318"/>
-						<reference key="parent" ref="1046388886"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">144</int>
-						<reference key="object" ref="646227648"/>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">136</int>
-						<reference key="object" ref="632727374"/>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">150</int>
-						<reference key="object" ref="908899353"/>
-						<reference key="parent" ref="110575045"/>
-					</object>
-					<object class="IBObjectRecord">
-						<int key="objectID">134</int>
-						<reference key="object" ref="755159360"/>
-						<reference key="parent" ref="110575045"/>
-					</object>
-				</object>
-			</object>
-			<object class="NSMutableDictionary" key="flattenedProperties">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<object class="NSArray" key="dict.sortedKeys">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-					<string>-1.IBPluginDependency</string>
-					<string>-2.IBPluginDependency</string>
-					<string>-3.IBPluginDependency</string>
-					<string>130.IBPluginDependency</string>
-					<string>131.IBPluginDependency</string>
-					<string>134.IBPluginDependency</string>
-					<string>136.IBPluginDependency</string>
-					<string>144.IBPluginDependency</string>
-					<string>145.IBPluginDependency</string>
-					<string>149.IBPluginDependency</string>
-					<string>150.IBPluginDependency</string>
-					<string>29.IBPluginDependency</string>
-					<string>371.IBPluginDependency</string>
-					<string>371.IBWindowTemplateEditedContentRect</string>
-					<string>371.NSWindowTemplate.visibleAtLaunch</string>
-					<string>372.IBPluginDependency</string>
-					<string>420.IBPluginDependency</string>
-					<string>494.IBPluginDependency</string>
-					<string>533.CustomClassName</string>
-					<string>533.IBPluginDependency</string>
-					<string>56.IBPluginDependency</string>
-					<string>57.IBPluginDependency</string>
-				</object>
-				<object class="NSArray" key="dict.values">
-					<bool key="EncodedWithXMLCoder">YES</bool>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>{{380, 496}, {480, 360}}</string>
-					<integer value="1"/>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>PolycodeView</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-				</object>
-			</object>
-			<object class="NSMutableDictionary" key="unlocalizedProperties">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<reference key="dict.sortedKeys" ref="0"/>
-				<reference key="dict.values" ref="0"/>
-			</object>
-			<nil key="activeLocalization"/>
-			<object class="NSMutableDictionary" key="localizations">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<reference key="dict.sortedKeys" ref="0"/>
-				<reference key="dict.values" ref="0"/>
-			</object>
-			<nil key="sourceID"/>
-			<int key="maxID">534</int>
-		</object>
-		<object class="IBClassDescriber" key="IBDocument.Classes">
-			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<object class="IBPartialClassDescription">
-					<string key="className">PolycodeView</string>
-					<string key="superclassName">NSOpenGLView</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/PolycodeView.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">StandalonePlayerAppDelegate</string>
-					<string key="superclassName">NSObject</string>
-					<object class="NSMutableDictionary" key="outlets">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>mainView</string>
-							<string>window</string>
-						</object>
-						<object class="NSArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>PolycodeView</string>
-							<string>NSWindow</string>
-						</object>
-					</object>
-					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
-						<bool key="EncodedWithXMLCoder">YES</bool>
-						<object class="NSArray" key="dict.sortedKeys">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<string>mainView</string>
-							<string>window</string>
-						</object>
-						<object class="NSArray" key="dict.values">
-							<bool key="EncodedWithXMLCoder">YES</bool>
-							<object class="IBToOneOutletInfo">
-								<string key="name">mainView</string>
-								<string key="candidateClassName">PolycodeView</string>
-							</object>
-							<object class="IBToOneOutletInfo">
-								<string key="name">window</string>
-								<string key="candidateClassName">NSWindow</string>
-							</object>
-						</object>
-					</object>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">./Classes/StandalonePlayerAppDelegate.h</string>
-					</object>
-				</object>
-			</object>
-		</object>
-		<int key="IBDocument.localizationMode">0</int>
-		<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
-		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
-			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
-			<integer value="3000" key="NS.object.0"/>
-		</object>
-		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-		<int key="IBDocument.defaultPropertyAccessControl">3</int>
-		<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<object class="NSArray" key="dict.sortedKeys">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<string>NSMenuCheckmark</string>
-				<string>NSMenuMixedState</string>
-			</object>
-			<object class="NSArray" key="dict.values">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-				<string>{11, 11}</string>
-				<string>{10, 3}</string>
-			</object>
-		</object>
-	</data>
-</archive>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="4514" systemVersion="13A2093" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="4514"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+            <connections>
+                <outlet property="delegate" destination="494" id="495"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application"/>
+        <menu title="AMainMenu" systemMenu="main" id="29">
+            <items>
+                <menuItem title="Polycode" id="56">
+                    <menu key="submenu" title="Polycode" systemMenu="apple" id="57">
+                        <items>
+                            <menuItem title="Services" id="131">
+                                <menu key="submenu" title="Services" systemMenu="services" id="130"/>
+                            </menuItem>
+                            <menuItem isSeparatorItem="YES" id="144">
+                                <modifierMask key="keyEquivalentModifierMask" command="YES"/>
+                            </menuItem>
+                            <menuItem title="Hide StandalonePlayer" keyEquivalent="h" id="134">
+                                <connections>
+                                    <action selector="hide:" target="-1" id="367"/>
+                                </connections>
+                            </menuItem>
+                            <menuItem title="Hide Others" keyEquivalent="h" id="145">
+                                <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+                                <connections>
+                                    <action selector="hideOtherApplications:" target="-1" id="368"/>
+                                </connections>
+                            </menuItem>
+                            <menuItem title="Show All" id="150">
+                                <connections>
+                                    <action selector="unhideAllApplications:" target="-1" id="370"/>
+                                </connections>
+                            </menuItem>
+                            <menuItem isSeparatorItem="YES" id="149">
+                                <modifierMask key="keyEquivalentModifierMask" command="YES"/>
+                            </menuItem>
+                            <menuItem title="Quit StandalonePlayer" keyEquivalent="q" id="136">
+                                <connections>
+                                    <action selector="terminate:" target="-3" id="449"/>
+                                </connections>
+                            </menuItem>
+                        </items>
+                    </menu>
+                </menuItem>
+            </items>
+        </menu>
+        <window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="371">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="335" y="390" width="480" height="360"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
+            <view key="contentView" id="372">
+                <rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <openGLView useAuxiliaryDepthBufferStencil="NO" allowOffline="YES" wantsBestResolutionOpenGLSurface="YES" id="533" customClass="PolycodeView">
+                        <rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                    </openGLView>
+                </subviews>
+            </view>
+        </window>
+        <customObject id="494" customClass="StandalonePlayerAppDelegate">
+            <connections>
+                <outlet property="mainView" destination="533" id="534"/>
+                <outlet property="window" destination="371" id="532"/>
+            </connections>
+        </customObject>
+        <customObject id="420" customClass="NSFontManager"/>
+    </objects>
+</document>

+ 1 - 1
Player/Contents/Source/PolycodeCocoaPlayer.mm

@@ -31,5 +31,5 @@ CocoaPolycodePlayer::~CocoaPolycodePlayer() {
 }
 
 void CocoaPolycodePlayer::createCore() {
-	core =  new CocoaCore(view, xRes, yRes,  fullScreen, false, 0, aaLevel, frameRate);	
+	core =  new CocoaCore(view, xRes, yRes,  fullScreen, false, 0, aaLevel, frameRate, 0, true);
 }

+ 1 - 0
Tools/Contents/polyimport/Include/polyimport.h

@@ -202,6 +202,7 @@ class ISkeleton {
 			fwrite(&anim->length, sizeof(float), 1, file);
 	
 			fwrite(&anim->numTracks, sizeof(unsigned int), 1, file);
+            
 			for(int j=0; j < anim->numTracks; j++) {
 				ITrack *track = anim->tracks[j];
 				fwrite(&track->boneID, sizeof(unsigned int), 1, file);