WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   <node3d>.save() position and rotation (https://forum.worldviz.com/showthread.php?t=4204)

torbeng 04-16-2012 05:18 AM

<node3d>.save() position and rotation
 
I'm currently trying to apply some transformations (scale, position, rotation) to a model and save it to an .ive file using .save(). However, all of these transformations are lost when I open the file.
I played around with the different modes for setting a position, e.g. setPosition(0,0,10,mode=viz.REL_LOCAL), but it does not seem to have any effect. Is there any way to save the model with these transformations applied? Thank you very much for your help in advance.

Jeff 04-16-2012 06:33 AM

The .save command will save a node to either the .ive or .osg format. Transformations made to the node will not be saved.

You'll need to apply the transformation in some modeling software and then export a new version of the model.

farshizzo 04-16-2012 08:23 AM

If you parent the model to a group node, then saving the group will preserve the transformation of the model. Example:
Code:

import viz
viz.go()

root = viz.addGroup()
model = viz.add('dojo.osgb',parent=root)
model.setEuler(180,0,0)

root.save('dojo_rotated.osgb')


torbeng 04-16-2012 08:42 AM

Thanks a lot, this seems to work, at least with some models. For some reason, it does not work with all - I'll have to investigate a bit. Maybe it is a format-specific glitch. Here is an example:

Code:

import viz
viz.go()

root = viz.addGroup()
model = viz.add('dojo.osgb',parent=root)
model2 = viz.add('table.wrl',parent=root)
model2.setPosition(2,2,2)
model.setEuler(99,0,0)
model.setPosition(1,1,1)
root.save('dojoandtable.ive')
root.remove()
viz.add("dojoandtable.ive")

If you comment out the last two lines, the table is floating in the air. If you don't, the table is one the floor.

farshizzo 04-16-2012 08:49 AM

Sorry, I forgot to mention that this will only work with the newer osgb format.

torbeng 04-16-2012 09:24 AM

Oh, thanks, that clears things up. However, once I have all my models saved as osgb, I cannot open them with any program. Even osgconv fails to convert these models to any other file (including the differnet osg file formats). Do you know of any software product that can successfully open osgb files generated by Vizard except for Vizard?

farshizzo 04-16-2012 09:53 AM

Unfortunately you won't be able to load the models within an external program. Vizard uses its own osg::Transform derived class for transforming models, so this class can only be serialized within Vizard.

torbeng 04-18-2012 09:17 AM

Thanks for your help. Does WorldViz have any plans to make a working export/save function a feature of future versions of Vizard?


All times are GMT -7. The time now is 04:51 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC