I am working on a non-standalone scripted manipulator (those that works with selected objects like radius manipulator) that manipulates any object's property. But I got troubles when the object's property is from a custom attribute.
for example: in this script i am creating a box that has a custom attribute with a property called "MyProperty", with a hollow box x-position i can manipulate this value, it works pretty fine when i manipulate the hollow box, but when i change MyProperty's value in the command panel the Hollow box position doesn't update until i select the viewport (that's because the gizmoActiveViewportOnly property). the funny part is that when i change a property that isn't from the attribute holder like the box's width the manipulator updates (it can be checked out by the string "updating" printed in the listener).
parameters myParameters rollout: myRollout
MyProperty type:#float default:0.5 ui:UIMyProperty
rollout myRollout "Rollout"
Slider UIMyProperty "MyProperty" range:[0,1,0.5]
addmodifier boxObject (emptymodifier())
custAttributes.add boxObject.modifiers def
plugin simpleManipulator MyManipulator
on canManipulate target return (isProperty target "MyProperty")
on updategizmos do
this.addgizmoMarker #hollowBox [target.MyProperty,0.5,0]\
(gizmoUseRelativeScreenSpace+ GizmoActiveViewportOnly ) [0,1,0] [0,0,1]
on mouseMove m which do
It seems that the event "UpdateGizmos" isn't called when a property from a custom attribute changes. but it does when any other property changes (like the radius of a sphere). it's very frustrating, because i will have problems when changing the values from the command pannel or even worse in animation (because the manipulators doesn't update playing an animation either).
Is there a right way to set the manipulator up to update itself with custom attributes?
the only way that i realized to hack this thing up, is by redrawing all in the viewport (completeRedraw()) when the property changes, but i'm afraid to use this because it will cause problems in heavy scenes..... or i don't have to be afraid?.