PDA

View Full Version : Colorslider and rearranging the attribute editor


JockeP
01-09-2008, 11:59 AM
Hi!

We are starting up a second season on a project Im part in. To make things simpler we have worked out some new shaders and stuff, but there are some things we wish to make even simpler. These are some problems we havent figured out how to solve yet:

1: I would like to add a new attribute in my Blinnshader that uses a Colorslider to control a rampcolor which lies earlier in the input connections. I am only getting 3 boxes with the "Vector" Data type, I would like to have a colorslider there instead so I can use the colorpicker.

2: When this is done Id like to rearrange in the attribute editor. I want to have those controls in the top when I open my Blinn in the Attribute editor. And maybe even hide all the attributes that I dont need.

Any help whatsoever is welcomed.

The result should look something like this:

Gravedigger
01-09-2008, 03:39 PM
why do you even need a ramp? you could define just two colors with the slider. it doesn't seem that you'd be able to create more than two colors for the shader because then there would't be enough sliders. or will this be adjusted dynamicly?

i have the same problem with the rearranging the attributes as you do but i haven't found a solution yet. maybe you need to create a new window with its layout for this but i don't know.

JockeP
01-10-2008, 08:20 AM
why do you even need a ramp? you could define just two colors with the slider. it doesn't seem that you'd be able to create more than two colors for the shader because then there would't be enough sliders. or will this be adjusted dynamicly?


The ramp is used for some reasons. For example, if I would need a third color on the shader I couldnt do it with just the 2 sliders. And the ramp also controls where on the shader the 2 colors should meet (the vCoord attribute). There wont be any need to have the sliders made dynamicly since we will use 2 colors on 98% of the shaders. In the other 2% we can just go into the ramp and control everything there. But since 1 click is faster than 2 clicks we want all the controls in the Blinnshader.

siproductions
01-22-2008, 12:40 AM
You can add attributes with the addAttr command through mel. But these will only show up under the extra attributes tab.

heres a way to add a color slider attribute to a blinn node

addAttr -longName RampTest -usedAsColor -attributeType float3 blinn1;
addAttr -longName redRamp -attributeType "float" -parent RampTest;
addAttr -longName greenRamp -attributeType "float" -parent RampTest;
addAttr -longName blueRamp -attributeType "float" -parent RampTest;

I think it'd be wiser to just create a custom window that your artists can pull up and access only the important controls. This will give you full control over the layout and allow you to easily connect the controls to multiple attributes across any nodes, objects or materials.


*edit* It appears you can edit the AEtemplate for a node. Might be worth looking into.

siproductions
01-22-2008, 05:00 AM
ok so I got a sec to sit down tonight and take a look at this and I got this to work. I had to go into the AEtemplate for the Lambert shader actually since the AEtemplate for the blinn just calls the Lambert mel before adding a few things. I added this code to the script before it starts to declare all the basic attrs for a lambert.


editorTemplate -beginLayout "Commonly Used Controls" -collapse 0;
editorTemplate -addControl "RampTest1";
editorTemplate -addControl "RampTest2";
editorTemplate -endLayout;


btw the file that I edited is located here on my machine:
C:\Program Files\Autodesk\Maya2008\scripts\AETemplates\AElambertCommon.mel

After that when you create a blinn in maya you have to add the attributes to it. I just used a very fast and dirty code:

addAttr -longName RampTest1 -usedAsColor -attributeType float3 blinn1;
addAttr -longName redRamp1 -attributeType "float" -parent RampTest1;
addAttr -longName greenRamp1 -attributeType "float" -parent RampTest1;
addAttr -longName blueRamp1 -attributeType "float" -parent RampTest1;


addAttr -longName RampTest2 -usedAsColor -attributeType float3 blinn1;
addAttr -longName redRamp2 -attributeType "float" -parent RampTest2;
addAttr -longName greenRamp2 -attributeType "float" -parent RampTest2;
addAttr -longName blueRamp2 -attributeType "float" -parent RampTest2;

As soon as you creat the attrs they show up in the Attribute editor where they should. I have attached a quick screen grab of my results.

You would want to have a script job or something like that that will always run and whenever you add a Blinn it will add these attributes to it if they don't exist. Thats up to you. Sorry for the long post.

Cheers :)

JockeP
01-22-2008, 10:19 AM
Thanks alot siproductions, Ill try the codes after Ive finished rendering.

The screenshot looks exactly as the result I was looking for :)

Edit: Tried it now and it works great, all the guys in the office says thanks :)

CGTalk Moderation
01-22-2008, 10:19 AM
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.