def SaveAlchemediaScene(filename):
    ''' Save a newton Alchemedia file '''

    #create an empty scene
    scene = pyScene.pyScene()

    # get the active blender scene
    blenderScene = bpy.data.scenes.active

    #iterate over all object saarching for root nodes
    for object in blenderScene.objects:
        if object.getParent() == None:
            type = object.getType()
            if type == 'Mesh' or type == 'Empty':
                ExportObject(scene, None, blenderScene, object)

    scene.Save(filename)
def SaveAlchemediaScene(filename):
	''' Save a newton Alchemedia file '''
	
	#create an empty scene
	scene = pyScene.pyScene()
	
	# get the active blender scene
	blenderScene = bpy.data.scenes.active
	
	#iterate over all object saarching for root nodes
	for object in blenderScene.objects: 	
		if object.getParent() == None:
			type = object.getType()
			if type == 'Mesh' or type == 'Empty':
				ExportObject(scene, None, blenderScene, object)
				
	scene.Save (filename)
def LoadAlchemediaScene(filename):
	''' Load a newton Alchemedia file '''
	scene = pyScene.pyScene()
	scene.Load (filename)
	root = scene.GetRoot() 
	
	# get the active blender scene
	blenderScene = bpy.data.scenes.active
	
	# load all unique textures
	(path, name) = os.path.split (filename)
	
	childLink = scene.GetFirstChildLink (root)
	while childLink != None: 
		textureNode = scene.GetNodeFromLink(childLink)
		if scene.IsTextureNode(textureNode) == True:
			texture = CreateBlenderTextureFromNode (scene, textureNode, blenderScene, path)
			
			# add a map key for asigning faces
			sourceTexture = pyScene.pyTexture(scene, textureNode)
			g_textureMap[sourceTexture.GetId()] = texture
		childLink = scene.GetNextChildLink (root, childLink)
	
		
	# import all objects into a blender scene	
	myChidren = []
	childLink = scene.GetFirstChildLink (root)
	while childLink != None: 
		node = scene.GetNodeFromLink(childLink)
		if scene.IsSceneNode(node) == True:
		   LoadNodesScene(scene, node, blenderScene, myChidren)
		childLink = scene.GetNextChildLink (root, childLink)

	# make sure everthing is updated before exiting
	# I see this in some demos, but nthing seeme to makes the scene render completly
	blenderScene.update(1)
Beispiel #4
0
def LoadAlchemediaScene(filename):
    ''' Load a newton Alchemedia file '''
    scene = pyScene.pyScene()
    scene.Load(filename)
    root = scene.GetRoot()

    # get the active blender scene
    blenderScene = bpy.data.scenes.active

    # load all unique textures
    (path, name) = os.path.split(filename)

    childLink = scene.GetFirstChildLink(root)
    while childLink != None:
        textureNode = scene.GetNodeFromLink(childLink)
        if scene.IsTextureNode(textureNode) == True:
            texture = CreateBlenderTextureFromNode(scene, textureNode,
                                                   blenderScene, path)

            # add a map key for asigning faces
            sourceTexture = pyScene.pyTexture(scene, textureNode)
            g_textureMap[sourceTexture.GetId()] = texture
        childLink = scene.GetNextChildLink(root, childLink)

    # import all objects into a blender scene
    myChidren = []
    childLink = scene.GetFirstChildLink(root)
    while childLink != None:
        node = scene.GetNodeFromLink(childLink)
        if scene.IsSceneNode(node) == True:
            LoadNodesScene(scene, node, blenderScene, myChidren)
        childLink = scene.GetNextChildLink(root, childLink)

    # make sure everthing is updated before exiting
    # I see this in some demos, but nthing seeme to makes the scene render completly
    blenderScene.update(1)