Hi,
I'm trying to create a separate slider for my finger controls.
The slider is at default 0. Then if you move it, the change will be applied to the finger control. Then the slider will be set again to 0.
However, I'm having a problem as it freezes when checking for c4d.MSG_CHANGE
.
You can see the problem here:
https://www.dropbox.com/s/88vmuzivqylbh1x/c4d207_dialog_freezes_when_checking_for_msg.mp4?dl=0
You can check the working code here:
# For the Add Edit Slider reset to Zero
import c4d
from c4d import bitmaps, documents, gui, plugins, threading, utils
class MyDialog(c4d.gui.GeDialog):
def __init__(self):
self.finger_B_01_L_con = doc.SearchObject('finger_B_01_L_con')
def CreateLayout(self):
self.AddEditSlider(id=303030, flags=c4d.BFH_SCALEFIT, initw=80, inith=0)
return True
def InitValues(self):
self.SetDegree(303030, 0.0, min=-45, max=45, step=0.01, min2=0.0, max2=0.0)
return True
def Message(self, msg, result):
if msg.GetId() == c4d.MSG_CHANGE:
if self.AddEditSlider.GetFloat(303030) != 0:
rotation_current = self.finger_B_01_L_con.GetRelPos()
rotation_modify = self.GetFloat(303030)
rotation_new = rotation_current + rotation_modify
self.finger_B_01_L_con.SetRelPos(rotation_new)
# Set the AddEditSlider Back to Zero
self.InitValues()
return True
if __name__ == "__main__":
dlg = MyDialog()
dlg.Open(dlgtype=c4d.DLG_TYPE_ASYNC)