Skip to content

Commit 7b64f1a

Browse files
author
george
committed
initial commit, with maya python plugin test, and a rabbitMQ send receive test
1 parent 3716d34 commit 7b64f1a

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

PoC/messaging/recieve.py

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pika
2+
3+
connection = pika.BlockingConnection(pika.ConnectionParameters(
4+
host='localhost'))
5+
channel = connection.channel()
6+
7+
channel.queue_declare(queue='hello')
8+
9+
def callback(ch, method, properties, body):
10+
print(" [x] Received %r" % body)
11+
12+
channel.basic_consume(callback,
13+
queue='hello',
14+
no_ack=True)
15+
16+
print(' [*] Waiting for messages. To exit press CTRL+C')
17+
channel.start_consuming()

PoC/messaging/send.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import pika
2+
3+
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
4+
5+
channel = connection.channel()
6+
7+
channel.queue_declare(queue='hello')
8+
9+
channel.basic_publish(exchange='',
10+
routing_key='hello',
11+
body='Hello World!')
12+
13+
print(" [x] Sent 'Hello World!'")
14+
15+
connection.close()

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# major-project
22
networking plugin for Maya
3+
4+

plugin/PythonPlug.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import sys
2+
import maya.OpenMaya as OpenMaya
3+
import maya.OpenMayaMPx as OpenMayaMPx
4+
5+
kPluginCmdName = "helloPython"
6+
7+
# Command
8+
class scriptedCommand(OpenMayaMPx.MPxCommand):
9+
def __init__(self):
10+
OpenMayaMPx.MPxCommand.__init__(self)
11+
12+
# Invoked when the command is run.
13+
def doIt(self,argList):
14+
print "Hello World!"
15+
16+
# Creator
17+
def cmdCreator():
18+
return OpenMayaMPx.asMPxPtr( scriptedCommand() )
19+
20+
# Initialize the script plug-in
21+
def initializePlugin(mobject):
22+
mplugin = OpenMayaMPx.MFnPlugin(mobject)
23+
try:
24+
mplugin.registerCommand( kPluginCmdName, cmdCreator )
25+
except:
26+
sys.stderr.write( "Failed to register command: %s\n" % kPluginCmdName )
27+
raise
28+
29+
# Uninitialize the script plug-in
30+
def uninitializePlugin(mobject):
31+
mplugin = OpenMayaMPx.MFnPlugin(mobject)
32+
try:
33+
mplugin.deregisterCommand( kPluginCmdName )
34+
except:
35+
sys.stderr.write( "Failed to unregister command: %s\n" % kPluginCmdName )
36+
37+
38+
39+
40+

0 commit comments

Comments
 (0)