setGLSLMaterialSetting has no effect #31757

Closed
opened 2012-06-08 18:23:32 +02:00 by Thomas Szepe · 13 comments
Member

Category: Python

%%%SetGLSLMaterialSetting is not working on Blender higher than version 2.59.
I have tried it with lights, shadows, shaders and extra_textures, no parameter is working.

Tested with Blender:
2.59 = working
2.62 = not working
2.63a = not working
2.63.10 = not working

Windows XP 32 Bit
Intel Q9300
Nvida GeForce GTX 460

Attached is a Blender 2.59 example.%%%

**Category**: Python %%%SetGLSLMaterialSetting is not working on Blender higher than version 2.59. I have tried it with lights, shadows, shaders and extra_textures, no parameter is working. Tested with Blender: 2.59 = working 2.62 = not working 2.63a = not working 2.63.10 = not working Windows XP 32 Bit Intel Q9300 Nvida GeForce GTX 460 Attached is a Blender 2.59 example.%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'

%%%confirmed (the file is missing its textures btw).

In 2.59, however, the GLSL setting is left 'alive' even after we quit the bge.
I think this was introduced when I fixed exactly that (with the GlobalSettings patch). I will investigate%%%

%%%confirmed (the file is missing its textures btw). In 2.59, however, the GLSL setting is left 'alive' even after we quit the bge. I think this was introduced when I fixed exactly that (with the GlobalSettings patch). I will investigate%%%

%%%ok I found the problem. In gpu_material.c Blender is checking for the flags in the mat->scene, not in the globalsettings.

Since this is a shared function for both BGE and Blender I'm not sure what is the best way to solve that.
One option is to store in KX_Scene the original flag and re-set Blender flags when we leave BGE.

Brecht, do you have any suggestion on a clean way of solving this?

For the records, the patch below reproduce 2.59 behaviour:

Index: source/gameengine/Ketsji/KX_PythonInit.cpp


- source/gameengine/Ketsji/KX_PythonInit.cpp	(revision 47633)

+++ source/gameengine/Ketsji/KX_PythonInit.cpp (working copy)
@@ -1169,6 +1169,10 @@
}
}

  • /* temporarily store the glsl settings in the scene for the GLSL materials */
  • GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
  • gm->flag = gs->glslflag;
  • Py_RETURN_NONE;
    }

(and also confirmed that the bug was introduced with the fix in rev. 40113)%%%

%%%ok I found the problem. In gpu_material.c Blender is checking for the flags in the mat->scene, not in the globalsettings. Since this is a shared function for both BGE and Blender I'm not sure what is the best way to solve that. One option is to store in KX_Scene the original flag and re-set Blender flags when we leave BGE. Brecht, do you have any suggestion on a clean way of solving this? For the records, the patch below reproduce 2.59 behaviour: Index: source/gameengine/Ketsji/KX_PythonInit.cpp **** - source/gameengine/Ketsji/KX_PythonInit.cpp (revision 47633) +++ source/gameengine/Ketsji/KX_PythonInit.cpp (working copy) @@ -1169,6 +1169,10 @@ } } + /* temporarily store the glsl settings in the scene for the GLSL materials */ + GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); + gm->flag = gs->glslflag; + Py_RETURN_NONE; } (and also confirmed that the bug was introduced with the fix in rev. 40113)%%%
Author
Member

%%%I change the place of your changing from line 1169 to 1154, because otherwise switching on and off is inverted.

Index: KX_PythonInit.cpp


- KX_PythonInit.cpp	(revision 47596)

+++ KX_PythonInit.cpp (working copy)

