Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a loadXML function to load an sofa scene from xml in python. #123

Merged
merged 2 commits into from
May 22, 2024

Conversation

damienmarchal
Copy link
Member

The added loadXML function permit to load old xml sofa scene from in python.

This is quite convenient to combine multiple of them or add extra features.

from splib3.loaders.xmlloader import loadXML

class Controller(Sofa.Core.Controller):
        def __init__(self, *args, **kwargs):
		self.target = kwargs.target)

def createScene(root):
	loadXML("MyScene.xml", root)

	root.addChild("Robot")
	loadXML("MyRobot.xml", root.Robot)

	root.Robot.addObject(Controller(target=root.Robot))

from splib3.loaders.xmlloader import loadXML

class Controller(Sofa.Core.Controller):
        def __init__(self, *args, **kwargs):
		self.target = kwargs.target)

def createScene(root):
	loadXML("MyScene.xml", root)

	root.addChild("Robot")
	loadXML("MyRobot.xml", root.Robot)

	root.Robot.addObject(Controller(target=root.Robot))
Copy link
Member

@EulalieCoevoet EulalieCoevoet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! An example at the end of the file like you usually do would be great, otherwise good for me.

@damienmarchal
Copy link
Member Author

@EulalieCoevoet as requested, I added an example.

@EulalieCoevoet EulalieCoevoet merged commit 2775941 into master May 22, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants