THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/06/2012 at 04:27, xxxxxxxx wrote:
Hi guys,
as title says, I'm trying to output the active camera name in a document from a Python node inside xpresso. I did a search and find this post: https://plugincafe.maxon.net/topic/5961/6071_activate-camera-a-very-simple-question-for-a-noob and thought It could solve the question, but I can't get it to work.
A little background: I'm doing this to solve a problem I have on another setup. I made a simple xpresso that toggle the visibility of an object based on wich camera is active at the moment. Lets say you have a cube that is visible only when camera_2 is active and invisible when others cameras are active. In xpresso is pretty easy, I used a Perspective node to output the active camera link, feeded into a generic camera object to get the name out of it, then compared the two names and used the bool result to toggle visibility of the cube. The problem with this setup is that if you copy it in another scene, the Perspective node looses its link becoming an undefinied object.
Hence I thought I could replace the Perspective node with a Python node that outputs (with a 'link' output port) the same information.. My setup so far consist in a Python node with this code:
import c4d
def main() :
bd = doc.GetActiveBaseDraw()
camera = bd.GetSceneCamera()
and this is what I'm getting:
If I try to provide the argument "doc" as stated in the console (like bd.GetSceneCamera(doc) ) the error in console becomes "Could not find port value for 'camera' in node 'Python'".
Sorry for the long and noob post, just trying to be clear as possible :)
Thanks
Massimiliano