julianeisel / bwidgets Goto Github PK
View Code? Open in Web Editor NEW[Unofficial & WIP] Narrow-scoped UI widget framework, designed for Blender.
Home Page: https://julianeisel.github.io/bWidgets/
License: MIT License
[Unofficial & WIP] Narrow-scoped UI widget framework, designed for Blender.
Home Page: https://julianeisel.github.io/bWidgets/
License: MIT License
This is something I really want to have supported properly in bWidgets. Blender doesn't support it at all right now, adding it would probably be a bit hacky.
Some C++ specific additions were recently made to the Blender code style
_
suffix.namespace bWidgets::Something {}
over namespace bWidgets { namespace Something {}}
Work on this is ongoing in the reconstruct-on-redraw
branch.
After all I decided it's best for Blender/bWidgets to keep the declarative construction of layouts Blender currently uses. In such a design, buttons can be dynamically added like this:
if (some_condition == true) {
create_button();
}
That is different from the more imperative layout creation, where the individual layout elements have to be permanently stored and you explicitly manage their state (e.g. hide/unhide). Doing so is quite complex, which is why modern frameworks use declarative construction where the UI code only represents the current state of the application (see React, Flutter, SwiftUI, etc.).
For the declarative layout creation to work, the entire layout has to be reconstructed on every redraw. bWidgets will have to make sure the state of individual widgets is kept over redraws, even if they are reconstructed. It's important that widgets can be unambiguously identified for this. Other toolkits do this with identifier names or such, I think we should keep doing what Blender is doing, which is identifying widgets by comparing the data they store. Edit: In fact, there may be better ways to do this. Needs more design work and experimentation.
Windows 10, VS2019
bwidgets/screen_graph/Iterators.h
bwidgets/screen_graph/Iterators.cc
demo\screen\DefaultStage.cc(135,1):error C2280: “bWidgets::bwScreenGraph::PreOrderIterator::PreOrderIterator(const bWidgets::bwScreenGraph::PreOrderIterator &)”
demo\screen\Stage.cc(159,1):error C2280: “bWidgets::bwScreenGraph::PreOrderIterator::PreOrderIterator(const bWidgets::bwScreenGraph::PreOrderIterator &)”
bWidgets currently doesn't support icon drawing.
There shouldn't be much involved on the bWidgets side, here's what we could do:
bwIcon
class containing a bitmapbwWidget::setIcon()
bwPaintEngine::drawBitmap()
to draw the icon bitmapWould also be good to support drawing Blender icons in bWidgets, although I'm not too sure how that could work. Maybe just copy the .c files output by datatoc? Think we'd need PNG reading support then.
In Blender we support drawing different font sizes for different widgets. E.g. the default panel font size is 12 pt while the size for general widgets is 11pt. We could also support CSS font properties per widget then.
Of course, the font specific logic should not be within bWidgets. It should have some interfaces instead, for example:
bwAbstractFontEngine
bwFont
bwDisplayText
bwPaintEngine::drawText(const bwPainter&, const bwDisplayText&)
Note that I don't intent do go crazy with Blender's font drawing capabilities. Every font variation to be drawn adds some costs (typically memory usage due to glyph texture caching). The plan is to get reasonable flexibility supported in the bWidgets code design, Blender can still dismiss that.
The following widget types need to be supported in bWidgets:
uiLayoutBox
)There are a few things to be considered:
Style management is limited and needs rework. Each style currently needs its own class (deriving from bwStyle
) and styles are registered statically, meaning their creation is hardcoded into bWidgets.
Ideally, a style could completely override how a widget is drawn (e.g. switch from Blender style number buttons to more typical ones). Supporting this can be difficult however, so let's keep it a "nice to have" feature for now, not a requirement.
Although basic drawing of widgets works fine, there are some "extras" that still need to be supported:
bwNumberButton.animated::hover
should work, although you'd have set colors for all states and all possible tints. Or maybe keep it bwNumberButton.animated
and extend CSS to support tinting the current value?When adding a style-property (bwStyleProperties::addBool()
, bwStyleProperties::addFloat()
, etc.), uniqueness of that property (based on its identifier) is not checked.
Issue is, the add functions return a reference to the added property, we can't just return nullptr
on failure. I would really like to have something like bwOptional in bWidgets, behaving similar to the std::optional
added in C++17. Then, the add functions could just return an bwOptional<bwStyleProperty&>
.
The way data is manipulated after interactions in the demo application is quite ugly and not representable for how a normal application would do this. bWidgets was designed for a different approach. It's simply a bad/misleading demo.
Currently, for every widget that's supposed to modify data in some way, we have to add a new functor class (!), create an instance of it and assign it to bwWidget.apply_functor
. However, most of these classes do very similar things which could be generalized with the help of a simple property system. Such an approach is much more like what bWidgets was designed for.
The following features are needed:
So basically a quite simplified version of RNA.
Then we can add generic functor classes to manipulate these. Also, we can try how screen-graph builders specifically for such properties would work. This idea seems to have quite some potential.
There should be some kind of reusable system to edit text. That includes cursor navigation, cancelling, copy & paste, multi-line editing support, etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.