Community:Science/Robotics/Simulators/LinkProblems

提供: wiki
移動先: 案内検索

Linking in Blender

This is a review of the link from library functionality for the Open Robots Simulator project. We are currently developing using Blender 2.49b.

The mechanics to link elements from one .blend file into another are very useful to maintain consistent and reusable component libraries. However, for our application of Blender as a robotics simulation platform, the current implementation of linking has several issues which make working with libraries difficult.

Moving and Parenting

When an object in a file A.blend is linked into another file B.blend, it is shown with a cyan outline when selected. In this state, it can not be moved within a scene, nor can it be parented to another object in B.blend. For the ORS library implementation, we keep robotic components in a library of .blend files. Building a robot consists of linking the diverse components, and parenting them to the robot's frame. This means we need to parent linked objects.

Parenting a linked object is impossible in the current versions. There are a few alternatives, but none is perfect.

  • Creating a Proxy. This permits the imported object to be modified. But when an object is turned into a proxy, its Logic Bricks are lost. For this reason, proxies are not practical in our application
  • Duplication of the linked object: Within B.blend the linked instances are kept in a hidden layer of the scene. Then a duplicate of the link is created and placed on a different, visible layer. The process is described here. This is the solution currently being used.

This process permits placing and parenting of the duplicate objects, but also makes the whole procedure of creating a robot/scene more complex and error prone. Plus it causes other problems, described below.

Grouping of the objects

Blender uses a file browser for the append and link operations. This browser shows the contents of a .blend file in different categories, such as Group, Material, Object, Mesh.

While using append to add files from A.blend, it is possible to append groups of objects. Thus a whole robot can be appended by selecting its group from the file browser showing the contents of A.blend. However, liking of groups does not seem to work. The first attempt at linking a group will finish without any error message, but will not add anything into file B.blend. Any further attempts after the first will print and error at the terminal: append: already linked.

To make liking work, it is necessary to select not the Groups, but the individual Objects. This means that in the case of a complex robot, there will be several objects which need to be selected from the file browser. Plus there is no indication in the file browser as to which objects are parented to the robot and which are part of the scenario.

Cascade linking

In the project we require assembling a full robot in file B.blend, composed of objects linked from A.blend. Then the robot in B.blend is linked into a scenario file C.blend. At this point several more problems occur.

  • The objects imported into C.blend are the duplicates created in B.blend, not the links
  • If A.blend is modified, it becomes necessary to change the duplicate in B.blend as well
  • If the mesh of an object in A.blend changes name, all its links in B.blend will no longer find the mesh. An error is reported by Blender, but the link object (cyan outline) is still shown. However, the duplicate is not displayed. Deleting the duplicate and creating a new duplicate of the link will not solve the problem. It is necessary to delete the linked object, create the link again and make a new duplicate.

An ideal solution to this and the previous issue would be to permit linking of an object and all its children. For example: a car in file A.blend with 4 wheels as its children. When linking the car in file B.blend, the wheels would also be linked. Furthermore, if seats are parented to the car in file B.blend, then linking the car in a file C.blend will add the car, the wheels and the seats.

Logic Bricks

Changes done to the objects in the original A.blend file will not always translate to its linked version in B.blend. The graphical representation of the object (mesh, materials, etc.) are preserved, but the Logic Bricks are only preserved in the direct link, but not in the duplicates. To preserve all copies consistent, changes in file A.blend have to be done manually again in the duplicates of B.blend.

Proposed changes

For the purpose of the Open Robots Simulator, a simplified work flow would be obtained if the following changes could be implemented in Blender:

  • Permit the linked version of an object to be parented and moved within a scene, without altering it in its original file
  • Link all the children of an object when it is selected. For example: a car in file A.blend with 4 wheels as its children. When linking the car in file B.blend, the wheels would also be linked. Furthermore, if seats are parented to the car in file B.blend, then linking the car in a file C.blend will add the car, the wheels and the seats.
  • Preservation of the Game Engine's Logic Bricks and Properties on the linked versions