Color Picker

User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Color Picker

Post by clintonman »

ColorPickerWIP.jpg
A general color picker based on the Unofficial Updates(UU) Lights color picker. The goal was to make a color picker that didn't have the undo issues of the UU lights based colorpicker. I wasn't able to solve that. This script has it's own undo issues, but it mostly works. On occasion it runs out of undos or it may be too aggressive and over-undo it.

To try it out, some version of the UU should be installed. Download from the link and copy into /Scripts/CustomCommands.
Select some scene item and press the open panel button. The color picker will not run if the color picker is selected.

The controls from top to bottom:
Main area that has the clickable hue-saturation
The color bar below is a preview for the final color.
The slider is for luminosity.
The color box is the system based color picker with red,green,blue controls to the right.

The color picker can run in 2 modes. Undo and no undos. When undo is enabled use the Undo button on the panel instead of the shortcut or the toolbar undo button. When undo is disabled the color changes are immediate and fully interactive. The "Undoable" control is in another panel aspect and must be set before opening the panel. Any changes when the panel is open are ignored.

Only "Lum", luminosity is setup at this time. Sat, Kelvin and Color are disabled.

When you select an item all it's color attributes are added to a dropdown list. In the image above the torus is selected and I chose the Points Color of the Object Render Attributes node and set the color to blue. The dropdown will default to the material color for meshes and to the light color for lights.
Press the Update button after making a selection.

The last 3 buttons are temporary testing buttons that can be used to open and close the panel. And a button to kill it if the scripts get out of hand.
ColorPickerWIP_undo.jpg
ColorPickerWIP_undo.jpg (25.39 KiB) Viewed 2668 times
Attachments
Color Picker2fff.RsObj
(539.09 KiB) Downloaded 156 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Really impressive Clinton!
I am using a Blank DX Material from the Materials - DX9 library.
I am seeing Unknown attributes as shown in the screenshot.
Unknown Attributes.png
.
The one highlighted and the two Color_InputColor.

Not sure if this is a bug but the Luminosity bitmap is being replaced with a solid black color when adding Primitives.
Seems to me, that bitmap should never change and works like the Windows Color Picker

Been noticing the Panel X being left open on several occasions.
Edit: Both panels are missing a WinID. I added {F021DF25-F4AA-41DD-86CC-8FF15C2E278A} to both panels

Is there any way to limit the Object Render Attributes from showing in the Drop-down list?
Like adding an Advanced option (Boolean)?

Edit2:
Update button error if nothing is selected
ERR Source object: /Scripts/CustomCommands/Color Picker/UpdateConnChoice Error: Microsoft JScript runtime error Description: 'undefined' is null or not an object Error code: 0x800a138f - (null) Line: 16, Char: 1 Script text: var colorArr = colorStr.split("\t");
UpdateConnChoice script
Add:

Code: Select all

	var selcount = Node.SelectedCount();
	if(selcount == 0) return;
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 26 Jan 2023, 19:17 Really impressive Clinton!
I am using a Blank DX Material from the Materials - DX9 library.
I am seeing Unknown attributes as shown in the screenshot.
Unknown Attributes.png
.
The one highlighted and the two Color_InputColor.

Not sure if this is a bug but the Luminosity bitmap is being replaced with a solid black color when adding Primitives.
Seems to me, that bitmap should never change and works like the Windows Color Picker

Been noticing the Panel X being left open on several occasions.
Edit: Both panels are missing a WinID. I added {F021DF25-F4AA-41DD-86CC-8FF15C2E278A} to both panels

Is there any way to limit the Object Render Attributes from showing in the Drop-down list?
Like adding an Advanced option (Boolean)?

Edit2:
Update button error if nothing is selected
ERR Source object: /Scripts/CustomCommands/Color Picker/UpdateConnChoice Error: Microsoft JScript runtime error Description: 'undefined' is null or not an object Error code: 0x800a138f - (null) Line: 16, Char: 1 Script text: var colorArr = colorStr.split("\t");
UpdateConnChoice script
Add:

Code: Select all

	var selcount = Node.SelectedCount();
	if(selcount == 0) return;
The script is finding all the color connectors. So it sees the color connectors inside the SolidColorShader and inside the DefaultModelShader. It should skip color connectors if they are exported to a higher level.

Black when add primitive is correct for the way it's working, which is different from my earlier tests that used compiled d3d materials. So it needs to be fixed to use the actual material color by default for node based materials. Also will need to check vray and yafaray materials to see how they come up.

There's some weirdness to the x close panel. I made adjustments for it but may have missed something by using compiled materials. The weirdness I refer to is that before I "fixed it", the x panel would hide behind the color picker if any floating window was open, including any error popups(which I saw a lot of). Just selecting any window would bring it back.
I have an idea to setup a timer so that if the panel is closed but still active, the timer will properly end it and disconnect all the watchdogs etc.
Another case of weirdness that was never fully solved is that opening the system color picker by double click on the color square might cause the luminosity connector to think it has changed and that throws the undo counts off. This is before even using it, opening is all it takes. It's random so pretty much impossible to fix.

Option to turn off ORA in the list sounds good.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Since adding the WinID to both panels, I have not seen any issues so far and the X panel now adds SnappedTo, I guess from your OpenPanel script

I found a setting that works pretty good
TheNode

Code: Select all

if(Node.IsRenderable(firstSel)) {
	var selstr = colorSource.GetStringAt(4);
i = 1;
colorSource.SetSelectedString(selstr);
}
Also added:
if(Node.IsCamera(firstSel)) {
return
}
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 26 Jan 2023, 21:20 Since adding the WinID to both panels, I have not seen any issues so far and the X panel now adds SnappedTo, I guess from your OpenPanel script

I found a setting that works pretty good
TheNode

Code: Select all

if(Node.IsRenderable(firstSel)) {
	var selstr = colorSource.GetStringAt(4);
i = 1;
colorSource.SetSelectedString(selstr);
}
Also added:
if(Node.IsCamera(firstSel)) {
return
}
Good news about the x panel. :bananathumb:

