Jump to content

[SOLVED] Convert ObjectMesh to NodeReference


photo

Recommended Posts

Is there a way to convert a mesh into a reference node?

 

We have a lot of modular meshes in oru scene and it would be a lot better if these were converted to node references

I already changed a few manually in the .world file by simply replacing the mesh node for a reference node while leaving the id and the transformation info intact

but this involves a lot of work, is there an easier way to do this?

 

We already thought about a python conversion script but me as an artist didnt get so far as I can only replace just 1 word instead a few different words

 

What we need is this:

 

<node type=”ObjectMesh” id=”1572192778” name=”CanyonModular35”>

<mesh>Island/meshes/Canyon/ModularCanyonSingle.mesh</mesh>
<surface name=”ModularCanyonSingle” max_visible_distance=”240” max_fade_distance=”150” material=”ModularCanyon” property=”surface_base” />
<surface name=”ModularCanyonSingleLOD2” min_visible_distance=”240” min_fade_distance=”150” material=”ModularCanyon” />
<transform>0.951883 -0.306293 0.0100831 0 0.306039 0.951787 0.021079 0 -0.0160534 -0.016979 0.999728 0 645.19 -730.67 50.0204 1</transform>
</node>

 

 

Converted into this:

 

<node type="NodeReference" id="1572192778" name="ModularCanyonSingle34">
<reference>Island/nodes/Canyon/ModularCanyonSingle.node</reference>
<transform>0.951883 -0.306293 0.0100831 0 0.306039 0.951787 0.021079 0 -0.0160534 -0.016979 0.999728 0 645.19 -730.67 50.0204 1</transform>
</node>

I found a tutorial about python and created this:

 

fin = open("canyon.txt")
fout = open("canyon2.txt", "wt")
for line in fin:
    fout.write( line.replace('ObjectMesh', 'NodeReference') )
fin.close()
fout.close()

But as you can see that way I am only able to replace 1 word while I need to replace about 7 different words, and while doing this I also need to copy out the modular bits to a seperate file so it wont change any of the other models still inside the scene

 

Anyone got an easy sollution for this?

 


 

Link to comment
×
×
  • Create New...