TwOgre - An AntTweakBar Integration

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
Contact:

Postby CaseyB » Wed Apr 11, 2007 5:44 pm

Chimelion wrote:No problem having OIS in the example, but I don't think it should be coupled in API.
I thought about that a long time and I am still nt sure it'll stay that way. I just thought that since the majority of people are using OIS now that it would be ok, but you're right, I really should decouple it. I'll make my own intermediate types and use those. Thanks!
0 x
Image
Image

User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
Contact:

Postby CaseyB » Thu Apr 12, 2007 3:49 am

Ok, I have updated the project and the Example to use the version of OIS that comes in the Ogre Dependencies. Then I added some examples of using keyboard shortcuts and better comments to the example. I also beefed up the key parsing. I haven't de-integrated OIS yet, but I am thinking of a nice simple, yet effective set of classes for that.

Also, TwOgre has been added to the AntTweakBar Users Gallery!
0 x
Image

Image

User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
Contact:

Postby CaseyB » Sat Apr 14, 2007 7:27 am

I added a new type of variable, it's TwOgre::EnumVariable and works like a drop-down box.

Image
0 x
Image

Image

redmonk
Kobold
Posts: 39
Joined: Sat Sep 23, 2006 10:09 am

Postby redmonk » Tue Apr 17, 2007 10:21 am

Hi, I play a bit with your code and I made my one class. Thank a lot it really help me a lot to integrate TweakInterface into my application.

Here is how my class looks and a screenshot.

Code: Select all

   OgreTweakBase(Ogre::RenderWindow *renderWindow, Ogre::SceneManager *sceneManager);
   virtual ~OgreTweakBase(void);

   TwBar *creatBar(const Ogre::String &name);
   void distoryBar(TwBar *bar);

   bool addInt(TwBar *bar, Ogre::String name, int *value, bool readOnly=false);
   bool addFloat(TwBar *bar, Ogre::String name, float *value, bool readOnly=false);
   bool addColor(TwBar *bar, Ogre::String name, Ogre::ColourValue *color, bool readOnly=false);
   bool addBool(TwBar *bar, Ogre::String name, bool *value, bool readOnly=false);
   bool addButton(TwBar *bar, Ogre::String name, TwButtonCallback callback);
   bool addEnum(TwBar *bar, Ogre::String name, TwEnumVal *enumVector, int enumNr, int *enumSelected, bool readOnly=false);

   bool setVariableGroup(Ogre::String bar, Ogre::String name, Ogre::String group);
   bool BRAND NAME(Ogre::String bar, Ogre::String name, bool visible);
   bool setVariableLabel(Ogre::String bar, Ogre::String name, Ogre::String label);
   bool setVariableHelp(Ogre::String bar, Ogre::String name, Ogre::String help);
   bool setVariableKey(Ogre::String bar, Ogre::String name, Ogre::String key);

   bool setBarPostion(Ogre::String bar, int x, int y);
   bool setBarColor(Ogre::String bar, Ogre::ColourValue color);
   bool setBarLabel(Ogre::String bar, Ogre::String label);
   bool setBarHelp(Ogre::String bar, Ogre::String help);

   bool injectMouseMoved(const OIS::MouseEvent& mouseEvent);
   bool injectMouseMoved(const int x, const int y);
   bool injectMousePressed(const OIS::MouseEvent& mouseEvent, OIS::MouseButtonID id);
   bool injectMouseReleased(const OIS::MouseEvent& mouseEvent, OIS::MouseButtonID id);
   bool injectKeyPressed(const OIS::KeyEvent& keyEvent);
   bool injectKeyReleased(const OIS::KeyEvent& keyEvent);



Image
0 x

ryandeboer
Halfling
Posts: 84
Joined: Thu Oct 05, 2006 6:19 am
Location: Perth, Australia

Postby ryandeboer » Tue Sep 11, 2007 6:01 am

CaseyB wrote:String variable type is #1 on his TODO list, so that should be coming around soon!


Awesome. I thought AntTweakBar was perfect except that a "TextBox" is my favorite tweak control. I was thinking I had to use some more heavy weight GUI implementation just to get a "text manipluation" control. Now going straight for AntTweakBar is less risky if some day you can edit strings.
0 x

User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
Contact:

Postby CaseyB » Tue Sep 11, 2007 7:10 am

Actually there was just a new release of AntTweakBar on Sept. 3 that included String variables, I just need to find the opportunity to add that to TwOgre.
0 x
Image

Image

dominic1988
Kobold
Posts: 29
Joined: Wed Jun 27, 2007 5:24 pm

Postby dominic1988 » Mon Nov 12, 2007 9:53 am

ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]
ERROR(AntTweakBar) >> Bad value
ERROR(AntTweakBar) >> Bad value line 1 column 72 [Val ...]

