Refresh object parameter (more info...)

hi all man and thanks for and thanks for the visit :)

I have completed another script and I'm completing the final steps (debug and more options). Now it is a problem. The script provides for the creation of a obj plane "general" called mr_plane and a map environmet. With its creation of plane (and map env), I active every spinner etc .. because I want it to be created first. Now If I close the rollot and re-open it, the spinner ecc are desabled. I know many ways to refresh parameters ecc, but are now bogged down..

My question is:

How to recognize the presence of the plane (and evironment) and activate all parameters? The problem is if the plane is renamed AFTER its creation and if there exists a map environment different or equal...

Any suggestion is welcome! Thanks!!

P.S: I attach the script to be consulted :)

AttachmentSize
env_light_hdr.ms10.61 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Michele71's picture

Hi Branko :) Bad news, the

Hi Branko :)

Bad news, the your script (thanks again :)) dont work!! The parameters dont refresh... I try the function "defPlaneCA node" on new script very simple:

try (destroydialog :: tes) catch()
 
rollout tes "Test"
(
	Global Cubo 
 
	button pl  "Button"
	spinner sp1 "Sp1" range: [0,200,10]
	spinner sp2 "Sp2" range: [0,200,10]
 
					fn defCuboCA node =
	(
		local mrpCA = attributes cubo_piano
		(
			fn getMRPlaneData =
			(
				local mrp = (refs.dependentNodes ((refs.dependents this)[1]))[1]
				if isValidNode mrp and iskindOf tes RolloutClass and tes.open do
				(
					tes.sp1.value = Cubo.length; tes.sp2.value = Cubo.width
 
				)
			)
		)
		custAttributes.add node mrpCA
	)
 
 
	on pl pressed do
	(
		Cubo = box length:10 width:10
		Cubo.material = Arch___Design__mi ()
		defCuboCA Cubo
	)
 
	on sp1 changed val do if isValidNode Cubo do Cubo.length = sp1.value
		on sp2 changed val do if isValidNode Cubo do Cubo.width = sp2.value
 
 
		on tes open do
	(
		local mrpArr = for o in geometry where isProperty o #cubo_piano collect o
		if mrpArr.count > 0 do
		(
			Cubo = mrpArr[1]
			Cubo.cubo_piano.getMRPlaneData()
		)
	)
)
createdialog tes

The function here work well, but in your example, no.

I noticed that at the function (the first time in new script) gave me error "IsKindOf" where he found three but was looking for two!! Very strange because value is tes and class rolloutclass then right. I do not think that is the position of the function in the script is wrong... In your opinion, where is the error?

barigazy's picture

...

Which parameters not refresh?
I did'nt make the code where you can change material properties in material editor and refresh parameters in rollout. Same things for plane render scale in command panel not refresh same spiner value in your rollout.
For that you can use Timer control bat this is another story.
Your example works because U declared your "Cubo" as global var. Your method not work if you save scene and close/open max and load the same scene and then run script again.
I "getMRPlaneData" function variable "mrp" represents your cube object which holds CA. So u can use

if isValidNode mrp and iskindOf tes RolloutClass and tes.open do
(
    tes.sp1.value = mrp.length; tes.sp2.value = mrp.width
)

One more thing. You use max2010. This version probably not supports many things which are available in max2014, related to mxs

admin

Michele71's picture

Heheheeh the spinner,

Heheheeh the spinner, checkboxes ecc are disabled (as in the original) whe re-open the script. As you suggested, I opened the script, created the plane and changed some values in rollout. Closed and reopen the script. The rollout is "closed".

That's why I created a new script, to try to see if the fn that you wrote worked (I have not create any change in Material Editor etc.)
In my work, I have had a chance to test your test script in max2015 64bit, and does not work. Reading in the help, there are differences with the 2010 version (at least not dictated from Autodesk) about CA, but this can not be safely...

Honestly, this opportunity to refresh with CA fascinates me a lot, since it can be convenient in many cases. I discovered something new very useful.

Thanks for the suggestion referred to the "Cubo", I have not thought that if I save scene and close/open max and load the same scene its dont work.

Thanks again Branko and sorry for the trouble :(

P.S: your script for the grid, the first time I installed it worked very well!!!

AttachmentSize
untitled.gif 188.71 KB
barigazy's picture

...

You are right. It's very wierd. Function inside CA is ok but not works. I don't know why.
Anyway...I manage this to works. I left CA only for mr_plane recognition and for label :)

AttachmentSize
env_light_hdr_fix.ms 12.41 KB

admin

Michele71's picture

Hahahah the function does not

Hahahah the function does not work in CA is really strange!!!

Thanks Branko, now work well :)Parameters and rollout refresh and and I'm happy!!!

Now try with the environment map, and I try to implement your recommendations and suggestions. I learned a lot, thanks! I leave this thread open for future updates ;)

I'm sorry again for the inconvenience and thank you very much!

barigazy's picture

...

U can use custAttribute which contains all rollout parameters of the plane and env map. When u close rollout this CA will be added on the plane.When you load the script again in the "open" event you need to add fn that will check if plane CA exists and load all parameters back

admin

Michele71's picture

Hi barigazy and thanks for

Hi barigazy and thanks for you reply (sorry for delay). I have not thought of this way for re-check the parameters. Now I try and see if I can use CA, otherwise I must use another method :(

Thanks for reply and support :)

barigazy's picture

...

See how I use CA for this tool
http://www.scriptspot.com/3ds-max/scripts/gridtm-addon
U can add one parameter in ParameterBlock like stringTab or soo to store data of your rollout.

admin

Michele71's picture

Ok, I have understand how it

Ok, I have understand how it works CA, but but I have a question that is not answered: I can enter a CA in a Rollout without create un modifier in the object?? Yes I can but...

If I check with

custAttributes.count p baseobject:false

the object plane, CA "testBox" is known and no modifier is applied (because obviously not created)

es.

rollout prova "Test"
(
	button bb ""
	spinner sp1 "L" range:[0,100,10] enabled:false
	spinner sp2 "W" range:[0,100,10] enabled:false
 
 
	on bb pressed do
	(
		p = plane name:"test_plane" 
		p.Length =sp1.value
		p.Width = sp2.value
		sp1.enabled = true
		sp2.enabled = true
 
		testBoxCA = attributes testBox
(
parameters main rollout:prova
			(
 
			)
rollout prova "Test" 
(
 
)
)
custAttributes.add p testBoxCA baseobject:false 
 
)
	on sp1 changed val do p.Length =sp1.value
	on sp2 changed val do p.Width = sp2.value
 
	on prova open do
 
	(
 
	)
 
)
createdialog prova

but I do not understand how the main "parameters" is updated, while if I create a modifier (attribute holder) con CA there are no problems... Where I am wrong?

PS: This is the first time I use a plug-in MAXScript and I have read dozens of pages helpscript tonight... every time I create a shred of script, opens a new world !! :-D

Michele71's picture

Thanks again, I check and

Thanks again, I check and study your tool. I hope to get on top of the problem :-D

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.