Grasshopper

algorithmic modeling for Rhino

Hi,

I am wondering how to do add menu items "on" a custom component itself ?

like the picture below..

thanks

Views: 2296

Replies to This Discussion

Menu items appear in menus, that image doesn't show menus. Can you elaborate on what it is exactly you want?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Hello david,

I am thinking about a kind of remote control panel that allow me to override some behaviour of  custom components. For example I have a component that can define color and width of a line. I am using it n time with n different type of color and width. At one time I want to be able to override the width input of all my component using a remote control panel.

There is that kind of interface in karamba for example..

thx

So you want to override the display of components (or maybe parameters?). This is not particularly easy because it involves a lot of code both on the layout side, the drawing side and the mouse-handling side. 

There's a topic in the SDK documentation called Custom Attributes, it explains the first steps needed for customizing display. It doesn't discuss mouse event handling though. 

Also note that it's not really possible to use Winforms controls as part of components (like your image shows), you're going to have to draw everything from scratch.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Can we use WPF to draw it?

No.

To elaborate, when you override the Render method of some Attributes, you'll be given a System.Drawing.Graphics object to draw with, so you're restricted to GDI+. If you really really really want to use WPF you may be able to render your interface to a bitmap and then draw that bitmap using the Graphics object, but I wouldn't recommend that approach.

It seems likely that in future versions of Grasshopper (think 2.0 or even 3.0) we'll switch to a more modern graphics platform (maybe WPF, maybe Direct2D, maybe OpenTK I have no idea which yet) but until then GDI+ is your best option.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

ok..I think I will add my remote panel using AppendAdditionalMenuItems for now ..

thx

I think WPF maybe a good choice.Whatever Following the Micorsoft Will be the right thing.

Maybe not, if Grasshopper is to run on both Windows and Mac perhaps it's better to pick a platform that works on both. GDI+ is supported in Mono, WPF is not. OpenTK is, Direct2D is not. SharpGL and SlimDX seem to be windows only, WebGL seems cross-platform. Lots of options to consider but I won't start seriously looking into them until we're close to making a switch as the landscape is undoubtedly going to change over the next couple months/years.

In the meantime, GDI+ works reasonably well. It can achieve high enough framerates for the drawing we currently do and it supports crisp anti-aliasing and text rendering. It's a bit low on image handling and I'd love to be able to use pixel or fragment shaders, but for now it will do just fine.

--
David Rutten
david@mcneel.com
Poprad, Slovakia

I feel it's little difficult for  develop customers.In our country few people use Mac, and I think Win8 will be next XP! Classic is classic,directX is the  future. GDI+  can't meet customers visual effect! Well,that's just my view!

What about GDI+ is insufficient in your opinion? Can you tell Grasshopper uses GDI+ instead of -say- Direct2D? If so, how?

--
David Rutten
david@mcneel.com
Poprad, Slovakia

No,I didn't mean that. GDI+ is an old technoledge

No,I didn't mean that. GDI+ is an old technology.The bottom of WPF is DirectX.First,you have done the best about GH.I don't think anyone can tanscend it.What I want to say is that with winform or wpf We can easily draw any shape component  with varied functions to interact with people, not being limited to ligatrue or some simple buttons. We can create More complicated component to use.Don't ask me how,I just think that,and say that. I didn't have your skill for that,even after ten years when I get your age. It's just an idea - -!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service