Node Graph



  • On 01/03/2017 at 13:07, xxxxxxxx wrote:

    Hello I post in this topic since it's more about what class to use or what solution can be made for making a nodegraph flow into c4d than a full solution.

    I see 2 exemple:
    Node graph like arnold / redshift wich inherit from gvnode but how does really work? It's look like they have their own GraphMaster.
    But this bug wich is on both RS and Arnold tell me it's standar graph but they should catch when it's called from xpresso or not and then with a message function change the left menu.
    https://www.redshift3d.com/?ACT=61&fid=34&aid=14558_N5TNwqD3GKsGrsJFsZo3&board_id=1

    The second exemple it's graphnode like Cycle. For that I don't see any other option than using library like Qt. But again how to attach a Qt UI. Widget to c4d.
    Since we can dock the windows, I think the nodegraph of cycle is a customelement. But again which class is used to do that in c4d?

    Thanks in advance ! :)



  • On 02/03/2017 at 01:49, xxxxxxxx wrote:

    Hello,

    you can display a Graph View node system by using a special custom GUI: GvNodeGUI. This GUI element displays and offers interaction with a given GvNodeMaster. This GvNodeMaster represents a Graph View node system. See the example in gedialog_gadgets.cpp.

    If you want to manage an own GvNodeMaster node system you have to handle an instance of this class. This GvNodeMaster must be owned by some NodeData based plugin that is part of the BaseDocument and must be properly handled in various functions. This was discussed in this thread: node interface similar to xpresso.

    If you want to create some completely new node GUI you can create such a custom GUI based on GeUserArea. This class can be used to create custom GUI elements that allow any kind of interaction. You also find an example for this in gedialog_gadgets.cpp. See also GeUserArea Manual.

    best wishes,
    Sebastian



  • On 02/03/2017 at 03:23, xxxxxxxx wrote:

    About second example, i tested Fabric engine in c4d by pyside and kraken - extension of it based at pyflowgraph
    interesting node framework with gui.



  • On 02/03/2017 at 07:03, xxxxxxxx wrote:

    About fabric engine when you say you try it that means, it's fabric engine integrated to c4d or fabric engine standalone + Custom tcp communication beetwen c4d ans fabric?

    What is kraken?

    Thanks you a lot S_Bach for pointing this out. As I see with a quick read of the exemple you posted. For  a custom graph we have to make an hidden xpresso tag which store the GvNodeMaster if I'm right. But in this case how can we create new GnNode which is not listed to the xpresso one but only to my xpresso?

    Anyway thanks you !



  • On 02/03/2017 at 07:53, xxxxxxxx wrote:

    Using Qt or even Win32 with C4D is not supported because the items are not owned properly by the document. And you have to handle the ownership stuff yourself.
    That means (among other things) we can't do things like docking dialogs in the layout.
    MAXON can't offer support for this kind of thing.

    It's much easier to do it using python using pyQt. Because in C++ we need to compile the moc stuff.
    I use an automated system for this. But it would require me to do a full tutorial on it to explain it all.
    I thought about doing a tutorial on it once. But the fact is that using Qt this way is a bad hack. And it's really only useful for bragging rights. And it's much better to do things properly using a User Area.
    But sometimes it's fun to be a crazy mad scientist and see what you can invent.

    Since you've never done it. And you're asking about it.
    Here are the instructions for using pyQt with C4D:

    DISCLAMER: Never do this in a commercial plugin! This is just for playing mad scientist

    NOTE: This is for R13 with python 2.6.
    If you're using a newer version that uses 2.7. Download and install the proper pyQt for 2.7 instead

    Download the proper PyQt package for you system(32 or 64 bit)  
    C4d uses python 2.6 so we need to get a PyQt pacakge that runs on that version of python  
    I only use the 64bit vesion of C4d. So I downloaded this one: PyQt4-4.10-gpl-Py2.6-Qt4.8.4-x64  
      
    Install it to a temporary folder on your desktop  
    Ignore the warning about python not found on your system  
      
    Copy and Paste the PyQt4 folder into this folder inside of the c4D folder structure:  
    C:\Program Files\MAXON\YOUR VERSION\resource\modules\python\res\Python.win64.framework\Lib\site-packages  
      
    NOTE:  
     Make sure you also copy these files too  
     -sipconfig.py  
     -sipdistutils.py  
     -sip.pyd  
      
    Uninstall PyQt from ControlPanel->remove programs  
    We don't want to use it anymore  
      
    To use it  
    In C4D load the module like this:  
      
    from PyQt4 import QtGui,QtCore, uic
    

    Here is a small example

      
    #This example creates a Qt dialog with a button in it  
    #Notice how the constructor's params keeps the dialog as the topmost window   
      
    import c4d,sys,time  
    from PyQt4 import QtGui, QtCore, uic  
      
    class Window(QtGui.QWidget) :      
        
      def __init__(self) :  
          QtGui.QWidget.__init__(self, None, QtCore.Qt.WindowStaysOnTopHint)   
          self.button = QtGui.QPushButton('Test', self)  
          self.button.clicked.connect(self.handleButton)  
          layout = QtGui.QVBoxLayout(self)  
          layout.addStretch(1)  
          self.setGeometry(300, 300, 300, 150)  #Sets the dimensions of the dialog window  
          layout.addWidget(self.button)  
      
      def handleButton(self) :  
          print ('Hello World')  
      
    def main() :      
      
      app = QtGui.QApplication(sys.argv)  
      window = Window()  
      window.setWindowTitle('My Qt dialog')  
      window.show()  
      #sys.exit(app.exec_()) #<---Closes C4D too!!  
      app.exec_()  #Closes the Qt dialog  
        
    if __name__=='__main__':  
      main()
    

    -ScottA



  • On 02/03/2017 at 10:44, xxxxxxxx wrote:

    Yeah I already dealing with Qt and it's a shame that it's not fully supported into c4d...
    Why do you said we can't make commercial pluging (using Pyside instead of PyQt for license reason)? I just did some litlle test but everything working fine (excepted the close of the windows which make c4d crash ofc ! :p)

    Anyway thanks for the code ! If you get some time I would really like to see more about Qt and moc.

    All other 3D softwares support PySide (Maya, Houdini, Nuke...), and it would be very usefull for making cross app plugins.

    Anyway thanks everyone for all the informations, now it's time to code !
    I will back after some tests ! :)



  • On 02/03/2017 at 13:18, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Yeah I already dealing with Qt and it's a shame that it's not fully supported into c4d

    Don't get me started on that.😂
    Some years ago I asked the same thing here. And the reply I got back from support was "We don't like Qt because it's too slow".
    You can't force people to like Qt. They seem to either love it, or hate it.
    I personally think it's wonderful. But MAXON generally seems to be put off by it.

    When it comes to selling things. You can do whatever you like of course. But since MAXON does not support this kind of thing where we are responsible for the objects ourselves. There can be unknown side effects from it. So whenever I go this far off of the support grid I use that disclaimer.
    It's really fun and cool to play around with this stuff for personal projects. But this is a big no-no for commercial products. Because there's no telling what accidental side effects that can occur.
    The SDK code gets battle tested by smart people. Straying from it this far can lead to angry customers. And MAXON cannot offer any help or advice.

    -ScottA



  • On 02/03/2017 at 23:42, xxxxxxxx wrote:

    Hello,

    it is not needed to create a "hidden" xpresso tag. You can store a GvNodeMaster object directly inside your NodeData based plugin class. It is possible to create new Xpresso nodes by implementing GvOperatorData plugins. But these nodes will be added to Xpresso globally. So they will be available in the default Xpresso dialog as in any other GvNodeGUI. It is not possible to "filter" the presented nodes.

    best wishes,
    Sebastian



  • On 03/03/2017 at 05:37, xxxxxxxx wrote:

    Thanks ScottA you are absolute right, time to explain it to supervisor and see what he will choose :p
    I guess it's like every software/SDK more you know it, more you hate it :p

    Originally posted by xxxxxxxx

    By implementing GvOperatorData plugins. But these nodes will be added to Xpresso globally. So they will be available in the default Xpresso dialog as in any other GvNodeGUI. It is not possible to "filter" the presented nodes.

    But why node from arnold/rs are not exposed into xpresso?
    Cause into my dialog I can make a Treeview like the one in Xpresso and then alloc my GvOperatorData when the user double click on a element of the treeview by sending a special message to my GeUserArea who store the GvNodeMaster.

    Anyway thanks you a lot !



  • On 06/03/2017 at 00:16, xxxxxxxx wrote:

    Hello,

    as far as I know the Arnold nodes are visible in the Xpresso right-click menu that appears when you right-click on the GvNodeGUI. There is no way to change this.

    The TreeView has nothing to do with Xpresso. This is just some GUI element you can configure as you like.

    best wishes,
    Sebastian



  • On 06/03/2017 at 06:53, xxxxxxxx wrote:

    I was baited by arnold cause they must have register only one(or at least a few) GvOperatorData for all their node and corresponding to the data filled in the bc they make different behavior.

    Anyway thanks you a lot !


Log in to reply