Webdialogs for SketchUp ......RIP!
-
@unknownuser said:
Javascript IMHO.
Especially since such a partly implemented API already exists, and even a first plugin.
Even if JS is not a beauty of a language, it's benefits are the wide-spread and the billions that have been invested into its speed optimization (although Python/Ruby&Co. have also benefited from such developments).For the original topic of this thread, neither webdialogs nor SketchUp's choice of scripting language matter. Node-based interfaces (previously mentioned as visual programming) are neither a replacement nor conflicting with webdialogs.
-
Interesting, why does ex-Asgvis use port of Ruby to Python and pyQt dialogs in vray for sketchup?
-
They use such a bridge because they make V-Ray for SketchUp and V-Ray for Rhino share the same code-base so they can be developed in parallel.
-
Interesting discussion. I work on OpenStudio which is a C++ SDK that includes a SketchUp plugin that uses ruby. We use tool called SWIG http://www.swig.org that gives us bindings to Ruby, Python, C# and potentially many other languages. Ruby is our most supported binding, but users are starting to use other bindings as well.
David
-
Dave,
Marshalling parameters and providing some glue to call a C function isn't the problem - though I'm sure SWIG does a great job.
The 'heavy lifting' is around exposing underlying C++ entities as first class objects in your chosen host language.
Adam
-
I do not know SU three month ago and never use ruby for programming. I would like to share my idea of three month usage.
- Webdialog is great idea for ui and HTML5 will extend this advantage. The disadvantage is that the UI provided by SU is not so good.
- The shortage of SU is that the api functions are not powerful, i expect more api to operate the SU and the support for ruby is not up to date. I'd like to easy use of new version ruby api in SU.
- SU should consider to support the usage in ipad and andriod base system.
-
I don't think ruby is the one to blame. It is very flexible. With the possibility to write ruby extensions in c/c++, on a Windows PC, one can also write it in C++/cli. Thus one can easily integrate any .net stuff. If one do not like webdialog, any other gui library can be linked through the extension. E.g. one can build c# plugin via p/invoke [DllImport("msvcrt-ruby18", CallingConvention = CallingConvention.Cdecl)]...
For stuff like Visual Programming the most challenge thing is parametric model. In sketchup this is not easy, since entities can easy be manipulated. I mean e.g. if you simply delete the area of a face, it becomes 4 lines. The entities are not consistent. They are so flexible. And if this is not a issue, one can make some effort and create a Visual Programming interface for su. -
@unknownuser said:
if you simply delete the area of a face, it becomes 4 lines. The entities are not consistent. They are so flexible. And if this is not a issue, one can make some effort and create a Visual Programming interface for su.
That is why I use Open GL objects through a tool's draw class to visualize entities for "Visual Programming interface". It is to sketchy to try to alter Sketchups entities parametrically. Subdivide a face with a slider and youre toast, as you mention.
The biggest problem, as I see it (so far) is that a webdialog freezes during any Ruby operation. Making webdialogs only really usable being used as a form-submit type of thing. One have to write very efficient Ruby code that masks that behavior.
I wonder how other type of GUI's, you mention behave during Ruby operations..
-
One can use c# wpf or winform for the GUI. One can create another thread for the GUI. And use dispatcher for the calling, something like:
in the ruby thread do
wpfWindow.Dispatcher.BeginInvoke((Action)(() =>
{
wpfWindow.Show();
wpfWindow.Activate();
}), System.Windows.Threading.DispatcherPriority.ContextIdle, null);
to open the window and call other functions in the gui.and in gui thread do
using VALUE = System.Int32;
ruby_extension.BeginInvoke(DispatcherPriority.Input,
(Action)(() =>
{
VALUE state = 0;
VALUE rb_mKernel = rb_eval_string_protect("Kernel", ref state);
rb_funcall(rb_mKernel, rb_intern("puts"),
rb_eval_string_protect(Encoding.UTF8.GetBytes("Hello, World!" + '\0'), ref state));
}));
to call ruby functions or evaluate ruby scripts. -
Oh, I wish I'd taken up on C or C++...
Anyway, I gather Windows only ?
Both plattforms ought to be provided to keep people happy.
-
Jolran, what do you use for your JS node-based interface ? I was wondering about something similar for a material editor (For vray and friends) like 3dsmax's.
JSmaker ? http://jsmaker.com/jsmaker/
-
@jolran said:
Oh, I wish I'd taken up on C or C++...
Anyway, I gather Windows only ?
Both plattforms ought to be provided to keep people happy.
I think the same method can be applied for c++ gui, e.g. qt, as well. A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated.
-
@unknownuser said:
I think the same method can be applied for c++ gui, e.g. qt, as well. A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated.
Great! It's just the small detail of learning c++ then
Seriously though, I was under the impression these kinds of 2 way Communication was not possible outside webdialog-World.
I would really like to know more.
-
JSmaker is not an option I think.
I use JsPlumb. It's depended of Jquery UI, which is a bit sketchy when dealing with CSS3 transforms. It does not recognize them So zooming is very fun to deal with
Anyway one have to write nodecreation functions oneself and where endpoints should be added. Jsplumb is only a view technology. Does not do any type of layout (yet).I've been looking into D3, and it's an awsome framework! But also very low-level so it would take ages to come up with something that's even close to where Jsplumb is now.
But still very interesting...edit: Removed some off topic ramblings..
-
@unknownuser said:
A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated
So, the dialog does not freeze during Ruby operations ?
How about window modal behavior. I mean how do one activate a dialog through Ruby plugin, must the C# program or whatever being used already be up and running?
I assume you already have tried this in practice.Sorry bout the noob questions
-
@jolran said:
@unknownuser said:
A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated
So, the dialog does not freeze during Ruby operations ?
How about window modal behavior. I mean how do one activate a dialog through Ruby plugin, must the C# program or whatever being used already be up and running?
I assume you already have tried this in practice.Sorry bout the noob questions
Yes, one can activate a dialog through ruby plugin. The c# thread is started within the plugin. I have tried something already. check out https://github.com/icehuli/suWpfExt.
Although it is a alpha version, it should give you a hint how to do the trick. It currently uses swig, which is not necessary. I am working on a version without swig. The plugin is separated in several dlls.- myExtMain.dll is the main dll in c++, compiled with /clr, so it can load .net dlls.
- suWpfUI.dll is the UI dll in c#, witch implements the WPF GUI.
- suExtMainWrapper.dll is the wapper linked by the GUI to call c++ functions in myExtMain.dll. (This one seems not necessary, the reason to have it is that c# can not be linked to with myExtMain directly. However one can use P/Invoke in c# code
using VALUE = System.Int32; using ID = System.Int32; [DllImport("msvcrt-ruby18", CallingConvention = CallingConvention.Cdecl)] private static extern VALUE rb_funcall_(VALUE recv, ID mid, int argc, __arglist);
to directly call ruby functions, thus the suExtMainWrapper is not necessary.)
Another issue is that suWpfUI and suExtMainWrapper are not explicitly loaded by rubyrequire
so it needs to be placed inside Sketchup.exe directory. I haven't figure out how to avoid this.
-
@jolran said:
@unknownuser said:
I think the same method can be applied for c++ gui, e.g. qt, as well. A new thread need to start for the GUI to avoid it being frozen while ruby scripts are being evaluated.
Great! It's just the small detail of learning c++ then
Seriously though, I was under the impression these kinds of 2 way Communication was not possible outside webdialog-World.
I would really like to know more.
In windows C++ should be not much more difficult thanks to visual studio and .net. However in mac os it is more difficult since the default system gui library is cocoa, which require object-c. Once upon a time, one can use carbon to build cocoa GUI, but it is deprecated since OS X 10.8. Automatic Reference Counting, or ARC makes things more complicated. I am not familiar with other c++ or c libraries. If one does, one can try to use multithreading tech. I tried qt yesterday. It is just not straight forward, since in qt every gui needs to be created and maintained in the main thread. And only one QApplication is allowed, thus multiple plugins using qt may cause problems.
-
Many thanks for the valuable information, really
And the link too, much appreciated.Looks like you know what youre talking about.
I'm probably not gonna dig into this just yet. Maybe if I reach a dead end with the Webdialog class.
I wan't to build an opinion if it's worth the effort first.
-
@jolran said:
Many thanks for the valuable information, really
And the link too, much appreciated.Looks like you know what youre talking about.
I'm probably not gonna dig into this just yet. Maybe if I reach a dead end with the Webdialog class.
I wan't to build an opinion if it's worth the effort first.
I reached the dead end a year ago, when I implemented heavy optimization operations. I tried ruby thread, which is a fake in ruby 1.8. It did not solve my problem so I looked into c++ and than realize the extension can be compiled with /clr that opens the door to the wide .NET world. -
Aha, interesting. Will chew on it a little..
My brother is a .net developper with quite a bit of knowledge of C++, so I could probably get a big kickstart and set up. Otherwise I woulden't even consider trying..
Anyway, thanks again! I'll keep an eye on you projects
Advertisement