Notifications
Clear all

[Closed] Calling multiple files using single script

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.

6 Replies
 lo1

post your entire code section please.

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.
  
  [b]>>dirname + filename + "Shape.xml[/b]"
  You could try printing it to the Listener, maybe somethings off with your String.

Hi starsybil, why would you need to delete the existing pointcache mod? Why not just assign the file to the existing one?

Cheers,

Cg.

1 Reply
(@starsybil)
Joined: 11 months ago

Posts: 0

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

-Markus

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.

1 Reply
(@starsybil)
Joined: 11 months ago

Posts: 0

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