MAKE OUR TOOLS WITH PYGLET

For collaboration on developing the mod capabilities of VS; request new features, report bugs, or suggest improvements

Moderator: Mod Contributor

Post Reply
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

MAKE OUR TOOLS WITH PYGLET

Post by ezee »

:idea: No need to repeat that we need tools :

_ Conversion to .dds format
_ Viewer for bxfm mesh
_ Animation2D Editor
_ Etc ...

I've found a pretty babe , mrs pyglet , that is :
pyglet provides an object-oriented programming interface for developing games and other visually-rich applications for Windows, Mac OS X and Linux. Some of the features of pyglet are:

No external dependencies or installation requirements. For most application and game requirements, pyglet needs nothing else besides Python, simplifying distribution and installation.
Take advantage of multiple windows and multi-monitor desktops. pyglet allows you to use as many windows as you need, and is fully aware of multi-monitor setups for use with fullscreen games.
Load images, sound, music and video in almost any format. pyglet can optionally use AVbin to play back audio formats such as MP3, OGG/Vorbis and WMA, and video formats such as DivX, MPEG-2, H.264, WMV and Xvid.
pyglet is provided under the BSD open-source license, allowing you to use it for both commercial and other open-source projects with very little restriction.
I have installed it on my windows xp , it rocks !
Already tested a minimal converter example , and tested the result in VS : Status ok :
# ----------------------------------------------------------------------------

'''Convert an image to another file format supported by pyglet.

Usage::
python image_convert.py <src-file> <dest-file>

'''

import sys

import pyglet

def convert(src, dest):
if '.dds' in src.lower():
# Compressed textures need to be uploaded to the video card before
# they can be saved.
texture = pyglet.image.load(src).get_texture()
texture.save(dest)
else:
# Otherwise just save the loaded image in the new format.
image = pyglet.image.load(src)
image.save(dest)

if __name__ == '__main__':
if len(sys.argv) != 3:
print __doc__
sys.exit(1)

src = sys.argv[1]
dest = sys.argv[2]
convert(src, dest)
I think you have enough imagination to preview all that could be done .
As it is said that many are python programmers here , i hope you will
soon reactivate ( WAKE UP ) yourself and make brand new tools .
Every window in pyglet has its own OpenGL context. Each context has its own OpenGL state, including
the matrix stacks and current flags. However, contexts can optionally share their objects with one or more
other contexts. Shareable objects include:
• Textures
• Display lists
• Shader programs
• Vertex and pixel buffer objects
• Framebuffer objects
There are two reasons for sharing objects. The first is to allow objects to be stored on the video card only
once, even if used by more than one window. For example, you could have one window showing the
actual game, with other "debug" windows showing the various objects as they are manipulated. Or, a set
of widget textures required for a GUI could be shared between all the windows in an application.
:wink:

And please don't ask me to code the things for you , lazy guys .
:arrow: DOWNLOAD : https://code.google.com/p/pyglet/
:lol:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
Deus Siddis
Elite
Elite
Posts: 1363
Joined: Sat Aug 04, 2007 3:42 pm

Re: MAKE OUR TOOLS WITH PYGLET

Post by Deus Siddis »

Pyglet is fairly well known in the python community already and in my humble opinion, tools are what's least needed at the moment. You can already get quite efficient content creation done with high quality tools outside of this project, like blender and gimp, combined with hacking exposed data in CSV, XML and PY files. Tools also have to be maintained (and they realistically won't be most of the time) and this gets worse for bigger and less vital tools like unit converter than for something small and critical like mesher.

For Python coders, what we should be doing is refactoring and adding features to the dynamic universe. And where we could really use outside assistance is with development of better AI, because so much of what we might do depends on that, yet (for performance reasons presumably) it cannot be improved from python. Some API documentation of the interface between vega strike's core C++ engine and its the python modules could also be a real plus to python scripting.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

Hi .
For Python coders, what we should be doing is refactoring and adding features to the dynamic universe. And where we could really use outside assistance is with development of better AI, because so much of what we might do depends on that, yet (for performance reasons presumably) it cannot be improved from python. Some API documentation of the interface between vega strike's core C++ engine and its the python modules could also be a real plus to python scripting.
I agree with that vision of things .

