Latest Posts

Topic: The current state of the blender script file?

trimard
Joined: 2009-03-05, 22:40
Posts: 122
Ranking
At home in WL-forums
Location: Paris
Posted at: 2016-12-05, 11:26

I'm searching through the media repo, lancuhpad, the wiki and this forum and come across some conflicting informations. I was wondering if someone could help me understand.

First the wiki:

3D Modeling in Blender

The 3D models (or "meshes") for Widelands are stored in the Media Trunk as .blend files. The .blend file format is native to the Open Source 3D modeling tool Blender. Unlike some 3D modeling tools, Blender has a wide set of >features that support everything from importing and modeling 3D meshes to generating fully rendered 2D images and animation. All of the .blend models in Widelands have been created and stored from Blender version 2.49.

Development of Blender has certainly not stood still and beta version 2.59 has recently been made available for user testing. As tempting as it is to jump right into using the latest development release, we remain using version 2.49 >for Widelands 3D files for two compelling reasons. First, Version 2.49 is Blender's most current "stable" version and for a developer having reliable tools is a "good thing". Secondly, the python scripts upon which we have come to >strongly rely do not work in version 2.5+. Version 2.49, though still our PREFERRED 3D modeling tool, is swiftly becoming outmoded. We are currently making plans to migrate to the latest Blender version, but that migration depends on having a stable Python 3.x API in Blender >and scripts to effect the bulk file conversion of our 2.49 models as well as scripts to replace those we currently use in animation and other tasks. So, as an interim approach until we can get Python 3.x scripting for the animation/conversion and evolve fully to Blender 2.5+, we WILL begin to accept development with the new releases of Blender with these conditions:

Update: the scripts are also working with Blender 2.76b.

So I guess if the update is up, why bother explaining for 20 lines how we should continue to use the old blender version? Shouldn't that be deleted?

Seeing the blender script are all updated would be coherent with what I saw on lauchpad or on the first or second post about it. But it is discordant with what I saw in the media repo, where one file is the main one "menu.py" simply don't work with current blender (or I don't how to use it, but from what I read it is using outdated modules). All other scripts are up to date though.

I'm ready to help modify the scripts or the wiki for this to be more clear. But first I would like to know what the actual state of the situation is. Actually if anyone who has succeed in making the script work recently could just explain me how he did it, that would already help a lot :D. And I mean that of course, without using blender 2.49!

Thanks in advance!


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2623
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-12-05, 20:05

The problem is that we currently have no graphic artist who knows these things intimately. I managed to adapt a worker model with some help last year, so I added the quick update note as to the Blender version and added a screenshot. I know nothing about Blender, so I didn't change any other information in the wiki - an update would be much appreciated!

I did the export by loading the worker script only, it will find the necessary menu script on its own. I tried rendering some buildings a few weeks ago and got some seriously messed up roof textures, although they all looked fine in Blender. NO clue what is going on there.

Alexia_Death can be caught on IRC on the #widelands channel sometimes, she hasn't used the scripts for a long time, but she can help in a pinch.

The configuration files for animations are now documented in our scripting reference: https://wl.widelands.org/docs/wl/animations/


Busy indexing nil values

Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 122
Ranking
At home in WL-forums
Location: Paris
Posted at: 2016-12-05, 22:08

Actually, my question goes to developpers too. When you do a build, how do you manage to produce the different pictures needed? In the current media repo, the images aren't available yet! So you mean, there hasn't been new images generated since the last presence of a graphic artist? But barbarian building aren't even present in the repo yet!

From what I understand the current procedure for new pictures is someone do the bender > generate images in a special folder > manually moves them in the general widelands repo> and then commit?

I feel that could be greatly simplified by a python script, but there must be some reason that hasn't been done before.


Top Quote
SirVer
Joined: 2009-02-19, 15:18
Posts: 1438
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2016-12-06, 08:06

So you mean, there hasn't been new images generated since the last presence of a graphic artist?

Unfortunately, that is exactly how it has worked in the past. And yes, no new pictures since somebody figured out how to get them out of blender.

But barbarian building aren't even present in the repo yet!

Barbarian buildings are in the repo. Which ones specifically are you missing?

From what I understand the current procedure for new pictures is someone do the bender > generate images in a special folder > manually moves them in the general widelands repo> and then commit?

Yes, that is correct.