any idea what does this mean? I encountered this problem when i wanted to update the values on runtime.

this is my code for updating the values

if(mKeyboard->isKeyDown(OIS::KC_E))
{
TwOgre::EnumValueList enumList1;
enumList1.push_back(TwOgre::EnumValue(9,"Nine"));
enumList1.push_back(TwOgre::EnumValue(8,"Eight"));
enumList1.push_back(TwOgre::EnumValue(7,"Seven"));
enumList1.push_back(TwOgre::EnumValue(6,"Six"));
enumVar->addEnumValues(enumList1);
}[/img]
0 x

User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
Contact:

Postby CaseyB » Mon Nov 12, 2007 8:50 pm

I am not sure right off the top of my head, but I'll look into it.
0 x
Image

Image

User avatar
CaseyB
OGRE Contributor
OGRE Contributor
Posts: 1335
Joined: Sun Nov 20, 2005 2:42 pm
Location: Columbus, Ohio
Contact:

Postby CaseyB » Fri Jan 11, 2008 12:49 am

Ok, it's been forever since I've done anything with this, but I've updated to the latest version of AntTweakBar and added support for StingVariables. The latest version has much more consistant results as far as the custom icons under Windows, which is nice and they added support for DX10, which I have left out for now since Ogre doesn't have a DX10 RenderSystem. I updated the Demo to show a StringVariable. The next thing I am going to work on is the callback system and buttons.

You can check this update out at:
svn checkout http://twogregui.googlecode.com/svn/trunk/ twogregui

SETUP
If you use the Ogre SDK then you should be all set. TwOgre should build right out of the box for you.

If you Build Ogre from Source then you'll need to add the OGRE_SRC environment variable to point to your ogrenew folder. Then TwOgre should build with no problems.
0 x
Image

Image

User avatar
wacom
Gnome
Posts: 350
Joined: Sun Feb 10, 2008 2:07 pm

Re:

Postby wacom » Tue Aug 04, 2009 8:23 am

Will there ever be an update to this?
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Wed Aug 05, 2009 10:18 am

I don't think so. :)
Unless you're interested in trying my unofficial update.
It was fairly easy to do.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Fri Jul 16, 2010 2:51 am

I've resurrected this and upgraded it to use the latest AntTweakbar.
Added support for buttons and separators.
More to come. :wink:

ScreenShot0.png
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Fri Jul 16, 2010 4:02 pm

I just committed the latest changes to TwOgre - as Casey was kind to allow me to take over the project. :wink:
Didn't fix the project, though - only added vc10 to it.
Will probably CMake it.
But the project lives. :)

JustBoo wrote:Oh wow, I've never seen this before. Is it really a property grid?

Is this it in the Wiki?
http://www.ogre3d.org/tikiwiki/TwOgre&h ... ntTweakBar

It's a GUI made especially for tweaking, hence it's name.
It's just perfect for programmers.
And, yes: I added a small wiki page for it.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Fri Jul 16, 2010 8:50 pm

TwOgre now uses CMake for building and Mercurial to hold the source:
http://code.google.com/p/twogregui/
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Sun Jul 18, 2010 10:09 pm

ScreenShot0.png


Now featuring:

Quaternions and Vector3's :)
And callbacks!
And buttons!!

And a much improved syntax, using named parameters:

Code: Select all

    mWin1 = mWinManager->createWindow(TwOgre::WindowParams("Window 1")
        .title("World Editor")
        .color(Ogre::ColourValue(1.0, 0.0, 0.0, 0.7))
        .position(mWindow->getWidth()-408, 0)
        .size(400, 380)
        .valuesWidth(240)
        );

    mBoxColor = mWin1->addColorVariable(TwOgre::ColorParams("Color1")
        .label("Cube Color")
        .value(Ogre::ColourValue(1.0, 0.0, 0.0, 0.7))
        .group("Color Values"));

    mSkyBox = mWin1->addBoolVariable(TwOgre::BoolParams("Bool2")
        .readOnly(false)
        .label("Show Skybox")
        .value(false)
        .shortcut("Alt+b")
        .callback(&DeviceListener::setSkyboxCallback, &DeviceListener::getSkyboxCallback, this)
        );
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby Beauty » Mon Aug 09, 2010 5:05 pm

I didn't know this GUI system.
It would be nice and useful when somebody adds it to the wiki.
At least to the GUI comparism page:
http://www.ogre3d.org/tikiwiki/tiki-ind ... on+of+GUIs
Good would be its own wiki page with feature list, discriptions, code snippets, ...
0 x
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Wed Aug 11, 2010 10:35 pm

0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby Beauty » Wed Aug 11, 2010 11:33 pm

Good note.
I recognized, that there was not only one page linking to TwOgre.
Now I added it to the page Comparison of GUIs.
But the data fields of the table are still empty and needs to get detail information.
Also it would be good to add more information to the TwOgre wiki page.
0 x
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Tue Jul 05, 2011 10:12 pm

