THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/06/2012 at 22:44, xxxxxxxx wrote:
Hi, I am new here and new to Python and also new to plugin writing. I am also a professional programmer, and am intrigued by the idea of making plugins with a market value - IOW to sell them.
If I ever come that far, I am already now interested to know to what extent protecting the plugin is a topic at all, and if - how to. I have loaded a couple of C++ written plugins, in my C4D R13 Studio, and am asked to enter the C4D serial (?). Does this apply to Python plugins too?
Then - what is pype and how do I encrypt py or pyp source code?
On 21/06/2012 at 12:08, xxxxxxxx wrote:
pype is an encrypted python file. cinema reads .pyp files. once you have your plugin working, you can encrypt it to a .pype file using cinam4d. its under the Script menu, then its called Source Protector.
as far as how-to.. the documentation for python/c4d api sucks big time.
your first stop is the developer support section of the maxon website to get the available docs. if you want to use external resource files for your dialogs and containers, you need to get the c++ and coffee docs as well.
you can use an online version of the python docs here http://chicagoc4d.com/C4DPythonSDK/index.html but i havent seen this for the c++ or coffee, so those have to be downloaded. My best advise is to go through the example files in the documentation.
as far as the serial number, thats something the person making the plugin is doing. you can choose to do that, or not by writing code for it.
i hope that answered some of your questions.
On 21/06/2012 at 21:34, xxxxxxxx wrote:
Thanks, yes, you answered som of my questions indeed! I would save a lot of time, if I can get hold of examples. Especially c++. Yes, I have looked at the Python docs and wha I miss is examples. The links at the chicagoc4d are peculiar, I find it hard (or imposible) to traverse the hirearchy upwards - suddenly I am at the home opage, when I just want to read about the object owning a certain method or property. And some of the examples links are broken, I get an error.
And I tried to encrypt to pype. I guess the purpose is just to hide the source, and that it would be easy to reverse if one really wants to.
Ok, I am excited about writing plugins for c4d!
On 22/06/2012 at 07:47, xxxxxxxx wrote:
The PYPE encryption is only for PYP (Python Plugins), if you want to encrypt included modules (.py suffix), you need to compile them manually via Python. Make sure to use either the built-in interpreter of Cinema 4D or any other installed CPython 2.6 Version.
python -m compileall "path/to/pyfiles"
On 22/06/2012 at 08:24, xxxxxxxx wrote:
how do I do this within Cinema 4D?
Is this documented?
On 22/06/2012 at 10:01, xxxxxxxx wrote:
You don't do it in Cinema 4D. If you have CPython 2.6 installed (and set as your primary python executeable), you can just execute the above command to compile all *.py files in the passed directory to *.pyc. Removing the *.py files will automatically import *.pyc instead of the former ones.
If you haven't and you don't want to install CPython 2.6 on your System, then do
cd ".../Cinema 4D R13/resource/modules/python/res/Python.win32.framework/"
python.exe -m compileall "path/to/pyfiles"
Adjusting the paths to the directories and to your OS. (On Mac, you should choose Python.osx.framework instead, etc.)