Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4171

Interactive Palette Color of materials for Display Color and Layer Color

$
0
0

This script was conceived for use the interactive palette color of materials to edit the Display Color and Layer Color in Shaded Mode.

All work occurs in Shaded Mode or any other mods without support displaying the render materials.



How it should work.

The selected object should be switched temporarily to the Rended mode. Inside the script actions something like this: _Setobjectdisplaymode _pause “Rended”.
And necessary to create a new Custom material. Take an RGB from the current display color with the material settings matches your Shaded Mode settings. And temporarily give this material to the object.

I have default settings:

Material name = ShadedMode
Material type = Custom
Material color = Current RGB by Display Color (if the start be next time)
Gloss Finish = 50
Reflectivity = 0
Transparency = 0
Environment = 30
Map = "C:\Program Files\Rhino 7\System\rhino_shaded_mode_emap_background.png"

You may have other settings. Material settings you can see below:
Options - View - Dysplay Modes - Shadeed - Shading Settings - Custom Object Attributes Settings.
Then new Custom material will be displayed according to your Saded Mode settings.

To simulate the material that is used the Shaded Mode, is only suitable the Custom Type. I tried all the types, but only Custom has an Environment option that creates lighting in Shaded Mode. All other types are not suitable for simulating the material that use Shaded Mode.

I’ve been fought for two days to create a Custom Type, but I didn’t succeed in anything sensible. I read all the topics on the forum related to the creation the material, but didn’t find a suitable Custom Material code to be use for modifications.
The forum has several beautiful codes with attributes by @nathanletwory but it for Physically Based, Plastic and Double Sided for metals.

Nathan's code (click for more details)

I could not figure out how to adapt these codes for Custom material. If I change the lines:

Rhino.render.rendermaterial.plastermaterialguid 
Rhino.render.rendermaterial.metalmaterialguid
rr.Contentuuids.physicalbosedMaterialtype

to
Rhino.render.rendermaterial.createbasicmaterial

Then all the time, and always I get an error.
However, I managed to change the primitive code.

My code (click for more details)

If we can get the code for creating Custom material with required attributes, then the next action of the script should open the “Material Color Palette” and the user will be able to configure the color.

After the color configured and the user pressed “ok” button and Color Palette closes then the Mitch’s code comes in. This code takes the color from RGB material and gives it to the Display Color in the Object Properties or layer Color.

Code by Mitch (click for more details)

Сomplete script should be possible to give the RGB to the Display Color, and return the object to the usual display mode. Inside the script actions something like this: _SetObjectDisplayMode _Pause _Mode=_UseView.

In order not to knock down the current settings and do not produce a lot of materials in the library, the script must delete a temporary material or temporary layer and return the object material that was before. Since maybe the user has already set up Render, the material assigned to the object or layer for other purposes. For example, metal or glass for the Rhino Render or other.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4171

Latest Images

Trending Articles



Latest Images