I feel that could be greatly simplified by a python script, but there must be some reason that hasn't been done before.

I am not sure what potential for optimizing the workflow you see. Could you elaborate? In general, the idea is that on trunk/ the files do not change as often, since every change in a picture is quite a substantial amount to download for all developers. If you touch all pictures, the commit can easily be a few hundred megabytes which will be forever in the trunk/ history. So we only update images in trunk/ as needed.


Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 122
Ranking
At home in WL-forums
Location: Paris
Posted at: 2016-12-06, 10:05

Barbarian buildings are in the repo. Which ones specifically are you missing?

All of the render. I must a problem with bzr :P. That solves that problem!

edit: They're not in the pngs directory at least. Isn't that were they should be?

edit2: That's actually the case for all tribes. I guess I didn't understand that the media repo didn't stock the pngs. But some are stocked there. Is that an error?

I am not sure what potential for optimizing the workflow you see.

Run a script of blender in which every folder is checked which automatically render the images in the necessary place if they hadn't be rendered. No need to open blender GUI.

Yes I understand why you want to keep the manual part, makes sense now. Although the script could check if the image has already been transfered or not. Meaning that would only change images if there was some changes. Another long process is rendering each model by going to the specific file and sending the render. What if you do many small changes in many files? What if you change the script? face-tongue.png

But yeah I admit it's not the feature of the year face-grin.png

Unfortunately, that is exactly how it has worked in the past. And yes, no new pictures since somebody figured out how to get them out of blender.

Ok then, I will try to figure it out face-smile.png

edit3: Actually what I said at first was false. The script menu_b25.py works fine on current blender version. We should have a discussion on why menu.py was kept in the future. I think it was there for compatibility issue, but if everyone use last blender version, there shouldn't be such problem. Perhaps all models have to be tested with the last blender version? If that's the case, I will definitely make a script for automatic replacement of image in the trunk so that we can bulk test all models.

Edited: 2016-12-06, 12:27
Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2623
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-12-06, 12:29

We don't keep the pngs in the media repo - it already takes forever to branch it as it is. So, the pngs are all in lp:widelands -> data/

A script would be feasible if you checked out both repos and gave the script the source and destination directories on the command line. We are also slowly working on implementing spritemaps though, and when that is done, any such script will need updating as well.

Maybe start off with a script that renders 1 animation for 1 unit only? That script could then later be wrapped by another script that will walk the directories.


Busy indexing nil values

Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 122
Ranking
At home in WL-forums
Location: Paris
Posted at: 2016-12-06, 14:08

Maybe start off with a script that renders 1 animation for 1 unit only? That script could then later be wrapped by another script that will walk the directories.

That's actually what the current script already does! face-smile.png

But I think in order to test, I really need to be able to bulk test images. I'll write the script, I don't think that's too much work, I already did that for another project. That way I will be able to say if the current scripts are up to date and all models are working. I cannot do that right now.


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2623
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-12-06, 18:18

Sounds like you know what you're doing face-smile.png


Busy indexing nil values

Top Quote
trimard
Joined: 2009-03-05, 22:40
Posts: 122
Ranking
At home in WL-forums
Location: Paris
Posted at: 2016-12-07, 15:27

Lol, I only know how to makes impression face-grin.png .

I think I might need to use bash. Is that tolerable for this project? The call to bash would be done with the "subprocess" python package.

I have another solution which consist in create one big blender file in which I import successively all models, render them, then remove the model and pass to the next. It's a bit less clean that the bash solution, but it's tolerable.

A third problem I got is where do I store the information of where the export folder is? Inside the python script (which will result in a very big script) or inside a config file (in that case which are the format you generally use guys?)

I know I do all this for tests, but I guess if I work on that thing, it would be cool if it could be used by other in the future, so I need to be coherent with the rest of the project face-smile.png .


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 2623
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-12-07, 22:15

Calling a subprocess in Python is fine - we do that in some other utils as well. Especially if it's the less hacky solution!

Our directory names are well-named now, so specifying a root dir should be enough. For example, the barbarians' lumberjack's hut is called "barbarians_lumberjacks_hut" and resides in data/tribes/productionsites/barbarians/lumberjacks_hut.

We also canonicalized the animation names, so the files for the "idle" animation are called idle_00.png, idle_01.png etc... there can be no digit or 3 digits though, depending on the length of the animation.


Busy indexing nil values

Top Quote