Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/material.c
| Show First 20 Lines • Show All 1,956 Lines • ▼ Show 20 Lines | static void material_default_gpencil_init(Material *ma) | ||||
| BKE_gpencil_material_attr_init(ma); | BKE_gpencil_material_attr_init(ma); | ||||
| add_v3_fl(&ma->gp_style->stroke_rgba[0], 0.6f); | add_v3_fl(&ma->gp_style->stroke_rgba[0], 0.6f); | ||||
| } | } | ||||
| static void material_default_surface_init(Material *ma) | static void material_default_surface_init(Material *ma) | ||||
| { | { | ||||
| strcpy(ma->id.name, "MADefault Surface"); | strcpy(ma->id.name, "MADefault Surface"); | ||||
| bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); | bNodeTree *ntree = ntreeAddTreeEmbedded( | ||||
| ma->nodetree = ntree; | NULL, &ma->id, "Shader Nodetree", ntreeType_Shader->idname); | ||||
| ma->use_nodes = true; | ma->use_nodes = true; | ||||
| bNode *principled = nodeAddStaticNode(NULL, ntree, SH_NODE_BSDF_PRINCIPLED); | bNode *principled = nodeAddStaticNode(NULL, ntree, SH_NODE_BSDF_PRINCIPLED); | ||||
| bNodeSocket *base_color = nodeFindSocket(principled, SOCK_IN, "Base Color"); | bNodeSocket *base_color = nodeFindSocket(principled, SOCK_IN, "Base Color"); | ||||
| copy_v3_v3(((bNodeSocketValueRGBA *)base_color->default_value)->value, &ma->r); | copy_v3_v3(((bNodeSocketValueRGBA *)base_color->default_value)->value, &ma->r); | ||||
| bNode *output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); | bNode *output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); | ||||
| Show All 10 Lines | static void material_default_surface_init(Material *ma) | ||||
| nodeSetActive(ntree, output); | nodeSetActive(ntree, output); | ||||
| } | } | ||||
| static void material_default_volume_init(Material *ma) | static void material_default_volume_init(Material *ma) | ||||
| { | { | ||||
| strcpy(ma->id.name, "MADefault Volume"); | strcpy(ma->id.name, "MADefault Volume"); | ||||
| bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); | bNodeTree *ntree = ntreeAddTreeEmbedded( | ||||
| ma->nodetree = ntree; | NULL, &ma->id, "Shader Nodetree", ntreeType_Shader->idname); | ||||
| ma->use_nodes = true; | ma->use_nodes = true; | ||||
| bNode *principled = nodeAddStaticNode(NULL, ntree, SH_NODE_VOLUME_PRINCIPLED); | bNode *principled = nodeAddStaticNode(NULL, ntree, SH_NODE_VOLUME_PRINCIPLED); | ||||
| bNode *output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); | bNode *output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); | ||||
| nodeAddLink(ntree, | nodeAddLink(ntree, | ||||
| principled, | principled, | ||||
| nodeFindSocket(principled, SOCK_OUT, "Volume"), | nodeFindSocket(principled, SOCK_OUT, "Volume"), | ||||
| output, | output, | ||||
| nodeFindSocket(output, SOCK_IN, "Volume")); | nodeFindSocket(output, SOCK_IN, "Volume")); | ||||
| principled->locx = 10.0f; | principled->locx = 10.0f; | ||||
| principled->locy = 300.0f; | principled->locy = 300.0f; | ||||
| output->locx = 300.0f; | output->locx = 300.0f; | ||||
| output->locy = 300.0f; | output->locy = 300.0f; | ||||
| nodeSetActive(ntree, output); | nodeSetActive(ntree, output); | ||||
| } | } | ||||
| static void material_default_holdout_init(Material *ma) | static void material_default_holdout_init(Material *ma) | ||||
| { | { | ||||
| strcpy(ma->id.name, "MADefault Holdout"); | strcpy(ma->id.name, "MADefault Holdout"); | ||||
| bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); | bNodeTree *ntree = ntreeAddTreeEmbedded( | ||||
| ma->nodetree = ntree; | NULL, &ma->id, "Shader Nodetree", ntreeType_Shader->idname); | ||||
| ma->use_nodes = true; | ma->use_nodes = true; | ||||
| bNode *holdout = nodeAddStaticNode(NULL, ntree, SH_NODE_HOLDOUT); | bNode *holdout = nodeAddStaticNode(NULL, ntree, SH_NODE_HOLDOUT); | ||||
| bNode *output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); | bNode *output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); | ||||
| nodeAddLink(ntree, | nodeAddLink(ntree, | ||||
| holdout, | holdout, | ||||
| nodeFindSocket(holdout, SOCK_OUT, "Holdout"), | nodeFindSocket(holdout, SOCK_OUT, "Holdout"), | ||||
| ▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines | |||||