"GetStringAt(4)", that 4 might change for different object types, like is SDS applied, will flattening or point edit change the order... testing will be needed

return if camera will make it not work for the ORA colors - small detail esp since you cant see color changes while the camera is selected
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Ugh, automatically applying a color is not a very good idea.

Can you make it work like the Windows Color Picker?
Select a Color and press a button that applies the color.
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 26 Jan 2023, 22:25 Ugh, automatically applying a color is not a very good idea.

Can you make it work like the Windows Color Picker?
Select a Color and press a button that applies the color.
Automatically applying color is an excellent idea. Would be more helpful if you said why its not a very good idea.

Do nothing until press a button option seems doable.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Sorry: oops:
I struggled with that statement.
I did not notice it was automatically applying the color until I made that change to theNode script, it was changing an ORA color that was not obvious because the ORA's 'Enable Obj Mode' was not enabled.
Now, after using the Color Picker on an object and selecting a different object, the last used color is applied.
Is that a tiny bit better? :)
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 26 Jan 2023, 23:10 Sorry: oops:
I struggled with that statement.
I did not notice it was automatically applying the color until I made that change to theNode script, it was changing an ORA color that was not obvious because the ORA's 'Enable Obj Mode' was not enabled.
Now, after using the Color Picker on an object and selecting a different object, the last used color is applied.
Is that a tiny bit better? :)
What!? You mean selecting an object is changing it's color. OK, yeah, that's not good. I haven't seen it, but I'll look out for it.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Yep!
If you add the following you can see this behavior.
TheNode script

Code: Select all

if(Node.IsRenderable(firstSel)) {
	var selstr = colorSource.GetStringAt(4);
i = 1;
colorSource.SetSelectedString(selstr);
}
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 26 Jan 2023, 23:50 Yep!
If you add the following you can see this behavior.
TheNode script

Code: Select all

if(Node.IsRenderable(firstSel)) {
	var selstr = colorSource.GetStringAt(4);
i = 1;
colorSource.SetSelectedString(selstr);
}
OK I notice a problem with your change. Looks like it's based off of :

Code: Select all

	if(Node.IsLight(firstSel)) {
		var selstr = colorSource.GetStringAt(0);
		i = 1;
		colorSource.SetSelectedString(selstr);
	}
That i = 1 line really means 0 + 1 [GetStringAt(0)],
so your i = 1 should be 4 + 1 [GetStringAt(4)]
Try that and see if it works any better.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

I have an update on the luminosity "changing" from just opening the system color picker. The problem is the slider. If it is not set to update on change then when you 1. change slider 2. open the system color picker, the lum connector will fire and try to run luminosity scripts. When the slider is set to update on change then it doesn't fire the watchdog.
This is totally typical of the craziness of this whole thing. :roll:

Wow, just did another test. This time I had a light selected, opened the color picker and changed the luminosity slider. Next I just clicked on the color control on the light, not double click, and the luminosity script fired off. I think trueSpace might be evil :twisted:

I didn't want to use update on change for luminosity. So time to figure a way around that craziness.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 26 Jan 2023, 19:17 ...

Been noticing the Panel X being left open on several occasions.
Edit: Both panels are missing a WinID. I added {F021DF25-F4AA-41DD-86CC-8FF15C2E278A} to both panels

...
I missed your edits.
I added that change to the WinID of both panels and it didn't change anything.

If you double click the square color control and cancel will the x button still be visible?
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

clintonman wrote: 27 Jan 2023, 00:48
trueBlue wrote: 26 Jan 2023, 19:17 ...

Been noticing the Panel X being left open on several occasions.
Edit: Both panels are missing a WinID. I added {F021DF25-F4AA-41DD-86CC-8FF15C2E278A} to both panels

...
I missed your edits.
I added that change to the WinID of both panels and it didn't change anything.

If you double click the square color control and cancel will the x button still be visible?
I do not know what you mean by Cancel
First of all, did you press the Kill button?
If so, did you close trueSpace before using your Color Picker?
For me, the Kill button causes this behavior.
Shortcut Runner uses the X close panel and does not have any issues that I am aware of
Maybe the problem is in your OpenPanel script
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 27 Jan 2023, 01:28
clintonman wrote: 27 Jan 2023, 00:48
trueBlue wrote: 26 Jan 2023, 19:17 ...

Been noticing the Panel X being left open on several occasions.
Edit: Both panels are missing a WinID. I added {F021DF25-F4AA-41DD-86CC-8FF15C2E278A} to both panels

...
I missed your edits.
I added that change to the WinID of both panels and it didn't change anything.

If you double click the square color control and cancel will the x button still be visible?
I do not know what you mean by Cancel
First of all, did you press the Kill button?
If so, did you close trueSpace before using your Color Picker?
For me, the Kill button causes this behavior.
Shortcut Runner uses the X close panel and does not have any issues that I am aware of
Maybe the problem is in your OpenPanel script
DoubleClickLoseX.jpg
Double click the color control , choose cancel and lose the special X
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

I had to do that several times before I lost the X Close panel, but yes, confirmed
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

I really think that using RsApp.HistoryLength = 1 in the Clickable Bitmap Control(s) could be a better process
Here is another example.

Code: Select all

RsApp.HistoryLength = 1
util = System.CreateDO("Clintons3D Package/Utility functions")
util.SetNodeValueFloat('%THIS_NAME%/Color Format', 'inR', %COLOR_R%)
util.SetNodeValueFloat('%THIS_NAME%/Color Format', 'inG', %COLOR_G%)
util.SetNodeValueFloat('%THIS_NAME%/Color Format', 'inB', %COLOR_B%)
Aftrer dragging to change the color, you have to press the Set button to restore the HistoryLength

Code: Select all

	history = Node.Value('Preferences/Desktop', 'Undo/Redo')
	RsApp.HistoryLength = history
	RsApp.Undo()
