Good day,
I have a simple question: how does one convert an instanced local model to regular mesh? The problem is, I would like to merge together a large blockout loaded with instances and export it as simple mesh.
Any help is greatly appreciated, thank you.
Convert Instanced Model to Mesh
-
SvalinnAsgard
- Posts: 24
- Joined: 17 Oct 2012, 08:19
- Location: United States
-
Rork
- Posts: 1359
- Joined: 09 Jul 2009, 06:59
- Location: Close to The Hague, Netherlands
Re: Convert Instanced Model to Mesh
there are some scripts out there that will do the trick.
i agree it would be nice to have this out of the box though.
rob
i agree it would be nice to have this out of the box though.
rob
SI UI tutorials: Toolbar http://goo.gl/iYOL0l | Custom Layout http://goo.gl/6iP5xQ | RenderManager View http://goo.gl/b4ZkjQ
So long, and thanks for all the Fish!!
So long, and thanks for all the Fish!!
-
face
- Posts: 57
- Joined: 10 Jan 2010, 11:28
Re: Convert Instanced Model to Mesh
I´m also searching for a solution, but i haven´t found any script that works as well.
All scrips fail if there are deep nested instances which have also an instance of a model which have an instance and a real mesh.
Sounds a little bit confused, i know ;)
face
All scrips fail if there are deep nested instances which have also an instance of a model which have an instance and a real mesh.
Sounds a little bit confused, i know ;)
face
-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: Convert Instanced Model to Mesh
Then here you go. Select instances and run it. If not all the instances would be converted, - select all the objects and run it againface wrote:I´m also searching for a solution, but i haven´t found any script that works as well.
Code: Select all
si = Application
sel = si.Selection
count = si.Selection.Count
selection = [sel[i] for i in range(count) if str(si.ClassName(sel[i])) == 'Model' and sel[i].ModelKind == 2]
for i in selection:
d = si.Duplicate("B:"+str(i.InstanceMaster))
si.MatchTransform(d, i)
if i.Parent.Name != si.ActiveProject.ActiveScene.Root.Name:
si.ParentObj(i.Parent, d)
si.DeleteObj(i)
Last edited by iamVFX on 20 Oct 2012, 04:53, edited 2 times in total.
-
SvalinnAsgard
- Posts: 24
- Joined: 17 Oct 2012, 08:19
- Location: United States
Re: Convert Instanced Model to Mesh
Thank you for the replies everyone.
@iamVFX: Thank you for providing this script. When I tried to run it, a COM error would arise on si.ParentObj. (Using Softimage 2013 SP1 here, not sure if it makes a difference)
I have a bit of programming experience in C# and C++, so I did some researching and changed the script to scan all my objects and automatically pull the instances because I am too lazy to select them myself (there are quite a few).
The script actually creates models from the instances as opposed to actual poly meshes, but at that point it does not matter as one can just filter poly meshes only in the Explorer and export them.
Here is the altered script that worked for me:
This is meant to rapidly make my instances export ready, so it scans the entire scene. Also, for this reason I needed to freeze transforms at the end.
@iamVFX: Thank you for providing this script. When I tried to run it, a COM error would arise on si.ParentObj. (Using Softimage 2013 SP1 here, not sure if it makes a difference)
I have a bit of programming experience in C# and C++, so I did some researching and changed the script to scan all my objects and automatically pull the instances because I am too lazy to select them myself (there are quite a few).
The script actually creates models from the instances as opposed to actual poly meshes, but at that point it does not matter as one can just filter poly meshes only in the Explorer and export them.
Here is the altered script that worked for me:
Code: Select all
sceneObjs = Application.SelectAll(False)
instList = [sceneObjs[inst] for inst in range(sceneObjs.Count) if str(Application.ClassName(sceneObjs[inst])) == 'Model' and sceneObjs[inst].ModelKind == 2]
for inst in instList:
mesh = Application.Duplicate("B:" + str(inst.InstanceMaster))
Application.MatchTransform(mesh, inst)
Application.ResetTransform(mesh, "siCtr")-
iamVFX
- Posts: 697
- Joined: 24 Sep 2010, 16:28
Re: Convert Instanced Model to Mesh
Uhm, yeah, sorry, Softimage thinks the object which placed under scene root should rise an error if it tries to parent it to the scene root againSvalinnAsgard wrote:Thank you for the replies everyone.
@iamVFX: Thank you for providing this script. When I tried to run it, a COM error would arise on si.ParentObj.
-
SvalinnAsgard
- Posts: 24
- Joined: 17 Oct 2012, 08:19
- Location: United States
Re: Convert Instanced Model to Mesh
No worries, your script saved me hours of research and trial and error (never scripted in SI Python before). Your new one works perfectly as well, no more COM error.
Thanks again.
Thanks again.
-
fabilabo
- Posts: 69
- Joined: 28 Jan 2010, 12:13
Re: Convert Instanced Model to Mesh
Nobody use :
http://rray.de/xsi/index_nodyn.html
Search "jhInstancia"
?
http://rray.de/xsi/index_nodyn.html
Search "jhInstancia"
?
-
face
- Posts: 57
- Joined: 10 Jan 2010, 11:28
Re: Convert Instanced Model to Mesh
Here a testscene which i use:
An instance from a model with instances can´t convert and this is what i need ;)
All scripts fail on the Model1_Instance.
I think, for this problem a recursive function is needed, also a function which calls itself and goes back to the tree to find the real mesh
But maybe i´m wrong.
face
All scripts fail on the Model1_Instance.
I think, for this problem a recursive function is needed, also a function which calls itself and goes back to the tree to find the real mesh
But maybe i´m wrong.
face
You do not have the required permissions to view the files attached to this post.