<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi Pierrick,<br>
<br>
Looking at the current documentation for Blender, there doesn't seem to
be a return value for operators. I don't know if this could be
implemented.<br>
<br>
For the moment, a possible workaround to find out what objects you have
just linked would be something like this:<br>
<br>
<tt># Deselect all objects in the scene<br>
bpy.ops.object.select_all(DESELECT)<br>
# Import from another file, asking to auto select the new objects:<br>
</tt>
<div><tt>bpy.ops.wm.link_append(directory="/home/pierrick/atrv.blend/Object",
link=False,&nbsp;</tt></div>
<div><tt>&nbsp; files=[{'name': 'ATRV'}, {'name': 'Wheel.4'}, {'name':
'Wheel.3'}, {'name': 'Wheel.2'}, {'name': 'Wheel.1'}], autoselect=True)<br>
# Read the list of selected objects<br>
for obj in bpy.context.selected_objects:</tt><br>
<br>
<br>
</div>
<div>Hope this helps. Cheers!<br>
Gilberto<br>
</div>
<br>
<br>
On 05/24/2011 06:52 AM, Pierrick Koch wrote:
<blockquote
 cite="mid:BANLkTik3SVjybPX21NFE5BJaQLkzt3iOdg@mail.gmail.com"
 type="cite">
  <div>Hi everyone,&nbsp;</div>
  <div>
  <div><br>
  </div>
  <div>I am looking for a Python method to link/append/import objects
in Blender that would give me back some info about what has been
appended (in the best case a list of the imported objects instances)...&nbsp;</div>
  <div><br>
  </div>
  <div>For instance: let say that in a .blend file I have a car made of
the main structure which contain 4 wheels.&nbsp;</div>
  <div>Code:</div>
  <div>bpy.ops.wm.link_append(directory="/home/pierrick/atrv.blend/Object",
link=False,&nbsp;</div>
  <div>&nbsp; files=[{'name': 'ATRV'}, {'name': 'Wheel.4'}, {'name':
'Wheel.3'}, {'name': 'Wheel.2'}, {'name': 'Wheel.1'}])</div>
  <div><br>
  </div>
  <div>if there was already an object called ATRV, my car will be
renamed ATRV.001,&nbsp;</div>
  <div>it would be nice to get an instance of the objects, to avoid
pasing by bpy.data.object&nbsp;</div>
  <div><br>
  </div>
  <div>Same with collada: it would be amazing if:&nbsp;</div>
  <div>Code:</div>
  <div>bpy.ops.wm.collada_import(filepath="/home/pierrick/atrv.dae")</div>
  <div><br>
  </div>
  <div>could return something like:&nbsp;</div>
  <div>Code:</div>
  <div>you_just_imported = {&nbsp;</div>
  <div>&nbsp; 'ATRV': [&nbsp;</div>
  <div>&nbsp; &nbsp; 'Wheel1',&nbsp;</div>
  <div>&nbsp; &nbsp; 'Wheel2',&nbsp;</div>
  <div>&nbsp; &nbsp; 'Wheel3',&nbsp;</div>
  <div>&nbsp; &nbsp; 'Wheel4'&nbsp;</div>
  <div>&nbsp; ]&nbsp;</div>
  <div>}</div>
  <div><br>
  </div>
  <div><br>
  </div>
  <div>Where the string are the real-name of the object in the Blender
instance.&nbsp;</div>
  <div>With .001 if there was already another object with the same name
in the scene.&nbsp;</div>
  <div><br>
  </div>
  <div>...&nbsp;</div>
  <div>In fact, I'm working on Robotics <a moz-do-not-send="true"
 href="http://wiki.blender.org/index.php/Robotics:Contents">http://wiki.blender.org/index.php/Robotics:Contents</a>&nbsp;</div>
  <div><a moz-do-not-send="true"
 href="https://github.com/pierriko/morse/blob/master/src/morse/builder/morsebuilder.py#L61">https://github.com/pierriko/morse/blob/master/src/morse/builder/morsebuilder.py#L61</a>&nbsp;</div>
  <div><a moz-do-not-send="true"
 href="https://github.com/pierriko/morse/blob/master/examples/morse/scenarii/ros_example.py">https://github.com/pierriko/morse/blob/master/examples/morse/scenarii/ros_example.py</a>&nbsp;</div>
  <div><a moz-do-not-send="true"
 href="http://www.openrobots.org/wiki/morse">http://www.openrobots.org/wiki/morse</a>&nbsp;</div>
  <div>...&nbsp;</div>
  <div><br>
  </div>
  <div>Any idea? shall I open an issue for that?&nbsp;</div>
  <div>Cheers,</div>
  </div>
  <div><br>
  </div>
  <div>Pierrick</div>
  <div><br>
  </div>
  <div>=&nbsp;This message is cross-posted on&nbsp;<a moz-do-not-send="true"
 href="http://www.blender.org/forum/viewtopic.php?t=20112">http://www.blender.org/forum/viewtopic.php?t=20112</a>&nbsp;=</div>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Robotics mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Robotics@blender.org">Robotics@blender.org</a>
<a class="moz-txt-link-freetext" href="http://lists.blender.org/mailman/listinfo/robotics">http://lists.blender.org/mailman/listinfo/robotics</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Gilberto Echeverria
Research Engineer
Robotics and Interactions Group (RIS)
LAAS/CNRS, Toulouse
+33 (0)5 61 33 78 95</pre>
</body>
</html>