For the .dds conversion , the Gimp dds plugin is not working properly with Vegastrike .
So to have a python lib that handle these important conversions in all platforms ( i'm under win32 ) is a miracle . :lol:

I think i will soon make a tool for the 2D animations with Pyglet .
Something like scan a source directory , automatic conversion of files , production of
.ani animation file , display of the animation .

Thank you for your comment .
:wink:

Edit :
And you are right , an API DOC for VS python is a must have .
I've done my c++ doc , and without it , my learning curve would have been 3*longer ( or more ) . Hey , i've done it also for python : http://spacetechs.free.fr/VEGASTRIKEDEV ... files.html

but when you say :
Some API documentation of the interface between vega strike's core C++ engine and its the python modules
you mean something else ?
In my thread about a ingame python console , i've started to explore the core of python/c , perhaps you will be interested : http://forums.vega-strike.org/viewtopic ... 83#p136283

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
Deus Siddis
Elite
Elite
Posts: 1363
Joined: Sat Aug 04, 2007 3:42 pm

Re: MAKE OUR TOOLS WITH PYGLET

Post by Deus Siddis »

ezee wrote: For the .dds conversion , the Gimp dds plugin is not working properly with Vegastrike.
That is strange, the plugin appears to be maintained still...
but when you say :
Some API documentation of the interface between vega strike's core C++ engine and its the python modules
you mean something else ?
Yeah, more specifically what I meant is the VS and Director "modules" that you see imported in various python files. These two aren't real python modules that you can find anywhere, but the parts of the engine that are exposed to python.

The trouble is these two are not documented so it is not very clear what are all the functions you can call (and arguments you can pass) through them.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

Ah okay !
I can help i think .
I was looking at that precisely 3 hours ago .
That's very interesting , and one of these days i will try to export one little function ,
just to experiment it .

There is a part in the source code that is made with macros , and a little difficult to read.
But globally that seem to be not too difficult .

there is a useful comment in python_class.h:
/*
These following #defines will create a module for python
call them with:


PYTHON_BEGIN_MODULE(VS)
PYTHON_BEGIN_INHERIT_CLASS(VS,FireAt,"PythonFire") //begins an inherited class with a virtual Execute function...
//You can call any other virtual functions by defining:
// void callFunction(std::string name){}
//in your base class... To use it, use:
// MyClass->callFunction("Execute").
//That will do the same thing as:
// "MyClass->Execute()"
//
PYTHON_END_CLASS(VS,FireAt)

//do it again ... start
PYTHON_BEGIN_INHERIT_CLASS(VS,BaseClass,"PythonVirtualClassName")
PYTHON_END_CLASS(VS,BaseClass)
//end

//start
PYTHON_BASE_BEGIN_CLASS(VS,MyClass,"PythonClassName")
Class.def(boost::python::constructor<int,float,string>); //this will define a constructor that takes an int, float and a string.
Class.def(&MyClass::MyFunc,"FunctionName");
PYTHON_END_CLASS(VS,MyClass)
//end etc ...
PYTHON_BEGIN_CLASS(VS,MyOtherClass,"DefaultConstructorPythonClassName") //this will automaticly define a default constructor
Class.def(&MyOtherClass::MyOtherFunc,"FunctionName");
PYTHON_END_CLASS(VS,MyOtherClass)
VS.def(&MyGlobalFunction,"GlobalFunc") //the global functions are easiest; you can call these in python with VS.globalfunc
PYTHON_END_MODULE(VS)
...

// HERE IS THE simulated STARTING POINT OF VEGASTRIKE

int main (int argc,char *argv[]) {
...
PYTHON_INIT_MODULE(VS);
...
return 0;
}

*/
There is also 4 main fonctions in init.h
void InitBriefing();
void InitDirector();
void InitVS();
void InitBase();
for example with InitBriefing()
void InitBriefing()
{
Python::reseterrors();
PYTHON_INIT_MODULE( Briefing );<-----we step in that
Python::reseterrors();
}
---> that in reality is :
#define PYTHON_INIT_MODULE(name) init##name()
For director , the wrap is here :
PYTHON_BEGIN_MODULE( Director )
PYTHON_BEGIN_INHERIT_CLASS( Director, pythonMission, PythonMissionBaseClass, "Mission" )
PYTHON_DEFINE_METHOD_DEFAULT( Class, &PythonMissionBaseClass::Pickle, "Pickle", pythonMission::default_Pickle );
PYTHON_DEFINE_METHOD_DEFAULT( Class, &PythonMissionBaseClass::UnPickle, "UnPickle", pythonMission::default_UnPickle );
PYTHON_DEFINE_METHOD_DEFAULT( Class, &PythonMissionBaseClass::Execute, "Execute", pythonMission::default_Execute );
PYTHON_END_CLASS( Director, pythonMission )
PYTHON_DEFINE_GLOBAL( Director, &putSaveDataPy, "putSaveData" );
PYTHON_DEFINE_GLOBAL( Director, &pushSaveDataPy, "pushSaveData" );
PYTHON_DEFINE_GLOBAL( Director, &eraseSaveDataPy, "eraseSaveData" );
PYTHON_DEFINE_GLOBAL( Director, &clearSaveDataPy, "clearSaveData" );
PYTHON_DEFINE_GLOBAL( Director, &getSaveDataPy, "getSaveData" );
PYTHON_DEFINE_GLOBAL( Director, &getSaveDataLengthPy, "getSaveDataLength" );
PYTHON_DEFINE_GLOBAL( Director, &putSaveStringPy, "putSaveString" );
PYTHON_DEFINE_GLOBAL( Director, &pushSaveStringPy, "pushSaveString" );
PYTHON_DEFINE_GLOBAL( Director, &getSaveStringPy, "getSaveString" );
PYTHON_DEFINE_GLOBAL( Director, &getSaveStringLengthPy, "getSaveStringLength" );
PYTHON_DEFINE_GLOBAL( Director, &eraseSaveStringPy, "eraseSaveString" );
PYTHON_DEFINE_GLOBAL( Director, &clearSaveStringPy, "clearSaveString" );
PYTHON_DEFINE_GLOBAL( Director, &loadStringListPy, "loadStringList" );
PYTHON_DEFINE_GLOBAL( Director, &saveStringListPy, "saveStringList" );
PYTHON_END_MODULE( Director )
The second parameter (after Director ) is the c++ function , followed by its python name
Yeah i think that it's important to understand that python/c cooperation .
So to know what is a function n you can use the c++ doxygen and use the search :
I typed ' saveStringListPy :
http://spacetechs.free.fr/VEGASTRIKEDEV ... tml#l00231

Followed by the declaration , the initialisation of the module:
void InitDirector()
{
Python::reseterrors();
PYTHON_INIT_MODULE( Director );
Python::reseterrors();
}


So by doing the same , i could i guess add more func to Director or another module .
:wink:

I can try if it is useful to generate a doxygen only for your requested modules .
If i comment the code , that could be an help yeah .
In my todo list .
:)

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: MAKE OUR TOOLS WITH PYGLET

