Export Materials to GLSL Code #28839

Closed
opened 2011-10-07 20:13:42 +02:00 by Vitor Balbio · 20 comments

Project: Blender Extensions
Tracker: Py Scripts Upload
Blender: 2.60
Category: Game Engine
Python: 3.2
Script name: GLSL Exporter
Wiki page: http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Game_Engine/Export_GLSL
Author(s): Vitor Balbio
Status: Open

%%%Export one or more materials to GLSL Code
Select the Export mode in "Material Properties" and click in "Export"

%%%

**Project**: Blender Extensions **Tracker**: Py Scripts Upload **Blender**: 2.60 **Category**: Game Engine **Python**: 3.2 **Script name**: GLSL Exporter **Wiki page**: http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Game_Engine/Export_GLSL **Author(s)**: Vitor Balbio **Status**: Open %%%Export one or more materials to GLSL Code Select the Export mode in "Material Properties" and click in "Export" %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

%%%Updated to version 1.0%%%

%%%Updated to version 1.0%%%
Author

%%%Fixed bl_info%%%

%%%Fixed bl_info%%%
Member

%%%Hi,
Due to changes to the api including the merging of bmesh, several addons are outdated.
Please, if you are the author of an addon check your script with blender revision 44256 or newer.
That is builds made After blender 2.62 official release.
I would ask that updates be made to your addon before the Blender 2.63 release.
6-8 weeks away.
This allows time for the api to become more exposed & bmesh to stablize furthur.
If you need help, drop into irc freenode #blenderpython or #blendercoders & feel welcome to ask questions.
At the time of 2.63 release, scripts that are not repaired or in active developement will have their tracker page marked "Closed"
this will not affect your links to the tracker, similar to closing scripts in 2.49b, the page will be still availible & can be re-opened.

Thanks for your understanding & patience during these Exciting Times.
Brendon.%%%

%%%Hi, Due to changes to the api including the merging of bmesh, several addons are outdated. Please, if you are the author of an addon check your script with blender revision 44256 or newer. That is builds made After blender 2.62 official release. I would ask that updates be made to your addon before the Blender 2.63 release. 6-8 weeks away. This allows time for the api to become more exposed & bmesh to stablize furthur. If you need help, drop into irc freenode #blenderpython or #blendercoders & feel welcome to ask questions. At the time of 2.63 release, scripts that are not repaired or in active developement will have their tracker page marked "Closed" this will not affect your links to the tracker, similar to closing scripts in 2.49b, the page will be still availible & can be re-opened. Thanks for your understanding & patience during these Exciting Times. Brendon.%%%

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Please don't use backslashes as path separators.

Don't:

frag = open(self.filepath + "\mat_" + mat.name + ".frag","w")

Do:

frag = open(os.path.join(self.filepath, "mat_" + mat.name + ".frag"),"w")
Please don't use backslashes as path separators. Don't: ``` frag = open(self.filepath + "\mat_" + mat.name + ".frag","w") ``` Do: ``` frag = open(os.path.join(self.filepath, "mat_" + mat.name + ".frag"),"w") ```

I have taken the liberty to update the code for the following:

  • Using proper path separators, as described above.
  • Removed duplicated and commented-out code.
  • Removed unused properties on the Scene type.
  • Moved the enum property from Scene to WindowManager and used meaningful names.
  • Safer writing of files (using context manager rather than depending on reference counting).
  • Reporting how many materials were exported.

The new version: game_export_GLSL_Shader.py

I have taken the liberty to update the code for the following: - Using proper path separators, as described above. - Removed duplicated and commented-out code. - Removed unused properties on the Scene type. - Moved the enum property from Scene to WindowManager and used meaningful names. - Safer writing of files (using context manager rather than depending on reference counting). - Reporting how many materials were exported. The new version: [game_export_GLSL_Shader.py](https://archive.blender.org/developer/F151259/game_export_GLSL_Shader.py)
Author

That is great Sybren. There was a while that i don't check it to update and fix bugs. Sure this addon can be useful to someone yet. Thanks!

That is great Sybren. There was a while that i don't check it to update and fix bugs. Sure this addon can be useful to someone yet. Thanks!

Added subscriber: @Razvan

Added subscriber: @Razvan
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Brendon Murphy self-assigned this 2015-09-03 09:20:27 +02:00
Member

hi, Vitor Balbio (vitorbalbio), could you please update the wiki page with a link to your latest code.
Archiving this page for now.
Feel free to resubmit this addon if your maintaining it & would like to develop in Blender.

hi, Vitor Balbio (vitorbalbio), could you please update the wiki page with a link to your latest code. Archiving this page for now. Feel free to resubmit this addon if your maintaining it & would like to develop in Blender.

Added subscriber: @JanisGrinvalds

Added subscriber: @JanisGrinvalds

This comment was removed by @JanisGrinvalds

*This comment was removed by @JanisGrinvalds*

Added subscriber: @r_guy

Added subscriber: @r_guy

Will this work with the most recent version of blender (2.78)?
The download link on the wiki page
https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Game_Engine/Export_GLSL
takes me to the maniphest page, which makes me wonder if this add on is no longer supported. Is there a new way to export glsl that has supplanted this one?

edit: the updated script that @dr.sybren links to still seems to work

Will this work with the most recent version of blender (2.78)? The download link on the wiki page https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Game_Engine/Export_GLSL takes me to the maniphest page, which makes me wonder if this add on is no longer supported. Is there a new way to export glsl that has supplanted this one? edit: the updated script that @dr.sybren links to still seems to work

Added subscriber: @shadowforce768

Added subscriber: @shadowforce768

Added subscriber: @IvayloGogov

Added subscriber: @IvayloGogov

Hello Guys,
There is a chance so start using Blender, in serious pipeline for automotive industry, I'm already in a process but I was wondering if this plugin could be updated for 2.8, or there is a plan for another tool in 2.8 similar like this one for exporting Cycles or Eevee shaders to Frag, Vertex once?

Basically, we need to have proper Ver, Frag sharer availability after the export.
We are using real-time engines for Auto-Cockpit and embedded systems. I will appreciate to discuss the topic with someone of the developers.

Hello Guys, There is a chance so start using Blender, in serious pipeline for automotive industry, I'm already in a process but I was wondering if this plugin could be updated for 2.8, or there is a plan for another tool in 2.8 similar like this one for exporting Cycles or Eevee shaders to Frag, Vertex once? Basically, we need to have proper Ver, Frag sharer availability after the export. We are using real-time engines for Auto-Cockpit and embedded systems. I will appreciate to discuss the topic with someone of the developers.
Author

This was developed for BGE that was removed in 2.8 and there's no direct shader access from python in EEVEE so i don't think it's possible to get GLSL shaders at this time.

This was developed for BGE that was removed in 2.8 and there's no direct shader access from python in EEVEE so i don't think it's possible to get GLSL shaders at this time.

Thank you for respond Vitor,

Do you think this could be done in addition by someone for 2.8 or? Are you saying there is no possibilities of access the GLSL generated materials in viewport via python. Interesting, then how the shader nodes are translated to the GLSL view-port environment then?

Thank you for respond Vitor, Do you think this could be done in addition by someone for 2.8 or? Are you saying there is no possibilities of access the GLSL generated materials in viewport via python. Interesting, then how the shader nodes are translated to the GLSL view-port environment then?
Sign in to join this conversation.
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#28839
No description provided.