Trouble compiling



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 07/07/2012 at 16:23, xxxxxxxx wrote:

    I will try to explain all the steps I'm doing.

    I have an ObjectData plugin, with the .pyp extension that is working.
    I dissected the RoundedTube file from the SDK and made my plugin from it (with a unique ID, of course).

    I tried compiling it from the Terminal (I'm on a Mac) with:

    cd /Applications/MAXON/CINEMA\ 4D\ R13/resource/modules/python/res/Python.osx.framework

    python -m compileall /Applications/MAXON/CINEMA\ 4D\ R13/plugins/Actor

    ...and I get:

    Listing /Applications/MAXON/CINEMA 4D R13/plugins/Actor ...
    Listing /Applications/MAXON/CINEMA 4D R13/plugins/Actor/res ...
    Listing /Applications/MAXON/CINEMA 4D R13/plugins/Actor/res/description ...
    Listing /Applications/MAXON/CINEMA 4D R13/plugins/Actor/res/strings_us ...
    Listing /Applications/MAXON/CINEMA 4D R13/plugins/Actor/res/strings_us/description ...

    But no Actor.pyc file is produced.
    If I change the extension of the original plugin to .py and perform the same steps to compile it, I do get a .pyc file.
    But using that .pyc file doesn't load the plugin.
    So, how can I compile a python plugin properly?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/07/2012 at 01:04, xxxxxxxx wrote:

    The

    .pyp
    

    extension is Py4D specific. To protect Py thon P lugins, you habe to use the Source Protector plugin from the Python Plugins Menu (R12) or the Scripting Menu (R13).

    .py | .pyw | .pyc | .pyo
    

    files are simply Python source/nowindow/compiled/object files and Py4D doesn't assume they're plugin-files.

    -Nik



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/07/2012 at 09:54, xxxxxxxx wrote:

    Thank you for the reply, Nik :-)

    So, there isn't any way to compile my .pyp files?
    Is there even any advantage of compiling python files?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/07/2012 at 21:47, xxxxxxxx wrote:

    > So, there isn't any way to compile my .pyp files?

    Originally posted by xxxxxxxx

    To protect Py thon P lugins, you habe to use the Source Protector plugin from the Python Plugins Menu (R12) or the Scripting Menu (R13).

    _
    > Is there even any advantage of compiling python files?_
    Well, I'd say to protect your source? :)
    You can both, protect your .pyp and your .py files. (You can outsource your code to .py files and compile those to .pyc)

    Cheers,
    -Nik



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 01:08, xxxxxxxx wrote:

    I was asking this because "protecting" is not the same as compiling.
    Usually, compiling speeds things up.
    Does this means that compiling (not protecting) has no advantage whatsoever?

    Rui Batista



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 04:09, xxxxxxxx wrote:

    I think the .pyc files are faster to load yes.

    so protect the .pyp file using the source protector in c4d, then compile all your .py files

    you can get rid of the .py files once compiled, just leave the .pyc in there



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 04:22, xxxxxxxx wrote:

    Well, I didn't know that this was your point. Actually the only thing that speeds up is loading, as mchaloner already said.
    I don't know about the implementation details of the "protected" .pyp files (.pype) but I'm pretty sure they're not just obfuscated but compiled.

    -Nik



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 04:28, xxxxxxxx wrote:

    really if you're using .py packages your .pyp should be pretty small in terms of code, so the protected .pype should run pretty quick!



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 06:01, xxxxxxxx wrote:

    @mchaloner: I don't think "run pretty quick" is the correct term, here. The code doesn't run faster because the code-size is small. It just loads faster, and loading is done at Cinema 4D startup.
    Also, outsourcing of code should be done in a "senseful way". Don't seperate each function to another source file. Importing does take it's take, too (when you want to decrease loading time).

    When you know where your source-files are (and you usually do, because they're in your plugin folder), instead of appending the path of the plugin's directory, rather insert it at the beginning of the sys.path list.
    In the former case, the Python Interpreter would walk through each folder in sys.path and finally gets to your plugin's path after it has traversed a number of other directories. In the latter, it will find your module at the first path in sys.path.

    -Nik



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 06:09, xxxxxxxx wrote:

    excuse the poor choice of words, but that's essentially what I meant :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 07:23, xxxxxxxx wrote:

    So, that means that a compiled Python plugin runs no faster than a protected non-compiled plugin?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 07:33, xxxxxxxx wrote:

    no, I was just saying that if you are using .py packages - your .pye wouldn't have much code in it, therefore Cinema 4D's loading of that plugin should be faster.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 09/07/2012 at 07:33, xxxxxxxx wrote:

    > So, that means that a compiled Python plugin runs no faster than a protected non-compiled plugin?
    Nope. It just speeds up the start-up of cinema 4d. If that is even noticeable..


Log in to reply