Maya newbie - user areas, and source protector ?


#1

I’m working with Maya for the first time and I have a few questions that I haven’t been able to find good answers to.

  1. In C4D you can define a ‘UserArea’, in a window, upon which you can draw bitmaps, rectangles, splines, etc, and receive buttonclick messages with x,y coordinates. Those messages let you redraw the UI according to user mouse click/drags.
    Does Maya allow you to do the same thing from Python?

  2. On C4D, there is a ‘Source Protector’ to encrypt python plugin files. It looks like ‘Mel Protector’ is used for this with Maya. However, on their website it says Python Protection is Windows only, and only for Maya-2012 to Maya-2014.
    Is this correct?

Or does this mean it only runs on windows, but the protected code can be used on any OS running Maya?

Is there a cross-platform solution that protects Python code similar to C4D’s native Source-Protector?

Thanks


#2

No idea how mel protector works, but you can simply use the compiled pyc files. These should work on all platforms as much as I know.


#3

it’s a smart idea to start maya script development from figuring out first a way of code protection. if there is no way to protect why should we do the coding?


#4

Mel Protector is a plugin that encrypts / decrypts your code. This plugin obviously needs to be installed and loaded to be able run Mel Protector encrypted code, so you’ll have to include the Mel Protector plugin in your distributions. Being a complied plugin, you’ll depend on the developer for new versions support.

.pyc isn’t a real protection. It may prevent non technical people to see the code, but they wouldn’t understand it even if they could see it. Any python user would know how to decompile it just by using one of the dozens of free decompilers you can find in the net.

Another problem with .pyc is that it will only work with the version that it was compiled on, so you’ll need to distribute a file for every version.

What I do, when I don’t want to share the code but I need to share the tool, is simple obstruction (with some tools I found in the internet) renaming variables to be almost unreadable before compiling so the code would be still reconstructable but it would take a lot of time and effort. I’ve seen some people encrypting all strings in a code, and using a decoder in another file. Since you have the decoder function, it would be also reconstructable, but cumbersome.

If you want real protection then you’ll need to go C++ or write your own Protector plugin.


#5

you are never going to get secured python or mel, if this is important use C++ but remember that even that isn’t full proof and even C++ can be partially decompiled as well as as stuff made in the JVM or .NET.

Best not to worry about it, besides your beginning so no one is going steal your code anyways.
Just make your scripts learn the API’s and improve as a programmer.


#6

MEL was designed to be open and shared…
the Python’s philosophy is to be open and be easy revealed or modified.

these two guys are maya’s scripting components today.

if you want to script-in the maya just expect ‘free’ using of your tools. if you want to commercially develop in maya look at c++

commercial script coding for maya is a ‘chemistry’ (actually it’s ‘alchemistry’).

it’s more like: “see this tool. I MADE IT! REMEMBER MY NAME!”


#7

There are some excellent C++ decompilers out there.

I bet if you obfuscate and compile your Python code, and only issue .pyc files, then the end result won’t be much different for a hacker than decompiling a C++ plugin.

Maya will load plugin .pyc files, correct?

The thing is, it is much faster to develop with Python.
And, every plugin and host (Maya, C4D, etc…) is cracked right after release anyway!


#8

why do you care, no matter how you distribute there is a way to crack it just adds time and work to do so.

Also distributing as pyc is kinda shitty since it ties you to a certain version of python and thus a certain version of maya. You are just going to trade usability for the client and a good workflow for dev in favor of a half baked way to protect things which is a bad choice.


#9

Distributing .pyc files works fine if you do it correctly.
Main plugin .py files loads in host (Maya) and then loads (imports) the correct .pyc file depending on the Python version. This doesn’t limit the user in anyway.

Saying that using obfuscated and compiled Python .pyc files is ‘half-baked’ doesn’t really mean much. I was looking for an experienced programmer that knows the relative difficulty level of cracking a decompiled C++ file vs. an obfuscated and compiled .pyc file.

If there is anyone here that actually knows the difference then I would love to hear from them.

Why do I care? I think I made that clear…it is much faster to develop with Python, and many people would be helped if they knew that there was a decent (not-perfect) way to protect their Python code.


#10

You can use some kind of obfuscation method on your python code before deploying it, that’s your best bet. Pyc files are super easy to decompile.

But, don’t forget one thing. People like to modify scripts and add simple features, fix issues or modify the ui. For them an obfuscated, pre-compiled python code is just a mess. Honestly, I never saw a maya plugin that was trying to do this. So I don’t think you should worry about protecting your code, or making your clients life way harder.

Depending on the kind of plugin you want to do, you will have to write c++ eventually, especially if you work with large amounts of data. You can put your licensing, etc… in the c++ part of the plugin and then you are set protecting your product.


#11

Any recommendation for obfuscation?

I think we all know that one of the good things of scripting is that they are easily editable, but there are sometimes when you don’t want to share the code or you want to put some restrictions that can fool any non technical artist. Like sharing script tools with a temporary hired outsource artist just to make his job easier and faster only for that period.

I don’t know you, but I don’t want to share all my code for free even if that means making this hired artist’s life harder, which I doubt.

I tried this website, http://pyob.oxyry.com/ (online version is free) and it was pretty good at what it does, it just replace variables with names like O0O0O00OO0O00OO.

Free Python decompilers give you the entire source code exactly how it was before compiling. I haven’t seen any C++ Decompiler that good.


#12

The purpose of this is to create an easier way to create cross-platform plugins with a faster development time.

Because Python runs the same way in the host (Maya) regardless of the OS, making a plugin with Python doesn’t require any complex cross-compatible compiling schemes. And except for extreme cases, computers are so fast now that Python can crunch the data without significant lag.

You are correct, C++ decompilers don’t give you the source as written because they can’t recapture the variable, class, and subroutine names, but they do give you the functional code as written.

To achieve the same thing in Python, you have to first obfuscate your code, then compile it. If someone then decompiles the .pyc file they will only get the obfuscated mess; this is roughly equivalent to what is achieved by decompiling the C++ file.

For a commercial plugin that is not intended to be modified by the user, is there any major drawback to this?

Thanks