View Full Version : refresh Hypershade?! my shader doesn't appear :[

10 October 2004, 12:36 PM
ok! Since my thread on highend3D didn't yield any fruits. I try it here :scream: (besides here are the better smileys!)

For workflow-purposes I first wrote a script wich creates a new lambertshader and just opens up a dialogue for browsing for a texture, when the textue is chosen, the script assigns the texturefilename to the new shader. Now I had a new Idea! : I just pick an object, run the script and the object has got the chosen texture on it.

Now my only problem is:
If you got your Hypershade minimized like I always do, this new shader doesn't arise when created with that script. You either have to select "textures" and "materials" again or close and open up the HyperShade again to see the new shader.

I crawled for a simple funktion that just refreshes the panel, but it all doesn't seem to work.

Any Ideas?

You can find the script here:
createNewLambertWithTex.mel (

But use it at your own risc! I mean thats a bug that prevents me from releasing it, even if its quite cool so far: Pick object Pick texture - ready

10 October 2004, 06:53 PM
What do you mean when you say that the new material doesn't arise? It doesn't get created? I'm not sure I understand why it's important to the functioning of the material creation script that the hypershade panel be refreshed.

10 October 2004, 09:10 PM
Hey lilli! Thanx for your interest. It has been almost solved.

Yea.. "...dosn't arise..." damn dictionary. Its a general problem: I meant: Only if you got the HyperShade minimized and you create a Material via script, eg:

shadingNode -asShader lambert;

Then you won't see the new Material, when you open up the HyperShade again.
So Joojaa from highend3D-MEL-forum told me to use:

hyperShadePanelGraphCommand("hyperShadePanel1", "showUpstream");

as some kind of "refresh" :) It seemes to work!
My only problem was: I use to hide the "Work Area"-Tab in Maya and that command always showed up both Top and Bottom Tab. But if you got your HyperShade that way another command with "showTopTabsOnly" instead of "showUpstream" fixes this.

Anyone thats got a better idea: Give it to me! :scream:

But for now its ready to release I think!
If you create a lot of game-assets for instance, you also create a lot of simple lambert-materials. And Its always the same: Open hypershade, create lambert, open attributes, click color connection, select file, click on the browse-icon, select your texture, select your object, rightclick material, "Assign To Selection" or MMB-drag the material to your object.

createNewLambertWithTex.mel (

This script puts it all into a mouseclick and a little more:

no HyperShade, just opens up the texture browse dialouge
+ assigns the new material to all objects selected
+ it renames the new material after the textures filename
+ its also useful to simply create a lambert (just esc/cancel dialouge)
+ built in Nebula2 toolkit for Maya (

Just put it in your scripts folder, and a "createNewLambertWithTex"-command on your shelf or a hotkey. Have Phun!

CGTalk Moderation
01 January 2006, 02:00 PM
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.