xboxscene.org forums

Pages: [1] 2

Author Topic: The Basics Of Controlling An Object :  (Read 494 times)

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
The Basics Of Controlling An Object :
« on: October 22, 2005, 01:48:00 PM »

Here's a general tip on understanding the way the dash works.
Default.xip / Default.xap is used to mainly call up other things and controll the main menu.
In the Default.xip you'll see a bunch of other xaps with the names of the menus they controll. Those xaps controll the functionality of those menus, and if an object moves where it moves to.

Take the clock menu for instance. The xap that controls it is the settings.xap inside default.xip. If you scroll down a bit in the settings.xap you'll come across
CODE
DEF theSetClockMenu Level
{
   name "theSetClockMenu"
    archive "Settings_Clock.xip"

the name theSetClockMenu is used to refer to the archive for various things; What text to update, what object to texture when, and where to move objects. Now the original placement of objects and the default text is defined in the archive. Which in this case is Settings_Clock.xip.

Inside the DEF theSetClockMenu Level you'll see an inline
CODE
       Inline
        {
            url "Settings_Clock/default.xap"
            function onLoad() { StartClockSettings(); }
        }


Most inlines are found in default/default. In this case, it's found inside the settings.xap. The url in the inline is telling the dash what file to use to find out all of the menus properties for placement and materials. As you can see it's telling it to use the default.xap inside the Settings_Clock.xip. It's important to have an inline tell the dash what xap to use because some xips contain more then just one xap, and if a xap is used to load up one menu it can't be used to load a second menu... (IE the memory manager and the hard drive menu) In this case a second default.xap would be needed and would be named anything ( usually default2.xap ) and the inline would call for the second xap.

Now if you wanted to edit the clock menu you'd know what xap was controlling all of the materials and placement. Also, the xap would also be using the xm files (meshes) from inside the xip the xap is loaded from. So to find what object you wanted to retexture, you could look inside the xip and see the list of meshes used for the menu. Some meshes, like the cellwall, aren't included in the xip to save space.
Check out each xm untill you find the mesh you want and search for it's name inside the inline's target. (Settings_Clock/default.xap) It should bring you to a DEF of the object. Some meshes are used more then once so search around to get a better sence of where the object you want is defined. Once you're at the right DEF it should look similar to

CODE
       DEF something Transform
        {
            children
            [
                Shape
                {
                    appearance Appearance
                    {
                        material MaxMaterial
                        {
                            name "somematerial"
                        }
                    }
                    geometry DEF something-object Mesh { url "something-object.xm" }
                }
            ]
            rotation
            scale
            scaleOrientation
            translation
        }


Now, You can edit the original properties of the object in question in the inline target (Settings_Clock/default.xap)or you can redefine it using the controll xap. (default/settings.xap)
If you wanted to use the controlling xap you'd refer to the object by
CODE
thename.children[0].children[0].theobject.children[0].the.attribute = "the update";
Which is
CODE
theSetClockMenu.children[0].children[0].something.children[0].appearance.material.name = "Typesdsafsda";

Or if you were to redefine a number of objects you can simplify the process by making the name into a variable.
CODE
   var c = theSetClockMenu.children[0].children[0];
c.something.children[0].appearance.material.name = "Typesdsafsda";
c.something1.children[0].appearance.material.name = "HilightedType";

the c before the object is defined above the function so it knows what c represents. As you can see if you replace the c with what it is defined as it would be the same as the set up above. This set up is usefull because it lets you easily see what objects you're redefining. If you wanted to update more then one attribute of an object this set up is usefull too. You would set it up like
CODE
var c = theSetClockMenu.children[0].children[0];
c.something.fade = 0; // speed of transition of something, higher numbers = slower
c.something.SetTranslation( -8.773, 4.723, 71.96 ); //makes something move
c.something.SetScale( 1, 1, 1);//defines the size of something

as you can see the .children[0] is missing from c.something.children[0]. If you look above you can see that in the DEF the apperance, material, material name, and mesh are defined inside children [ ] and the rotation, translation, scaleOrientation and scale aren't. That's the reason .children[0] isn't needed in this case wink.gif

Using the controll xap to update the object is usefull for having the object update on button presses. If you want the object to first appear a certain way or position it's better to define it in the inline xap.

I hope this helps out with what ever mods you guys do to the UIX dash. If you got a question on something, go ahead and ask.
A list of scriptable functions is located in the UIX readme.
beerchug.gif
Logged

midas

  • Archived User
  • Jr. Member
  • *
  • Posts: 87
The Basics Of Controlling An Object :
« Reply #1 on: October 27, 2005, 09:49:00 PM »

Yeah but you still didn't add anything about:

CODE
SetTranslation();
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
The Basics Of Controlling An Object :
« Reply #2 on: October 27, 2005, 11:17:00 PM »

QUOTE(Odb718 @ Oct 22 2005, 09:59 PM)
c.something.SetTranslation( -8.773, 4.723, 71.96 ); //makes something move

I dont get your question. SetTranslation means where the object is. If you change the values ( x, y, z ) the object/group will move to that spot on the screen. If you want it to return to it's original spot in another function you'd need to copy the values out of the xap.
Logged

midas

  • Archived User
  • Jr. Member
  • *
  • Posts: 87
The Basics Of Controlling An Object :
« Reply #3 on: October 28, 2005, 09:03:00 PM »

To what scale is the screen? Like is there an origen (0,0) and where does it go to (255,255)?

Sorry for the vague question. I don't knwo if you were planning on going this in depth with this thread . . . . but I would really appreciate it, especially with the new features of 2.0 and its .xip handling abilities. . . .
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
The Basics Of Controlling An Object :
« Reply #4 on: October 28, 2005, 11:18:00 PM »

The screen depends on what veiwpoint is used. But since the veiwpoints are usually different you can't assume that the same translation will be in the same spot on the screen in a different menu. Getting the meshes on the screen where you want them is pretty tough.

There's no limit to the translation that I've noticed. ( notice the -8.773 )
In this case the object I was moving was on the right side of the skin, but because of the veiwpoint (the camera spot) -8 is the right side of the screen and about -10 was the left side of the screen. All I can tell you is the first value moves the object left and right, the middle value moves it up and down, and the third value moves the object in and out of the background. How that's set up is defined by the viewpoints. If the camera was looking down, then z would move the object up and down, x would still be left and right, and y would raise and lower the object.

Take the Soundtrack controll menu for instance. It has the small 5 tab menu and when you select your function the big panel flips down into view. If the viewpoint doesn't change you wouldn't be able to see the menu. You would still be able to access the functions but you wouldn't be able to tell what song you were on.

Getting the right spots for your mesh depends on how you want it to look. If you wanted the mesh to be parallel to the screen you might have to rotate it, if you wanted it to have a lot of perspective you might want it far in the background but scaled up. There's no one set answer to the translation. The object could look exactly the same but the scale and position could be totally different. You just have to mess with it untill you get what you're looking for... which could be a lot of testing.
Logged

midas

  • Archived User
  • Jr. Member
  • *
  • Posts: 87
The Basics Of Controlling An Object :
« Reply #5 on: October 29, 2005, 06:28:00 AM »

Well, thats a lot fo help. Seriously. Is SetRotation() the same way as in (x,y,z,)? and SetScale()?
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
The Basics Of Controlling An Object :
« Reply #6 on: October 29, 2005, 11:51:00 AM »

QUOTE(Odb718 @ Oct 22 2005, 09:59 PM)
c.something.SetScale( 1, 1, 1);//defines the size of something

rotation can have 4 variables in it. The readme should have examples of all the scriptables.
Logged

midas

  • Archived User
  • Jr. Member
  • *
  • Posts: 87
The Basics Of Controlling An Object :
« Reply #7 on: November 01, 2005, 01:32:00 AM »

No example of SetRotation in the readme. From what I can gather its (X,Y,Z,Scale) but I am not sure on that one. . . .
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
The Basics Of Controlling An Object :
« Reply #8 on: December 12, 2005, 01:21:00 AM »

Sorry about the late reply but it's actually X,Y,Z,R.
The last number is actually for the rotation point.
Logged

midas

  • Archived User
  • Jr. Member
  • *
  • Posts: 87
The Basics Of Controlling An Object :
« Reply #9 on: December 18, 2005, 09:27:00 PM »

Rotation Point?

I thought it was X,Y,Z, Radians?

I think thats what acid said (it might have been him)
Logged

gasclown

  • Archived User
  • Hero Member
  • *
  • Posts: 686
The Basics Of Controlling An Object :
« Reply #10 on: December 19, 2005, 03:52:00 PM »

well from what ive always thought, ^^ its sorta the same. the last value is the angle of the object(s) in radians. ie. the first  3 values set up its position in the 3d space the fourth value sets up the "angle" its viewed from in this space.
Logged

JbOnE

  • Archived User
  • Full Member
  • *
  • Posts: 242
The Basics Of Controlling An Object :
« Reply #11 on: December 20, 2005, 03:44:00 PM »

rotations are set using quaternions. the first 3 are the x, y, z values of the axis vector, the last is the angle in radians of the rotation on that axis. google up the theory behind 3d vectors to clear up any questions on that part (IMG:style_emoticons/default/wink.gif)

This post has been edited by JbOnE: Dec 21 2005, 12:13 AM
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
The Basics Of Controlling An Object :
« Reply #12 on: December 20, 2005, 04:59:00 PM »

Oh I think that quick little lesson in quatum physics just did wink.gif
Logged

midas

  • Archived User
  • Jr. Member
  • *
  • Posts: 87
The Basics Of Controlling An Object :
« Reply #13 on: December 21, 2005, 10:02:00 PM »

QUOTE(JbOnE @ Dec 20 2005, 11:44 PM) View Post

rotations are set using quaternions. the first 3 are the x, y, z values of the axis vector, the last is the angle in radians of the rotation on that axis. google up the theory behind 3d vectors to clear up any questions on that part wink.gif


I was right! HAHA! Your's sounds more technical though.
Logged

Odb718

  • Archived User
  • Hero Member
  • *
  • Posts: 925
The Basics Of Controlling An Object :
« Reply #14 on: December 25, 2005, 01:43:00 AM »

uuuuuhhhh... I think you misread JbOnE's post.
QUOTE
the last is the angle in radians of the rotation on that axis.

Logged
Pages: [1] 2