Post by klauss »

Deus Siddis wrote:Pyglet is fairly well known in the python community already and in my humble opinion, tools are what's least needed at the moment. You can already get quite efficient content creation done with high quality tools outside of this project, like blender and gimp, combined with hacking exposed data in CSV, XML and PY files. Tools also have to be maintained (and they realistically won't be most of the time) and this gets worse for bigger and less vital tools like unit converter than for something small and critical like mesher.
I beg to disagree.

We're requiring content creators to learn and use a myriad of tools in concert. It's difficult for non-technical people.

We need something simple, something that is able to preview a unit before uploading it, or preview a system's layout before saving it.

Pyglet is great for that, because it can consume the same data VS consumes (shaders and textures) and is quite standard. We already have a python tool, for instance, to process shader includes and generate ready-to-use shaders (I used them to profile in external tools). Pyglet-based tools would use it to generate the final shaders for previewing the materials.

I think this is a very good fine (pyglet). Up till now, I thought it was heavy on dependencies, but it seems my worries were unfounded.
Deus Siddis wrote:For Python coders, what we should be doing is refactoring and adding features to the dynamic universe. And where we could really use outside assistance is with development of better AI, because so much of what we might do depends on that, yet (for performance reasons presumably) it cannot be improved from python. Some API documentation of the interface between vega strike's core C++ engine and its the python modules could also be a real plus to python scripting.
An AI editor would also be very nice, but all this should be integrated into a "mission editor", where you can point and click in a system map to set waypoints and stuff like that for scriptable events.

I believe Pyglet is a great tool for enabling that kind of WYSIWYG.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Re: MAKE OUR TOOLS WITH PYGLET

Post by jackS »