Attachments
Color Picker1d29.RsObj
(104.3 KiB) Downloaded 153 times
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 27 Jan 2023, 02:16 I really think that using RsApp.HistoryLength = 1 in the Clickable Bitmap Control(s) could be a better process
Here is another example.

Code: Select all

RsApp.HistoryLength = 1
util = System.CreateDO("Clintons3D Package/Utility functions")
util.SetNodeValueFloat('%THIS_NAME%/Color Format', 'inR', %COLOR_R%)
util.SetNodeValueFloat('%THIS_NAME%/Color Format', 'inG', %COLOR_G%)
util.SetNodeValueFloat('%THIS_NAME%/Color Format', 'inB', %COLOR_B%)
Aftrer dragging to change the color, you have to press the Set button to restore the HistoryLength

Code: Select all

	history = Node.Value('Preferences/Desktop', 'Undo/Redo')
	RsApp.HistoryLength = history
	RsApp.Undo()
If you open the other aspect of the color picker there is an undoable checkbox that can be unchecked if you don't want any undos.

Using this color picker:

1. move object in 3d view
2. drag or click in the color picker
3. undo for object move is gone
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

clintonman wrote: 27 Jan 2023, 00:40 I have an update on the luminosity "changing" from just opening the system color picker. The problem is the slider. If it is not set to update on change then when you 1. change slider 2. open the system color picker, the lum connector will fire and try to run luminosity scripts. When the slider is set to update on change then it doesn't fire the watchdog.
This is totally typical of the craziness of this whole thing. :roll:

Wow, just did another test. This time I had a light selected, opened the color picker and changed the luminosity slider. Next I just clicked on the color control on the light, not double click, and the luminosity script fired off. I think trueSpace might be evil :twisted:

I didn't want to use update on change for luminosity. So time to figure a way around that craziness.
Quoting myself. I changed the luminosity slider to update on change and it wasn't bad like I thought. I had already lowered the resolution of the image so it updates fast enough to be usable even with update on change active.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

This is true, but without using RsApp.HistoryLength = 1, you lose undos while dragging
If a User has 20 undos set in the Desktop, the undos are lost really fast!
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Humm... just notice something with your Color Picker
Open Command History and your Color Picker
Clear the History
Move an object a few times
Click in your Color Picker
Press the trueSpace Undo icon
The last Undo is removed and added back with each press
No Undos are possible after that
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 27 Jan 2023, 03:13 Humm... just notice something with your Color Picker
Open Command History and your Color Picker
Clear the History
Move an object a few times
Click in your Color Picker
Press the trueSpace Undo icon
The last Undo is removed and added back with each press
No Undos are possible after that
Yes, that's why there is a Undo Color button on the color picker. It is setup to only undo the color changes(ideally).
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Oh, I see...
You press the Undo Color button first, then trueSpace's Undo to continue using it to Undo the previous undos
Nice!
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 26 Jan 2023, 21:20 Since adding the WinID to both panels, I have not seen any issues so far and the X panel now adds SnappedTo, I guess from your OpenPanel script

I found a setting that works pretty good
TheNode

Code: Select all

if(Node.IsRenderable(firstSel)) {
	var selstr = colorSource.GetStringAt(4);
i = 1;
colorSource.SetSelectedString(selstr);
}
Also added:
if(Node.IsCamera(firstSel)) {
return
}
The IsRenderable check won't be needed. After I removed those exported child node color connections from the list the good color is found at index 0 for compiled and d3d materials. The only odd ball was the yafaray materials, I added a TODO note in the code
"shiny diff=3, glossy=5, coated glossy=7, glass=4, rough glass=5, yaf light=0, blend=7"
I already added your selection check for the UpdateConnChoice.
I'm going to see about adding the ORA option now.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

Here are the latest changes:

new option to not include object render attributes colors in the drop down list - looks nice and clean, option is on the default aspect

removed internal color nodes with exported connectors from the drop down list - now all default mesh colors are good except yafaray materials, still haven't checked other possibilites yet - mesh with hair, sds mesh, nurbs, skeletons, actors... bunch of stuff

changed the luminosity slider to update on change - using the color control won't add another luminosity undo

added a selection check for the update button

TODO list:

yafaray materials
closing x issue
untested object types
Attachments
Color Picker091c.RsObj
(544.6 KiB) Downloaded 142 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Great update! :bananathumb:
The drop-down list is a huge improvement!
I will test a bunch tomorrow.
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

I looked at Shortcut Runner's panel setup in the UU
First of all, I was wrong having both panels WinID the same

The XCoverColorPickerPanelFrame's OwnedBy needs to be the same as the ColorPickerFrame's WinID

Edit: Random GUID Generator
lowercase or UPPERCASE :?:
I like UPPERCASE :mrgreen:

Code: Select all

// guidGenerator 
// Called to execute the command 
function Execute(params)
{

	params.ConValue("myguid") = guid();

}

function S4() {

	return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
}

function guid() {


	//return ("{" + S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4() + "}");
	return ("{" + S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4() + "}").toUpperCase();
}
GUID Generator.png
GUID Generator.png (5.55 KiB) Viewed 1598 times
.
Color Picker toolbar icon
Color Picker.png
Color Picker.png (7.69 KiB) Viewed 1596 times
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Getting a few errors with the Update button
It may be a selection issue, like when you change the color picker's selected object to a different material.
Selecting the color picker's selected object again seems to help.

ERR Source object: /Scripts/CustomCommands/Color Picker/UpdateConnChoice Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 28, Char: 1 Script text: color = Node.Value(ActiveObject, ActiveConn);

I think you may need to make this script use a try&catch with an Alert "Selection lost."


Getting a lot of Border color attributes in the drop down list
I do not think these are of any value.
Is there any way to bypass a connector name: "Border color"?
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Yay, I did it! :D
TheNode script
if(connector[1]=="Border color") continue;
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 27 Jan 2023, 19:48 ...

