View Full Version : Changing objects script, help nedded
06-27-2003, 02:04 PM
Im having a problem with a script im working at, where i can take an object in scene A and exchange it with an object from scene B..
for eksameple.. im having a scene of a street where i want cars in but they got to many vertex's, so i want to have a box in the street scene that i can change out with the car at render time..
i have tried to do it with a preRender but i get a string error cause i tryed to use merge, witch i also found out, just puts in the object at the place it have in the scene it came from, and dont inherit the x,y,z cordinats from the object its going to replace..
can somebody give me a hint how to get further.. im a little stuck.. thinking maybe i can use Xref, but can i do that in a preRender string and if so, how can i specify the file i want to get the (car) object from? I have been looking to see if i could find a script that did something in preRender put cant.. except the build in "howTo" excample but it just give a sphere more segments.. I also cant seem to find out how to have a string in a string..
06-27-2003, 03:48 PM
Without doing any research or testing on your specific problem, I can help you with your question about putting a "string inside a string." You need to use the escape character to put the quote marks in explicitly:
"This string has a \"string\" inside it!"
The \ character tells Maxscript to include the quote mark into the string. Hope that gets you a little further along with your script:)
06-27-2003, 04:42 PM
X-ref Object is your best bet.
Set your cars up in individual files centered at [0,0,0]. You need to collapse your car to a single mesh.
Collect them with the X-ref Object dialog in the file menu. Then right click on the object and go to properties. Check display as box.
There's also an option to use a proxy object in the X-ref object, which I set up in the same file. So I have a low-poly and a highres of each car in one file. I load in the hi-res into the x-ref slot, and the low res in the proxy slot. You can then select to render the proxy for scenes where the car is at a distance or render the high-res when it's closer in your scene, or a combination when you've a bunch of cars in a shot...
06-27-2003, 04:55 PM
thanx for that..
I'll try to see if i can get it to work..
cause i still need to make a preRender function with the X-ref command within.. I'll studdy it a bit more..
Do any of u know if there is a book that goes deeper into the max scripting? or is the only thing i can go for the help?
06-27-2003, 05:06 PM
You can not change goemetry with the prerender callback, the scene nodes have already been evaluated.
The x-ref object will automatically do exactly what you stated above, load the high-res car in prior to rendering, but not negatively effect your working file size and your ability to move fast in that file.
What else do you need to change prior to rendering?
Books. I own two of them, but 64.7% of the time the help file is where I get answers to questions. 10.2% looking through scripts that do similar things that I want to do. After that I hit the forum.
I don't feel the books were I very good investment, there's plenty of resources on the web too...
06-27-2003, 06:46 PM
but what i want is to make the car appear in the rendered scene but not in the scene im working at..
i want the substitude to happen when i press the render button..
is there a way that i can do that??
06-27-2003, 06:58 PM
Sure. xref object.. try it out...
When it's an x-ref object it just like being a max node, you can hide it, animate it, add modifiers.. ect...
You can animate the wheels turning in the max file with the car in it and the wheels will turn in the file you have it xref object'd into. They're really bitch'n. I use them all the time.
For farm rendering there great, the queued file is small but has all the geometry from the x-ref'd files in it...
06-27-2003, 07:00 PM
The biggest problem is that im newbiee.. but had a company ask me if i could program a script that could do the above..
as a programmer I'll ofcause try.. Maybe I could be so lucky to get a job in the future.. but first im trying to figure out how to script max.. not that easy i found out.. so if u know some good links to pages where i cant find good scripts to look at, please post them!!
06-27-2003, 07:08 PM
Has 90%, or so, of all the scripts out there..
Discreets Web board. very usefull as well..
Don't forget to use the search feature of the web boards to find things too... Alot of times the info I need has already been disscussed...
Is this company aware of X-ref objects? I know where I work they don't use them much, although they should... very frustrating...
06-27-2003, 07:25 PM
I dont know if they know them..
But I didn't know them until yesterday when i read about them.. I still havent figured them out but hope I can understand them by reading more about them somewhere..
But in the online help it dont says that mutch about using them.. and the other part is kinda dark talk for me.. hehe
But when i figure out the force of them I will ofcause tell them about them.. And since its not that big a company i guess its not that hard to get info around to everyone (5 persons)
06-27-2003, 07:30 PM
WEll Good luck..
The big thing to remember about xref object is that the pivot of the object is going to be the [0,0,0] of the file your are xref'ing.
if you want the middle, ground level point of the car to be the pivot point in your overall file. Then in the file with the car, the car needs to be positioned centered on x=0,y=0 with z=0 as the cars ground plane.
Best of luck
06-27-2003, 07:35 PM
hmm think i have to try it off before i excatly know what we are talking about..
Cause just the word pivot, is a little unknow for me right now!!.. I cant remember all the names of stuff in max..
thanx for the luck wishing.. I can use it.. hehe
01-15-2006, 12:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.