I'm going to second Klauss here - we really do need tools. In particular, we need easy to use tools that content-developers who are not only not engine-developers but not technically savvy in general outside of their content development environments can readily use. This was one of the key failings of early VS development. We either didn't build tools, built crappy tools, or built arcane tools.

I understand Deus' concern about tool rot. A tool that isn't maintained can be a fair bit of wasted effort. Similarly, tools with terrible UIs (see: texturizer) are going to become unmaintained tools because no one will use them. Moreover, we shouldn't ever attempt to make a VS-specific replacement for, say, blender. That said, if we pick a standard or small set of standard formats that we can expect tools to put out (we've pretty much gone with obj+mtl for a while now) we can and should build glue-logic tools that make moving between, say, blender and VS easier without worrying too much about moving-target syndrome.

If you really want to avoid tool rot, one way to approach the problem is to make the tools share as much code as possible with the engine. This can go very well (I'm fairly certain that the editor tools for Source engine content use the Source engine) or terribly (see, again, the VS Texturizer tool. On the other hand, that means you need to elevate these tools to the same level as engine development, and it's not clear how the manpower requirements for that would work out. The other approach would be to define some interchange formats that the VS engine/content set will take responsibility for always being able to read, and then have the tool output to that fixed target, rather than whatever internal representation (a moving target) is actually being used by the data set at the time. That means more total tools, but only one (an interchange converter tool) that has to be kept up to engine-level development. I'm honestly not certain which makes the most sense, given the current development model/pace/etc.

As for why bother thinking about tools at this point, it's good to remember that tools are an implicit issue behind a lot of things -- why, for instance, was units.csv a csv instead of xml (which would have been sane, especially since everything else, including the meshes, was originally in xml)? Answer: Because we could use off-the-shelf editors to stare at the unit data for multiple units at a time. (This was, admittedly, before a lot of XML-oriented off-the-shelf tools existed, unless we'd wanted to go full-on DB). Then, inertia set in :-/ You can also think about the VS-content-ecology in general, and think about all of the tasks that could be made easier if they weren't done by hand. We didn't buy into the cult of automation hard enough or early enough, and what we have now is... well, a very strange infrastructure for expanding VS.
Deus Siddis
Elite
Elite
Posts: 1363
Joined: Sat Aug 04, 2007 3:42 pm

Re: MAKE OUR TOOLS WITH PYGLET

Post by Deus Siddis »

Using VS' own renderer for 3D content editors could be best for accuracy. I find that previewing shader maps in blender's real time rendering looks quite different from how they appear in VS.

I think something to keep in mind though, is that as far as development power goes, VS is a very small project. For a great deal of time it has had many of the same painful bugs and missing features, such as the minor collision == act of war! bug that makes docking so strangely hazardous and the escorts do not escort bug which makes escorts (for both the player and NPCs) so useless. IMHO things like this are evidence that this project suffers more from a lack of programmers than content creators. Which is part of the trouble with in house tools -- they essentially convert precious coding power into much less precious content creation power. (The other part being how many bugs and missing or broken features they have, to the point you just give up and dig into a text file or command line tool.)

One compromise that has been discussed in the past, is to move over to using the content pipeline of a bigger open source project like OGRE. The conversion would be an ordeal but it would theoretically remove the maintenance burden from VS' shoulders.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: MAKE OUR TOOLS WITH PYGLET

Post by klauss »

Deus Siddis wrote:Using VS' own renderer for 3D content editors could be best for accuracy. I find that previewing shader maps in blender's real time rendering looks quite different from how they appear in VS.
That should be no problem to reproduce in pyglet by reusing shaders - techniques more specifically - there's no need to reuse the whole engine.

Techniques have a quite concise and exact specification, so it should be stable enough.

Moving to Ogre trades maintainance burdens, rather than removing them. The trade is bugs vs API changes. I myself started the ogre branch, and during the time I was active in it, I had to adapt it twice to API changes. Now, the difference is quite huge (judging from what I get when I try to build with Ogre support).

Ogre is a great project, but it's quite unstable in its API, and that will be a chore to maintain, as is the case with ffmpeg.

However, I do believe it will be beneficial in the long run - if only because it will let us support DirectX where it is the native GPU API.

Just as content tools will be - because content tools will mean better content, which will mean a better game. And that last point, means more contributions. It's a snowball effect we've got to start rolling.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Re: MAKE OUR TOOLS WITH PYGLET

Post by jackS »