I think you may need to make this script use a try&catch with an Alert "Selection lost."
...
No thanks. try catch is the worst solution to any programming problem.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Hopefully you can solve the error.
Is the 1dColorData Clickable Bitmap Control being discontinued?
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 27 Jan 2023, 20:27 Hopefully you can solve the error.
Is the 1dColorData Clickable Bitmap Control being discontinued?
Probably, to both.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

How are you going to get gray scale colors?
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 27 Jan 2023, 20:49 How are you going to get gray scale colors?
The 1dColorData Clickable Bitmap Control is replaced by the slider control and remains as a visual guide for the slider.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

ColorPickerBugs.jpg

Found a couple of bugs. One is a truespace bug. For color objects the SetColorHSL command will create a white color if hue is 1. A hue of 1 should be red. This effects the main color picker. If you pick on the far right you get white because the image was not built properly because of the hue bug.

Second thing is that I changed the resolution of the main color picker making it shorter. The control was still square and tS was causing a white selection at the very bottom of the control which should be maximum saturation. I made the control proportional and that fixed the problem.

Another bug is when you select an object with no color and press the Update button you get an null error. Fixed it with an early return. This is not the same error trueBlue found. Haven't been able to reproduce that error without some steps.
Attachments
Color Pickerbd5f.RsObj
(545.77 KiB) Downloaded 157 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

clintonman wrote: 01 Feb 2023, 05:36 Another bug is when you select an object with no color and press the Update button you get an null error. Fixed it with an early return. This is not the same error trueBlue found. Haven't been able to reproduce that error without some steps.
That null error, that you fixed is the same error that I was getting.
I will let you know if I get any other errors.
I am using the same code used in the main bitmap in the Black & White gradient bitmap.
Do you see any reason not to use that?
Attachments
Color.png
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 01 Feb 2023, 14:44
clintonman wrote: 01 Feb 2023, 05:36 Another bug is when you select an object with no color and press the Update button you get an null error. Fixed it with an early return. This is not the same error trueBlue found. Haven't been able to reproduce that error without some steps.
That null error, that you fixed is the same error that I was getting.
I will let you know if I get any other errors.
I am using the same code used in the main bitmap in the Black & White gradient bitmap.
Do you see any reason not to use that?
Not off the top of my head.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Couple other observations...
Color aspect
The Lum; Red; Green; Blue right click Reset does not do anything except add Undo entries to the Command History and Undoing them does not do anything. I changed the Link(s) to None.
The Integer2Number script has two OnDefaultValue functions.
The BufferColor does not need to be exposed. The Color attribute updates.
Exp aspect
There are two attributes that should be deleted.
The Icon is a Spotlight bitmap.
Tip: Left click - Iconize
Color.png
Color.png (19.92 KiB) Viewed 1754 times
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

I made a poor man's Lum Channel
Or is it Saturation?
Lum Channel.png
Lum Channel.png (10.22 KiB) Viewed 1739 times
.
Lum Bitmap
The first color is a static White color.
The second and third color are both the Picked color.
The fourth color is a static Black color.
Gradient Bitmap.png
.
And a Shortcut

Code: Select all

    <RS_ACC KEY="SHIFT C" GROUP="USERDEFINED" CONTEXT="" DESC="Run Color Picker" COMMAND="Activity.Run(&quot;Scripts/CustomCommands/Color Picker/OpenPanel&quot;)" />
Point Edit also uses SHIFT C

Code: Select all

    <RS_ACC KEY="SHIFT C" DESC="Convert Selection" GROUP="VIEW3D" CONTEXT = "PointEdit" COMMAND="MeshModifiers.ConvertSelection('','');" />
Do you think that will be an issue?
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 02 Feb 2023, 20:09 I made a poor man's Lum Channel
Lum Channel.png
.
Lum Bitmap
The first color is a static White color.
The second and third color are both the Picked color.
The fourth color is a static Black color.

Gradient Bitmap.png
.
And a Shortcut

Code: Select all

    <RS_ACC KEY="SHIFT C" GROUP="USERDEFINED" CONTEXT="" DESC="Run Color Picker" COMMAND="Activity.Run(&quot;Scripts/CustomCommands/Color Picker/OpenPanel&quot;)" />
Point Edit also uses SHIFT C

Code: Select all

    <RS_ACC KEY="SHIFT C" DESC="Convert Selection" GROUP="VIEW3D" CONTEXT = "PointEdit" COMMAND="MeshModifiers.ConvertSelection('','');" />
Do you think that will be an issue?
Do you think that will be an issue?
The only way to know for sure is try it and see.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

The best I can tell, the Convert Selection is a two-part process.
If you do not do the first part (change the element mode) before using Convert Selection, it does not do anything.

The only thing I can think of, if it is possible, is add code to your OpenPanel script that stops it from opening if tS is in PE Mode
Is that possible?
Or at the very least, add:

Code: Select all

	if(Node.ConExists(Node.FirstSelected(), 'Selection')) {
	if(Node.Exists('Project/Windows Manager Space/ColorPickerFrame'))
		if(Node.Exists('Scripts/CustomCommands/Color Picker/ClosePanel'))
		ScriptObject.Execute('Scripts/CustomCommands/Color Picker/ClosePanel')
		return;
	}
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 01 Feb 2023, 20:15 Couple other observations...
Color aspect
The Lum; Red; Green; Blue right click Reset does not do anything except add Undo entries to the Command History and Undoing them does not do anything. I changed the Link(s) to None.
The Integer2Number script has two OnDefaultValue functions.
The BufferColor does not need to be exposed. The Color attribute updates.
Exp aspect
There are two attributes that should be deleted.
The Icon is a Spotlight bitmap.
Tip: Left click - Iconize
Color.png
Cleaned connections.
RMB on icon, now it's black, not a light icon.
Removed extra OnDefaultValue stuff
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 02 Feb 2023, 22:00 The best I can tell, the Convert Selection is a two-part process.
If you do not do the first part (change the element mode) before using Convert Selection, it does not do anything.

The only thing I can think of, if it is possible, is add code to your OpenPanel script that stops it from opening if tS is in PE Mode
Is that possible?
Or at the very least, add:

