PDA

View Full Version : scripted modifier and animated parameters


uiron
10-01-2005, 08:37 PM
i'm sure the answer is somewhere there, but i couldn't find it anywhere.

what is the correct way to reflect changes in animated parameters in scripted modifiers?

i've written a simple scripted modifier that has a custom animated property, representing percentage of the effect modifier takes on the object. the problem is that i don't know when, in what event, should i perform the update.

i used "on <pararameter> get" construct, but it works only when modifier rollout is displayed:

on percentage get v do (
updateSelection(); -- does all the actions i must take to reflect percentage value
v;
)

any suggestions?

Bobo
10-01-2005, 09:19 PM
i'm sure the answer is somewhere there, but i couldn't find it anywhere.

what is the correct way to reflect changes in animated parameters in scripted modifiers?

i've written a simple scripted modifier that has a custom animated property, representing percentage of the effect modifier takes on the object. the problem is that i don't know when, in what event, should i perform the update.

i used "on <pararameter> get" construct, but it works only when modifier rollout is displayed:

on percentage get v do (
updateSelection(); -- does all the actions i must take to reflect percentage value
v;
)

any suggestions?

If it is a simpleMod class plug-in, you don't have to do anything special, as long as the parameter is used in the on Map() handler.
If your simple modifier is NOT a simpleMod modifier, I might need some more info...

uiron
10-01-2005, 09:42 PM
well, this is a Edit_Poly descendant. effect i'm achieving for is to animate polygon selection in recorded sequence. use of plugin is simple - you press the record button, select polygons in the order you want, unpress the records button; animate percentage from 0 to 100 in a wanted time period, and voila, it works... while modifier is selected in edit panel:] as soon as i try to use the selection upper in the stack with "delete mesh" or "face extrude" modifiers, selection animation is not updated…


plugin modifier AnimatedSelection
name:"Animated Selection"
classID:#(0x1604ebe6, 0x1a5defa7)
extends:Edit_Poly
replaceUI:false
version:1
(
local prevSel = #{}; -- previous selection

function updateSelection = (
if delegate.getNumFaces()==0 then return undefined;

s = #{};
for i=1 to (this.fseq.count*this.percentage/100) do (
append s this.fseq[i];
)
delegate.setSelection #Face s;

)

parameters main rollout:mainR (
percentage type:#float animatable:true ui:spnPercentage; --percentage of recorded selection to activate
fseq type:#inttab animatable:false tabSize:0 tabSizeVariable:true; --polygon select sequence


on percentage set v do (
updateSelection();
)

on percentage get v do (
if not this.mainR.tmrRecord.active then updateSelection();
v;
)
)

rollout mainR "Animated Selection" (
checkbutton btnRecord "record";
spinner spnPercentage;
timer tmrRecord interval:100 active:false;

on btnRecord changed state do(
if state==on then (
fseq = #();
tmrRecord.active = true;
)
else (
tmrRecord.active = false;
updateSelection();
)
)

on tmrRecord tick do (
-- adds newly selected polygons to selection sequence queue
local currSel = (delegate.getSelection #Face);
local diff = currSel-prevSel;
prevSel = currSel;
for i in diff do
append this.fseq i;
)
)
on create do (
delegate.setEPolySelLevel #Face;
)
)

marktsang
10-01-2005, 10:23 PM
im new to scripted plugins so i could have this ass ways...
seems to me that you dont have a parameter associated with the record button so when the rollout is not displayed its local variable will be reset to the default - off

add a parameter and associate it with the checkbutton and it will keep its state

hope this is correct / helps

mark tsang

uiron
10-01-2005, 10:26 PM
no, "record" button is just needed to activate "selection record" state. you press it, write to fseq array and exit record mode.

CGTalk Moderation
10-01-2005, 10:26 PM
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.