Variable Definition Confusion

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  11 November 2011
Variable Definition Confusion

fn updateMods selected property state modClass =
		for s in selected do for m in s.modifiers where classOf m == modClass do
		( = state

property = enabled
list = turbosmoothTool.findModifierObjects turboSmooth
selected = turbosmoothTool.findSelectedObjects list turboSmooth
turbosmoothTool.updateMods selected property enabledCBState turboSmooth

So this is a snippet of the code I'm working on, and I can't figure out how to define property variable to have the right value. Right now it is just making the undefined variable of property into the undefined variable of enabled, solving nothing. What I'm trying to do is get = state to essentially be equal to turbosmooth.enabled = true but in context will run entirely different depending on what variables are sent to the function.

So I need a way to define a variable with the actual executable enabled, or for that matter any property of any potential modifier.
  11 November 2011
You could pass the property as a string and then use setProperty.

property = "enabled"

setProperty m property state
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
  11 November 2011
Fantastic! That worked perfectly, thank you very much.
  11 November 2011
better yet, pass it as a name (#enabled instead of "enabled")
  11 November 2011
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:45 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.