@@ -1154,6 +1154,10 @@
else
gs->glslflag |= flag;

  • /* temporarily store the glsl settings in the scene for the GLSL materials */
  • GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
  • gm->flag = gs->glslflag;
  • /* display lists and GLSL materials need to be remade */
    if (sceneflag != gs->glslflag) {
    GPU_materials_free();
    %%%
%%%I change the place of your changing from line 1169 to 1154, because otherwise switching on and off is inverted. Index: KX_PythonInit.cpp **** - KX_PythonInit.cpp (revision 47596) +++ KX_PythonInit.cpp (working copy) @@ -1154,6 +1154,10 @@ else gs->glslflag |= flag; + /* temporarily store the glsl settings in the scene for the GLSL materials */ + GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); + gm->flag = gs->glslflag; + /* display lists and GLSL materials need to be remade */ if (sceneflag != gs->glslflag) { GPU_materials_free(); %%%

%%%This indeed seems to be the easiest solution, I'm ok with this fix.%%%

%%%This indeed seems to be the easiest solution, I'm ok with this fix.%%%

%%%Should this be closed?%%%

%%%Should this be closed?%%%

%%%hi Angus,
this can't be closed (no commit was done to address that). I'm assigning to Mitchell in case he wants to implement the solution discussed above.
(the above patch + the changes in KX_Scene to store the initial glsl settings, although that requires testing).%%%

%%%hi Angus, this can't be closed (no commit was done to address that). I'm assigning to Mitchell in case he wants to implement the solution discussed above. (the above patch + the changes in KX_Scene to store the initial glsl settings, although that requires testing).%%%

%%%The problem isn't fixed until now.
Is there someone who can investigate into this problem?
It seems to be solved by Dalai Felinto and HG1, but it's still not fixed in trunk.
It would be very cool if someone can fix it.%%%

%%%The problem isn't fixed until now. Is there someone who can investigate into this problem? It seems to be solved by Dalai Felinto and HG1, but it's still not fixed in trunk. It would be very cool if someone can fix it.%%%

%%%I'm assigning this to Dalai; I never took much of a look at the patch.%%%

%%%I'm assigning this to Dalai; I never took much of a look at the patch.%%%

%%%Hi,
is there any possible fix for the function now?
I would like to see a function which works. :)
Thank you guys for investigating.%%%

%%%Hi, is there any possible fix for the function now? I would like to see a function which works. :) Thank you guys for investigating.%%%

%%%The mentioned fix from HG1 works perfectly.
I'd updated it for the newest revision.

Index: source/gameengine/Ketsji/KX_PythonInit.cpp


- source/gameengine/Ketsji/KX_PythonInit.cpp	(revision 56527)

+++ source/gameengine/Ketsji/KX_PythonInit.cpp (working copy)
@@ -1182,7 +1182,13 @@
gs->glslflag &= ~flag;
else
gs->glslflag |= flag;
+

  • /* temporarily store the glsl settings in the scene for the GLSL materials */
  • GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm);
  • gm->flag = gs->glslflag;
  • /* display lists and GLSL materials need to be remade */
    if (sceneflag != gs->glslflag) {
    GPU_materials_free();%%%
%%%The mentioned fix from HG1 works perfectly. I'd updated it for the newest revision. Index: source/gameengine/Ketsji/KX_PythonInit.cpp **** - source/gameengine/Ketsji/KX_PythonInit.cpp (revision 56527) +++ source/gameengine/Ketsji/KX_PythonInit.cpp (working copy) @@ -1182,7 +1182,13 @@ gs->glslflag &= ~flag; else gs->glslflag |= flag; + + /* temporarily store the glsl settings in the scene for the GLSL materials */ + GameData *gm= &(gp_KetsjiScene->GetBlenderScene()->gm); + gm->flag = gs->glslflag; + /* display lists and GLSL materials need to be remade */ if (sceneflag != gs->glslflag) { GPU_materials_free();%%%

%%%patch committed on rev. 56605
thanks everyone for contributing to that.

Sorry about the long delay, but I've been too busy lately%%%

%%%patch committed on rev. 56605 thanks everyone for contributing to that. Sorry about the long delay, but I've been too busy lately%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 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#31757
No description provided.