[0.8.3] Problems with ColourPicker in both CEGUI and CEED

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

[0.8.3] Problems with ColourPicker in both CEGUI and CEED

Postby Lemmi » Sat May 10, 2014 14:15

Hey. I'm running CEGUI 0.8.3 on Windows 7 64bit, using the DX11 renderer. And using the latest CEED (snapshot 11 win32 r2)

I'm trying to make a chat room layout, using the pre-made console layout from the tutorial, and it works reasonably well. I'm trying to extend it by adding a side menu for stuff like your chat name and what text color you want.

Here's the big problem, so first of all I couldn't get the ColourPicker (or ColourPickerControls) to work at all, it would crash CEED all the time, claiming the windowFactory didn't have a base window type for a "ColourPicker".

After lots of hacking around, I stumbled upon a solution of sorts; if I added <WindowSet filename="CEGUICommonDialogs" /> to the start of the VanillaCommonDialogs.scheme include header, I could add and use the ColourPicker in CEED.

But now CEGUI won't load the VanillaCommonDialogs scheme, throwing a CEGUI::GenericException when I call CEGUI::SchemeManager::getSingleton().createFromFile("VanillaCommonDialogs.scheme");

If I remove the <WindowSet filename="CEGUICommonDialogs" /> from the VanillaCommonDialogs.scheme, CEGUI starts up just fine, but I can no longer load my layout in CEED. It's a catch-22!

I don't quite know how to generate or find error log files for you to view. If there is anything more I can do to explain or clarify my predicament, I would be more than happy to do so.

Thank you in advance for any help.

Edit: I forgot to mention, I read the comment in VanillaCommonDialogs.scheme, and I'm also loading in VanillaSkin.Scheme in my engine.

This is how I load in my schemes:

Code: Select all

   
   CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
   CEGUI::SchemeManager::getSingleton().createFromFile("AlfiskoSkin.scheme");
   CEGUI::SchemeManager::getSingleton().createFromFile("VanillaSkin.scheme");
   CEGUI::SchemeManager::getSingleton().createFromFile("VanillaCommonDialogs.scheme");

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Ident » Sat May 10, 2014 14:53

Welcome to CEGUI!

First of all: great that we for the first time have someone wanting to use our ColourPicker. I made this quite relatively new widget a while ago and it was my first big addition to CEGUI. So far you are the first one in the forums that stated that he/she uses it.

The latest CEED snapshot unfortunately does not contain the library (CommonDialogues) that contains the ColourPicker. Therefore it will always crash when you try to use it and there is no way to fix this easily. You can also not just add it on your own from your own build, it will not work. To overcome this, CEED has to be completely compiled and linked from scratch on Windows, which for multiple reasons is a very tedious process that only Kulik understands currently and the last version is pretty old. I will work on CEED this summer during GSOC2014 and since I only develop on Windows 7 & Visual Studio I will (or should!) be able to make new releases from then on. Bottomline: Latest CEED doesn't support ColourPicker, fixing it yourself is impossible, next release might take a while (earliest in about 1 month once I understand how to build it). I do myself have an interest to have new CEED releases, so as soon as I can do these on my own, they will come out more often.

That said, if you want to use the ColourPicker in your own program, this should definitely work flawlessly and I have in the past used it many times in my own projects. Did you compile the SampleFramework and look at the ColourPicker demo? It shows how to use it and there you can see that it actually works and how it works. Do i understand correctly that your problem only exists in CEED as for now?

To work around this issue i suggest to add the ColourPicker via C++ code or to edit the XML with an editor (not CEED) and not load the specific layout file into CEED. You can just load this layout file to add it to your regular layout, during runtime.

I hope I could help.
CrazyEddie: "I don't like GUIs"

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sat May 10, 2014 17:18

Hello! So, this is good and bad news, but all in all I believe it to be good news, as I was afraid I would not be able to use ColourPicker at all.