So I think perhaps we should also be explicitly broad when we talk about "content tools" because it's not just content conversion/import that VS needs, it's content management -- and mission editors, level designers, unit stat editors, etc. are necessarily in-house sorts of tool. These sorts of tools not only help the content creators, but they also help developers address bugs by being able to create test cases, themselves a very specific form of content, or to address data-side errors in a timely fashion (or to viably crowdsource such fixes).

Now, does VS direly need a tool to import 1000s of new models? No. But it will need tools that allow us to do more than just talk about modular unit construction from both an engine and art side (I consider that effort entangled -- it is unlikely to make progress without both asset and engine work). If nothing else, there is a UI undertaking to be done to figure out how we want to allow artists to build from and add to a library of component parts. I think similar situations apply for many longstanding feature requests.

Will VS eventually need tools for bulk artwork? Hopefully :)

VS is a very small project. It has never been a very big project, even at its most active. I'm tempted to think that tasks oriented toward lowering the bar to useful contributions of both code and content-side work (by which I mean more than models) is probably a worthwhile undertaking for the dev time that VS does have. I could be wrong -- and it almost certainly isn't going to be me spending the time to do the necessary ecology-development work, so I have no money to put where my mouth is on this. That said, there certainly do seem to be some meta-development tasks that wouldn't be that hard to do (crowd-source some doxygen comments for the code?), whereas others (progressively moving more code out of hard-coded and into data-driven structures) will take more work, but can be done iteratively. Small projects are fine as long as they can make progress because there's some achievable milestone that can be reached in a finite amount of time before the goalposts have left them far behind with their own inexorable drift forward. Anything that requires a major step-function change (like the OGRE port) is going to be very hard for a small project to do, unless someone with a whole lot of motivation (and in-depth knowledge of the project) happens to have a long, but strangely lucrative, period of being otherwise unoccupied with any other worldly concerns to lead that march through the desert.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: MAKE OUR TOOLS WITH PYGLET

Post by klauss »

jackS wrote: VS is a very small project. It has never been a very big project, even at its most active. I'm tempted to think that tasks oriented toward lowering the bar to useful contributions of both code and content-side work (by which I mean more than models) is probably a worthwhile undertaking for the dev time that VS does have. I could be wrong -- and it almost certainly isn't going to be me spending the time to do the necessary ecology-development work, so I have no money to put where my mouth is on this. That said, there certainly do seem to be some meta-development tasks that wouldn't be that hard to do (crowd-source some doxygen comments for the code?), whereas others (progressively moving more code out of hard-coded and into data-driven structures) will take more work, but can be done iteratively. Small projects are fine as long as they can make progress because there's some achievable milestone that can be reached in a finite amount of time before the goalposts have left them far behind with their own inexorable drift forward. Anything that requires a major step-function change (like the OGRE port) is going to be very hard for a small project to do, unless someone with a whole lot of motivation (and in-depth knowledge of the project) happens to have a long, but strangely lucrative, period of being otherwise unoccupied with any other worldly concerns to lead that march through the desert.
That pretty much summarized my POV, quite succintly and quite exactly.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Deus Siddis
Elite
Elite
Posts: 1363
Joined: Sat Aug 04, 2007 3:42 pm

Re: MAKE OUR TOOLS WITH PYGLET

Post by Deus Siddis »

jackS wrote:These sorts of tools not only help the content creators, but they also help developers address bugs by being able to create test cases, themselves a very specific form of content, or to address data-side errors in a timely fashion (or to viably crowdsource such fixes).

...it will need tools that allow us to do more than just talk about modular unit construction from both an engine and art side (I consider that effort entangled -- it is unlikely to make progress without both asset and engine work). If nothing else, there is a UI undertaking to be done to figure out how we want to allow artists to build from and add to a library of component parts.
Good points.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

*********************SPECIAL GOOD NEWS :*********************

We have a new french python coder onboard the Artistic branch : Mr GreenDreamer .
( yeah , this guy that translate the wiki in french for us 8) )
He just accepted the task to make for us the massive conversion tool with pyglet .
He started to work on it , and we could have the tool before the end of the week !
gooooooood , thank you GreenDreamer .
:wink:
Last edited by ezee on Wed Apr 02, 2014 12:58 am, edited 1 time in total.

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: MAKE OUR TOOLS WITH PYGLET

Post by klauss »

Nice - but what does "massive conversion" mean? Batch processing of files?
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

