[Sidefx-houdini-list] Maya as a Houdini Modeling tool...

Ammon Riley ammon.riley at gmail.com
Thu Sep 2 15:16:50 EDT 2010


On Fri, Aug 27, 2010 at 3:12 PM, Francois Duchesneau <sidefx at trinix.ca> wrote:
> I guess at low level a guru developer could write something that writes
> into memory and access it on the other software... maybe it doesn't make
> sense at all too :)

Now that both Maya and Houdini have QT integrated into them, you don't
have to be that much of a guru developer to do that -- it's taken care
of using QSharedMemory.

A quick bit of sample code:

    ariley at igloo:~$ cat fakeMayaPlugin.cc
    #include <QApplication>
    #include <QPushButton>
    #include <QSharedMemory>

    #include <string.h>

    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);

        QSharedMemory mem("geoForHoudini");
        mem.create(1024);

        void *data = mem.data();
        mem.lock();
        strcpy((char *)data, "point data");
        mem.unlock();

        QPushButton btn("Running in Maya!");
        btn.show();

        return app.exec();
    }

    ariley at igloo:~$ cat fakeHoudiniPlugin.cc
    #include <QApplication>
    #include <QPushButton>
    #include <QSharedMemory>

    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);

        QSharedMemory mem("geoForHoudini");
        mem.attach(QSharedMemory::ReadOnly);
        const void *data = mem.constData();

        QPushButton btn((const char *)data);
        btn.show();

        return app.exec();
    }

Instead of a simple string like in the above, you can stuff a QObject
into the shared memory, and have Maya send it a signal when it's finished
updating the geometry. On the Houdini side, you can connect that signal
to something to update the view.

I'll leave that as an exercise for the reader. :)

Cheers,
Ammon



More information about the Sidefx-houdini-list mailing list