[Bf-python] a direct x importer addon for 2.6x (naming concern)

Campbell Barton ideasman42 at gmail.com
Mon Jan 23 17:16:04 CET 2012


Hi Jerome,

Great to see your script in SVN,

I've moved bel/ into being a submodule of the  io_directx_bel since
this is the only user so far.

For general utility functions I prefer extend bpy_extras, noticed
theres already some overlap between `bel` and `bpy_extras`,
http://www.blender.org/documentation/blender_python_api_2_61_release/bpy_extras.html

At some stage we can look at moving parts of bel/ into bpy_extras/.

Also, noticed none of the files in bel/ have a GPL header, please add
one - copy from any of the py scripts in trunk/ should do.

this is annoying house keeping, but rather keep this stuff in order.

- Campbell

On Mon, Jan 23, 2012 at 6:44 PM, jerome <jerome.le.chat at free.fr> wrote:
> Campbell,
>
> I committed two folders in svn addons (2931) : bel and io_directx_bel
> the bel folder should reside in .../2.61/scripts/modules/ to avoid this
> message :
>
> Warning: addon-module 'bel' found module but without __addon_enabled__
> field, possible name collision from file:
> '.../2.61/scripts/addons/bel/__init__.py'
>
> but it's  ok if you don't move it from /addons
>
> no big updates, I essentially added a 'last run' feature that saves the
> last importer config automatically in the operator preset path.
> so one can recall it from the operator preset dropdown ('last run' set).
> method should be available for any other scripts, allowing to refine an
> operator setup after several tries.
> (bel.fs.saveOptions() at line 214 in io_directx_bel)
>
>
> Le 12/01/2012 17:09, Campbell Barton a écrit :
>> checked the updated version, looks good so +1 to commit this to
>> contrib/, after some testing can probably go in trunk for release.
>>
>> @jerome, if you don't have commit access mail me with your login name
>> on http://projects.blender.org, otherwise, feel free to commit into:
>>
>> https://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts/addons
>>
>> But only the script, we have a different place for test files:
>> https://svn.blender.org/svnroot/bf-blender/trunk/lib/tests/io_tests
>>
>> ... but this needs access to blender/trunk svn.
>>
>> On Fri, Jan 13, 2012 at 1:01 AM, jerome<jerome.le.chat at free.fr>  wrote:
>>> thanks for your encouragement Campbell :)
>>>
>>> updated according to your last mail below :
>>> blender naming for img and tex, 'image exists ?' tests made by path
>>> comparison module not by bpy.img names, etc... all details appended to
>>> README
>>> excepted for the dict suggestion, but this should work without it.
>>> https://github.com/littleneo/directX_blender/wiki
>>>
>>> fyi, the bel module provided is a working multi files draft that acts as
>>> a layer for import/export/data injection stuff, as an extra helper module.
>>> in this case the x importer (should) only cares about data
>>> parsing/conversion and ask bel to solve things about naming and data
>>> injection.
>>> I supposed most of the existing methods/functions in import/export or
>>> mesh creation addons could reside in such a kind of module, since cases
>>> and concerns about naming, data generations/creations are the same. so
>>> its my long-term attempt to do this.
>>> thanks for any c&c about it. feel free to mod.
>>>
>>> Jerome
>>>
>>>
>>> Le 29/12/2011 00:43, Campbell Barton a écrit :
>>>> Hi, I had a look over the script and think its mostly ok but still
>>>> some things I think should be resolved.
>>>>
>>>> the obvious issues are still with namespace. from checking:
>>>> littleneo-directX_blender-a3ed6b4
>>>>
>>>> these lines assume an image filename can fit into an ID name which may
>>>> well fail if the names over 22 chars.
>>>> if filename not in bpy.data.images :
>>>> if filename not in bpy.data.textures :
>>>>
>>>> suggest to have a dictionary which maps names to datablocks.
>>>> if its desireable to use existing datablocks this dict could
>>>> optionally be initialized from existing data when the import starts.
>>>>
>>>> Another is...
>>>>    bpy.ops.object.select_name(name=arm.name)
>>>>
>>>> This should be replaces with...
>>>>    arm.select = True
>>>>    bpy.context.scene.objects.active = arm
>>>>
>>>>
>>>> Since the script looks quite well written (aside from noted issues) -
>>>> suggest this go into contrib/ so users can start testing more easily
>>>> and the few remaining issues can be resolved.
>>>>
>>>> On Tue, Dec 27, 2011 at 7:42 AM, jerome<jerome.le.chat at free.fr>    wrote:
>>>>> hi,
>>>>>
>>>>> the .x file importer has now support for armatures and parent-childs
>>>>> relationships importation.
>>>>> download and info :
>>>>> https://github.com/littleneo/directX_blender/wiki
>>>>>
>>>>> you need to enable the 'experimental blah' checkbox in the importer
>>>>> options for armatures/empties, and relation-ship importation.
>>>>> once the script has finished its job, mesh objects need to be parented
>>>>> 'by hand' using alt-p>    Armature Deform or an Armature modifier.
>>>>> (vertices weights are ready)
>>>>>
>>>>> Campbell please let me know for naming convention, it's ok according to me.
>>>>> Thanks for feedback and .x files you'd like to share to improve this.
>>>>>
>>>>> wish you the best,
>>>>>
>>>>> Jerome
>>>>>
>>>>>
>>>>> Le 30/11/2011 01:06, jerome a écrit :
>>>>>> Le 25/11/2011 05:16, Campbell Barton a écrit :
>>>>>>> On Thu, Nov 24, 2011 at 6:52 PM, jerome<jerome.le.chat at free.fr>      wrote:
>>>>>>>> oh ok Campbell,
>>>>>>>>
>>>>>>>> this should be alright then, at least for objs, meshes and mats. (tex
>>>>>>>> slots / img not supported yet but will be)
>>>>>>>> I though you talked about python module namespaces, 'import / from bpy
>>>>>>>> import' etc stuffs :)
>>>>>>>>
>>>>>>>> bpy.data.materials.new(name="MyMat").name = name
>>>>>>>> :)
>>>>>>>>
>>>>>>>> J.
>>>>>>> see found a way around but its not foolproof.
>>>>>>>
>>>>>>> you might still exceed the name length or have a blank script - see:
>>>>>>> http://www.blender.org/documentation/blender_python_api_2_60_5/info_gotcha.html#naming-limitations
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Bf-python mailing list
>>>>>>> Bf-python at blender.org
>>>>>>> http://lists.blender.org/mailman/listinfo/bf-python
>>>>>>>
>>>>>>>
>>>>>> oh the bpy.data.materia... line was just a kind of joke, you can find
>>>>>> the naming function quickly. assuming the name max lenght is 21 this
>>>>>> should be ok (actually 17 + 4 digits maybe a bit paranoid..).
>>>>>>
>>>>>> sorry I was not very available these days and won't until the next week.
>>>>>> nice pointer btw thanks.
>>>>>>
>>>>>> Jerome
>>>>>>
>>>>> _______________________________________________
>>>>> Bf-python mailing list
>>>>> Bf-python at blender.org
>>>>> http://lists.blender.org/mailman/listinfo/bf-python
>>>>
>>> _______________________________________________
>>> Bf-python mailing list
>>> Bf-python at blender.org
>>> http://lists.blender.org/mailman/listinfo/bf-python
>>
>>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python



-- 
- Campbell



More information about the Bf-python mailing list