Jump to content

how to add undo functionality to edtior scripts?


photo

Recommended Posts

I've successfully created a full featured tcb-spline for unigine, now I'm writing editor script for it, I've found other scripts using State class to create undo, So I use following script to save state

State s = new State();
s.init_modify(nodes, curve);
current_key.setPosition(pos.xyz);
point_position_el[0].setText(editorFormat(pos.x));
point_position_el[1].setText(editorFormat(pos.y));
point_position_el[2].setText(editorFormat(pos.z));

curve.setKey(int(current_point_el.getText()), current_key);
save_state(s);

but after I move the manipulator for curve point, press Ctrl+Z didn't undo any thing.my curve object already implemented saveState function with all its' points stored in stream.so, How can I add undo functionality to editor script?

Link to comment
  • 3 weeks later...
×
×
  • Create New...