GDL
About building parametric objects with GDL.

Where are the default light controls?

Durval
Booster
A long time ago I have scripted some simple lamp objects in which the basic light control are shown in the settings dialog box (attached image). The UI script of this object is blank; the controls show up by default, simply because it is classified as light subtype.

Now I'm trying to write a new lamp, similar to the old one, but these controls do not show up.

I know I could write an UI script, but the default behavior of the old object is fine enough to me and I'd rather not having to go through the UI scripting, as I would have to code all other parameters.

Is there a way to make the basic controls show up without writing an UI script?

--- www.dtabach.com.br ---
AC 24 BR – MacBook Pro 2,9 GHz Intel Core i7 16GB RAM Mac OS 10.14
9 REPLIES 9
Barry Kelly
Moderator
Durval wrote:
A long time ago I have scripted some simple lamp objects in which the basic light control are shown in the settings dialog box (attached image). The UI script of this object is blank; the controls show up by default, simply because it is classified as light subtype.

The UI script in your object may be blank, but is it CALLing a macro in the Master script.
If that macro has a UI script, that would cause the UI to show (I am pretty sure).


Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Durval
Booster
There is no macro being CALLed in the other scripts.
It’s a simple object with a pair of REVOLVEs and a LIGHT command in the 3D script.
But there are some old parameters added by default, such as C, D, E, F and G for setting the light switch, RGB color and light intensity.
If I start a new light object, these parameters have different names such as ac_light_switch etc, and these names cannot be changed.
--- www.dtabach.com.br ---
AC 24 BR – MacBook Pro 2,9 GHz Intel Core i7 16GB RAM Mac OS 10.14
Barry Kelly
Moderator
If you are happy with the look of the old object, open it and 'Save As' a new object and then just modify what needs to change.
This way you should have the interface the way you want and you just need to modify the 2D/3D scripts.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Barry Kelly
Moderator
I found I have some old lights that show the same as yours.
It is not a user interface as such but seems to be some sort of special parameters.

When I open the old object I see this.


The 'Type' is a special symbol and not part of the standard set of types.

At the same time with the 'Light' subtype, it creates these new parameters with the same symbols - but it is not possible to change these 'Type' to anything else.


So it seems these new parameters have replaced the old ones.

With a new lamp object, the new parameters are used in the user interface - called by a macro ("lightMacro_m").

I don't see any way of using the old parameters or the new ones without the user interface.
Other than doing a 'Save As' to the old object - that keeps the old features.


Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Durval
Booster
Thank you for your help, Barry.
Strangely enough, my old lamp object has both sets of light parameters, the old ones AND the new ones...
Maybe I should start anew and simply CALL the lightMacro_m, so that my new object does not rely on deprecated features.
--- www.dtabach.com.br ---
AC 24 BR – MacBook Pro 2,9 GHz Intel Core i7 16GB RAM Mac OS 10.14
Durval
Booster
Well, even by starting a new object and CALLing lightMacro_m I did not succeed on showing the light controls.
  • Created new object (attached) and classified as Light subtype;
  • Added a very simple 3D solid with an sphere;
The light controls do not show up. So I tried to paste de macro Call also in the Parameter Script. Received messages that some variables are not valid. Anyways, no light controls showing up in the light settings dialog box...
--- www.dtabach.com.br ---
AC 24 BR – MacBook Pro 2,9 GHz Intel Core i7 16GB RAM Mac OS 10.14
Barry Kelly
Moderator
When I open a 24 light object I see that the macro seems to get called a few times - parameter script, 3D script and Interface script.
I have a hard time following Graphisoft objects though!
It looks like that macro does more than just the simple settings in your object.

I think I would just 'Save As' your original object and edit that.
It will have the new parameters and I assume you just ignore them.

I have no idea how the old controls show up in the parameter list.
Delete C,D E F & G and that interface part in the parameter list disappears - but you can not re-create it, as you can't create the old parameters with the old types again.
And it doesn't work with the new 'gs_...'parameters.
So 'Save As' an old light seems to be the only way to keep them.

You can't delete the new parameters because they are part of the light sub-type, but you can hide them - although I am not sure if that is necessary.
The object (the interface part in the parameter list) still seems to be using the old parameters.


Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Laszlo Nagy
Community Admin
Community Admin
Does this article help?

https://gdl.graphisoft.com/tips-and-tricks/how-to-create-light-controls-on-ui
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac27
Durval
Booster
Yes, Laszlo, thank you. So, unless you "save as" an old object, now a UI script is mandatory for light objects, not optional anymore, as it is for other object types. Plus you have to include all parameters in the UI script, not only those related to the light. I'll have to overcome my laziness for writing UIs...
--- www.dtabach.com.br ---
AC 24 BR – MacBook Pro 2,9 GHz Intel Core i7 16GB RAM Mac OS 10.14

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!