Jump to content
Developer Wiki and Function Reference Links ×

Node - Calculations


Recommended Posts

  • Marionette Maven

Hi Alan,

What you've written is acceptable.

The only thing I've noticed is that you used this line twice:

calc = self.Params.calc.value

Every user/programmer will have their own style of coding, it's up to you to use whatever you like best.

I think that your code is very easy to understand, so I don't think there's an issue with you writing this way.

A few notes that don't REALLY matter:

1) Although using "Marionette.TupleMap" makes sense in Marionette networks, I've found it better practice to use use the standard operators on the small scale. (+, -, *, /)

2) Adding comments to your code will always assure that the user can follow what you're doing. I'm glad you used the comments to say which operation is being used for which option.

3) In the Params class, maybe you'd like to add descriptions using .SetDescription to the a, b, and c ports - this will allow descriptions of each of those to appear in the "Description" dialog brought up by the button in the OIP. That is another great way to help a user understand what a node does or requires to work.

I personally believe that the most important part of coding is creating code that an unexperienced user will be able to understand moderately easily. It's also very beneficial to comment code because you may return to a project from months or years ago and not remember what a certain part does off the top of your head, or you may not remember why you did it a certain way.

Hope this helps!

Link to comment
  • Marionette Maven

It doesn't really matter in the end, but using the TupleMap is only advanced in the sense that if you were adding vectors or points (i.e. (0,1,2) + (1,2,3)) you'd be adding the independent elements (so the result would be (1,3,5))

If you're only trying to accomplish basic math, it's much easier to just use the + - * / operators.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

  • Create New...