PDA

View Full Version : Linking about 2000 objects


Jorge Arango
09-17-2010, 09:32 PM
I have close to 2000 proxy objects that were created in R11 with vray. Now with R11.5, the linked objects must reside in a different folder and I have to link them again. For those of you that aren't familiar with vray, it is a process similar to linking a bitmap to a material.

In this case, the name of the object to be linked is exactly the same as the name of the object + .obj.vrmesh and all of them are in the same folder.

Anyone can produce a script that will help me link all these objects?

Here's a screenshot that will help explain how it works:

tcastudios
09-17-2010, 11:57 PM
You try this (copy all into script manager)
No warranty of any kind but it -should- work
based on your description.
(I don't have Vray installed on this machine to double check)

Cheers
Lennart

// Set VrayProxy links from Selected Folder Example, tcastudios.com 2010
// Sets links to all Proxys in scene based on proxy name (excluding ".obj.vrmesh")
AllObjects(op,fn)
{
while(op)
{
if(op->IsInstanceOf(1021309)) // VrayProxy Object
{
var last = op->GetName();
fn->AddLast(stradd(last,".obj.vrmesh"));

if(GeFileExist(fn,FALSE)) // If file found
{
op#VRAYPROXY_FILE = fn; // Set the vraymesh link
op->Message(MSG_UPDATE);
fn->RemoveLast(); // Reset path for next iteration
}
else// If file not found
{
println("Error "+last+"!!"); // ops! File not found,
//return; // source path not available!
}
}
AllObjects(op->GetDown(),fn);
op = op->GetNext();
}
}


main(doc,op)
{
var fn = GeGetStartupWritePath(); // Generate a file path
if(!fn->PathSelect("Select Vrmesh Folder")) return; // Select Vrmesh Folder

AllObjects(doc->GetFirstObject(),fn); // Use our iteration function
}

Jorge Arango
09-18-2010, 12:22 AM
Thanks Lennart! Please note that this is a proxy object (no proxy tag), see screenshot. I will try asap.

tcastudios
09-18-2010, 12:29 AM
That was me typing a bit to fast.
It should be Proxy Object.

Cheers
Lennart

Jorge Arango
09-18-2010, 01:48 AM
It's perfect! Only thing is when I link them manually, the postfix .obj.vrmesh is added to the object name, using the script the name remains unmodified. But it renders fine!

Thank you! :bowdown:

CGTalk Moderation
09-18-2010, 01:48 AM
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.