Advertisement

You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Python Scripting - How to Create and Assign a Material Shader

0

Darkfall writes:

In this video, we will be taking a look at not only creating a Shader Material but also assigning that material to the currently selected object.

We can create something simple or something complex but both ways will be using an Operator.

We first create a panel where our button will live. Then we can create a simple operator, that when pressed will create and assign a Shader Material to the Selected Object.

If you want the user to have any options, we can easily upgrade the simple operator and make it become a popup dialog box. We can then giver the user control over any setting or option. In this example we want the user to be able to set the color before adding the Shader.

We have covered popup dialog boxes in other posts and videos so be sure to check them out!. Though in this example we will be taking a look at the FloatVectorProperty. We will be changing the Sub Type of the Property in order to make it not only look better but it will help with the users experience when using the Operator.

You can check out the Blog Post here.

If you want to download the template script, you can find it here.

I hope you find this video helpful and as always, thanks for reading!

About the Author

Avatar image for John Brook
John Brook

I make Youtube tutorials for blender Users. From CG and VFX to Animations, Shorts and Asset Creation. I upload tutorials once a week along with any assets we create for you to use in your own projects.

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.

Advertisement

×