This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/ObjectDiffuseStencil" { | |
Properties { | |
_Color("Color", Color) = (1,1,1,1) | |
_myDiffuse ("Diffuse Texture", 2D) = "white" {} | |
_myBump ("Bump Texture", 2D) = "bump" {} | |
_mySlider ("Bump Amount", Range(0,10)) = 1 | |
_SRef("Stencil Ref", Float) = 1 | |
[Enum(UnityEngine.Rendering.CompareFunction)] _SComp("Stencil Comp", Float) = 8 | |
[Enum(UnityEngine.Rendering.StencilOp)] _SOp("Stencil Op", Float) = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import pi | |
from random import random | |
import bpy | |
def delete_object(name): | |
if name in bpy.data.objects: | |
obj = bpy.data.objects[name] | |
obj.select_set(True) | |
bpy.ops.object.delete(use_global=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
public class GIDisabler : EditorWindow | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try (closeRolloutFloater MainFloater) catch() | |
rollout LODCheck "LOD Checker" | |
( | |
spinner lodNumberSpinner "Max LOD number" type:#integer range:[0,5,3] align:#left | |
spinner reductionSpinner "Reduction percentage" type:#integer range:[0,100,50] align:#left | |
global nodeArray = #() | |
global reductionPercentage = 50 | |
global maxLOD = 3 | |
label menuLabel "Select an object/layer from layer explorer" align:#left |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def replace_material(obj, obj_data, mat_src, mat_dst): | |
""" | |
replace a material in blender. | |
""" | |
print("ob is", obj) | |
for i in range(len(obj_data.materials)): | |
# test if the old material is in the slot and replace it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def repositionChildrenToPivot(): | |
coll = bpy.context.collection | |
# Iterate on all object, separate into list of objects, pivot, shadow catcher | |
objectList = [] | |
pivot = None | |
shadowCatcher = None | |
for c in coll.all_objects: | |
if ("Pivot" in c.name): | |
pivot = c | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def renameCollection_2(): | |
categoryColl = bpy.context.collection | |
categoryName = categoryColl.name | |
pivotObject = None | |
shadowCatcherObject = None | |
prefix = "Prefix_" | |
if (checkCollectionNaming(categoryColl.name) == True): | |
# Set naming for collection | |
for childColl in categoryColl.children: | |
objectName = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def matchPlaceholderName(): | |
# Function to rename placeholder to match the category name | |
# Select props collection | |
placeholderString = "Placeholder" | |
propsColl = bpy.context.collection | |
categoryArray = [] | |
placeholderArray = [] | |
placeholderCollection = bpy.data.collections[placeholderString] | |
if (propsColl.name == "Props"): | |
# Fill both array |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "UI/Procedural UI Image 2" | |
{ | |
Properties | |
{ | |
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} | |
_Color ("Tint", Color) = (1,1,1,1) | |
_Fade ("Fade", Float) = 1 | |
_StencilComp ("Stencil Comparison", Float) = 8 | |
_Stencil ("Stencil ID", Float) = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def create_material(color_name, color): | |
# Create a new material with the given color | |
mat = bpy.data.materials.new(name=color_name) | |
mat.use_nodes = True | |
nodes = mat.node_tree.nodes | |
principled_bsdf = nodes.get("Principled BSDF") | |
if principled_bsdf is not None: |
OlderNewer