Jump to content

Materialgraph: activity condition


photo

Recommended Posts

Posted

Hello,

I have a custom mgraph where I want a parameter to only be visible when another one has a specific value. As described here https://developer.unigine.com/en/docs/latest/content/materials/graph/?highlighted=condition,activity,conditionlll,condit,activ,conditionll#activity_condition, I tried this syntax in the editor for the Activity Condition, but this leads to this error at runtime:

image.png.6dfbe36da95e11992f9e8d211a084cba.png

ERROR:    Material::loadUlon(): (Material:"XXX/viewcone_decal.mgraph" Texture:"texture") Condition "(use_texture==1)" has semantic error

What am I missing?

Additional question: at first, I wanted to use a bool for 'use_texture', but then it wouldn't be found by findParameter(), and there is no setParameterBool.

Additional bug report: when the material graph window is displayed in Editor, you can no longer move/rotate/resize node in the main viewport with the gizmo.

viewcone_decal.mgraph

Posted

Sorry, not sure to understand. I want the "texture" parameter to be visible only when the other parameter "use_texture" equals 1. Shouldn't the condition then be "use_texture=1" ? But I also tried it and it doesn't work either.

What about the other 2 questions/bug?

Posted

Hi Stephane,

Please check the video with custom parameter usage: Is that what you want to achieve?

You can use findState() to search for bool type of parameters in code.

Regarding the non-working manipulators inside the Editor viewport, so far we were unable to reproduce this. Are you using multi-monitor setup for Editor (maybe DPI scale as well)? Will it work again if you do the Windows -> Reset Windows Layout?

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

You are right, it works as expected when the condition is a Bool, and I have to use setState instead of setParameter*. Thanks for the clarification!

Regarding the non-working gizmo when mgraph is edited, I couldn't reproduce here, so there must have been something else. I'll see if I can reproduce it, anyway.

Thanks!

×
×
  • Create New...