SOLVED!
I got it, instead of using c4d.EventAdd(),
what I was searching for is c4d.DrawViews().
Now the Slider works interactive.
import c4d
class SliderDialog(c4d.gui.GeDialog):
def __init__(self):
super().__init__()
self.slider_id = 1001
self.last_value = None
def CreateLayout(self):
self.SetTitle("Slider")
self.AddEditSlider(self.slider_id, c4d.BFH_SCALEFIT, initw=200)
self.SetFloat(self.slider_id, 0.0, min=0.0, max=1.0, step=0.01)
return True
def Command(self, id, msg):
if id == self.slider_id:
value = self.GetFloat(self.slider_id)
print(f"Real-time slider value: {value}")
self.UpdateScene(value)
return True
def UpdateScene(self, value):
doc = c4d.documents.GetActiveDocument()
obj = doc.SearchObject("Cube")
if obj:
obj[c4d.ID_BASEOBJECT_REL_SCALE, c4d.VECTOR_X] = value
#c4d.EventAdd()
c4d.DrawViews() # That's it
if __name__ == "__main__":
doc = c4d.documents.GetActiveDocument()
obj = doc.SearchObject("Cube")
if not obj:
obj = c4d.BaseObject(c4d.Ocube)
doc.InsertObject(obj)
c4d.EventAdd()
dlg = SliderDialog()
dlg.Open(c4d.DLG_TYPE_ASYNC)
Cheers