Code: Select all

	if(Node.ConExists(Node.FirstSelected(), 'Selection')) {
	if(Node.Exists('Project/Windows Manager Space/ColorPickerFrame'))
		if(Node.Exists('Scripts/CustomCommands/Color Picker/ClosePanel'))
		ScriptObject.Execute('Scripts/CustomCommands/Color Picker/ClosePanel')
		return;
	}
I don't know what the Convert Selection is about, or what it has to do with the Color Picker.

So the shortcuts didn't work?
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Shift C works for me to open the Colot Picker and Convert Selection
I added the above code the OpenPanel script
I also added code to TheNode script:

Code: Select all

	if(Node.FirstSelected() == System.ThisOwner()) {
var colorSource = System.CreateDO("Common Data Package/String Enum Data");
colorSource.Clear();
Node.Value(owner, "ColorSource") = colorSource;
Space.Unselect()
		return;
	}

if(Node.IsCamera(Node.FirstSelected())) {
var colorSource = System.CreateDO("Common Data Package/String Enum Data");
colorSource.Clear();
Node.Value(owner, "ColorSource") = colorSource;
Space.Unselect()
return;
}
Also, to the function BuildColorConnList

Code: Select all

if(connector[1]=="Border color") continue
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 03 Feb 2023, 23:12 Shift C works for me to open the Colot Picker and Convert Selection
I added the above code the OpenPanel script
I also added code to TheNode script:

Code: Select all

	if(Node.FirstSelected() == System.ThisOwner()) {
var colorSource = System.CreateDO("Common Data Package/String Enum Data");
colorSource.Clear();
Node.Value(owner, "ColorSource") = colorSource;
Space.Unselect()
		return;
	}

if(Node.IsCamera(Node.FirstSelected())) {
var colorSource = System.CreateDO("Common Data Package/String Enum Data");
colorSource.Clear();
Node.Value(owner, "ColorSource") = colorSource;
Space.Unselect()
return;
}
Also, to the function BuildColorConnList

Code: Select all

if(connector[1]=="Border color") continue
I see, I needed to read back a page to your earlier post.

So all the extra code is because the shortcuts worked?
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

clintonman wrote: 03 Feb 2023, 23:17
trueBlue wrote: 03 Feb 2023, 23:12 Shift C works for me to open the Colot Picker and Convert Selection
I added the above code the OpenPanel script
I also added code to TheNode script:

Code: Select all

	if(Node.FirstSelected() == System.ThisOwner()) {
var colorSource = System.CreateDO("Common Data Package/String Enum Data");
colorSource.Clear();
Node.Value(owner, "ColorSource") = colorSource;
Space.Unselect()
		return;
	}

if(Node.IsCamera(Node.FirstSelected())) {
var colorSource = System.CreateDO("Common Data Package/String Enum Data");
colorSource.Clear();
Node.Value(owner, "ColorSource") = colorSource;
Space.Unselect()
return;
}
Also, to the function BuildColorConnList

Code: Select all

if(connector[1]=="Border color") continue
I see, I needed to read back a page to your earlier post.

So all the extra code is because the shortcuts worked?
Nope, just the OpenPanel script
It only helps and is not full prof.
When the Color Picker is open and you in PE Mode, the Color Picker still works.
You can change the Color of the selected object in PE Mode :|
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

ColorPickerDesign02.jpg
Lots of changes under the hood for this one.

Works with normal undos so removed the special "Undo Color" button and the "Undoable" option.
Replaced the red, green, blue controls with clickable bitmaps
Added dummy sliders as indicators for the values
Removed the "Color" button, "Lum",Sat" and "Kelvin" remain.
Removed the "Kill All" testing button
Added preset colors, just 4 for now.
Improved default behavior for objects that have YafaRay materials.
Added a new option "Include Advanced" which ignores the bitmap shader block (border colors...)
Drop down list not alphabetized - makes it predictable so can have good default color selected
Works with objects that have scene instanced materials.

To save a preset push one of the S1 - S4 buttons
To use the preset click the color.

The sliders don't change anything, they just indicate the current values.

Only the luminosity mode is working. The other 2 will be added soon.

Design Note: Any changes to the size of the clickable bitmap "sliders" may need a small code change. If the built bitmap isn't proportional to the display bitmap, trueSpace will add bad values to the bottom and right edges.
Attachments
Color Picker627c.RsObj
(244.42 KiB) Downloaded 146 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Lots of great updates Clinton! :bananathumb:
Question...
Do the sliders have to be longer than the color bitmaps?
Color Picker UI.png
.
The XCoverColorPicker hides behind the main panel when you use the Pick Color Control - "Color".
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

The Color Pickers; S1, S2, S3, and S4 give errors.
08:15:49.345 WARN Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 1, Char: 156 Script text: Node.Value(target, conn) = color;Node.Value(owner, 'Color') = color;Node.Value(owner, 'BufferRed') = 59;Node.Value(owner, 'BufferGreen') = 148;Node.Value(owner, 'BufferBlue') = 87;Node.Value(owner, 'lum') = 0.847100019454956;;} 0x80020101 [RsScript.cpp(188)]
08:15:49.345 ERR Source object: /Scripts/CustomCommands/Color Picker/set final color Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 1, Char: 156 Script text: IMPORTANT - if the above mentioned command is accessing any function set, the error line above may refer to the function set code, instead of command code! 0x80020101 [RcScriptCmd.cpp(1170)]
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 04 Feb 2023, 16:09 Lots of great updates Clinton! :bananathumb:
Question...
Do the sliders have to be longer than the color bitmaps?
Color Picker UI.png
.
The XCoverColorPicker hides behind the main panel when you use the Pick Color Control - "Color".
If the sliders are shorter then the indicator doesn't line up with the "color slider".

