MaxStudio Posted February 16, 2017 Share Posted February 16, 2017 I'm trying to set parameter visibility in the object info panel. In the old vector script I would retrieve the custom object information as follows: result:= GetCustomObjectInfo(objname,oh,rh,wh); I would then set the visibility of the parameter as follows: SetParameterVisibility(oh,'parametername',FALSE); In python I am trying to accomplish the same thing. I've tried the following: result = vs.GetCustomObjectInfo(objname,oh,rh,wh) and then I attempted to set the visibility as follows: vs.SetParameterVisibility(oh, 'parametername', FALSE) when i run the script I get the following error: NameError: name 'objname' is not defined Does anyone know how to accomplish this using best practice? Thanks, Derek Quote Link to comment
MullinRJ Posted February 16, 2017 Share Posted February 16, 2017 In Python, how are you assigning a value to "objname"? Raymond Quote Link to comment
MaxStudio Posted February 16, 2017 Author Share Posted February 16, 2017 (edited) I have not assigned a value to objname. I've created a plugin object and I need to reference and object handle to set the visibilities of the parameter. how do i acquire or assign these? I thought using the following: vs.GetCustomObjectInfo(objname,oh,rh,wh) would have acquired and assigned these for me Edited February 16, 2017 by MaxStudio Quote Link to comment
MaxStudio Posted February 16, 2017 Author Share Posted February 16, 2017 I've eliminated the vs.GetCustomObjectInfo(objname,oh,rh,wh) and just used vs.SetParameterVisibility(handle, 'parametername', FALSE) I set the object handle to zero vs.SetParameterVisibility(0, 'parametername', FALSE) I want to use a pulldown to set the visibility to true: number=vs.Pnumber if number == "2": vs.SetParameterVisibility(0, 'parametername', True ) but I'm getting the following error: Error: Invalid callback function parameter type. Parameter index= 0 name=inPlugin File "<string>", line 38, in <module> File "<string>", line 1, in <module> below is the actual code: import vs import shapes number=vs.Pnumber shape01=vs.Pshape01 shape02=vs.Pshape02 shape03=vs.Pshape03 xstart=0 vs.SetParameterVisibility(0, 'shape01', False ) vs.SetParameterVisibility(0, 'shape02', False ) vs.SetParameterVisibility(0, 'shape03', False ) if number == "2": vs.SetParameterVisibility(0, 'shape01', True ) vs.SetParameterVisibility(0, 'shape02', True ) if number == "3": vs.SetParameterVisibility(0, 'shape01', True ) vs.SetParameterVisibility(0, 'shape02', True ) vs.SetParameterVisibility(0, 'shape03', True ) Quote Link to comment
MullinRJ Posted February 17, 2017 Share Posted February 17, 2017 Derek, I should have read the documentation before I asked my question. 'objname' is returned by the function vs.GetCustomObjectInfo(). However, in Python, all returned variables must be to the left of the equal sign. Try this: result, objname, oh, rh, wh = vs.GetCustomObjectInfo() then use the handle "oh" in your vs.SetParameterVisibility() calls. Raymond Quote Link to comment
MaxStudio Posted February 17, 2017 Author Share Posted February 17, 2017 (edited) Ok thanks Raymond I will try! Thank you Raymond that worked! I appreciate the response! Edited February 17, 2017 by MaxStudio Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.