The Wayback Machine - https://web.archive.org/web/20220509101117/https://github.com/obsproject/obs-studio/issues/5712
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

obs_property_clicked_t callback not implemented in Python scripting #5712

Open
rishubil opened this issue Dec 29, 2021 · 6 comments · May be fixed by #6305
Open

obs_property_clicked_t callback not implemented in Python scripting #5712

rishubil opened this issue Dec 29, 2021 · 6 comments · May be fixed by #6305
Labels
Confirmed Good first issue

Comments

@rishubil
Copy link

@rishubil rishubil commented Dec 29, 2021

Operating System Info

Windows 10

Other OS

No response

OBS Studio Version

27.1.3

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/H539xmaggfEcaaGL

OBS Studio Crash Log URL

No response

Expected Behavior

When I click the Test button in the script, the URL opens in my browser.

Current Behavior

Nothing happened.

Steps to Reproduce

  1. Add script below
import obspython as obs

def do_nothing():
    pass

def script_description():
    return "test"

def script_properties():
    props = obs.obs_properties_create()

    button = obs.obs_properties_add_button(props, "button", "Test", do_nothing)
    obs.obs_property_button_set_type(button, obs.OBS_BUTTON_URL)
    obs.obs_property_button_set_url(button, "https://localhost")

    return props
  1. Click Test button

Anything else we should know?

It worked normally when the lua script doing the same thing.

@rishubil rishubil changed the title Link button not working Link button is not working Dec 30, 2021
@JoshuaMaitland
Copy link

@JoshuaMaitland JoshuaMaitland commented Dec 31, 2021

I did tested the script, worked once and then it's not working so I do have the same issue. But then after a few button clicks, I get this window (screenshot) so I have no idea why it does that as I never done any scripting within OBS before. I'm not sure if it's a bug or not!
obs64_2021-12-31_15-17-41

@rishubil
Copy link
Author

@rishubil rishubil commented Dec 31, 2021

obs_properties_add_button's callback function should have props, prop as parameters, so the log will disappear if we change do_nothing functions as follows.

import obspython as obs

def do_nothing(props, prop):
    pass

def script_description():
    return "test"

def script_properties():
    props = obs.obs_properties_create()

    button = obs.obs_properties_add_button(props, "button", "Test", do_nothing)
    obs.obs_property_button_set_type(button, obs.OBS_BUTTON_URL)
    obs.obs_property_button_set_url(button, "https://localhost")

    return props

However, the same problem still occurs when I test it.
Also, when I tested it, it didn't even work on the first try.

@JoshuaMaitland
Copy link

@JoshuaMaitland JoshuaMaitland commented Dec 31, 2021

obs_properties_add_button's callback function should have props, prop as parameters, so the log will disappear if we change do_nothing functions as follows.

import obspython as obs

def do_nothing(props, prop):
    pass

def script_description():
    return "test"

def script_properties():
    props = obs.obs_properties_create()

    button = obs.obs_properties_add_button(props, "button", "Test", do_nothing)
    obs.obs_property_button_set_type(button, obs.OBS_BUTTON_URL)
    obs.obs_property_button_set_url(button, "https://localhost")

    return props

However, the same problem still occurs when I test it. Also, when I tested it, it didn't even work on the first try.

Well... I have no clue whatsoever. If you have discord, you can go onto their server and put it into #scripting text channel under the Development category. People might be able to help better than me.

@WizardCM
Copy link

@WizardCM WizardCM commented Jan 30, 2022

This is strange. It definitely should work. I can confirm the issue, at least.

@WizardCM WizardCM added the Confirmed label Jan 30, 2022
@WizardCM WizardCM changed the title Link button is not working Link button property is not working in Python Jan 30, 2022
@kkartaltepe kkartaltepe added the Good first issue label Apr 1, 2022
@kkartaltepe kkartaltepe changed the title Link button property is not working in Python obs_property_clicked_t callback not implemented in Python scripting Apr 1, 2022
@kkartaltepe
Copy link

@kkartaltepe kkartaltepe commented Apr 1, 2022

Callback types must be manually implemented. Python functions are not C functions and cannot be passed directly as callbacks in the OBS api without implementing the appropriate wrapper.

@usakhelo usakhelo linked a pull request Apr 10, 2022 that will close this issue
6 tasks
@usakhelo
Copy link

@usakhelo usakhelo commented Apr 11, 2022

The PR fixes the dialog box to appear when URL property button is pressed.
do_nothing callback is not called when button is obs.OBS_BUTTON_URL. I'm not sure if that's still the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Confirmed Good first issue
5 participants