First of all I want to thank you and the rest of the CEGUI team for making this fantastic library, it really is a pleasure to work with (when it works, that is :hammer: ).

About the problem, I actually am having problems on the C++ side too. I unfortunately my description was a bit of a jumbled mess. I have tried manually editing my XML file to make possible it use, without editing it through CEED. This didn't work either, as I'm getting an CEGUI::InvalidRequestException when trying to load the layout.

This is what my layout file looks like, if that's any help: http://pastebin.com/z5ccTmAq

Either way, I will try adding ColourPicker through C++ and see if that works any better. Again, thank you for your help!

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Ident » Sat May 10, 2014 18:14

Try without the autowindows. Also look at the Sample for the ColourPicker. Look at its Code. The file is small, I am sure it will help.
CrazyEddie: "I don't like GUIs"

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sat May 10, 2014 23:31

So! I tried creating a ColourPicker in C++, doing exactly as the CommonDialogs sample does, and CEGUI throws UnknownObjectExceptions when I call the creation function, which looks like this:

Code: Select all

CEGUI::ColourPicker* colourPicker = static_cast<CEGUI::ColourPicker*>(CEGUI::WindowManager::getSingleton().createWindow("Vanilla/ColourPicker"));


I've tried downloading both the stable 0.8.3 branch AND the very latest dev branch and have tried using their datafiles, but to no avail.

I have also tried replacing the CommonDialogs source code with newer versions of the same, but that doesn't solve it either.

I went back to CEED to try something again, and adding a ColourPicker throws this error, which is probably a more descriptive version of the exception that I get when trying to create the ColourPicker in C++:

Code: Select all

Exception message: CEGUI::UnknownObjectException in function 'class CEGUI::WindowFactory *__thiscall CEGUI::WindowFactoryManager::getFactory(const class CEGUI::String &) const' (E:\dev\Scamper\cegui_mk2\cegui\cegui\src\WindowFactoryManager.cpp:185) : A WindowFactory object, an alias, or mapping for 'CEGUI/ColourPicker' Window objects is not registered with the system.

Traceback:
========================
  File "e:\dev\Scamper\cegui_mk2\ceed11\ceed\editors\layout\undo.py", line 282, in redo

  File "e:\dev\Scamper\cegui_mk2\ceed11\ceed\editors\layout\widgethelpers.py", line 364, in reconstruct

  File "e:\dev\Scamper\cegui_mk2\ceed11\ceed\cegui\widgethelpers.py", line 739, in reconstruct

Versions:
========================
CEED revision: Can't execute "hg"
CEED version: snapshot11
HW architecture: ('32bit', 'WindowsPE')
HW type: AMD64
HW processor: Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
OS type: Windows
OS release: 7
OS version: 6.1.7601
OS Windows: ('7', '6.1.7601', 'SP1', u'Multiprocessor Free')
SW Python: 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
SW PySide: 1.1.2
SW Qt: 4.8.2
SW PyCEGUI: 0.8.9090
GL bindings version: 3.0.2
GL version: 4.4.0
GL vendor: NVIDIA Corporation
GL renderer: GeForce GTX 470/PCIe/SSE2
GL extensions:
   -snip-


Tomorrow I will try rebuilding my entire CEGUI library, because it's very possible that I did something wrong when building it. CMake confuses me.

I will be back with the results.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Ident » Sun May 11, 2014 11:49

Did you link to the CommonDialogues lib and did you load the scheme containing the colourpicker widget?
CrazyEddie: "I don't like GUIs"

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sun May 11, 2014 12:31

Yep! Didn't help! I did however rebuild and recompile everything, and the CommonDialogs sample does work, and I can use the ColourPicker fine in there, just not in my own application. So, it's just another case of user error. :)

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Ident » Sun May 11, 2014 12:42

I cant help you with your CEED problem at all, yet, I think only Kulik can. Regarding the other issue I need more information (log, exact error message, callstack,...)
CrazyEddie: "I don't like GUIs"

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sun May 11, 2014 15:09

