[REBOL] Re: [why-REBOL] Pros and Cons / what's so special
From: moliad:aei:ca at: 29-Jun-2004 7:29
Anton,
You do know that you can eval() code in MEL, right?
well, use that more and you'll see that you can use some rebol tricks in it
too!
MEL programmers read carefully!
if you didn't know, you can program maya USING REBOL / CORE :-)
no fancy tricks, no plugins needed... you simply open a command port in maya,
like so:
// ----------- in MAYA ---------------
commandPort -n ":3044"
// ----------------------------------------
the actual port number is irrelevent, as long as it is not already opened. And
then open a tcp port in rebol, and send it your mel commands directly through
the port. If you are on unix, you can even use named ports.
;-------------- IN REBOL --------------
maya: open/lines tcp://localhost:3044
insert maya "sphere"
;------------------------------------------
in theory, you should see the sphere appear in the maya software.
also note that all return values are returned afterwards to the client port!
so, after the previous command you can do:
;-------------- IN REBOL --------------
>> print first maya
nurbsSphere1 makeNurbSphere1
;-----------------------------------------
This has the advantages that you can use OBJECTS to manipulate your datasets
and just build up little mel commands to manipulate them. If you are
comfortable, in building up maya nodes as data placeholders, you can easily keep
a node with an added id string or int attribute to reference your objects in the
rebol world and do all your "real" programming in rebol. If you want, you can
create stubs in your objects which mimic the MEL commands (using refinements for
the switches :-) and do all the logic in rebol, and whatever goes or retrieves
data from the MEL sides, gets converted by the stub routines, so that you stay
focused on the rebol side.
if you do all the "doing" in rebol and only call MEL's "connectAttr()",
addAttr()
, "getAttr()" and "setAttr()" via rebol, you already halved your
coding time for sure. !!! imagine, you can use REBOL WINDOWS to make interfaces
for your maya tools :-) you miss out on the fancy maya ui classes, but if
your' just doing lists, fields, buttons and stuff, you can get away with a lot
in VID, much quicker IMHO.
the only caveat I know is that maya's tcp buffer is only 4096 bytes, so don't
send a large return command over the port ("ls" for example), unless you know
that the return will be a manageable amount of data, cause maya will close the
port if you overrun the buffer.
HTH !
-MAx