Slider to trigger an image switch - trueSpace WS

Technical questions, etc..
Post Reply
User avatar
Draise
Captain
Posts: 2963
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Slider to trigger an image switch - trueSpace WS

Post by Draise » 11 Aug 2015, 21:47

In the LE in Workspace, how would one evaluate a slider (float) value to then trigger a switch for a pair of bitmap images?

I know the code to switch node links, but.. have no idea how to evaluate a slider.

So...

If number change <1, run original switch once till slider stops moving
If number >1, run the second switch once till the slider stops moving

How do you do this?

How do you evaluate true/false = run script with nodes/jscript?

User avatar
Draise
Captain
Posts: 2963
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Slider to trigger an image switch - trueSpace WS

Post by Draise » 11 Aug 2015, 23:07

Ok, in the Activities - My Activities library I found an Activity example.

But it doesn't have a watchdog, and you have to trigger the evaluation. I'd want one that is always evaluating a slider, so I can animate the slider, and switch the image in a shader or visibility of an object accordingly.

Hmm. This would be awesome if I get this to work.

clintonman
Captain
Posts: 2273
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Slider to trigger an image switch - trueSpace WS

Post by clintonman » 12 Aug 2015, 14:55

Here's a sample from my toolbars script that shows choosing different control outputs for running different scripts. The series of if, else if lines shows it.

I think sliders have an option to update continuously or only after release.
Attachments
waitForToolbarChange.zip
(3.38 KiB) Downloaded 14 times
Clinton Reese

http://clintons3d.com

stan
Master Chief Petty Officer
Posts: 471
Joined: 21 May 2009, 17:20

Re: Slider to trigger an image switch - trueSpace WS

Post by stan » 12 Aug 2015, 18:24

try this Draise.. you can change the bitmaps to floats or anything useful. One changes 10 images
you can write it like this too;
switch(func)
{
case 0:
params.ConValue('b2') = b1;
break;
case 1:
params.ConValue('b2') = bb;
break;
case 2:
params.ConValue('b2') = b3;
break;
case 3:
params.ConValue('b2') = b4;
break;
}
Attachments
Image Changer.rar
(87.98 KiB) Downloaded 17 times

User avatar
Draise
Captain
Posts: 2963
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Slider to trigger an image switch - trueSpace WS

Post by Draise » 12 Aug 2015, 21:41

Wow.

You are legend Stan, that is EXACTLY what I needed, PLUS SOME!

The multibitmap switcher.. is AWESOME. I can totally create a 2D image/sprite character or lipsync system with that. Beautiful.

And it solves my issue! I owe you one for that!

User avatar
Draise
Captain
Posts: 2963
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Slider to trigger an image switch - trueSpace WS

Post by Draise » 13 Aug 2015, 05:13

Ok. I am using the bitmap switch, but you mentioned you could switch it to floats.

I would.. like it to execute a command now though.

Code: Select all

	Node.Value(Space.CurrentScene() + "/ACTOR/OBJECT/Object Render Attributes", 
		"Invisible") = 1
And vice versa.

.. could you give an example of changing it to something else? (I'm still learning..)

User avatar
Draise
Captain
Posts: 2963
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Slider to trigger an image switch - trueSpace WS

Post by Draise » 13 Aug 2015, 05:25

I tried using a Watchdog and a Zero Condition activity node, but I got errors on the D3D render, they couldn't execute a parameter.

I really don't know how javascripting if's and elses with a string of commands later on as a consequence.."Node.Value" etc.. I'll try study.

User avatar
Draise
Captain
Posts: 2963
Joined: 21 Sep 2009, 19:33
Type the number ten into the box: 0
Location: Bogota, Colombia
Contact:

Re: Slider to trigger an image switch - trueSpace WS

Post by Draise » 13 Aug 2015, 05:45

Ok, solved my issue using.. my rescale math nodes, offsets and binaryops linked to transparency, then a boolean fcurve interpolator that you Stan made! Works well enough for now.

stan
Master Chief Petty Officer
Posts: 471
Joined: 21 May 2009, 17:20

Re: Slider to trigger an image switch - trueSpace WS

Post by stan » 13 Aug 2015, 13:03

Here is the basic idea using floats. If you just need true/false just reduce the number of float inputs. You can change the delivery system but you can't use Node.value('blabla') with a jscript object you must use a jscript command.
Attachments
changefloat.rar
(1.74 KiB) Downloaded 11 times

Post Reply