Oh, damn. It appears my last message was swallowed.

This isn't a CEED problem, this is purely C++ and CEGUI related.

I've tried recompiling and replacing all libraries to no avail. I do exactly as the sample does, I link the right libraries and include all necessary headers, but nothing helps.

I did however figure out where the error log ends up, so I can paste that: http://pastebin.com/c2Wd1Lpm

I compare the logs between my own project and the sample browser project, and it appears that there are some parts that are missing from my version. Apparently the windowManager doesn't register the necessary types (ColourPicker and ColourPickerControls).

I suspect that my project doesn't properly include/parse this file: CEGUI\include\CommonDialogs\Module.h

Will be back after I test some things..... Again, thank you for your patience.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Ident » Sun May 11, 2014 17:19

Any chance you mixed up old versions of datafiles with new ones or are referencing wrong files in your project overall? Either way, once you found out what it was please post it here so others might find the solution as well.
CrazyEddie: "I don't like GUIs"

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sun May 11, 2014 17:20

I have managed to make some amount of progress by hacking around in the code a little.

So I dug up the code inside Module.cpp, and added some of the code to my own initialize functions. If I add these lines before calling creation:

Code: Select all

      CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPicker>();
      CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPickerControls>();


Then I can create a Colour Picker and interact with it and play with the colours. BUT! I get access violation error when pressing accept, because I try to change internal values. I get the error because nothing gets initialized. Everything is nulled or undefined.

I don't know enough about CEGUI internals to make an accurate guess.

What exactly happens when you call this line?:
CEGUI::ColourPicker* colourPicker = static_cast<CEGUI::ColourPicker*>(CEGUI::WindowManager::getSingleton().createWindow(colourPickerString));

Because I would expect it to call the constructor and initialize function of the window object in question (ColourPicker). But this isn't what happens? Can I hack it further to fix this? Or preferrably work around the entire hack and just make the normal version work.

Is there a "valid" way to make CEGUI read+load this file: include\CEGUI\CommonDialogs\Module.cpp ?

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sun May 11, 2014 17:31

Ident wrote:Any chance you mixed up old versions of datafiles with new ones or are referencing wrong files in your project overall? Either way, once you found out what it was please post it here so others might find the solution as well.


I don't think the datafiles are old. I downloaded the stable 0.8.3 datafiles and replaced everything yesterday. The only files that are "custom" are the alfisko skin look&feel and scheme files, that I modified slightly to add a custom button skin with different behaviour.

And in regards to referencing wrong files... I'm unsure. It's quite possible. I've noticed that I had an installed version of CEGUI in my program files, for some reason. And when I change the name of that folder my error logs stop appearing. There's definitely something wrong there. I'm really bad at using CMake. I want all the libraries/dlls to use local filepaths (for example: "..\..\include\CEGUI\") as opposed to global filepaths: (for example: "C:\Users\Documents\Desktop\etcetcetc").

So to summarize, yes, I do suspect that some of my libraries/DLLs are looking in the completely wrong places, yeah. Can you give me any pointers on how to solve this? I know this is pretty far from my original questions/problem, but any help is appreciated!

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Ident » Sun May 11, 2014 17:42

Check your visual studio project settings espeically the linker settings ( directory) and the c++ include file directory and see if they direct to the right folders. Also check if these folders contain the right files.

Other than that I have no suggestion other than to further compare what could be different.
CrazyEddie: "I don't like GUIs"

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sun May 11, 2014 18:02

Alright! I got it to work, sort of. This is what I had to do in C++ to make it work:

These headers:

Code: Select all

#include "CEGUI/CEGUI.h"
#include "CEGUI/String.h"
#include "CEGUI/WindowFactoryManager.h"
#include "CEGUI/CommonDialogs/ColourPicker/ColourPicker.h"
#include "CEGUI/CommonDialogs/ColourPicker/Controls.h"


