Jump to content

python / c++ possibilities


Recommended Posts

Hi guys,

 

i wanted to ask you if python can do anything a c++ plugin can do? it is clear, that the performance is worse, but what is with the capability?

 

I want to create some modifiers, generators, tags. Is python capable enough to do this things?

 

Thanks!

Link to post

You can create plugins in Python, although in some areas you may hit a limitation. Python as language is not the impediment here, but the API - the C4D API for Python just doesn't cover everything that the C++ API covers. However, the API is being expanded with each version, and the vast majority of functions are already there, so it's hard to make a generalized statement "you can't do that in Python" without details.

 

About speed, the API just calls C4D internal functionality, so Python is only slower in the Python-native code that you develop, plus some overhead for the calls. When the control is with the C4D system, the speed is just the same, which is important to keep in mind when you perform costly functions like the neighbor stuff or ray hit things.

 

Also keep in mind that C4D uses only Python 2.7 while the rest of the world mostly has progressed to Python 3.

 

Link to post

maya and max, and i think houdini use also 2.7. so it is not a deal breaker. do not know which new features python 3 has.

 

my idea is to develop a selection tag, which selects components with various conditions. for example a loop from a predefined edge. or all edges with certain angle between them, or polygons with a certain normal. but the point is it should be procedural! everytime the base mesh changes this selection tag should evaluate the new components which meet the conditions. then this tag can be used everywhere a selection tag can be specified.

do you think this is possible in python? from what i saw i think yes.

Link to post
7 hours ago, iamnew said:

do not know which new features python 3 has.

 

I started using Python as v3 in Pycharm, and when I did my 1st C4D Python project using v2.7 I found some of my math was broken. After considerable hair pulling I found out why - integer division is different in the 2 versions. My project used frame numbers in the math which are integers -

 

in v2.7, int division gives int result > 5 / 2 = 2

in v3, int division gives real > 5 / 2 = 2.5

 

I had to use a lot of float commands, and add unnecessary zeroes e.g. write 99 as 99.0 to make it run correctly

 

pythonsnip.PNG.c2765a91084f10a1c34ee204679b23f8.PNGpycharmsnip.png.b527aacacb8e838c0ae756bc5e1c0efd.png

 

son of a diddly, as Ned Flanders would say

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...