PDA

View Full Version : sweep modifer dynamic properties


em3
03-07-2012, 06:16 PM
Hi! I am trying to avoid having to code in all of the properties of each sweep type (1,2,3,4...)

right now I have


case sweepType of
(
10: --Ibeam
(
local swp = sweep()
addmodifier thePath swp
swp.CurrentBuiltInShape = sweepType
classOf thePath
local p = swp[4].object
case theAxis of
(
1:
(
p.wide_flange_width = (obb[2]) as float
p.wide_flange_length = (obb[3]) as float
)
2:
(
p.wide_flange_width = (obb[1]) as float
p.wide_flange_length = (obb[3]) as float
)
3:
(
p.wide_flange_width = (obb[1]) as float
p.wide_flange_length = (obb[2]) as float
)
)
)


I have to do this for each type. Is there a way to loop through the properties of the modifier and grab the length and width?

Thanks!

PEN
03-07-2012, 08:44 PM
getPropNames, getProperty, setProperty

Is that what you are looking for?

em3
03-07-2012, 08:52 PM
Hi Paul, thanks!

Those certainly look like the ones. Hard to believe I couldn't find those after a moderately determined search.

So basically I will say,
(pseudo)

for prop in getPropNames where (getPropNames[prop] == "*width") do p.getPropNames[prop] = (obb[1])
--or whatever


I will try it out, thanks!

PiXeL_MoNKeY
03-07-2012, 09:16 PM
More like something like this:for prop in (getpropnames swp[4]) where (matchpattern (prop as string) pattern:"*width") do (setproperty swp[4] prop 8.0)Where the width parameter is set to the value of 8.0. Remember that property and propname properties return name values and should be converted to a string and tested with something like matchpattern. Also, as you previously found out the 4th subanim of the sweep modifier is where the properties of the built-in sections are stored. You will need to also test if it is in built-in mode or not, as the custom section doesn't have a 4th subanim.

-Eric

em3
03-07-2012, 09:39 PM
Awesome Eric, thank you for the clarification!

CGTalk Moderation
03-07-2012, 09:39 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.