creating a custom node system
-
On 16/08/2014 at 08:56, xxxxxxxx wrote:
You can create xpresso node plugins too. Why reinvent the wheel unless you have a very specific need that could not be addressed by the xpresso interface.
-
On 16/08/2014 at 10:34, xxxxxxxx wrote:
xpresso lacks a lot of things, after all it is single threaded and lacks array holders
just need a very simple hint of where to start "any simple custom gui example in the SDK?" -
On 16/08/2014 at 11:59, xxxxxxxx wrote:
To continue Eclectrik's thoughts, you will need a GeUserArea in a dialog to allow GUI for the node system (display, user interaction, actions, etc.). The nodes themselves can be represented as classes however you want. I'd suggest a base node class containing all of the general node data and methods from which your other nodes can be derived. Connections should be a class used for each connection and stored in the nodes either as an array or a pointer list or something similar so that connections are independent of the nodes themselves. You will need a direction tree to go from start to end of the node processing. Consider whether your nodal system always starts with a single node, ends with a single output node, or allows for multiple starts and/or multiple outputs.
-
On 16/08/2014 at 13:07, xxxxxxxx wrote:
seems like a nightmare xD, I guess I will do it in Qt and embed it somehow
-
On 16/08/2014 at 13:34, xxxxxxxx wrote:
Qt?
-
On 16/08/2014 at 13:50, xxxxxxxx wrote:
-
On 16/08/2014 at 14:43, xxxxxxxx wrote:
Ah! First thing that i thought was QuickTime, was confused
I have to be honest i`m still trying to get my head around how the custom GUI etc stuff works in C4D, without many solid examples ( at least that i can find ) it is really really difficult to put the different parts of the puzzle together..
But in saying that - for me it
s been like that with everything in the api, it
s like a maze. Once you know how it works you realise it is actually really simple. Give people more and better example code and practical reference material Maxon guys ffs!!! I cant stress that enough!! I could have saved literally weeks if i
d had the knowledge i have now, laid out in an organised and accessible way, to learn from.Anyway, i completely digress. The point i was going to make was, maybe it
s worthwhile learning the GeUserArea stuff. If you use an alternative framework such as Qt for UI, you
re still going to have to implement all the object classes, data classes, etc etc.. So why not -
On 16/08/2014 at 17:52, xxxxxxxx wrote:
And, as a warning, interfacing OpenGL Qt with Cinema 4D is not a done deal. I have had no success and it appears that others have had similar issues getting them to play well together.
-
On 18/08/2014 at 07:47, xxxxxxxx wrote:
Howdy,
If by chance you can get in touch with David Farmer (darf), he may be able to offer you some advice, as he had started a plugin for R7 called Blunt Trauma that was a node based expression plugin.
Adios,
Cactus Dan -
On 18/08/2014 at 09:31, xxxxxxxx wrote:
@Robert I think I know the way to put Qt UI inside Cinema4D , testing it today
@Cactus Dan does he have any website or email so I contact him?
-
On 18/08/2014 at 09:47, xxxxxxxx wrote:
Howdy,
His user name here on plugin cafe is "darf". You might be able to send him a PM.
Adios,
Cactus Dan -
On 18/08/2014 at 13:54, xxxxxxxx wrote:
Hello,
creating your own node system is an ambitious task. And as stated before you may use a GeUserArea within a GeDialog.
So the first thing to do is to create you own dialog. You just need a dialog class based onGeDialog
[URL-REMOVED]. An example is the ActiveObjectDialog in the SDK.class ExampleDialog : public GeDialog { public: ExampleDialog() { }; virtual Bool CreateLayout() { SetTitle("My Node System"); return true; } };
The layout of the dialog is defined in the CreateLayout function. Elements are not placed by absolute coordinates but are arranged in groups like in Cinemas *.res files. You can add Cinema's default widgets, menues and your own interactive widgets. Such a widget must be based on
GeUserArea
[URL-REMOVED]. An example is the SDKGradientArea in the SDK.class ExampleUserArea : public GeUserArea { public: virtual void DrawMsg(Int32 x1, Int32 y1, Int32 x2, Int32 y2, const BaseContainer& msg) { // we will draw the widget here }; virtual Bool InputEvent(const BaseContainer& msg) { // we will handle user input here return true; }; };
The widget is drawn in DrawMsg :
virtual void DrawMsg(Int32 x1, Int32 y1, Int32 x2, Int32 y2, const BaseContainer& msg) { OffScreenOn(); // draw background DrawSetPen(Vector(0.8, 0.8, 0.8)); DrawRectangle(0, 0, 400, 400); // draw a simple rectangle DrawSetPen(Vector(0.4, 0.4, 0.9)); DrawRectangle(100, 100, 200, 200); };
You want to be able to interact with your nodes by clicking on them. To catch user interaction events use the InputEvent function:
virtual Bool InputEvent(const BaseContainer& msg) { GeData data; // check if mouse event msg.GetParameter(DescLevel(BFM_INPUT_DEVICE), data); if (data.GetInt32() == BFM_INPUT_MOUSE) { // check if left mouse button msg.GetParameter(DescLevel(BFM_INPUT_CHANNEL), data); if (data.GetInt32() == BFM_INPUT_MOUSELEFT) { // now get the coordinates msg.GetParameter(DescLevel(BFM_INPUT_X), data); const Int32 xCoordiante = data.GetInt32(); msg.GetParameter(DescLevel(BFM_INPUT_Y), data); const Int32 yCoordiante = data.GetInt32(); GePrint("UserArea hit at " + String::IntToString(xCoordiante) + " : " + String::IntToString(yCoordiante)); } } return true; };
Finally you need to use your UserArea within your dialog:
virtual Bool CreateLayout() { SetTitle("My Node System"); C4DGadget * userAreaGadget = this->AddUserArea(1000, BFH_LEFT, 400, 300); this->AttachUserArea(_exampleUserArea, userAreaGadget); return true; }
You simply create a new C4DGadget of the type UserArea and then attach an instance of your UserArea (_exampleUserArea) to this gadget.
Based on the user interaction you can update your node system; in DrawMsg you can draw you node system. Another thing is when you want to solve your node system; when should it be executed? This can happen when a new frame is processed; you may take a look at this thread.With these elements you are able to build your own fully functional GUI. But still, building your own node system is a big undertaking that needs good planning.
Best wishes,
Sebastian
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 18/08/2014 at 13:58, xxxxxxxx wrote:
Holy hell good post ^
-
On 18/08/2014 at 15:40, xxxxxxxx wrote:
@Sebastian really thanks a lot for this info, I really like it, will do my best to replace xpresso soon