Condensing code

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 08 August 2011   #1
Functions - Adjusting properties bug

I'm recently posed a script here.
I'm working on condensing the code and I'm trying to make a function that does just that.
This is bugging out and I'm not sure exactly how to solve it.
http://jokermartini.com/extras/217/Welder

The setup. A spline object has a displace modifier on it and then the displace mod has a cellular map in the map slot.

Then run this function with the object selection.


	fn fnDisplaceModChange prop val =
	(
		undo on (
			for i = 1 to selection.count do
			(
				Obj = selection[i]
				for m in Obj.modifiers where (classOf m == Displace) and (classof m.map == Cellular) do
				m.prop = val
			)
		)
	)
	
fnDisplaceModChange (map.size) 50
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com

Last edited by JokerMartini : 08 August 2011 at 07:40 PM.
 
Old 08 August 2011   #2
Originally Posted by JokerMartini:

 	fn fnDisplaceModChange prop val =
 	(
 		undo on (
 			for i = 1 to selection.count do
 			(
 				Obj = selection[i]
 				for m in Obj.modifiers where (classOf m == Displace) and (classof m.map == Cellular) do
 				setproperty m prop val
 			)
 		)
 	)
 	
 fnDisplaceModChange #size 50
 


it was wrong using of property name, and setting a property
 
Old 08 August 2011   #3
Understandable

Thank you for clearing that up Denis.
I was wondering why it was not working vs when it would work when it was outside of the function.

Thanks
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 08 August 2011   #4
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 03:04 PM.


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