TwOgreGui now builds and runs on Linux. :)

Was upgraded to using AntTweakBar 1.14.

Needs some Windows loving, and some fixing of the mouse position handling in Linux (it's off for some reason..) :wink:

Still at Google.Code at this address:
http://code.google.com/p/twogregui/
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Wed Jul 06, 2011 12:36 am

Linux problems fixed! :D

twOgre_Linux.jpg
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany

Re: TwOgre - An AntTweakBar Integration

Postby tdev » Tue Jul 26, 2011 5:54 am

very nice integration, thanks :)
i already provided a patch to fix some issue: http://code.google.com/p/twogregui/issues/detail?id=2

it seems to drop shadows. How to prevent?
screenshot07262011_064927875.jpg

screenshot07262011_064913251.jpg


also, i wrote this little wrapper macro:

Code: Select all

#define TW_WRAPPER(X, Y) \
   void set##Y(const X value); \
   X get##Y(); \
   static inline void TW_CALL HeightmapTerrain::TWset##Y(const void *value, void *clientData) { static_cast<HeightmapTerrain*>(clientData)->set##Y(*static_cast<const X *>(value)); } \
   static inline void TW_CALL HeightmapTerrain::TWget##Y(void *value, void *clientData) { *static_cast<X *>(value) = static_cast<HeightmapTerrain *>(clientData)->get##Y(); }


so you can define it like this in a class header:

Code: Select all

public:
   TW_WRAPPER(Ogre::Quaternion, CamOrient);
   TW_WRAPPER(Ogre::Vector3, CamPosition);


and its variable adding:

Code: Select all

   TwOgre::QuaternionVariable *camOrient = mWin->addQuaternionVariable(TwOgre::QuaternionParams("Orientation")
      .label("Orientation")
      .group("Camera")
      .help("The cameras orientation")
      .callback(&HeightmapTerrain::TWsetCamOrient, &HeightmapTerrain::TWgetCamOrient, this)
      );

   TwOgre::Position3DVariable *camPos = mWin->addPosition3DVariable(TwOgre::Position3DParams("Position")
      .label("Position")
      .group("Camera")
      .help("The cameras position")
      .callback(&HeightmapTerrain::TWsetCamPosition, &HeightmapTerrain::TWgetCamPosition, this)
      );


and the implementation of the getter/setter (in the cpp file):

Code: Select all

void HeightmapTerrain::setCamOrient(const Ogre::Quaternion v)
{
   mCamera->setOrientation(v);
}

Ogre::Quaternion HeightmapTerrain::getCamOrient()
{
   return mCamera->getOrientation();
}

void HeightmapTerrain::setCamPosition(const Ogre::Vector3 v)
{
   mCamera->setPosition(v);
}

Ogre::Vector3 HeightmapTerrain::getCamPosition()
{
   return mCamera->getPosition();
}
0 x

User avatar
duststorm
Minaton
Posts: 921
Joined: Sat Jul 31, 2010 6:29 pm
Location: Belgium
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby duststorm » Sun Jul 31, 2011 11:39 pm

Thank you for updating and bringing this GUI to my attention.
I didn't know it until now. This is really handy for quickly tuning some parameters visually.
0 x
Developer @ MakeHuman.org

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: TwOgre - An AntTweakBar Integration

Postby jacmoe » Fri Aug 05, 2011 2:37 pm

tdev wrote:it seems to drop shadows. How to prevent?

By letting me commit a fix for it. :)

It took me a while, but I finally figured out how to exclude shadows from the rendering of the GUI.
I added these lines to WindowManager::renderQueueStarted:

Code: Select all

      if (invocation == Ogre::RenderQueueInvocation::RENDER_QUEUE_INVOCATION_SHADOWS)
         return;

so that it becomes:

Code: Select all

   void WindowManager::renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& skipThisInvocation)
   {
      if (invocation == Ogre::RenderQueueInvocation::RENDER_QUEUE_INVOCATION_SHADOWS)
         return;
      // We're going to render ourselves in the Overlay Queue so we're always on top
      if(queueGroupId == Ogre::RENDER_QUEUE_OVERLAY)
      {
         TwDraw();
      }
   }


Nice trick if you are using direct rendering without Ogre objects.
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany

Re: TwOgre - An AntTweakBar Integration

Postby tdev » Fri Aug 05, 2011 9:12 pm

thanks for fixing :)
0 x

User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany

Re: TwOgre - An AntTweakBar Integration

Postby tdev » Wed Aug 24, 2011 9:59 am

duststorm wrote:On the other hand, some might consider menus dropping shadows a feature rather than a bug ;)

not that way as the shadows that were dropped were distorted and alike.
0 x


Return to “Showcase”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests