Jump to content
Sign in to follow this  
Stan`

Actor Importer For Blender

Recommended Posts

Currently, it can be a little annoying to get a mesh from the game in Blender, especially when it has a lot of props.

So I created this little blender addon for blender 2.8

What it does is it loads all the files used by the actor recursively (it picks random variants like the game does) and place all objects on their respective prop points using constraints. (Do not forget to disable constraints before exporting, else you might get into trouble)

It also assign a diffuse, norm and spec material to the object

 

@Syn I believe this will be way better than the explanation I gave you by e-mail, as it's a one click business

@Alexandermb @LordGood @Enrique @Trinketos

@The Undying Nephalim I believe you only use blender as a proxy, but it might be helpful for you as well.

 

Here is an example with a model with a lot of props

 

image.png

image.png

image.png

 

You can test it here https://github.com/StanleySweet/blender_pyrogenesis_importer/releases/download/1.3.6/io_scene_pyrogenesis.zip

 

EDIT: Textures are assigned in the link above.

EDIT2:  The importer may edit files, to remove materials, effects or images that might have broken the import otherwise

EDIT3: Update version.

 

  • Like 6
  • Thanks 1

Share this post


Link to post
Share on other sites

Hello I tried your plugin and unfortunately it gave me the following error messages when importing ....

Traceback (most recent call last):
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 124, in execute
    return self.import_pyrogenesis_actor(context)
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 263, in import_pyrogenesis_actor
    self.parse_actor(root)
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 448, in parse_actor
    fixer.execute()
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 674, in execute
    warnings.warn("subchild: "+ subchild.tag)
NameError: name 'warnings' is not defined

location: <unknown location>:-1

Share this post


Link to post
Share on other sites
49 minutes ago, Alcibiades said:

Hello I tried your plugin and unfortunately it gave me the following error messages when importing ....

Traceback (most recent call last):
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 124, in execute
    return self.import_pyrogenesis_actor(context)
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 263, in import_pyrogenesis_actor
    self.parse_actor(root)
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 448, in parse_actor
    fixer.execute()
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 674, in execute
    warnings.warn("subchild: "+ subchild.tag)
NameError: name 'warnings' is not defined

location: <unknown location>:-1

Sorry for the inconvenience can you try with the fix I just pushed?

Share this post


Link to post
Share on other sites

Thank you so much.

The majority of the units I have tested are now importing into Blender 2.81. This Addon is very helpful. There are some units still giving errors such as below.

\0ad-master\binaries\data\mods\public\art\actors\structures\athenians\trireme.xml

Traceback (most recent call last):
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 124, in execute
    return self.import_pyrogenesis_actor(context)
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 263, in import_pyrogenesis_actor
    self.parse_actor(root)
  File "C:\PortableApps\BlenderPortable\Data\user_scripts\addons\io_scene_pyrogenesis\__init__.py", line 430, in parse_actor
    variant['props'].append(prop)
TypeError: element indices must be integers

location: <unknown location>:-1

 

Share this post


Link to post
Share on other sites

Interesting, thanks. In general I would avoid animated objects. The support isn't complete and action are not imported. For those it's better to use the blendfiles when available. Let me know if you need a specific one.

Might I ask what your use of the tool is?

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, Stan` said:

Interesting, thanks. In general I would avoid animated objects. The support isn't complete and action are not imported. For those it's better to use the blendfiles when available. Let me know if you need a specific one.

Might I ask what your use of the tool is?

I began learning Blender in my spare time 6 months ago and I am fascinated by Ancient Civilizations. Exploring the models helps me understand how they are made and if I can I would like to contribute as my skills improve.

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, Alcibiades said:

I began learning Blender in my spare time 6 months ago and I am fascinated by Ancient Civilizations. Exploring the models helps me understand how they are made and if I can I would like to contribute as my skills improve.

@feneur can you lift his post limit.

Nice to hear! Let me know if there is anything I can do to help you get started. Like if you need help creating a mod, getting a model in the game or looking for a specific topic related to art. You can also anything you might need for this project really.

Share this post


Link to post
Share on other sites

Currently on import "Specular" images are set to SRGB. I read somewhere that "Specular" images should be set to the Color Space "Non-Color". I tried this one a few models and it increased the effect. I hope this helps.

image.png.d1e69fb330414f79f0b82478f980b09b.png

Share this post


Link to post
Share on other sites

This works ...
 

            if texture.split('|')[0] == 'specTex':
				#My Change Start
                texImage.image.colorspace_settings.name='Non-Color'
				#My Change End
                mat.node_tree.links.new(bsdf.inputs['Specular'], texImage.outputs['Color'])
                continue

 

Share this post


Link to post
Share on other sites
8 minutes ago, Alcibiades said:

From what I read they are usually black & white for game engines for performance reasons but this is all new to me.

 

Usually they are (Actually most of the time), but our engine supports using the color channel and the alpha channel to do stuff.

Share this post


Link to post
Share on other sites
54 minutes ago, Bestinbest said:

Please how can we export the meshes? Is there an other topic?

Hello,

As implied by the name I only wrote the importer. To export you need to use the standard workflow with XML and collada. Do you need help?

Share this post


Link to post
Share on other sites

Yes thank you I just discovered the game and I find it amazing. I downloaded the add-on but where are the dae files? And how to import them? I thought the add-on was for special files I found but it only suggest xml. My problem is that I don't know how to find dae file : all that I found is dae.cached.pmd (D:\jeux\0 A.D. alpha\binaries\data\mods\public\public.zip\art\meshes\structural), and I don't know how to import them. After yhat, I suppose that I only need to replace them to change the game objects.

Edited by Bestinbest
orthographe

Share this post


Link to post
Share on other sites

In your local install all of the games assets are found in the public.zip though the textures/images are in compressed dds format which you may find a bit tricky to open with out a dds plugin for your image editing app the reason that it's under mods is that even the main game is in fact a mod for the base engine which you can also see on the mod selection screen so do not disable it on that screen by mistake ;) if you have problems getting to a file on your hard drive you can browse the svn repo on trac which you can get to by the Development link on the forums header that's also our wiki with lots on useful links there.

Enjoy the Choice :)

Share this post


Link to post
Share on other sites

To access the assets in a usable format for blender you need the development version.

The dae are also cached in the release version. 

If you need me to explain it in French let me know :)

  • Like 1

Share this post


Link to post
Share on other sites

Speaking english is not to hard for me but maybe for who reads me:rolleyes:. Is it possible to get the development version?

and this is my public.zip, I don't find any texture or images... 1554840804_Capturedcran(420).thumb.png.7d24d5404fc043686433329ad16b4e60.png

Edited by Bestinbest
add picture

Share this post


Link to post
Share on other sites
2 minutes ago, Bestinbest said:

Speaking english is not to hard for me but maybe for who reads me:rolleyes:. Is it possible to get the development version?

Sure it is possible. 

If you are more familiar with git you can clone the repository https://github.com/0ad/0ad

(It is slightly less up to date (lagging one day behind) and you'll need to compile the game if you want to play)

Else you need to clone the SVN repository

https://svn.wildfiregames.com/public/ps/trunk/

If you need to build you'll find more detailed information here.

https://trac.wildfiregames.com/wiki/BuildInstructions

Share this post


Link to post
Share on other sites
Just now, Bestinbest said:

Ok thank you I cloned with git on linux... Sorry to not respond earlier, my number of post per day is limited to 3.

Oh my bad, I usually ping someone to lift the post limit. How can I help?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...