[Accepted] Ogre Material Editor
- Evak
- Orc Shaman
- Posts: 707
- Joined: Sun Apr 02, 2006 7:51 pm
- Location: Sacramento, CA
- x 1
- Contact:
- KungFooMasta
- OGRE Contributor
- Posts: 2087
- Joined: Thu Mar 03, 2005 7:11 am
- Location: WA, USA
- x 16
- Contact:
I just read the wiki, and maybe I missed this somewhere.. is this application in any sort of useable state?
Creator of QuickGUI!
- KungFooMasta
- OGRE Contributor
- Posts: 2087
- Joined: Thu Mar 03, 2005 7:11 am
- Location: WA, USA
- x 16
- Contact:
Maybe next summer we can have a project that focuses on finishing this one up. . . or at least gets it to a useable state. . .
Creator of QuickGUI!
- steven
- Gnoll
- Posts: 657
- Joined: Mon Feb 28, 2005 1:53 pm
- Location: Australia - Canberra (ex - Switzerland - Geneva)
- Contact:
@Hudson
I really like some parts of your editor.
Btw before people ask: No... I didn't compile the editor I am using it for inspiration for my own editor (in the OGE project).
I liked especially your EventContainer that I hope to reuse/modify for my needs. However I was obliged to make some modifications that you could find useful.
It seems you can't (at least I couldn't) unsubscribe directly a boost::function from the boost::signal. You need first to store the boost::signals::connection and use it to unsubscribe.
Here is the code - not in code format because I don't know how to
bold the useful modifications
Hope it will help you
---------- EventContainer.h -------------
typedef boost::signals::connection DelegateConnection;
typedef boost::function<void (EventArgs&)> EventHandler;
typedef boost::signal<void (EventArgs&)> Delegate;
typedef std::map<int, Delegate*> DelegateMap;
/** Container of events to which an instance can un/subscribe
* to receive firings.
*/
class EventContainer
{
public:
EventContainer();
virtual ~EventContainer();
DelegateConnection subscribe(int eventId, EventHandler handler);
void unsubscribe(int eventId, DelegateConnection connection);
protected:
void registerEvent(int eventId);
void fireEvent(int eventId, EventArgs& args);
private:
DelegateMap mDelegates;
};
--------------- EventContainer.cpp -------------
DelegateConnection EventContainer::subscribe(int eventId, EventHandler handler)
{
DelegateMap::iterator it = mDelegates.find(eventId);
return it->second->connect(handler);
}
//-----------------------------------------------------------------------------
void EventContainer::unsubscribe(int eventId, DelegateConnection connection)
{
DelegateMap::iterator it = mDelegates.find(eventId);
if (it != mDelegates.end())
{
it->second->disconnect(connection);
}
}
//-----------------------------------------------------------------------------
// TODO Should we throw an exception on duplicate event IDs?
void EventContainer::registerEvent(int eventId)
{
mDelegates[eventId] = new Delegate();
}
//-----------------------------------------------------------------------------
void EventContainer::fireEvent(int eventId, EventArgs& args)
{
DelegateMap::iterator it = mDelegates.find(eventId);
if (it != mDelegates.end())
(*(it->second))(args);
}
Of course the instances that subscribe will need to keep the connection to be able to unsubscribe.
I really like some parts of your editor.
Btw before people ask: No... I didn't compile the editor I am using it for inspiration for my own editor (in the OGE project).
I liked especially your EventContainer that I hope to reuse/modify for my needs. However I was obliged to make some modifications that you could find useful.
It seems you can't (at least I couldn't) unsubscribe directly a boost::function from the boost::signal. You need first to store the boost::signals::connection and use it to unsubscribe.
Here is the code - not in code format because I don't know how to
bold the useful modifications
Hope it will help you
---------- EventContainer.h -------------
typedef boost::signals::connection DelegateConnection;
typedef boost::function<void (EventArgs&)> EventHandler;
typedef boost::signal<void (EventArgs&)> Delegate;
typedef std::map<int, Delegate*> DelegateMap;
/** Container of events to which an instance can un/subscribe
* to receive firings.
*/
class EventContainer
{
public:
EventContainer();
virtual ~EventContainer();
DelegateConnection subscribe(int eventId, EventHandler handler);
void unsubscribe(int eventId, DelegateConnection connection);
protected:
void registerEvent(int eventId);
void fireEvent(int eventId, EventArgs& args);
private:
DelegateMap mDelegates;
};
--------------- EventContainer.cpp -------------
DelegateConnection EventContainer::subscribe(int eventId, EventHandler handler)
{
DelegateMap::iterator it = mDelegates.find(eventId);
return it->second->connect(handler);
}
//-----------------------------------------------------------------------------
void EventContainer::unsubscribe(int eventId, DelegateConnection connection)
{
DelegateMap::iterator it = mDelegates.find(eventId);
if (it != mDelegates.end())
{
it->second->disconnect(connection);
}
}
//-----------------------------------------------------------------------------
// TODO Should we throw an exception on duplicate event IDs?
void EventContainer::registerEvent(int eventId)
{
mDelegates[eventId] = new Delegate();
}
//-----------------------------------------------------------------------------
void EventContainer::fireEvent(int eventId, EventArgs& args)
{
DelegateMap::iterator it = mDelegates.find(eventId);
if (it != mDelegates.end())
(*(it->second))(args);
}
Of course the instances that subscribe will need to keep the connection to be able to unsubscribe.
-
- Gnoblar
- Posts: 6
- Joined: Wed Nov 28, 2007 4:38 pm
I have the Material Successfully compiled under Windows, and it runs without any Error Message, but this thing is unstable as hell, so there is no way to work with it, if i add a material and try to edit it, it crashes, also there is no Compile option or Preview Material option at all, that i have expected :/
Sad ... could be such a nice and handy tool
Sad ... could be such a nice and handy tool
- Wolfmanfx
- OGRE Team Member
- Posts: 1525
- Joined: Fri Feb 03, 2006 10:37 pm
- Location: Austria - Leoben
- x 99
- Contact:
- BRAINLESS
- Goblin
- Posts: 282
- Joined: Tue Jan 04, 2005 6:56 pm
- Location: The Netherlands
I've also got it compiled, the only thing I was able to do so far:
- open a .material file
- open a material editor (allows editing the script code) with color coding
- change a bunch of settings for materials (quite a lot really)
- probably save the material back to a file, although I'm not sure
I would argue it's not in a usable state as it is, but I must add, the design is pretty nice and definitely deserves more credit then a simple "it doesn't work". It's just not finished yet... I can only hope Hudson is ever going to continue it, but has hasn't been here for a while?
In the meantime I've copied the color coding editor for my own material editor (which will be announced when it's in a useful state). The reason I didn't continue this one is that I'm incorporating it into a different editor allowing much more then just material editing.
- open a .material file
- open a material editor (allows editing the script code) with color coding
- change a bunch of settings for materials (quite a lot really)
- probably save the material back to a file, although I'm not sure
I would argue it's not in a usable state as it is, but I must add, the design is pretty nice and definitely deserves more credit then a simple "it doesn't work". It's just not finished yet... I can only hope Hudson is ever going to continue it, but has hasn't been here for a while?
In the meantime I've copied the color coding editor for my own material editor (which will be announced when it's in a useful state). The reason I didn't continue this one is that I'm incorporating it into a different editor allowing much more then just material editing.
Proud member of the OpenFRAG Game Development community
- ©LitoByte!
- Gnoblar
- Posts: 22
- Joined: Thu Feb 01, 2007 7:13 pm
- x 1
- Contact:
Re: [Accepted] Ogre Material Editor
discontinued ?
I see last post is from 2007
Has the project went up ?
I ask this because after 5 days coding the same thing! wxwidget Ogre material editor and I came up pretty much to your results, and well, I felt dumb!?
Here a screenshot, its name would be...Simple Ogre Material Editor,
it will parse/accept .cg,.hlsl,.glsl, .frag, .vert, .material files and try to be nicer than that ! (only few days of coding...sorry)
I see last post is from 2007
Has the project went up ?
I ask this because after 5 days coding the same thing! wxwidget Ogre material editor and I came up pretty much to your results, and well, I felt dumb!?
Here a screenshot, its name would be...Simple Ogre Material Editor,
it will parse/accept .cg,.hlsl,.glsl, .frag, .vert, .material files and try to be nicer than that ! (only few days of coding...sorry)
Litobyte Softworks di Tommaso Lintrami
Sviluppo software e sistemi interattivi.
Software and Interaction Systems Development
http://www.litobyte.com
Sviluppo software e sistemi interattivi.
Software and Interaction Systems Development
http://www.litobyte.com
- Brocan
- Orc
- Posts: 441
- Joined: Tue Aug 01, 2006 1:43 am
- Location: Spain!!
- x 8
- ©LitoByte!
- Gnoblar
- Posts: 22
- Joined: Thu Feb 01, 2007 7:13 pm
- x 1
- Contact:
Re: [Accepted] Ogre Material Editor
thank you to point me in the right direction!
Litobyte Softworks di Tommaso Lintrami
Sviluppo software e sistemi interattivi.
Software and Interaction Systems Development
http://www.litobyte.com
Sviluppo software e sistemi interattivi.
Software and Interaction Systems Development
http://www.litobyte.com
-
- Kobold
- Posts: 25
- Joined: Tue Feb 19, 2008 1:55 pm
Re: [Accepted] Ogre Material Editor
Need CMakeLists.txt for compile in linux!