MAXON CINEMA 4D: Cinema 4D Forum Adobe After Effects Forum

XPresso Question - Degree of Rotation Display

COW Forums : Maxon Cinema 4D

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Tony BaroneXPresso Question - Degree of Rotation Display
by on Nov 15, 2013 at 1:29:50 pm

I have an animation where a “lens” is being rotated to different degrees 0 – 360. I have an XPResso setup with a slider controller to do this.
I would like to also output the current degrees of rotation to a text display within the animation. I set this up as well in Xpresso, but it shows the degree of rotation out to the 3rd decimal place. Is there a way to get it to somehow round off to the nearest .25 degree of rotation on the text display? Or at least only show 2 decimal places?

Thanks!



Return to posts index


Brian JonesRe: XPresso Question - Degree of Rotation Display
by on Nov 16, 2013 at 2:55:36 am

-you can delete all the decimals by running it through a Universal node set to Integer
-you can get two decimals by multiplying by 100 then running it through a Universal node then dividing by 100 (or one decimal by using 10 instead)
-you can use a Python node and run the input through a Round function to get 1 or 2 decimals in one step


Return to posts index

Tony BaroneRe: XPresso Question - Degree of Rotation Display
by on Nov 18, 2013 at 4:44:04 pm

THANK YOU!



Return to posts index


Tony BaroneRe: XPresso Question - Degree of Rotation Display
by on Nov 18, 2013 at 8:58:22 pm

Is there a way to also have it display a .0 when its not .1-.9? and/or add a "degree" symbol at the end?

The problem is, this is to show the degree of rotation of an object, and I have the object stopping at different points which sometimes have a .5 and sometimes nothing at all, so if I were to add the degree symbol as a different text object, I would have to have it move closet to the number when theres not a decimal after it.

Thanks again!



Return to posts index

Brian JonesRe: XPresso Question - Degree of Rotation Display
by on Nov 18, 2013 at 9:12:42 pm

are you using xpresso standard nodes or are you using the Python node at all? And how many decimal places are you using in the display? the degree symbol should be easy.

Either way this is the sort of thing you get in a lot of scripting when values are being returned with automatically rounded values (dropping the.0 for example) you have to detect that it's missing then add it in with an if statement. I don't know how complete the python interpreter is in C4D but it should be possible even in xpresso (but not absolutely sure of that...)


Return to posts index

Tony BaroneRe: XPresso Question - Degree of Rotation Display
by on Nov 18, 2013 at 9:19:37 pm

I'm using standard XPresso nodes, I don't know the first thing about python.

I have it setup as per one of your suggestions:

Math Multiply (10) - Universal (Integer) - Math Divide (10) - Text



Return to posts index


Brian JonesRe: XPresso Question - Degree of Rotation Display
by on Nov 18, 2013 at 10:24:35 pm

yes the degree symbol is easy, just pass the Math Divide (10) into Input [1] of another Math node set to Data Type - String, Function - Add and set Input [2] to be ° then pass that to Text

Adding the .0 should be done the same way but testing if you need it is something else... I will see if it can be done


Return to posts index


Brian JonesRe: XPresso Question - Degree of Rotation Display
by on Nov 19, 2013 at 12:29:33 am

yes, it can be done

6810_xpressoroundwithdecimals.c4d.zip

by taking the value that would go to the text then comparing it to a rounded (Universal:Integer) version of itself - if they are exactly equal (the Compare node) then the original value must not have trailing decimals and if they are not equal then the original must have decimals and the rounded version does not. Passing the true or false value to the Condition node lets us add the degree symbol if it already has decimals and '.0' plus the degree symbol if it does not have trailing decimals.


Return to posts index

Tony BaroneRe: XPresso Question - Degree of Rotation Display
by on Nov 19, 2013 at 1:19:06 pm

Brian, thank you very much for your help! Especially for posting the file... not sure I would have been able to figure it out from your explanation. :-)



Return to posts index


Arturo LazcanoRe: XPresso Question - Degree of Rotation Display
by on Jan 19, 2015 at 11:18:41 pm

Hi,
I don't know if i'm been stupid or what. But i copy your xpresso nodes, replace your oil tank object, for my own object, but nothing happened.


Return to posts index

Arturo LazcanoRe: XPresso Question - Degree of Rotation Display
by on Jan 19, 2015 at 11:23:46 pm

Hi,
I don't know if i'm been stupid or what. But i copy your xpresso nodes, replace your oil tank object, for my own object, but nothing happened.


Return to posts index

Brian JonesRe: XPresso Question - Degree of Rotation Display
by on Jan 20, 2015 at 3:40:29 am

that was just a quick test and it uses an absolute reference to the oil tank.
In that example if you open the xpresso itself, the first node (on the left) is an Absolute Reference to the Oil Tank. Which just means you can put the xpresso tag on any object (even a null) in the scene and it will always target the oil tank for it's Rotation.H. If you click on that node you can change Reference Mode from Absolute Reference to Use Start Position - leave Start Position as This object and Start Distance and History Depth at 1. Now whichever object you put the xpresso tag on will be the object who's rotation shows up in the MoText.

Or

you can open the xpresso and drag your new object into the xpresso box and it makes an absolute reference to the object, create an output port to export a value into the rest of the xpresso. (click on the red rectangle and choose Coordinate/Rotation/Rotation.H to copy what was used with the oil tank)

Or

you can open the xpresso and drag a new object on the Oil Tank node (on the darkest part not the borders i.e. where the name is) and it will change now be a node which points to the new object (the name will change) and it will still output Rotation.H like it was set to do with the oil tank.


Return to posts index


Arturo LazcanoRe: XPresso Question - Degree of Rotation Display
by on Jan 20, 2015 at 4:00:06 pm

Thank you very much Brian, you're my new god : )


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]