XCoverColorPicker fixed, thanks.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 04 Feb 2023, 16:30 The Color Pickers; S1, S2, S3, and S4 give errors.
08:15:49.345 WARN Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 1, Char: 156 Script text: Node.Value(target, conn) = color;Node.Value(owner, 'Color') = color;Node.Value(owner, 'BufferRed') = 59;Node.Value(owner, 'BufferGreen') = 148;Node.Value(owner, 'BufferBlue') = 87;Node.Value(owner, 'lum') = 0.847100019454956;;} 0x80020101 [RsScript.cpp(188)]
08:15:49.345 ERR Source object: /Scripts/CustomCommands/Color Picker/set final color Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 1, Char: 156 Script text: IMPORTANT - if the above mentioned command is accessing any function set, the error line above may refer to the function set code, instead of command code! 0x80020101 [RcScriptCmd.cpp(1170)]
Fixed, thanks.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

clintonman wrote: 04 Feb 2023, 16:50
trueBlue wrote: 04 Feb 2023, 16:30 The Color Pickers; S1, S2, S3, and S4 give errors.
08:15:49.345 WARN Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 1, Char: 156 Script text: Node.Value(target, conn) = color;Node.Value(owner, 'Color') = color;Node.Value(owner, 'BufferRed') = 59;Node.Value(owner, 'BufferGreen') = 148;Node.Value(owner, 'BufferBlue') = 87;Node.Value(owner, 'lum') = 0.847100019454956;;} 0x80020101 [RsScript.cpp(188)]
08:15:49.345 ERR Source object: /Scripts/CustomCommands/Color Picker/set final color Error: Microsoft JScript runtime error Description: Invalid procedure call or argument Error code: 0x800a0005 - (null) Line: 1, Char: 156 Script text: IMPORTANT - if the above mentioned command is accessing any function set, the error line above may refer to the function set code, instead of command code! 0x80020101 [RcScriptCmd.cpp(1170)]
Fixed, thanks.
Is it the RsApp.RunScriptBuffer(cmd) in set final color script?

Edit: It looks like there is a mixed use of quotes at beginning and end
Some lines use: '
And other lines use: "
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 04 Feb 2023, 17:00
clintonman wrote: 04 Feb 2023, 16:50
trueBlue wrote: 04 Feb 2023, 16:30 The Color Pickers; S1, S2, S3, and S4 give errors.
Fixed, thanks.
Is it the RsApp.RunScriptBuffer(cmd) in set final color script?
You didn't say how you got the errors so I assumed you were pressing the buttons without a valid selection in the dropdown list. I put a check in the script called by the clickable bitmap.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

As it turns out, ALL of the Clickable Color Controls are giving similar errors by a simple click.
Edit: With nothing selected
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 04 Feb 2023, 17:15 As it turns out, ALL of the Clickable Color Controls are giving similar errors by a simple click.
Edit: With nothing selected
Got it, put the same fix in the others as well.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Observation:
Steps...
Select a Shader node like in this example, a DefaultModelShader.
Select a 3D Object
The Combo Ctrl still has the DefaultModelShader's "Specular_Color"
Specular_Color
Clear Combo Control.png
Clear Combo Control.png (4.01 KiB) Viewed 1600 times
.
Edit: I wonder if it is necessary to append the name of the node?
"_Node Name"
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Pick Color Control - "Color"
In the previous version this worked
With nothing selected...
Pick a Color using the Pick Color Control - "Color"
The Lum, Red, Green, and Blue values do not update.
You have to do it twice now.

Edit:
It would be awesome if there was no need for the Update button
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 04 Feb 2023, 18:23 Pick Color Control - "Color"
In the previous version this worked
With nothing selected...
Pick a Color using the Pick Color Control - "Color"
The Lum, Red, Green, and Blue values do not update.
You have to do it twice now.

Edit:
It would be awesome if there was no need for the Update button
The color picker is pretty useless if nothing is selected to make a color change. I'll add an auto close for when nothing is selected.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 04 Feb 2023, 18:04 Observation:
Steps...
Select a Shader node like in this example, a DefaultModelShader.
Select a 3D Object
The Combo Ctrl still has the DefaultModelShader's "Specular_Color"
Specular_Color
Clear Combo Control.png
.
Edit: I wonder if it is necessary to append the name of the node?
"_Node Name"
I don't see it. Unless you are selecting the same object or another object that contains a "Specular_Color"

Yep, the names have to be unique to work. If removed the system would fail if there are 2 different nodes with the same connector name.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

ColorPickerNewIndicators2.jpg

Removed the slider based value indicators and added indicators to the clickable bitmaps for luminosity, red, green, and blue
Fixes mentioned in earlier posts
Fixed some bugs in the presets loader
Added some buffer areas to the sliders so it's possible to reach the lowest and highest values - 0 to 1 and 0 to 255
Panel will close itself if nothing is selected


EDIT: just found a bug I thought I fixed already...
Attachments
Color Picker395.RsObj
(252.55 KiB) Downloaded 162 times
Last edited by clintonman on 04 Feb 2023, 23:08, edited 1 time in total.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

clintonman wrote: 04 Feb 2023, 22:33
trueBlue wrote: 04 Feb 2023, 18:23 Pick Color Control - "Color"
In the previous version this worked
With nothing selected...
Pick a Color using the Pick Color Control - "Color"
The Lum, Red, Green, and Blue values do not update.
You have to do it twice now.

Edit:
It would be awesome if there was no need for the Update button
The color picker is pretty useless if nothing is selected to make a color change. I'll add an auto close for when nothing is selected.
Humm...
Please do not do that on my account.
As it is currently, you select an object, and the Color Picker gets the object's Color.
Then if use UnSelect, the Color Picker clears the combo control and the last select object's color remains.
So, it is in this instance, where I tried the Pick a Color using the Pick Color Control - "Color".
I was just pointing out that you have do it twice now, not a big deal, just different from the last version.
I thought maybe you could fix the need to do it twice, is all.
I do not think closing it would be such a great idea.
I do think that a default color fallback would be good though.
Color default.png
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

Fixed an error in the luminosity value

Removed the Update button from the drop down list

