PDA

View Full Version : Manipulators don't update with custom attributes


phoelix
03-31-2008, 02:33 AM
Hi!

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).

def=attributes myAttributes
(
parameters myParameters rollout: myRollout
(
MyProperty type:#float default:0.5 ui:UIMyProperty
)
rollout myRollout "Rollout"
(
Slider UIMyProperty "MyProperty" range:[0,1,0.5]
)
)
boxObject=box()
addmodifier boxObject (emptymodifier())
custAttributes.add boxObject.modifiers[1] def

plugin simpleManipulator MyManipulator
name:"MyManipulator"
invisible:true
(
on canManipulate target return (isProperty target "MyProperty")
on updategizmos do
(
print "updating"
this.clearGizmos()
this.addgizmoMarker #hollowBox [target.MyProperty,0.5,0]\
(gizmoUseRelativeScreenSpace+ GizmoActiveViewportOnly ) [0,1,0] [0,0,1]
return ""
)
on mouseMove m which do
(
target.MyProperty=m.x/gw.getWinSizeX()
)
)

manipulatemode=true
select boxObject

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?.

any ideas?,

thanks.

CGTalk Moderation
03-31-2008, 02:33 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.