Jump to content

viewcube integration problem


photo

Recommended Posts

I'm trying to add viewcube same way as in editor.

looks like few lines of "code editor\panels\editor_panel_viewcube.h"

copying all includes from "editor\editor.cpp" does not help

so I'm started from small - added: WidgetViewportLayout layout; and include required classes from error messages

using Unigine::Widgets;
#include <core/scripts/tuple.h>
#include <core/systems/widgets/widget.h>
#include <core/systems/widgets/widget_window.h>
#include <core/systems/widgets/widget_hbox.h>
#include <core/systems/widgets/widget_vbox.h>
#include <core/systems/widgets/widget_icon.h>
#include <core/systems/widgets/widget_sprite.h>
#include <core/systems/widgets/widget_groupbox.h>
//error Widget.setOrder()
#include <editor/widgets/editor_widget_viewport_layout.h>
 
and stuck with setOrder() that must be in Widget - but it's not there
error:
16:33:24 panel_box.widget.setOrder(order);
16:33:24 editor/widgets/editor_widget_viewport_layout.h:569: Interpreter::parse_user_class(): unknown "Widget" class member "setOrder"
 
in "class WidgetViewportLayoutPanel { ", "VBox panel_box;" but in initialization it "panel_box = new HBox();"
and method calls (VBox or Hbox).widget.
  void setOrder(int order) {
   panel_box.widget.setOrder(order);
  }
but class Widget { - has no method setOrder() in "core\systems\widgets\widget.h"
 
any clear thoughts?
Link to comment

Hi Mikhail,

Try to remove this line:

using Unigine::Widgets;

It seems declarations in core/systems/widgets/*.h headers are affected by this using.
Actually, this is not a good idea to add usings into the global namespace, something will go wrong for sure :)

Link to comment

ok, thanks

#include <core/scripts/tuple.h>
#include <core/systems/widgets/widget.h>
#include <core/systems/widgets/widget_vbox.h>
#include <core/systems/widgets/widget_window.h>
#include <core/systems/widgets/widget_hbox.h>
#include <core/systems/widgets/widget_icon.h>
#include <core/systems/widgets/widget_sprite.h>
#include <core/systems/widgets/widget_groupbox.h>
//error configSet
#include <editor/widgets/editor_widget_viewport_layout.h> 

  class someclass {
  	WidgetViewportLayout layout;
  	...
  }

got error

10:35:41 configSet(config_name + "_panel_" + name,format("%d %d %d",panels[name].getPositionX(),panels[name].getPositionY(),panels[name].getBoundAnchor()));
10:35:41 editor/widgets/editor_widget_viewport_layout.h:1014: Interpreter::parse(): unknown token "configSet"

hat can't find how to bypass; searched in "...Unigine SDK Browser\sdks\sim_windows_2.5\" has no definition of "configSet"

https://developer.unigine.com/en/search?query=configSet - 0 results

Link to comment

>If you will delete editor and engine configs (*.cfg files) - will it help in this case?

got no intuition on this, delete "bin\unigine_editor.cfg" and "data\project_name\unigine.cfg" ? - that not it

can't find what I'm missing

 

Link to comment

configGet() and configSet() are implemented in the C++ part of the editor.
I guess you don't need them for the purpose of integrating the view cube into your application.

So I suggest copying the contents of editor_widget_viewport_layout.h to your project and getting rid of configGet() and configSet() calls.
The second argument of configGet() has the meaning of default value when the corresponding setting is not found in the unigine_editor.cfg.
You can use it in place of the entire configGet() function call, for example.

Also, you can add your implementation of these functions.
It may be simple stubs at the first iteration if you not sure whether you want your config file or not, like:

int configGet(string name, int default_value) { return default_value; }
void configSet(string name, value) {}

 

Link to comment

viewcube requires almost all includes from editor, that have unreachable structures in compiled code - nailed ends of spagetti includes

so.... minimizing task: render viewcube at screen corner

load mesh to - Mesh mesh_viewcube;

then Canvas() holds polygons and .. mesh? Canvas.addPolygon() ; ?copy Mesh to Canvas?

and bind Canvas to editor.WidgetViewportLayout <- how this can be bypassed

Link to comment
×
×
  • Create New...