Latest changes caused performance issues which could cause the undo stack to fill up.
Now the red, green, blue, luminosity and main color areas don't update while dragging.
Attachments
Color Picker399.RsObj
(256.24 KiB) Downloaded 150 times
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 04 Feb 2023, 22:51
clintonman wrote: 04 Feb 2023, 22:33
trueBlue wrote: 04 Feb 2023, 18:23 Pick Color Control - "Color"
In the previous version this worked
With nothing selected...
Pick a Color using the Pick Color Control - "Color"
The Lum, Red, Green, and Blue values do not update.
You have to do it twice now.

Edit:
It would be awesome if there was no need for the Update button
The color picker is pretty useless if nothing is selected to make a color change. I'll add an auto close for when nothing is selected.
Humm...
Please do not do that on my account.
As it is currently, you select an object, and the Color Picker gets the object's Color.
Then if use UnSelect, the Color Picker clears the combo control and the last select object's color remains.
So, it is in this instance, where I tried the Pick a Color using the Pick Color Control - "Color".
I was just pointing out that you have do it twice now, not a big deal, just different from the last version.
I thought maybe you could fix the need to do it twice, is all.
I do not think closing it would be such a great idea.
I do think that a default color fallback would be good though.
Color default.png
I have no idea why you would want a color picker without anything to assign a color too, but I can put it back the way it was easy enough.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

It is not that really, it is just the way it works now which is kind of shocking.
When open it with nothing selected, it opens up and then closes.
Windows Color Picker does not do that.

I will test it a bit longer and see how it works out.
Attachments
Color UI.png
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 05 Feb 2023, 01:40 It is not that really, it is just the way it works now which is kind of shocking.
When open it with nothing selected, it opens up and then closes.
Windows Color Picker does not do that.

I will test it a bit longer and see how it works out.
Here is your latest version with the UI arranged.
Added two none-working color slots.
Color UI.png
Looks good. I'll add 2 more color presets. I'm working on the saturation and kelvin now. I think I'll have it all done tonight.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

The 4 colors I picked are from the top row of the Windows Color Picker starting from the left.
It would be nice if you could add a total of 8 slots that would fit in one row in your UI.
That is of course if you can make them smaller to fit in one row.
Colors.png
Colors.png (1.45 KiB) Viewed 1518 times
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 05 Feb 2023, 02:04 The 4 colors I picked are from the top row of the Windows Color Picker starting from the left.
It would be nice if you could add a total of 8 slots that would fit in one row in your UI.
That is of course if you can make them smaller to fit in one row.
Colors.png
Ok, I'll add 4 more.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 05 Feb 2023, 02:04 The 4 colors I picked are from the top row of the Windows Color Picker starting from the left.
It would be nice if you could add a total of 8 slots that would fit in one row in your UI.
That is of course if you can make them smaller to fit in one row.
Colors.png
Those colors are already easily available in the color picker control. We would just be copying what's already there.
Is there any other set of 8 colors you would prefer?
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

When I looked at and tried all of the choices, the top row seemed best.
Still not able to get pure White easily from the color pickers.
I am really not sure what would be best.

Would not be very intuitive, but I wonder if you could put the code in the S1 button into its color picker and remove the button(s)?
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 05 Feb 2023, 03:06 When I looked at and tried all of the choices, the top row seemed best.
Still not able to get pure White easily from the color pickers.
I am really not sure what would be best.

Would not be very intuitive, but I wonder if you could put the code in the S1 button into its color picker and remove the button(s)?
I'll add some notes to the "SavePreset" node so if you want you can override the random colors currently used

You're not able to get white. Can you get black?

Not possible to move the code from the button into the clickable bitmap controls. There is a %MOUSE_BUTTON% it gives 1 for the left mouse button. It gives 2 for the right button and also opens a context menu. The middle button is ignored.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Okay
Have you ever seen the Lum change to 70110208031775968.000 when clicking in the left-hand side of the main bitmap control?
And the bitmap control turns 98% white?
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 05 Feb 2023, 03:06 When I looked at and tried all of the choices, the top row seemed best.
Still not able to get pure White easily from the color pickers.
I am really not sure what would be best.

Would not be very intuitive, but I wonder if you could put the code in the S1 button into its color picker and remove the button(s)?
Ok I found some stuff.
First there was an error in the code. The truespace hsl color has a bug in the hue part and I put the correction on the luminousity part.
Then truespace main clickable bitmap needed buffer zones on the top for the luminosity and both top and bottom for the saturation.

It's better now but still takes some effort so I'm going to try making the clickable bitmap taller, since we need to be able to get to the top and bottom values to get full black and white easily.

Cross posting:

"Okay
Have you ever seen the Lum change to 70110208031775968.000 when clicking in the left-hand side of the main bitmap control?
And the bitmap control turns 98% white?"


Nope, I haven't seen that. :o
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Do not know if its tS761StdUU9 or the Color Picker but this is what is happening when clicking on the edges in the main bitmap control.
I rebooted tS but it is the same.
I'll reboot my PC and give it a go in the morning.
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

clintonman wrote: 05 Feb 2023, 04:43
trueBlue wrote: 05 Feb 2023, 03:06 When I looked at and tried all of the choices, the top row seemed best.
Still not able to get pure White easily from the color pickers.
I am really not sure what would be best.

Would not be very intuitive, but I wonder if you could put the code in the S1 button into its color picker and remove the button(s)?
Ok I found some stuff.
First there was an error in the code. The truespace hsl color has a bug in the hue part and I put the correction on the luminousity part.
Then truespace main clickable bitmap needed buffer zones on the top for the luminosity and both top and bottom for the saturation.

It's better now but still takes some effort so I'm going to try making the clickable bitmap taller, since we need to be able to get to the top and bottom values to get full black and white easily.

Cross posting:

"Okay
Have you ever seen the Lum change to 70110208031775968.000 when clicking in the left-hand side of the main bitmap control?
And the bitmap control turns 98% white?"


