@Sagen Soren
Thank You for the helpful response, looking into the project options I am hugely influenced by https://github.com/opencax/GSoC/issues/27 . I needed a head start in working with the codebase, since I am working for the first time with a huge code base
Supposing you already master to build BRL-CAD from source code, I recommend to have a look at the QtGUI: https://sourceforge.net/p/brlcad/code/HEAD/tree/rt%5E3/trunk/src/QtGUI/
This was a project of second last GCi. It was programmed by high-school students in a few days and demonstrates how a Qt based GUI can be programmed on top of the C++ core interface. This program and the C++ interface are rather clear, and could be used as a starting point for own experiments.
To build this program you have to check out the rt^3 trunk branch side-by-side with the brlcad trunk.
While using BRL-CAD I faced a problem. After a design when I am typing mged>rt it should have produced a 3D lighted solid model of the wireframe model. But instead the dialogue box opened, is full white and no solid model is shown. Can anyone help me out here by explaining why is this happening?
@Sagen Soren screenshot? from the sound of it, you're simply in unfamiliar territory -- if it's white, you're probably looking at some geometry that is filling the window. If you run the "autoview" command, it will auto-resize based on what is drawn. If you run the "who" command, you'll see a list of what objects are drawn.
Ohk. I will check it out.
Guys reporting a bug.
While exploring the doxygen module i came across this bug.
Link to the bug.
http://brlcad.org/docs/doxygen-r64112/files.xhtml
@Chetan Shinde Thanks. Though I caution that the uploaded doxygen you're looking at there is r64112 ... and current sources are at r72738
Better to get an SVN checkout and browse the sources directly (and ask questions of course)
To the students who are interested in the New BRL-CAD GUI project: This task is about writing a new graphical user interface from scratch. As reference for what we think at, there is a link to high-school students CAD GUI designs created during Google Code-in the project idea description text.
We recommend to use Qt for the GUI elements. If you want to use something different, you need a very good reason to do so, and need to convince us.
There is already a Qt GUI for BRL-CAD, which was created during a number of Google Code-in tasks by high-school students: src/QtGUI in the rt^3 repository branch. I recommend to have a look at this and use it as a template for your own ideas because it solves three issues already: Integration into the CMake build, establishing the connections to the Qt and BRL-CAD (here: C++ coreInterface) libraries.
I want to open (or create) a .g file and display it inside this(qt app i created) application and do a very basic thing like making a sphere.
Any advises on how I should start? @Daniel Rossberg @Sean
how to add these features and build the basic scaffolding?
Again, I recommend to have a look at the src/QtGUI program in the rt^3 sub-repository. This demonstrates how to do a Qt based GUI inside BRL-CAD's CMake build system, and how to connect to a BRL-CAD library, here the C++ core interface.
With this C++ interface you can do very much everything you wrote about. For example, creating a new .g database can be done via opening a file-database with a yet not existing file or by saving an in-memory-database to a not yet existing file.
Where can I find coreinterface ?
/usr/bin/ld: cannot find -lcoreinterface
building QtGUI
@Daniel Rossberg
You have to check-out the rt^3 subrepository. See https://brlcad.org/wiki/SVN. The module is rt^3. Therefore the SVN URL is https://svn.code.sourceforge.net/p/brlcad/code/rt^3/trunk.
Check it out into a directory (usually named rt^3) parallel to your BRL-CAD brlcad checkout.
The coreinterface is included in the src directory there.
i have already put main brlcad and rt^3 in place preserving the directory hierarchy in a (root dir in my computer being 'code')
Main brlcad is working properly. Also installed it as mentioned in http://svn.code.sourceforge.net/p/brlcad/code/rt%5e3/trunk/README
In rt^3,
cmake works fine
Only when I try to build it gives
"[ 22%] Linking CXX executable ../../bin/QtGUI
/usr/bin/ld: cannot find -lcoreinterface
collect2: error: ld returned 1 exit status" @Daniel Rossberg
Linking with coreinterface is where it goes wrong
I managed to fix this, QTGUI is running
Within the GSoC period I'll be improving QtGui in rt^3 into a GUI that is fit to be shipped as a replacement to Archer and MGED, by adding the necessary features and giving it the look and feel of the Qt application I have already created (look screenshot in above the chat)
I am sending a proposal that will describe what I plan to do in detail, alone with the timeframe.
@Daniel Rossberg @Sean
@Sadeep Darshana You can copy the QtGUI directory to, for example, MyGUI and include this in your CMake build to do your experiments.
@Sadeep Darshana Please, read the comments for the methods in the header files. Object* BRLCAD::ConstDatabase::Get(const char* objectName)
returns a copy of the objects. void BRLCAD::Database::Get(const char* objectName, ObjectCallback& callback)
is intended for changing object properties.
How the process of creation, adjusting properties, and linking to a combination of an object can be implemented with the core interface can be seen here: https://brlcad.org/wiki/CoreInterface_Hallo_World_Example (on the example of a half space).
Forget the realtime rendering. Evaluating if this is even a theoretical option would be a GSoC project of its own. The closest one could do is to tessellate the model in triangle meshes and display them e.g. with OpenGL. The C++ interface provides the Facetize()
method to get a triangulated boundary representation of the objects.
In addition, you could expect that the ray-trace provided by the C++ interface is the fastest available in the actual hardware and software environment.
Also, I wouldn't think about having a command window in the new GUI. @Sean may however have another opinion here.
The BRL-CAD command lines are in fact TCL shells, and TCL is a Moloch. One could argue that BRL-CAD users are used to the command line interface, but what else could they use to create the models?
Some commercial CAD programs provide a command line interface as well, but these are intended for plugins and automating tasks.
There doesn't need to be a command window (or panel or similar dedicated space) with a new GUI. I think we will eventually want to expose libged commands in some form, but that can be trivially added later -- we have a couple applications already showing how easy that is. Definitely not something needed right away, but also not something we are going to abandon.
As a point of clarity, while BRL-CAD's command line is exposed via a Tcl shell in mged and archer, the two are not interlinked. You can issue commands without Tcl. One can easily expose BRL-CAD's commands via any interpreting environment like zsh, bash, python, lisp, perl, etc., or without a shell too, run a la carte (e.g., src/gools/gsh.cxx and src/gootls/gex.cpp).
Any command interface shouldn't be a substitute for good GUI design, which I think we all agree is the focus.
I'll send a revised proposal today.
Something I have always been wondering is at which point I should work on integrating the wireframe graphical display instead of the rendering and refresh image thing that is there now.
Do you think implementing that earlier in the project can help with development, or can it be easily embedded later towards the end of the project?
Also does the Qt Display Manager take care of Mouse inputs? Or does it have to be implemented?
Where can I find the code for Qt Display Manager?
@Sadeep Darshana Look forward to seeing the update. I'd certainly encourage you to take a look at integrating the wireframe, just to not get too distracted with it just yet. The code is in src/libdm/dm-qt.cpp, enabled when Qt is detected and enabled during CMake. So you'll want to install Qt and make sure CMake finds it (and says so in the summary), which might take some tweaking or minor code updates.
So it's a double-edged sword -- IF you can get a (libdm) display manager integrated and working in a Qt GUI, you will get nearly instant access to (shaded) triangle mesh and wireframe drawing like you see in mged automatically. That said, the libdm code is typically hard code to comprehend and debug, so there's a learning curve and you very well might make faster progress doing something new using Qt3D, but then having to replicate some of the code in libdm for getting geometry representations. As Daniel mentioned, coreInterface has an API for getting triangles, though, so you could simply start with that if you like the clean slate approach. Start with libdm if you want the more featureful but harder approach.
For your proposal, I suggest you keep it as simple as possible, low risk, modular, so things can be updated/replaced if desired later, but always functional. For exploring the code and getting familiarized, I think you should check out as much as possible. ;)
Be sure you're read http://brlcad.org/wiki/User:Vladbogolin/GSoC2013/Logs if you haven't, follow his links, read his code. Then there's the qtged branch which has a working hierarchical object view, which is pretty essential to graphical geometry navigation. No documentation, but you can reach the original developer @starseeker as needed if you have questions (he's also on IRC). Lastly, you could take a look at Ralith's 2008/2009 project -- http://brlcad.org/wiki/User:Ralith
Ralith's project was a failure, but he got exceptional mouse navigation controls working with binding profiles implemented that matched MGED, Blender, and a standard Orbital camera.
In the best of all worlds, you'd be able to glue that all together with the Window and hierarchy from starseeker's qtged, the context from Vladbogolin's dm-qt, and Ralith's mouse controls on top of coreInterface and libged. Simple. ;)
Enabled Qt in the main brlcad project and In MGED selected Modes->DisplayManager->Qt
The application crashed.
Daniel had told me this would lead the application to crash.
Also I do not understand the need there was for a Qt Display Manager, since by the time Qt DM was implemented the OpenGl DM was already there and OpenGl is cross platform. Why was a Qt DM implemented?
@Sadeep Darshana how you access OpenGL is not cross-platform. On Linux, one typically uses GLX, on Windows it's WGL, on MacOSX it can be GLX or Aqua, each being a different set of code to support them. With a Qt DM, there's just one code.
Once you have an OpenGL context, you're right in that the OpenGL calls themselves are the same API, same code, but that's not what is being referred to here -- it's the creation and management of the drawing surface being used by OpenGL that is the issue and for that, there's the low-level methods (e.g. GLX and WGL) and higher-level methods (e.g., Qt3D, GLUT, GLFW, etc).
we've had the low level interface since before OpenGL existed, but now we want to make it go through a higher-level interface: Qt3D ;)
I understand. I assume dm-glx & dm-wgl are the corresponding src files for those platforms.
I'm trying to find the best way to design the toolbox (only primitive create tools)
1) RHC & RPC look different from Cylinders and Cones for an end user. Should we put them under a new category? (in case we are going for a design that categorizes). What about Elliptical Paraboloid being under ellipsoids?
2) Is starting A,B,Cs being at 2:1:1 the the only thing special about ell1 from its generic type ell ?
3) Regarding our discussion about wireframes/rendering.
Without implementing this it is impossible to implement any editing. (other than property changes through properties panel). Even position/rotation changing will have to be delayed. Anyway in the proposal I'm putting the wireframe thing and everything that depends on it towards the later weeks.
4) In dm-qt.cpp
Is the only reason tk and tcl stuff are in the code, because the whole rectangular graphics window is placed inside a Tk window?
Thanks @Sadeep Darshana. Update received.
I understand. I assume dm-glx & dm-wgl are the corresponding src files for those platforms.
Yes.
I'm trying to find the best way to design the toolbox (only primitive create tools)
Lots of viable ways and feel free to argue otherwise, but I'd keep it familiar and simple -- Photoshop (PS) pretty much nailed this. Have a panel of tool icons. When one is selected, you're presented with its options (e.g, upper toolbar in PS).
That's pattern is inherently modular should we want to change appearance or behavior (e.g., swap out a tool for another or change displayed options) and maps to existing capabilities very directly.
1) RHC & RPC look different from Cylinders and Cones for an end user. Should we put them under a new category? (in case we are going for a design that categorizes). What about Elliptical Paraboloid being under ellipsoids?
Keep it simple. Wouldn't do anything to depict categories yet.
2) Is starting A,B,Cs being at 2:1:1 the the only thing special about ell1 from its generic type ell ?
No. If you know OOP, it's like a different C++ constructor for the same class. You'll see this directly if you run the "in" command. It will prompt you for each parameter based on the type of object you try to make.
ELL is created via three vectors. ELL1 is created with 1 vector and a radius. Both result in an ELL object, only difference is how they were created.
What this does raise is there possibly needing to be some way to have alternative ways for specifying parameters later, but it's out of scope for you.
3) Regarding our discussion about wireframes/rendering.
Without implementing this it is impossible to implement any editing. (other than property changes through properties panel). Even position/rotation changing will have to be delayed. Anyway in the proposal I'm putting the wireframe thing and everything that depends on it towards the later weeks.
Having some visual representation of geometry is kind of central to a GUI, more important than editing. It's okay to defer or have a placeholder for "draw geometry here" at first, but once there are buttons and panels that will quickly be a necessity to ensure everything is getting wired up correctly.
4) In dm-qt.cpp
Is the only reason tk and tcl stuff are in the code, because the whole rectangular graphics window is placed inside a Tk window?
Yes. As it is a Tk window, Tk also handles that window's key and mouse events. In a pure Qt context, that is all bypassed (qt_open_existing()).
By the way, check out http://brlcad.org/design/gui/ if you haven't already. Particularly like Alexander's work. Folder has lots of big-picture concepts and examples of other CAD GUIs (good and bad).
This is a particular bit of inspiration I just wanted to share, only remotely relevant as it's not a CAD GUI but is one of the most astounding examples of massive and localized option management: NoWindows.png
You can think of the upper tabs as being tools (e.g., "Text" is a tool). The options for that tab display when the tool's icon is selected. Of course, tabs as tools won't work if there are lots of tools, but the notion is the same even if you put all those tab icons into a panel on the left and leave the options at the top (which is essentially what PS does).
While I'm at it, might as well show one of the newest CAD GUIs that is taking off big in popularity, from OnShape: e9ab5754-af10-4c2d-8936-afc487499881.png
(deleted)
Proposal here refers to "BRL-CAD Proposal V3.pdf" I send via email seven hours ago.
When one is selected, you're presented with its options (e.g, upper toolbar in PS).
but the notion is the same even if you put all those tab icons into a panel on the left and leave the options at the top
Please find the the last paragraph and the sentence before the last paragraph in 3.2.1. I have described the problem with this approach.
To proceed with this approach we have to change the event on which object is created to some mouse event on the graphics window (from mouse click on the toolbar icon now).
Having some visual representation of geometry is kind of central to a GUI, more important than editing. It's okay to defer or have a placeholder for "draw geometry here" at first
We already have a way implemented in QtGui to display the geometry. It raytraces and updates the image.
pasted image
This is sufficient for viewing in development.
How do I get the Qt DM running on mged without the application being crashed. Daniel told some special settings have to be made for Tcl/tk. I'm trying to embed the qt dm before the coding period officially begins.
(I enabled qt, now the menu item shows, but crash when selected)
@Daniel Rossberg
@Sadeep Darshana
How do I get the Qt DM running on mged without the application being crashed. Daniel told some special settings have to be made for Tcl/tk. I'm trying to embed the qt dm before the coding period officially begins.
(I enabled qt, now the menu item shows, but crash when selected)
I debugged a bit and found the following in the Qt documentation of QApplication::QApplication(int &argc, char **argv)
:
Warning: The data referred to by argc and argv must stay valid for the entire lifetime of the QApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string.
And now you ;)
While it's good to know the Qt display manager (and with the above hint you should be able to fix its crash), the project aims for a new GUI with a new concept for user interactions (which means new for BRL-CAD). This is a step-wise process.
The first step would be to find a name for the new GUI. You need it as directory name for your source code, for example. You could throw some possible names here and ask for comments.
Hi @Sadeep Darshana I am co-mentor for "New UI for BRL-CAD" project. Congratulations for getting selected in GSoC 2019. I will try to help you with the design side of things and do my best to make this summer of code a successful experience for us.
hi @pooh (inder)
I sent you my proposal to your email. Please have a look at it.
hi pooh (inder)
I sent you my proposal to your email. Please have a look at it.
Hey @Sadeep Darshana thank you for that. I have read your proposal when you submitted. :) It's a good one. Anything specific you want my attention on?
hi pooh (inder)
I sent you my proposal to your email. Please have a look at it.
@Sadeep Darshana Please don't use private e-mails to discuss technical matters. You can send proposals here on Zulip or link to them on IRC or post them to the brlcad-devel mailing list for feedback. Private e-mail should only be for personal situations and even then you should CC more than one person (e.g., CC the program admin).
https://drive.google.com/open?id=1neRDaiPuKw48aq7KYNAAthhBSw3vMiR8zY1RibsmQdw
This is what I sent him through email.
Integrating the DM seems a little hard I'm trying to do the basic UI stuff first. There are several aspects I talked about when it comes to the design of UI toolbars etc. Also Sean did suggest ways. Which way do you think I should choose?
Integrating the DM seems a little hard I'm trying to do the basic UI stuff first. There are several aspects I talked about when it comes to the design of UI toolbars etc. Also Sean did suggest ways. Which way do you think I should choose?
We are looking for a new user interface with a look and feel similar to the "usual" CADs. For the start, you may want to take one or two designs from the GCi tasks or compile an own as template, and implement it in Qt. (Please share your choice with us before you start implementing it.)
When you implement it, you shouldn't try to trick Qt but use its widgets as intended. Furthermore, connecting the GUI with the BRL-CAD functions has no priority when you implement your first design.
@Sadeep Darshana Even if you don't use the current display managers for the new GUI (which is OK because we want a different "user experience" there), you should consider to provide a patch for the bug which prevents the current Qt display manager from working. See my considerations in https://brlcad.zulipchat.com/#narrow/stream/111975-Google-Summer.20of.20Code/topic/New.20BRL-CAD.20GUI/near/165052853. It's a Qt issue, which taught me something about Qt.
@Sadeep Darshana are you writing a daily diary? If yes, can you please give me the link here? If not, it's a good idea to set it up before the coding period begins.
Sadeep Darshana are you writing a daily diary? If yes, can you please give me the link here? If not, it's a good idea to set it up before the coding period begins.
It's not just a good idea -- it's required as per the checklist. Please speak up if you have questions about setting something up.
Followed the checklist
http://brlcad.org/wiki/User:Sadeep/DevLog-NewGui (It does not have new things that are not in my proposal, also only in an abstract manner for now)
My Milestones
1. Ability to create several primitives by GUI
2. Editing
3. Integrating Qt DM
(added Milestones section to the end of my proposal)
I read and accept this https://brlcad.org/wiki/Summer_of_Code/Acceptance
Read https://brlcad.org/wiki/Summer_of_Code/Expectations
Filled profile
https://sourceforge.net/u/sadeep/profile
http://brlcad.org/wiki/User:Sadeep (empty)
The university academic period and exams ending only on June 17. They are like 2 weeks behind the schedules due to the terrorist attacks. (I mentioned this might happen in the Proposal V3 I sent Daniel and Sean). I won't be able to fully commit towards the project till then.
But I hope I will be able to complete Milestone 1 by the 1st evaluation since I have already been familiar with the Rt^3 project and done some slight modifications to it.
@pooh (inder) @Sean @Daniel Rossberg
@Sadeep Darshana Thank you for giving this priority attention. Please e-mail me for #9. Have you talked with your mentor yet about an interaction schedule?
@pooh (inder) @Daniel Rossberg Can you make a suggetion about the interaction schedule?
My Milestones
1. Ability to create several primitives by GUI
2. Editing
3. Integrating Qt DM
Why do you want to integrate the Qt display manager in the new GUI? I consider this as unsuited.
Do you know what steps are necessary to create a GUI which can create and edit objects?
pooh (inder) Daniel Rossberg Can you make a suggetion about the interaction schedule?
Daily development log? Zulip?
pooh (inder) Daniel Rossberg Can you make a suggetion about the interaction schedule?
Thanks for that advice!
To be more transparent with deveopment progress I am thinking of creating gifs using GeForce Experience for screen recording bugs/UI interaction and then using Giphy to create some good gifs from the recorded video of important development progress. @pooh (inder)
@Daniel Rossberg
Do you know what steps are necessary to create a GUI which can create and edit objects?
I'm studying on this. I really appreciate if you could guide me on what I should look into.
Also which DM is used when building and running on Ubuntu64bit? dm-X.c?
Please ignore above question
Displaying geometry seems to be difficult. A lot of files are involved. Without all this complexity, is there a way to display a database in a Qt component in a simple way only for the development purposes. (it's better content being displayed when I'm working on other UI related things)
Do you know what steps are necessary to create a GUI which can create and edit objects?
I'm studying on this. I really appreciate if you could guide me on what I should look into.
OK, I'll first explain what it's not, exemplified by the sphere: Click the create sphere icon, then a dialog opens where you have to type in the name, center, and radius, and at the end you hit the OK button.
What's wrong with it? The GUI doesn't support the creation of the sphere! You could do the same with mged in nu mode, maybe even faster, because you don't have to change between keyboard and mouse. From a CAD GUI you can expect that it helps you to determine the center and radius (and the name) of the sphere. For example, to do the goblet in the tutorial you want to place the spheres for the stem by clicking on the places where you want to create them on the screen.
Which are the steps one had to do for this? I recommend to go this way:
* Creation of a mock-up GUI: It shows the intended layout and functioning, but it isn't connected to any BRL-CAD core function yet.
* Opening, saving, and closing of BRL-CAD database files: Here starts the connection with BRL-CAD functions. It should be easy to implement, but already arise a question about the GUIs behavior.
* Displaying the geometry on the screen: This is one of the big points, which requires some work. I'm thinking at a wire-frame depiction here. The lines could be taken from the tessellation or the plot functions (I would prefer the plot functions). Did you thought of having GUI elements for shifting, rotating, and zooming the view in the first step?
* Determining model points under screen points: When the user clicks on the screen, which point does they mean?
* Creation of a sphere: After having all the above done, this shouldn't be so complicated any more.
* A preview of the sphere during its creation: When the center of the new sphere is determined, a circle which moves with the mouse should help the user to imagine how this new sphere looks like with the other geometric elements.
Well, if you are able to create a sphere with your GUI at the end of GSoC you are good :wink:
Thank you @Daniel Rossberg . It was really helpful and clarifies a lot of doubts. This sort of reaffirms what I had in my mind.
But I'm sorry I misunderstood this.
Do you know what steps are necessary to create a GUI which can create and edit objects?
What I really wanted to know was how do I create the GUI that displays/edits the geometry? (THE GRAPHICS WINDOW)
I looked at the sources to understand the process but it is too hard to understand without help.
For instance when I look at the mged there are a lot of source files involved. The DMs, mged_dm.h, the tcl scripts, dm-generic.
1. Can someone give me a brief idea about in which source file each stage related to displaying geometry on screen happens?
I want to get the abstract idea of how DisplayManagers, OpenGl, Tk(in mged/archer), and anything else related connects and what they do.
For example, what decides the positions of the lines displayed for a sphere, what decides the pixels needed to color to draw it on screen. What draws it on screen. Which widget(ex:togl) in Tk has been used to display geometry
2. Any tips on how I might create this on Qt?
I want to get the geometry displayed on the screen as soon as possible since all the development depends on it.
@Sean @pooh (inder) @Daniel Rossberg
How to display the geometry in the GUI? That's easy: With a QWidget! It is as trivial as it sounds. Look for example at rt^3/src/QtGUI/GraphicView.
Well, for a real nice CAD display there is something more to do, but this is the start.
To understand the mged display managers you might want to have a look at the null dm (brlcad/src/libdm/dm_Null.*). There you see that the display managers are mainly different implementations of functions declared in the struct dm_internal. This are functions for draw management, setting the transformation matrix, setting the color, drawing simple objects, handling display lists, etc.. And all this can be done in a X Window, OpenGL window, QWidget, etc., depending on which implementation of these functions you use.
i had studied the displaying in QtGUI. It simply raytraces the objects everytime something happens and draws the output image in the QWidget. I believe this would be more troublesome
Not necessarily. You get out a wire-frame description from the model and draw it with the corresponding Qt functions.
so for this I can use the dm-qt?
so for this I can use the dm-qt?
NO. You don't work on mged or archer but on a new GUI with new behavior.
The point with the mged display manager is, that it should give you an idea what's expected from the graphic engine, and it can be implemented with Qt or OpenGL. But, we don't expect you to copy them to the new GUI.
why does dm-tk use Xlib?
I believe a DM based on OpenGL should be implemented for this since Display Managers based on window systems like Tk or Qt use a 2D plane and we have to do the converting. In opengl we are dealing with a 3D environment. This is better especially when we want to display objects other than wireframes. Also we are given the abstraction of a 3D environment with a lot of other features like lighting which are not available if we used a Window System based DM. People might not want to work with wireframes since almost all other CAD software display solid
In Qt the way to implement an open gl based DM would be to use QOpenGLWidget
and implement new-dm_drawVList
function to draw on that widget. I believe this function would be almost identical to osgl_drawVList
, ogl_drawVList
or wgl_drawVList
@Daniel Rossberg @pooh (inder) @Sean
I do understand how the Vlist is displayed on the screen by different DMs. Now I need to look at how Vlists are created from the db. I will start implementing hopefully tomorrow.
Why are display lists used?
why does dm-tk use Xlib?
Because the Tk graphics window uses X Window features? The would mean that it works with a X Window environment only, of course. You can find it out by either looking for xlib functions in the code or removing the xlib includes and see what is broken after that.
I do understand how the Vlist is displayed on the screen by different DMs. Now I need to look at how Vlists are created from the db.
ft_plot() (the rt_~_plot() functions)
I will start implementing hopefully tomorrow.
Do the mock-up first.
I believe a DM based on OpenGL should be implemented for this since Display Managers based on window systems like Tk or Qt use a 2D plane and we have to do the converting. In opengl we are dealing with a 3D environment. This is better especially when we want to display objects other than wireframes. Also we are given the abstraction of a 3D environment with a lot of other features like lighting which are not available if we used a Window System based DM. People might not want to work with wireframes since almost all other CAD software display solid
I'm afraid this isn't a good idea. My doubts start with your argumentation with the "2D Qt plane" and 3D OpenGL environment". Maybe, you don't know what OpenGL does: Computing 2D raster images from 3D input data. I.e., you need to consider the 2D display plane there as well. What complicates it is, that you need to translate the BRL-CAD transformation an display logic into the OpenGL "language". This isn't trivial, see the annotation bug thread here for example.
If you know what you are doing and how to say it in OpenGL, it can be a powerful tool to accelerate the graphic routines, because a good OpenGL driver will do many of the computations on the graphic card.
Lightning, textures, etc. are another issue, were OpenGL is hard to use, because BRL-CAD has its own renderer with algorithmic generated textures, for example. Shifting this to the graphic card is far behind the scope of your project (and would probably be hidden behind the BRL-CAD interface).
BTW, people are forced to work with wire-frames, because solids cover what's behind them ;)
Why are display lists used?
:grinning: Therefore: Whats's a display list? As already mentioned, graphic libraries as OpenGL take their power from shifting a large part of the computational work to the video card. To be effective, as much data as possible hast to be stored there too. You may have heard that there is memory for textures on a video card. The display lists are chunks of the model or CAD data, reduced to simple primitives (often triangles), which can be stored on the video card and used there without bothering the CPU or RAM again.
For example, for the wire-frame view, you could put all the edges from the BRL-CAD model in a huge edge list as a display list, and store it on the video card. If you zoom, shift, or rotate the view now, you have to readjust the camera only and send the command for redrawing the stored display list.
Hey @Sadeep Darshana were you able to create a daily dev log somewhere? If so, can you please share the link with me?
I am getting a gist of what you do daily from this zulip chat. It's just that all of that progress written in your own words at one place will help you and me see the trajectory and velocity of the progress. :)
I did update the progress. Exams and the academic timetables (were supposed to over now) have been delayed due to reasons I could not predict when I applied. So I'm struggling to allocate as much time on this as possible.
@Sean @pooh (inder)
Some questions I have been having
1) Doesn't rt in librt stand for RayTrace? If so why are things like db open and vlist generation in it?
2) 'RT^3' what does this mean?
3) Was coreinterfaces and qt gui developed as parts of the same project?
I did update the progress.
Thank you. The information looks good, but try to keep things separated with an entry per day going forward, not ranges of days.
Exams and the academic timetables (were supposed to over now) have been delayed due to reasons I could not predict when I applied. So I'm struggling to allocate as much time on this as possible.
This is understandable and will certainly be a challenge for you. In particular, it's going to be a time management challenge until at least the 17th. I suggest you dedicate some part of your day at a specific schedule, like 4 hours a day from 9am-11am and 6-8pm 4-5 days a week, something like that instead of trying to burst a whole 8-10 hours one day and then nothing for 2-3 days because you're now behind on studying for some exam. If we see you making even a little bit of activity and actual progress every day, that will be reassuring. Then you can adjust your schedule after exams are over to make up lost time (e.g., 50-60 hour weeks for 3-4 weeks). What doesn't work and gets you on a trouble radar is when you do nothing for 3+ days.
1) Doesn't rt in librt stand for RayTrace? If so why are things like db open and vlist generation in it?
It does stand for ray tracing. Originally the database functions were actually colocated in librt for low-level performance reasons. Those reasons, however, no longer matter so there are plans to extract them into their own "libg" for the .g file format. As for vlist generation, that's a property of objects, which also belongs to the individual primitives (they must describe themselves in a wireframe form, in textual form, in raytrace form, etc).
2) 'RT^3' what does this mean?
"RT cubed" is simply the name of the repository holding some "next generation" plans for BRL-CAD. In mathematical terms, to cube something is to multiply it three times (e.g., 8^3 = 8 * 8 * 8 = 512). Other than a fun mathematical project name, it has no other implication.
3) Was coreinterfaces and qt gui developed as parts of the same project?
They were developed independently but added to the rt^3 repository as that's where "next generation" code projects have been worked on.
What is the square root of 50 + 14?
or 100 - 51
it's broken apparently
I obtained vlist for 1 object in RT^3, QtGui project. using ft_plot
. Thanks @Daniel Rossberg for pointing in this direction. Was a big time saver. My next task is to display wireframe in a widget in qt.
1. For this I need to study, Camera angle and distance setup like things. And other things that might be needed for rendering a wireframe scene.
2. Also I noticed something called ft_adaptive_plot
. some optimizing thing?
3. Will I be needing displaylists or can I straight away display wireframes. (i.e. is it essential or just an optimize thing)
@Daniel Rossberg @Sean
Hey Sadeep Darshana were you able to create a daily dev log somewhere? If so, can you please share the link with me?
@pooh (inder) http://brlcad.org/wiki/User:Sadeep/DevLog-NewGui. I could not update the log today. because What is the square root of 1000 - 100?
Hey Sadeep Darshana were you able to create a daily dev log somewhere? If so, can you please share the link with me?
pooh (inder) http://brlcad.org/wiki/User:Sadeep/DevLog-NewGui. I could not update the log today. because What is the square root of 1000 - 100?
Perfect! Thank you so much. I would just advice to add at-least single line at end of every day, like even if you didn't work on anything just say it. I remember Sean saying me when I was a student "If you spent the day on the beach, just write it down" :D (something along that line, not exact words)
I cannot edit a brlcad wiki page (my dev log) from my laptop (ubuntu, chrome). It says "Error: Incorrect or missing CAPTCHA." every time.Apparently it works on mobile. Anyone experienced similar issues?
What is the square root of 50 + 14?
what do you think the answer is? the captcha is working for me
8?
(without the question mark)
yes, so if you entered that and it didn't work, something is awry but hard to say what's wrong. are you hitting enter or clicking the submit button?
if you log in, it will not prompt the captcha
Something wrong with the cookies it seems. Says
"There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Please resubmit the form."
when I try to login. Works well on incognito mode
perhaps try deleting your cookies for brlcad.org?
Didn't work. Maybe user of the default header sent from the normal mode suspected as trying to hijack or something. Doesn't matter I can manage this with incognito mode or mobile. Thanks
are you unable to log in?
I can log in using firefox
I'm implementing displaying in both QOpenGLWidget using OpenGLand QWidget using window system functions. Working on the OpenGL method today.
Added QOpenGLWidget to the application. Line creation is not straight-forward like in the earlier OpenGL version which existing OpenGL DMs use in BRL-CAD. glBegin and glEnd are have been deprecated and now removed. Studying the new method. This means I will have to change the code in the existing vlist_draw functions to suit the modern opengl.
They're not removed yet, and won't likely be removed anytime soon. So using new or old OpenGL should be fine. That said, the new is better but I wouldn't get too caught up on the details other than what you need to do basic drawing of lines and/or triangles.
I'm using the legacy component QGLWidget (old opengl) instead of QOpenGLWidget (no glbegin) since it will be easy to use and the main emphasis of the project should be on creating the application UI than the display manager
bu_lists are very weird. Iterations crashes when iterating inside GraphicsViewOpenGL::paintGL() method. Iterating works well when used inside methods I define. Does it have anything that could cause unexpected behaviors? like threading?
IGNORE THE ABOVE MESSAGE !! IGNORE THE ABOVE MESSAGE !! IGNORE THE ABOVE MESSAGE !!!
Got this solved after struggling few hours.
C++ erases local variable objects even though you set a global level reference to point that after declaring it. Java is a lot easier.
pasted image
Wireframe displaying implemented to display wireframes of 2 objects that I name in the scene.
intern.idb_meth->ft_plot(&vhead,&intern,m_wdbp->wdb_initial_tree_state.ts_ttol,m_wdbp->wdb_initial_tree_state.ts_tol,&info);
This crashes when plotting combinations. Any idea why?
Is it not possible to plot combinations using ft_plot?
pasted image
Would be great if we can have these. Will this be hard to implement with openGL?
intern.idb_meth->ft_plot(&vhead,&intern,m_wdbp->wdb_initial_tree_state.ts_ttol,m_wdbp->wdb_initial_tree_state.ts_tol,&info);
This crashes when plotting combinations. Any idea why?
Do you know how to use a debugger like GDB or LLDB? If not, this would be a great time to do a little tutorial from the web. Basically, you can run as you usually do, and then when it crashes, you can examine the backtrace which will tell you exactly where it crashed and what the variables were at that time.
If you did in this instance, you'd find that intern.idb_meth->ft_plot is NULL, and that's why it crashes.
So you're right in that you can't currently plot combinations using ft_plot() -- they don't know how to plot themselves (see src/librt/primitives/table.cpp for all callbacks and src/librt/comb for implementation). The logic for how combinations get plotted is quite complex for mged and archer, and it's not yet been cleaned up enough to be a simple callback. You can see the combination plotting logic in src/libged/draw.c
@Sadeep Darshana That all said, I'm a little surprised you're working with low-level OpenGL code and directly calling into librt for plot lists. What is your first project milestone? If it doesn't entail OpenGL, then you will want to refocus on the milestone -- there's not much time in your schedule for distraction (like implementing those coordinate axes). As the plan is for the gui to go through coreInterface, you should be getting plot information from it instead of via ft_plot() too.
Reading your project plan, looks like the first milestone is opening and closing a geometry database -- if you can do that already, you should have submitted code for review. If you have not, that is what you should be working on now. :)
Sadeep Darshana That all said, I'm a little surprised you're working with low-level OpenGL code and directly calling into librt for plot lists. What is your first project milestone? If it doesn't entail OpenGL, then you will want to refocus on the milestone -- there's not much time in your schedule for distraction (like implementing those coordinate axes). As the plan is for the gui to go through coreInterface, you should be getting plot information from it instead of via ft_plot() too.
@Sean
1. How do I obtain plot list through CoreInterfaces? Is a function that does the functionality of ft_plot() already implemented in CoreInterfaces?
2. DM had to be implemented because without it I won't be able to develop other required things like creating a sphere on the canvas with the mouse. Or editing. Btw I won't be focusing on those coordinate axes (they are object rotate/scale/translate handlers) or will do them at the end if time permits.
@Sadeep Darshana
Sean
1. How do I obtain plot list through CoreInterfaces? Is a function that does the functionality of ft_plot() already implemented in CoreInterfaces?
You can use the database Facetize() method to get a triangle mesh boundary representation of the geometry. The edges of these triangles create a wireframe.
There will be likely be a plot-like method in future, but all you need for the beginning is a set of edges, which you can obtain via Facetize().
2. DM had to be implemented because without it I won't be able to develop other required things like creating a sphere on the canvas with the mouse. Or editing. Btw I won't be focusing on those coordinate axes (they are object rotate/scale/translate handlers) or will do them at the end if time permits.
You can't have a DM without a window, which you don't have. You still work with the QtGUI from GCi, which is far away from what we expect a CAD GUI should look. We clarified the priorities for your project here, but you haven't started with the first of them yet.
Metaphorically speaking, you are talking about the mountains you are seeing at the horizon, but you haven't start going there. Then, you have heard that a cable car is a good way to go up a hill, but you have no idea what it means to build one. You'll have to climb up the mountain first and find a path.
We, the mentors, can guide you there. This has to be done however step by step. It isn't useful to philosophize about things which look a bit different when you are standing in front of them, then you might think now.
The creation of a complete functional CAD GUI is far behind the scope of your project. You should feel more like an explorer, who tries to come as close as possible to the desired software in the short time of this GSoC. You'll find many things which are missing or having a to bad (time)cost-benefit ratio to be done here. That's OK. This should be noted for the future.
Okay, I'll work on the UI next
Hi @Sadeep Darshana I see that you have not updated your dev log from couple of days, is everything fine? Do you need any help?
I did not do anything significant during the period. My exams are not over yet. I will do my best to find time to work on this.
I did not do anything significant during the period. My exams are not over yet. I will do my best to find time to work on this.
Hmm, that's bad.
@Sadeep Darshana It would really help you and your mentors if you keep the communication running. So even on days when you havent done anything significant, inform us (through dev log and otherwise) about any non-significant thing you did, or even when you didnt do anything at all. Not communicating in my humble opinion is always worse than not working. I know its hard, I used to miss my dev log too, but I promise you this habit of daily updating will help you in successful completion of GSoC as well as in your future endeavors as a professional in tech industry.
thanks @pooh (inder)
I didn't start working on the UI yet. When I start should I make improvements to the QtGui project or start it fresh?
@Sadeep Darshana I will be sending an e-mail regarding your dev log. While you did let us know about your exams (through the 17th right?), I believe I also reiterated the importance of time management and still making some progress. Going 6 days without activity is not acceptable even with exams.
I have done some improvements on the QtGUI
Is it prefered to start a new project or do things on top of the rt^3 QtGUI project?
@Daniel Rossberg
@Sean
Create a new project parallel to QtGUI.
I'm fine with either approach, merits to both, downsides to both. ;)
@Sean @Daniel Rossberg @pooh (inder) I hope you received my email. I'm implementing the toolbar.
placed our OpenGL view as the central widget. im trying to make it possible to create a sphere through ui
placed our OpenGL view as the central widget. im trying to make it possible to create a sphere through ui
Where is the code?
Where is the code?
Daniel Rossberg SHould I upload to github and send link? cant push to svn since a new project.
GitHub or tarball to our patches tracker on sourceforge or tarball posted somewhere else...anywhere is better than nowhere. ;)
@Sadeep Darshana do you have it up anywhere yet? we really need it as soon as possible...
Sadeep Darshana do you have it up anywhere yet? we really need it as soon as possible...
Give me 30 mins @Sean
@Sean @Daniel Rossberg @pooh (inder)
Here is everything you can do with the application I have created so far,
Open a DB
move around with the keys (has to be improved, also mouse support to drag/zoom viewport needed)
Create a sphere using the sphere tool (this has to be improved to support drawing with mouse)
save the database
the UI is far from what will be created ultimately, a lot of features when creating geometry also have to be pre set. also I will talk to the mentors and finalize on the positioning of components
Please have a look at the demo video,
Demo Video
https://github.com/sadeepdarshana/QtNewGUI
https://brlcad.org/wiki/User:Sadeep/DevLog-2020
The current BRL-CAD trunk may be a bit bumpy. Revision 75083 works for me with Visual Studio 2019.
Could be the case. It gave an error msg saying some -Ot build option was invalid. I will try out that revision
Can include actual cmake or build output (can attach a log or paste code snippet in between two ~~~ lines), easier than guessing the context of an error, often helpful.
What should I focus on implementing in the beginning?
@Sean I hope my patch is also sufficient
I am reusing the display manager I implemented last year. That would be sufficient for developing the UI for the moment.
@Sadeep Darshana I haven't looked into the code yet, but the feature your patch implements looks fantastic! and you did that so quickly!
As for where to start, this is a complex issue of prioritization and you're going to get different priorities depending on who you ask and what the near-term goal is.
what would you like to do first?
I want to build the most basic editor, yet functional
@Sadeep Darshana you need to be way more specific. that could be almost anything. it also doesn't imply what the GUI itself will require.
Sadeep Darshana said:
I am reusing the display manager I implemented last year. That would be sufficient for developing the UI for the moment.
Did you tested it with the current BRL-CAD trunk revision?
Hey @Sadeep Darshana
How are you doing? I just wanted to check-in and understand how you are approaching the flow for new GUI. I would love to help you, especially on the UI part of things. Let me know if you need anything.
@Daniel Rossberg it is working with the current version
@pooh (Inderpreet Singh) It's great to hear from you. There are several Google Code In designs that I looked into. Also the UI of vectary.com seems interesting. I'm using CMake instead of qt's qmake to be consistent.
OK. Next, you should remove all in the build process generated files from the repository, e.g. the moc_ files.
@Sadeep Darshana Awesome, it would still make sense to have a wireframe which is based on our favorite UIs (from gci, vectary etc). I wont block you with this wireframe task right now, as its more important for us to get properly set up and make some progress on the core coding side. So keep doing what you are already doing but soon enough we should consolidate our UI ideas. :innocent: So excited to see your progress.
I started a new repository. Implemented basic save/open functions. Integrated the DM from my previous years works.
I accessed rt_i* m_rtip and resource* m_resp from ConstDatabase.h and rt_wdb* m_wdbp from Database.h (which are not public without changing coreinterfaces code) for rendering.
@Sadeep Darshana Nice to hear that you started working. Where can I find your new repository? What do you plan for the next days?
I added everything I did for the last few days to this repository. https://github.com/sadeepdarshana/arbalest
Will be pushing daily to this repo.
This is where I am now. image.png
My dev log https://brlcad.org/wiki/User:Sadeep/DevLog-2020
@Daniel Rossberg
My immediate focus is on,
1) Making the code a little more cleaner in places where I have imported last year's code.
2) Adding drawable items toolbar to the UI. (support drawing 1 or 2 object types)
3) Implement adding new objects to a MemoryDatabase (to be used with drawing toolbar). (support drawing 1 or 2 object types)
I hope to complete these tasks within today and tomorrow. Anything else I should be focusing on?
Hi @Sadeep Darshana, thanks for the link to your code. You chose an interesting name for your program :)
You can find code for generating a tree view of the database objects here: https://github.com/drossberg/BrlCadGUI/blob/master/src/MainWindow.cpp#L179
Would this vlist interfacing class help for the graphics output?
@Daniel Rossberg This will likely help. I can make use of this and change my display manager not to use vlist directly. From my last year's experience I think I dived too much into the rendering part and lost focusing on the UI (which is the core goal of the project. (is it?)). So what I thought was to use last years code for rendering and make improvements to it only after focusing on UI (since we already can display stuff in screen).
What do you suggest?
Sadeep Darshana said:
What do you suggest?
I'm fine with your focus on the user-interface part. This should indeed be the main emphasis of your work. However, you'll gain profit from your last years rendering implementation.
Sadeep Darshana said:
Daniel Rossberg This will likely help. I can make use of this and change my display manager not to use vlist directly.
I'll backport the VectorList class to the rt^3 repository then.
Done.
It compiles with Linux, will test on Windows tomorrow. If it works, I don't know. We'll see.
great
is the code available in the latest revision of rt^3?
Yes, with revision 76022.
The Windows build seems to have an issue with the inline constructors of DLL-exported classes. It builds, but complains about them. I don't know how serious it is.
It could result in version incompatibility if, for example, a DLL were updated but not the application. Code in the application would likely call the inline'd version whereas other libraries Dll-importing the symbol would get the different updated version. This could result in badness, but not a major concern nor is it likely.
The warnings were abut a member variable of Vector3D type, which is not exported by the DLL. The declaration is fully inline. It looks like the compiler is "worried" that the declaration is different inside and outside the DLL, like it can happen with STL.
Maybe, having not inline constructors will make MSVC happy.
@Daniel Rossberg I'll use this in the DM. thanks
I investigated the build warnings a bit more, and decided to not touch them for the moment. It looks like suppressing them would be the best I could do in my case (https://www.cnblogs.com/zhangyz/articles/6238841.html).
The warning is about classes which have non-inline (i.e. real) member functions, which could probably not be present on the client's side. However, Vector3D is a very primitive class with only simple pure inline functions.
I implemented creating new geometry and adding to db. (create sphere only with hardcoded parameters, no ui toolbar). Will look at this vlist thing next @Daniel Rossberg
Qt's using thisCase for method names. Core interfaces is using ThisCase. I only noticed the difference now. So far the code I did follow Qt's convention. Should I switch?
You don't need to switch.
BTW, having the same naming conventions as somebody else's library, which you use in your own code, can make it hard to distinguish between yours and alien types, functions, etc.. This depends on the definition of "own" and "alien" too.
Sadeep Darshana said:
I implemented creating new geometry and adding to db. (create sphere only with hardcoded parameters, no ui toolbar).
Did you committed it?
I implemented creating new geometry and adding to db. (create sphere only with hardcoded parameters, no ui toolbar).
Did you committed it?
https://github.com/sadeepdarshana/arbalest/blob/master/GeometryOperationsManager.cpp
image.png The generated file name is in lower case. Is this not the case for Linux?
Sadeep Darshana said:
Did you committed it?
https://github.com/sadeepdarshana/arbalest/blob/master/GeometryOperationsManager.cpp
If you call it explicitly a sphere I recommend to use the Sphere class. There is a primitive with ID_SPH (src/librt/primitives/sph).
Sadeep Darshana said:
The generated file name is in lower case. Is this not the case for Linux?
No. It's the same as the source file. MSVS has a tendency to change file names to lower case.
However, my patch should work for both now.
No. It's the same as the source file. MSVS has a tendency to change file names to lower case.
However, my patch should work for both now.
merged it
If you call it explicitly a sphere I recommend to use the Sphere class. There is a primitive with ID_SPH (src/librt/primitives/sph).
I should have called that Ellipsoid. I just implemented the method to see if it working. Not finalized. I'm working on display manager.
@Sadeep Darshana How is your progress?
You should commit to your Github repository at least once each working day. And your development log needs an update as well.
Will commit the changes and give update the log. I was working on DM. Here is what I did.
Moving forward /backward (camera looking direction) with mouse wheel.
Configured so that cursor jumps to the other edge when it passes the boundary of opengl display while doing 1. or 2.
Grid lines
I had to spend some time to learn the stuff needed to implement the Camera and did a lot of experimenting to come up with the final solution. Studied representing rotation, creating modelview/projection matrices and using them to render the scene.
The working code contains a lot of stuff I added to debug since the Camera is still WIP. So I did not commit. Will update the log.
Also the keyboard shortcuts for 2 and 3
@Sadeep Darshana Is the Camera code here of any help/use? https://sourceforge.net/p/brlcad/code/HEAD/tree/rt%5E3/trunk/src/g3d/
Thanks. I will check this @starseeker .
From zulip thread general -> coreInterfaces
Daniel Rossberg said:
It is possible to create a list of copies from the elements, but I decided no not explicitly support it (e.g. by providing a Clone() method), because this is not how this list should be used. It would slow down the process. Instead, you should move the corresponding drawing functions to a call-back class:
class ElementOpenGL : public BRLCAD::VectorList::ConstElementCallback { public: virtual bool operator()(const Element* element) { switch (element->Type()) { case BRLCAD::VectorList::Element::PointDraw: BRLCAD::VectorList::PointDraw* pointDraw = static_cast<BRLCAD::VectorList::PointDraw*>(element); // put your OpenGL code here break; case BRLCAD::VectorList::Element::PointSize: BRLCAD::VectorList::PointSize* pointSize = static_cast<BRLCAD::VectorList::PointSize*>(element); // put your OpenGL code here break; // ... } } }; void DrawVectorList(const VectorList& vectorList) { ElementOpenGL elementOpenGL; vectorList.Iterate(elementOpenGL); }
This code demonstrates the principle only. It doesn't contain all necessary methods, checks, etc..
But @Daniel Rossberg , would this not slow things down instead of making things faster?
I had actually considered doing this but then decided against it due to the following reason. Think of the 2 scenarios.
Case 1 - We call opengl methods inside Iterate()
Each time the opengl scene is redrawn we need to call Iterate
. In each call all elements in m_vlist
are used to build C++ class instances. A single call to Iterate
costs approximately the time taken to clone a list (if implemented) that contains all the Elements
.
Each time the geometry is changed we need to call Plot
. In this call m_vlist
is built.
Total cost in a session = (# OpenGL redraws * costs for Iterate
) + (# geometry edits * cost for Plot
)
Case 2 - We generate and save the list of all elements when Plot
is called and keep using that same list for drawing until geometry is changed again.
Total cost in a session = # geometry edits * (cost for Plot
+ costs for Iterate
+ cost to clone the list)
Cost to clone the list can be avoided if supported by coreinterfaces (e.g allocated on heap)
The big difference between the cost happens in the way it is used in practice. (# OpenGL redraws) is hugely higher than (# geometry edits). This is because most of the time users navigate the 3d space. Even when a user rotates opengl camera by 90 degrees, if it goes smoothly there will be 100 frames for that move itself. But for an entire 30 minutes session he would only do less than 100 edits to the geometry. Putting the overhead of generating C++ instances from m_vlist to every opengl draw frame IMO is more costly since it is roughly the cost to clone the list.
Maybe we can optimize case 2 further by doing m_vlist > c++ classes conversion only for changes geometry .
Not sure I understood stuff correctly.
@Daniel Rossberg
I implemented multiple document support to the application today. Now we can open and work with several databases.
The grid is very ugly. I need to make it fade away with the distance to the camera. Otherwise everything in far horizon looks like a highly concentrated mess of lines. But this might require shaders. Not sure if I should prioritize on something else.
Calling Iterate() is cheap. It does, what the usual iteration over a bn_vlist does: It uses BU_LIST_FOR() and has switch/case. The Element classes it constructs are cheap too: They need only a minimal amount of stack memory (no memory allocation on the heap at all) and all methods necessary to construct them are inline. This can be optimized to almost nothing. The whole procedure is very close to what is done with the bn_vlist in mged/archer.
I'll proceed with that way. Is there a place I can download .g models?. I searched in the internet. I couldn't find any.
They did some efforts to optimize the time consumed by handling vlists in BRL-CAD. If they did it well, the coreInterface should gain profit from it too by not using std::vector or std::list and not using heap memory - but using the original structs and algorithms.
You can find .g's in your BRL-CAD installation at share/db.
Daniel Rossberg said:
They did some efforts to optimize the time consumed by handling vlists in BRL-CAD. If they did it well, the coreInterface should gain profit from it too by not using std::vector or std::list and not using heap memory - but using the original structs and algorithms.
I thought recreating C++ classes might be time consuming compared to reuse.
I had forgotten to account for the stuff happening in std classes like vector
- Should I plot for each object or each object in root level in the tree? (i.e does ploting an object recursively plots its children too?)
Plotting is recursive. You should plot whatever was selected from the objets' tree.
- Does BRLCAD::ConstDatabase::TopObjectIterator return all objects or all objects in root level?
Only the ones at root level. See https://github.com/drossberg/BrlCadGUI/blob/master/src/MainWindow.cpp#L179 for an algorithm to walk down the objects tree if you know the roots.
Thanks. I will implement the DM and commit everything I did in the past days.
Also what do you think about (not) committing WIP code? I have a lot of log statements and code I write just for experimenting without implementing the real thing in a solid manner. How should I deal with this (in the future)?
Sadeep Darshana said:
I thought recreating C++ classes might be time consuming compared to reuse.
Yes, might be time consuming.
BTW, did you know that struct and class are almost the same in C++? The only difference is, that for a struct the default visibility is public, but for a class it's private. I.e., if your class is the same as a struct with with 3 doubles and a trivial, inline constructor - and a pointer to a virtual function table.
Sadeep Darshana said:
Also what do you think about (not) committing WIP code? I have a lot of log statements and code I write just for experimenting without implementing the real thing in a solid manner. How should I deal with this (in the future)?
If it compiles, commit it. This gives yourself check points too, where you can follow your progress. You may reject some of them while your development progresses, but you can always look back and have a rethink.
And your mentors can see if you run in avoidable trouble and help you.
All in all, it sounds promising what you are doing. And I know that the display manager stuff is hard. This isn't a 3 days thing. I expect you to work on it the whole summer. Every time you implement a new feature, you may need to adapt something in the DM.
It compiles. I committed it and pushed.
Hi @Sadeep DarshanaCongratulations on getting started with the coding part. Just a suggestion, it would be really helpful to add some description and a very quick readme file to the project. :) If we keep our documentation maintained from now onwards, it won't be difficult at the end. We don't need crazy docs for now, just couple of lines on what this project is, may be some instructions on how to set it up etc.\
@pooh (Inderpreet Singh) https://github.com/sadeepdarshana/arbalest/blob/master/README.md
Awesome, thanks! @Sadeep Darshana
@Daniel Rossberg
from dm-wgl.c
int
wgl_drawVList(dm *dmp, struct bn_vlist *vp)
{
struct bn_vlist *tvp;
register int first;
register int mflag = 1;
float black[4] = {0.0, 0.0, 0.0, 0.0};
GLfloat originalPointSize, originalLineWidth;
GLdouble m[16];
GLdouble mt[16];
GLdouble tlate[3];
glGetFloatv(GL_POINT_SIZE, &originalPointSize);
glGetFloatv(GL_LINE_WIDTH, &originalLineWidth);
if (dmp->dm_debugLevel)
bu_log("wgl_drawVList()\n");
/* Viewing region is from -1.0 to +1.0 */
first = 1;
for (BU_LIST_FOR(tvp, bn_vlist, &vp->l)) {
register int i;
register int nused = tvp->nused;
register int *cmd = tvp->cmd;
register point_t *pt = tvp->pt;
GLdouble glpt[3];
Some of the variables here (corresponding ones in our implementation) will be used across multiple Elements. I can declare them static in the class or declare them in the header outside any class. I believe this won't have any performance impact though they aren't declared in stack.
These would be member variables of class ElementOpenGL
in my example.
I am trying to getting the DM into working. It doesn't display stuff correctly. And opengl is not updating.
Also please check this. https://sourceforge.net/p/brlcad/patches/544/ @Daniel Rossberg
DM working now.
What's the thing with objects having different colors in archer and mged? Are the colors a property of these objects? (as opposed to they being an indicator). Where is it implemented (the 17 commands of vlist don't seem to have a setColor)
This is slower than archer or mged (smoothness when rotating camera). It's hardly noticeable. But noticeable if you specifically try to notice that.
Could this be since I'm using perspective projection? I'm in the mid of implementing Orthographic btw)
Sadeep Darshana said:
Also please check this. https://sourceforge.net/p/brlcad/patches/544/ Daniel Rossberg
Looks reasonable. I may need some days to commit it, when I've more time.
Sadeep Darshana said:
- This is slower than archer or mged (smoothness when rotating camera). It's hardly noticeable. But noticeable if you specifically try to notice that.
Could this be since I'm using perspective projection? I'm in the mid of implementing Orthographic btw)
It should be a bit slower because of the C++ interface overhead.
I think I need to change the way of rotating and moving camera.
Should I look into how it is done in Archer?
Also does archer set initial zoom level / how close based on the size of the model?
Should I only focus on orthographc?
Also what about that color thing?
What's the thing with objects having different colors in archer and mged? Are the colors a property of these objects? (as opposed to they being an indicator). Where is it implemented (the 17 commands of vlist don't seem to have a setColor) @Sean
Sadeep Darshana said:
I think I need to change the way of rotating and moving camera.
Should I look into how it is done in Archer?
Also does archer set initial zoom level / how close based on the size of the model?
Should I only focus on orthographc?
Did you check out the g3d repo starseeker mentioned? It has three working camera implementations in there including one that works the same as Archer, another that works like Blender, and another that works like a lot of games.
The initial zoom level is based on the overall bounding box of the geometry when it's displayed. This is calculated pretty quickly.
Sadeep Darshana said:
What's the thing with objects having different colors in archer and mged? Are the colors a property of these objects? (as opposed to they being an indicator). Where is it implemented (the 17 commands of vlist don't seem to have a setColor) Sean
Colors are actually a bit of a complicated subject. Yes, they are a property of geometry. There are a variety of rules for how colors work. The summary is that there are essentially three ways an object gets a color.
First and most simple is an object can have a color specified directly on that object. This is stored as an attribute on the object.
Second, an object can inherit a color from a parent object. For example, say you have some "engine" object and way down the hierarchy there is a "bolt". We can set a color on engine and bolt can inherit the color when it's displayed in the context of an engine. In this manner, bolt will not have a color if it's displayed by itself (i.e., NOT in context of an engine).
Third, an object's color may come from a global color table. For regions and object belonging to a region, they have a numeric identifier set on them as an attribute (e.g., regionID is "1000"). The color table can specify all objects 1000-3000, for example, are rgb 255/0/0.
There is not a succinct function to get an object's color, but you can find the core logic in a few places throughout the code. The cleanest appears to be in src/libged/display_list.c, start with the color_soltab() function.
Did you check out the g3d repo starseeker mentioned? It has three working camera implementations in there including one that works the same as Archer, another that works like Blender, and another that works like a lot of games.
I did look at this. I could not get it built since it required some Orge to build. So I gave up on that. I will look at the camera code in it.
I'm trying to get rid of the windows title bar. It's just a waste of space, ugly and almost all apps in 2020 (VS, all jetbrains products, adobe all, chrome) use their own. There is no straight forward way to do this in qt it seems.
You can try to set the flags parameter of the QMainWindow constructor appropriately.
BTW, I don't like it if an application doesn't has it ;)
That of course is the first thing I tried. Qt::FramelessWindowHint and Qt::CustomizeWindowHint exist. But when those flags are set the OS (at least Windows) do not treat the window as a normal window. No resizing possible. Clicking the taskbar icon doesn't minimize the application. No moving. No Aero Snap.
Community seems to be using this https://github.com/dfct/TrueFramelessWindow. It uses native win32 calls and do stuff. Problem with this is you can't select close by moving cursor to the top right corner (because there is like 1px border around the button, I'm trying to figure out where this comes from). So you need to move a very small amount towards center from corner which is inconvenient.
@Daniel Rossberg I implemented rendering directly from bn_vlist too. Now we can choose between using VectorList and bn_vlist.
(change bool ArbalestSettings::useLegacyVlists
)
I did this mostly to evaluate the performance differences. For share/db/goliath.g, bn_vlist renderer works seamlessly (similar to Archer/MGED). VectorList renderer is noticeably slower.
Did we consider the potential overhead of creating a function stack for each element? I think that might be more expensive than class instantiating. Also I had to dynamic_cast Elements, I believe this does not cost much.
Btw im accessing the underlying C list from VectorList for bn_vlist renderer. Are we going to continue having support for both methods? (will have to create a getter for VectorList::m_vlist if so)
Also check if I'm doing anything incorrectly when using VectorList (resulting in bad performance)
Sadeep Darshana said:
That of course is the first thing I tried. Qt::FramelessWindowHint and Qt::CustomizeWindowHint exist. But...
Or Qt::WindowFlags() | Qt::CustomizeWindowHint
. But, this only removes the standard decoration. I.e., you have to draw your own one by hand now, give it a frame, put the minimize, maximize, and close buttons in the menu bar, etc. - I think. I haven't tried it by myself yet.
I've been studying libged and tclcad. It is doing a lot underneath before generating vlists. Without this we are losing all the colors and other effects.
I did not do any new implementations. Trying to understand the code in the BRLCAD repo. Now I have a better understanding of how libged, display_lists and dm (I was only familiar with drawVList method) works.
Even the lists are weird :speechless:
@Sean @Daniel Rossberg @pooh (Inderpreet Singh) The amount of things we need to do to re-implement the geometry displaying as it is done in the 2 existing editors code is huge. So far I was just displaying the vlist obtained from ft_plot (generated for the whole tree at once by passing all the leaf nodes, therefore all solids are same style/color, I'm using ConstDatabase::Plot for this). I'm passing this vlist to my drawVList() implementation (I have not implement other methods in dm). But when I study the code for Archer, I realize that in archer the logic is lot more complex than this.
I have been studying the methods in libdm, libged and libtclcad. I see several choices here,
If going with 1, should I put the implementation under coreinterfaces?
If going with 2, do you recommend implementing a minimal subset of feature in C++ or linking libdm, libged and libtclcad?
If going with 3, single color wireplots don't look pretty
Although I talked mainly about color enabling color and display_lists, in archer it does a lot more than that in addition to displaying wireframes. Likely it will take too long to integrate that all. My preference is 2. implementing the minimal features in C++ without using the libraries. (if using libraries we'll have to deal with BU_LISTS etc)
Until they respond, I have a smaller but potentially helpful/useful task: the qged code in the branch qtged SVN branch:
https://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/branches/qtged/src/qged/
has an accordion widget: https://sourceforge.net/p/brlcad/code/HEAD/tree/brlcad/branches/qtged/src/qged/QAccordionWidget.cxx
This widget needs some behavioral refinements - in particular, if all the accordion panels are closed, the spacing of the widget gets strange and it loses it's prior width. This widget will likely be useful in the future, and should be fairly "stand-alone" to work on.
The qged code itself can be built with -DBRLCAD_ENABLE_QT=ON set for CMake - there is no display code, but if you open a .g file (share/db/pinewood.g is the one I usually used) you should be able to do a variety of GUI manipulations.
There are other widgets there that need some work - the tree widget, for example, has graphical elements that don't quite line up properly when the tree is expanded - if you get through the accordion widget quickly.
I'll look at this @starseeker thanks
Another challenge - the CADTreeView horizontal scrollbar doesn't seem to be working correctly - it is present, but doesn't calibrate correctly to the tree contents.
https://stackoverflow.com/questions/6625188/qtreeview-horizontal-scrollbar-problems might be a place to start, but it's been to long and I don't know if what they're discussing there is relevant to our code...
equally likely (or even more likely) that some calculation in our code is off...
@Sadeep Darshana These are good questions. They show, that you made progress.
At first, you should be aware that you won't be able to program a complete CAD GUI in 3 months. I.e., you have to set priorities for yourself.
I personally wouldn't support the idea of using libged functions, because I'm afraid of not being able to extend them with new CAD features, if they are not implemented with the GUI code. You project is not about writing a new mged or archer, but a new generation graphical user interface, like someone would expect it from AutoCAD, for example. Maybe, the other mentors have a slightly different opinion here.
And, I don't see such a big problem with the colors. I have a model, where mged displays black edges on a dark-blue background (because the objects are black). This would be impossible for a CAD. There, it is important to have a good contrast.
To work on different things can be good to keep the code flowing and wait for inspiration on the areas where you got stuck.
I'm making support for displaylists in C++ code. (this does solve the issue with the colors too)
@Sadeep Darshana I also agree that those are/were fantastic questions. I think any of the three would be perfectly reasonable next steps to work on. That said, I wouldn't put colors on the priority list. I think we'll get far more mileage and usefulness if you keep working on other aspects.
I agree with Daniel in that I wouldn't think it a great approach to use libged for aspects of GUI drawing. That said, I do think it would be awesome to be able to call some GED commands on opened geometry (e.g., call the search command or ls command or l command to introspect, etc). How to go about is up for interpretation.
I'd think you'd probably get the most mileage merging the features of qtged and getting other basic aspects of the GUI sorted out (e.g., full screen, windowed, drag-n-drop, etc.). Then, maybe work on getting triangle display lists working as an alternative to wireframes (similar to ft_plot, uses ft_tess).
FWIW, qged can already run ls and search on a .g file...
@Sadeep Darshana Also, since you are already working on display lists, please keep in mind that it's perfectly viable to add new/additional functions not only to MOOSE but to the other low-level libraries as well as well. for example, there's no reason you can't add a new function to librt or libwdb or [insert lib] so long as it's within scope of the library. for example, the code you wrote for ft_plot traversal would easily make sense as a general function somewhere: given an object, get its wireframe.
only difference is moose should be pure/clean c++. the low-level libs can be implemented in c++, but their public API need to get marshaled via C data types.
Hey @Sadeep Darshana what time zone are you in? Nothing major, I was just looking through your dev log and found entries for 27th June already :D so was confused.
Sadeep Darshana said:
Thanks. I will implement the DM and commit everything I did in the past days.
Also what do you think about (not) committing WIP code? I have a lot of log statements and code I write just for experimenting without implementing the real thing in a solid manner. How should I deal with this (in the future)?
The unofficial official motto of open source dev is "commit small, commit often" - and I would go to length and say, whenever you leave your computer for a break, make a commit (as daniel said if it compiles, its good enough to commit). Also, those commits would be really helpful in your evaluations. It's just another way of communicating progress and showcasing your workflow.
You can use the branch -> Pull Request workflow to keep things organized. I would suggest you keep committing in a feature branch, and then send a PR to the dev branch and once the code is reviewed by someone, it can be merged in to the main codebase/ master branch.
@Sean should we move/clone sadeep's code in the official GitHub org we have?
pooh (Inderpreet Singh) said:
Hey Sadeep Darshana what time zone are you in? Nothing major, I was just looking through your dev log and found entries for 27th June already :D so was confused.
Not sure what you are saying about
image.png
image.png
https://brlcad.org/w/index.php?title=User:Sadeep/DevLog-2020&action=history
@pooh (Inderpreet Singh)
Feature branch sounds like a good idea.
@Sadeep Darshana so curious, did you compare the performance of vlist with VectorList?
pooh (Inderpreet Singh) said:
Sean should we move/clone sadeep's code in the official GitHub org we have?
Yes, I would think it could have even started there, but no worries. It would be good to get it all together in one place.
I did. VectorList is noticeably slower. Can feel the difference when rotating the camera with mouse. I did not do any time measuring (can do it if required)
But this does not matter anymore since I'm using displaylists and drawVList is not called every frame. So I deleted the vlist implementation (should be there in the older commits).
@Sean I implemented color and style (DM_DASHED_LINE) to displaylist. I wonder why everything is so complex in the old libs. Is the underlying logic behind them really that complex?
It's not required. Just curious about the performance, and good to know. We should try some models with a more typical level of detail, thousands of objects and instances.
The underlying logic is pretty complicated. It's almost guaranteed that your wireframe colors will not match the actual ray tracing colors. A lot of the complexity is also accumulation of optimizations, feature creep, and complexity of procedural code.
@Sadeep Darshana Instances add a fair bit of complexity, for example. Say you have a bolt on a truck. It keeps track of one copy of that bolt as it might be used 10,000 times around the vehicle and you don't want 10,000 copies of it in memory.
Yet while you might have only 1 copy of the bolt, the instances of the bolt might be different colors .. which has to be kept track of separately.
I did not think of any of these. This is my whole color / styling logic
if (tsp->ts_mater.ma_color_valid) {
gr->setFGColor(tsp->ts_mater.ma_color[0], tsp->ts_mater.ma_color[1], tsp->ts_mater.ma_color[2], 1);
}
else {
gr->setFGColor(gr->defaultWireColor[0], gr->defaultWireColor[1], gr->defaultWireColor[2], 1);
}
gr->setLineAttr(-1,tsp->ts_sofar & (TS_SOFAR_MINUS|TS_SOFAR_INTER));
There were few cases I had noticed but not yet implemented like the DM options for overriding solid's colors
@Sadeep Darshana did anything come of the camera modes from the old OGRE code?
@starseeker I created my own implementation since I couldn't anyway use g3d as it is. I did not study g3d a lot.
@Sean In my implementations I have used the C methods like db tree walk, also in the above code if you notice. How do I deal with this? My implementations are certainly not worth to be put among the old C libs since the functionalities are a subset of what's already there. SHould I use them through a coreinterface interface?
my specific need here is db_walk_tree. Do I need to wrap it?
you should -- I believe it's called elsewhere wrapped
Do I need to implement immediate mode (no display lists). I created this partially for debugging qged. But it is very badly optimized (ft_plot everyframe). Need to make some changes if keeping it as a feature. Do we need to support it? @Sean
I can remove it thing alternatively
Immediate mode is dead.
Any new code should be using "the new way" via opengl 4, vulkan, or a lib that wraps one of them.
What about fixed function pipeline?
The new way is to use shaders for everything. Yet everything is done in the BRL-CAD with the old way. Everywhere in the internet they say FFP is deprecated and should not be used.
Just asking, updating to this would need a radical change from the existing code.
The new way is not so different from what is already used in BRL-CAD for display lists.
The data can be just filled into a vertex buffer + glDrawArrays(), e.g., https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_05
at least it's that simple for drawing points, wireframes, and polygons
probably might be worth thinking about changing glColor stuff to fragment shaders some day if it's still there O.o ffp is dead, yo
I'm in doubt if it is reasonable to put much effort in tweaking the OpenGL code. There is a new Qt 3D API in development https://doc.qt.io/qt-5/qt3d-index.html which puts an abstraction layer above the rendering engine. Especially on Windows the performance of Direct3D is usually better than OpenGL. In addition, OpenGL don't run everywhere.
Instead, you shouldn't forget the other aspects of the GUI. For example the creation and modification of database objects, or an undo/redo feature. You can't implement everything in these 3 months, but you should aim for creating a framework where the biggest issues are already addressed (not necessarily solved!).
fair. :)
undo/redo tree would be... nice.
Qt3D is definitely the way to go. I meant more that you shouldn't need to be modifying existing code radically either way, not to suggest working on OpenGL makes sense beyond just getting/keeping the demonstration working.
How do I wrap db_walk_tree? It contains complex structs (which themselves consist of more structs) like db_tree_state, db_full_path, rt_db_internal, bg_tess_tol, bn_tol.
Is std::vector<std::string> preferred over char** to pass a list of names? (when developing on top of coreinterfaces)
@Daniel Rossberg
Please review this https://sourceforge.net/p/brlcad/patches/546/ and let me know if/how this can be improved.
It wraps db_walk_tree.
For your convenience, this is how it is accessed from the outside,
https://github.com/sadeepdarshana/arbalest/blob/9188c17c074da7355579d26ee83933fa06199d0f/src/display/GeometryRenderer.cpp: line 63 and void GeometryRenderer::drawSolid method (line 73 onwards)
@Daniel Rossberg @Sean What is the criteria for making the wireframe lines dashed (I have already implemented this).
What do these mean TS_SOFAR_MINUS, TS_SOFAR_INTER? SOFAR as in "so far as we traverse in the db"?
Need to implement an accessor to tsp->ts_sofar in coreinterface (TreeLeaf) with a meaningful name
Now the codebase fully depends on coreinterfaces. No access to low level code.
@Sadeep Darshana take a moment to read about serialization, these are the same challenges as db_walk_tree
@Erik thanks, I will. Btw I'm not reimplementing the feature. I want to wrap the C method in coreinterface and give a more convenient interface to the outside.
Yeah, it should follow python idiomatic design, the recursive serialization pattern shows what you will need to worry about as you bridge the two paradigms :)
Eh, python or qt or whatever, it's how to get all the right data to shove it in another system
Sadeep Darshana said:
How do I wrap db_walk_tree? It contains complex structs (which themselves consist of more structs) like db_tree_state, db_full_path, rt_db_internal, bg_tess_tol, bn_tol.
Why do you want to do this? The C++ core interface has already a tree walking mechanism. I pointed you to an example where this mechanism is used to create an object tree widget in Qt.
BTW, it looks like you abuse the auto specifier. You use it mainly (only?) at places, where you could write the concrete type as well. Whereas it's less typing, it makes it harder to understand the code (because you don't name the types) and find the places where a class is used.
I didn't know that the functionality already existed. I thought that was only for top object. I'll change the code to use the existing implementation.
Well, it's a combination of FirstTopObject() with TopObjectIterator and Get() with ObjectCallback().
Look at the Qt object tree example.
For the Plot() you have to play with Select() and UnSelectAll().
And remember hat there is a difference between comm_shifter_box.r
and all/Shifter/comm_shifter_box.r
.
Neat!
@Sadeep Darshana did the docking stuff end up being too complicated to tangle with?
No, I only have one (object tree) of them yet.
Just looking at your code: You are using brlcad/vmath.h there. Did you considered to use QMatrix4x4 and QVector3D?
I am thinking about changing that. It doesn't compile on linux due to brlcad/vmath.h. Also in windows I have to build twice after every CMake reload. In the first attempt it says can't find vmath.h. Works well after running build again.
If that is an alternative I'll use it.
Try #include <vmath.h>
.
The C++ core interface contains intentionally no vector functions, because it's expected that the project using it already has them. For example, a large framework like Qt has already types for matrices and vectors, and the basic algorithms like computing the inverse are build in. There is no need to mess with an additional library.
BTW, the wireframe drawing works well on my computer :)
Replaced the vmath.h with QMatrix4x4 and QVector3D. What is your platform? How well does the window work without the title bar?
BTW daniel, did you look at my implementation of the traversing the tree for drawing (GeometryRenderer::DatabaseWalker)?
I was using std::string to pass the path as it traversed through the db. Is there a better way to access the objects than using the entire path?
I can have a single big (enough to hold the longest object path I might encounter) char array and append characters if creating an entire new string each time we go to a new db object is not fast enough.
What was that thing about Select and UnSelectAll in ConstDatabase? I only used FirstTopObject() TopObjectIterator Get() ObjectCallback() for plotting.
I couldn't understand the meaning by reading the doc. What is an active set?
Sadeep Darshana said:
What is your platform?
I use Windows and Linux.
How well does the window work without the title bar?
I don't know. I like the title bar.
Sadeep Darshana said:
BTW daniel, did you look at my implementation of the traversing the tree for drawing (GeometryRenderer::DatabaseWalker)?
I was using std::string to pass the path as it traversed through the db. Is there a better way to access the objects than using the entire path?I can have a single big (enough to hold the longest object path I might encounter) char array and append characters if creating an entire new string each time we go to a new db object is not fast enough.
There is nothing wrong with using std::string. It encapsulate the necessary memory management for the creation of object paths in a class. That's fine.
If there are better ways to access the objects depends on which information do you want to get and how much do you want to compute by yourself. With the Combination object you have access to all available information. It contains the complete Boolean tree with the operations and transformations. I.e., if you walk through the trees like you did in ObjectsTreeView and evaluate the transformations in addition, you get everything what's there.
I don't know. I like the title bar.
You mean you like the native title bar? or the one that I implemented? When I said "How well does the window work without the title bar?" I meant does it look buggy without the native title bar?
Because it should. Some features like resize and " drag to top to maximize are not working". I have implemented dragging only out of the missing features
.
Sadeep Darshana said:
What was that thing about Select and UnSelectAll in ConstDatabase? I only used FirstTopObject() TopObjectIterator Get() ObjectCallback() for plotting.
Okay, I see. Indeed, plotting is a database operation, but it doesn't depend on Select() but gets the object name as parameter.
BTW, this Select() and UnSelectAll() is the equivalent to "e" or "draw" and "Z" in mged.
So I won't need to use Select() and UnSelectAll()?
I was working on UI and stylsheet processing.
I'm implementing object properties widget now.
As I understand I will have to determine the type of the object selected in the tree (Ellipsoid / Cone / Combination). Then look for the properties of the type in the corresponding coreinterface class. And display all of them.
What are the properties I cannot find this way?
Ex: Color
Where can I find a list of other such properties.
Sadeep Darshana said:
So I want need to use Select() and UnSelectAll()?
They shouldn't be necessary. Your database->Plot(name,vectorList);
seems to work. However, they are necessary for the ray-trace.
You need to create a properties widget for every object type.
The color is a property of Combination.
When I look at QGED i see things like region, material id, aircode. I don't fully understand them. Maybe I should start using brlcad before developing.
I'll follow the tutorial
from Combination.h
FastgenType FastgenRegion(void) const;
void SetFastgenRegion(FastgenType value);
int RegionId(void) const;
void SetRegionId(int value);
int Aircode(void) const;
void SetAircode(int value);
int GiftMaterial(void) const;
void SetGiftMaterial(int value);
int LineOfSight(void) const;
void SetLineOfSight(int value);
bool HasColor(void) const;
void SetHasColor(bool value);
double Red(void) const;
void SetRed(double value);
double Green(void) const;
void SetGreen(double value);
double Blue(void) const;
void SetBlue(double value);
const char* Shader(void) const;
void SetShader(const char* value);
bool Inherit(void) const; ///< override lower nodes color and shader
void SetInherit(bool value);
const char* Material(void) const;
void SetMaterial(const char* value);
double Temperature(void) const;
void SetTemperature(double value);
Sadeep Darshana said:
Maybe I should start using brlcad before developing.
Maybe :wink:
And
bool IsRegion(void) const;
void SetIsRegion(bool value);
Sadeep Darshana said:
I don't know. I like the title bar.
You mean you like the native title bar? or the one that I implemented? When I said "How well does the window work without the title bar?" I meant does it look buggy without the native title bar?
Because it should. Some features like resize and " drag to top to maximize are not working". I have implemented dragging only out of the missing features
.
You main window seems to work well. I can resize it and move it around. (Debian buster Linux)
/me wonders why the Gift terminology was preserved... should probably just be GetMaterialID and SetMaterialID
@Sean What is Gift terminology? the properties under Combination?
Sean said:
/me wonders why the Gift terminology was preserved... should probably just be GetMaterialID and SetMaterialID
You have both a legacy integer GIFT material (rt_comb_internal.GIFTmater) and a general string material (rt_comb_internal.material).
I mean actual usage of the word GIFT .... nobody else knows what that means :)
it's just an id number
also, I believe the "material" string ... is a carryover from v4. I think it presently is only set to gift%d on v4 databases and not actually used by anything. the number is just the material ID. I think our intention should be to eliminate GIFTmaterial field and let material actually refer to a material object name (akin to shaders) when they get implemented. this has been a growing priority of late.
Well, I'm still working with GIFT because one of the UniVeMo modules (programmed by another company) uses it. In general, programs like these don't need a designated material field. They have higher requirements on the material specification, which can better supported by universal attributes.
conceptually, it's just an integer index to a name and a density value.
🧐
that certainly has a place, imho. it's the basis for massprops calculations. as a field, it's undeniably a fast index if it ever needed to be fast (which it almost certainly doesn't or couldn't be made automatic during prep)
the fact that the value originated in gift isn't relevant or useful. it's not like it's a broad standard that conveys meaning. it's an index and one must have the accompanying table of names+densities (which are now embedded in the .g too). if all we ever wanted to support was density, it wouldn't exactly be a bad way.
gqa / rtweight use the ID mapping for calculating mass, centroids, and moments of inertia. that alone gives the ID itself merit until there's an alternative.
Hi @Sadeep Darshana I see that your dev log has not been updated since 9th July. Just a gentle reminder, to update the dev log preferably daily.
Sorry, I will update the log. I have been developing daily and committed daily to the github.
Sadeep Darshana said:
- My current plan is,
Once I change an object which is not a combination, I will search the object tree for all paths ending with that object's name. Then remove each displaylist corresponding to each of such paths. Plot only such paths again and add each as a new displaylist.
If this is feasible? It sounds much more complicated than I had originally in mind. But, much better too.
Sadeep Darshana said:
- When Ploting a single object I will have to traverse its entire path to find color info etc?
In principle, yes. You need to consider HasColor() and Inherit() there too.
Refreshing the whole database is by no means affordable. We can't do things like dragging. At least not with something like goliath.g. It takes between 1 to 2 seconds for the model to load.
We might be able to reduce this if using the C methods like archer does though. Archer is significantly faster at loading the database.
Sadeep Darshana said:
Refreshing the whole database is by no means affordable. We can't do things like dragging. At least not with something like goliath.g. It takes between 1 to 2 seconds for the model to load.
I meant load and draw vlist
There is so much to do with this GUI and the project just started that you are free to set your priorities.
That's awesome @Sadeep Darshana, looking good. How'd you ultimately go about handling colors? And what's next?
@Sean I implemented editing geometry. Now implementing some handlers for textboxes that can be used to change the numbers.
You mean wireframe colors?
I'm using the tree and getting the color inherited down from the ancestor Combination objects
Right, but how are you getting the color from the ancestors?
just curious what exact mechanism is being used given there's three color systems (direct color rgb values, inherited/overridden values, and based on the region_id)
void GeometryRenderer::DatabaseWalker::operator()(const BRLCAD::Object& object) {
const BRLCAD::Combination* comb = dynamic_cast<const BRLCAD::Combination*>(&object);
if (comb != 0) {
if(comb->HasColor()) {
colorInfo.red = comb->Red();
colorInfo.green = comb->Green();
colorInfo.blue = comb->Blue();
colorInfo.hasColor = true;
}
ListTreeNode(comb->Tree());
}
else{
geometryRenderer.drawSolid(path.c_str(), colorInfo);
}
}
Not the complete code handling the color. But this is the core code. TODO Implement ignoring cases where Combination::Inherit()==false in the above code.
anim.gif
@Daniel Rossberg @Sean @pooh (Inderpreet Singh) project status
animation
that's looking good. perhaps spin widgets instead of text fields, so it's more clear you can slider up/down?
I shared your animated gif on facebook. Good stuff.
Sean said:
perhaps spin widgets instead of text fields, so it's more clear you can slider up/down?
I made it so that the cursor changes to vertical drag icon when hovering over textboxes changeable by dragging. Might not be clear in the gif. I have seen a similar implementation somewhere (3Ds Max?). Wouldn't spin widgets give the impression you have to click on the up/down buttons rather than dragging?
I implemented autoview.
I selected (ConstDatabase::Select) all objects that are not combination for this. Is this necessary? (for the BoundingBox methods to work)
Sadeep Darshana said:
I implemented autoview.
Did you use the code in libged or did you do something custom? How is it working?
would be nice to match what mged/archer uses.. :)
My camera implementation is different. I'll have change that also if I'm to match it.
Sadeep Darshana said:
I selected (ConstDatabase::Select) all objects that are not combination for this. Is this necessary? (for the BoundingBox methods to work)
If you want to select all (geometric) objects, you should Select() all top objects beside _GLOBAL.
BTW, nice interface design :smiley:
The code might not be of good quality in the latest several commits. I rushed to implement features using quick fixes. Need to fix those things
@Sadeep Darshana the slider option from the new gui works very similarly to the slider options in blender but the new GUI is cool with support for opening multiple files at the same time :+1:
I was sure I had seen that somewhere but couldnt recall where. So its blender.
@Sadeep Darshana I am loving the progress. Please keep your devlog updated. A daily dev log would be more helpful than a full week's log at once.
@Daniel Rossberg My new rendering method only renders modified parts. Performance when modifying by dragging from my handlers went from practically impossible to use to seemless for goliath
However this would still not be efficient if a high level combination is modified since the whole subtree will be redrawn. This can only be solved by changing how combinations are rendered. In other words we need to save child objects in displaylists without their transformation available due to the position in object hierarchy. (save "wheel" instead of "cart/wheel"). And apply parent child transformations in the displaylist drawing time. I did not study how applying this currently happens in BRLCAD code. Without diving deep into this can't optimize this further.
This sounds impressive. But, how can I modify by dragging? The Edit Menu entry seems to have no function.
A fully featured GUI needs an own data model, and the display lists are part of it. For example, it would need to emphasize the regions, because this are in fact the geometric objects. But, nobody expects you to implement this in 3 months. BTW, do you have a plan for creating a ray-traced image? (not required, just asking)
However, because this is the last Month in 2020's GSoC, you should aim for rounding Arbalest off, for example:
Daniel Rossberg said:
But, how can I modify by dragging? The Edit Menu entry seems to have no function.
I meant the handles in text boxes (the icon changes when you hover on a property textbox). No handles have been implemented in the 3D GUI.
Keeping the eye in the Objects tree view widget visible, if it is active(?)
I can do that. My original intention was to keep it only as a button rather than an indicator.
The text colors work as an indicator.
Each item in the tree can have one of 3 colors. Blue (subtree+itself[if leaf] fully visible), light blue (some children in the subtree are visible) and black (no child [or itself] in the subtree is visible).
My current focus is to create properties for Combination.
These are the ones without properties pages,
BagOfTriangles
Combination
NMG
Pipe
Sketch
A fully featured GUI needs an own data model, and the display lists are part of it. For example, it would need to emphasize the regions, because this are in fact the geometric objects.
Regarding data models, most of my commits in the past few days were to place the ObjectTree class in the center of everything.
Sadeep Darshana said:
Daniel Rossberg said:
But, how can I modify by dragging? The Edit Menu entry seems to have no function.
I meant the handles in text boxes (the icon changes when you hover on a property textbox). No handles have been implemented in the 3D GUI.
Ah yes, this was indeed seamless :smiley:
Is it okay to display the transformation matrix in the UI instead of translate + rotation + scale + skew?
I've been struggling to extract components and then use these components to prepare the matrix back.
(combination child node's matrix)
btw raytracing done
image.png
image.png
Current camera position and orientation are used for raytracing also
@Sadeep Darshana, regarding the transformation matrix of the combinations: I would hide them by default. They could be shown on request, e.g. by clicking on a button. At first, it is only of interest, if a node has a transformation matrix different from the identity matrix or not. You could show the "Show Matrix" button for these entries only.
For me, it would be more interesting to see the tree structure of the combination with its Boolean operations.
BTW, you make still extensive use of auto, but I think, you shouldn't use it unless it really makes sense. If an inexperienced reader sees it, they don't know the type of the variable. In addition, it makes it hard to find the places where a distinct type is used (e.g. with grep). Reading through some articles discussing this issue, I got the impression, that people who know the code (classes, API used there) find it a reasonable way to make the code more readable, for every body else it makes the source code a riddle.
PS: The File menu would need a Quit or Exit entry :)
I'll remove the auto keyword. There are only 3 instances of the keyword I have forgotten to remove in all project files.
debug_utils.cpp is not project, i removed that from CMake didn't delete the file just in case
Okay, then it was bad luck that I saw one if theae remaining instances :}
@Daniel Rossberg if no matrix is displayed shouldn't we provide a way to change the transformation? Display position / rotation etc?
Transformation matrix is not having [0 0 0 1] as the last row. Why is this the case?
Sadeep Darshana said:
Daniel Rossberg if no matrix is displayed shouldn't we provide a way to change the transformation? Display position / rotation etc?
Yes, if the combination can be edited. But, editing isn't possible in general, or am I missing something?
I thought objects are movable :speechless:
In arbalest?
In BRLCAD?
In mged or Archer: Yes. But, as far as I can see, the Edit menu in arbalest has no functionality(?)
I am asking to implement the functionality
Every BRLCAD::Object should be able to move rotate and scale, aren't they?
Except the TopObjects
Top objects too ;)
I'm not sure I understand things correctly
Isn't the position, rotation and scale stored in the node tree of the parent combination?
You can move something around by giving an intermediate combination another transformation matrix - or by changing its content (points, vectors).
oh yes. That I have implemented. (you are talking about changing Ellipsoid::Center right?)
For example, the mged commands push and xpush changes the transformations from the matrices in the combinations to changes in the solids' parameters.
Sadeep Darshana said:
oh yes. That I have implemented. (you are talking about changing Ellipsoid::Center right?)
Yes, for example.
I noticed something weird when I was rotating things in Archer
Instead of the object being rotated (which should chang its parent properties) it changed the properties of its children
SO this was due to push and xpush?
Maybe not the push command itself, but a similar functionality. It's often desired that the combinations have identity transformations. This way, the solids are still at the same place if selected separate.
I'll look into this. This wouldn't be easy since math would be different for each object type. Isn't it?
Btw I implemented a dark theme and raytracing. Did not make it possible to edit any parameters relating to raytracing.
Which parameters need to be implemented for raytracing first (are there any?)?
Sadeep Darshana said:
Which parameters need to be implemented for raytracing first (are there any?)?
I recommend to stay with the background color for the moment.
ah okay
About combinations I will display the translation, scale or quaternions if the matrix is not identity. No displaying of the matrix in any case and also no editing.
Sadeep Darshana said:
I'll look into this. This wouldn't be easy since math would be different for each object type. Isn't it?
There should be functions for this in the primitives (~_xform?) They need however to be included in the C++ interface.
Let me know if about or license has to be changed. I copied the license from Archer. Also sketched something in illustrator for the icon.
You don't need to mention the mentors in the About dialog ;) Especially not in the first place.
You are the creator of Arbalest.
For now I will focus on implementing functionalities that change the object tree? Moving objects in the tree, duplicating and creating new objects
I had implemented creating last year
Without creating the application will not be complete
Since can't do anythig without a pre saved .g from archer or mged
Thanks
@Sean @Daniel Rossberg @pooh (Inderpreet Singh)
arbal1.gif
arbal2.gif
arbal3.gif
@Sadeep Darshana, do you have the exact license text from icons8.com?
https://icons8.com/vue-static/landings/pricing/icons8-license.pdf
(deleted)
"DESKTOP APPS
macOS and Windows applications should have the link to https://icons8.com in the About dialog."
This is what the website says. It is different from what is in the license agreement.
Also they have something like this,
"OPEN SOURCE
Established open source projects could get the icons for free. For you, we'll opensource the resources that you need.
By established projects we mean the Wikipedia criteria. If you have a page on Wikipedia and it's not removed for a week, you're qualified."
This is also from the website, not the formal agreement.
Well yes, this matches with my impression: Under some circumstances it is possible to use these icons - but it's preferable to avoid them. If somebody else works with your code, they won't know about the conditions.
I'll try to find alternatives
what is the legal situation for previous commits in a repository?
Sadeep Darshana said:
what is the legal situation for previous commits in a repository?
They are self-made. They are part of the BRL-CAD project.
The least thing you should do is to mention all other origins than yourself and what came from there. Do all icons8.com icons have the "icons8" prefix?
They do. I'll change them.
I meant what is the legal situation for all the icons from 3rd party sources that have already been committed to the repository by me in the previous commits.
The google material design repository is free and open. I'll use that
Sadeep Darshana said:
I meant what is the legal situation for all the icons from 3rd party sources that have already been committed to the repository by me in the previous commits.
I don't know ;) Which 3rd party sources did you used?
It's always been a bit strange to me that one can't just put a matrix over any object (comb or primitive). Probably a carryover from comgeom days, but one we really should rectify in v6.
Sadeep Darshana said:
I'll try to find alternatives
what is the legal situation for previous commits in a repository?
We do have sets of icons developed under GCI for common editing operations like scale/rotate/translate
There are also tons at https://thenounproject.com/search/?q=3D
here's some examples from the gci work, more at https://brlcad.org/gci/data/uncategorized/ if you search on "icon": Overview.png
file-1-2014-12-06T00-01-0800-mockup.png file-10-2014-12-09T03-13-0800-All-1_2.png file-1-2015-01-16T06-32-0800-allicons.png
There's bunches more .
all displayed icons are now from google material design repository (Apache license). I'll remove the unused from the repository.
It's always been a bit strange to me that one can't just put a matrix over any object (comb or primitive). Probably a carryover from comgeom days, but one we really should rectify in v6.
I can implement changing the matrix of a node in a combination. Is it recommended this be a feature?
I was thinking this was discouraged in favor of propagating rotate/scale/translate changes to the primitives via push / xpush.
@Sean
For proper editing, you really need both the ability to have matrices in the hierarchy as well as the ability to push them down
I'll also note that pushing is a relatively complex topic to do correctly in the general case without introducing xpush options for replicating geometry and detecting when a push must be prohibited (e.g., applying a non-uniform scale to a torus primitive is impossible to represent using the parameters of a torus)
But yes, in general we want to be able to apply and edit a matrix at any node in a hierarchy.
Sean said:
But yes, in general we want to be able to apply and edit a matrix at any node in a hierarchy.
I will implement this.
Is it okay to allow them to edit the 4x4 matrix directly? @Sean
Does it have to be via individual components like translate / rotation / scale?
They're stored as a homogeneous matrix
I know.
But to allow it to be as a matrix rather than individual components?
This is not something most programs allow. They allow rotating / moving / scaling but not changing a 4x4 table which is the matrix.
I'm asking should there be textboxes for x, y, z of translate (same with rotation and shear? and scale ). It will be hard since I will have to compose and decompose the matrix given translate/rotation/scale.
The editing can be constrained to rotate/scale/translate, but it's stored as a matrix
I'm asking instead of this is it okay to directly allow changing 4x4 matrix in the form of 16 text boxes through the UI
I don't think you need to allow direct editing of the matrix at this point in time... no
the problem is you're not going to reliably be able to tell what operations are encoded to display them
if you just open an existing database with matrices, for example
I mean you might be able to apply https://math.stackexchange.com/questions/237369/given-this-transformation-matrix-how-do-i-decompose-it-into-translation-rotati a large portion of the time, so maybe good enough. not sure what you'll do when it's not though.
I looked at that stackexchange post and tried to implement that. The translate sometimes was different when there was a scale.
in BRLCAD
Sean said:
I don't think you need to allow direct editing of the matrix at this point in time... no
But Sean if it's unreliable shouldn't I be giving them direct access?
I wouldn't be able to compose and decompose matrices. So the most reliable thing is to let them change the matrix directly. Wiithout taking the translate / scale/ rotation.
Sean said:
the problem is you're not going to reliably be able to tell what operations are encoded to display them
This supports the opposite of
"I don't think you need to allow direct editing of the matrix at this point in time... no"
Sadeep Darshana said:
Sean said:
I don't think you need to allow direct editing of the matrix at this point in time... no
But Sean if it's unreliable shouldn't I be giving them direct access?
It's nearly impossible to directly edit a 4x4 matrix in any meaningful way except for existing simple matrices. The ones that can be edited are trivially decomposable.
if it can't be decomposed and you support edits, that's more likely to just result in an invalid matrix
that said, you can still allow scale/translate/rotate operations ... you just might not know what the current values are
your interface could override the matrix with the values they input in that case
you can allow the edits in absolute form because they can be encoded without issue even on top of some arbitrary existing matrix.
you mean multiplying an existing matrix to apply an operation instead of [decomposing matrix->change components->compose matrix back] ?
@Sean
basically, yes
at least in the cases where you can't decompose
Okay I will do that.
How do I represent rotation for relative editing? quaternion? rotation around an axis?
maybe display an icon or something to indicate that the operation is relative or simply disallow the edits if it can't be decomposed. you have choices, just saying you'll have to figure out some plan. there's not a great answer as the editing intent is lost.
you just know it's 32, you don't know if it was 2 * 10 + 12 or 3 * 10 + 2 or 4 * 8 + 0 or ..
(oversimplified of course)
@Sean
I implemented the feature we discussed.
anim.gif
The method we discussed is not perfect since as you can see in the animation translate is applied before other operations. So relative scaling on top of the existing matrix leads to the whole object moving also. Same with rotating.
Also removed all the 3rd party icons from the repository.
@Sadeep Darshana nice work!
it won't work for primitives as they don't have any place to hang/retain the parameters, but for members of combinations, you could display this as a property panel
something like this: 30.png
or this: Scale10.jpg
that way it also becomes clear that it's the reflective absolute state being described, not the relative edit operation, so it's consistent and can be adjusted incrementally or to absolute values without needing a checkbox or other GUI clutter
here's another example how cinema4d presents it: Screen-Shot-2020-08-27-at-3.51.22-PM.png
Video from https://www.youtube.com/watch?v=lz3cjEtaXpA
This wouldn't be possible @Sean since I don't have access to the absolute values as we discussed earlier. I am merely taking the existing matrix and apply a transformation to it. I do not know the absolute Position / Rotation / Scale values of the previous (before user changes) state or after.
@Daniel Rossberg @Sean @pooh (Inderpreet Singh)
Shouldn't https://github.com/sadeepdarshana/arbalest be moved somewhere else?
absolutely!
how to proceed? we could import it or fork it .. other options?
I don't know. What do you think is the best? Can I just put the entire directory into the rt^3 repository?
Because that is where my repository has to be placed when building / running?
image.png
One possibility would be to move it to https://github.com/BRL-CAD. It is legitimate to see it as an independent program.
I hesitate to add it to rt^3, at least at the moment, and would like to wait until the main repository is moved to github. Then, it can be included in rt^3 as a submodule.
Daniel Rossberg said:
One possibility would be to move it to https://github.com/BRL-CAD. It is legitimate to see it as an independent program.
Can we proceed with this?
Sure.
anything I should do for this?
Hmm, good question. If you go to your repository, click "Settings", and go to the bottom, you come to the "Danger Zone". There you can select "Transfer ownership", but only if you can create a repository at the target. I.e., if this doesn't end with a kind of pull request at BRL-CAD, we should probably better fork it there.
It would be nice to retain all commits, however it's done.
ah, looks like this is documented: https://help.github.jp/enterprise/2.11/user/articles/transferring-a-repository-owned-by-your-personal-account/
https://github.com/sadeepdarshana/arbalest link will still be accessible isn't it (or redirected)? Because that is the one I submitted for GSoC evaluation.
"Users must have repository creation permissions within the receiving organization before they can transfer a repository that they individually own"
Will see if we can fix that since need to fix that. Need to fix it for others as well.
@Sadeep Darshana Who is kaymers? An alter ego?
I changed my computer's git email & user to the account we have for our final year project. I changed it back in github desktop. Only later I discovered it was still using the final year project account when I commit from the terminal
How do we proceed with placing the project to https://github.com/BRL-CAD?
I can't do it since I don't have the create repository permission in https://github.com/BRL-CAD
@Sean @Daniel Rossberg
I think that the best would be to fork it on ttps://github.com/BRL-CAD.
@Sadeep Darshana I got distracted/interrupted the other day working on GitHub permissions. I think the best preserving option will be for you to initiate a transfer (you will have create repository permission once I fix it) so it becomes authoritative for all and includes your entire commit history. I'm looking at the permissions now.
great
Sadeep Darshana said:
https://github.com/sadeepdarshana/arbalest link will still be accessible isn't it (or redirected)? Because that is the one I submitted for GSoC evaluation.
That should still be possible. At most, you might have to fork it back to yourself so upstream/downstream work right.
Also, the link you submitted is mostly for our benefit, but I can certainly sort things out with OSPO if needed.
@Sadeep Darshana I have to get some rest, but would you give it a try now? The default permissions should allow you to initiate the transfer once you accept the member invitation.
the steps are at https://help.github.jp/enterprise/2.11/user/articles/transferring-a-repository-owned-by-your-personal-account/
@Sean I transferred the repo. https://github.com/BRL-CAD/arbalest
The old link is working fine. It redirects to the new location.
The readme is outdated. I will update it tomorrow if possible.
@Sadeep Darshana, please have a look at https://github.com/BRL-CAD/arbalest/pull/8
merged it @Daniel Rossberg
And tested it? I was wondering why this section was in the config.
Tested. It works fine. I might have added it when I was experimenting with windows window system to remove title bar and still retain other functionalities associated with it.
@Sadeep Darshana, I created a new pull request: https://github.com/BRL-CAD/arbalest/pull/9
I could merge it by myself, but I want you to have a look at it too. For example, I removed the glm library and replaced it with Qt methods. However, was there a reason why you didn't use Qt?
I checkedout https://github.com/drossberg/arbalest. This is working fine on Windows, Visual Studio.
I didn't know Qt already had these features until the very end of the project. I used what was seeing everywhere on the internet for GL math.
I actually thought of changing them to use Qt functions once I got to know. This is great.
What do you think of my use of circular dependency? I only realized later that this was very inconvenient in C++ unlike in Java/C#. Everytime I do some change or addition in the includes of most files a lot of errors come up due to header including / forward declaration related errors etc.
To be honest, I haven't noticed the circular dependencies yet.
However, there are some more flaws in the code too. E.g., transformationMatrix in MatrixTransformationWidget.cpp is allocated on the heap but never freed. I.e., a code review is necessary anyway. But, this isn't surprising after a step in a new direction.
I've been using C++ in algorithm contests. But this is the first software I created.
@Sadeep Darshana I know it's not your primary focus, but any chance you could back-port those changes to the qged code as well?
arbalest is a very nice peace of software. I like the modern look and feel. Especially, GUI apllication source code tends to become messy if developed fast from the scratch. But, you managed to implement a new GUI concept for BRL-CAD.
@Sadeep Darshana that was your first software creation!? That's amazing. You should be very proud; I'm impressed!
Instead of backporting, it may make more sense at this point to forward-merge qged into arbalest. I'm not intimately familiar with the differences but do like the fresh physically separated architecture. They both use the same hierarchy widget now, yes? Main aspect missing I believe is the ability to invoke ged commands?
@Sadeep Darshana do you have or can you make a short 5-30 sec screencap video showcasing the GUI how it ended up by the end of GSoC? I posted one you gave me from a couple months ago, but it'd be nice to showcase the finale too. Something with an interesting hierarchical model like m35 or something downloaded..
I will create one @Sean
Sean said:
Instead of backporting, it may make more sense at this point to forward-merge qged into arbalest. I'm not intimately familiar with the differences but do like the fresh physically separated architecture. They both use the same hierarchy widget now, yes? Main aspect missing I believe is the ability to invoke ged commands?
The best way would be to implement ged commands into coreinterface and make arbalest use it, isn't it?
Sean said:
Sadeep Darshana that was your first software creation!? That's amazing. You should be very proud; I'm impressed!
First C++
The thing is, qged can integrate directly into the main BRL-CAD repo the way mged/archer do. Arbalest, as I understand it, doesn't and deliberately isn't intended to (since coreInterface also isn't intended to integrate into the main repo.)
Visually speaking, it looks like qged and arbalest have different hierarchy widgets. (qged's has an issue with newer Qt in my testing, but it's the one that sets the icons based on type and (at least when things are working properly) can do selection based highlighting of rows.)
Also not sure if things like the html based console widget, accordion widget, or docking setup have migrated?
Not really sure if they can be readily migrated to arbalest - would take some exploring - but I'd hate to lose some of those features...
On the plus side, ged_exec and friends should make exposing the GED commands much simpler...
Sadeep Darshana said:
The best way would be to implement ged commands into coreinterface and make arbalest use it, isn't it?
That's a great question. Probably as part of MOOSE (i.e. part of the larger API that includes coreInterface's OO hierarchy). It could be attached as a method on a Database object, but the GUI needs more access and control in order to automatically update views and such, so probably not there. It really begs for a stand-alone command executor interface that is hooked up to a database and has connections for getting update notifications.
starseeker said:
On the plus side, ged_exec and friends should make exposing the GED commands much simpler...
Exposing them or even just directly calling them from inside a qt console is super easy already. The question would just be whether there's any benefit to wrapping it in an OO API or whether the app should just directly manage the ged state. Somewhere someone has to keep one informed of changes from the other (e.g., delete an object in the GUI, does ged see the deletion and vice versa).
I would prefer in some ways to have callback hooks at the .g read/write layer in libg...
o.O
That's when the .g file actually changes, after all...
Right now I think we're trying to keep track of which GED commands potentially do what, which just feels wrong...
that would be weird. I get it. but it would be unusual. callbacks typically implement app logic.
Well, generate DB_WRITE events of some sort then, if we have an events or signals system apps can hook into.
I had envisioned that happening at the libged layer. After all, once it's fully abstracted, just about all that remains is an exec call, so the rest of it's role would be providing app connections
callbacks or a public/subscribe system, definitely transactions
/me has a little trouble envisioning what that would look like, at least from a migration standpoint - would all librt level calls in libged commands be replaced with transaction event generation calls?
was leaning towards an event based publish/subscribe system where invoking a command then generates a list of events and those events default to specific behaviors (i.e., what they currently do)
starseeker said:
/me has a little trouble envisioning what that would look like, at least from a migration standpoint - would all librt level calls in libged commands be replaced with transaction event generation calls?
yes, exactly. so for a command like "killall foo" could return a transaction set filled with whatever relevant "DELETE [obj]" events.
So the first step is to design the transaction set and API?
there would be a predefined set of possible events that we'd have to specify (i.e., all possible low-operations)
Would libg publish that set, or does that live at the libged level?
I saw that living at the libged level as it introduces the concept of a command and command transactions
it would have default handlers for things like KILL, MAKE, DRAW, ERASE, LIST, ... that would make the corresponding librt/libg call
OK, I think that makes sense.
As long as we don't have any situations where a command can't deduce it's transaction list without applying the previously generated transaction(s)...
I see these default handlers actually getting far more interesting and advanced than our currently ad hoc logic. for example, a command that causes a new object to get created might generate a MAKE event, and the handler for MAKE would automatically 1) do the db_lookup to make sure it doesn't already exist 2) come up with a consistent name or error if it does exist based on some policy, 3) automatically be loggable or debuggable, 4) be automatically and consistently undo-able
starseeker said:
As long as we don't have any situations where a command can't deduce it's transaction list without applying the previously generated transaction(s)...
that's a very important consideration, yes! (nice)
search -exec is what leaps to mind, but there may be others...
What to do about "commands" that are Tcl procs calling multiple GED commands is another one - do we build up all the transaction sets and then apply them at the end, or does each GED command finalize before moving on to the next one?
I think it'd be on us in how transactions are ultimately validated and processed, but I think it's very tractable as there'd still be the call that's there now (e.g., wdb_export() becomes something like ged_make() or whatever) and inside that routine it would carry the current processing state.
mind you, that processing state is a virtual environment
but from the command's perspective, it will have occurred
But, for example, a loop that does a wdb_export and then later in the loop does a db_lookup on the object it just exported - if wdb_export is a transaction not applied, the db_lookup equivalent would have to check both the .g state and play the transaction set up to that point to answer the question of what the db_lookup is actually supposed to be. Am I missing something?
so something like search -exec would be nested transactions in a parent transaction. and if you have a command like "mv a b" that does a RENAME a b event followed by a validation check to make sure b exists and a doesn't, those would likewise be updated.
starseeker said:
But, for example, a loop that does a wdb_export and then later in the loop does a db_lookup on the object it just exported - if wdb_export is a transaction not applied, the db_lookup equivalent would have to check both the .g state and play the transaction set up to that point to answer the question of what the db_lookup is actually supposed to be. Am I missing something?
we have choices here. even to make it play transactions, which is an option, we'd still have to inject ourselves somewhere in that command (e.g., replace all db_lookup with an identical ged_lookup)
Playing transactions though would get performance prohibitive as the building transaction set gets large. Don't we need another answer?
and doing that, we could also not apply transactions inside the ged_lookup but instead just keep track of changes thus far to know what objects exist and dont' exist
that would be even faster than what we currently do
as all I/O would get deferred
similarly, laying out our choices, we could do it fully passively
like what svn and git do
ged would have an inmem of the real deal, let the command actually do whatever it does to it, and then diff to determine the change events
speaking of which, gdiff already has a strong notion of what this event system should look like
as the things it can diff are akin to the events possible (at least for i/o events, there are also camera, view, and display events)
Is the transaction API what we'd then send over the capnproto channels when we go fully IPC for ged_exec execution?
Must confess that appeals as all ged commands become read-only on the .g file
that would be my hope
Would solve a whole host of issues.
would be good to survey and see if we actually have any commands that potentially rely on previous state besides search
OK, that establishes the order of implementation then - transaction API first, then IPC.
Intrinsic database viewer: Proof of concept
Steps:
const qint64 programSize
variable in the ReadFile() function in src/gui/MainWindow.cppcat arbalest db/toyjeep.g > toyjeep
chmod 755 toyjeep
However, it's only a proof of a concept, and not meant to be product ready.
Hah!
this is great, and the original idea for a standalone cad viewer that the student worked on. is this using anything from that, or from scratch?
@Sean I will prepare that gif you asked. Sorry, there were some exams and I couldn't work on that.
Sean said:
this is great, and the original idea for a standalone cad viewer that the student worked on. is this using anything from that, or from scratch?
I don't know about any outcome of this student project. My POC uses the rt_dirbuild_inmem() function I implemented this summer (from scratch) via the C++ core interface and Sadeep's arbalest.
How should I get started with https://github.com/opencax/GSoC/issues/27 ? I am able to build and run arblest.
I saw Implement the C++ core classes for the remaining primitives
but how should I get started? @Sean @Daniel Rossberg
I'd probably look at one of the existing primitives that has a name that can be easily searched (e.g., torus), find all references to it, then find a primitive that is missing (look at all the subfolders in src/librt/primitives in the brlcad repo for a listing), and work to implement it
You could also simply find a bug and fix it, you could also get qged up and running so you can compare against that, you could work on trying to make components in qged reusable in arbalest (e.g., the hierarchy view), you could also work on something unrelated to qged like setting up an interactive raytrace window, ... lots of possibilities ;)
btw rt^3 can be build and run in windows too?
I thought, you already did it(?)
I don't know how to export brlcad bin dir so that rt^3 can find and build in windows.
Daniel Rossberg said:
I thought, you already did it(?)
Done in WSL.
You need to install BRL-CAD (CMake INSTALL target). This is what rt^3 needs.
I have build BRL-CAD for windows.
In addition, you should use the CMake GUI. It tells you which paths are missing, so you can set them there. Also, have a look at the CMake output. It may give you a hint what's missing.
let me see now
Himanshu Sekhar Nayak said:
I have build BRL-CAD for windows.
But, have you installed it too?
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
I have build BRL-CAD for windows.
But, have you installed it too?
install through NIS installer or something like that I guess?
BTW, for development it's wise to install it at a directory where you don't need administration privileges.
I don't recall the name of the installer.
Himanshu Sekhar Nayak said:
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
I have build BRL-CAD for windows.
But, have you installed it too?
install through NIS installer or something like that I guess?
Install it by building the INSTALL project in Visual Studio.
On my way to INSTALL now :sweat_smile:
Daniel Rossberg said:
BTW, for development it's wise to install it at a directory where you don't need administration privileges.
Yes, it shows me the error now that it needs admin privileges.
So, set CMAKE_INSTALL_PREFIX to a directory where you can write to: Open the CMake GUI - look for CMAKE_INSTALL_PREFIX - change its value (it's a string) - configure - generate - open Visual Studio ...
You can help rt^3 CMake to find your BRL-CAD installation by setting the BRLCAD_BASE_DIR variable to its installation directory: Open the CMake GUI (for rt^3) - [+ Add Entry] with name BRLCAD_BASE_DIR and type "PATH" - set its value - configure - generate - ...
@Daniel Rossberg I added both BRLCADD_BASE_DIR and CMAKE_INSTALL_PREFIX for /bin and Qt 5.14.2 but I am getting errors.
I am getting bunch of errors related to "BRLCAD_HEADERS_DIR-NOTFOUND"
Did you check the CMake configuration? Sounds like the variable BRLCAD_HEADERS_DIR isn't set.
Daniel Rossberg said:
Did you check the CMake configuration? Sounds like the variable BRLCAD_HEADERS_DIR isn't set.
Where it should be set?
CMake GUI (for example)
I mean what path it should be set to.
include directory of your BRL-CAD installation
One thing I noticed that while installing it shows Build: 328 succeeded, 0 failed, 686 up-to-date, 0 skipped
but may be it should show around 1k succeeded ?
The number of build targets is the sum of the four numbers.
:hushed: I didn't know that.
I am getting this even if I added right paths. Screenshot-5.png
It means that
Daniel Rossberg said:
It means that
- 328 build targets were build successfully
- 0 builds had an error
- 686 build targets were already build before and are still okay
- 0 build targets were ignored
:hushed: Now I understand the meaning of these lines.
What's the path of the installed mged program?
Daniel Rossberg said:
What's the path of the installed mged program?
c/Users/Himanshu/Desktop/WindowsBRLCAD/install/bin
I.e., the installation directory is c/Users/Himanshu/Desktop/WindowsBRLCAD/install. This should be the value of BRLCADD_BASE_DIR.
btw my WindowsBRLCAd/
have brlcad/ build/ buildRT3/ install/ rt-cubed/
all the time I am thinking that bin/ should be go to dir like I had done for linux
Should I ignore this?
Found BRL-CAD at C:/Users/Himanshu/Desktop/WindowsBRLCAD/install
Configuration for 'ge'... Omitted.
Configuration for 'coreInterface'... Omitted.
Getting errors while building RT3 in vs.
2>LINK : fatal error LNK1104: cannot open file 'coreinterface.lib'
2>Done building project "tester_ci_primitives.vcxproj" -- FAILED.
In the output in the CMake GUI there should be a message regarding BRLCAD_VERSION.
Daniel Rossberg said:
In the output in the CMake GUI there should be a message regarding BRLCAD_VERSION.
Got a warning.
CMake Warning at cmake/FindBRLCAD.cmake:178 (MESSAGE):
Could not locate 'brlcad-config' - please set BRLCAD_VERSION in CMake
Call Stack (most recent call first):
CMakeLists.txt:132 (find_package)
Getting bunch of errors related to cannot open file while building in vs.
Did coreInterface
succeeded?
nope because it shows ommitted.
Did you set BRLCAD_VERSION
?
Daniel Rossberg said:
Did you set
BRLCAD_VERSION
?
What should I set to?
Himanshu Sekhar Nayak said:
Daniel Rossberg said:
Did you set
BRLCAD_VERSION
?What should I set to?
Okay it should be set to install/
but still linking errors
@Himanshu Sekhar Nayak it should get set to the version of BRL-CAD, not a path
like "7.32.5"
Sean said:
Himanshu Sekhar Nayak it should get set to the version of BRL-CAD, not a path
like "7.32.5"
should be set to where brlcad is installed right to find the version?
@Himanshu Sekhar Nayak I just pushed some changes I needed on Mac, do a git pull
you'll set BRLCAD_ROOT (or BRLCAD_BASE_DIR) and BRLCAD_VERSION ... the first is a path, the second is a version
see README and make sure you're doing similar steps or see if you missed something
hmm I had set the version to 7.32.5 but still ...
5>VectorList.obj : error LNK2019: unresolved external symbol bv_vlist_copy referenced in function "public: __cdecl BRLCAD::VectorList::VectorList(class BRLCAD::VectorList const &)" (??0VectorList@BRLCAD@@QEAA@AEBV01@@Z)
5>C:\Users\Himanshu\Desktop\WindowsBRLCAD\buildRT3\bin\coreinterface.dll : fatal error LNK1120: 1 unresolved externals
5>Done building project "coreinterface.vcxproj" -- FAILED.
Build: 14 succeeded, 3 failed, 0 up-to-date, 0 skipped
Hmm I found another too
3>Sketch.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Sphere.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Torus.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Object.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>ParabolicCylinder.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Paraboloid.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Particle.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>HyperbolicCylinder.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Hyperboloid.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>MemoryDatabase.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>NonManifoldGeometry.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>EllipticalTorus.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>FileDatabase.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>globals.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Halfspace.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Cone.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>ConstDatabase.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Database.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Ellipsoid.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>MinimalDatabase.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Arb8.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>BagOfTriangles.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Combination.obj : error LNK2001: unresolved external symbol bu_setjmp_valid
3>Pipe.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Sketch.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Sphere.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Torus.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Object.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>ParabolicCylinder.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Paraboloid.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Particle.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>HyperbolicCylinder.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Hyperboloid.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>MemoryDatabase.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>NonManifoldGeometry.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>EllipticalTorus.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>FileDatabase.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>globals.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Halfspace.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Cone.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>ConstDatabase.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Database.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Ellipsoid.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>MinimalDatabase.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Arb8.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>BagOfTriangles.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>Combination.obj : error LNK2001: unresolved external symbol bu_jmpbuf
3>ConstDatabase.obj : error LNK2001: unresolved external symbol rt_uniresource
3>ConstDatabase.obj : error LNK2001: unresolved external symbol RTG
3>NonManifoldGeometry.obj : error LNK2001: unresolved external symbol RTG
3>C:\Users\Himanshu\Desktop\WindowsBRLCAD\buildRT3\bin\ge.dll : fatal error LNK1120: 4 unresolved externals
3>Done building project "ge.vcxproj" -- FAILED.
Himanshu Sekhar Nayak said:
5>VectorList.obj : error LNK2019: unresolved external symbol bv_vlist_copy referenced in function "public: __cdecl BRLCAD::VectorList::VectorList(class BRLCAD::VectorList const &)" (??0VectorList@BRLCAD@@QEAA@AEBV01@@Z) 5>C:\Users\Himanshu\Desktop\WindowsBRLCAD\buildRT3\bin\coreinterface.dll : fatal error LNK1120: 1 unresolved externals 5>Done building project "coreinterface.vcxproj" -- FAILED.
This one got solved after I git pull and build and now 15 succeeded.
@Himanshu Sekhar Nayak so are you built now or do you ahve the bu_jmpbuf unresolved symbols issue? that's basically saying you're missing libbu from the link list or missing BU_DLL_IMPORTS during compile
Sean said:
Himanshu Sekhar Nayak so are you built now or do you ahve the bu_jmpbuf unresolved symbols issue? that's basically saying you're missing libbu from the link list or missing BU_DLL_IMPORTS during compile
I still have bu_jmpbuf
unresolved symbols issue.
BRLCAD_BU_LIBRARY
is able to find C:/Users/Himanshu/Desktop/WindowsBRLCAD/install/lib/libbu.lib
@Himanshu Sekhar Nayak I know it's a hassle, but can you try deleting your build directory, recreate it, re-run cmake, and compile again? when repeatedly rebuilding through errors, sometimes object files will get compiled with wrong settings and it can help to make sure you start fresh. The fact that bv_vlist_copy went away and bu_setjmp_valid and bu_jmpbuf remained indicates the possibility.
it'll also then be easier to inspect your log to make sure it's getting compiled... if you turn up the verbosity, we can check that BU_DLL_IMPORTS is being defined
Cleaning up the CMake cache (or removing everything what's in the build directory) and re-running CMake with BRLCAD_BASE_DIR set would be my first idea too.
Daniel Rossberg said:
Cleaning up the CMake cache (or removing everything what's in the build directory) and re-running CMake with BRLCAD_BASE_DIR set would be my first idea too.
Some of them are getting not found. Is that okay? Screenshot-7_LI.jpg
This can be okay. The rt^3 configuration may contain some outdated stuff. What does the CMake output window say? Are there warnings or some red text?
Daniel Rossberg said:
This can be okay. The rt^3 configuration may contain some outdated stuff. What does the CMake output window say? Are there warnings or some red text?
Nope, no warnings.
Some thing omitted?
Daniel Rossberg said:
Some thing omitted?
Nah, after I set BRLCAD_VERSION
to 7.32.5
then those omitted are not shown.
Then you can generate the Visual Studio files and give the build another try.
Himanshu Sekhar Nayak said:
Daniel Rossberg said:
Some thing omitted?
Nah, after I set
BRLCAD_VERSION
to7.32.5
then those omitted are not shown.
Sorry, those omitted are gone after I set right path to install
previously set to install/bin/
This is how it should be. I had never to struggle with BRLCAD_VERSION before.
I turned verbosity to normal from minimal and here is the log https://pastecode.io/s/c8ekapr4
"ge" and "geTest" failed. This is possible because they are unsupported. But, there should be a coreInterface.dll somewhere among the build results(?)
Daniel Rossberg said:
"ge" and "geTest" failed. This is possible because they are unsupported. But, there should be a coreInterface.dll somewhere among the build results(?)
https://pastecode.io/s/9szgod1f New one.
And, do you know what this output says? Did you got a coreinterface.dll somewhere?
Hint: Search for coreinterface in your log.
Daniel Rossberg said:
Hint: Search for coreinterface in your log.
5> coreinterface.vcxproj -> C:\Users\Himanshu\Desktop\Windows\buildRT3\bin\coreinterface.dll
line no 200
And, is there a C:\Users\Himanshu\Desktop\Windows\buildRT3\bin\coreinterface.dll in your file system?
BTW, there is in addition
5>Build succeeded.
5> 0 Warning(s)
5> 0 Error(s)
in your log.
Daniel Rossberg said:
And, is there a C:\Users\Himanshu\Desktop\Windows\buildRT3\bin\coreinterface.dll in your file system?
Yep, it is there.
Himanshu@Legion-5P MINGW64 ~/Desktop/Windows/buildRT3/bin
$ ls coreinterface.dll
coreinterface.dll*
Might want to double check your version if you’re using latest brlcad main. It was bumped to 7.35.7 recently.
I cloned BRLCAD latest from github
Yes but it matters when and if you’ve done a git pull and recompiled, etc. What did the summary say when you compiled brl-cad? Can also run rt and look at the usage statement for a version number.
Sean said:
Yes but it matters when and if you’ve done a git pull and recompiled, etc. What did the summary say when you compiled brl-cad? Can also run rt and look at the usage statement for a version number.
BRL-CAD Release 7.32.7 The BRL-CAD Raytracer RT
Mon, 14 Mar 2022 06:04:48 UTC, Compilation 1
Himanshu@Legion-5P
Okay yeah so make sure your rt-cubed cmake has version set to that
/me wonders what it needs the version number for…
Sean said:
/me wonders what it needs the version number for…
Same reason why there is a brlcad_version.h. But this file wasn't always part of the public API. That's why rt^3 generates its own one.
However, if the BRL-CAD installation was found, it will be generated automatically. But if the installation wasn't found, CMake and the compiler will complain about every piece which isn't configured, including the version number.
@Daniel Rossberg I am able to produce fully ray traced image by clicking on Reset the viewports and focus on the visible
button having Z-axis to 0. Screenshot-12.png
But without focusing, ray traced is not fully complete.
Also tried on havoc too without reset and focus. And it gives results same as half ray traced castele.
After reset and focus, it gives fully ray traced image. Screenshot-15.png
I have done some testing on this QVector3D imagePoint(column, h - row - 1., 0.);
changing Zpos to column
and row + column
but column
didn't work out well while row + column
works well without having to reset and focus
.
Having only column
gives Screenshot-16_LI.jpg
But row + column
gives Screenshot-17_LI.jpg
I don't know about the behavior of taking only column
and row + column
because it comes to my mind arbitrarily.
What does the Reset the viewports and focus on the visible
button? Can you call this function before the ray-trace?
Daniel Rossberg said:
What does the
Reset the viewports and focus on the visible
button? Can you call this function before the ray-trace?
Yes, it can be called before ray-trace.
It just resize the very zoomed wireframe into a smaller one I guess. Like this.... Screenshot-18.png
Okay, that's not optimal. Have you had a look at the reset routine and understood how it works?
Daniel Rossberg said:
Okay, that's not optimal. Have you had a look at the reset routine and understood how it works?
Nope. Where should I look at? Is it in RaytraceView.cpp?
Look for the code of the button and which function it refers (probable a QAction).
Daniel Rossberg said:
Look for the code of the button and which function it refers (probable a QAction).
In MainWindow.cpp resetViewports->setToolTip("Reset the viewports and focus on the visible");
in line no 652
Which slot is connected to resetViewports?
What's the type of resetViewports?
(deleted)
(deleted)
Daniel Rossberg said:
What's the type of resetViewports?
QPushButton* resetViewports = new QPushButton(menuTitleBar);
it's QPushButton *
In this case, you should learn about QPushButton :wink: E.g., how function are connected to the button actions.
Daniel Rossberg said:
In this case, you should learn about QPushButton :wink: E.g., how function are connected to the button actions.
I am taking a break due to my upcoming semester exams that is going to start from 29th March to 9th April. I hope I will not miss the deadline for sending an proposal after discussion with you and @Sean for this project.
Yes, definitely don't miss the deadline. Google has a strict no-exceptions policy for anyone that misses a deadline, no matter the reason.
Btw I found a bug that after closing .g file the Properties
and Objects
does not clear own buffers. Screenshot-23.png
because documentArea->currentIndex()
still counts Quick Start
as opened tab so it doesn't clears the Objects
and Properties
.
Desktop-2022.04.02-00.35.03.01.mp4
Another one I found that in dark theme, close is not visible. Screenshot-24_LI.jpg
There is tons of things to do :smiley:.
/me just waiting for my semester exam to complete :oh_no:
Good to see that you make progress with exploring the current development state and identifying things you want to change, extend or add.
One big difference between GCi and GSoC is that you have to make your own project plan for GSoC.
Daniel Rossberg said:
Good to see that you make progress with exploring the current development state and identifying things you want to change, extend or add.
One big difference between GCi and GSoC is that you have to make your own project plan for GSoC.
Only one subject is left and my exams will be over. Today, I started writing up the proposal and only added the personal information by following https://opencax.github.io/gsoc_guidelines.html.
Once it is over, I will write the complete proposal.
My exams got over. I am thinking to open issue in arbalest that I had spotted. Should I open the issue ?
I mean that completely depends... why or why not?
we know it's in development and has issues and room for improvement, so creating the issue if you're not going to work on it is not valuable. If you're going to create an issue to discuss and work on it, then sure.
Yeah I will work upon on those issues so I thought that I should go on and upon the issue. And also I thought that to add those issues to my proposal for addressing.
Sure that’s fine with me that way. I just don’t want to create busy work if the plan changes before it’s finalized, but if it helps you be more productive and it creates an intentional space for discussion, absolutely sounds fine
One major thing I found that I think is not implemented yet is if I create a new file and draw a primitive and close the file by clicking X without saving then the untitled tab is removed. And also if I close the main GUI app having unsaved changes then the app got closed without asking to save the file or not.
Another one I found that Help section is not showing anything.
It should show manual I think.
Btw where I can find the primitives headers in brlcad dir? Not talking about coreinterface.
Is it include/rt/primitive
? Because I found arb8.h there.
I am just trying to match if every primitive matched with coreinterface to brlcad/ so that I don't miss any primitives that is not yet implemented
The closest to a primitive header in the core BRL-CAD is include/rt/geom.h. If you are looking for the list of primitives, src/librt/primitives may contain what you are looking for. include/rt/defines.h contains the list of solid IDs.
Yeah, src/librt/primitives/table.cop has all possible entities. Just beware that some are deprecated or obsoleted. You can probably ignore hf, cline, bspline, hrt, super, just to name a few that come to mind
@Daniel Rossberg @Sean Which feature(s) I should try to implement? Like in mged there are too much options that are not found in arbalest yet. I have listed some of the feature that are not yet in arbalest which are the following:-
Alert box is missing that shows title after opening a .g file. There should be way to give title to a file? If this feature implemented then either it can be displayed in a bar which is currently showing the file path or when I hover mouse on the name of the tab . Or any suggestion?
title.jpg
The most important one I found that missing of status bar which includes angle of view, size of view, center and also changing the units. I think instead of showing file path in arbalest we can show the status bar.
statusBar.jpg
Currently Arbalest Help section is only showing Quick start . We can add a manual page which will be helpful but there is a part where it shows synopsis
which shows a command but Arbalest didn't have a command line yet.
HelpSection.jpg
Manual.png
In mged, the create section have primitives like Arbs which contains arb8, arb7... but there is no such like in arbalest. It only includes arb8 instead of Arbs section. Same applies to cone and ellipsoids. May be we should try to import those into arbalest?
shift key grips
and effects
are not in arbalest. We can add those too.There are many more features that can be implemented and many more I can explore what have been missing by comparing mged with arbalest. From above list of features, which will be important one? I am deciding to work on these and also the bugs that I have found during this GSoC. Since this is a long project, so I will write both improvements, fixes and features to arbalest.
Btw I saw this project is 350hrs so it will come to end on November 21 or September 5-12? I am little confused here.
Himanshu Sekhar Nayak said:
Btw I saw this project is 350hrs so it will come to end on November 21 or September 5-12? I am little confused here.
This depends on how many hours you want to spend per week.
Doe you prefer a 175h size?
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Btw I saw this project is 350hrs so it will come to end on November 21 or September 5-12? I am little confused here.
This depends on how many hours you want to spend per week.
Doe you prefer a 175h size?
I think I should go with 175hrs.
I am planning to propose bugs fix, add features and extend object-oriented C++ Geometry API.
I can commit 4hrs/day.
I thought 175hrs timeline will end on September while 350hrs will end on November.
So according to those timelines, I have to write development schedule too.
Database Title [/path/to/the/file.g]
. If this text is too long, you could write the title in the tab and have the file path as tool tip for it. In addition, you could have in the File menu (or somewhere else?) a Properties entry where one can set the database title.These are only small issues. Implementing only these wouldn't be enough for a GSoC project. You should look for at least one new CAD feature, like creating and modifying a pipe with the mouse. It can be something else, but you should aim for implementing a new concept for working with BRL-CAD models.
Because you plan to go with 175h, how about a small feature as placing and sizing new solids with the mouse?
Added the medium size to the project idea.
Daniel Rossberg said:
- I don't miss this alert box. In mged it signals that something happened. This shouldn't be necessary in arbalest because the GUI elements change according the opened database. An often used way to display a datasets title is to use
Database Title [/path/to/the/file.g]
. If this text is too long, you could write the title in the tab and have the file path as tool tip for it. In addition, you could have in the File menu (or somewhere else?) a Properties entry where one can set the database title.- This would create space in the status bar for something else.
- Qt comes with an own frame work for help pages. And, arbalest aims for a GUI centered user interface.
- An arb7, etc. is in fact a (special) arb8 and arbalest was implemented very straight there. It would however be very useful to be able to create the other arb# there too, ideally with mouse support to place and resize them.
- The shortcuts should adapt to what's usual for CAD or modeler applications. But, there seem indeed only few shortcuts implemented in arbalest. I.e., we would probably need more there.
- Yes, creating other arb# with mouse support to place and resize them would be a meaningful feature.
These are only small issues. Implementing only these wouldn't be enough for a GSoC project. You should look for at least one new CAD feature, like creating and modifying a pipe with the mouse. It can be something else, but you should aim for implementing a new concept for working with BRL-CAD models.Because you plan to go with 175h, how about a small feature as placing and sizing new solids with the mouse?
btw 175h can also be completed within November right?
I thought those will be new features that are missing from arbalest.
In mged, placing a new solid using mouse and resizing is there or not? I have to search for it to see how it works originally.
Himanshu Sekhar Nayak said:
I thought those will be new features that are missing from arbalest.
Yes, they are new for arbalest, but rather small and straight forward, not demonstrating a new concept for a GUI.
Himanshu Sekhar Nayak said:
In mged, placing a new solid using mouse and resizing is there or not? I have to search for it to see how it works originally.
You can look at the mged tutorial for reference. But, I don't recommend to copy it. And, don't think of mged as the original. It's rather the reference (together with archer). Arbalest want's to introduce a new way of interacting with the geometry.
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
I thought those will be new features that are missing from arbalest.
Yes, they are new for arbalest, but rather small and straight forward, not demonstrating a new concept for a GUI.
Now I remembered that using in
we are able to create shape by giving size to the parameters.
Is it like that? Instead of CUI, use mouse support to place and resize.
I will look into it in the morning. I have written down bugs that I am going to fix and also extending support for coreinterface in my proposal. Only thing that is missing is adding at least an feature. I will check it out in morning for this new feature. By far I know we can create shapes by giving size using in
which insert command.
@Daniel Rossberg I have done an example. Is it like this? Desktop-2022.04.15-21.48.06.03.mp4
This is how it works in mged. But you should not be tempted to copy from mged. Be creative!
E.g., how are other programs doing this? Some of them put handles on the objects which can be hold by the mouse and allow special actions (moving, resizing, rotating it), for example.
Mouse supported placing and sizing of new solids is one possibility for a new feature. Selecting objects with the mouse could be another. E.g., selecting an element in a ray-traced view and make it transparent, to see what's inside. Or, clicking on the model starts a ray-trace and returns a list of hits.
Be creative!!!
Daniel Rossberg said:
This is how it works in mged. But you should not be tempted to copy from mged. Be creative!
E.g., how are other programs doing this? Some of them put handles on the objects which can be hold by the mouse and allow special actions (moving, resizing, rotating it), for example.
Mouse supported placing and sizing of new solids is one possibility for a new feature. Selecting objects with the mouse could be another. E.g., selecting an element in a ray-traced view and make it transparent, to see what's inside. Or, clicking on the model starts a ray-trace and returns a list of hits.
Be creative!!!
I am thinking of one way. Like first selecting an object through mouse by selecting an specific area.
Then do operation like move and resizing.
I will post an example now.
Daniel Rossberg said:
This is how it works in mged. But you should not be tempted to copy from mged. Be creative!
E.g., how are other programs doing this? Some of them put handles on the objects which can be hold by the mouse and allow special actions (moving, resizing, rotating it), for example.
Mouse supported placing and sizing of new solids is one possibility for a new feature. Selecting objects with the mouse could be another. E.g., selecting an element in a ray-traced view and make it transparent, to see what's inside. Or, clicking on the model starts a ray-trace and returns a list of hits.
Be creative!!!
Here is an example that I have done in AutoCAD. Desktop-2022.04.15-23.01.41.04.mp4
This is a feature where we can select an object and can resize them.
I have a doubt. In rt-cubed/include/brlcad
, all primitives headers are there. Let's take Arb8.h as consider. How Arb8.h
here is different from arb8.h
found in brlcad/include/rt/primitives
? Are they same?
@Daniel Rossberg How Arb8.h is extracting object nature from arb8.h?
Did you looked into these files?
Yes
Today I added Pipe and BagOfTriangles to MainWindow.cpp to test it.
:sweat_smile: I am able to give the object name too but not able to draw on screen.
I will look later why they don't work.
Currently I am writing milestones and timeline for the project. Hopefully I will send the draft for feedback tomorrow.
I mean, opened them in and editor and read it.
I am thinking to leave the project as Long
so I will get time to research and implement the feature.
Daniel Rossberg said:
I mean, opened them in and editor and read it.
Yeah, I had opened and read the code too. I tried to look into functions of both arb8.h
and Arb8.h
.
The function names mainly describe what they are doing. From these descriptions, what do you think are the headers purpose?
Looked into functions like rt_arb_centroid(), rt_arb_calc_points(),
etc of arb8.h
and tried to match with function found in Arb8.h
like NumberOfVertices(), Point(), SetPoint()
.
And, do they match?
Daniel Rossberg said:
And, do they match?
I am not able to match it through function names. So may be I have not yet looked into .cpp files.
I thought names are not similar too. So might be anything other.
Looking at the function names should you give the answer: The headers of the core interface declare the interfaces for accessing the primitives, as expected. The headers in rt/primitives are utility functions which declare/export some useful higher level functions used ate different places in main BRL-CAD.
Daniel Rossberg said:
Looking at the function names should you give the answer: The headers of the core interface declare the interfaces for accessing the primitives, as expected. The headers in rt/primitives are utility functions which declare/export some useful higher level functions used ate different places in main BRL-CAD.
Hmm now I understand. So coreinterface still uses main BRL-CAD for some functions.
I thought it to be single one rather than extracting from main BRL-CAD.
my bad
I thought every functionality of arb8.h have to be here in Arb8.h so that it will not use even a single functionality from main BRL-CAD.
The "C++ core interface" is a thin layer on the BRL-CAD core.
Since my proposal contains gif to show some examples that can't be viewed in pdf format. So here is the docs file format draft of my proposal. I am currently uploading in gsoc website.
@Daniel Rossberg What topics I should include for this project?
saw in gsoc
BTW, the creation of arb5, arb6, tgc, etc. are implemented in the core interface. See the constructors.
Himanshu Sekhar Nayak said:
Daniel Rossberg What topics I should include for this project?
What do you mean by "topics"?
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Daniel Rossberg What topics I should include for this project?
What do you mean by "topics"?
Like is this project belongs Vision or Robotics or Cloud or Graphics or Web or Machine Learning, etc.
Choose the topics you think match best. Graphics sounds reasonable, maybe GUI too.
Himanshu Sekhar Nayak said:
Since my proposal contains gif to show some examples that can't be viewed in pdf format. So here is the docs file format draft of my proposal. I am currently uploading in gsoc website.
You should explicitly mention the program size (mdium/175h or large/350h) you apply too in your proposal.
I found that a constructor in ellipsoid.h for sph is already there and also a sphere.h is created for sph.
Are they same?
btw both have different functions in use.
Updated the document and sent proposal from gsoc website.
Himanshu Sekhar Nayak said:
Are they same?
It's a bit confusing that both Ellipsoid and Sphere handle rt_ell_internal. But, ConstDatabase::Get (in ConstDatabase.cpp) and Database::Add (in Database.cpp) tell you that Ellipsoid is a C++ handle for the database objects with ID ID_ELL (3) and Sphere is a handle for objects with ID_SPH (10).
Btw for creating a rectangle shape selection area using mouse support, I have found https://doc.qt.io/qt-5/qrubberband.html#:~:text=A%20QRubberBand%20can%20represent%20a,QRubberBand%20can%20represent%20a%20rectangle.
Currently I learnt about QDialog, signals and slots and their functions too.
https://doc.qt.io/qt-5/qrubberband.html
I found another one and it looks picking an primitive https://doc.qt.io/qt-5/qtquick3d-picking-example.html
Himanshu Sekhar Nayak said:
I found another one and it looks picking an primitive https://doc.qt.io/qt-5/qtquick3d-picking-example.html
This can give you some ideas, but the example is based on a different geometric engine and a different kind of programming (QML).
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
I found another one and it looks picking an primitive https://doc.qt.io/qt-5/qtquick3d-picking-example.html
This can give you some ideas, but the example is based on a different geometric engine and a different kind of programming (QML).
Hmm QML : JavaScript
I will look into it.
I found a bug :beetle: Opening a new tab and closing it and having Quick Start
tab opened, I am still able to create arb8
and also it shows properties and objects.
@Daniel Rossberg Can I send a pull request? I have fixed a bug that I have mentioned above. I am asking because I don't know if the actual coding should start after the project gets selected or before. But anyways I want to fix the bug :innocent: :grinning_face_with_smiling_eyes:.
Btw I have a doubt
In MainWindow.h
line no 53
// The ID of the active document.
int activeDocumentId = -1;
Here activeDocumentId
is counting number of tabs opened?
hmm for each tab, it's giving an id number?
What I found that even after new tab is closed and if Quick Start
is not closed then still activeDocumentId
is 0. So Create is able to function.
I will look into this in morning. Late night here.
Himanshu Sekhar Nayak said:
What I found that even after new tab is closed and if
Quick Start
is not closed then stillactiveDocumentId
is 0. So Create is able to function.
Same applies to Save
and Save As
too.
I have also found that after the tab is removed, the [key, value]
is not removed from the documents
which is type of unordered_map
.
@Himanshu Singh you don’t need permission to work on code or to submit pull requests
Open source is about working together as a community
Sean said:
Himanshu Singh you don’t need permission to work on code or to submit pull requests
There are two Himanshu here :open_mouth:
Oops! My apologies @Himanshu Sekhar Nayak and @Himanshu Singh
He’s not subscribed here fortunately so he won’t see the mistake
I will send a pull request to fix this bug.
Done testing. I will push the code in the morning. Late night here. :night:
I have send the pull request with new issue. Also I will work on another patch to fix status bar.
I pushed a new commit @Daniel Rossberg.
@Daniel Rossberg I don't know if these functions like Relative scale, move, rotate are actually working or not? I didn't find any during testing. Is these are the functions that we are talking about to implement like move and scale?
I found one
QMenu* editMenu = menuTitleBar->addMenu(tr("&Edit"));
QAction* relativeMoveAct = new QAction("Relative move selected object", this);
relativeMoveAct->setStatusTip(tr("Relative move selected object. Top objects cannot be moved."));
connect(relativeMoveAct, &QAction::triggered, this, [this](){
if (activeDocumentId == -1) return;
if (documents[activeDocumentId]->getObjectTreeWidget()->currentItem() == nullptr) return;
int objectId = documents[activeDocumentId]->getObjectTreeWidget()->currentItem()->data(0, Qt::UserRole).toInt();
MatrixTransformWidget * matrixTransformWidget = new MatrixTransformWidget(documents[activeDocumentId],objectId, MatrixTransformWidget::Translate);
});
editMenu->addAction(relativeMoveAct);
btw @Sean Have you looked into my proposal :sweat_smile: ? I am just curios if you have seen it or not. I had shown to Daniel. btw pdf doesn't show the gifs but here is the doc file that shows gifs proposal
Himanshu Sekhar Nayak said:
Daniel Rossberg I don't know if these functions like Relative scale, move, rotate are actually working or not? I didn't find any during testing. Is these are the functions that we are talking about to implement like move and scale?
You need a combination to use these functions. The transformation matrix is put into the object tree. But, I didn't found a way to confirm the input values :thinking:
Himanshu Sekhar Nayak said:
btw Sean Have you looked into my proposal :sweat_smile: ? I am just curios if you have seen it or not. I had shown to Daniel. btw pdf doesn't show the gifs but here is the doc file that shows gifs proposal
Yes, I definitely had seen and read it! I think it looks good and like the focus on GUI interaction.
Opened a new issue https://github.com/BRL-CAD/arbalest/issues/15
(deleted)
(deleted)
I would expect the patch to be small ;)
Daniel Rossberg said:
I would expect the patch to be small :wink:
:sweat_smile: I will make the changes that you have asked for in my next commit. Also I saw inconsistency in code style too in the project. Should I follow any code style for this project?
Not yet. If there would be stylistic changes necessary, it's better to have an own patch for them.
/me learning Models of Qt
Finished Models and learnt QStringListModel, QFileSystemModel, QStandardItemModel with List, Table and Tree View and also know how the models are sync and extract data from a model. :grinning:
The rt-cubed version uses the BRL-CAD libraries from the main installation during runtime while MOOSE doesn't. Sounds interesting. How I forgot about this :sad: ?
@Himanshu Sekhar Nayak that's one of the more compelling aspects of the arbalest architecture, honestly. It's built strictly on top so there's no cheating or lazy coding even possible. It requires calling through API, properly layered and isolated. It's cool.
MOOSE is a generalization of the Windows brlcad.dll. The goal is to get a shard library containing the complete BRL-CAD core, which can be distributed easily with all supported systems. In addition, it shall not be a "hack" but cleanly build based on a normal BRL-CAD installation.
May be next time, this project will appear in gsoc? Anyways, I am interested for it. I will look into it in future.
@Himanshu Sekhar Nayak "this project" meaning what? working on MOOSE?
It would be interesting to port arbalest to MOOSE. This would avoid hacking rt-cubed, for example. This port would consist mainly in some renaming (e.g. header paths).
Sean said:
Himanshu Sekhar Nayak "this project" meaning what? working on MOOSE?
Yep, working on MOOSE.
Daniel Rossberg said:
It would be interesting to port arbalest to MOOSE. This would avoid hacking rt-cubed, for example. This port would consist mainly in some renaming (e.g. header paths).
So MOOSE will be independent and once it get's installed and compiled and it will never look back to libraries during runtime what rt-cubed does.
MOOSE is liked with the static BRL-CAD libraries.
That's cool I think and it will be faster in terms of performance right?
That's an interesting nuanced perspective (static).. I hadn't really conceptualized it in terms of static vs dynamic. I think of it as clean C++ API on top of the C libs (i.e., rt^3) but compiled in a separate space so it can't reach into non-public API.
Himanshu Sekhar Nayak said:
That's cool I think and it will be faster in terms of performance right?
Potentially yes, but it looks like that the overhead of having multiple dynamic bindings should not be overrated.
I doubt performance will be a distinguishing feature, but yes it does put less burden on program start-up time as the linker doesn't have to resolve symbols.
There's also a different memory footprint, as the dynamic linker will often not load until something is actually needed. So there's a tradeoff that will have different implications for different app needs.
Sean said:
There's also a different memory footprint, as the dynamic linker will often not load until something is actually needed. So there's a tradeoff that will have different implications for different app needs.
That's true, dynamic linker will not load until needed.
Sean said:
That's an interesting nuanced perspective (static).. I hadn't really conceptualized it in terms of static vs dynamic. I think of it as clean C++ API on top of the C libs (i.e., rt^3) but compiled in a separate space so it can't reach into non-public API.
One possible application in mind was the BRL-CAD backend for Freecad. They may have stronger requirements regarding their libraries (like Linux standard base).
@Daniel Rossberg https://github.com/BRL-CAD/arbalest/pull/13#discussion_r870764258 What you think about this?
So how should I proceed?
@Himanshu Sekhar Nayak for most, this is the time to get fully set up and familiarized with the code and community, so you have an advantage there -- you're already familiar. Your mentor may have other setup tasks in mind, but one bit of setup that'd be useful would be compiling the latest brlcad repo with Qt enabled, familiarize yourself with how it's different. That way, you'd be able to at least be aware what is going on in those Qt modules that are being developed for other GUI integrations, and what's going on in Arbalest.
Okay, I think I should clean up my workspace and build brlcad & arbalest again. Btw I saw that previous year students maintained a log for each day work. So should I do that this year too?
Sean said:
Himanshu Sekhar Nayak for most, this is the time to get fully set up and familiarized with the code and community, so you have an advantage there -- you're already familiar. Your mentor may have other setup tasks in mind, but one bit of setup that'd be useful would be compiling the latest brlcad repo with Qt enabled, familiarize yourself with how it's different. That way, you'd be able to at least be aware what is going on in those Qt modules that are being developed for other GUI integrations, and what's going on in Arbalest.
According to our checklist: Yes, please.
You daily log will be a very useful, informal way of communication. It can tell me, if I need to become active, for example.
Daniel Rossberg said:
According to our checklist: Yes, please.
You daily log will be a very useful, informal way of communication. It can tell me, if I need to become active, for example.
Blogger is fine for that? Or I should choose any?
And, regarding your pull request, I made a comment to your code.
Daniel Rossberg said:
And, regarding your pull request, I made a comment to your code.
I can't see the comment. You commented now?
Btw I already added a commit 4 days ago.
Himanshu Sekhar Nayak said:
Blogger is fine for that? Or I should choose any?
You can choose the solution you like most. However, one possibility is to create an account for the BRL-CAD wiki and have the blog there under your user page.
Himanshu Sekhar Nayak said:
I can't see the comment. You commented now?
No, it was 2 or 3 days before, regarding your last commit.
I can see my comment at the bottom of the "Conversation" tab, for example.
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
I can't see the comment. You commented now?
No, it was 2 or 3 days before, regarding your last commit.
I forgot to inform you that I had added a commit.
I saw your commit, and commented it :)
Daniel Rossberg said:
I saw your commit, and commented it :smile:
Yep I saw it and added a commit. How's about the recent commit that I had sent?
https://github.com/BRL-CAD/arbalest/pull/13#issuecomment-1132499183
And, this is the last thing you see at Conversation?
Daniel Rossberg said:
And, this is the last thing you see at Conversation?
Yep, my comment is the last one with a commit above comment.
Btw I had to add my project here ? https://brlcad.org/wiki/Google_Summer_of_Code/2022
Can you see it now?
Daniel Rossberg said:
Can you see it now?
Yes, now I got the notification.
It was a "review" before. Now, I added it as "single comment". (I can't remember to had this option the day before :thinking:)
I now added two more commits.
Hmm, then you have to change line 811 (807) too. The point in my code example was, that I mad two distinct if-clauses:
if (displayGrid != nullptr) {
if (displayGrid->getDocument()->getDocumentId() != activeDocumentId) {
The outer if tests if it's a BRL-CAD database or not. If it's not, and if it wasn't reset yet (activeDocument = -1), then reset it now.
Ahh... Why I am so in hurry ...... :oh_no:
Daniel Rossberg said:
The outer if tests if it's a BRL-CAD database or not. If it's not, and if it wasn't reset yet (activeDocument = -1), then reset it now.
Added new commit.
I see :grinning:
I'll test it tomorrow, but this should do it.
I am going to search for library for mouse events that I am going to apply and will inform you.
Himanshu Sekhar Nayak said:
Btw I had to add my project here ? https://brlcad.org/wiki/Google_Summer_of_Code/2022
And should I add?
Ah, yes.
@Himanshu Sekhar Nayak yes, please add yourself to the wiki page. thank you for stubbing the new year too.
My Workspace is ready. Freshly built and ran arbalest. :cowboy:
I updated my wiki page https://brlcad.org/wiki/Google_Summer_of_Code/2022#New_BRL-CAD_GUI and also started updating my dev log from today.
Btw arbalest don't have .ui file?
That's Qt's xml configuration when you make the GUI using their tool right?
Yep, that's right. I can't find one.
Yes, that's to be expected. It wasn't designed using the GUI tool.
We didn't want to use the code generator. I'm also in doubt that what Himanshu did can be created with the Composer.
Daniel Rossberg said:
We didn't want to use the code generator. I'm also in doubt that what Himanshu did can be created with the Composer.
Composer? What is it?
Sorry, you are right, it's called Qt Creator.
Created a pr https://github.com/BRL-CAD/arbalest/pull/16 @Daniel Rossberg
Updated my dev log and also raised an issue https://github.com/BRL-CAD/arbalest/issues/17
Can https://github.com/BRL-CAD/arbalest/issues/15 be closed?
(deleted)(Posted in Project site topic)
Daniel Rossberg said:
Can https://github.com/BRL-CAD/arbalest/issues/15 be closed?
Nope, it is not fixed yet. Properties docks are not visible while switching tabs.
@Daniel Rossberg Arbalest have special tool bar?
btw should I add those icons to the menubar?
but these icons are in black color and doesn't suit with violet.
probably white icons can help?
I am thinking to remove QPushButton
completely in tool bar area and only keep DisplayGrid
and Viewports
.
But still there will be duplicate code for DisplayGrid
and ViewPorts
. One thing can be done like keep QPushButton
and remove QAction
for DisplayGrid
and ViewPorts
. It looks good and helpful too.
Himanshu Sekhar Nayak said:
Daniel Rossberg Arbalest have special tool bar?
The usual way would be to use a QToolBar object, e.g. from QMainWidget::addToolBar(). But, arbalest uses a QFrame with a QVBoxLayout for this purpose.
You can assign an action to a QToolButton via setDefaultAction().
Instead of using QPushButton, we can shift to QToolButton.
So we have QToolBar and QVBoxLayout.
I will look into it and will compare what will be best.
I think, it's worth to give QToolButton a try. And of course, it need a different icon.
Btw QVBoxLayout is like having items downward fashion right?
Like this Screenshot-2022-05-30-224015.png
Right, the V is for vertical, QHBoxLayout (QHBoxWidget) is the horizontal one.
Daniel Rossberg said:
I think, it's worth to give QToolButton a try. And of course, it need a different icon.
Previous night, I was trying that QToolButton
. And I agree that once QAction
object for New
is created then it can be used by QToolButton
too right?
I would expect it. The documentation and the Internet says it...
Yep, I was searching on it and saw we can assign QAction to QToolButton.
I have a doubt regarding GSoC timelines.
My dashboard shows september is the final deadline submission.
It should be November right? Or google will extend it in future?
So, you want Final Submission End Date: Monday, November 21
?
Created a new PR https://github.com/BRL-CAD/arbalest/pull/19
@Daniel Rossberg Ahh... what a fool I used view in for all icons.
$Color-IconFile : #430086;
$Color-IconView : #0d7088;
$Color-IconRaytrace : #cf041b;
It can easily been overseen. I realized the different colors when I put the old and new version side-by-side, and looked for the reason.
Daniel Rossberg said:
It can easily been overseen. I realized the different colors when I put the old and new version side-by-side, and looked for the reason.
Now it looks like this after I made changes. Screenshot-2022-06-02-223204.png
BTW, this method could be a way to recolor the icons for the menu too. Something like $Color-MenuIcon: #ffffff;
.
So we are adding icons to menu items?
You could also have Color-MenuIconFile, Color-MenuIconView, and Color-MenuIconRaytrace. Try it out!
Himanshu Sekhar Nayak said:
So we are adding icons to menu items?
By adding the icon to the action.
I will start my work from 6th June because I have an entrance exam on 4th June and tomorrow I will be travelling to a different state because the test center is not available where I live now.
I will test it out and will update the pr.
Have a good trip!
@Daniel Rossberg Are we planning to add icons to QAction
open, new, .... same like that I had done for QToolButton
? I am bit confused to add icons to the menu or inside menu items?
Opened a new pr https://github.com/BRL-CAD/arbalest/pull/20
Himanshu Sekhar Nayak said:
Daniel Rossberg Are we planning to add icons to
QAction
open, new, .... same like that I had done forQToolButton
? I am bit confused to add icons to the menu or inside menu items?
I would give QAction::setIcon()
a try. With an appropriate $Color-
, of course.
Added a new commit to the pr.
@Daniel Rossberg To create a toggle button for ToggleGrid
, I saw that using QCheckBox
and adding icons ON/OFF
we can do it. But I think we can achieve same using QToolButton by using QToolButton::pressed
and QToolButton::released
too.
I created a new pr https://github.com/BRL-CAD/arbalest/pull/21. We can remove the color if you don't like it.
I'm having a busy week. I hope to be able to test them at the weekend.
No problem, take your time. :cowboy:
@Daniel Rossberg Added a new pr and found some problems too. https://github.com/BRL-CAD/arbalest/pull/22
Should I add space? Screenshot-68.png
Seems like a good idea for readability
I haven't yet tried QAction::setCheckable()
. Will do it now.
After I add isCheckable to true. But the color shows Screenshot-2022-06-13-225345.png
how this color is set?
I can't find.
I don't really know what you mean. I'm just testing it, and something strange happens. But, the QToolButton now has definitely a checked state.
Daniel Rossberg said:
I don't really know what you mean. I'm just testing it, and something strange happens. But, the QToolButton now has definitely a checked state.
I removed setCheckable(true);
from toggleGrid
and added back to toggleGridAct->setCheckable(true);
. Also I commented out connect that I have added in my pr. Then I run the program and click on that button and it becomes green.
I can't find where this color property is set.
Maybe, it's a default behavior. Can you control it with your #toolbarButton:checked { background-color: "$Color-ButtonHoverMask"; }
line?
Nope.
Already tested it out but nothing I can see the result.
Yes it may be a default behaviour.
BTW, on my computer (Linux) the icon disappears and is replaced by the tool tip text. But, this text shows a nice toggle behavior.
Well, something you can test out tomorrow.
I will test it and will you tell you if something I find. :computer:
@Daniel Rossberg I found that the icon becomes green due to the icon that I had set for QAction
in toogleGridAct
. So when I click on the tool button of toggle grid, it swaps with the color that had been set for icon in QAction.
So I commented out setIcon
of QToolButton
for toggleGrid
and ran the program. I found that the the setIcon
for QAction is acting default for QToolButton too. The icon for QAction is already there for QToolButton too which means setDefaultAction
is playing a part here.
So one now I am proposing that if we set icons for QAction
for all items in menu bar then the icons will be already be present for QToolButton
too. Should we do that?
Hmm, not sure if it helps, but it may good to know: Look at the documentation of QIcon. You can set there multiple pixmaps for multiple purposes. I.e., in Qt an icon isn't just one image.
Himanshu Sekhar Nayak said:
So one now I am proposing that if we set icons for
QAction
for all items in menu bar then the icons will be already be present forQToolButton
too. Should we do that?
For View and Raytrace this could work, but for File?
(deleted)
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
So one now I am proposing that if we set icons for
QAction
for all items in menu bar then the icons will be already be present forQToolButton
too. Should we do that?For View and Raytrace this could work, but for File?
Hmm the icons that I have added for QAction for files of items in menu bar will not suit the color to fit in tool bar area, I think.
I am taking a day off today.
I have commented out all setIcon
for QToolButton
and let them behave according to setDefaultAction
and it looks this. Screenshot-2022-06-16-205231.png
For files the color is not suitable and looks not good.
Therefore, which color do you propose?
I haven't decided it yet. I have to choose a color that will best fit in menu bar and in tool bar too. I am now looking into it.
Pushed a new commit regarding that and solved merge conflicts.
And now it looks like this. check.png
I chosen a color which both suits light and dark areas.
I also found a way that is mentioned in docs too. https://doc.qt.io/qt-6/qicon.html#making-classes-that-use-qicon
@Daniel Rossberg Is there any closeEvent()
? So that we can handle close successfully like when we close we can see if a document is opened or not and also it is saved or not.
I found there is no closeEvent()
.
It should check if current document is edited and not saved then the closeEvent() should notify to save it or close it, like that.
Btw what event propagation
in qt really do? I only came to know through by writing an example if I have two classes ParentButton
and ChildButton
. ParentButton
inherits QPushButton
and ChildButton
inherits ParentButton
. In ParentButton
class I have added an override function name ParentButton::mousePressEvent(QMouseEvent *event)
and inside this function definition I called QPushButton::mousePressEvent(event);
while in 'ChildButton' class I have added ChildButton::mousePressEvent(QMouseEvent *event)
and inside this function definition I have added ParentButton::mousePressEvent(event);
.
Then in widget.cpp
I wrote
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
ChildButton *button {new ChildButton(this)};
button->setText("Child Button");
connect(button, &ChildButton::clicked, [=](){
qDebug() << "Button clicked";
});
ui->verticalLayout->addWidget(button);
}
And when I run this program I can clearly see the output of the program using qDegug()
Child button mousePressEvent called
Parent button mousePressEvent called
Button clicked
But if I comment out ParentButton::mousePressEvent(event);
then connect doesn't work. Why? Slot doesn't respond it. Why?
Ultimately this ChildButton
is not going to work if I comment it out.
Created a new commit where I selected a suitable color for both light and dark theme.
btw where I should start looking for to add mouse support using qt? Any references?
Currently I am looking to mouse events.
Himanshu Sekhar Nayak said:
Daniel Rossberg Is there any
closeEvent()
? So that we can handle close successfully like when we close we can see if a document is opened or not and also it is saved or not.
The QWidget class has a protected function closeEvent()
which can be redefined to handle close events correctly.
While testing your latest version of #21 I learned that it's not a good idea to have the same colors for the menu and tool buttons. However, you can give an own color to the tool buttons with setIcon
.
Then, I saw that a light color looks good in the menus, as long as you don't touch it with a mouse. Then, the background color changes to white. This can be handled by code like this:
QIcon newActIcon;
newActIcon.addPixmap(QPixmap::fromImage(coloredIcon(":/icons/sharp_note_add_black_48dp.png", "$Color-MenuText")), QIcon::Normal);
newActIcon.addPixmap(QPixmap::fromImage(coloredIcon(":/icons/sharp_note_add_black_48dp.png", "$Color-Menu")), QIcon::Active);
newAct->setIcon(newActIcon);
As I already said, in Qt an icon isn't just one image.
Himanshu Sekhar Nayak said:
btw where I should start looking for to add mouse support using qt? Any references?
You probably have to reimplement one or more of QWidget's protected mouse~Event()
functions.
Daniel Rossberg said:
While testing your latest version of #21 I learned that it's not a good idea to have the same colors for the menu and tool buttons. However, you can give an own color to the tool buttons with
setIcon
.Then, I saw that a light color looks good in the menus, as long as you don't touch it with a mouse. Then, the background color changes to white. This can be handled by code like this:
QIcon newActIcon; newActIcon.addPixmap(QPixmap::fromImage(coloredIcon(":/icons/sharp_note_add_black_48dp.png", "$Color-MenuText")), QIcon::Normal); newActIcon.addPixmap(QPixmap::fromImage(coloredIcon(":/icons/sharp_note_add_black_48dp.png", "$Color-Menu")), QIcon::Active); newAct->setIcon(newActIcon);
As I already said, in Qt an icon isn't just one image.
I saw something like that https://doc.qt.io/qt-6/qicon.html#making-classes-that-use-qicon.
(deleted)
Pushed new commit to #21. For now I have only made changes to menubar of file items and added two new icons. Next I will for view icons in menu bar. Then similarly I will add rest changes to toolbar area.
Btw should I mention or credit the icons that I use for arbalest? Those icons I used are free.
Found a bug. After closing the tab. The toolbutton are no longer there. Here what is missing. Screenshot-73.png
The toolbutton supposed to be there right even after there is no tabs or documents open?
MainWindow::tabCloseRequested(const int i)
and MainWindow::closeButtonPressed()
are not handled if a document is open and there is unsaved changes. And closing the tab should open a dialog and ask to save it. Save goes for closeButtonPressed
if the whole application is going to be closed then it should check if there any unsaved changes that are not saved yet.
Is there gonna be any difference if we should use closeEvent()
instead of closeButtonPressed()
? We can override closeEvent and add the implementation on how to handle the close if there are any unsaved changes?
Pushed a commit where I added Save As
to toolbutton and added icons for rest of toolbuttons. Only thing broken is toolGridButton
. Because it should behave as pressed if a document is open and the background color should become grey but for now without any document open, it can turn grey if it is in pressed state.
Will work on it tomorrow.
I have upcoming exams from 27-29 June. I may not contribute during those days. I will resume from 29 June.
I just saw https://doc.qt.io/qt-6/qaction.html#qaction-in-widget-applications and thought to give something like that to our code. Btw how it looks:
QIcon newActIcon;
newActIcon.addPixmap(QPixmap::fromImage(coloredIcon(":/icons/sharp_note_add_black_48dp.png", "$Color-MenuIconFile")), QIcon::Normal);
newActIcon.addPixmap(QPixmap::fromImage(coloredIcon(":/icons/sharp_note_add_black_48dp.png", "$Color-Menu")), QIcon::Active);
QAction* newAct = new QAction(newActIcon, tr("&New"), this);
newAct->setShortcuts(QKeySequence::New);
newAct->setStatusTip(tr("New .g file"));
connect(newAct, &QAction::triggered, this, &MainWindow::newFile);
fileMenu->addAction(newAct);
Everything looks same. Only thing is that I directly passed it to the constructor instead of setIcon
but looks clean. @Daniel Rossberg
Btw I implemented toggle feature for QAction *toggleGridAct
like this and it's working simultaneously with toggleGridButton
too. Here is a look:
connect(toggleGridAct, &QAction::triggered, this, [=](){
if (toggleGridAct->isChecked()) {
if (activeDocumentId == -1) {
toggleGridAct->setChecked(false);
return;
}
}
documents[activeDocumentId]->getDisplayGrid()->getActiveDisplay()->gridEnabled =
!documents[activeDocumentId]->getDisplayGrid()->getActiveDisplay()->gridEnabled;
documents[activeDocumentId]->getDisplayGrid()->getActiveDisplay()->forceRerenderFrame();
});
Himanshu Sekhar Nayak said:
Btw should I mention or credit the icons that I use for arbalest? Those icons I used are free.
Did you read their license? https://icons8.com/license They require to be mentioned. The full text of their license agreement requires at least two links. In addition, free accounts are for personal use only. I.e., icons8 looks like a no go to me.
Himanshu Sekhar Nayak said:
MainWindow::tabCloseRequested(const int i)
andMainWindow::closeButtonPressed()
are not handled if a document is open and there is unsaved changes. And closing the tab should open a dialog and ask to save it. Save goes forcloseButtonPressed
if the whole application is going to be closed then it should check if there any unsaved changes that are not saved yet.
MainWindow is a QMainWindow, which doesn't have a tabCloseRequested() method. I.e., if you implement one, it will never be called (you don't overwrite the default one because there is no such function). Only QTabBar and QTabWidget have tabCloseRequested() methods.
For catching closing of the application look at the Qt documentation at QWidget::closeEvent():
void MainWindow::closeEvent(QCloseEvent *event)
{
if (maybeSave()) {
writeSettings();
event->accept();
} else {
event->ignore();
}
}
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Btw should I mention or credit the icons that I use for arbalest? Those icons I used are free.
Did you read their license? https://icons8.com/license They require to be mentioned. The full text of their license agreement requires at least two links. In addition, free accounts are for personal use only. I.e., icons8 looks like a no go to me.
Okay, I will look for better options for icons which supports open source license.
@Sean Do we have icon sets? I looked at https://brlcad.org/gci/, but could find CAD specific icons only, nothing for load/save/new document/etc..
@Daniel Rossberg yes and no. I have some of the icon sets summarized at https://brlcad.org/design/ under 'icons' for app and web. I only uploaded the overviews, but the complete data sets are under gci/data. There's also a fair bit of GUI concepts under https://brlcad.org/design/gui/ including a few new ones I recently added from 2017 gci. They should all be fair game.
Here are a handful of good open source icon repositories I've come across:
https://fonts.google.com/icons (apache)
https://remixicon.com (apache)
https://iconoir.com (mit)
https://materialdesignicons.com (mostly apache, see https://github.com/Templarian/MaterialDesign)
https://icons.mono.company (mit)
https://feathericons.com (mit)
Thanks @Sean for the resources. Btw I like the icons provided by Google.
Btw I pushed a new commit too.
What does the Apache licence there say? What do we have to do to fulfill it?
@Daniel Rossberg Looks like we have to add the LICENSE and NOTICE file in our arbalest if we are adding those icons. https://www.apache.org/licenses/LICENSE-2.0
Not exactly. They write "If the Work includes a "NOTICE" text file...". Arbalest does not. But, the License file should be updated. And maybe mentioned which files are under Apache 2.0 license.
In the brlcad repo, we store a copy of each license in doc/legal so they’re included in distributions
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
yyyy
- 2022 and what about [name of copyright owner]
? Is it brlcad? And this will be written to arbalest LICENSE right?
So far the file menu now looks like this in light theme:
Screenshot-2022-07-01-001151.png
Started working on closeEvent()
. Btw I pushed some commits too related to shortcut key.
I found that even if the file is saved and I try to save, the program is saving the contents even if there is no new changes to the file.
Instead of saving it, it should stop because there is no new changes to the file.
I have found similar one https://doc.qt.io/qt-6/qtwidgets-mainwindows-application-example.html but Qt already have isModified()
to check if there is unsaved changed which is a part of QLineEdit
.
Added initial prototypes https://github.com/BRL-CAD/arbalest/pull/23. I converted this pr to draft because it is still in work in progress.
Himanshu Sekhar Nayak said:
I have found similar one https://doc.qt.io/qt-6/qtwidgets-mainwindows-application-example.html but Qt already have
isModified()
to check if there is unsaved changed which is a part ofQLineEdit
.
That's the point: How do you know if the database was modified? You won't get it for free.
Looks likes this is a feature too like mouse feature.
Okay for now I have some things to do before I start implementing save feature.
Free memory as soon as I close the tab instead of eating up all memory even if the tabs are already closed through GUI. The current scenario of this thing is that in unordered_map
all documents are destroyed after the application is closed. Instead of this, we should free memory as soon as the tab gets closed.
Currently I don't how the data is being saved in database. By far I only came to know how a file is currently saving the data:
bool MainWindow::saveFile(const QString& filePath) {
return documents[activeDocumentId]->getDatabase()->Save(filePath.toUtf8().data());
}
I need to know how getDatabase()->Save(filePath.toUtf8().data())
is actually being saved in a database. I have found Database.h
and MemoryDatabase.h
and need to see how this working on to save a file. Without knowing how these are working, I can't know what to do for unsaved changes.
isModified()
to check if the document have any unsaved changes like this:bool MainWindow::saveFile(const QString& filePath) {
if (!isModified()) {
return false;
}
return documents[activeDocumentId]->getDatabase()->Save(filePath.toUtf8().data());
}
Taking day off today for tomorrow's one and only entrance examination.
Something like this. You need a flag, which tells you if the database was modified. Any modifying function had to set it, and save() (for example) has to reset it.
Ideally, the save button isn't available, if the database wasn't modified.
Working on to free memory as soon as the tab gets closed.
Added new PR https://github.com/BRL-CAD/arbalest/pull/24
Great to see progress in Arbalest. Let me know if I can help you with anything.
Sadeep Darshana said:
Great to see progress in Arbalest. Let me know if I can help you with anything.
Thanks @Sadeep Darshana, I am currently looking into how to save the unsaved changes of a .g file.
@Sadeep Darshana How's about the icons that are added? https://github.com/BRL-CAD/arbalest/pull/21
@Sadeep Darshana Meanwhile also have a look here https://github.com/BRL-CAD/arbalest/issues/15. So far I am able to know that after selecting an object from object tree, documents[activeDocumentId]->getProperties()->bindObject(objectId);
helps in creating properties and show values. But if I switched to other document where the object is already selected then it doesn't show the properties. Either it is not visible or something idk?
@Daniel Rossberg while closing tabs, the memory is being freed. But I saw in task manager and also in vs while debugging but it doesn't show the memory being reduced of what it is being allocated. Is that right way to see?
The memory assigned to the process can stay the same, if only a small amount is freed (which is the case for the empty in-memory database in your tests). The memory is kept in store by the C library memory management.
@Daniel Rossberg okay looks like I found what have been causing this problem for switching tabs where it doesn't show properties
of the selected object from objects
docks.
In Properties.cpp
line 28 void Properties::bindObject(const int objectId) {}
where it sets the values for properties. Here is the function:
void Properties::bindObject(const int objectId) {
this->fullPath = document.getObjectTree()->getFullPathMap()[objectId];
this->name = fullPath.split("/").last();
fullPathWidget->setText(QString(fullPath).replace("/"," / "));
static BRLCAD::Object* object = nullptr;
delete object;
object = document.getDatabase()->Get(fullPath.toUtf8().data());
objectType = QString(object->Type());
static TypeSpecificProperties * current = nullptr;
delete current;
current = new TypeSpecificProperties(document, object, objectId);
typeSpecificPropertiesArea->addWidget(current);
QString nameType = "<font color='$Color-PropertiesObjectNameText'>"+name+"</font><font color='$Color-DefaultFontColor'> ( "
"<font color='$Color-PropertiesObjectTypeText'>"+breakStringAtCaps(objectType)+"</font><font color='$Color-DefaultFontColor'> )";
nameWidget->setText(Globals::theme->process(nameType));
}
Here BRLCAD::Object* object
stores the values of the selected object of the current document and if I switched to another tab or document then object
still stores the values of the previous selected object from objects dock.
Main Problem lies here:
static TypeSpecificProperties * current = nullptr;
delete current;
current = new TypeSpecificProperties(document, object, objectId);
typeSpecificPropertiesArea->addWidget(current);
Since it is static so it only retains the values when bindObject
is called for an selected object from Objects dock.
Nice. It looks like you found the cause. Next, you need an idea of how to fix this. :smile:
Daniel Rossberg said:
Nice. It looks like you found the cause. Next, you need an idea of how to fix this. :smile:
Fixed. Here is the PR: https://github.com/BRL-CAD/arbalest/pull/25
Also I updated my dev log. You can have a look. https://brlcad.org/wiki/User:H1manshu/GSoC2022/Log#Dev_Log
Btw, in meantime I added toggle option for grid.
https://github.com/BRL-CAD/arbalest/pull/21/commits/da58ba2b8056e942fc4bea5d646fb237c5c01df9
@Daniel Rossberg BTW, I wrote some prototype code which I think will be enough to handle if documents are unsaved but now I can start looking how to detect if a file has unsaved changes. You can have a look: https://paste.ofcode.org/PTbXARvTBQLqJt8WpiH2Ue
Also pushed commits to the draft pr: https://github.com/BRL-CAD/arbalest/pull/23
Himanshu Sekhar Nayak said:
Daniel Rossberg BTW, I wrote some prototype code which I think will be enough to handle if documents are unsaved but now I can start looking how to detect if a file has unsaved changes. You can have a look: https://paste.ofcode.org/PTbXARvTBQLqJt8WpiH2Ue
I started with looking at the logic: In maybeSave() you iterate over the open files, but in closeEvent(), you call saveAsFileDialog(), which saves the active document only, which may even be unmodified. This doesn't look right.
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Daniel Rossberg BTW, I wrote some prototype code which I think will be enough to handle if documents are unsaved but now I can start looking how to detect if a file has unsaved changes. You can have a look: https://paste.ofcode.org/PTbXARvTBQLqJt8WpiH2Ue
I started with looking at the logic: In maybeSave() you iterate over the open files, but in closeEvent(), you call saveAsFileDialog(), which saves the active document only, which may even be unmodified. This doesn't look right.
I only completed maybeSave()
but never looked to saveAsFileDialog()
which is used in closeEvent()
. I wrote saveAsFileDialog()
when I had not implemented maybeSave()
and hadn't thought about it so more.
Btw, here is the new commit I added https://github.com/BRL-CAD/arbalest/pull/23/commits/f7a782f8aa58ae15ee1f9dac7c704a7d249dbc19
Hmm, where is the "save file" there? Think about the desired behavior first! How should this feature work?
BTW, don't make it too complicated, e.g. by having two buttons for not saving.
Why not QMessageBox::question()?
@Daniel Rossberg What will be the behavior if the user press cancel for unsaved changes? 1. Close the application 2. Don't close the application and allow user to modify the document ?
Added new commit but I don't know what I should do for if the user press cancel.
You need 3 buttons: "save", "don't save", and "abort". The first one saves the document and proceeds to the next one. The second doesn't save and proceeds to the next one. The last one aborts the procedure and arbalest won't close.
During execution I got some warnings.
QObject::connect: No such signal QAction::QAction::triggered() in C:\Users\Himanshu\Desktop\Workspace\rt-cubed\src\arbalest\src\gui\MainWindow.cpp:124
QObject::connect: No such signal QAction::QAction::triggered() in C:\Users\Himanshu\Desktop\Workspace\rt-cubed\src\arbalest\src\gui\MainWindow.cpp:133
Currently,
124 connect(saveAct, SIGNAL(QAction::triggered()), this, SLOT(MainWindow::saveFileDefaultPath()));
133 connect(saveAsAct, SIGNAL(QAction::triggered()), this, SLOT(MainWindow::saveAsFileDialog()));
Btw should I ignore these? Btw I solved using,
124 connect(saveAct, SIGNAL(triggered()), this, SLOT(saveFileDefaultPath()));
133 connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAsFileDialog()));
@Daniel Rossberg but it is less informative I think?
It depneds, if you are using the SIGNAL and SLOT macros or not. I.e., connect(saveAct, &QAction::triggered, this, &MainWindow::saveFileDefaultPath);
should work too (using function pointers).
And no, you shouldn't ignore these warnings ;)
@Daniel Rossberg I got something when I am searching in stack overflow.
/me Today's lesson is: do not overload your signals and slots in Qt!
I used signal and slot macros since there are overloading functions.
Btw I added three buttons but from user's perspective there should be abort button or cancel?
Found here https://stackoverflow.com/questions/16794695/connecting-overloaded-signals-and-slots-in-qt-5
What I found that we can use static_cast
and qOverload
too.
But qOverload
requires Qt 5.7
Or, you could give the save file functions different names.
Himanshu Sekhar Nayak said:
Btw I added three buttons but from user's perspective there should be abort button or cancel?
I would say "Cancel".
Daniel Rossberg said:
Or, you could give the save file functions different names.
Or we can use static_cast
?
You can work around this with static_cast or avoid it with not using same function names. It's your choice.
Here is the new commit where I changed function names and added cancel instead of abort. https://github.com/BRL-CAD/arbalest/pull/23/commits/848d414236677926b378fcc9bdd9504b70fe112a
Opened a new issue where ray trace is able to function even if there is nothing in document.
https://github.com/BRL-CAD/arbalest/issues/27
@Daniel Rossberg Should we use ConstDatabase
for sure? I saw it is for read-only. https://brlcad.org/wiki/BRL-CAD%27s_core_C%2B%2B_interface
? Where? Arbalest is for modifying databases too. However, MemoryDatabase
is derived from Database
, which is derived from ConstDatabase
. I.e., if you want to return a database handle, where you can be sure that the receiver isn't able to modify it, you can declare it as ConstDatabase
.
I made some progress by changing it to BRLCAD::ConstDatabase
and still there are some conversion left to remove all errors reported during conversion.
During conversion, I visited back to the article and saw it is for read-only.
Anyways, I understood now.
You mean Document::getDatabase()
?
yup
That should be possible: By changing the return type to ConstDatabase
you make sure that the calling function cannot modify it.
It follows the usual const - non-const logic: If a function requires a const value, you can put in a non-const too, but not vice versa.
documents[activeDocumentId]->getDatabase()->Add(*object);
Since there is no Add()
in ConstDatabase
and also for Save
. Should I add those to ConstDatabase
class?
Definitely No! A const value cannot be modified. Didn't you know?
But, you can add an Add()
and Save()
method to the Document
class, which take care for the modified flag.
Daniel Rossberg said:
Definitely No! A const value cannot be modified. Didn't you know?
But, you can add an
Add()
andSave()
method to theDocument
class, which take care for the modified flag.
Okay I will add those to Document
class.
We can add the LICENSE to the about window.
There is already a license statement in the about window, but it won't use the content of the LICENSE file (automatically).
Added license to aboutwindow.cpp https://github.com/BRL-CAD/arbalest/pull/28
@Daniel Rossberg Made some progress by adding Add
and Save
to Document
and publicly inherited Database
to Document
because rt_wdb* m_wdbp;
in Database
is used in Add
and Save
. So moving Add
and Save
to Document
to make sure it works.
But some of the problems that arises:
C++ object of abstract class type Document is not allowed: pure virtual function BRLCAD::Database::Load has no overrider
So looks like we have to override Load
in Document
.
torus->Internal()
is not accessible. Need a fix for that.I'm not sure what you are doing there. The Document class has a member variable database which is a BRLCAD::Database.
Daniel Rossberg said:
I'm not sure what you are doing there. The Document class has a member variable database which is a BRLCAD::Database.
BRLCAD::MemoryDatabase *database;
This one?
I added Add
and Save
to Document.
bool Add(const BRLCAD::Object& object);
bool Save(const char* fileName);
OK, that should be easy.
But Add
throws errors related to m_wdbp
is not defined. So I inherited BRLCAD::Database
to Document
so that it will be visible.
??? What's your code?
paste your Document::Add() method here
Daniel Rossberg said:
??? What's your code?
Well, why not
bool Document::Add(const BRLCAD::Object& object) {
return database->Add(object);
}
?
Ahhh that's also good :frowning:
I am thinking too much
You see :grinning_face_with_smiling_eyes:
However, my code isn't perfect yet. Why?
However, probably good enough.
Daniel Rossberg said:
However, my code isn't perfect yet. Why?
Okay I added those what you have suggested. May be database is here of MemoryDatabase
and we need type of ConstDatabase
to make sure calling function do not modify it?
No, that's not it. Add()
modifies the database. That's its purpose. ConstDatabase
cannot have an add.
The reason for my doubt was that the code doesn't contain a check for NULL. But, Document
won't work without a correct initialized database
member. I.e., with a NULL database we won't get so far to call Add()
.
However, you should set the modified flag there, if you have it.
Opened a new issue https://github.com/BRL-CAD/arbalest/issues/29
closed the issue since this is from other branch.
@Daniel Rossberg Here is the complete PR and also I have added new function saveFileId
and tested all edge cases to make sure it works without breaking the program. You can test the PR now to see if any other changes are required to add.
Also I made sure that saveFile()
should not save file unnecessarily if there is no modification in the document and tested it too.
Opened two new issues during debugging that I saw. https://github.com/BRL-CAD/arbalest/issues/31, https://github.com/BRL-CAD/arbalest/issues/30
One thing that I missed is that we have implemented maybeSave()
for application close and we missed for if a document is going to close then it should also for unsaved changes.
And what buttons we should expect for one single document if there are any unsaved changes and going to be closed? Like Save
, Discard
or Don't Save
and Cancel
.
Pushed a new commit where it checks if there is any object in the document before it start to ray trace.
@Daniel Rossberg Changing assert(alreadyThere == true);
to assert(!alreadyThere);
doesn't throw error and works fine while changing the properties of Arb8.
This issue https://github.com/BRL-CAD/arbalest/issues/26
Where did you found the assert(alreadyThere == true);
? However, this doesn't look right. For me, the issue looks like something which should be catched in the GUI.
Daniel Rossberg said:
Where did you found the
assert(alreadyThere == true);
? However, this doesn't look right. For me, the issue looks like something which should be catched in the GUI.
In rt-cubed/src/coreInterface/Arb8.cpp
line number 335
Are you sure? https://github.com/BRL-CAD/rt-cubed/blob/main/src/coreInterface/Arb8.cpp#L335
Mine is showing assert(alreadyThere == true);
Revert your change?
Well, if it is different from GitHub, somebody must have changed it locally on your computer...
We found this error while I was sharing my screen with you.
May be my fault but idk.
You should ask git about what it knows about this file.
I restored the file now.
Made some changes to the quit message box https://github.com/BRL-CAD/arbalest/pull/23/commits/ae730b8b53e84a6274793779561bb36a1a698a15
Huge progress @Himanshu Sekhar Nayak, loving it! Could you maybe capture a 1min video showcasing some of the changes you worked on since starting? Even if it's just you clicking around (with or without audio), I think it'd be really helpful to see the current state of the interface from your hands.
Sure. I will do it in today's morning.
@Daniel Rossberg @Sean Feature.mp4 Hope you will like it. :sweat_smile:
@Daniel Rossberg I am thinking to refactor maybeSave ()
so that tabCloseRequested()
can also pass documentId
to maybeSave()
Regarding more mouse actions, here an idea: This can be handled by moving the event filter stuff (see MainWindow::eventFilter()
) in an own class hierarchy. I.e. having a base class for all the actions
class MouseAction : public QObject {
Q_OBJECT
public:
virtual ~MouseAction(void);
signals:
void Done(MouseAction* myself);
protected:
QObject* m_watched;
MouseAction(QObject* watched,
...);
virtual bool QObject::eventFilter(QObject *watched,
QEvent *event);
private slots:
void WatchedDestroyed(QObject* watched);
};
and derive the specific actions from it
class ZoomInMouseAction : public MouseAction {};
class ZoomOutMouseAction : public MouseAction {};
class RotateMouseAction : public MouseAction {};
class MoveMouseAction : public MouseAction {};
...
They have to be instantiated if the corresponding button was pressed
MainWindow::MainWindow() : m_mouseAction(0) {}
void MainWindow::XButtonAction(void) {
if (m_mouseAction != nullptr)
delete m_mouseAction;
m_mouseAction = new XMouseAction();
installEventFilter(m_mouseAction);
}
(All code here has to be considered as pseudo-code. All names are arbitrary.)
Himanshu Sekhar Nayak said:
Daniel Rossberg I am thinking to refactor
maybeSave ()
so thattabCloseRequested()
can also passdocumentId
tomaybeSave()
Yep, this sounds good.
I am taking day off for tomorrow and will start working from Sunday.
@Daniel Rossberg Added default parameter cancel
to maybeSave()
. Also I have added blue color to the heading of the dialog box text. See if you like it. Capture.PNG
@Daniel Rossberg changing BRLCAD::MemoryDatabase
to BRLCAD::ConstDatabase
have some points that I have noted which are:
getBRLCADObject()
in Utils.h
so I have modified to only 2 args:inline void getBRLCADObject(BRLCAD::MemoryDatabase *database, const QString& objectName,const std::function<void(BRLCAD::Object&)>& func){
BRLCADObjectCallback callback(func);
database->Get(objectName.toUtf8(), callback);
}
Now
inline void getBRLCADObject(BRLCAD::ConstDatabase *database, const QString& objectName){
database->Get(objectName.toUtf8());
}
Since class BRLCADObjectCallback
inherits BRLCAD::Database::ObjectCallback
where virtual void operator()(const Object& object) = 0;
it is a pure virtual function and it has been override in class BRLCADObjectCallback
. But what I have changed works with no more errors. Only problem is that to keep const std::function<void(BRLCAD::Object&)>& func
or not but I saw it has been used as lambda function.
Well, this call-back function isbthe whole point on getBRLCADObject(). You version does nothing now. How about moving the getBRLCADObject() to the Document class and setting the modified flag there?
@Daniel Rossberg Moved getBRLCADObject()
inside Document
class and the problem is that database->Get()
not accepting BRLCADObjectCallback
object because it inherits BRLCAD::Database::ObjectCallback
. So I modified to BRLCAD::ConstDatabase::ObjectCallback
and override the () operator where the arg for () is const BRLCAD::Object& object
. Now it accepts but main problem is:
inline explicit BRLCADObjectCallback(std::function<void(BRLCAD::Object&)> func): func(std::move(func)){}
So I added const here too and also where it is declared privately. But now it is leading to more const errors.
Severity Code Description Project File Line Suppression State
Error C2664 'void getBRLCADObject(BRLCAD::ConstDatabase *,const QString &,std::function<void (const BRLCAD::Object &)> &)': cannot convert argument 3 from 'TypeSpecificProperties::{ctor}::<lambda_ea01135dc03223a24fd587b78eff7e6e>::()::<lambda_26663c7c4cc71b05277346cda6946773>' to 'std::function<void (const BRLCAD::Object &)> &' arbalest C:\Users\Himanshu\Desktop\Workspace\rt-cubed\src\arbalest\src\gui\TypeSpecificProperties.cpp 61
I will dig more tomorrow.
Hmm, at first glance, it doesn't look good. Why doesn't database->Get()
accept a BRLCAD::Database::ObjectCallback
object?
This is exactly what we have in Utils.h, line 55 - 58.
Daniel Rossberg said:
Hmm, at first glance, it doesn't look good. Why doesn't
database->Get()
accept aBRLCAD::Database::ObjectCallback
object?
It was accepting but when I changed to ConstDatabase
for getDatabase()
then the problem occurs.
So I modified to ConstDatabase
from MemoryDatabase
in getBRLCADObject()
Then database->Get(objectName.toUtf8(), callback);
didn't work for ConstDatabase
.
Himanshu Sekhar Nayak said:
Daniel Rossberg said:
Hmm, at first glance, it doesn't look good. Why doesn't
database->Get()
accept aBRLCAD::Database::ObjectCallback
object?It was accepting but when I changed to
ConstDatabase
forgetDatabase()
then the problem occurs.
??? Can you please show me your code?
BRLCAD::ConstDatabase* getDatabase() const
{
return database;
}
inline void getBRLCADObject(BRLCAD::ConstDatabase *database, const QString& objectName,const std::function<void(BRLCAD::Object&)>& func){
BRLCADObjectCallback callback(func);
database->Get(objectName.toUtf8(), callback);
}
Didn't you want to move getBRLCADObject() to the Document class?
I have shifted but still same issue.
That's the point: You have not. There is no Document::getBRLCADObject() method.
Working on it.
@Daniel Rossberg In TypeSpecificProperties.cpp
we can see in line 60-69:
connect(hasColorCheck,&QCheckBox::stateChanged,[this,objectId](int newState){
getBRLCADObject(this->document.getDatabase(),this->document.getObjectTree()->getFullPathMap()[objectId],[newState](BRLCAD::Object &object){
if(newState == Qt::CheckState::Checked){
dynamic_cast<BRLCAD::Combination&>(object).SetHasColor(true);
}
else {
dynamic_cast<BRLCAD::Combination&>(object).SetHasColor(false);
}
});
});
but how we are going to instantiate a Document class to access getBRLCADObject in lambda function and document class has no default constructor?
oops
I found that
We need to capture document object in a capture list so that it can access getBRLCADObject
void Document::getBRLCADObject(const QString& objectName,const std::function<void(BRLCAD::Object&)>& func) {
BRLCADObjectCallback callback(func);
database->Get(objectName.toUtf8(), callback);
modified = true;
}
and
connect(hasColorCheck,&QCheckBox::stateChanged,[this,objectId](int newState){
this->document.getBRLCADObject(this->document.getObjectTree()->getFullPathMap()[objectId],[newState](BRLCAD::Object &object){
if(newState == Qt::CheckState::Checked){
dynamic_cast<BRLCAD::Combination&>(object).SetHasColor(true);
}
else {
dynamic_cast<BRLCAD::Combination&>(object).SetHasColor(false);
}
});
});
Here is a patch Changes-On-3068ee.patch
Himanshu Sekhar Nayak said:
We need to capture document object in a capture list so that it can access getBRLCADObject
Noob here and how on earth I am not able to see there is already a document object. :grimacing:
Okay modified to ConstDatabase that I have forgot.
Okay. Doers it work? Can you add this to your PR #23?
Daniel Rossberg said:
Okay. Doers it work? Can you add this to your PR #23?
Nope. I am still getting error for database->Get()
Severity Code Description Project File Line Suppression State
Error C2665 'BRLCAD::ConstDatabase::Get': none of the 2 overloads could convert all the argument types arbalest C:\Users\Himanshu\Desktop\Workspace\rt-cubed\src\arbalest\src\Document.cpp 90
Get()
not accepting callback
of BRLCADObjectCallback
even if it inherits from BRLCAD::Database::ObjectCallback
Should we modify it to BRLCAD::ConstDatabase::ObjectCallback
and override
inline void operator()(const BRLCAD::Object& object) override {
func(object);
}
No, we need the BRLCAD::Database::ObjectCallback
. Only this can modify the object. However, did you noticed the modified = true;
in my code example?
Daniel Rossberg said:
No, we need the
BRLCAD::Database::ObjectCallback
. Only this can modify the object. However, did you noticed themodified = true;
in my code example?
Yes, saw now.
@Daniel Rossberg Added new commit https://github.com/BRL-CAD/arbalest/pull/23/commits/cbd3b5c57b62c0840a140a2cd8505fe0b0d3c568
Completed https://github.com/BRL-CAD/arbalest/pull/23 you can check
@Daniel Rossberg Do we need this line anymore? Line 77 src/gui/MatrixTransformWidget.cpp
document->modifyObjectNoSet(document->getObjectTree()->getParent()[childObjectId]);
I removed this line after removing modifyObjectNoSet()
.
Yes and no. The purpose of this function is to mark objects as changed for redrawing (geometryRenderer
). This should however done more automatically whenever modified = true
is set.
So this function redraws geometryRenderer
No. Who redraws?
geometryRenderer->refreshForVisibilityAndSolidChanges();
this one
This function works if the user selected relative scale or move or rotate and then it refresh the screen with new ones?
Well, somehow the geometryRenderer
instance :wink:
It gets the changed objects known (geometryRenderer->clearObject(objectId)
) and does a refresh at the end (geometryRenderer->refreshForVisibilityAndSolidChanges()
).
I have added a base class to start with mouse action and will add more mouse action derived classes. Meanwhile, I also found two issues which leads to crash of program.
BTW, we can't have object names empty. right?
this things crash the program
We can have a check if the user press ok and with string and then proceed otherwise if the user press cancel then no need to proceed. Otherwise this problem crash the program.
Just checking the C++ interface. One point is that every object has a IsValid()
method. This should check the name as well, but does it for a few types only :thinking:
BTW, where does it crash?
Daniel Rossberg said:
BTW, where does it crash?
Do not provide any name to the object of any primitive and in Object dock you can see there is a object with no name and try to click on it which leads to crash of the program.
That's the "how to reproduce". But it was helpful too. The "where" is src/gui/Properties.cpp:33. object
is probably invalid.
Daniel Rossberg said:
Just checking the C++ interface. One point is that every object has a
IsValid()
method. This should check the name as well, but does it for a few types only :thinking:
I can't find IsValid()
in arbalest.
It's not used there. It is a method of BRLCAD::Object, which checks if the object is okay.
This one virtual bool IsValid(void) const = 0;
inside Object.h
.
Yes. It's implemented in the derived classes.
Daniel Rossberg said:
Yes. It's implemented in the derived classes.
For every primitive right?
/me going for dinner now
Well, now: yes. But wasn't before.
@Daniel Rossberg I am thinking to do implement something like this.
bool ok;
QString name = QInputDialog::getText(this,tr("Object Name"), tr("Enter object name"), QLineEdit::Normal, "", &ok);
if (ok && !name.isEmpty()) {
object->SetName(name.toUtf8());
}
else {
return;
}
Hmm, without any feedback to the user?
QInputDialog::getText() is used 11 times in MainWindow. I.e., you should think about writing a function for it. How shall this function look like? It needs somehow two results: The new name and a flag if "Cancel" was hit. In this case, no primitive should be created.
Daniel Rossberg said:
Hmm, without any feedback to the user?
QInputDialog::getText() is used 11 times in MainWindow. I.e., you should think about writing a function for it. How shall this function look like? It needs somehow two results: The new name and a flag if "Cancel" was hit. In this case, no primitive should be created.
So what I have thought like is that ....
ok
without giving names then it should prompt to enter name.You may need this function at other places too, e.g. to change an object name. Therefore, putting it at Utils?
@Daniel Rossberg Changes-On-0e7832.patch I have done something like this but I have not added feedback to the user.
Prompt a messagebox to the user?
Something like: If Cancel was pressed, then isValidObjectName() returns false. If name is invalid, show a message box and run QInputDialog::getText() again.
BTW, isValidObjectName() is a bad function name, because it doesn't describe what this function does. getObjectNameFromUser() would be better.
Here is the pr: https://github.com/BRL-CAD/arbalest/pull/36 @Daniel Rossberg
https://github.com/BRL-CAD/arbalest/issues/35 BTW, different primitives having same name is not a good idea, I think?
That's right. The objects are uniquely referenced by their names.
Daniel Rossberg said:
That's right. The objects are uniquely referenced by their names.
Then I should leave it as it is.
Or, the check for correct object names needs an additional criterion.
Daniel Rossberg said:
Or, the check for correct object names needs an additional criterion.
Hmm good :idea:.
Check if there exist an object name already then re-prompt to enter a new object name apart from previous one.
The ConstDatabase::Get() searches for an object with a given name. If it found something, the call-back will be called.
Daniel Rossberg said:
The ConstDatabase::Get() searches for an object with a given name. If it found something, the call-back will be called.
Hmm saw now. Get()
accepts objectName
.
@Daniel Rossberg Here is a patch that I have worked on for prompting a message box if an object is already present. But strange that I have to do forward declarations for some class to make it work. Changes-On-5af3e2.patch
I will start now with mouse functionality.
Himanshu Sekhar Nayak said:
Daniel Rossberg Here is a patch that I have worked on for prompting a message box if an object is already present. But strange that I have to do forward declarations for some class to make it work. Changes-On-5af3e2.patch
Hmm, the "else if" can be true even if cancel was hitted (!ok). You should test for cancel first (if (!ok) break;) and do the other tests after.
@Daniel Rossberg Changes-On-5af3e2.patch Here is the patch.
Here is the better one Changes-On-5af3e2.patch
What was the base for this patch? I get errors when trying to apply it to the main repository master version.
Daniel Rossberg said:
What was the base for this patch? I get errors when trying to apply it to the main repository master version.
This one 5af3e220900988671c4f4f8d66c2ac5ab88ff1b6
This id is from fixEmptyObjectName
branch
Okay, I'll check this PR first.
Ahh, I see...
:thinking:
I think, you can add your patch to this PR.
okay, I will send a commit now.
Got it :smile:
Done :cowboy:
BTW, yesterday I started implementing mouse actions feature.
For now I have came across one derived class DragWindowMouseAction
This class can override the eventFilter()
of MouseAction
which defines if we drag the menu bar or title bar then the window should move.
First virtual bool QObject::eventFilter(QObject* watched, QEvent* event) = 0;
I should make it pure virtual then override in derived class.
If we look into definition of eventFilter()
bool MainWindow::eventFilter(QObject *watched, QEvent *event)
{
static QPoint dragPosition{};
if (watched == menuTitleBar)
{
if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
if (mouse_event->button() == Qt::LeftButton)
{
dragPosition = mouse_event->globalPos() - frameGeometry().topLeft();
return false;
}
}
else if (event->type() == QEvent::MouseMove)
{
QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
if (mouse_event->buttons() & Qt::LeftButton)
{
if(isMaximized()) return false;//showNormal();
//todo showNormal when dragged
move(mouse_event->globalPos() - dragPosition);
return false;
}
}
}
return false;
}
Here is a variable menuTitleBar
which is part of MainWindow.h
You could make MouseAction::eventFilter()
pure virtual, but not QObject::eventFilter()
. However, it isn't necessary.
oops
I forgot to add MouseAction::eventFilter()
At the end, DragWindowMouseAction::eventFilter()
should become what MainWindow::eventFilter()
is now.
So what we should prefer? MouseAction::eventFilter()
or QObject::eventFilter()
?
You should not touch QObject::eventFilter()
, but MouseAction
is derived from QObject
and its eventFilter()
method overwrites the one of QObject
.
Ahh, I understand now :grinning:
I am on that path. Started implementing the DragWindowMouseAction::eventFilter()
Btw, how DragWindowMouseAction::eventFilter()
will access menuTitleBar
? Inherit MainWindow
?
If this class needs additional information, you can add them to its constructor.
Ahh, yes, there is a cycle.
PR #36 looks good, but I want to have another quiet think about it.
In meantime, I will primarily focus on the mouse feature now. Will do #36 if anything more needed.
@Daniel Rossberg Updated https://github.com/BRL-CAD/arbalest/pull/36
removed header file cycle inclusion and conditional operator
Here is a patch for the drag window mouse action Changes-On-d8477a.patch
But I can't figure out the about the slot which will call the signal. Like what would be the definition of the slot WatchedDestroyed()
Oops I missed menuTitleBar->installEventFilter(m_mouseAction);
inside DragWindowButtonAction()
Himanshu Sekhar Nayak said:
Here is a patch for the drag window mouse action Changes-On-d8477a.patch
Is there a reason why you don't do this on github?
What's the purpose of MainWindow::DragWindowButtonAction()
? See, I proposed a Done()
signal for the mouse actions. This allows to switch back to a default action when something was done. E.g., suppose there is an object selection action. When activated, you can click on an object, and the action returns its path - and emits "Done". You can react on this signal by switching back to the default drag mouse action.
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Here is a patch for the drag window mouse action Changes-On-d8477a.patch
Is there a reason why you don't do this on github?
I thought to make the PR clean and neat. Okay from next time I will do that.
@Daniel Rossberg Added DragWindowMouseAction
class https://github.com/BRL-CAD/arbalest/pull/33/commits/0ac9e7f1d4fe64883afce0679bff3e6d85e1d905
Resolved @Daniel Rossberg https://github.com/BRL-CAD/arbalest/pull/33/commits/1bbfdb2971e0c30ca5cee16fed8cbcae411de387
Hey @Himanshu Sekhar Nayak I just compiled up the latest sources to test things out and am getting a crash on Mac -- have you seen this?
Process: arbalest [70465]
Path: /Users/USER/*/arbalest
Identifier: arbalest
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [41634]
Responsible: Terminal [580]
User ID: 501
Date/Time: 2022-09-22 17:13:35.659 -0400
OS Version: macOS 11.7 (20G817)
Report Version: 12
Anonymous UUID: 4FB272B2-CD88-8DB1-34BA-D8168CF2DAA1
Time Awake Since Boot: 77000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000560
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [70465]
VM Regions Near 0x560:
-->
__TEXT 10db60000-10dc10000 [ 704K] r-x/r-x SM=COW /Users/*
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libGL.dylib 0x00007fff6beee245 glMaterialfv + 20
1 arbalest 0x000000010dba6e1f DisplayManager::setFGColor(float, float, float, float) + 367
2 arbalest 0x000000010dba6c97 DisplayManager::DisplayManager(Display&) + 119
3 arbalest 0x000000010dba6e7d DisplayManager::DisplayManager(Display&) + 29
4 arbalest 0x000000010dba4207 Display::Display(Document*) + 263
5 arbalest 0x000000010dba447d Display::Display(Document*) + 29
6 arbalest 0x000000010dbdc227 DisplayGrid::DisplayGrid(Document*) + 519
7 arbalest 0x000000010dbdc8fd DisplayGrid::DisplayGrid(Document*) + 29
8 arbalest 0x000000010db84490 Document::Document(int, QString const*) + 720
9 arbalest 0x000000010db845d3 Document::Document(int, QString const*) + 35
10 arbalest 0x000000010db6cbf6 MainWindow::openFile(QString const&) + 102
11 arbalest 0x000000010db6da32 MainWindow::openFileDialog() + 210
12 arbalest 0x000000010db7739b QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (MainWindow::*)()>::call(void (MainWindow::*)(), MainWindow*, void**) + 123
13 arbalest 0x000000010db772dd void QtPrivate::FunctionPointer<void (MainWindow::*)()>::call<QtPrivate::List<>, void>(void (MainWindow::*)(), MainWindow*, void**) + 77
14 arbalest 0x000000010db771d2 QtPrivate::QSlotObject<void (MainWindow::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) + 146
15 org.qt-project.QtCore 0x000000010eaf88a4 0x10e8e1000 + 2193572
16 org.qt-project.QtWidgets 0x000000010dd617d6 QAction::activate(QAction::ActionEvent) + 310
17 org.qt-project.QtCore 0x000000010eaf0c19 QObject::event(QEvent*) + 745
18 org.qt-project.QtWidgets 0x000000010dd6ada6 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 262
19 org.qt-project.QtWidgets 0x000000010dd6c160 QApplication::notify(QObject*, QEvent*) + 480
20 org.qt-project.QtCore 0x000000010eac7ff7 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 167
21 org.qt-project.QtCore 0x000000010eac9108 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 792
22 libqcocoa.dylib 0x0000000113c8a698 0x113c4f000 + 243352
23 libqcocoa.dylib 0x0000000113c8adb8 0x113c4f000 + 245176
24 com.apple.CoreFoundation 0x00007fff208d5d2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25 com.apple.CoreFoundation 0x00007fff208d5c94 __CFRunLoopDoSource0 + 180
26 com.apple.CoreFoundation 0x00007fff208d5a14 __CFRunLoopDoSources0 + 242
27 com.apple.CoreFoundation 0x00007fff208d443c __CFRunLoopRun + 893
28 com.apple.CoreFoundation 0x00007fff208d39fc CFRunLoopRunSpecific + 563
29 com.apple.HIToolbox 0x00007fff28b1d1f3 RunCurrentEventLoopInMode + 292
30 com.apple.HIToolbox 0x00007fff28b1ce26 ReceiveNextEventCommon + 284
31 com.apple.HIToolbox 0x00007fff28b1ccf3 _BlockUntilNextEventMatchingListInModeWithFilter + 70
32 com.apple.AppKit 0x00007fff230dcb12 _DPSNextEvent + 864
33 com.apple.AppKit 0x00007fff230db2e5 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1364
34 com.apple.AppKit 0x00007fff230cd609 -[NSApplication run] + 586
35 libqcocoa.dylib 0x0000000113c89a6a 0x113c4f000 + 240234
36 org.qt-project.QtCore 0x000000010eac45e7 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 471
37 org.qt-project.QtCore 0x000000010eac8592 QCoreApplication::exec() + 130
38 arbalest 0x000000010db82afa main + 90
39 libdyld.dylib 0x00007fff207f8f3d start + 1
Basically it's crashing if I open an existing .g file. This is not on any specific branch, and probably isn't related to anything anyone has done recently. Seems to be OpenGL-related, not the right data it's expecting?
tried a variety of .g files, seems consistent
@Sean Mine working fine in windows. Not sure why it is failing in mac. Looks like a segmentation fault issue.
@Daniel Rossberg Updated https://github.com/BRL-CAD/arbalest/pull/33/commits/2fa6a37a1315c4bf8c2b6d62a02477f7c8fba879
@Sean I opened three .g files found in rt-cubed/src/arbalest/extra/db
and it opens fine.
I opened these three and I am able to view it toogoliath.g m35.g moss.g
Also I am able to open other .g files from brlcad share/db
@Himanshu Sekhar Nayak thanks for checking -- looking at the stack trace, I'd guess it's a piece of invalid data that is being ignored on linux/windows, but mac opengl driver does not like. that 0x0000000580 looks like data. I'm going to try stepping in the debugger to see which param that is.
I think there's some initialization order issue. If I comment out the DisplayManager() constructor's two lines that make gl calls, it works. So presumably opengl is not yet initialized at the time of construction.
@Daniel Rossberg Does we actually need to show these child objects in properties tab too? Screenshot-83.png
Is there a keybinding to get it out of the default fullscreen or resize the window? On mac, I can't seem to minimize it which makes it impossible to get to the Desktop while the app is running.
I'm also seeing some bug where the wireframe only displays in the bottom left...
Here's the first issue (no means to windowfy or minimize): Screen-Shot-2022-09-24-at-10.34.33-AM.png
Here's the second issue:
Screen-Shot-2022-09-24-at-10.36.58-AM.png
Screen-Shot-2022-09-24-at-10.37.36-AM.png
Wow a strange bug that is hiding for mac. @Sean can you upload the .g file that you have tested with?
I will test it out in windows in morning.
Sean said:
Is there a keybinding to get it out of the default fullscreen or resize the window? On mac, I can't seem to minimize it which makes it impossible to get to the Desktop while the app is running.
This is probably caused by the Qt::FramelessWindowHint
flag. For the sake of a modern look, the system menu was eliminated and, at least with Windows and KDE, replaced by the main window's menu bar. On these systems, the minimize/maximize/exit icons are however still there.
Sean said:
I'm also seeing some bug where the wireframe only displays in the bottom left...
A screen resolution (retina disply) issue? Qt has Qt::AA_EnableHighDpiScaling and Qt::AA_DisableHighDpiScaling flags, but not for macOS? See also https://doc.qt.io/qt-5/highdpi.html#macos-and-ios
Himanshu Sekhar Nayak said:
Daniel Rossberg Does we actually need to show these child objects in properties tab too? Screenshot-83.png
Yes, ideally including their boolean operators.
Himanshu Sekhar Nayak said:
Wow a strange bug that is hiding for mac. Sean can you upload the .g file that you have tested with?
It does it with all .g's, so it's not specific to the geometry. something is probably getting calculated differently (obviously half of what it should be in both dimensions).
Daniel Rossberg said:
A screen resolution (retina disply) issue? Qt has Qt::AA_EnableHighDpiScaling and Qt::AA_DisableHighDpiScaling flags, but not for macOS? See also https://doc.qt.io/qt-5/highdpi.html#macos-and-ios
I do have a retina display and high dpi scaling was turned on, but I get the same result even if I turn scaling off.
but you're definitely on to something there. if I multiple h and w by 2 in Display::resizeGL() it displays perfectly: Screen-Shot-2022-09-25-at-11.40.52-PM.png
Ah, I think I found it -- DisplayManager::DrawVListElementCallback::operator()
/* 96 dpi = 3.78 pixel/mm hardcoded */
glScaled(2. * 3.78 / displayManager->display.getW(),
2. * 3.78 / displayManager->display.getH(),
1.);
Sean said:
Ah, I think I found it -- DisplayManager::DrawVListElementCallback::operator()
/* 96 dpi = 3.78 pixel/mm hardcoded */ glScaled(2. * 3.78 / displayManager->display.getW(), 2. * 3.78 / displayManager->display.getH(), 1.);
So it should be calculated differently for different platform?
spoke too soon, looks like that code isn't called though I was able to eliminate the hardcoding
I think I got it fixed. I'll push a PR for review but it's pretty simple.
@Daniel Rossberg Added a skeleton class for selecting an object. https://github.com/BRL-CAD/arbalest/pull/33/commits/6f942d91db1f6d450b0f2326b473f5a66f441e0b
Okay, thanks. I want however talk with you about your MouseAction base class first. You mixed up the parameters there.
For the start, you could rethink my hint "MouseAction(QObject* parent, QWidget* watched);".
Daniel Rossberg said:
Okay, thanks. I want however talk with you about your MouseAction base class first. You mixed up the parameters there.
For the start, you could rethink my hint "MouseAction(QObject* parent, QWidget* watched);".
For frameGeometry().topLeft()
, isMaximized()
, move()
to work they need an object from MainWindow
, so I have done something like that.
If I am right, here parent
should be MainWindow
for MouseAction
?
Here is a patch but I can't figure out how to make frameGeometry().topLeft()
, isMaximized()
, move()
work. Changes-On-6f942d.patch
You are asking the right question :grinning: We didn't talked about this yet. But, while looking at this, I realized, that your current code aim at the wrong widget. Moving the main window is not what we are looking for. Instead, Display is the widget we want different mouse actions for. I.e., MouseAction(QObject* parent, Display* watched);
.
Daniel Rossberg said:
You are asking the right question :grinning: We didn't talked about this yet. But, while looking at this, I realized, that your current code aim at the wrong widget. Moving the main window is not what we are looking for. Instead, Display is the widget we want different mouse actions for. I.e.,
MouseAction(QObject* parent, Display* watched);
.
So menuTitleBar
shouldn't be the target widget?
So the goal is to move these mouse functions to their respective classes which are in Display.h
?
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void keyPressEvent(QKeyEvent *k) override ;
The mouse behavior on the menuTitleBar is a bit boring. No need to create a class hierarchy for this. The mouse actions in the Display widget are much more exciting. Here we need a frame work to create easily new kinds of interactions.
And yes, the has to be done in the eventFilter() method.
Sean said:
I think I got it fixed. I'll push a PR for review but it's pretty simple.
PR pushed, https://github.com/BRL-CAD/arbalest/pull/37
Daniel Rossberg said:
The mouse behavior on the menuTitleBar is a bit boring. No need to create a class hierarchy for this. The mouse actions in the Display widget are much more exciting. Here we need a frame work to create easily new kinds of interactions.
And yes, the has to be done in the eventFilter() method.
So I guess we have to shift the MouseAction object to Display.h instead of keeping it inside MainWindow?
Just want to clear this so that I can start again :sweat_smile:
I will restore the DragWindowMouseAction to its original place e.g removing that class.
Then I will implement them in separate classes for all the override that are in Display.h
You should save (rescue) the MouseAction and DragWindowMouseAction classes and reset the source tree, e.g. by deleting the branch and creating a new one. Then, move the MouseAction class there and make the constructor look like MouseAction(QObject* parent, Display* observed). The design of DragWindowMouseAction wasn't bad. It can be used as a template for the new mouse rotation action class on Display. This way, you have hopefully an easier start.
Daniel Rossberg said:
You should save (rescue) the MouseAction and DragWindowMouseAction classes and reset the source tree, e.g. by deleting the branch and creating a new one. Then, move the MouseAction class there and make the constructor look like MouseAction(QObject* parent, Display* observed). The design of DragWindowMouseAction wasn't bad. It can be used as a template for the new mouse rotation action class on Display. This way, you have hopefully an easier start.
So all the functions e.g DragWindowButtonAction()
will be placed inside Display.h and so on
No. First, this task is about defining functionality outside from the Display class, i.e., moving stuff out. In addition, Display has no use for a drag window action. But, it would be good if you had this code to hand and look up there to speed up development.
Alright :+1:🏻. I will start tomorrow then. Late night here. I will create a new branch and will send a PR.
@Daniel Rossberg Should I go with friend
for all those derived class of MouseAction
so that they can access those private variables of Display
class?
or add some getters inside Display class?
Btw if (watched == m_watched)
Will it even be true? Since both are different classes or I am missing somethin here?
You should write interfaces for the functionality you need in the mouse action. E.g., don't hand over the camera
object but write Display::MoveCamera()
, Display::RotateCamera()
, etc. functions.
Himanshu Sekhar Nayak said:
Btw
if (watched == m_watched)
Will it even be true? Since both are different classes or I am missing somethin here?
m_watched
should be of Display
type, which is, after some levels of inheritance, a QObject
, the type of watched
.
Just FYI, we have a team of capstone students using arbalest GUI as the base for creating a new geometry V&V tool. Basically, the tool is going to have a "compile" button of sorts and will run a slew of tests on the geometry, summarizing them in compiler-info/warning/error fashion like msvc's warnings panel.
@Daniel Rossberg Added the functionality that I need for derived classes of MouseAction
class. https://github.com/BRL-CAD/arbalest/pull/38/commits/e793c41e4afaf033d9a995a7c4123b1dbc2209e7
Btw what parameters need to be passed in these? E.g MoveCameraMouseAction(QObject* parent, Display* watched)
Sean said:
Just FYI, we have a team of capstone students using arbalest GUI as the base for creating a new geometry V&V tool. Basically, the tool is going to have a "compile" button of sorts and will run a slew of tests on the geometry, summarizing them in compiler-info/warning/error fashion like msvc's warnings panel.
Wow that's nice. Idk that others are working too in this. :grinning:
He's a very preliminary screenshot of where they're at right now,
Screenshot_from_2022-10-07_10-06-50.png
Himanshu Sekhar Nayak said:
Daniel Rossberg Added the functionality that I need for derived classes of
MouseAction
class. https://github.com/BRL-CAD/arbalest/pull/38/commits/e793c41e4afaf033d9a995a7c4123b1dbc2209e7
Your code is a bit unexpected, and (without having tested it) I doubt that it works. For example, only the wheel action should be active: The last mouse action you create the MainWindows constructor is the wheel action.
You seem to doing hard in understanding what kind of objects are needed. This is about the generalization of the mouse interactions. At the moment, there is only one mouse interaction implemented: The movement of the camera. This shall be the start point.
Object oriented means, that there shall be objects which take the responsibility for the different behavior modes. However, at the moment there is only one behavior, the default one, the camera movement.
All behavior specific code has to be part of this class.
In your case you need two new classes:
The current mouse behavior is implemented like
void Display::mouseMoveEvent(QMouseEvent *event) {
const int x = event->x();
const int y = event->y();
int globalX = event->globalX();
int globalY = event->globalY();
bool resetX = false, resetY = false;
if(prevMouseX != -1 && prevMouseY != -1 && (event->buttons() & (rotateCameraMouseButton|moveCameraMouseButton))) {
if (skipNextMouseMoveEvent) {
skipNextMouseMoveEvent = false;
return;
}
if(event->buttons() & (rotateCameraMouseButton)) {
const bool rotateThirdAxis = QApplication::keyboardModifiers().testFlag(rotateAroundThirdAxisModifier);
camera->processRotateRequest(x- prevMouseX, y - prevMouseY,rotateThirdAxis);
}
if(event->buttons() & (moveCameraMouseButton)){
camera->processMoveRequest(x- prevMouseX, y - prevMouseY);
}
forceRerenderFrame();
const QPoint topLeft = mapToGlobal(QPoint(0,0));
const QPoint bottomRight = mapToGlobal(QPoint(size().width(),size().height()));
int newX = -1;
int newY = -1;
if (globalX <= topLeft.x()) {
newX = bottomRight.x()-1;
resetX = true;
}
if (globalX >= bottomRight.x()) {
newX = topLeft.x()+1;
resetX = true;
}
if (globalY <= topLeft.y()) {
newY = bottomRight.y()-1;
resetY = true;
}
if (globalY >= bottomRight.y()) {
newY = topLeft.y()+1;
resetY = true;
}
if (resetX || resetY) {
prevMouseX = resetX ? mapFromGlobal(QPoint(newX,newY)).x() : x;
prevMouseY = resetY ? mapFromGlobal(QPoint(newX,newY)).y() : y;
QCursor::setPos(resetX ? newX : globalX, resetY ? newY : globalY);
skipNextMouseMoveEvent = true;
}
}
if(!resetX && !resetY) {
prevMouseX = x;
prevMouseY = y;
}
}
void Display::mousePressEvent(QMouseEvent *event) {
document->getDisplayGrid()->setActiveDisplay(this);
prevMouseX = event->x();
prevMouseY = event->y();
}
void Display::mouseReleaseEvent(QMouseEvent *event) {
prevMouseX = -1;
prevMouseY = -1;
}
void Display::wheelEvent(QWheelEvent *event) {
if (event->phase() == Qt::NoScrollPhase || event->phase() == Qt::ScrollUpdate || event->phase() == Qt::ScrollMomentum) {
camera->processZoomRequest(event->angleDelta().y() / 8);
forceRerenderFrame();
}
}
This should be implemented as something like this
bool MoveCameraMouseAction::eventFilter(QObject* watched, QEvent* event) {
if (watched == m_watched) {
if (event->type() == QEvent::MouseMove) {
// put the code of Display::mouseMoveEvent() here
}
else if (event->type() == QEvent::MouseButtonPress) {
// put the code of Display::mousePressEvent() here
}
else if (event->type() == QEvent::MouseButtonRelease) {
// put the code of Display::mousePressEvent() here
}
else if (event->type() == QEvent::Wheel) {
// put the code of Display::mousePressEvent() here
}
}
return ?
}
Variables like prevMouseX
and prevMouseY
should become member of MoveCameraMouseAction.
Ahh my bad. I though for every different mouse event I have to create separate class. I will solve it by today.
@Daniel Rossberg Should we also shift bool bool skipNextMouseMoveEvent = false;
inside MoveCameraMouseAction
class ?
Updated @Daniel Rossberg https://github.com/BRL-CAD/arbalest/pull/38/commits/91e2e48670eeef37a882868ddfd162fc557fa563
Btw I have forgot to add return false;
in those events so I added them also.
While navigating through MainWindindow
src file, I saw QMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
where dynamic_cast
is used and I added static_cast
inside respective event->type()
. So which will be right?
As far I know If there is a surety we will never cast to wrong object then we can avoid dynamic_cast
and use static_cast
but I don't know which will be best fit for these since dynamic_cast
has runtime overhead.
Himanshu Sekhar Nayak said:
Daniel Rossberg Should we also shift bool
bool skipNextMouseMoveEvent = false;
insideMoveCameraMouseAction
class ?
Yes, it should become a member of MoveCameraMouseAction and removed from Display.
Himanshu Sekhar Nayak said:
Btw I have forgot to add
return false;
in those events so I added them also.
One return false;
at the end of MoveCameraMouseAction::eventFilter() would be enough, or?
Himanshu Sekhar Nayak said:
While navigating through
MainWindindow
src file, I sawQMouseEvent* mouse_event = dynamic_cast<QMouseEvent*>(event);
wheredynamic_cast
is used and I addedstatic_cast
inside respectiveevent->type()
. So which will be right?
Using static_cast
is okay. dynamic_cast
is rather a test, if the variable has the desired type. The result of a dynamic_cast
should be tested for nullptr too. BTW, it wasn't the MainWindow with these mouse event casts ;)
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Btw I have forgot to add
return false;
in those events so I added them also.One
return false;
at the end of MoveCameraMouseAction::eventFilter() would be enough, or?
Hmm understood. One return false;
since all other events are ignored, and the filter
returns false
to allow them to be sent on to the target widget.
@Daniel Rossberg We need a Display
object that need to be passed MoveCameraMouseAction(QObject* parent, Display* watched)
and here the parent will be a object of MainWindow
?
So now we have to do something like this. Create another class where it can select the object and highlight it. But before that if we select a sub-object inside object dock then it should also highlight too.
Himanshu Sekhar Nayak said:
Daniel Rossberg We need a
Display
object that need to be passedMoveCameraMouseAction(QObject* parent, Display* watched)
and here the parent will be a object ofMainWindow
?
Good question. The watched
parameter is a Display instance, but who manages these instances? I don't think it's MainWindow.
The MainWindow has a member documentArea which contains the tab widgets. documentArea->widget(index)
is of type DisplayGrid (if it isn't the help page), which contains an array of displays.
Maybe, the mouse action objects should be managed by DisplayGrid too? It would need a MouseAction instance for each Display instance.
DisplayGrid could have a setMoveCameraMouseAction()
method, which allows to set the required action in the MainWindow class.
Daniel Rossberg said:
The MainWindow has a member documentArea which contains the tab widgets.
documentArea->widget(index)
is of type DisplayGrid (if it isn't the help page), which contains an array of displays.
Okay, I see that it is dynamically casted to DisplayGrid
in MainWindow
. Also I saw this, documentArea->addTab(new HelpWidget(), "Quick Start");
that you talked about Help page.
So every time there is a new tab, then there should be always new mouse actions for each tab.
So there are 4 displays right?
I don't know if their number is limited :thinking:
This one QVector<Display *> displays;
inside DisplayGrid class ^^
In constructor of DisplayGrid I saw this too -> displays.append(new Display(document));
written 4 times
So I thought are they referring to viewport?
Then I saw this activeDisplay = displays[3];
and thought this should be the viewport. Right?
Himanshu Sekhar Nayak said:
In constructor of DisplayGrid I saw this too ->
displays.append(new Display(document));
written 4 times
I think, this refers to the four displays in mged (archer) when you activate the multipane (quad view) mode.
Please, add everything I shall consider to your PR.
@Daniel Rossberg Idk but still I am not able to see my mouse during creation of a new file or opening a file. Have you tested it out?
Desktop-2022.10.19-21.04.37.02.mp4 It didn't show the blinks but I will upload another from my camera.
lol, the blinks is due to hide of taskbar. When I disable the auto hide of taskbar, it works. Anyways it's fine now for me at least.
But when I switch to AMD GPU from NVIDIA GPU even if the auto hide of taskbar is enabled, the blinks doesn't appear and works fine. Idk what is happening for NVIDIA GPU.
The cause is probably a wrong return of the eventFilter()
function. See its documentation. However, I'm working on it right now.
Daniel Rossberg said:
The cause is probably a wrong return of the
eventFilter()
function. See its documentation. However, I'm working on it right now.
This one --> stop it being handled further, return true; otherwise return false.
I just kind of accepted your PR. Please, test it.
okay
My main change was, that eventFilter()
now returns true, if the event was handled.
Hmm but still my screen blinks when I create a new file. Idk if this is my problem but if I disable the autohide of taskbar, it works fine without blinks.
Was the behavior different before?
Nope.
After I completed the eventFilter(), it happens but previously my taskbar hide is disabled but these days I am using auto hide of taskbar.
Btw my screen resolution is 2560x1600
I.e., it could be your video driver.
hmm that can be the reason but anyways I disabled auto hide of taskbar so now it works fine.
@Daniel Rossberg Should there be any Select object
inside Edit
menu? Or only a tool button for select feature?
and for the arrow, do you mean upward arrow? https://fonts.google.com/icons?icon.query=arrow+upward
Himanshu Sekhar Nayak said:
and for the arrow, do you mean upward arrow? https://fonts.google.com/icons?icon.query=arrow+upward
I thought more at something like this: https://www.flaticon.com/free-icon/cursor_99183
Himanshu Sekhar Nayak said:
Daniel Rossberg Should there be any
Select object
insideEdit
menu? Or only a tool button for select feature?
Make a "Select Object" action, which can be inserted in an edit menu and/or tool bar.
Hmm I am thinking for both action and tool button for select
.
@Daniel Rossberg Currently I am thinking to do like this for select function.
QString SelectMouseAction::getSelectedRegionPath() const {
BRLCAD::ConstDatabase::Hit *obj = dynamic_cast<BRLCAD::ConstDatabase::Hit *>(m_watched->getDocument()->getDatabase());
if (obj != nullptr) {
return obj->Name();
}
return nullptr;
}
I'm afraid, this won't work.
Better: In eventFilter()
on if (event->type() == QEvent::MouseButtonPress)
shoot a ray where the click was. If something was hit, memorize obj->Name()
on a member variable m_selected
and emit Done(this)
. Then
QString SelectMouseAction::getSelected() const {
return m_selected;
}
BTW, if there is a region, m_selected contains a region's path, but if there are no regions at all (for example), it can contain a solid's name too.
@Daniel Rossberg In order to shoot a ray which is new to me so first I have to fetch the my mouse x and y co-ordinates.
and also get the direction. And then initialize ray origin and direction coordinates and shoot that ray using this one m_database.ShootRay(ray, callback, BRLCAD::ConstDatabase::StopAfterFirstHit);
Maybe, RaytraceView can give you a hint on how this can be done. In RaytraceView a ray for every pixel will be shot. You need only one pixel.
@Daniel Rossberg Is this one virtual bool operator()(const BRLCAD::ConstDatabase::Hit& hit) throw(){}
actually checks if a ray is hit or not? If yes then why it always return false.
That function operator overloading function is inside class RayTraceCallback : public BRLCAD::ConstDatabase::HitCallback
but it is in RaytraceView.cpp
file.
Himanshu Sekhar Nayak said:
Daniel Rossberg Is this one
virtual bool operator()(const BRLCAD::ConstDatabase::Hit& hit) throw(){}
actually checks if a ray is hit or not? If yes then why it always return false.
The return value isn't meant for you directly, but for the algorithm behind BRLCAD::Database::ShootRay()
. It's explained in the ConstDatabase.h file, line 184 ff.:
/** return true: go on; false: stop
The return value gives the calling function the possibility to optimize.
However be aware the return value may be ignored. */
I.e., always returning false means: Stop after the first hit.
@Daniel Rossberg What does this image point and model point means?
QVector3D imagePoint(column, h - row - 1., 0.);
QVector3D modelPoint = m_transformation.map(imagePoint);
The image coordinates should be more-or-less screen coordinates (y-coordinate reversed?) The transformation maps them to model coordinates (where the BRL-CAD geometry lives). Because the screen is 2D, but the model is 3D, the z-coordinate of the screen is set to 0. In fact, the image of a point on the screen in model space is not a point but a line.
@Daniel Rossberg Here is what I have done so far....
bool SelectMouseAction::eventFilter(QObject* watched, QEvent* event) {
bool ret = false;
if (watched == m_watched) {
if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>(event);
if (mouseEvent->button() == Qt::LeftButton) {
const int x = mouseEvent->x();
const int y = mouseEvent->y();
int w = m_watched->getDocument()->getRaytraceWidget()->width();
int h = m_watched->getDocument()->getRaytraceWidget()->height();
QVector3D &eyePosition = m_watched->getCamera()->getEyePosition();
QMatrix4x4 m_transformation;
QVector3D directionStart = m_transformation.map(eyePosition);
QVector3D directionEnd = m_transformation.map(QVector3D(0., 0., 0.));
QVector3D direction = directionEnd - directionStart;
direction.normalize();
QVector3D imagePoint(x, h - y - 1., 0.);
QVector3D modelPoint = m_transformation.map(imagePoint);
RayTraceCallback callback(direction, m_watched->getDocument()->getRaytraceWidget()->getColor());
BRLCAD::Ray3D ray;
ray.origin.coordinates[0] = modelPoint.x();
ray.origin.coordinates[1] = modelPoint.y();
ray.origin.coordinates[2] = modelPoint.z();
ray.direction.coordinates[0] = direction.x();
ray.direction.coordinates[1] = direction.y();
ray.direction.coordinates[2] = direction.z();
// Shoot a ray
m_watched->getDocument()->getDatabase()->ShootRay(ray, callback, BRLCAD::ConstDatabase::StopAfterFirstHit);
// Check if a ray intersects or hit
// Dynamically cast BRLCAD::ConstDatabase to BRLCAD::ConstDatabase::Hit and return region Name
emit Done(this);
ret = true;
}
else {
ret = false;
}
}
}
return ret;
}
You need to write your own call-back class.
@Daniel Rossberg What is the purpose of QColor m_color;
in RayTracecallback
class? Do you need that?
RaytraceView generates a ray-trace image: For every pixel of the screen/image a ray will be shot and the corresponding colour will be determined. This colour is based on the colour of the object hit and the hitting angle. The variable m_color
holds this colour.
Of course, you don't need this for your selection call-back.
@Daniel Rossberg Should we make the select mouse action as a toggle action? So after select operation is finished, it can switch back to move mouse action.
I wouldn't call it "toggle action" (I've different associations with this name), but yes: Switch back to the mouse move action after the selection has finished.
@Daniel Rossberg okay, I am created a slot that will show the region name in the object docks. But looks like my ray is not shooting the region since I am getting empty in m_selected
.
Good that you implemented the slot. The issues aren't surprising. Now, you should debug your code: Add a break point at the beginning of SelectMouseAction::eventFilter()
.
x
and y
(the coordinates of the mouse click) reasonable/as expected? You may need more than one click to check this.modelPoint
reasonable/as expected? Check your example geometry (e.g. m35.g) with another program (e.g. mged) to see at which coordinate you actual clicked.@Daniel Rossberg Meanwhile here is the slot that I had done. You can have a look. I have not tested it yet but looks good. Any suggestion like the name of the function or something?
bool ObjectTreeWidget::build(QString& selected, int objectId) {
if (objectId != 0) {
ObjectTree::VisibilityState visibilityState = document->getObjectTree()->getObjectVisibility()[objectId];
if (visibilityState == ObjectTree::FullyVisible || visibilityState == ObjectTree::SomeChildrenVisible) {
if (document->getObjectTree()->getNameMap()[objectId] == selected) {
objectIdTreeWidgetItemMap[objectId]->setSelected(true);
document->getProperties()->bindObject(objectId);
return true;
}
}
else {
return false;
}
}
for (int childObjectId : document->getObjectTree()->getChildren()[objectId])
{
bool isSelected = build(selected, childObjectId);
if (isSelected == false) {
continue;
}
if (objectId != 0) {
objectIdTreeWidgetItemMap[objectId]->setExpanded(true);
}
return true;
}
return false;
}
Daniel Rossberg said:
Good that you implemented the slot. The issues aren't surprising. Now, you should debug your code: Add a break point at the beginning of
SelectMouseAction::eventFilter()
.
- Are
x
andy
(the coordinates of the mouse click) reasonable/as expected? You may need more than one click to check this.- Is the
modelPoint
reasonable/as expected? Check your example geometry (e.g. m35.g) with another program (e.g. mged) to see at which coordinate you actual clicked.
qDebug()
handling left mouse button event QEvent "MouseButtonPress"
Mouse x: 957
Mouse y: 852
modelPoint
is not working because sometimes there is a region name for a click and sometimes even if I click on a object, m_selected
shows empty.Are this the coordinates you expected?
I'm afraid, you have to set a break point there and debug it yourself. Something must be wrong there.
Himanshu Sekhar Nayak said:
Daniel Rossberg Meanwhile here is the slot that I had done. You can have a look. I have not tested it yet but looks good. Any suggestion like the name of the function or something?
Why don't you iterate over fullPathMap
?
Oops I forgot that m_selected
stores full path of the region name. Unless I should make it like document->getObjectTree()->getFullPathMap()[objectId] == selected
?
Yes, you should look for the selected path in this map.
So here it is --->
void ObjectTreeWidget::build(QString selected) {
int size = document->getObjectTree()->getFullPathMap().size();
for (int objectId = 1; objectId < size; ++objectId) {
ObjectTree::VisibilityState visibilityState = document->getObjectTree()->getObjectVisibility()[objectId];
if (visibilityState == ObjectTree::FullyVisible || visibilityState == ObjectTree::SomeChildrenVisible) {
if (document->getObjectTree()->getFullPathMap()[objectId] == selected) {
objectIdTreeWidgetItemMap[objectId]->setSelected(true);
document->getProperties()->bindObject(objectId);
}
}
}
}
I have tested it out and looks like when we click on multiple object, the previous selected ones stays setSelected()
to true.
@Daniel Rossberg My pr is ready and I have some additional design touches that I wanted to ask if it suits you.
selected
path then the object dock should be expanded till it's last /
and show selected there. Or we should it only make the selected to setSelected(true)
and no need of setExpanded()
?For now the pr is ready and ready to test for select action. Let me know if there is anything needs to do.
Himanshu Sekhar Nayak said:
Daniel Rossberg My pr is ready and I have some additional design touches that I wanted to ask if it suits you.
- When we click on an empty area which is not an object, so we should not be getting any region names. So at that moment should I clear the properties dock whenever it gets empty region name or make it stay there? Another example like the properties dock already shows the details of a selected object and now I click on empty area and the properties dock is still same and not updates. So should I make it clear?
Let the properties dock unchanged. Clicking in an empty area is the same as canceling the selection procedure.
- I have a thought like when we get a
selected
path then the object dock should be expanded till it's last/
and show selected there. Or we should it only make the selected tosetSelected(true)
and no need ofsetExpanded()
?
Do not setExpanded()
. Show the selected object together with its siblings.
- When we click on select button icon then the background should be change to show that the button is active or selected instead of just a button which acts like other buttons like new, save, open...... . So should I change the background once it is selected?
Doesn't do setCheckable(true)
the job? Why does it work for toggleGridAct/toggleGrid?
Himanshu Sekhar Nayak said:
For now the pr is ready and ready to test for select action. Let me know if there is anything needs to do.
This will need some time. However, here is my first one: ObjectTreeWidget::build()
is a bad name. You don't build something. Instead, look at line 110: You select something. Therefore, ObjectTreeWidget::select()
would be a better name.
Ahh I forgot that there is one thing to add so that background will be changed once it is checked.
#toolbarButton:checked { background-color:"$Color-ButtonCheckedMask"; }
But the problem is background color is not able to find that macro $Color-ButtonCheckedMask
. I have tried to clean the solution and rebuild it but no luck but once I set it to like this #toolbarButton:checked { background-color:"$Color-ButtonHoverMask"; }
or set the background color to yellow without any macro, it works. I made sure that the macro is present in both light and dark theme but looks like didn't work.
I found a bug. If the grid button or select object button is enabled for one document then once we create a another new document, the buttons remains active. These buttons should act according to the document right? @Daniel Rossberg
One thing we can do like to check for every document for grid and select act and setChecked()
accordingly. We can do it here MainWindow::onActiveDocumentChanged()
but problem is that we can't access those variables which are inside MainWindow::prepareUi()
.
Or we can do a signal slot connection to solve this issue?
Himanshu Sekhar Nayak said:
I found a bug. If the grid button or select object button is enabled for one document then once we create a another new document, the buttons remains active. These buttons should act according to the document right? Daniel Rossberg
Not necessarily. I personally would consider it rather confusing if the grid would be a property of the document.
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
I found a bug. If the grid button or select object button is enabled for one document then once we create a another new document, the buttons remains active. These buttons should act according to the document right? Daniel Rossberg
Not necessarily. I personally would consider it rather confusing if the grid would be a property of the document.
So once grid and select is active then it should remain active for all documents right? Because here you can see documents[activeDocumentId]->getDisplayGrid()->getActiveDisplay()->selectObjectEnabled == false
. This only works when the button is clicked but not on active document change.
I expected that you bring up this point :)
What's important is that the behavior is all-in-all consistent. That the behavior of the grid (display property) and select (mouse behavior) button are different, would be reasonable. You can however define how you think the behavior should be and implement it that way.
Is there any key binding or way to drop arbalest out of full-screen mode? On Mac, there's no maximize/minimize buttons when it's full screen -- Only the menu bar. Typically Mac apps have an "Exit Fullscreen" menu option under View, or the window fills the whole desktop without going fullscreen so buttons remain accessible.
Sean said:
Is there any key binding or way to drop arbalest out of full-screen mode? On Mac, there's no maximize/minimize buttons when it's full screen -- Only the menu bar. Typically Mac apps have an "Exit Fullscreen" menu option under View, or the window fills the whole desktop without going fullscreen so buttons remain accessible.
I never saw arbalest running on Mac so I have no idea but I wish to test it out in Mac too but I have no mac. But can you share screenshot of how it looks actually?
@Daniel Rossberg @Sean What you will prefer for publishing Project Report
? Should I create in BRL-CAD wiki? or Dev.to? or any?
@Himanshu Sekhar Nayak I sure can.. I’ll get one to you in a bit later today. Also could probably set you up with Remote Desktop access, if you want to try it that way also but happy to test and retest as needed.
@Himanshu Sekhar Nayak actually the screenshot I sent before is a perfect example of what it looks like on launch: Screen-Shot-2022-09-25-at-11.40.52-PM.png
As it’s full screen, there is no window so it fills the view.
Sean said:
Himanshu Sekhar Nayak actually the screenshot I sent before is a perfect example of what it looks like on launch: Screen-Shot-2022-09-25-at-11.40.52-PM.png
Ahh I see, there is no such minimize, maximize and close buttons.
Yeah it’s not truly going full screen on Windows so it still has the buttons there
I think I recall there being some Qt hint/preference/call that tells it to keep the Window but not sure..
Sean said:
Yeah it’s not truly going full screen on Windows so it still has the buttons there
Yep, during launch it goes full screen and I can see the buttons in windows. Are we also expecting those buttons on Mac too, right?
I will look into this, why those buttons are not visible in Mac.
We’ll without them, it’s impossible to minimize or resize.. :)
Maybe Qt::WindowFullscreenButtonHint
Ok, I am on it.
It’s actually nice/fine that there’s not buttons displayed, but then there needs to be some menu option to get out of full screen if it stays buttonless
The Mac application menu is at the top but it’s a permanent fixture on Mac
My guess from September 25:
Sean said:
Is there a keybinding to get it out of the default fullscreen or resize the window? On mac, I can't seem to minimize it which makes it impossible to get to the Desktop while the app is running.
This is probably caused by the Qt::FramelessWindowHint
flag. For the sake of a modern look, the system menu was eliminated and, at least with Windows and KDE, replaced by the main window's menu bar. On these systems, the minimize/maximize/exit icons are however still there.
@Daniel Rossberg Here is the project report. Any suggestions? https://brlcad.org/wiki/User:H1manshu/GSoC2022/Project_Report
Thank you very much @Daniel Rossberg and @Sean. What I accomplished today is all due to you guys. Your guidance, advice and support always helped me to learn more and more. :face_holding_back_tears:
@Himanshu Sekhar Nayak Thank you for all your hard work. I was very much impressed by both the magnitude and quality of effort you put into the GUI work. Your accomplishments have been outstanding.
The improvements you made to arbalest's usability made it possible for another team of students to use the GUI as a base for developing an entirely new geometry V&V application. It also will hopefully get us one step closer to that overarching goal of a new modern CAD GUI.
I like your write-up and noticed your points about GED and MOOSE. If we can figure out how to combine the two, we'll gain the full expressiveness of mged/archer with a vastly more elegant front-end design.
FYI: I hope to find time to work on the backlog next week.
@Himanshu Sekhar Nayak, I accepted your PR. It isn't perfect yet, but the form was good, such that nothing was preventing it from being accepted. The remaining work in fine tuning and tweaking.
I applied Sean's PR which fixes the OpenGL issues on Mac. Maybe, you can test it on Windows.
And, I renamed the branch from master to main (like it's named in the other BRL-CAD repositories too):
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
Daniel Rossberg said:
I applied Sean's PR which fixes the OpenGL issues on Mac. Maybe, you can test it on Windows.
Tested in Windows and working fine.
@Himanshu Sekhar Nayak, I moved MOOSE to BRL-CAD:
git remote set-url origin https://github.com/BRL-CAD/MOOSE.git
It contains an example for test too.
Daniel Rossberg said:
Himanshu Sekhar Nayak, I moved MOOSE to BRL-CAD:
git remote set-url origin https://github.com/BRL-CAD/MOOSE.git
It contains an example for test too.
Nice. I will see it and start working soon.
I am little bit busy this week. Will look this weekend.
Take your time. It looks like, most people here (including myself) are busy.
@Daniel Rossberg Took too much time from my side and got time today to add the feature. Here it is https://github.com/BRL-CAD/arbalest/pull/45.
One think I noticed that select feature doesn't work when the object is not focused. When the object is focused from the object dock, select feature works.
Coming week I will see the first test of MOOSE that you had sent earlier.
Thanks @Himanshu Sekhar Nayak, I'll have a look at it.
I've created a moose_port
branch in the arbalest repository. You can test it.
Daniel Rossberg said:
I've created a
moose_port
branch in the arbalest repository. You can test it.
I have an upcoming exam on april 16th to get into master's. After that I will do the left over work.
Himanshu Sekhar Nayak said:
Daniel Rossberg said:
I've created a
moose_port
branch in the arbalest repository. You can test it.I have an upcoming exam on april 16th to get into master's. After that I will do the left over work.
Okay, take the time. But, the actual work should be done :wink:
The port has some issues. I'm working on them.
Daniel Rossberg said:
The port has some issues. I'm working on them.
Porting arbalest to moose?
Yes: https://github.com/BRL-CAD/arbalest/tree/moose_port
It's ready for testing again.
I recently like 5 days uninstalled qt 5.14.2 and downloaded qt installer to install again 5.14.2 but damn it always report me to network error like it can't download the archive. Btw 5.14.2 is no more in LTS for Qt.
Okay we can change the mirror through cmd installer(.exe) --mirror http://www.nic.funet.fi/pub/mirrors/download.qt-project.org
Are you behind a fire wall? In this case, you may need to set the proxy.
Daniel Rossberg said:
Yes: https://github.com/BRL-CAD/arbalest/tree/moose_port
It's ready for testing again.
Interesting, looks like you're moving away from using inheritance as much? Or just a side effect of restructuring the classes a bit?
I'm using C++11 features, as for example functional, to simplify the API.
Daniel Rossberg said:
Are you behind a fire wall? In this case, you may need to set the proxy.
Hmm that can be as I am using university internet.
@Daniel Rossberg Qt 5.14.2 is no longer in LTS. Should we concern?
Qt 5.14.2 should be okay. We don't use features which can be exploited from a distance. And, everybody builds the program for personal use only.
I.e., only you are building it with 5.14.2 ;)
One interesting thing I found. While opening a .g file, looks like either camera position is not right or the object seems to very zoomed in. It varies from object to object.
So while raytracing, it ray trace according the loaded camera position.
There should be a default position of camera and the object we load. Right?
Successfully built MOOSE but didn't installed and when I tried to built arbalest, and made sure the BRLCAD_MOOSE_DIR is path is given. But during building arbalest, it report fatal error C1083: Cannot open include file: 'brlcad/ConstDatabase.h': No such file or directory
and many more which are related to brlcad
. @Daniel Rossberg
Looks like you didn't switched to arbalest's moose_port branch. There should be no brlcad/ConstDatabase.h include in the sources but brlcad/Database/ConstDatabase.h.
Oops, my bad. What I have done that I cloned two separate arbalest for rt-cubed and MOOSE. And didn't realize I'm switching to moose_port branch while staying rt-cubed.
BRLCAD_MOOSE_INCLUDE_DIR
not found while configuring? Need to specify explicitly?
You wrote that you haven't installed MOOSE. This means that CMake won't find the include directory at the expected place? In this case, you have to set it in fact manually.
BRLCAD_MOOSE_LIBRARY
not found? Even after install. It's causing arbalest to not run and not able to find brlcad.dll which is present inside lib/
of MOOSE.
During config, BRLCAD_MOOSE_LIBRARY
is not set too. Specify explicitly ?
Oh, now the path is set but it is still not able to find brlcad.dll
.
Same. Still not able to find that .dll file even if it is present inside lib/
Screenshot-2023-04-21-210250.png
Here are the paths.
If you changed something, e.g. installed MOOSE, it could be necessary to start from scratch, i.e. to remove the old CMake config.
The DLL cannot be found, if it's not in the PATH. You could either add the corresponding directory of your MOOSE installation to your PATH variable, or (what I did) copy the DLL to the directory where the arbalest.exe is.
Daniel Rossberg said:
The DLL cannot be found, if it's not in the PATH. You could either add the corresponding directory of your MOOSE installation to your PATH variable, or (what I did) copy the DLL to the directory where the arbalest.exe is.
Hmm, copied the DLL and now arbalest works. Nice.
Tried removing the install/moose/
and done a fresh start but still not able to find DLL file. But anyway now it works after copying it.
Now arbalest is able to run through MOOSE. What's next?
Tested out selection, raytrace and other things on arbalest. It works too.
Screenshot would be great to see! :)
Would be great to figure out a proper way to run libged commands via MOOSE. It's not the same architecture as it's a string-based procedural interface and MOOSE is a more proper OO API, but having some sort of executor interface in the API would go a long way towards bridging a massive swath of capability (e.g., so you could run commands in arbalest and have it reflected automatically) ... if it can be done in a way that keeps the OO model in sync. So if you have a comb and a sph, and then you ran "mvall sph sph.new" via moose, that its representation of the comb would correctly reflect a reference to sph.new instead of the sph it originally read from disk.
Sean said:
Screenshot would be great to see! :smile:
Screenshot-123.png
Here is the screenshot of arbalest while selection feature is in action.
Sean said:
Would be great to figure out a proper way to run libged commands via MOOSE. It's not the same architecture as it's a string-based procedural interface and MOOSE is a more proper OO API, but having some sort of executor interface in the API would go a long way towards bridging a massive swath of capability (e.g., so you could run commands in arbalest and have it reflected automatically) ... if it can be done in a way that keeps the OO model in sync. So if you have a comb and a sph, and then you ran "mvall sph sph.new" via moose, that its representation of the comb would correctly reflect a reference to sph.new instead of the sph it originally read from disk.
MOOSE has a CommandString module (experimental), which serves as interface to libged. Set MODULE_COMMANDSTRING in MOOSE's CMake to on, to activate it.
In Examples/CommandString/PrintTitle.cpp
you can find an example, where a database is opened with C++ API and the title is retrieved by sending title
to libged.
Daniel Rossberg said:
MOOSE has a **CommandString** module (experimental), which serves as interface to libged. Set **MODULE_COMMANDSTRING** in MOOSE's CMake to on, to activate it.
In `Examples/CommandString/PrintTitle.cpp` you can find an example, where a database is opened with C++ API and the title is retrieved by sending `title` to libged.
Oh, that's exciting to hear! I missed seeing that addition. Will definitely check that out..
We've been having internal code reviews on the qged code, so I'm still looking at ways to merge the efforts if we can maintain the clean coding you have in arbalest's design. Maybe leverage the key pieces in qged like the command window widget (which might be super trivial now with a way to call commands), and the quad view (a lot of work went into making it highly performant, so that one might be tricky). Still learning about the two hierarchy views.
Vidit Jain said:
Hello Sir, my name is Vidit Jain and I am a second year undergrad at BITS Pilani Goa campus. I am exploring open source and open to learn new technologies. Would love some insights on how should I start contributing to BRL-CAD. I was going through GSOC 2024 projects and I am genuinly interested in working on project "New BRL-CAD GUI #27". Looking forward to hear from you. Thank you
Hi @Vidit Jain, welcome at BRL-CAD. Lets do our conversion here, where other mentors can jump in. E.g., @Himanshu Sekhar Nayak did a lot of the GUI development, and he wants to be a mentor this year, if BR_CAD will be accepted for GSoC :wink:
First, you should learn about BRL-CAD, what it is and how it works:
@Daniel Rossberg
Thanks a lot! I will go through the material and will get back to you all. If I have some doubts, I will get back to you.
Hello @Himanshu Sekhar Nayak!
My name is Vidit Jain. I am a second year undergraduate from BITS Pilani, KK Birla Goa Campus. I am interested in GUI development of BR_CAD. It's great to hear that you will be mentoring us for GSOC 2024. Looking forward to learn a lot from you and all the other mentors.
Thank you
Vidit Jain said:
Hello Himanshu Sekhar Nayak!
My name is Vidit Jain. I am a second year undergraduate from BITS Pilani, KK Birla Goa Campus. I am interested in GUI development of BR_CAD. It's great to hear that you will be mentoring us for GSOC 2024. Looking forward to learn a lot from you and all the other mentors.
Thank you
Hi Vidit, you can go through my progress and where I left it here https://brlcad.org/wiki/User:H1manshu/GSoC2022/Project_Report. But before that make yourself familiar to MGED and Arbalest. Then see if you want to come up with new ideas or find that thing which is missing in Arbalest but is present in MGED.
Thank you, sure, I will start reading from tomorrow :blush:
@Vidit Jain, there is no installation file for Arbalest yet. You have to build it by yourself. On top of that, the build is currently broken. However, you can start setting up your development environment, and maybe, we can fix the build meanwhile.
As the first step for building Arbalest, you have to build and Install BRL-CAD:
Some additional tips:
Thanks a lot for the guidance! Will do all of this as soon as possible.
Vidit Jain said:
Thanks a lot for the guidance! Will do all of this as soon as possible.
Currently I am little bit busy for my ongoing exam. After Saturday, I am free.
Building arbalest should be possible again. I could do it with Debian bookworm, at least.
Vidit Jain said:
What should I do next? Should I try installing Arbalest?
There is an issue with building the MOOSE library with Visual Studio, but you can start setting it up nevertheless.
@Sean can you please help me with this
@Himanshu Sekhar Nayak can you please send me sample proposals from past years. That would be really helpful for me to understand how I am supposed to make my own. Thank you
Vidit Jain said:
Himanshu Sekhar Nayak can you please send me sample proposals from past years. That would be really helpful for me to understand how I am supposed to make my own. Thank you
Here is mine.
You can see for 2022, 2023 also.
Himanshu Sekhar Nayak said:
Vidit Jain said:
Himanshu Sekhar Nayak can you please send me sample proposals from past years. That would be really helpful for me to understand how I am supposed to make my own. Thank you
Here is mine.
Thanks a lot.. also can you please help me with heap memory issue while building BRL-CAD
Vidit Jain said:
Himanshu Sekhar Nayak said:
Vidit Jain said:
Himanshu Sekhar Nayak can you please send me sample proposals from past years. That would be really helpful for me to understand how I am supposed to make my own. Thank you
Here is mine.
Thanks a lot.. also can you please help me with heap memory issue while building BRL-CAD
What's the error you are getting while building ?
I did build now and no issue found.
Okay, I am able to build arbalest again and ran it.
If I can see your build errors then I may help you. @Vidit Jain
Himanshu Sekhar Nayak said:
Okay, I am able to build arbalest again and ran it.
How was the compilation of MOOSE? I got two unresoved functions with MSVS 2019.
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Okay, I am able to build arbalest again and ran it.
How was the compilation of MOOSE? I got two unresoved functions with MSVS 2019.
I didn't get anything unresolved but I used MSVS 2022.
But while building with MSVS 2019 I got unresolved error.
unresolved external symbol __std_find_trivial_1 referenced in function "char const * __cdecl __std_find_trivial<char const ,unsigned char>(char const *,char const *,unsigned char)" (??$__std_find_trivial@$$CBDE@@YAPEBDPEBD0E@Z)
These are the issues that I am facing
WhatsApp-Image-2024-02-24-at-17.37.02_b554cceb.jpg
WhatsApp-Image-2024-02-24-at-17.37.33_5f2f976b.jpg
Himanshu Sekhar Nayak said:
If I can see your build errors then I may help you. Vidit Jain
Vidit Jain said:
These are the issues that I am facing
WhatsApp-Image-2024-02-24-at-17.37.02_b554cceb.jpg
WhatsApp-Image-2024-02-24-at-17.37.33_5f2f976b.jpgHimanshu Sekhar Nayak said:
If I can see your build errors then I may help you. Vidit Jain
Try it in other drive maybe. What I see is you're trying to build where there is admin privilege.
Also take screenshot next time when you're posting your errors.
thanks a lot! I will share screenshots from next time
Himanshu Sekhar Nayak said:
Also take screenshot next time when you're posting your errors.
Now the build passed?
Himanshu Sekhar Nayak said:
Himanshu Sekhar Nayak said:
Also take screenshot next time when you're posting your errors.
Now the build passed?
Actually my laptop just has one drive.. that is C drive.. so I am creating a partition in my drive.. after that I guess it should work
Vidit Jain said:
Himanshu Sekhar Nayak said:
Himanshu Sekhar Nayak said:
Also take screenshot next time when you're posting your errors.
Now the build passed?
Actually my laptop just has one drive.. that is C drive.. so I am creating a partition in my drive.. after that I guess it should work
You can remove admin privileges I guess.
Ohh yaa.. just found it thanks
Himanshu Sekhar Nayak said:
Vidit Jain said:
Himanshu Sekhar Nayak said:
Himanshu Sekhar Nayak said:
Also take screenshot next time when you're posting your errors.
Now the build passed?
Actually my laptop just has one drive.. that is C drive.. so I am creating a partition in my drive.. after that I guess it should work
You can remove admin privileges I guess.
Oh yess! I just found it.. thanks
Hey,
This is Balraj,
I am willing to contribute to BRL-CAD as of GSOC 2024,
can you please guide me to the 1st step that I acn take to start my journey
Hello @Sean @Daniel Rossberg ,
Sorry for being inactive from past few days. My college mid-semester exams were going on so I was not able to work this. But they are over now.
I installed Linux in my machine and I build BRL-CAD successfully on it
@Himanshu Sekhar Nayak
Screenshot-from-2024-03-08-20-40-07.png
While I was runnind the built mged, I was facing this glitch in it.
Also, what should I do next to proceed further with it?
Vidit Jain said:
Screenshot-from-2024-03-08-20-40-07.png
While I was runnind the built mged, I was facing this glitch in it.
Glitch?
Its not visible on screen but the white background on graphics window was flickering
Vidit Jain said:
Also, what should I do next to proceed further with it?
Install moose first and then arbalest.
Vidit Jain said:
Its not visible on screen but the white background on graphics window was flickering
Vidit Jain said:
Vidit Jain said:
Its not visible on screen but the white background on graphics window was flickering
May be issue with graphics driver I guess.
Ohh.. ok
got it
Arbalest is the one where you are going to work on.
Oh that sounds great
Himanshu Sekhar Nayak said:
Arbalest is the one where you are going to work on.
You have to specify path of brlcad build in order to build moose. Since you are in linux you have to specify path e.g cmake -DBRLCAD_BASE_DIR=/path/to/your/brlcad /path/to/your/moose
Himanshu Sekhar Nayak said:
You have to specify path of brlcad build in order to build moose. Since you are in linux you have to specify path e.g
cmake -DBRLCAD_BASE_DIR=/path/to/your/brlcad /path/to/your/moose
Was just going to ask this because I was facing this error.
Thanks!
Himanshu Sekhar Nayak said:
You have to specify path of brlcad build in order to build moose. Since you are in linux you have to specify path e.g
cmake -DBRLCAD_BASE_DIR=/path/to/your/brlcad /path/to/your/moose
While running this command, I am facing this issue.. if you can help
Vidit Jain said:
Vidit Jain said:
Its not visible on screen but the white background on graphics window was flickering
That is a bug and initialization/driver related, but see if it still flickers after you open a geometry database. There are a bunch of sample models in the share/db folder. Opening any of them should initialize the window to a dark blue or black background. Then you can see if geometry displays. If it does, then that will confirm it's a startup issue. If nothing displays, then there's a deeper issue with the display manager context on your environment to investigate.
Vidit Jain said:
Himanshu Sekhar Nayak said:
You have to specify path of brlcad build in order to build moose. Since you are in linux you have to specify path e.g
cmake -DBRLCAD_BASE_DIR=/path/to/your/brlcad /path/to/your/moose
While running this command, I am facing this issue.. if you can help
Looks like you have to specify the brlcad version too.
You can add extra variable like this cmake -DBRLCAD_BASE_DIR=/path/to/your/brlcad -DBRLCAD_VERSION=your_version_number /path/to/your/source/code
version_number is 7.38.2
@Sean @Daniel Rossberg I saw that we have to specify version even I tried in windows too. Isn't it suppose to find itself?
Himanshu Sekhar Nayak said:
You can add extra variable like this
cmake -DBRLCAD_BASE_DIR=/path/to/your/brlcad -DBRLCAD_VERSION=your_version_number /path/to/your/source/code
Yaa.. this worked for me and now I am moving forward to build arbalest
Vidit Jain said:
Himanshu Sekhar Nayak said:
You can add extra variable like this
cmake -DBRLCAD_BASE_DIR=/path/to/your/brlcad -DBRLCAD_VERSION=your_version_number /path/to/your/source/code
Yaa.. this worked for me and now I am moving forward to build arbalest
After building moose, install it too by make install
@Vidit Jain, you have to install brlcad too: make install
Install it to a directory, where you have write rights, e.g. /home/vidit/bin/brlcad
. The CMake brlcad detection script expects the directory structure from an installation.
In addition, you should include the brlcad bin directory (/home/vidit/bin/brlcad/bin
?) in your PATH shell environment variable. This way, it's easier to work with the many BRL-CAD programs ... and you don't need to set anything in CMake, because the brlcad-config script will automatically detected and all necessary information retrieved from it.
Unfortunately, there is no brlcad-config for Windows.
No brlcad-config for windows due to which I have to specify version :sweat_smile:
I have successfully installed BRLCAD but while installing MOOSE, I am facing this error
/usr/bin/ld: libbrlcad.so: undefined reference to brl_deflate'
/usr/bin/ld: libbrlcad.so: undefined reference to
libregex_regexec'
/usr/bin/ld: libbrlcad.so: undefined reference to brl_inflate'
/usr/bin/ld: libbrlcad.so: undefined reference to
libregex_regcomp'
/usr/bin/ld: libbrlcad.so: undefined reference to brl_inflateEnd'
/usr/bin/ld: libbrlcad.so: undefined reference to
libregex_regfree'
/usr/bin/ld: libbrlcad.so: undefined reference to brl_deflateInit_'
/usr/bin/ld: libbrlcad.so: undefined reference to
brl_deflateEnd'
/usr/bin/ld: libbrlcad.so: undefined reference to `brl_inflateInit_'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/generateDataTest.dir/build.make:111: src/generateDataTest] Error 1
make[1]: *** [CMakeFiles/Makefile2:145: src/CMakeFiles/generateDataTest.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
Again build moose then install it.
Make sure you include brlcad in your path shell.
I have built it again and added brlcad build bin directory to the path but still its not installing
Daniel Rossberg said:
Vidit Jain, you have to install brlcad too:
make install
Install it to a directory, where you have write rights, e.g./home/vidit/bin/brlcad
. The CMake brlcad detection script expects the directory structure from an installation.In addition, you should include the brlcad bin directory (
/home/vidit/bin/brlcad/bin
?) in your PATH shell environment variable. This way, it's easier to work with the many BRL-CAD programs ... and you don't need to set anything in CMake, because the brlcad-config script will automatically detected and all necessary information retrieved from it.Unfortunately, there is no brlcad-config for Windows.
I have shifted everything to this directory as well.. now I am building everything from scratch again
ig this time it should work
How you are setting path?
Himanshu Sekhar Nayak said:
How you are setting path?
PATH=$PATH:/your/directory/path
by using this command.. is this correct?
export PATH=$PATH:/your/directory/path
export PATH="/home/vidit/bin/brlcad/bin:$PATH"
my bin folder is in build directory? is this the same bin folder?
Vidit Jain said:
my bin folder is in build directory? is this the same bin folder?
You mean /home/vidit/bin
?
No, /home/vidit/bin/brlcad/bin the last bin?
If you did make install
after building brlcad then /home/vidit/bin/brlcad/bin
should be present. Now only thing you have to do is to set the path and build moose and install.
Let me try it
should I run
make install
in base directory or build directory?
Vidit Jain said:
should I run
make install
in base directory or build directory?
In build directory.
It is successfully executing but its not making any bin directory
Can you please help @Himanshu Sekhar Nayak
Hmm, strange. You are on Linux? Where is your installation directory? How did you set it?
Daniel Rossberg said:
Hmm, strange. You are on Linux? Where is your installation directory? How did you set it?
Yes I am on linux. My vase directory is desktop/brlcad . I firstly followed the compiling guidelines to compile brlcad. I than compiled it successfully. Than I installed it using sudo make install. But no bin folder is formed
In this case, you installed brlcad into a different directory. In fact a directory, where you need install privileges.
The install directory is set in CMake via the CMAKE_INSTALL_PREFIX (I think) variable. What is its value? You can keep it or change it to a folder where you don't need root privileges.
BTW, when running make install
, its output tells you where it copies the files.
@Himanshu Sekhar Nayak @Daniel Rossberg
after running make installed, it got installed a directory /usr/brlcad/rel-7.38.1/bin and a bin folder was also there.. is this the currect bin?
Even after adding it to the path its giving the same error
image.png
@Himanshu Sekhar Nayak
This is while running make install on moose
Do echo $PATH
and see if /usr/brlcad/rel-7.38.1/bin
is there or not.
Wait! If you did make install
then in /usr/bin/
brlcad should be there.
During install did you see where your files being copied to?
Screenshot-from-2024-03-13-02-47-58.png
This is a screenshot which I have
Himanshu Sekhar Nayak said:
Wait! If you did
make install
then in/usr/bin/
brlcad should be there.
No, BRL-CAD is not there
Did you check if that path is set by doing echo $PATH
?
yes.. its not there
ig that command that you told for setting path is not working
Vidit Jain said:
yes.. its not there
That's why moose is complaining about the files not found.
Is there any way I can do it through gui?
I found it.. wait
You have probably to start your MOOSE build from scratch. I.e., rerun CMake from scratch.
brlcad looks okay
When I am creating a path, its there in the memory for that terminal, but when I am doing it in another terminal window its not there. Ig the path is not getting stored
Which shell do you use? Bash?
Yes
How did you create the path?
export PATH="/home/vidit/bin/brlcad/bin:$PATH"
this way
There is a file /home/vidit/.bashrc.
You can put the export in that file and it will be set for all bash sessions
yes it is there
I am putting it in that
You can confirm it works by running “rt” with no arguments
write there
PATH="/usr/brlcad/rel-7.38.1/bin:$PATH"
export PATH
Screenshot-from-2024-03-13-03-44-38.png
I did that but still its not there
Open a new shell ;)
You didn’t open a new terminal..
The script is run only once when the shell opens.
“source .bashrc” to load into an already existing terminal
Screenshot-from-2024-03-13-03-46-08.png
Screenshot-from-2024-03-13-03-47-00.png
I opened a new terminal as well, but still
It’s there at the front
The path looks good, doesn't it?
Ohh yaa, my bad! sorry
What does rt output?
I am not sure about your question. Can you please tell me what is rt?
Should be vers
Run “rt”
Sean said:
Should be vers
Screenshot-from-2024-03-13-03-51-38.png
Excellent that’s confirmed
Thanks a lot
Notice the version and build info matches what you’re expecting
If you run “which rt” that will confirm that it’s coming from the right install t
Location
Yes, after running which rt I got usr/brlcad/rel-7.38.1/bin/rt
Also while building should I specify brlcad vcersion?
I am talking about moose
Vidit Jain said:
Also while building should I specify brlcad vcersion?
There should be no need to specify anything, because brlcad-config should be found.
Screenshot-from-2024-03-13-04-06-33.png
Still the same error while building moose :sob:
You didn't started from scratch. It refers to the header files in your build directory. Instead, it should refer to /usr/brlcad/rel-7.38.1 now.
I started from scratch only.. I cloned it in the brlcad folder on my desktop. Should I try it in other location?
In your screenshot, I see references to /home/vidit/Desktop/brlcad/include/bu/bitv.h. But, your MOOSE build should not know about /home/vidit/Desktop/brlcad. Instead, it should know /usr/brlcad/rel-7.38.1.
Therefore, clean up your MOOSE build directory before running CMake again.
I cloned the moose again, but still its refering to that only.. may be its because of the wrong PATHs that I setup earlier?
But when I am checking .bashrc, there are no other variables
What do you mean by "clone again"? git clone? That's not necessary, because you didn't change anything. Just remove everything what's not in the repository.
Where is your MOOSE source directory? Where is your MOOSE build directory?
Daniel Rossberg said:
What do you mean by "clone again"? git clone? That's not necessary, because you didn't change anything. Just remove everything what's not in the repository.
Yaa I did git clone.
Daniel Rossberg said:
Where is your MOOSE source directory? Where is your MOOSE build directory?
Base is on my desktop, and build is inside base
Then, remove the build.
So I should build and install in base directory itself?
No. Remove the build directory and recreate it with CMake.
Daniel Rossberg said:
No. Remove the build directory and recreate it with CMake.
By "create with CMake" what do you exactly mean? should I make it using mkdir or is there a way by which I can make it directly through CMake
How did you your first run of CMake on MOOSE?
i made a build folder first
than I run "cmake .."
Okay, then mkdir build
, cd build
, and cmake ..
.
yes
Still while running make install, refering to desktop one only
Did you removed the old build directory first, before recreating it? Are you doing this in a new shell?
Daniel Rossberg said:
Did you removed the old build directory first, before recreating it? Are you doing this in a new shell?
Yes I deleted that. I also created a new terminal
Let me restart my system, that might help?
What does CMake say? There should be a line with "Found BRL-CAD".
Did you set en environment variable BRLCAD_ROOT?
vidit-vidit-Dell-G15-5520.txt
This is the log that I got
Daniel Rossberg said:
Did you set en environment variable BRLCAD_ROOT?
No, I didn't
where should that variable say?
Daniel Rossberg said:
Did you set en environment variable BRLCAD_ROOT?
The variable could be in the way.
Okay, you have Found BRL-CAD 7.38.1 at /usr/brlcad/rel-7.38.1
.
If possible can we get on a gmeet and fix it? Only if it suits you. I can share my screen there.
I have to stop for today.
The only issue I see is that you are using gcc 13.2.0 and I use gcc 12.2.0.
Maybe, @Himanshu Sekhar Nayak uses a 13 gcc too?
Daniel Rossberg said:
I have to stop for today.
The only issue I see is that you are using gcc 13.2.0 and I use gcc 12.2.0.
Maybe, Himanshu Sekhar Nayak uses a 13 gcc too?
Ohh ok ok.. thanks a lot
Daniel Rossberg said:
I have to stop for today.
The only issue I see is that you are using gcc 13.2.0 and I use gcc 12.2.0.
Maybe, Himanshu Sekhar Nayak uses a 13 gcc too?
Mine is gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0. Using WSL.
@Vidit Jain I can help you to setup. May be not now. Tomorrow probably.
Himanshu Sekhar Nayak said:
Vidit Jain I can help you to setup. May be not now. Tomorrow probably.
Works. at what time?
Vidit Jain said:
Himanshu Sekhar Nayak said:
Vidit Jain I can help you to setup. May be not now. Tomorrow probably.
Works. at what time?
I will ping you.
Ohkk.. thanks
Strange thing is brl-cad build is failing for gdal
for me.
Can't find gdal while building brlcad :face_with_peeking_eye: .
gdal is in src/other/ext.
Daniel Rossberg said:
gdal is in src/other/ext.
Hmm I see it's present but build failing not able to find. Strange.
Anyway, I am building it again. Reset everything and do cmake and then build.
Strange is that I got 3 times like this today. :neutral:
When in doubt, delete the build directory and rerun cmake. I think there are some situations where existing files affect subsequent cmake behavior.
@Daniel Rossberg Can you confirm if select mouse action is working in arbalest? I started fresh build of everything(brlcad, moose, arbalest).
From my side, it is not working.
Himanshu Sekhar Nayak said:
Daniel Rossberg Can you confirm if select mouse action is working in arbalest? I started fresh build of everything(brlcad, moose, arbalest).
It works, at least on Debian bookworm (fresh build). A fresh Windows build is still running.
Daniel Rossberg said:
Himanshu Sekhar Nayak said:
Daniel Rossberg Can you confirm if select mouse action is working in arbalest? I started fresh build of everything(brlcad, moose, arbalest).
It works, at least on Debian bookworm (fresh build). A fresh Windows build is still running.
Okay, it is working for me now. I saw that at that time I didn't hide my taskbar and doing selection and it is not working. Now I hide the taskbar, it works. Strange. :face_with_peeking_eye:
image.png
I have built brlcad, moose and arbalest successfully but when I am trying to run arbalest Its showing this error
this time I am on windows
You can find the brlcad.dll in your MOOSE installation directory (lib subdirectory). Copy this DLL to where your arbalest.exe is, or include your ~/MOOSE/lib directory in your path environment variable.
Ya its working now.. thanks a lot
Do we have some sample databses which I can test on arbalest?
Look at your brlcad installation directory at share/db.
Thanks! Also what will be the length of the "New BRL-CAD GUI" project if I get selected :sweat_smile: .
Vidit Jain said:
Thanks! Also what will be the length of the "New BRL-CAD GUI" project if I get selected :sweat_smile: .
It depends on the complexity of the feature that you propose. If we feel that you can implement a feature which is complex and going to take more time. Then length of the project can be changed.
I have been using arbalest for long today, and now I guess I am ready to dive into codebase, can you please help me from where should I start?
Where can I find .qmlproject file for arbalest?
The starting point of arbalest is main.cpp
and for the interface(GUI) of arbalest you can find in MainWindow.cpp
.
Vidit Jain said:
I have been using arbalest for long today, and now I guess I am ready to dive into codebase, can you please help me from where should I start?
Himanshu Sekhar Nayak said:
The starting point of arbalest is
main.cpp
and for the interface(GUI) of arbalest you can find inMainWindow.cpp
.Vidit Jain said:
I have been using arbalest for long today, and now I guess I am ready to dive into codebase, can you please help me from where should I start?
How can I open the project in Qt?
Vidit Jain said:
Himanshu Sekhar Nayak said:
The starting point of arbalest is
main.cpp
and for the interface(GUI) of arbalest you can find inMainWindow.cpp
.Vidit Jain said:
I have been using arbalest for long today, and now I guess I am ready to dive into codebase, can you please help me from where should I start?
How can I open the project in Qt?
You don't need to open the project in Qt. You can open in visual studio 2022 itself.
Open arbalest solution in visual studio then in your right side you can expand arbalest section to see source files.
You can try these issues https://github.com/BRL-CAD/arbalest/issues.
I know for now that raytrace function is working fine but the raytrace window where it is being displayed is not displaying properly.
You can see what I left during my time so that it will be better for you to start on a task or if you want to propose any new functionality. https://brlcad.org/wiki/User:H1manshu/GSoC2022/Project_Report
Thanks a lot
Screenshot-88.png
Screenshot-87.png
I was trying out this project. In raytracing view, it was the output. Can you please tell me what exactly is the issue in raytrace?
(deleted)
Change the camera view and ray trace.
Vidit Jain said:
Screenshot-88.png
Screenshot-87.pngI was trying out this project. In raytracing view, it was the output. Can you please tell me what exactly is the issue in raytrace?
You mean viewport?
Vidit Jain said:
You mean viewport?
Through dragging mouse left click, you can change too.
Idk actually, if it is an intended to function like this. Looks like whatever camera is looking only those things are getting raytraced, rest just got hide.
Also, for me its working only if one of the cordinate is 0 (when I am looking through one of the axis). On changing angle a little bit its turning all black.
Screenshot-89.png
Screenshot-90.png
Hmm, I see. Check if you can find the problem. RaytraceView.cpp
might help you.
Is mouse selection working?
Himanshu Sekhar Nayak said:
Is mouse selection working?
No, its not working
Himanshu Sekhar Nayak said:
Hmm, I see. Check if you can find the problem.
RaytraceView.cpp
might help you.
I am seeing that only
Vidit Jain said:
Himanshu Sekhar Nayak said:
Is mouse selection working?
No, its not working
Strange. Happening for me too in windows. Idk why.
Now its working properly for every angle
Himanshu Sekhar Nayak said:
Idk actually, if it is an intended to function like this. Looks like whatever camera is looking only those things are getting raytraced, rest just got hide.
Ig it is intended to function like this only. @Sean @Daniel Rossberg if you can tell
I don't know if this is related, but there was a problem with the start plane of the ray-trace. It can be inside or behind the geometry.
@Vidit Jain the raytrace viewport should match what's displayed in the wireframe, at least that would be my expectation. As daniel implied, it might simply be an issue of needing to move the camera backwards, outside of the model. That should be a pretty simple change if it's not doing that already.
@Vidit Jain, before implementing higher features, you should think about fixing and completing the basic ones. Some keywords:
I want to see moc files and for that I have to open the project in qt. Can you please help me with that @Himanshu Sekhar Nayak ?
Daniel Rossberg said:
Vidit Jain, before implementing higher features, you should think about fixing and completing the basic ones. Some keywords:
- Mouse interactions, e.g. selection of regions and primitives
- Navigation in the geometry, e.g. highlighting the selected object
- Think about Geometry Verification and Validation GUI in Qt (AI Project) as well. I would like to use Archer to explore geometries, find regions there, see what is around them, find overlaps, compute volumes, ...
- I find the current GUI a bit hard to maintain, because it uses special solutions for its GUI elements and has a complicated coloration. This gives it a fancy look, but makes it harder to port between operating systems. Any suggestions? Do you have access to a macOS computer?
I am updating my proposal, I will send it once I will edit it after adding all these things
Vidit Jain said:
I want to see moc files and for that I have to open the project in qt. Can you please help me with that Himanshu Sekhar Nayak ?
??? In MS Visual Studio, they are included in the project sources. In Linux with gcc and make, they are in the build directory's include subdirectory.
Daniel Rossberg said:
Vidit Jain said:
I want to see moc files and for that I have to open the project in qt. Can you please help me with that Himanshu Sekhar Nayak ?
??? In MS Visual Studio, they are included in the project sources. In Linux with gcc and make, they are in the build directory's include subdirectory.
When I am opening those files in visual studio, a blanck screen is coming, with no code
Some of them are empty, i.e., there is nothing to moc. However, some of them have code, e.g. moc_CollapsibleWidget.cpp.
Hi @Vidit Jain, to complete your application, you should provide a patch. Sean came up with some ideas regarding such patches. However, because you want to work on the GUI, I would like to see a patch for arbalest, which shows that you are able to work on it. Is there something, which can easily improved?
Daniel Rossberg said:
Hi Vidit Jain, to complete your application, you should provide a patch. Sean came up with some ideas regarding such patches. However, because you want to work on the GUI, I would like to see a patch for arbalest, which shows that you are able to work on it. Is there something, which can easily improved?
Thanks @Daniel Rossberg for considering. I cannot think of anything that can be easily improved as of now. If you have anything, than I can work on that or else I can start working on select primitive feature?
Vidit Jain said:
Daniel Rossberg said:
Hi Vidit Jain, to complete your application, you should provide a patch. Sean came up with some ideas regarding such patches. However, because you want to work on the GUI, I would like to see a patch for arbalest, which shows that you are able to work on it. Is there something, which can easily improved?
Thanks Daniel Rossberg for considering. I cannot think of anything that can be easily improved as of now. If you have anything, than I can work on that or else I can start working on select primitive feature?
One thing you can submit either:
Himanshu Sekhar Nayak said:
Vidit Jain said:
Daniel Rossberg said:
Hi Vidit Jain, to complete your application, you should provide a patch. Sean came up with some ideas regarding such patches. However, because you want to work on the GUI, I would like to see a patch for arbalest, which shows that you are able to work on it. Is there something, which can easily improved?
Thanks Daniel Rossberg for considering. I cannot think of anything that can be easily improved as of now. If you have anything, than I can work on that or else I can start working on select primitive feature?
One thing you can submit either:
- Check why mouse selection is not working in windows. You can debug and see.
- Once a new tab is created, you can activate mouse selection button and it stays active even if you close it. Same applies if you open a .obj file and activate the mouse selection and close the tab, the mouse selection stays active. Find a way to disable it.
I have started working on first one
Remember what I put in my earlier post also -- some code submission is vastly more important than no code submission. If you can't figure it out, work on something even simpler that is an improvement. If you can't figure out something GUI, work on something non-GUI. Something is absolutely better than nothing.
Sean said:
Remember what I put in my earlier post also -- some code submission is vastly more important than no code submission. If you can't figure it out, work on something even simpler that is an improvement. If you can't figure out something GUI, work on something non-GUI. Something is absolutely better than nothing.
Yes, I will keep it in mind.
Hey @Himanshu Sekhar Nayak, can you please tell me what all variables I have to setup in CMake while building Arbalest?
Vidit Jain said:
Hey Himanshu Sekhar Nayak, can you please tell me what all variables I have to setup in CMake while building Arbalest?
BRLCAD_BASE_DIR
, BRLCAD_VERSION
, BRLCAD_MOOSE_DIR
, BRLCAD_MOOSE_INCLUDE_DIR
.
Himanshu Sekhar Nayak said:
Vidit Jain said:
Hey Himanshu Sekhar Nayak, can you please tell me what all variables I have to setup in CMake while building Arbalest?
BRLCAD_BASE_DIR
,BRLCAD_VERSION
,BRLCAD_MOOSE_DIR
,BRLCAD_MOOSE_INCLUDE_DIR
.
Not really. Arbalest links with MOOSE. Therefore, you may need to set BRLCAD_MOOSE_DIR
. See the error message in your CMake configuration. It should mention it.
The other variables are used during the MOOSE build.
... or set automatically.
I gave all the variables from building moose to arbalest :sweat_smile:
I was thinking of this one patch where when on home screen, we have list of shortcuts but we can't just click on the text there to use it.. like in vscode we can have that functionality..
Screenshot-2024-04-11-114245.png
@Daniel Rossberg
Hmm, maybe. What shall happen if somebody clicks on "Left Mouse Button"?
Ya.. thats something we have to look into but for creating and opening new file.. that will be useull
One solution I can think of is we can categories them in some other section. That section will not be clickable.
We can use different colours to segregate.
Currently, it is a simple help page. You want to turn it into a start page. Good.
A "What do you want to do" at the top? Followed by a short help section, with the most important shortcuts ans mouse gestures? Okay, make a proposal (PR, show me your code ;).
I started the implenting it. So the way in which I am implementing it was in
HelpWidget.cpp
I added an <a> tag to the Ctrl+N
HelpWidget::HelpWidget() : QVBoxWidget() {
setObjectName("helpWidget");
QVBoxWidget* container = new QVBoxWidget();
QString
text = "New File <a href=\"Ctrl+N\" style=\"color:$Color-ColorText\">Ctrl+N</a> <br><br>"
"Open File <a href=\"Ctrl+O\" style=\"color:$Color-ColorText\">Ctrl+O</a> <br><br>"
"Save File <a href=\"Ctrl+S\" style=\"color:$Color-ColorText\">Ctrl+S</a> <br><br>"
"<br><br>"
"Drag with <font style=\"color:$Color-ColorText\">Mouse Left Button</font> to rotate viewport camera<br><br>"
"Drag with <font style=\"color:$Color-ColorText\">Mouse Right Button</font> to move viewport camera<br><br>"
"Zoom In / Zoom Out <font style=\"color:$Color-ColorText\">Mouse Wheel</font> <br><br>"
"<br><br>"
"Focus camera on selected item <font style=\"color:$Color-ColorText\">F</font> <br><br>"
"Focus camera on all visible items <font style=\"color:$Color-ColorText\">Ctrl+F</font> <br><br>"
"Use keys <font style=\"color:$Color-ColorText\">1 2 3 4</font> to switch between viewports<br><br>"
"Open all viewports in quad view <font style=\"color:$Color-ColorText\">5</font> <br><br>"
"Toggle grid on / off <font style=\"color:$Color-ColorText\">G</font> <br><br>"
"<br><br>"
"Raytrace current viewport <font style=\"color:$Color-ColorText\">Ctrl+R</font> <br><br>";
text = Globals::theme->process(text);
QLabel* intro = new QLabel(text);
//intro->setWordWrap(true);
intro->setMargin(5);
intro->setObjectName("helpWidget");
intro->setTextFormat(Qt::RichText);
intro->setTextInteractionFlags(Qt::TextBrowserInteraction);
intro->setOpenExternalLinks(true);
intro->setMargin(80);
// Connect the link clicked signal to a slot
connect(intro, SIGNAL(linkActivated(QString)), this, SLOT(onLinkClicked(QString)));
container->addWidget(intro);
QScrollArea* scrollArea = new QScrollArea();
scrollArea->setObjectName("helpWidget");
addWidget(scrollArea);
scrollArea->setWidget(container);
}
void HelpWidget::onLinkClicked(const QString& link) {
// Check if the link corresponds to Ctrl+N
if (link == "Ctrl+N") {
// Call your function for Ctrl+N here
emit newFileRequested();
}
}
void HelpWidget::newFileRequested() {
}
and now in MainWindow.cpp
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_mouseAction{nullptr}
{
loadTheme();
prepareUi();
prepareDockables();
connect(helpWidget, &HelpWidget::newFileRequested, this, &MainWindow::newFile);
documentArea->addTab(new HelpWidget(), "Quick Start");
if(QCoreApplication::arguments().length()>1){
openFile(QString(QCoreApplication::arguments().at(1)));
}
Globals::mainWindow = this;
setCentralWidget(helpWidget);
}
But its giving some weired error in qobject.h file "Unhandled exception at 0x00007FFB65CAA9A5 (Qt5Cored.dll) in arbalest.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF."
I have updated the corresponding .h files for the functions
@Daniel Rossberg can you please help
Hmm, where does the access violation occur? At which line of which file in arbalest?
Under which conditions does the access violation occur?
Vidit Jain said:
<a href=\"Ctrl+N\" style=\"color:$Color-ColorText\">Ctrl+N</a>
connect(helpWidget, &HelpWidget::newFileRequested, this, &MainWindow::newFile);
how you are accessing helpWidget
here?
Daniel Rossberg said:
Hmm, where does the access violation occur? At which line of which file in arbalest?
Its in qobject.h line number 264
Himanshu Sekhar Nayak said:
Vidit Jain said:
<a href=\"Ctrl+N\" style=\"color:$Color-ColorText\">Ctrl+N</a>
connect(helpWidget, &HelpWidget::newFileRequested, this, &MainWindow::newFile);
how you are accessinghelpWidget
here?
I imported it
@Daniel Rossberg , I am not able to figure out anything yet..
Okay, three points:
- Fork arbalest on github.
- Create a branch in your fork, derived from the main branch, for your development.
- After pushing the changes to your github fork, create a pull request, which we can evaluate.
BTW, I think I know what's wrong. The cause is in a part of the code, you haven't provided yet :wink:
It is however important for you to learn, how to work with code, treat bugs, give extensive reports... Knowing this, makes it much easier to mentor you.
Vidit Jain said:
Himanshu Sekhar Nayak said:
Vidit Jain said:
<a href=\"Ctrl+N\" style=\"color:$Color-ColorText\">Ctrl+N</a>
connect(helpWidget, &HelpWidget::newFileRequested, this, &MainWindow::newFile);
how you are accessinghelpWidget
here?I imported it
Imported it ?
As Daniel said, it will be best if you can send a PR in a separate branch. It will be easier to debug whole code instead of partial.
I guess <a href="Ctrl+N">
might not be a good solution here since it completely relies on a link. I tested this replacing Ctrl + N
with www.google.com
and guess what it is able to open a tab in browser and went to www.google.com
but for Ctrl+N
it shows ShellExecute 'Ctrl+N' failed (error 2).
Himanshu Sekhar Nayak said:
As Daniel said, it will be best if you can send a PR in a separate branch. It will be easier to debug whole code instead of partial.
I am creating a repo
Its giving some error.. fixing it and will send
This might be a good solution to implement own Clickable QLabel
? I found a src Clickable QLabel - Qt Wiki
Himanshu Sekhar Nayak said:
This might be a good solution to implement own
Clickable QLabel
? I found a src Clickable QLabel - Qt Wiki
Ohh yes.. I am going through it once
https://github.com/ViditJain123/arbalest
this is the repo I am working in
:+1:
You should however create a branch for your development. Doing your changes in the main branch pollutes it and can make your fork unusable for the further development.
Ok ok..i will create a branch
Daniel Rossberg said:
Okay, three points:
- Describe, what I have to do, to reproduce the crash. Does it happen at program start? Or, where do I have to click?
- Run the program in the debugger. In Visual Studio it's the green triangle. Make sure that you start arbalest with it. How does the call stack look, when the program crashes?
- Provide us your full code, not only snippets:
- Fork arbalest on github.
- Create a branch in your fork, derived from the main branch, for your development.
- After pushing the changes to your github fork, create a pull request, which we can evaluate.BTW, I think I know what's wrong. The cause is in a part of the code, you haven't provided yet :wink:
It is however important for you to learn, how to work with code, treat bugs, give extensive reports... Knowing this, makes it much easier to mentor you.
Can you please tell me this now:sweat_smile:
I am not able to figure out
(deleted)
Vidit Jain said:
I am not able to figure out
You didn't send the PR from your branch?
Himanshu Sekhar Nayak said:
Vidit Jain said:
I am not able to figure out
You didn't send the PR from your branch?
Just sent it.
https://github.com/BRL-CAD/arbalest/pull/47
Vidit Jain said:
Edit your PR name something like Convert help page to start page
or anything which is suitable ? Inside that PR, solution and error can remain.
Yaa.. I updated everything :sweat_smile:
I may need some time to review your PR... (other obligations, you know)
@Sean @Daniel Rossberg Did you go through my pr?
Not yet. This week is a very busy one. But, this is not your fault. You have provided a PR - and I hope to be able to review it at the weekend.
Daniel Rossberg said:
Not yet. This week is a very busy one. But, this is not your fault. You have provided a PR - and I hope to be able to review it at the weekend.
Ohh, never mind.
Vidit Jain said:
Sean Daniel Rossberg Did you go through my pr?
I am currently looking to your code.
@Himanshu Sekhar Nayak as you said in the comment of the pull request that I didn't initiate the pointer, I did so and the application is working fine now, though its not working as expected
@Vidit Jain, please, update your PR then.
Vidit Jain said:
Himanshu Sekhar Nayak as you said in the comment of the pull request that I didn't initiate the pointer, I did so and the application is working fine now, though its not working as expected
As I said earlier that QLabel::linkActivated
might not be the best fit here since it relies on URLs only and it reports ShellExecute 'Ctrl+N' failed (error 2)
.
If you replace with any URL, it works but it is not what we expected.
Himanshu Sekhar Nayak said:
Vidit Jain said:
Himanshu Sekhar Nayak as you said in the comment of the pull request that I didn't initiate the pointer, I did so and the application is working fine now, though its not working as expected
As I said earlier that
QLabel::linkActivated
might not be the best fit here since it relies on URLs only and it reportsShellExecute 'Ctrl+N' failed (error 2)
.
Yes, it it reporting that. Should I try implementing it with Clickable QLabel? @Daniel Rossberg
Vidit Jain said:
Yes, it it reporting that. Should I try implementing it with Clickable QLabel? @Daniel Rossberg
This is not the point (yet) in your code.
Do you remember the three points I posted here? You fulfilled the third one, which es very helpful, but didn't managed the first two. For us, the first one is very important too: Describe in detail, what you did in the program (e.g.: start the program, click in the "X" button, click on the "Y" button) and what the result was (e.g.: crash with access violation).
A bit about your code (we can move this discussion to github, if you prefer this): You introduced a helpWidgetInstance
pointer, but why? It's true that if you create a new pointer variable, than it's on you to initialize it. But in this case, I would say, going without it would be the better solution. If you want to know why, look, where the real instance of HelpWidget are created.
To reproduce the issue -
After setting up the arbalest properly, when you launch it debug mode, it will crash at the very beginning. This is due to the access violation.
Call stack -
HelpWidget was the last function called in the call stack so far I remember.
Yaa, I realised that creating a new pointer is not really necessary.. we can do it without creating the new pointer. I am thinking of a new approach.
While debugging the code, I realized that the approach that I was using to create the signal is working. The function that's doing that is not getting called only.
Vidit Jain said:
To reproduce the issue -
After setting up the arbalest properly, when you launch it debug mode, it will crash at the very beginning. This is due to the access violation.Call stack -
HelpWidget was the last function called in the call stack so far I remember.Yaa, I realised that creating a new pointer is not really necessary.. we can do it without creating the new pointer. I am thinking of a new approach.
While debugging the code, I realized that the approach that I was using to create the signal is working. The function that's doing that is not getting called only.
not working*
Good to hear that you were able to get the call stack.
Regarding the pointer initialization issue: To make it work, you have to make slight changes on your logic. But first, you need to understand, how the HelpWidget is created (used). Therefore, find the lines in the original code, where the HelpWidged is created/initialized (i.e., the calls of the constructor).
@Vidit Jain firstly, congratulations on getting selected in Google Summer of Code 2024. During your contribution and pre contribution period @Himanshu and I will be directly mentoring you. Of course, Sean and Daniel will add their invaluable advice and suggestions. It's going to be fun working with you on new GUI of BRL-CAD.
We are now in the community bonding period. You will learn about how we will work and communicate throughout the contribution period. Remember, "proactive communication" helps solve and avoid many issues quickly and saves a lot of time. So keep the updates and conversations going here.
Thanks a lot @Amanjot Singh @Himanshu for selecting me. I am really very excited to work with you all and learn.
I will be very active in the community for sure and want to make the most out of this time for sure.
Hello mentors, actually, my end term exams are going on right now, so I am not able to contribute at the moment. Is it fine if I start contributing after 16th?
The official coding period starts at May 27th. Therefore, it is okay. You should however start discussing with your mentors earlier, e.g. about your PR, to get into the "flow".
Hey @Himanshu @Amanjot Singh , I am done with my exams now, and now I will start working again with full power. As @Daniel Rossberg said, I will start working on my earlier pr.
@Vidit Jain I would encourage you to keep sharing your progress
Amanjot Singh said:
Vidit Jain I would encourage you to keep sharing your progress
I am working on the landing page.. mostly I will update the pr tomorrow
Himanshu said:
I have updated GSoC 2024 wiki page where you can add your dev log, project plan and abstract. Here are some samples you can see from past years. 2023, 2022.
Ohh thanks
I wanted to make a new header file for clickable text, how can I include it in the build process?
@Amanjot Singh @Himanshu
Vidit Jain said:
I wanted to make a new header file for clickable text, how can I include it in the build process?
Amanjot Singh Himanshu
You have to add the .cpp file inside CMakeLists.txt to add it into the build process.
What about .h files?
Vidit Jain said:
What about .h files?
You don't have to explicitly list header files.
CMake manages dependencies and its primary focus on building executables and libraries from source files. Header files are included by source files, and the compiler automatically processes them as part of the source file compilation. So, header files don’t need separate compilation rules.
@Vidit Jain what's the current progress?
I am currently working on my pr only, but I am stuck on the part where I have to send a signal from HelpWidget.cpp to MainWindow.cpp
There is some or another error whenever I am trying any way to do the same
Can you please tell what should be the best approach to do that.. I can't figure it out.
Thanks
Vidit Jain said:
Can you please tell what should be the best approach to do that.. I can't figure it out.
Thanks
Did you find the places where HelpWidget
will be created?
What do you mean by places?
Helpwidget is rendering at the start of application. Thats the only place where I can see it
I mean where the connection between ctrlNPressed()
and newFile()
can be made there.
So my was when Ctrl+N will be clicked, it will create a signal and the MainWindow.cpp will catch it and will execute a functin which it already has which is newFile, but the signal is not emitting only and there is no connection that's getting established :(.. there are no logs in terminal so I can't figure out anything while even debugging
Vidit Jain said:
So my was when Ctrl+N will be clicked, it will create a signal and the MainWindow.cpp will catch it and will execute a functin which it already has which is newFile, but the signal is not emitting only and there is no connection that's getting established :frown:.. there are no logs in terminal so I can't figure out anything while even debugging
If you want to see logs in terminal. Use qDebug() << "Check";
and include QDebug
. In this way, you can check if a connection is made or not.
@Vidit Jain okay I debugged it now and found something.
I saw intro->setOpenExternalLinks(true);
which is set to true
in HelpWidget.cpp
. Making it false
enables us that the QLabel
handles link clicks internally rather than delegating them to the system's default web browser.
When setOpenExternalLinks
is set to true
, the QLabel
opens the link in an external web browser, bypassing the linkActivated
signal and preventing our custom slot from being called.
@Vidit Jain Now your code will work as expected I guess because I guess so far you have already made the connection.
For your reference setOpenExternalLinks
QLabel Class | Qt Widgets 5.15.17
Thanks, finally it worked!
Thanks a lot
In my final commit I have updated the code.. looking forward for the review.
Thanks
Okay, a first review. @Vidit Jain, I start always with a look at formal things. There I see, that you mixed stylistic with functional changes. You should not do this. Create separate pull requests for stylistic and functional changes. Because your PR is about adding new functionality, you should revert all stylistic/white space changes.
@Vidit Jain I want something you to move that connect
inside MainWindow
constructor to HelpWidget
constructor. So that HelpWidget
takes its parent widget as a parameter in its constructor, and the signal-slot connection is made within the HelpWidget
itself. This makes HelpWidget
more self-contained and easier to manage.
@Vidit Jain I made a review on your PR. Make those changes and then we can focus on next things.
@Daniel Rossberg Since MainWindow::newFile()
is private. So how we are going to connect inside HelpWidget
constructor so that it can call newFile()
whenever Ctrl+N
is clicked?
Himanshu said:
Daniel Rossberg Since
MainWindow::newFile()
is private. So how we are going to connect insideHelpWidget
constructor so that it can callnewFile()
wheneverCtrl+N
is clicked?
You, or @Vidit Jain, should move newFile()
to the public slots.
(deleted)
Can I create a new pull request? My older one is a little messed up :)
Sure.
I have created a more cleaner pull request
Vidit Jain said:
I have created a more cleaner pull request
What about the changes that I commented in the review? Did you see it? I saw whitespace thing is gone. I guess you are already working on it that I gave feedback.
Also close that old PR too.
I am working on the changes you asked me to make. I will close the older PR.
I have made all the changes that were suggested in my latest commit. @Himanshu @Daniel Rossberg
@Daniel Rossberg I had tested the new changes and it's working as expected. I saw the code too and it's fine. You can check the PR and merge it.
Hmm, couldn't line 45 in MainWindow.cpp simply be documentArea->addTab(new HelpWidget(this), "Quick Start");
?
The HelpWidget* helpWidget;
in MainWindow.h isn't needed, or? It isn't updated in MainWindow.cpp line 595 anyway.
In HelpWidget.cpp, parent is casted to MainWindow. I would prefer using the SIGNAL and SLOT macros here: connect(this, SIGNAL(ctrlNClicked), parent, SLOT(newFile));
.
Daniel Rossberg said:
Hmm, couldn't line 45 in MainWindow.cpp simply be
documentArea->addTab(new HelpWidget(this), "Quick Start");
?The
HelpWidget* helpWidget;
in MainWindow.h isn't needed, or? It isn't updated in MainWindow.cpp line 595 anyway.In HelpWidget.cpp, parent is casted to MainWindow. I would prefer using the SIGNAL and SLOT macros here:
connect(this, SIGNAL(ctrlNClicked), parent, SLOT(newFile));
.
Hmm, I see. Unnecessarily we are taking HelpWidget* helpWidget;
. It can be removed. And regarding dynamic casting that thing is also not needed I see now. Both can be removed.
@Daniel Rossberg I wrote like this connect(this, &HelpWidget::ctrlNClicked, parent, &MainWindow::newFile);
and got error 'QObject::connect': no overloaded function could convert all the argument types
. I guess there is no context in which this conversion is possible so it throws error.
Himanshu said:
Daniel Rossberg I wrote like this
connect(this, &HelpWidget::ctrlNClicked, parent, &MainWindow::newFile);
and got error'QObject::connect': no overloaded function could convert all the argument types
. I guess there is no context in which this conversion is possible so it throws error.
Of course, we have to use the SIGNAL and SLOT macros then, as I did in my example. (Okay, which isn't correct to, because I omitted the parameters of the signal and slot.)
I made all the suggested changes in my latest commit
Almost:
#include "HelpWidget.h"
from MainWindow.h MainWindow* mainWindow = qobject_cast<MainWindow*>(parent);
if (mainWindow) {
in HelpWidget.cpp anymore. The SIGNAL and SLOT macros will take care that it connects with existing functions only.
I have fixed everything in this commit
I was trying to use the select primitive feature of arbalest. For me its working fine.. can you tell me what exactly the issue is?
I am thinking of taking up that issue next. If you all want we can work on something else as well. @Himanshu @Daniel Rossberg @Amanjot Singh
Vidit Jain said:
I was trying to use the select primitive feature of arbalest. For me its working fine.. can you tell me what exactly the issue is?
I am thinking of taking up that issue next. If you all want we can work on something else as well. Himanshu Daniel Rossberg Amanjot Singh
Yes, the mouse select option is working I saw it today. It doesn't work for me when it is full screen idk why but works fine when I restore down.
Vidit Jain said:
I have fixed everything in this commit
Hmm, MainWindow.h has still the #include "HelpWidget.h"
.
And in HelpWidget.h:
parent = nullptr
)?Vidit Jain said:
I was trying to use the select primitive feature of arbalest. For me its working fine.. can you tell me what exactly the issue is?
I am thinking of taking up that issue next. If you all want we can work on something else as well. Himanshu Daniel Rossberg Amanjot Singh
Yes, it works, but it could do better. E.g., show all regions on the ray (in a dialog box?), and highlight the selected regions in the graphics view.
@Vidit Jain You can also start on after selecting the primitive there should be an option to resize the primitive too. This idea is also good.
@Daniel Rossberg I noticed we can extend object-oriented C++ Geometry API. But I forgot where to look on to start with.
Do you refer to MOOSE? Its build is currently broken, because of the changes for externals in the brlcad repository. I've a work-around, which works at least for Linux, but haven't committed it yet. The real fix needs some time.
Daniel Rossberg said:
Vidit Jain said:
I have fixed everything in this commit
Hmm, MainWindow.h has still the
#include "HelpWidget.h"
.And in HelpWidget.h:
- Line 11: There is no default constructor anymore
- Line 12: Is it really a good idea, to default the parent with the null pointer (
parent = nullptr
)?
When I am removing import "Helpwidget.h" from MainWindow.h, its giving error in MainWindow.cpp at All places where we are using new HelpWidget(this).
Daniel Rossberg said:
Do you refer to MOOSE? Its build is currently broken, because of the changes for externals in the brlcad repository. I've a work-around, which works at least for Linux, but haven't committed it yet. The real fix needs some time.
Yes, but idk that moose build is currently broken for linux. Working fine in Windows.
Vidit Jain said:
Daniel Rossberg said:
Vidit Jain said:
I have fixed everything in this commit
Hmm, MainWindow.h has still the
#include "HelpWidget.h"
.And in HelpWidget.h:
- Line 11: There is no default constructor anymore
- Line 12: Is it really a good idea, to default the parent with the null pointer (
parent = nullptr
)?When I am removing import "Helpwidget.h" from MainWindow.h, its giving error in MainWindow.cpp at All places where we are using new HelpWidget(this).
Remove MainWindow.h
from HelpWidget.cpp. Now it will work.
Himanshu said:
Daniel Rossberg said:
Do you refer to MOOSE? Its build is currently broken, because of the changes for externals in the brlcad repository. I've a work-around, which works at least for Linux, but haven't committed it yet. The real fix needs some time.
Yes, but idk that moose build is currently broken for linux. Working fine in Windows.
With the new build, some static libraries are missing. If you haven't cleaned up your your install directory, they may be still there. So, be happy that it still works for you :wink:
I have updated the PR here
@Vidit Jain: See my first comment in https://brlcad.zulipchat.com/#narrow/stream/111975-Google-Summer-of-Code/topic/New.20BRL-CAD.20GUI/near/441078691
Beside this, it looks okay.
If we are removing that default constructor from HelpWidget
then I see creating HelpWidget object by dynamically casting from documentArea will be useless. Here in this code:
connect(helpAct, &QAction::triggered, this, [this](){
HelpWidget * helpWidget = dynamic_cast<HelpWidget*>(documentArea->widget(0));
if (helpWidget== nullptr){
documentArea->insertTab(0, new HelpWidget(this), "Quick Start");
}
documentArea->setCurrentIndex(0);
});
Hmm, can you explain this in more detail? A cast doesn't create an object, and it seems to work well without the default constructor. Removing it shall prevent accidentally calling it.
Daniel Rossberg said:
Hmm, can you explain this in more detail? A cast doesn't create an object, and it seems to work well without the default constructor. Removing it shall prevent accidentally calling it.
So that portion of code looks like after removing casting,
connect(helpAct, &QAction::triggered, this, [this](){
documentArea->insertTab(0, new HelpWidget(this), "Quick Start");
documentArea->setCurrentIndex(0);
});
So whenever we are going to create new HelpWidget
we have to pass an object of type QWidget
.
I still don't get it. The cast is to test, if there is a help widget in documentArea, and if there is one, if the first one is the help widget. If there is no help widget in documentArea, one will be created. This ensures that there is one help widget and it is the first one (index 0). Your code would always create a new help widget, ending up with many of them in the document area.
Passing this (which is of type MainWindow) ensures, that the correct actions will happen, if the user clicks on a link.
Daniel Rossberg said:
I still don't get it. The cast is to test, if there is a widget in documentArea, and if there is one, if the first one is the help widget. If there is no help widget in documentArea, one will be created. This ensures that there is a help widget and it is the first one (index 0). You code would always create a new help widget, ending up with many of them in the document area.
Passing this (which is of type MainWindow) ensures, that the correct actions will happen, if the user clicks on the links.
Oh, I understand now. That we need to check if already there is a Quick Start
tab opened.
Hey @Daniel Rossberg ,
What should I work on next? I have these two options in my mind. Firstly, I noticed a bug with select primitive feature. It's not getting off when we are either changing or closing a document. Is it supposed to work like this, or is it a bug. Or I can start working on improving the same. There are some glitches going on in there.
I'm still waiting for the update of your PR regarding https://brlcad.zulipchat.com/#narrow/stream/111975-Google-Summer-of-Code/topic/New.20BRL-CAD.20GUI/near/441899050
Vidit Jain said:
Hey Daniel Rossberg ,
What should I work on next? I have these two options in my mind. Firstly, I noticed a bug with select primitive feature. It's not getting off when we are either changing or closing a document. Is it supposed to work like this, or is it a bug. Or I can start working on improving the same. There are some glitches going on in there.
@Himanshu, can you say something about the primitive select feature? Sounds like a bug to me(?)
Daniel Rossberg said:
Vidit Jain said:
Hey Daniel Rossberg ,
What should I work on next? I have these two options in my mind. Firstly, I noticed a bug with select primitive feature. It's not getting off when we are either changing or closing a document. Is it supposed to work like this, or is it a bug. Or I can start working on improving the same. There are some glitches going on in there.Himanshu, can you say something about the primitive select feature? Sounds like a bug to me(?)
Yes, that select primitive button remains active even after document gets closed. I saw this problem during my gsoc time.
Daniel Rossberg said:
Vidit Jain said:
I have fixed everything in this commit
Hmm, MainWindow.h has still the
#include "HelpWidget.h"
.And in HelpWidget.h:
- Line 11: There is no default constructor anymore
- Line 12: Is it really a good idea, to default the parent with the null pointer (
parent = nullptr
)?
Now I understand what you asked :sweat_smile:. So if we are removing default HelpWidget
constructor then in scenarios where a parent
is not necessary or the widget is intended to be a top-level widget, having to always pass nullptr
can be inconvenient and add verbosity to the code.
By not providing a default nullptr
value for the parent parameter, we make it mandatory for users to always specify a parent or explicitly pass nullptr
, which can reduce the convenience and readability of the code.
So we will face problem here:
connect(this, SIGNAL(ctrlNClicked()), parent, SLOT(newFile()));
connect(this, SIGNAL(ctrlOClicked()), parent, SLOT(openFileDialog()));
My point is that we think that every HelpWidget is a child of MainWindow. By not providing a default constructor for HelpWidged, the compiler will complain whenever this assumption isn't fulfilled.
In a previous version, parent was tested for nullptr. Then, I wanted a cast to be changed to the SIGNAL and SLOT macros ... but not the test for nullptr to be removed. It was however removed, but because we provide parent explicitly, I don't consider this as a problem. BTW, how does connect() handle nullptr?
I have updated my pr here
Thanks, I'll have a look at it.
Daniel Rossberg said:
My point is that we think that every HelpWidget is a child of MainWindow. By not providing a default constructor for HelpWidged, the compiler will complain whenever this assumption isn't fulfilled.
In a previous version, parent was tested for nullptr. Then, I wanted a cast to be changed to the SIGNAL and SLOT macros ... but not the test for nullptr to be removed. It was however removed, but because we provide parent explicitly, I don't consider this as a problem. BTW, how does connect() handle nullptr?
Here what I got if I pass nullptr
:
image.png
That's okay. connect() checks the input and complains in the debug log, if there is something wrong with it, but doesn't crash.
When I building the latest merge.. its giving some errors after building .. I am looking into it
The only fix I can see is by adding "#include "HelpWidget.h" " in "MainWindow.h" . I don't why it is happening..
@Daniel Rossberg if you can help
Unfortunately, you removed the #include <include/HelpWidget.h>
from MainWindow.cpp. I readded it.
Daniel Rossberg said:
Unfortunately, you removed the
#include <include/HelpWidget.h>
from MainWindow.cpp. I readded it.
I am really sorry, by mistake I removed it from MainWindow.cpp instead of MainWindow.h :smiling_face_with_tear:
I have created a new PR here
I am really sorry for the mistake
Now I am starting to work on select primitive feature
@Vidit Jain you can delete your new PR that is for including missing HelpWidget
because it is fixed now.
@Daniel Rossberg @Himanshu the approach I am thinking to fix this bug is by emmiting a signal from wherever the document is getting its id. So whenever activeDocumentId is changing, it will emit a signal which will connect to MainWindow.cpp and from there we can turn off the toggle.
But I cannot find the function which assigning a document its id.. can you please help me with that
The documents are organized in the documentArea member variable of MainWindow of type QTabWidget. When the active Tab is changed, MainWindow::onActiveDocumentChanged() is called.
I created a new Pull request addressing the Select Object not turning off when changing document bug here
Vidit Jain said:
I created a new Pull request addressing the Select Object not turning off when changing document bug here
Looking for review on it.
@Daniel Rossberg @Himanshu I am looking for review on my latest pr
@Daniel Rossberg @Himanshu , now I am planning to start working on outlining the object that's being selected by the select object feature. But I don't have much idea on how to proceed. Can you please help me with that?
Thanks
Hmm, you could get the wireframe from the selected object and paint it on top of the general wireframe?
Vidit Jain said:
I created a new Pull request addressing the Select Object not turning off when changing document bug here
I was busy in some other work. I will check your PR by today or tomorrow.
@Vidit Jain There is some inconsistency in setChecked()
when I switch tabs.
What I found:
select
button, now you see checked is true
and button is active. Now I open another .g file and I saw that the select button have checked to false
which is fine. But when I switch back to previous .g file, the button is active and it's working when I select any object but the button UI itself is turned off
because you setChecked(false)
. So the button is still active but button UI shows it's off
.Only doing setChecked(false)
when document is changed is not going to work because the button still remains active showing select button UI to off.
@Daniel Rossberg Btw which behavior you suggest for select button when we switch tabs? So that we can implement that behavior for select
button.
Himanshu said:
Only doing
setChecked(false)
when document is changed is not going to work because the button still remains active showing select button UI to off.
I am not able to debug properly because the select primitive feature is not working for me.
Vidit Jain said:
Himanshu said:
Only doing
setChecked(false)
when document is changed is not going to work because the button still remains active showing select button UI to off.I am not able to debug properly because the select primitive feature is not working for me.
Is your taskbar hided in windows? Then turn it off. Or make that arbalest window size down by clicking on the maximize button. This way works for me.
Himanshu said:
Daniel Rossberg Btw which behavior you suggest for select button when we switch tabs? So that we can implement that behavior for
select
button.
Hmm, couldn't the button stay active and the selection will be made in the active document? (I haven't looked at the code yet, therefore I don't know, if this is in fact an option.)
Daniel Rossberg said:
Himanshu said:
Daniel Rossberg Btw which behavior you suggest for select button when we switch tabs? So that we can implement that behavior for
select
button.Hmm, couldn't the button stay active and the selection will be made in the active document? (I haven't looked at the code yet, therefore I don't know, if this is in fact an option.)
Yes, the select button stays active even if I switch to another document. So what will happen to that another document that I switched?
If you click on the graphics display, an object (usually a region) will be selected.
Daniel Rossberg said:
If you click on the graphics display, an object (usually a region) will be selected.
Okay then we will go with this one. @Vidit Jain So make sure that select button stays active for every document and the button UI shouldn't show off state even after document is changed.
Himanshu said:
Daniel Rossberg said:
If you click on the graphics display, an object (usually a region) will be selected.
Okay then we will go with this one. Vidit Jain So make sure that select button stays active for every document and the button UI shouldn't show off state even after document is changed.
I was trying to look to get the feature running as mentioned but I am not able to figure out whats going wrong, If @Daniel Rossberg @Himanshu have any idea what's wrong then can you please help me with that.
We wanted to make sure that select button UI stays active even after document or tab is changed once select button is clicked. So your PR does opposite. The select button UI remains off after a tab is changed. So make sure to make it active and select is working even after tab is changed.
@Vidit Jain, you have to understand, what the select-object-action selectObjectAct
does. E.g., it uses the activeDocumentId
and it calls selectObjectButtonAction()
or moveCameraButtonAction()
, which use the activeDocumentId
too.
Ya, I got that, but the thing is, I am not able to figure out why it is not always working. The logic I am seeing there seems fine, but it does not always work..
The original behavior of the button exactly matches the behavior you are expecting..
Probably, the structures have to be updated with the current activeDocumentId
, which changes when the document changes.
@Vidit Jain Did you tested your PR? Why there is two connect when document is changing? Btw when the select button is off, I saw it still calls two connects when a document is changed and calls selectObjectButtonAction()
and then moveCameraButtonAction()
.
I will test your PR after some time, I just checked the code only.
Himanshu said:
Vidit Jain Did you tested your PR? Why there is two connect when document is changing? Btw when the select button is off, I saw it still calls two connects when a document is changed and calls
selectObjectButtonAction()
and thenmoveCameraButtonAction()
.
The code is working fine. I have added these two connects because that was the only way I could figure out to make it work.
@Daniel Rossberg , I have updated my pr. The problem we are facing is that in the selectObjectAct, the activeDocumentId is not updating automatically. That's why we have to use another connect. If you have any better alternative to that, we can use that.
Also, I have noticed this bug that, until we are not clicking the focus button (which is present right to the name of object), we are not able to select the primitive and once we are clicking on that, then after only we are able to start using it. Is this a bug or this is how it is supposed to work?
Vidit Jain said:
Daniel Rossberg , I have updated my pr. The problem we are facing is that in the selectObjectAct, the activeDocumentId is not updating automatically. That's why we have to use another connect. If you have any better alternative to that, we can use that.
I suggested this way to Vidit because I thought that in future if we are creating many buttons where its state should be active even if document is switched. So that for every document change(when we switch tabs), we will check what buttons are active so that we can again call those button functions.
For now, select button is implemented for documents but if we going for any other buttons, we can do same for those buttons too.
Hmm, why haven't you made a slot function from updateSelectObjectState? This function could be simply called from onActiveDocumentChanged().
Vidit Jain said:
Also, I have noticed this bug that, until we are not clicking the focus button (which is present right to the name of object), we are not able to select the primitive and once we are clicking on that, then after only we are able to start using it. Is this a bug or this is how it is supposed to work?
Sounds like a bug. The focus button should change the displayed area only.
Daniel Rossberg said:
Hmm, why haven't you made a slot function from updateSelectObjectState? This function could be simply called from onActiveDocumentChanged().
Ah ha, how I can forget this that for every document change onActiveDocumentChanged()
is called. :dizzy:
@Daniel Rossberg @Vidit Jain I created a patch for the above issue. Let me know what you guys think.
Changes-On-64ac3f.patch
So what I did:
bool moveObjectEnabled = false;
in Display.h
.setMoveCameraMouseAction()
was called inside DisplayGrid::DisplayGrid(Document* document)
. Now setMoveCameraMouseAction()
is removed from there. So every time we change a document or switch, connect(documentArea, &QTabWidget::currentChanged, this, &MainWindow::updateMouseButtonObjectState);
will be used now and inside MainWindow::updateMouseButtonObjectState
, it is already calling setMoveCameraMouseAction()
. I change it like to this way to suit for new changes because once a document is created or switched, setMoveCameraMouseAction()
being called for 2 times so we are allocating and deallocating memory. So I thought to go this way.Previously also 2 times memory is being allocated and deallocated for move action.
(deleted)
Hmm, do you mean "move object" or "move camera"?
move camera
Daniel Rossberg said:
Hmm, do you mean "move object" or "move camera"?
@Daniel Rossberg @Himanshu I have started working on highlting the stuff that have been selected and for that I have started working on the approach that @Daniel Rossberg suggested.
The approach that I am planning is, I will be painting the selected object again that has been selected by the select object button. In SelectMouseAction.cpp, its returing m_selected.. I am planning to paint over it with different color and increse the width of the paint
I am not sure, how can I draw over the selected region? Is there any internal BRL-CAD stuff that we have to use to paint over it?
The rendering is done in the arbalest code. The GeometryRenderer class is a good start point to learn it.
However, you need a geometric representation of the selected object as a VectorList, which can be generated with BRLCAD::ConstDatabase::Plot()
.
How can I get FullobjectPath to rerender it? @Daniel Rossberg @Himanshu if you have any idea?
The result of the SelectMouseAction (getSelected()
) is in fact not only a region but its full path. I.e., you have it it DisplayGrid::setSelectObjectMouseAction()
. With document->getObjectTreeWidget()->select(regionName)
the tree widget is adjusted to it. Now, you need something similar for the graphics.
@Daniel Rossberg @Himanshu
Himanshu said:
Daniel Rossberg Vidit Jain I created a patch for the above issue. Let me know what you guys think.
Changes-On-64ac3f.patch
I guess this patch is working fine.. I don't think we can improve it any further. @Daniel Rossberg if you have any other inputs?
Also I have created a new pull request for highlight feature here. I have created a vectorList, its value is also getting updated but its color and width is not changing. I am not sure whats going wrong. If you can help @Daniel Rossberg @Himanshu
Vidit Jain said:
Daniel Rossberg Himanshu
Himanshu said:
Daniel Rossberg Vidit Jain I created a patch for the above issue. Let me know what you guys think.
Changes-On-64ac3f.patchI guess this patch is working fine.. I don't think we can improve it any further. Daniel Rossberg if you have any other inputs?
My only comment was regarding the moveObjectEnabled variable name. I would prefer moveCameraEnabled.
However, there is no pull request with this, or?
Vidit Jain said:
Also I have created a new pull request for highlight feature here. I have created a vectorList, its value is also getting updated but its color and width is not changing. I am not sure whats going wrong. If you can help Daniel Rossberg Himanshu
Hmm, you modified the SelectMouseAction class, which is the wrong place.
Daniel Rossberg said:
However, there is no pull request with this, or?
Who's going to send pr? Me or Vidit? I am okay to transfer my patch to him so that he can create a pr and send it.
Daniel Rossberg said:
Vidit Jain said:
Also I have created a new pull request for highlight feature here. I have created a vectorList, its value is also getting updated but its color and width is not changing. I am not sure whats going wrong. If you can help Daniel Rossberg Himanshu
Hmm, you modified the SelectMouseAction class, which is the wrong place.
Should I create a new file for this or should I put it in GeometryRenderer.cpp?
@Vidit Jain, did you noticed my comment to your PR #123 5 days ago?
Oh.. I am really sorry.. I missed the notification
@Daniel Rossberg @Himanshu , I am working on the highlight selected object feature from the past few days. I am facing this issue (you can check the current pr for it), the code is traversing through the rerendering part but its never rendering it.. I am not sure why this is happening.. maybe i guess its the issue of z-index?
If you have any idea.. can you please tell me
I'll have a look at it tomorrow.
@Vidit Jain, your PR #52 has still the state from July 7th, i.e. before we talked about how to do it right.
Vidit Jain said:
Daniel Rossberg Himanshu , I am working on the highlight selected object feature from the past few days. I am facing this issue (you can check the current pr for it), the code is traversing through the rerendering part but its never rendering it.. I am not sure why this is happening.. maybe i guess its the issue of z-index?
I will check it in coming Saturday and Sunday. I am little bit busy in internship and getting less time. So mostly Saturday and Sunday, I will see.
Daniel Rossberg said:
Vidit Jain, your PR #52 has still the state from July 7th, i.e. before we talked about how to do it right.
Actually I haven't updated the pr because I am facing the same issue again and again after all different ways that I am trying to do for the rerendering part and that is, something is rerendering the original color over the highlighted yellow render that I am creating after selecting the object. I am not able to figure out when is the last render of the selected object happening and have to rerender it. But I am not able to figure that out..
Did you modified DisplayManager like we talked about?
Daniel Rossberg said:
Did you modified DisplayManager like we talked about?
I have tried doing the stuff that you said.. can you please tell me in a little brief what all that you said?
@Daniel Rossberg Can you pleasae tell me in a little brief what all functions I am suppose to use from DisplayManager.. I am trying to do so.. but I am not able to figure out why the re-rendered part not visible.
The basic OpenGL widgets are of type Display (derived from QOpenGLWidget). If they shall refresh their content, paintGL() will be called. This function calls render() from GeometryRenderer, which again uses the functions provided with DisplayManager.
The idea was to add functions to DisplayManager, which set and clear a BRLCAD::VectorList. Then, this vector list will be drawn after the usual objects by GeometryRenderer::render().
To set and clear the vector list by SelectMouseAction, m_watched->getDisplayManager() could be used there.
@Daniel Rossberg @Vidit Jain Is this the way we should proceed? I wrote a template like this.
void DisplayManager::setVectorList(const QString &objectFullPath, BRLCAD::VectorList *vectorList) {
display.getDocument()->getDatabase()->Plot(objectFullPath.toUtf8(), *vectorList);
display.getDisplayManager()->setFGColor(1.0f, 1.0f, 0.0f, 1.0f); // Set color to yellow
/*
Do something that new vector list will be drawn after the current objects by GeometryRenderer::render().
*/
display.update();
}
void DisplayManager::clearVectorList(BRLCAD::VectorList *vectorList) {
vectorList->Clear();
}
The structure looks fine to me
I'm afraid, this won't do it. To take effect, QOpenGLWidget::paintGL() or a function called inside has to be touched. E.g.
void GeometryRenderer::render() {
document->getDisplay()->getDisplayManager()->saveState();
if (!objectsToBeDisplayedIds.empty()) {
for (int objectId : objectsToBeDisplayedIds) {
if (!objectIdDisplayListIdMap.contains(objectId)) {
drawSolid(objectId);
}
visibleDisplayListIds.append(objectIdDisplayListIdMap[objectId]);
}
objectsToBeDisplayedIds.clear();
}
for (int displayListId : visibleDisplayListIds) {
document->getDisplay()->getDisplayManager()->drawDList(displayListId);
}
document->getDisplay()->getDisplayManager()->drawSuffix();
document->getDisplay()->getDisplayManager()->restoreState();
}
void DisplayManager::setSuffix(const BRLCAD::VectorList& vectorList) {
suffix = vectorList;
}
void DisplayManager::clearSuffix(void) {
suffix.Clear();
}
void DisplayManager::drawSuffix(void) {
drawVList(&suffix);
}
No idea if this works, but it should point to the right direction.
@Daniel Rossberg @Himanshu I have created a new pull request here
Its working fine but the issue is its not going back to its normal state after turning off the select object button.
I will look into it.
Nice to hear that you got closer to the solution. Some thought about your PR:
@Daniel Rossberg @Himanshu , I have updated the pr here.
Daniel Rossberg said:
Nice to hear that you got closer to the solution. Some thought about your PR:
- m_selectedObjectDisplayListId is always 0. This variable is never used and not needed. You should remove it.
- SelectMouseAction::Deselect() is never called, so you can remove it?
- DisplayManager::clearSuffix() should be called to remove the selection highlighting from the screen. Maybe in the destructor of SelectMouseAction?
- In SelectMouseAction::eventFilter() you should call setSuffix() from DisplayManager only. Setting the color should be done in DisplayManager::drawSuffix(), protected with a saveState()/restoreState(). Display::forceRerenderFrame() is doing the redraw.
I am not sure about protection with saveState() and restoreState because drawSuffix() is already protected by that in GeometryRenderer::render()
(deleted)
You are right: The way drawSuffix() is called does not need a saveState()/restoreState().
@Vidit Jain There is a bug I saw now in your PR. Highlight feature doesn't work for other document. For example if I have 2 tabs opened then it doesn't work for 2nd tab. Can you check that?
Himanshu said:
Vidit Jain There is a bug I saw now in your PR. Highlight feature doesn't work for other document. For example if I have 2 tabs opened then it doesn't work for 2nd tab. Can you check that?
I was not working on the latest commit of the arbalest, that's why the bug was there. I have shifted to the latest commit now and its working perfectly fine now.
(deleted)
@Daniel Rossberg @Himanshu I guess we can move to solve some different problem since we are done with the Highlight feature. Do you have some suggestions on what should I start working on after this?
For example: https://github.com/BRL-CAD/arbalest/issues
I also noticed this one bug that selectObject only works when we are focusing on it through the focus button. Without clicking on the focus button, it will not work but once you click on the focus button, it will start working.
Daniel Rossberg said:
For example: https://github.com/BRL-CAD/arbalest/issues
This could be connected to https://github.com/BRL-CAD/arbalest/issues/18. I'ts probable because the start point of the rays is behind the scene. Maybe, you can fix this.
@Vidit Jain I reviewed your PR. Can you make some changes that I asked here https://github.com/BRL-CAD/arbalest/pull/52#pullrequestreview-2251575775
@Himanshu I have updated the PR with all the suggested changes here
I am thinking of starting to work on the issue . Can you please tell me where should I start from @Daniel Rossberg @Himanshu
Can you reproduce the issue?
Himanshu said:
Daniel Rossberg I am able to produce fully ray traced image by clicking on
Reset the viewports and focus on the visible
button having Z-axis to 0. Screenshot-12.png
@Vidit Jain Here what I found previously for https://github.com/BRL-CAD/arbalest/issues/18. You can see my older messages, you will get some idea.
Here is the .g file: brlcadInstall\share\db\castle.g
Here what I got without clicking Focus on Selected Object
.
image.png
Hello @Daniel Rossberg ,
I was able to reproduce the issue. I was able to conclude that without centering the object, raytracing is not working properly and same is the case with select object feature. The function responsible for the same is "centerToCurrentSelection()" . I am not able to figure out the reason for the same. Can you please help.
The ray-trace is done in RaytraceView::UpdateImage(). There, m_transformation mediates between two coordinate systems: The dot-matrix-system of the screen and the model-coordinate-system of the geometry.
For example:
QVector3D imagePoint(column, h - row - 1., 0.);
QVector3D modelPoint = m_transformation.map(imagePoint);
...
ray.origin.coordinates[0] = modelPoint.x();
ray.origin.coordinates[1] = modelPoint.y();
ray.origin.coordinates[2] = modelPoint.z();
The ray-trace is done with BRL-CAD in the model-coordinate-system. The start point of a ray is modelPoint. Its coordinates were determined from imagePoint, a point in the dot-coordinate-system of the screen. (Why is the y-coordinate reversed? Find it out ;) But, why is the z-coordinate 0?
To understand its consequences, you have to determine the direction of the ray:
QVector3D directionStart = m_transformation.map(QVector3D(0., 0., 1.));
QVector3D directionEnd = m_transformation.map(QVector3D(0., 0., 0.));
i.e., the direction of the ray is in the virtual z-direction of the screen, in -z direction.
Until here, there is no good reason, why there should be no geometric objects with positive z coordinate, when transferred to the screen coordinate system - which produces the raytracing issue.
Now, OrthographicCamera::centerToCurrentSelection() comes into play. This ends up in a transformation, which centers(?) the geometry around the origin ... this wouldn't be very helpful ... but wait, where is it created:
The transformation is created in RaytraceView::raytrace(), with a lot of reasonable operations - and a
transformation.translate(0, 0, 10000);
This looks like a shift on the z-axis with the hope, that this will move all geometric objects behind the screen's z=0 plane. I wouldn't be so optimistic that this will always be the case.
Can you follow my argumentation until here?
Hello, I have created a Medium post as my GSOC final Submission.. You all can read it here
Hello @Daniel Rossberg @Himanshu , I have finally successfully completed my GSOC. It’s been an incredible experience, and I’m truly grateful for the opportunity to work with such amazing mentors. I’ve learned so much throughout this journey, and I couldn’t have done it without your guidance and support.
Looking forward to continuing my contributions to Arbalest. Thank you all so much!
Last updated: Nov 15 2024 at 00:49 UTC