Selaa lähdekoodia

Merge branch 'development' of https://github.com/GarageGames/Torque2D into sixtyfour

Mike Lilligreen 11 vuotta sitten
vanhempi
commit
cd3f7cfb53

+ 3 - 3
engine/source/2d/scene/Scene_ScriptBinding.h

@@ -1895,7 +1895,7 @@ ConsoleMethodWithDocs(Scene, getPrismaticJointMotor, ConsoleString, 3, 3, (joint
 
 //-----------------------------------------------------------------------------
 
-/*! Creates a prismatic joint.
+/*! Creates a pulley joint.
     @param sceneObjectA The first scene object to connect to the joint.  Use an empty string to indicate the Scene ground body.
     @param sceneObjectB The second scene object to connect to the joint.  Use an empty string to indicate the Scene ground body.
     @param localAnchorA The local point of the first scene object where the joint connects.
@@ -1983,9 +1983,9 @@ ConsoleMethodWithDocs(Scene, createPulleyJoint, ConsoleInt, 9, 16, (sceneObjectA
 
     b2Vec2 worldGroundAnchorA;
 
-    if ( worldGroundAnchorAElementCount == 1 && argc > 5 )
+    if ( worldGroundAnchorAElementCount == 1 && argc > (nextArg+1) )
     {
-        worldGroundAnchorA.Set( dAtof(argv[nextArg]), dAtof(argv[nextArg++]) );
+        worldGroundAnchorA.Set( dAtof(argv[nextArg]), dAtof(argv[nextArg+1]) );
         nextArg += 2;
     }
     else if ( worldGroundAnchorAElementCount == 2 )

+ 5 - 4
engine/source/platform/nativeDialogs/fileDialog.cc

@@ -31,10 +31,11 @@ IMPLEMENT_CONOBJECT(OpenFolderDialog);
 //-----------------------------------------------------------------------------
 FileDialogData::FileDialogData()
 {
-    mDefaultPath = StringTable->insert("");
-    mFilters = StringTable->insert("");
-    mFile = StringTable->insert("");
-    mTitle = StringTable->insert("");
+    mDefaultPath = StringTable->EmptyString;
+    mDefaultFile = StringTable->EmptyString;
+    mFilters = StringTable->EmptyString;
+    mFile = StringTable->EmptyString;
+    mTitle = StringTable->EmptyString;
     mStyle = 0;
 
 	mDefaultPath = StringTable->insert(Con::getVariable("Tools::FileDialogs::LastFilePath"));

+ 4 - 4
engine/source/platformWin32/nativeDialogs/win32FileDialog.cc

@@ -241,10 +241,10 @@ bool FileDialog::Execute()
    UTF16 pszFilter[1024];
    UTF16 pszFileTitle[MAX_PATH];
    // Convert parameters to UTF16*'s
-   convertUTF8toUTF16((UTF8 *)mData.mDefaultFile, pszFile, sizeof(pszFile));
-   convertUTF8toUTF16((UTF8 *)mData.mDefaultPath, pszInitialDir, sizeof(pszInitialDir));
-   convertUTF8toUTF16((UTF8 *)mData.mTitle, pszTitle, sizeof(pszTitle));
-   convertUTF8toUTF16((UTF8 *)mData.mFilters, pszFilter, sizeof(pszFilter) );
+   if(mData.mDefaultFile != StringTable->EmptyString)    convertUTF8toUTF16((UTF8 *)mData.mDefaultFile, pszFile, sizeof(pszFile));
+   if(mData.mDefaultPath != StringTable->EmptyString)    convertUTF8toUTF16((UTF8 *)mData.mDefaultPath, pszInitialDir, sizeof(pszInitialDir));
+   if(mData.mTitle != StringTable->EmptyString)			 convertUTF8toUTF16((UTF8 *)mData.mTitle, pszTitle, sizeof(pszTitle));
+   if(mData.mFilters != StringTable->EmptyString)		 convertUTF8toUTF16((UTF8 *)mData.mFilters, pszFilter, sizeof(pszFilter) );
 #else
    // Not Unicode, All char*'s!
    char pszFile[MAX_PATH];

+ 7 - 5
engine/source/sim/simObject.cc

@@ -1314,14 +1314,16 @@ void SimObject::unlinkNamespaces()
 
 void SimObject::setClassNamespace( const char *classNamespace )
 {
-   mClassName = StringTable->insert( classNamespace );
-   linkNamespaces();
+    mClassName = StringTable->insert( classNamespace );
+    if (mFlags.test(Added))
+        linkNamespaces();
 }
 
 void SimObject::setSuperClassNamespace( const char *superClassNamespace )
-{  
-   mSuperClassName = StringTable->insert( superClassNamespace );
-   linkNamespaces();
+{
+    mSuperClassName = StringTable->insert( superClassNamespace );
+    if (mFlags.test(Added))
+        linkNamespaces();
 }
 
 static S32 QSORT_CALLBACK compareFields(const void* a,const void* b)

+ 46 - 1
modules/AngleToy/1/main.cs

@@ -212,7 +212,52 @@ function AngleToy::createMathematicalObjects( %this )
 
 //-----------------------------------------------------------------------------
 
-function AngleToy::onTouchMoved(%this, %touchID, %worldPosition)
+function AngleToy::onTouchDown(%this, %touchID, %worldPosition)
+{
+    // Used to let the repointing target kno  
+    AngleToy.repointTarget = %worldPosition;
+
+    // Calculate the angle to the mouse.
+    %angle = mAtan( %worldPosition );
+    
+    // "Point" particles towards cursor
+    AngleToy.EmitterParameters.selectField( "EmissionAngle" );
+    AngleToy.EmitterParameters.addDataKey( 0, %angle );
+    AngleToy.EmitterParameters.deselectField();
+    
+    // Show Sin, Cos, Tan
+    %sin = mSin( %angle );
+    %cos = mCos( %angle );
+    %tan = mTan( %angle );
+
+    // Find the vector that's 20/21 units from the center in the direction of
+    // %worldPosition.  Here are a couple of ways to do that:
+    %worldPositionAtRadius20 = Vector2Direction( %angle, 20 );
+    %worldPositionAtRadius21 = Vector2Scale( Vector2Normalize( %worldPosition ), 21 );
+
+    // Draw the Sine    
+    %onYAxis = setWord( %worldPositionAtRadius20, 0, 0 ); // Set the X-component to 0
+    AngleToy.SinLineSegment.draw( %worldPositionAtRadius20, %onYAxis );
+    AngleToy.SinLabel.setPosition( Vector2Add( %onYAxis, "0 -1" ) );
+    AngleToy.SinLabel.setText( mFloatLength( %sin, 4 ) );
+    
+    // Draw the Cosine
+    %onXAxis = setWord( %worldPositionAtRadius20, 1, 0 ); // Set the Y-component to 0
+    AngleToy.CosLineSegment.draw( %worldPositionAtRadius20, %onXAxis );
+    AngleToy.CosLabel.setPosition( Vector2Add( %onXAxis, "-1 0" ) );
+    AngleToy.CosLabel.setAngle( 90 );
+    AngleToy.CosLabel.setText( mFloatLength( %cos, 4 ) );
+    
+    // Draw the Tangent
+    AngleToy.TanLineSegment.drawTangent( %worldPositionAtRadius20, %tan, %angle );
+    AngleToy.TanLabel.setPosition( %worldPositionAtRadius21 );
+    AngleToy.TanLabel.setAngle( %angle - 90 );
+    AngleToy.TanLabel.setText( mFloatLength( %tan, 4 ) );
+}
+
+//-----------------------------------------------------------------------------
+
+function AngleToy::onTouchDragged(%this, %touchID, %worldPosition)
 {
     // Used to let the repointing target kno  
     AngleToy.repointTarget = %worldPosition;

+ 1 - 1
modules/MoveToToy/1/main.cs

@@ -170,7 +170,7 @@ function MoveToToy::onTouchDown(%this, %touchID, %worldPosition)
 
 //-----------------------------------------------------------------------------
 
-function MoveToToy::onTouchMoved(%this, %touchID, %worldPosition)
+function MoveToToy::onTouchDragged(%this, %touchID, %worldPosition)
 {
     // Finish if not tracking the mouse.
     if ( !MoveToToy.trackMouse )

+ 53 - 1
modules/PickingToy/1/main.cs

@@ -156,7 +156,59 @@ function PickingToy::createRaycastOverlay( %this )
 
 //-----------------------------------------------------------------------------
 
-function PickingToy::onTouchMoved(%this, %touchID, %worldPosition)
+function PickingToy::onTouchDown(%this, %touchID, %worldPosition)
+{
+    // Update cursor position.
+    PickingToy.CursorObject.Position = %worldPosition;
+    
+    // Are we in ray mode?
+    if ( PickingToy.PickType $= "ray" )
+    {
+        // Yes, so update the ray geometry.
+        PickingToy.RaycastOverlay.PolyList = PickingToy.RayStart SPC %worldPosition;
+    }    
+    
+    // Handle picking mode appropriately.
+    switch$( PickingToy.PickType )
+    {
+        case "point":
+            %picked = SandboxScene.pickPoint( %worldPosition, "", "", PickingToy.PickMode );
+        
+        case "area":
+            %halfSize = PickingToy.PickAreaSize * 0.5;
+            %lower = (%worldPosition._0 - %halfSize) SPC(%worldPosition._1 - %halfSize);    
+            %upper = (%worldPosition._0 + %halfSize) SPC(%worldPosition._1 + %halfSize);    
+            %picked = SandboxScene.pickArea( %lower, %upper, "", "", PickingToy.PickMode );
+            
+        case "ray":
+            %picked = SandboxScene.pickRay( PickingToy.RayStart, %worldPosition, "", "", PickingToy.PickMode );
+            
+        case "circle":
+            %halfSize = PickingToy.PickAreaSize * 0.5;
+            %picked = SandboxScene.pickCircle( %worldPosition, %halfSize, "", "", PickingToy.PickMode );
+    }
+        
+    // Fetch pick count.
+    %pickCount = %picked.Count;
+    
+    // See if the target object is amongst those picked.
+    for( %i = 0; %i < %pickCount; %i++ )
+    {
+        // If this is the target object then make it opaque.
+        if ( getWord( %picked, %i ) == PickingToy.TargetObject )
+        {
+            PickingToy.TargetObject.setBlendAlpha( 1.0 );
+            return;
+        }
+    }
+    
+    // Target not picked so make it transparent.
+    PickingToy.TargetObject.setBlendAlpha( 0.25 );
+}
+
+//-----------------------------------------------------------------------------
+
+function PickingToy::onTouchDragged(%this, %touchID, %worldPosition)
 {
     // Update cursor position.
     PickingToy.CursorObject.Position = %worldPosition;

+ 1 - 1
modules/RotateToToy/1/main.cs

@@ -130,7 +130,7 @@ function RotateToToy::onTouchDown(%this, %touchID, %worldPosition)
 
 //-----------------------------------------------------------------------------
 
-function RotateToToy::onTouchMoved(%this, %touchID, %worldPosition)
+function RotateToToy::onTouchDragged(%this, %touchID, %worldPosition)
 {
     // Finish if not tracking the mouse.
     if ( !RotateToToy.trackMouse )

+ 7 - 7
modules/SpineToy/1/main.cs

@@ -93,7 +93,7 @@ function SpineToy::createGoblin(%this)
     %goblin.Skin = %this.skin;
         
     // Set the animation name
-    %goblin.setAnimation(%this.animation, true);
+    %goblin.setAnimationName(%this.animation, true);
     
     %goblin.RootBoneScale = 0.025;
     %goblin.setRootBoneOffset(0, -5);
@@ -121,7 +121,7 @@ function SpineToy::createSpineBoy(%this)
     };
 
     %object.Asset = "SpineToy:TestSkeleton";
-    %object.setAnimation("walk", true);
+    %object.setAnimationName("walk", true);
     %object.RootBoneScale = 0.025;
 
     %object.SceneLayer = 29;
@@ -140,7 +140,7 @@ function SpineBoy::onAnimationFinished(%this, %animationName)
 {
     if (%animationName $= "jump")
     {
-        %this.setAnimation("walk", true);
+        %this.setAnimationName("walk", true);
         %this.schedule(4000, "doJump");
     }
 }
@@ -149,7 +149,7 @@ function SpineBoy::onAnimationFinished(%this, %animationName)
 
 function SpineBoy::doJump(%this)
 {
-    %this.setAnimation("jump", false);
+    %this.setAnimationName("jump", false);
 }
 
 //-----------------------------------------------------------------------------
@@ -197,9 +197,9 @@ function SpineToy::createBackground(%this)
     %animatedMenu.Asset = "SpineToy:spinosaurus";
 
     // Set properties    
-    %animatedMenu.setAnimation("Animation", false);
+    %animatedMenu.setAnimationName("Animation", false);
     %duration = %animatedMenu.getAnimationDuration();
-    %animatedMenu.schedule(%duration*1000, "setAnimation", "loop", true);
+    %animatedMenu.schedule(%duration*1000, "setAnimationName", "loop", true);
     %animatedMenu.position = "0 0";
     %animatedMenu.SceneLayer = 30;
     %animatedMenu.RootBoneScale = 0.025;
@@ -220,7 +220,7 @@ function SpineToy::createPowerup(%this, %xPos, %yPos)
     %powerup.Asset = "SpineToy:powerup";
 
     // Set properties    
-    %powerup.setAnimation("Animation", true);    
+    %powerup.setAnimationName("Animation", true);    
     %powerup.position = %xPos SPC %yPos;
     %powerup.SceneLayer = 30;