Convert editMesh to editpoly all objects but keep and convet instances

Hi,

I need a script converting Editable mesh to editable poly conversion. But ı want to keep instance objects. is there anyone has something like this ?

İs it possible ?

Thanks

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
pixamoon's picture

`

Hi Fajar,

not if next line after "add modifier" is "collapse to Edit_Poly"...
- because all instances of "o" will be collapsed to Edit_poly too...
- that's mean they will be skipped later by ".. where classof o == Editable_mesh do ..."

of course this don't work if you "--" turn off collapse line, do you agree ?

About your code:
- it should be "appendifunique" otherwise same object will be collected multiple times (so "--add something here...." will be also repeated few times on the same object)
- "if firstOnly.count > 1 do" it will collects only instanced objects
- what about other selected objects which don't have any instance ?
(qestion was about convert "all objects" to EditPoly but keep instances)
- why "firstOnly[firstOnly.count-1]" not just firstOnly[1] ?

I think your code should look this way:

firstInstances = #()
for o in selection do (
	InstanceMgr.GetInstances o &Arr
 
	if Arr.count > 1 then 
		appendifunique firstInstances Arr[1]
	else 
		appendifunique firstInstances o
)
--print firstInstances 
if firstInstances.count != 0 do --add something here....

or even:

firstInstances = #()
for o in selection do (
	InstanceMgr.GetInstances o &Arr
	appendifunique firstInstances Arr[1]
)
--print firstInstances 
if firstInstances.count != 0 do --add something here....

what do you think ?

fajar's picture

if its intance we just need

if its intance we just need the first node only...say bout using InstanceMgr.GetInstances...

firstInstances = #()
for o in selection do 
		(
			InstanceMgr.GetInstances o &firstOnly
			if firstOnly.count > 1 do 
				append firstInstances firstOnly[firstOnly.count-1]
		)
if firstInstances.count != 0 do --add something here....

if object added modifer while the object itself is intance then if it added more than two modifier it'll result to add modifer 2xobject in selection count per object...

say something like this

for o in selection where classof o == Editable_mesh do (
	addmodifier o (Poly_Select())
		addmodifier o (Cloth())
	--maxOps.CollapseNodeTo o 1 off
)
pixamoon's picture

`

try this:
for selected objects only:

for o in selection where classof o == Editable_mesh do (
	addmodifier o (Poly_Select())
	maxOps.CollapseNodeTo o 1 off
)

for whole scene:

for o in geometry where classof o == Editable_mesh do (
	addmodifier o (Poly_Select())
	maxOps.CollapseNodeTo o 1 off
)

cheers,
Pixamoon

redapplist's picture

Thank you very much. Works

Thank you very much. Works great

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.