CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 12-25-2012, 10:13 PM   #1
Animare
Still learning...
 
Animare's Avatar
portfolio
Shan Joseph
None
Animare
Australia
 
Join Date: Jun 2002
Posts: 373
Send a message via MSN to Animare
Question Confused with Colours

Ok, I'm so close...


What I'm trying to do is have a colour picker change the first colour of a falloff map, and then have the second colour of the falloff map be a slightly darker version of the colour.

colorpicker theColor "Colour" color:[0,0,255] modal:false pos:[500,500]
on theColor changed new_col do
(
meditMaterials[1].texmap_diffuse.color1 = new_col
meditMaterials[1].texmap_diffuse.color2 = new_col.value - 50
)

Now from what I've been reading up from the maxscript help is that colors are 3point values. However the color component properties such as H.S.V are floats. So what I was trying to do here is decrease the value by 50, yet it comes back with a "Unable to convert to Point 3" error...

What am I misunderstanding?

Thanks

And Merry Christmas!
 
Old 12-25-2012, 11:56 PM   #2
lucpet
Know-it-All
 
lucpet's Avatar
portfolio
Luke Pettit
Canberra, Australia
 
Join Date: Oct 2006
Posts: 378
Quote:
Originally Posted by Animare
Ok, I'm so close...


What I'm trying to do is have a colour picker change the first colour of a falloff map, and then have the second colour of the falloff map be a slightly darker version of the colour.

colorpicker theColor "Colour" color:[0,0,255] modal:false pos:[500,500]
on theColor changed new_col do
(
meditMaterials[1].texmap_diffuse.color1 = new_col
meditMaterials[1].texmap_diffuse.color2 = new_col.value - 50
)

Now from what I've been reading up from the maxscript help is that colors are 3point values. However the color component properties such as H.S.V are floats. So what I was trying to do here is decrease the value by 50, yet it comes back with a "Unable to convert to Point 3" error...

What am I misunderstanding?

Thanks

And Merry Christmas!


Do you have a scene you could post with all the code? I'm trying to guess what you are trying to do this to but keep getting errors myself.

Code:
meditMaterials[1][#Maps][#Diffuse_Color__Map__1____Falloff].color1 meditMaterials[1][#Maps][#Diffuse_Color__Map__1____Falloff].color2
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram

 
Old 12-26-2012, 01:38 AM   #3
Animare
Still learning...
 
Animare's Avatar
portfolio
Shan Joseph
None
Animare
Australia
 
Join Date: Jun 2002
Posts: 373
Send a message via MSN to Animare
Thumbs up

Thanks! Didn't expect a reply today, so definitely appreciated

I've condensed the scene and it is attached.

Also getting frustrated with materials, is there a way to reference materials the same way as objects, currently I am just going through the listener and selecting it through material editor slots

so for this example I have a material named 'mat', I thought selecting it would be similar to selecting an object e.g $mat.diffuse = colour 1 1 1 or something.

Please also find the script below :
------------------------------------------------------------------------------------------------------------------
try (closeRolloutfloater ColourChanger) catch()
rollout ColourFall "Colour"
(
colorpicker theColor "Colour" color:[0,0,255] modal:false
on theColor changed new_col do
(
meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color1 = new_col
meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color2 = new_col
)
)
ColourChanger = newrolloutfloater "Main" 500 565
addrollout Colourfall ColourChanger
Attached Files
File Type: zip colour_fallof.zip (19.1 KB, 1 views)

Last edited by Animare : 12-26-2012 at 01:52 AM.
 
Old 12-26-2012, 03:23 AM   #4
lucpet
Know-it-All
 
lucpet's Avatar
portfolio
Luke Pettit
Canberra, Australia
 
Join Date: Oct 2006
Posts: 378
Try this

I'm multitasking watching Sri Lanka get their arses handed to them and surfing the net.

Code:
try (closeRolloutfloater ColourChanger) catch() rollout ColourFall "Colour" ( local col = (Random 0 255) colorpicker theColor "Colour" color:[col,col,col] modal:false on theColor changed new_col do ( meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color1 = new_col meditMaterials[1][#Maps][#Diffuse_Color__Map__2____Falloff].color2 = new_col/2 ) ) ColourChanger = newrolloutfloater "Main" 200 100 addrollout Colourfall ColourChanger
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram


Last edited by lucpet : 12-26-2012 at 04:38 AM.
 
Old 12-26-2012, 05:24 AM   #5
Animare
Still learning...
 
Animare's Avatar
portfolio
Shan Joseph
None
Animare
Australia
 
Join Date: Jun 2002
Posts: 373
Send a message via MSN to Animare
Hahah nice, yes its a nice gloomy day for watching cricket!

Thanks for that, so simple....didn't even think of that I'll try it out!
 
Old 12-26-2012, 06:54 AM   #6
lucpet
Know-it-All
 
lucpet's Avatar
portfolio
Luke Pettit
Canberra, Australia
 
Join Date: Oct 2006
Posts: 378
Quote:
Originally Posted by Animare
Hahah nice, yes its a nice gloomy day for watching cricket!

Thanks for that, so simple....didn't even think of that I'll try it out!


You can perform all sorts of maths, divide, multiply, subtract etc. Try it out along with
different numbers.
Don't forget to (like I did) to change this number if you change things lol
[#Diffuse_Color__Map__!!!2!!!____Falloff]
If you could use the code symbol when you are posting code everyone's life
is made much easier.
The Hash symbol above where all the text formatting stuff is just highlight your
code and click it, it will format it for you.
Code:
Ramdom 0 255
__________________
Luke
Web site

3d Max 2012 Win 7
Intel Corei5 8g Ram

 
Old 12-27-2012, 07:52 AM   #7
Animare
Still learning...
 
Animare's Avatar
portfolio
Shan Joseph
None
Animare
Australia
 
Join Date: Jun 2002
Posts: 373
Send a message via MSN to Animare
Thanks! Will do, sorry about the code quote, I'll add that from now on

Code:
if problem = solved then say thanks else beg some more
 
Old 12-27-2012, 07:52 AM   #8
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:14 PM.


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