Nice - but what does "massive conversion" mean? Batch processing of files?
:lol: , yeah i said massive because of the weight of this word .
Let me verify the definition of batch ( i'm french ... )
Batch processing is the execution of a series of programs ("jobs") on a computer without manual intervention.
That's it .
I asked him to change the original pyglet conversion example to be able to convert+rename
( two jobs ) the content of a media folder .

Perhaps he will later code the animation preview too , but right now this converter will be
very useful for the animation workflow . ( Darkvixen works with 100 or more frames by sequence ) .

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

:!: Some news about the converter .

GreenDreamer reported to me that Pyglet conversion was not working under Linux , with
some guys reporting the same in some forums .
I don't know yet if it is really the case ( we are working on it ) , but in my case , the script
is working just fine under windows xp and python 2.7

I have added some fonctions that write the converted and renamed ( .image ) files in a
folder given as parameter 2 for the script .

Usage : You copy/paste the script into your source folder containing the rendered frames ,
launch it with " . mydestFolder " as command line args , and it's all .
Very useful , as 120 frames were converted+renamed+mooved in 30 secondes approximativly .

The next step is to make the script write a .anim file too , that will contain the size,scale,alpha information for the anim and the reference to the frames used .
Also planned a preview in a window with Pyglet .
This way , a complete animation folder for comms display could be made in only few minutes .

Stay tuned , i will soon post a alpha release to be tested by you , who are interested
in creation of textures content or animations for vegastrike .
:)

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: MAKE OUR TOOLS WITH PYGLET

Post by klauss »

ezee wrote::!: Some news about the converter .

GreenDreamer reported to me that Pyglet conversion was not working under Linux , with
some guys reporting the same in some forums .
I don't know yet if it is really the case ( we are working on it ) , but in my case , the script
is working just fine under windows xp and python 2.7
We can probably do a workaround with nvcompress. Do we have the source code somewhere?
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

yeah , sure .
But you must have pyglet installed .
'want my last script ?

nah , i will sell him a million dollar .
:wink:
Here is the original :

Code: Select all

#!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#  * Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#  * Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#  * Neither the name of pyglet nor the names of its
#    contributors may be used to endorse or promote products
#    derived from this software without specific prior written
#    permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ----------------------------------------------------------------------------

'''Convert an image to another file format supported by pyglet.

Usage::
    python image_convert.py <src-file> <dest-file>

'''

import sys

import pyglet

def convert(src, dest):
    print("hello")
    if '.dds' in src.lower():
        # Compressed textures need to be uploaded to the video card before
        # they can be saved.
        texture = pyglet.image.load(src).get_texture()
        texture.save(dest)
    else:
        # Otherwise just save the loaded image in the new format.
        image = pyglet.image.load(src)
        image.save(dest)

if __name__ == '__main__':
    if len(sys.argv) != 3:
        print __doc__
        sys.exit(1)

    src = sys.argv[1]
    dest = sys.argv[2]
    convert(src, dest)
if ya have pyglet , its located in :
pyglet-1.1.4\examples\image_convert.py
Thank you for the feedback .
Our actual code is a dev code , we need to clean it before release it .
But if you guys can run the original script in mac or linux , that will be a sign that
pyglet is good for our future .

You python coders , could even dream about a python engine , because pyglet is a very
powerful opengl friendly python wrappper .

If i was a python coder , i'll choose pyglet .
Under windows , it's a beautiful babe .
:shock:
Last edited by ezee on Sat Apr 12, 2014 11:15 am, edited 1 time in total.

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: MAKE OUR TOOLS WITH PYGLET

Post by klauss »

What license is that?
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

Duno , i personally have received the license to kill .
https://www.youtube.com/watch?v=vQKaujX6R-U
8)

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: MAKE OUR TOOLS WITH PYGLET

Post by klauss »

No, seriously. License compatibility is important if we intend to put that, eventually, in SVN.

I'll do the adaptation later at home.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: MAKE OUR TOOLS WITH PYGLET

Post by ezee »

:lol:

Good , thank you !
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
Deus Siddis
Elite
Elite
Posts: 1363
Joined: Sat Aug 04, 2007 3:42 pm

Re: MAKE OUR TOOLS WITH PYGLET

Post by Deus Siddis »

klauss wrote:What license is that?
It looks a great deal like the 3-clause BSD, which is also what pyglet is released under.
Post Reply