Closed zeffii closed 10 years ago
sad we cannot make subcategory
not sure we need this.
None of these are modifiers, they are dedicated Transform operations
did you realy did it? wow! cool if in 3D this duplicated... maybe insert to panel creation of triple nodes? when created, it searches for layout sverchok tree and inserts node generator and node viewer and node object in and in 3d empty, so with empty you manage matrix... how idea?
try the branch, it already checks those things
could certainly add extra ops to add real objects to scene. but not yet
Nice
Really nice!
I also think some menu restructuration should be done. Transforms make sense to me.
the amount of code involved is depressing..but I just wanted to see how it looks..
add n grab now working
Yes Nortikin! I think finally I slowed down enough to understand what you meant earlier. I think this code provides an easy way to extend menus and even offer custom "node ensembles", (we add one node from a specials list and automatically can get common nodes added simultaneously)
case: adding Image Decomposer, i would probably always want
Not only limited to Nodes, but also (as you say) adding objects to 3d view too. Objects which always get used in conjunction with certain nodes. Could reuse the IO code here to add ensembles from a json folder
both menu.py
and nodeview_space_menu.py
could read from the same nodes dict
, but they would need to be equivalent. (this would reduce duplication)
for example
class NODEVIEW_MT_AddConditionals(bpy.types.Menu):
bl_label = "Conditionals"
def draw(self, context):
layout = self.layout
node_details = [
# bl_idname, shortname, <icon> (optional)
['SvLogicNode', 'Logic'],
['SvSwitchNode', 'Switch'],
['SvNeuroElman1LNode', 'Neuro'],
]
layout_draw_categories(layout, node_details)
if this list is declared in menu.py as
node_cats["Conditionals"] = [
['SvLogicNode', 'Logic'],
['SvSwitchNode', 'Switch'],
['SvNeuroElman1LNode', 'Neuro'],
]
then
# have node_cats available
class NODEVIEW_MT_AddConditionals(bpy.types.Menu):
bl_label = "Conditionals"
def draw(self, context):
layout_draw_categories(self.layout, node_cats[self.bl_label))
and slightly modify the for category, nodes in node_cats.items():
from menu.py
to ignore 3rd sublist items (icons)
this way we could continue to edit the menu easily from menu.py, and nodeview_space_menu.py automatically adjusts to changes
it cannot import sverchok.menu is it works for you, @zeffii ?
it rise needs to make own icons and bgl image menu implementation. not nice to choose standard icons here.
yes works here, what is your sverchok folder called?
@zeffii Since we have added the sverchok folder to the python import path you can just import menu. I have some doubts how safe it is with such generic names as menu etc...
Also it strikes me that perhaps we should split utils into sverchok-ui and utils since it has a growing number of files, some utils, some panels etc.
agreed.. about utils / vs ui
I thought I tried importing menu first..? seems not. yes this works nicer
menu = imported_modules[-1]
it was already silently conflicting with this
I don't think bgl
is ready for drawing nice icons, even loading them as raster seems like a lot of extra work. Using blf
loading icon font files at least offloads some work, downside is monochrome.
A lot of extra work designing the right icons, which I would be happy to do if the tools to display them were appropriate.
This menu solves most of the problems I had with the old menu and feels quite nice. However for the old shift-A and especially T-panel fewer categories works better. This of course is a general problem with blender tabs...
Yeah I would love to solve that but the solution (i haven't tried yet) seems quite hacky
NODES_MT_add
, sv_add
which can essentially open the space menu from the header.OK, there is no nice way to insert a menu item in the NODE_MT header, ( I don't have time to mess with it)
An alternative is to reimplement the nodeitems_utils.py
specifically for sverchok. I'll experiment with it
bleh..that gets messy too
This concludes my experiment, I thinks it's pretty cool even tho not all icons are great - at least this allows submenus without too much vagueness.
It is also possible that, unfortunately, these will be my last commits for the foreseeable future.
Thanks for the effort! For me this makes more sense as a shift-A replacement than space bar. Right now it has the side effect of killing the space menu in other node editors, I will try to tinker a bit with it.
it might not be possible to selectively override keyboard combos for specific node trees, I think it is forced on the level of the View (ie NodeView ). There is a poll the the Menu to not draw if the tree is not Sverchok tho...
better to remove icons completely. If you making menu to be clear, not as disoder. We cannot find al icon types now. Overall this idea super
poll decorator kill space menu completely.
the easiest things is probably just to bind it to another key than space. problem then is finding it the first time...
yes, that's not good.. this is very lame :)
a custom version of nodeitems_utils.py is possible. At the moment some of the code I wrote for the menus and the "dynamically created classes" is very similar to nodeitems_utils.
# from dynamic menu
# does not get registered
class NodeViewMenuTemplate(bpy.types.Menu):
bl_label = ""
def draw(self, context):
layout_draw_categories(self.layout, node_cats[self.bl_label])
# quick class factory.
def make_class(name, node_list):
name = 'NODEVIEW_MT_Add' + name
return type(name, (NodeViewMenuTemplate,), {'bl_label': node_list})
from nodeitems_utils
for cat in cat_list:
menu_type = type("NODE_MT_category_" + cat.identifier, (bpy.types.Menu,), {
"bl_space_type": 'NODE_EDITOR',
"bl_label": cat.name,
"category": cat,
"poll": cat.poll,
"draw": draw_node_item,
})
Ctrl+Space then :)
I have grown to like the icons.. maybe we ask people what they think...and remove if the majority says its crap
I think in conclusion of this experiment I can say a few things.
1 - The current Pynode Custom tree (in particular nodeitem_utils) is not designed with the idea that there might be a wide variety of nodes (not just node count,, but node catagorization..and subtle subcats)
2 - nodeitem_utils can be overridden, but that was not the goal initially of this experiment
3 - If we are going to use icons, lack of convenient custom icons is a big shame.
it is crap
:octocat: my prediction is that bgl driven icons will look equally (if not worse) crappier.
can implement that they are off by default, is a reasonable compromise
it is what needed. we will draw icons from zero-point. there will be small icons in future, styled as cricket do. But not now
i don't disagree. Fresh icons would be best
tamed default menu, icons are now optional
))
should I do a pullrequest?
Yes, go for it. An then I will sync with SN2 then push that to beta.
re-open if problems
@zeffi. How did you get this icons in the menus? Personally I don't have them and don't know how to activate them.
makes sense when moniker 'modifier' doesn't. Transforms are very specific operations, whereas modifier can be a whole range of different operations.
Maybe