2

Nice to be here in Stackoverflow in the first time:)

I would like to ask your helps, because i can't find any solution and documentation about my problem:( I want to make a script for myself, with i can add instanced custom turbosmooth modifier for objects. These will use paramteres from a custom attribute on rootnode. With this i can manipulate all of the turbosmooths on my highpolys from my dialog. I know it can be easier if i just put an object in the scene with turbosmooth, and instance from it, but i don't want to add any node to the viewport for this. And other hand, i just want to learn some tricks:)

So my problem is, if i just add a simple spinner to control the iteration separatedly, the modifier stop updating itself compare to the original TS. I don't really know why the custom rollout kill the auto mesh update. Maybe i can add an 'update $' or something after the delegate, but it won't work, if it need to run on instanced objects.

plugin modifier myMod
name:"BTSmooth"
classID:#(0x753e4721, 0x1d99e401)
extends:turbosmooth replaceUI:false version:1
(
  parameters main rollout:params
  (
    Iterats type:#integer animatable:true ui:Iterats default:1
    on Iterats set val do 
    (
        delegate.iterations = val
    )
  )
  rollout params "BTSmooth"
  (
    spinner Iterats "Iterat " type:#integer range:[0,4,2]
  )
)
Kalle Richter
  • 8,008
  • 26
  • 77
  • 177
Sanislov
  • 23
  • 4

1 Answers1

1

If you try to extend turbosmooth, it stops working. If you plan to have one CA to control everything, you can just as well assign a bezier_float controller to its parameter and instance this controller instead. Let's say:

ts = TurboSmooth()
ts.iterations.controller = path_to_your_param.controller
addModifier objs ts

First you can of course test if there's already some turbosmooth modifier dependent on this controller in the scene and only if there's none, create a new one:

ts = for d in refs.dependents path_to_your_param.controller where isKindOf d TurboSmooth do exit with d
if not isKindOf ts TurboSmooth do ts = TurboSmooth()
Swordslayer
  • 2,061
  • 1
  • 13
  • 15