Page 2 of 3

Posted: Wed Apr 11, 2007 5:44 pm
by CaseyB
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!

Posted: Thu Apr 12, 2007 3:49 am
by CaseyB
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!

Posted: Sat Apr 14, 2007 7:27 am
by CaseyB
I added a new type of variable, it's TwOgre::EnumVariable and works like a drop-down box.

Image

Posted: Tue Apr 17, 2007 10:21 am
by redmonk
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

Posted: Tue Sep 11, 2007 6:01 am
by ryandeboer
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.

Posted: Tue Sep 11, 2007 7:10 am
by CaseyB
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.

Posted: Mon Nov 12, 2007 9:53 am
by dominic1988
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]

Posted: Mon Nov 12, 2007 8:50 pm
by CaseyB
I am not sure right off the top of my head, but I'll look into it.

Posted: Fri Jan 11, 2008 12:49 am
by CaseyB
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.

Re:

Posted: Tue Aug 04, 2009 8:23 am
by wacom
Will there ever be an update to this?

Re: TwOgre - An AntTweakBar Integration

Posted: Wed Aug 05, 2009 10:18 am
by jacmoe
I don't think so. :)
Unless you're interested in trying my unofficial update.
It was fairly easy to do.

Re: TwOgre - An AntTweakBar Integration

Posted: Fri Jul 16, 2010 2:51 am
by jacmoe
I've resurrected this and upgraded it to use the latest AntTweakbar.
Added support for buttons and separators.
More to come. :wink:
ScreenShot0.png

Re: TwOgre - An AntTweakBar Integration

Posted: Fri Jul 16, 2010 4:02 pm
by jacmoe
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.

Re: TwOgre - An AntTweakBar Integration

Posted: Fri Jul 16, 2010 8:50 pm
by jacmoe
TwOgre now uses CMake for building and Mercurial to hold the source:
http://code.google.com/p/twogregui/

Re: TwOgre - An AntTweakBar Integration

Posted: Sun Jul 18, 2010 10:09 pm
by jacmoe
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)
        );

Re: TwOgre - An AntTweakBar Integration

Posted: Mon Aug 09, 2010 5:05 pm
by Beauty
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, ...

Re: TwOgre - An AntTweakBar Integration

Posted: Wed Aug 11, 2010 10:35 pm
by jacmoe

Re: TwOgre - An AntTweakBar Integration

Posted: Wed Aug 11, 2010 11:33 pm
by Beauty
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.

Re: TwOgre - An AntTweakBar Integration

Posted: Tue Jul 05, 2011 10:12 pm
by jacmoe
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/

Re: TwOgre - An AntTweakBar Integration

Posted: Wed Jul 06, 2011 12:36 am
by jacmoe
Linux problems fixed! :D
twOgre_Linux.jpg

Re: TwOgre - An AntTweakBar Integration

Posted: Tue Jul 26, 2011 5:54 am
by tdev
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();
}

Re: TwOgre - An AntTweakBar Integration

Posted: Sun Jul 31, 2011 11:39 pm
by duststorm
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.

Re: TwOgre - An AntTweakBar Integration

Posted: Fri Aug 05, 2011 2:37 pm
by jacmoe
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.

Re: TwOgre - An AntTweakBar Integration

Posted: Fri Aug 05, 2011 9:12 pm
by tdev
thanks for fixing :)

Re: TwOgre - An AntTweakBar Integration

Posted: Wed Aug 24, 2011 9:59 am
by tdev
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.