<!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, </tt></div>
<div><tt> 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, </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)... </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. </div>
<div>Code:</div>
<div>bpy.ops.wm.link_append(directory="/home/pierrick/atrv.blend/Object",
link=False, </div>
<div> 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, </div>
<div>it would be nice to get an instance of the objects, to avoid
pasing by bpy.data.object </div>
<div><br>
</div>
<div>Same with collada: it would be amazing if: </div>
<div>Code:</div>
<div>bpy.ops.wm.collada_import(filepath="/home/pierrick/atrv.dae")</div>
<div><br>
</div>
<div>could return something like: </div>
<div>Code:</div>
<div>you_just_imported = { </div>
<div> 'ATRV': [ </div>
<div> 'Wheel1', </div>
<div> 'Wheel2', </div>
<div> 'Wheel3', </div>
<div> 'Wheel4' </div>
<div> ] </div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>Where the string are the real-name of the object in the Blender
instance. </div>
<div>With .001 if there was already another object with the same name
in the scene. </div>
<div><br>
</div>
<div>... </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> </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> </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> </div>
<div><a moz-do-not-send="true"
href="http://www.openrobots.org/wiki/morse">http://www.openrobots.org/wiki/morse</a> </div>
<div>... </div>
<div><br>
</div>
<div>Any idea? shall I open an issue for that? </div>
<div>Cheers,</div>
</div>
<div><br>
</div>
<div>Pierrick</div>
<div><br>
</div>
<div>= This message is cross-posted on <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> =</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>