Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strange behavior of strings #2

Open
HansElectrumpet opened this issue Dec 16, 2020 · 2 comments
Open

strange behavior of strings #2

HansElectrumpet opened this issue Dec 16, 2020 · 2 comments

Comments

@HansElectrumpet
Copy link

HansElectrumpet commented Dec 16, 2020

Hi, I don't know if it should be here or is actually an obs websockets issue, but I used the following code (hacked some of yours) because I want to use the streamFX plugin through OSC. If it works I can give you my code if you want it when finished.
I am not familiar much with javascript per se but thought I knew enough about programming languages to do this... Anyway. In the following piece of code, changing the x position works, but y and z don't. As I want to make the code versatile I'd like to use variables and not have to type out every single string. Do you have any idea why this wouldn't work? I get no error message. You see a few variations, but any variation gives the same result.

   //Triggers the Source Camera position (via Filter > 3D_Transform)
    else if ((msg[0].includes('macbookCamSkew')) && (msg[0].includes('Position'))){
        console.log(`OSC IN: ${msg[0]} ${msg[1]} ${msg[2]} ${msg[3]}`)
        var msgArray = msg[0].split("/")
        msgArray.shift()
        var x = msg[1]
        var y = msg[2]
        var z = msg[3]
	var filterType = 'Filter.Transform.'
	var actionX = filterType.concat(msgArray[3], '.X')
	var actionY = 'Filter.Transform.' + msgArray[3] + '.Y'
	var actionZ = filterType.concat(msgArray[3], '.Z')
        console.log(`filterprint: ${actionY}`)
        obs.send("SetSourceFilterSettings", {
           'sourceName': msgArray[0].split('_').join(' '),
           'filterName': msgArray[1].split('_').join(' '),
           'filterSettings': { 'Filter.Transform.Position.X' : x, actionY : y, actionZ : z }
        }).catch(() => {
            console.log("ERROR: Transform Command Syntax is Incorrect. Refer to Node OBSosc Github for Reference")
        })  
    }
@jshea2
Copy link
Owner

jshea2 commented Dec 16, 2020

Hey, sorry I'm unfamiliar with StreamFX, because I only have a Mac. I have looked into it and it looks pretty cool. I don't know what the properties or key should be, but it looks like if X works and it's

"Filter.Transform.Position.X" : x

then shouldn't Y be:

"Filter.Transform.Position.Y": y

Cause Right now it is:

"Filter.Transform.[msgArray[3]].Y" : y

If you wanted that variable to be "Position", after the msgArray.shift(), 'msgArray[0]' should then equal "Position"
(as long as the OSC message is set up kinda like this: "[/macbookCamSkew/Position], [x], [y], [z]")

Another debugging thing you could try to see if Y or Z is a different key name. obs.send("GetSourceFilterSettings) after that you can .then() and console.log whatever is going on in the 'filterSettings' properties.

Sorry if this info isn't much help, but it's my best guess

@WilliamAHuston
Copy link

Wow! I am very interested in controlling StreamFX via OSC. Please keep me posted and provide other details if possible. Thanks!

h/t: @jshea2 for directing me here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants