[Closed] Saving Camera's Name in Save File area
Im trying to create a script that will write the file name of the selected camera inside my Output Filename area in my renderer. Everything works fine, except my camera name has more information in the output file than I need. It reads like “View_Camera:Camera01 @ [9.9,0.0,-65].rpf”
How can I clean that up to only show “Camera01.rpf” ?
Here is my code
edittext txtSavePath FieldWidth:360
selectedCamera = viewport.getCamera() as string
SaveFile = txtSavePath.text + selectedCamera +".rpf"
rendOutputFilename = SaveFile
the textbox is to allow the user to type the directory, then the script gives the file name… Any sugesstions on how to clean this up?
ALSO!
Is it possible to edit the .rpf settings from the script? For example, enable Z-Depth, keep 16bit, Enable G-Buffer, etc. ??
Try adding this:
[left]
[left]edittext txtSavePath FieldWidth:360
selectedCamera = viewport.getCamera() --note I removed the string() part[/left]
[left] [/left]
[left][b]cameraName = selectedCamera.name[/b]
[/left]
[left]SaveFile = txtSavePath.text + [b]cameraName [/b]+".rpf"
rendOutputFilename = SaveFile[/left]
[/left]
That’s exactly what I needed! It works great now! How did you know what variables are available for you to use? Like how did you know .name would be available for my viewport.GetCamera() ?
Thanks a lot for responding so fast… Any suggestion on my .rpf question?
Pretty much all nodes, whether they be geometry, lights, cameras etc. have access to the property .name. It’s basically the same property you use when you create any node in code. For example:
newBox = box [b]name:"BoxTest"[/b] position:[1,1,1]
As to your RPF question, check out RPF: BitmapI0 in the maxscript help. This should give you what you need.
ShowProperties < MAx Node > – will display them in the listener
or
getpropnames < Max Node > – will return an array of property names for an object.
How can I show properties for the Renderer? The Renderer dialog box does not list to the listener. Is it possible to list the variables or settings that the render dialog box is using?
It’s all in the MaxScript Help file… I like to keep my help file on the index tab, and just type in what ever it is you’re looking for…I also have a shortcut to the help file on my start bar, that way WHEN max crashes, you still have the last topic you where help’n yourself to…
You’ll find alot of the general renderer variables have global names, the rest can be found this way…
showproperties renderers.production
[size=1]getpropnames renderers.production
Good Luck…
[/size]
I just typed showproperties renderers.production [size=2]in the maxscript, and it listed everything I needed to know for my renderer variables! This is something I’ve been looking for! Thanks a lot of showing me this!!
I use the MaxScript Help Referrence often, but I sometimes get lost or can’t find the answer Im looking for… Like in this case, I couldn’t find something as simple as [/size]showproperties renderers.production [size=2]… The community makes it so much easier to understand Thanks a lot!
[/size]
There is a topic that most people probably skirt over in the MXS help – Inheritance and polymorphism, that describes what martin and keith are talking about. It means how objects within OOP programming inherit the properties of their parent class. So the box class inherits the geometryclass, which inherits properties from the node class. The light blue box underneath any max object in the MXS help will confirm this. Another useful topic is Node Common properties, operators and Methods.
the inheritance topic really helped me start understanding how the dotnet classes work – as OOP object handling is similar in someways, but infinitely more powerful once you get the idea of what an “Object” can actually encompass.
[left]for example, at the moment im writing a vb.net application that handles images. nothing fancy there, but i have written a custom class to expose properties and methods that i want to use all the time. so in the imageops class i will have access to the following properties and methods –
filename
extension
imagesize
path
full path
last save
date created
width
height
colordepth
GDI+ bitmap
Grayscale bitmap
ResizeBitmap
thus, when i want to retrieve an image, i create an object that is an instance of the imageOps class. this means I can access all the properties of this custom class in a more organised way.
[/left]