PDA

View Full Version : Calling multiple files using single script


Unik
07-28-2011, 04:14 PM
Hey Guys,

I am trying to import animation using point cache. There are about 100 geometries in the scene and each has an individual .xml file. The modifier adding part goes smoothly but how should I change the name according to the object?

I tried PointCache.filename = dirname + filename + "Shape.xml but its showing error that no cache file found.

Any suggestions will be helpful.

Thanks in advance.

lo
07-28-2011, 05:56 PM
post your entire code section please.

starsybil
08-01-2011, 12:10 PM
Hello,
maybe this helps:


cDir = "c:\\cacheTest\\"

for o in objects do
(
if o.modifiers[#Point_Cache] != undefined do
(
deletemodifier o o.modifiers[#Point_Cache]
)
cPC = Point_Cache ()
addmodifier o cPC

cPC.filename = cDir + o.name + ".xml"
)

It should work like this. The files in this case would be located at:
C:\CacheTest

Xml Files named after the Object.

>>dirname + filename + "Shape.xml"
You could try printing it to the Listener, maybe somethings off with your String.

3rd Dimentia
08-03-2011, 07:10 AM
Hi starsybil, why would you need to delete the existing pointcache mod? Why not just assign the file to the existing one?

Cheers,

Cg.

starsybil
08-03-2011, 07:13 AM
Hi starsybil, why would you need to delete the existing pointcache mod? Why not just assign the file to the existing one?

Cheers,

Cg.

Hi :) I just added that part, so I have a clean object every time I start the script.
Sorry for the confusion~

-Markus

3rd Dimentia
08-04-2011, 02:01 AM
No confusion, there's a few reasons I wouldn't go about it that way:

1/ There may be settings on the PCmod that you want to keep.

2/ The PCmod might not be on the top of the stack of the objects, but if you delete and re-add it, it will be in the wrong spot.

3/ It's just a bit wasteful.

So it just seems there's possibility for more damage than is actually needed by doing that when you don't really need to.

Just my opinion.

Cheers,

Cg.

starsybil
08-04-2011, 10:19 AM
No confusion, there's a few reasons I wouldn't go about it that way:

1/ There may be settings on the PCmod that you want to keep.

2/ The PCmod might not be on the top of the stack of the objects, but if you delete and re-add it, it will be in the wrong spot.

3/ It's just a bit wasteful.

So it just seems there's possibility for more damage than is actually needed by doing that when you don't really need to.

Just my opinion.

Cheers,

Cg.

Yup, i agree 100% :)
I certainly wouldn't use the delete part in production. Probably should have deleted that part from the Code before posting it.

I mainly wanted to point out:
cPC = Point_Cache ()
addmodifier o cPC

cPC.filename = cDir + o.name + ".xml"
Since thats where the problem seemed to occur.

Thx for the feedback. :)

~Markus

CGTalk Moderation
08-04-2011, 10:19 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.