This code to create a colour picker with controller:

Code: Select all

      CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPicker>();
      CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPickerControls>();

      CEGUI::ColourPicker* colourPicker = static_cast<CEGUI::ColourPicker*>(CEGUI::WindowManager::getSingleton().createWindow("Vanilla/ColourPicker"));
      colourPicker->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0.0f), CEGUI::UDim(0.0f, 0.0f)));
      colourPicker->setSize(CEGUI::USize(CEGUI::UDim(1.0f, 0.0f), CEGUI::UDim(0.9f, 0.0f)));
      colourPicker->setColour(CEGUI::Colour(1.0f, 1.0f, 1.0f));

      CEGUI::ColourPickerControls* colourPickerControls = static_cast<CEGUI::ColourPickerControls*>(CEGUI::WindowManager::getSingleton().createWindow("Vanilla/ColourPickerControls"));

      colourPickerControls->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0.0f), CEGUI::UDim(0.0f, 0.0f)));
      colourPickerControls->setSize(CEGUI::USize(CEGUI::UDim(1.0f, 0.0f), CEGUI::UDim(0.9f, 0.0f)));
      colourPickerControls->setVisible(true);
      colourPickerControls->setCallingColourPicker(colourPicker);

      window->addChild(colourPickerControls);


If you only want a colour picker without any controller (it'll just be an invisible box that you have to click to toggle up the colour picker) you can do this:


Code: Select all

      CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPicker>();
      CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPickerControls>();

      CEGUI::ColourPicker* colourPicker = static_cast<CEGUI::ColourPicker*>(CEGUI::WindowManager::getSingleton().createWindow("Vanilla/ColourPicker"));
      colourPicker->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0.0f), CEGUI::UDim(0.0f, 0.0f)));
      colourPicker->setSize(CEGUI::USize(CEGUI::UDim(1.0f, 0.0f), CEGUI::UDim(0.9f, 0.0f)));
      colourPicker->setColour(CEGUI::Colour(1.0f, 1.0f, 1.0f));

      window->addChild(colourPicker);



I haven't changed anything else, no includes, no other links, didn't change or move any libraries. I think I had a typo in the string I used to call createWindow; I tried to call createWindow("Vanilla/ColourPickerControls")); tried to cast it into a normal ColourPicker.

After I solved that, everything works reasonably well. You still have to be very careful about a lot of the internal variables, for example you NEED to call colourPicker->setColour(CEGUI::Colour(1.0f, 1.0f, 1.0f)), else the colour var won't be initialized...?

My only problem right now is that when I press Accept on the ColourPickerControls window, the window just disappears (stops rendering). It's like it goes inactive or becomes hidden? Do you know which flag affects this?

These are the functions that I've tried to remedy this:

Code: Select all

      colourPickerControls->setAlwaysOnTop(true);
      colourPickerControls->setMutedState(false);
      colourPickerControls->setDisabled(false);
      colourPickerControls->setUpdateMode(CEGUI::WindowUpdateMode::WUM_ALWAYS);


But none of them change anything.

Edit: So, to summarize, I think the problem was that CEGUI didn't automatically call:

Code: Select all

CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPicker>();
      CEGUI::WindowFactoryManager::addWindowType<CEGUI::ColourPickerControls>();


When you try to create a colour picker. I don't know if this is because I have corrupted/outdated/wrongly configured library files, but I hope this is of use to you! Thanks for making the colour picker; it's neat. When it works. :wink:

Lemmi
Just popping in
Just popping in
Posts: 12
Joined: Sat May 10, 2014 14:04

Re: [0.8.3] Problems with ColourPicker in both CEGUI and CEE

Postby Lemmi » Sun May 11, 2014 18:40

Decided to just go with the normal ColourPicker for now!

http://youtu.be/BHYfzD0ncXE


Return to “Help”

Who is online

Users browsing this forum: No registered users and 3 guests