Nope, I haven't seen that. :o
Maybe the above is my issue with the Color Picker?
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 05 Feb 2023, 05:02
clintonman wrote: 05 Feb 2023, 04:43
trueBlue wrote: 05 Feb 2023, 03:06 When I looked at and tried all of the choices, the top row seemed best.
Still not able to get pure White easily from the color pickers.
I am really not sure what would be best.

Would not be very intuitive, but I wonder if you could put the code in the S1 button into its color picker and remove the button(s)?
Ok I found some stuff.
First there was an error in the code. The truespace hsl color has a bug in the hue part and I put the correction on the luminousity part.
Then truespace main clickable bitmap needed buffer zones on the top for the luminosity and both top and bottom for the saturation.

It's better now but still takes some effort so I'm going to try making the clickable bitmap taller, since we need to be able to get to the top and bottom values to get full black and white easily.

Cross posting:

"Okay
Have you ever seen the Lum change to 70110208031775968.000 when clicking in the left-hand side of the main bitmap control?
And the bitmap control turns 98% white?"


Nope, I haven't seen that. :o
Maybe the above is my issue with the Color Picker?
I think the tS clickable bitmap just has issues. I made the bitmap taller and that along with the buffers seems to have done the trick. I'm looking at the saturation display because it's behavior seems a little off. Will look at other color pickers to see if it's misbehaving. I'll upload what I have tonight so you have something to see in the morning.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

This one has a bigger clickable bitmap control and a white zone at the top of the luminosity display to make it easier to get to white. The value, red, green and blue "sliders" have buffers at the left and right to make it easier to get min and max values.
Fixed a color calculation bug.
It has 8 presets now. They can be resized since they only contain a single color. Random color values are the default and some notes are included in the code if specific default colors are desired.
I found that the saturation display theory isn't 100% compatible with the way the color picker is setup so it has a limit on the saturation value slider to avoid black and white values. Everything in between is good.
Attachments
Color Pickered2a.RsObj
(295.98 KiB) Downloaded 163 times
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Thanks!
Occasionally, I am getting errors clicking in the Luminosity bitmap.

Code: Select all

ERR   Source object: /Scripts/CustomCommands/Color Picker/RestorePreviousState Error: Microsoft JScript runtime error Description: Overflow Error code: 0x800a0006 - (null) Line: 32, Char: 1 Script text:  util.SetNodeValueFloat(owner + "/UpdateRGB", "c_value", colorFS.PrevValue * 255); 
Then it stops working.
Select the selected object again and try again gives an error.

Now I get the SavePreset script, it gets random colors when you Reset them.
Nice!

The combo control looks like it defaults to the last item in the list.
I seemed to remember that the Color_ was showing more so in the previous version(s?)

TheNode script
Using two underscores kind of makes it look like one whole object name

Code: Select all

var connNodeSN = ColorConnList[i].theconn + "__" + Node.ShortName(ColorConnList[i].thenode);
Specular_Color__DefaultModelShader

What do you think about using:

Code: Select all

var connNodeSN = ColorConnList[i].theconn + "<- " + Node.ShortName(ColorConnList[i].thenode);
Specular_Color<- DefaultModelShader
For me, it kind of looks like an InAttribute

Panel Editing is a real pain in trueSpace when the controls are not a certain Grid size.
For instance, the color controls are 192x12
Color UI.png
User avatar
clintonman
Captain
Posts: 5659
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California

Re: Color Picker

Post by clintonman »

trueBlue wrote: 05 Feb 2023, 11:32 Thanks!
Occasionally, I am getting errors clicking in the Luminosity bitmap.

Code: Select all

ERR   Source object: /Scripts/CustomCommands/Color Picker/RestorePreviousState Error: Microsoft JScript runtime error Description: Overflow Error code: 0x800a0006 - (null) Line: 32, Char: 1 Script text:  util.SetNodeValueFloat(owner + "/UpdateRGB", "c_value", colorFS.PrevValue * 255); 
Then it stops working.
Select the selected object again and try again gives an error.

Now I get the SavePreset script, it gets random colors when you Reset them.
Nice!

The combo control looks like it defaults to the last item in the list.
I seemed to remember that the Color_ was showing more so in the previous version(s?)

TheNode script
Using two underscores kind of makes it look like one whole object name

Code: Select all

var connNodeSN = ColorConnList[i].theconn + "__" + Node.ShortName(ColorConnList[i].thenode);
Specular_Color__DefaultModelShader

What do you think about using:

Code: Select all

var connNodeSN = ColorConnList[i].theconn + "<- " + Node.ShortName(ColorConnList[i].thenode);
Specular_Color<- DefaultModelShader
For me, it kind of looks like an InAttribute

Panel Editing is a real pain in trueSpace when the controls are not a certain Grid size.
For instance, the color controls are 192x12
Color UI.png
ColorPickerCrazyBigNumber.jpg
ColorPickerCrazyBigNumber.jpg (44.46 KiB) Viewed 1451 times
I see it. A crazy big number. For me the number shown isn't big enough to give an error, but that super crazy big number you mentioned would. The error Overflow Error code: 0x800a0006 means "this is too big to handle".

Do you have a specific example of an undesirable value defaulting in the combo box?

I'll see about changing the combo underscores. Should be doable.

The 192x12 sliders can be resized now since the picker uses the mouse position instead of the color underneath. The only thing to know is that if they are not long enough it will be more difficult to get to the min and max values.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

Do you have a specific example of an undesirable value defaulting in the combo box?
Just wished it went to Color first
Example:
Cube1 = Default Material (it only has one Color)
Cube2 = BlankDXMaterial (it has Color and Specular Color)
Now select each one
Cube1 is fine. :D
Cube2 shows the Specular Color and the main bitmap turns Black. :shock:

I think you mentioned you changed it to non-Alphabetized or No Sort.
TheNode:
var CBS_SORT = 256;
Are there different values I can experiment with?
User avatar
trueBlue
Captain
Posts: 5548
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Color Picker

Post by trueBlue »

If I Reset the c_value it seems to work, so far without errors
Reset C Value.png

Return to “Workspace Side”