Cleanup: Nodes: Begin splitting shader node buttons into individual files
Currently, most node buttons are defined in `drawnode.cc` however, this is inconvenient because it requires editing many files when adding new nodes. The goal is to minimize the number of files needed to add or update a node. This commit moves most of the node layout functions for shader nodes into their respected source/blender/nodes/shader/nodes file. In the future, these functions will be simplified to node_layout. Some nodes were left in `drawnode.cc` as this would require duplicating code while this is likely fine it is best to leave that to a seperate commit.
This commit is contained in:
@@ -216,22 +216,6 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_clamp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "clamp_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "data_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "interpolation_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
if (!ELEM(RNA_enum_get(ptr, "interpolation_type"),
|
||||
NODE_MAP_RANGE_SMOOTHSTEP,
|
||||
NODE_MAP_RANGE_SMOOTHERSTEP)) {
|
||||
uiItemR(layout, ptr, "clamp", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
@@ -380,40 +364,6 @@ static void node_buts_image_user(uiLayout *layout,
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_vector_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "rotation_type", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, 0);
|
||||
}
|
||||
|
||||
static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_vect_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "convert_from", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "convert_to", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "attribute_type", DEFAULT_FLAGS, IFACE_("Type"), ICON_NONE);
|
||||
uiItemR(layout, ptr, "attribute_name", DEFAULT_FLAGS, IFACE_("Name"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_wireframe(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "use_pixel_size", DEFAULT_FLAGS, nullptr, 0);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
PointerRNA imaptr = RNA_pointer_get(ptr, "image");
|
||||
@@ -483,375 +433,21 @@ static void node_shader_buts_tex_environment_ex(uiLayout *layout, bContext *C, P
|
||||
uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, IFACE_("Projection"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "sky_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_PREETHAM) {
|
||||
uiItemR(layout, ptr, "sun_direction", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_HOSEK) {
|
||||
uiItemR(layout, ptr, "sun_direction", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "ground_albedo", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_NISHITA) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
if (BKE_scene_uses_blender_eevee(scene)) {
|
||||
uiItemL(layout, TIP_("Nishita not available in Eevee"), ICON_ERROR);
|
||||
}
|
||||
uiItemR(layout, ptr, "sun_disc", DEFAULT_FLAGS, nullptr, 0);
|
||||
|
||||
uiLayout *col;
|
||||
if (RNA_boolean_get(ptr, "sun_disc")) {
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "sun_size", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "sun_intensity", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "sun_elevation", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "sun_rotation", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
|
||||
uiItemR(layout, ptr, "altitude", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "air_density", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "dust_density", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "ozone_density", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "gradient_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "turbulence_depth", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_brick(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *col;
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "offset", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, IFACE_("Offset"), ICON_NONE);
|
||||
uiItemR(col, ptr, "offset_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "squash", DEFAULT_FLAGS, IFACE_("Squash"), ICON_NONE);
|
||||
uiItemR(col, ptr, "squash_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "wave_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
int type = RNA_enum_get(ptr, "wave_type");
|
||||
if (type == SHD_WAVE_BANDS) {
|
||||
uiItemR(layout, ptr, "bands_direction", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
else { /* SHD_WAVE_RINGS */
|
||||
uiItemR(layout, ptr, "rings_direction", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, ptr, "wave_profile", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "musgrave_dimensions", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "musgrave_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "voronoi_dimensions", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "feature", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
int feature = RNA_enum_get(ptr, "feature");
|
||||
if (!ELEM(feature, SHD_VORONOI_DISTANCE_TO_EDGE, SHD_VORONOI_N_SPHERE_RADIUS) &&
|
||||
RNA_enum_get(ptr, "voronoi_dimensions") != 1) {
|
||||
uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "noise_dimensions", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_pointdensity(uiLayout *layout,
|
||||
bContext *UNUSED(C),
|
||||
PointerRNA *ptr)
|
||||
{
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
NodeShaderTexPointDensity *shader_point_density = (NodeShaderTexPointDensity *)node->storage;
|
||||
Object *ob = (Object *)node->id;
|
||||
|
||||
PointerRNA ob_ptr, obdata_ptr;
|
||||
RNA_id_pointer_create((ID *)ob, &ob_ptr);
|
||||
RNA_id_pointer_create(ob ? (ID *)ob->data : nullptr, &obdata_ptr);
|
||||
|
||||
uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "object", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
|
||||
if (node->id && shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
|
||||
PointerRNA dataptr;
|
||||
RNA_id_pointer_create((ID *)node->id, &dataptr);
|
||||
uiItemPointerR(
|
||||
layout, ptr, "particle_system", &dataptr, "particle_systems", nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, ptr, "space", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "radius", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "resolution", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
|
||||
uiItemR(layout, ptr, "particle_color_source", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, ptr, "vertex_color_source", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTWEIGHT) {
|
||||
if (ob_ptr.data) {
|
||||
uiItemPointerR(
|
||||
layout, ptr, "vertex_attribute_name", &ob_ptr, "vertex_groups", "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTCOL) {
|
||||
if (obdata_ptr.data) {
|
||||
uiItemPointerR(
|
||||
layout, ptr, "vertex_attribute_name", &obdata_ptr, "vertex_colors", "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "object", DEFAULT_FLAGS, nullptr, 0);
|
||||
uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, nullptr, 0);
|
||||
}
|
||||
|
||||
static void node_shader_buts_bump(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, 0);
|
||||
}
|
||||
|
||||
static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, nullptr, 0);
|
||||
|
||||
if (!RNA_boolean_get(ptr, "from_instancer")) {
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
|
||||
if (U.experimental.use_sculpt_vertex_colors &&
|
||||
RNA_collection_length(&dataptr, "sculpt_vertex_colors")) {
|
||||
uiItemPointerR(
|
||||
layout, ptr, "layer_name", &dataptr, "sculpt_vertex_colors", "", ICON_GROUP_VCOL);
|
||||
}
|
||||
else {
|
||||
uiItemPointerR(layout, ptr, "layer_name", &dataptr, "vertex_colors", "", ICON_GROUP_VCOL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
uiItemL(layout, TIP_("No mesh in active object"), ICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "use_tips", DEFAULT_FLAGS, nullptr, 0);
|
||||
}
|
||||
|
||||
static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "space", DEFAULT_FLAGS, "", 0);
|
||||
|
||||
if (RNA_enum_get(ptr, "space") == SHD_SPACE_TANGENT) {
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, ptr, "uv_map", DEFAULT_FLAGS, "", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_displacement(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "space", DEFAULT_FLAGS, "", 0);
|
||||
}
|
||||
|
||||
static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *split, *row;
|
||||
|
||||
split = uiLayoutSplit(layout, 0.0f, false);
|
||||
|
||||
uiItemR(split, ptr, "direction_type", DEFAULT_FLAGS, "", 0);
|
||||
|
||||
row = uiLayoutRow(split, false);
|
||||
|
||||
if (RNA_enum_get(ptr, "direction_type") == SHD_TANGENT_UVMAP) {
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "uv_map", DEFAULT_FLAGS, "", 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_principled(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "subsurface_method", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_anisotropic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_subsurface(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "falloff", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_toon(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "component", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_hair(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "component", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_principled_hair(uiLayout *layout,
|
||||
bContext *UNUSED(C),
|
||||
PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "parametrization", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_ies(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *row;
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
|
||||
if (RNA_enum_get(ptr, "mode") == NODE_IES_INTERNAL) {
|
||||
uiItemR(row, ptr, "ies", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "filepath", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *row;
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
|
||||
if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_INTERNAL) {
|
||||
uiItemR(row, ptr, "script", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "filepath", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update");
|
||||
}
|
||||
|
||||
static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemS(layout);
|
||||
|
||||
node_shader_buts_script(layout, C, ptr);
|
||||
|
||||
#if 0 /* not implemented yet */
|
||||
if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) {
|
||||
uiItemR(layout, ptr, "use_auto_update", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void node_buts_output_shader(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "target", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_buts_output_linestyle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
row = uiLayoutRow(col, true);
|
||||
uiItemR(row, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_bevel(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_ambient_occlusion(uiLayout *layout,
|
||||
bContext *UNUSED(C),
|
||||
PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "inside", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "only_local", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "noise_dimensions", DEFAULT_FLAGS, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_buts_output_aov(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "name", DEFAULT_FLAGS, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
/* only once called */
|
||||
static void node_shader_set_butfunc(bNodeType *ntype)
|
||||
{
|
||||
@@ -868,9 +464,6 @@ static void node_shader_set_butfunc(bNodeType *ntype)
|
||||
case SH_NODE_CURVE_FLOAT:
|
||||
ntype->draw_buttons = node_buts_curvefloat;
|
||||
break;
|
||||
case SH_NODE_MAPPING:
|
||||
ntype->draw_buttons = node_shader_buts_mapping;
|
||||
break;
|
||||
case SH_NODE_VALUE:
|
||||
ntype->draw_buttons = node_buts_value;
|
||||
break;
|
||||
@@ -883,33 +476,9 @@ static void node_shader_set_butfunc(bNodeType *ntype)
|
||||
case SH_NODE_VALTORGB:
|
||||
ntype->draw_buttons = node_buts_colorramp;
|
||||
break;
|
||||
case SH_NODE_CLAMP:
|
||||
ntype->draw_buttons = node_shader_buts_clamp;
|
||||
break;
|
||||
case SH_NODE_MAP_RANGE:
|
||||
ntype->draw_buttons = node_shader_buts_map_range;
|
||||
break;
|
||||
case SH_NODE_MATH:
|
||||
ntype->draw_buttons = node_buts_math;
|
||||
break;
|
||||
case SH_NODE_VECTOR_MATH:
|
||||
ntype->draw_buttons = node_shader_buts_vect_math;
|
||||
break;
|
||||
case SH_NODE_VECTOR_ROTATE:
|
||||
ntype->draw_buttons = node_shader_buts_vector_rotate;
|
||||
break;
|
||||
case SH_NODE_VECT_TRANSFORM:
|
||||
ntype->draw_buttons = node_shader_buts_vect_transform;
|
||||
break;
|
||||
case SH_NODE_ATTRIBUTE:
|
||||
ntype->draw_buttons = node_shader_buts_attribute;
|
||||
break;
|
||||
case SH_NODE_WIREFRAME:
|
||||
ntype->draw_buttons = node_shader_buts_wireframe;
|
||||
break;
|
||||
case SH_NODE_TEX_SKY:
|
||||
ntype->draw_buttons = node_shader_buts_tex_sky;
|
||||
break;
|
||||
case SH_NODE_TEX_IMAGE:
|
||||
ntype->draw_buttons = node_shader_buts_tex_image;
|
||||
ntype->draw_buttons_ex = node_shader_buts_tex_image_ex;
|
||||
@@ -918,105 +487,20 @@ static void node_shader_set_butfunc(bNodeType *ntype)
|
||||
ntype->draw_buttons = node_shader_buts_tex_environment;
|
||||
ntype->draw_buttons_ex = node_shader_buts_tex_environment_ex;
|
||||
break;
|
||||
case SH_NODE_TEX_GRADIENT:
|
||||
ntype->draw_buttons = node_shader_buts_tex_gradient;
|
||||
break;
|
||||
case SH_NODE_TEX_MAGIC:
|
||||
ntype->draw_buttons = node_shader_buts_tex_magic;
|
||||
break;
|
||||
case SH_NODE_TEX_BRICK:
|
||||
ntype->draw_buttons = node_shader_buts_tex_brick;
|
||||
break;
|
||||
case SH_NODE_TEX_WAVE:
|
||||
ntype->draw_buttons = node_shader_buts_tex_wave;
|
||||
break;
|
||||
case SH_NODE_TEX_MUSGRAVE:
|
||||
ntype->draw_buttons = node_shader_buts_tex_musgrave;
|
||||
break;
|
||||
case SH_NODE_TEX_VORONOI:
|
||||
ntype->draw_buttons = node_shader_buts_tex_voronoi;
|
||||
break;
|
||||
case SH_NODE_TEX_NOISE:
|
||||
ntype->draw_buttons = node_shader_buts_tex_noise;
|
||||
break;
|
||||
case SH_NODE_TEX_POINTDENSITY:
|
||||
ntype->draw_buttons = node_shader_buts_tex_pointdensity;
|
||||
break;
|
||||
case SH_NODE_TEX_COORD:
|
||||
ntype->draw_buttons = node_shader_buts_tex_coord;
|
||||
break;
|
||||
case SH_NODE_BUMP:
|
||||
ntype->draw_buttons = node_shader_buts_bump;
|
||||
break;
|
||||
case SH_NODE_NORMAL_MAP:
|
||||
ntype->draw_buttons = node_shader_buts_normal_map;
|
||||
break;
|
||||
case SH_NODE_DISPLACEMENT:
|
||||
case SH_NODE_VECTOR_DISPLACEMENT:
|
||||
ntype->draw_buttons = node_shader_buts_displacement;
|
||||
break;
|
||||
case SH_NODE_TANGENT:
|
||||
ntype->draw_buttons = node_shader_buts_tangent;
|
||||
break;
|
||||
case SH_NODE_BSDF_GLOSSY:
|
||||
case SH_NODE_BSDF_GLASS:
|
||||
case SH_NODE_BSDF_REFRACTION:
|
||||
ntype->draw_buttons = node_shader_buts_glossy;
|
||||
break;
|
||||
case SH_NODE_BSDF_PRINCIPLED:
|
||||
ntype->draw_buttons = node_shader_buts_principled;
|
||||
break;
|
||||
case SH_NODE_BSDF_ANISOTROPIC:
|
||||
ntype->draw_buttons = node_shader_buts_anisotropic;
|
||||
break;
|
||||
case SH_NODE_SUBSURFACE_SCATTERING:
|
||||
ntype->draw_buttons = node_shader_buts_subsurface;
|
||||
break;
|
||||
case SH_NODE_BSDF_TOON:
|
||||
ntype->draw_buttons = node_shader_buts_toon;
|
||||
break;
|
||||
case SH_NODE_BSDF_HAIR:
|
||||
ntype->draw_buttons = node_shader_buts_hair;
|
||||
break;
|
||||
case SH_NODE_BSDF_HAIR_PRINCIPLED:
|
||||
ntype->draw_buttons = node_shader_buts_principled_hair;
|
||||
break;
|
||||
case SH_NODE_SCRIPT:
|
||||
ntype->draw_buttons = node_shader_buts_script;
|
||||
ntype->draw_buttons_ex = node_shader_buts_script_ex;
|
||||
break;
|
||||
case SH_NODE_UVMAP:
|
||||
ntype->draw_buttons = node_shader_buts_uvmap;
|
||||
break;
|
||||
case SH_NODE_VERTEX_COLOR:
|
||||
ntype->draw_buttons = node_shader_buts_vertex_color;
|
||||
break;
|
||||
case SH_NODE_UVALONGSTROKE:
|
||||
ntype->draw_buttons = node_shader_buts_uvalongstroke;
|
||||
break;
|
||||
case SH_NODE_OUTPUT_MATERIAL:
|
||||
case SH_NODE_OUTPUT_LIGHT:
|
||||
case SH_NODE_OUTPUT_WORLD:
|
||||
ntype->draw_buttons = node_buts_output_shader;
|
||||
break;
|
||||
case SH_NODE_OUTPUT_LINESTYLE:
|
||||
ntype->draw_buttons = node_buts_output_linestyle;
|
||||
break;
|
||||
case SH_NODE_TEX_IES:
|
||||
ntype->draw_buttons = node_shader_buts_ies;
|
||||
break;
|
||||
case SH_NODE_BEVEL:
|
||||
ntype->draw_buttons = node_shader_buts_bevel;
|
||||
break;
|
||||
case SH_NODE_AMBIENT_OCCLUSION:
|
||||
ntype->draw_buttons = node_shader_buts_ambient_occlusion;
|
||||
break;
|
||||
case SH_NODE_TEX_WHITE_NOISE:
|
||||
ntype->draw_buttons = node_shader_buts_white_noise;
|
||||
break;
|
||||
case SH_NODE_OUTPUT_AOV:
|
||||
ntype->draw_buttons = node_shader_buts_output_aov;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_ambient_occlusion_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -30,6 +33,15 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("AO"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_ambient_occlusion(uiLayout *layout,
|
||||
bContext *UNUSED(C),
|
||||
PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "inside", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "only_local", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat,
|
||||
bNode *node,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
@@ -71,6 +83,7 @@ void register_node_type_sh_ambient_occlusion()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_ambient_occlusion);
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_ambient_occlusion);
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_attribute_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -29,6 +32,12 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Alpha"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "attribute_type", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Type"), ICON_NONE);
|
||||
uiItemR(layout, ptr, "attribute_name", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Name"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderAttribute *attr = MEM_cnew<NodeShaderAttribute>("NodeShaderAttribute");
|
||||
@@ -92,6 +101,7 @@ void register_node_type_sh_attribute()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_attribute;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_attribute);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_bevel_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -28,6 +31,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Normal"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_bevel(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = 4; /* samples */
|
||||
@@ -61,6 +69,7 @@ void register_node_type_sh_bevel()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_bevel;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_bevel);
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_bevel);
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_bsdf_anisotropic_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -40,6 +43,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Shader>(N_("BSDF"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_anisotropic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "distribution", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_anisotropic(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = SHD_GLOSSY_GGX;
|
||||
@@ -79,6 +87,7 @@ void register_node_type_sh_bsdf_anisotropic()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_anisotropic;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_anisotropic);
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_anisotropic);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_bsdf_hair_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -43,6 +46,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Shader>(N_("BSDF"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_hair(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static int node_shader_gpu_bsdf_hair(GPUMaterial *mat,
|
||||
bNode *node,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
@@ -63,6 +71,7 @@ void register_node_type_sh_bsdf_hair()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_hair;
|
||||
node_type_size(&ntype, 150, 60, 200);
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_hair);
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_bsdf_hair_principled_cc {
|
||||
|
||||
/* Color, melanin and absorption coefficient default to approximately same brownish hair. */
|
||||
@@ -76,6 +79,13 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Shader>(N_("BSDF"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_principled_hair(uiLayout *layout,
|
||||
bContext *UNUSED(C),
|
||||
PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "parametrization", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
/* Initialize the custom Parametrization property to Color. */
|
||||
static void node_shader_init_hair_principled(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
@@ -126,6 +136,7 @@ void register_node_type_sh_bsdf_hair_principled()
|
||||
sh_node_type_base(
|
||||
&ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_principled_hair;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_hair_principled);
|
||||
node_type_update(&ntype, file_ns::node_shader_update_hair_principled);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_bsdf_principled_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -119,6 +122,12 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Shader>(N_("BSDF"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_principled(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "distribution", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "subsurface_method", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = SHD_GLOSSY_GGX;
|
||||
@@ -240,6 +249,7 @@ void register_node_type_sh_bsdf_principled()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_principled;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_principled);
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_principled);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_bsdf_toon_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -38,6 +41,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Shader>(N_("BSDF"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_toon(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static int node_shader_gpu_bsdf_toon(GPUMaterial *mat,
|
||||
bNode *node,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
@@ -64,6 +72,7 @@ void register_node_type_sh_bsdf_toon()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_toon;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_toon);
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
/* **************** BUMP ******************** */
|
||||
|
||||
namespace blender::nodes::node_shader_bump_cc {
|
||||
@@ -46,6 +49,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Normal"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_bump(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "invert", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
}
|
||||
|
||||
static int gpu_shader_bump(GPUMaterial *mat,
|
||||
bNode *node,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
@@ -73,6 +81,7 @@ void register_node_type_sh_bump()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_bump;
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_bump);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_clamp_cc {
|
||||
|
||||
static void sh_node_clamp_declare(NodeDeclarationBuilder &b)
|
||||
@@ -34,6 +37,11 @@ static void sh_node_clamp_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Result"));
|
||||
};
|
||||
|
||||
static void node_shader_buts_clamp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "clamp_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_clamp(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = NODE_CLAMP_MINMAX; /* clamp type */
|
||||
@@ -83,6 +91,7 @@ void register_node_type_sh_clamp()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER);
|
||||
ntype.declare = file_ns::sh_node_clamp_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_clamp;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_clamp);
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_clamp);
|
||||
ntype.build_multi_function = file_ns::sh_node_clamp_build_multi_function;
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_ies_light_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -28,6 +31,23 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Fac"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_ies(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *row;
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
|
||||
if (RNA_enum_get(ptr, "mode") == NODE_IES_INTERNAL) {
|
||||
uiItemR(row, ptr, "ies", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderTexIES *tex = MEM_cnew<NodeShaderTexIES>("NodeShaderIESLight");
|
||||
@@ -45,6 +65,7 @@ void register_node_type_sh_tex_ies()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_ies;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_ies);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
|
||||
#include "NOD_socket_search_link.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_map_range_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeMapRange)
|
||||
@@ -52,6 +55,17 @@ static void sh_node_map_range_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Vector"));
|
||||
};
|
||||
|
||||
static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "data_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "interpolation_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
if (!ELEM(RNA_enum_get(ptr, "interpolation_type"),
|
||||
NODE_MAP_RANGE_SMOOTHSTEP,
|
||||
NODE_MAP_RANGE_SMOOTHERSTEP)) {
|
||||
uiItemR(layout, ptr, "clamp", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_update_map_range(bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
const NodeMapRange &storage = node_storage(*node);
|
||||
@@ -650,6 +664,7 @@ void register_node_type_sh_map_range()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER);
|
||||
ntype.declare = file_ns::sh_node_map_range_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_map_range;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_map_range);
|
||||
node_type_storage(
|
||||
&ntype, "NodeMapRange", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_mapping_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -49,6 +52,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Vector"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "vector_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static const char *gpu_shader_get_name(int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
@@ -94,6 +102,7 @@ void register_node_type_sh_mapping()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_mapping;
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_mapping);
|
||||
node_type_update(&ntype, file_ns::node_shader_update_mapping);
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_normal_map_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -28,6 +33,23 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Normal"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
|
||||
|
||||
if (RNA_enum_get(ptr, "space") == SHD_SPACE_TANGENT) {
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, ptr, "uv_map", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderNormalMap *attr = MEM_cnew<NodeShaderNormalMap>("NodeShaderNormalMap");
|
||||
@@ -113,6 +135,7 @@ void register_node_type_sh_normal_map()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_normal_map;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_normal_map);
|
||||
node_type_storage(
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "BLI_hash.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_output_aov_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -29,6 +32,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_input<decl::Float>(N_("Value")).default_value(0.0f).min(0.0f).max(1.0f);
|
||||
};
|
||||
|
||||
static void node_shader_buts_output_aov(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "name", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_output_aov(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderOutputAOV *aov = MEM_cnew<NodeShaderOutputAOV>("NodeShaderOutputAOV");
|
||||
@@ -63,6 +71,7 @@ void register_node_type_sh_output_aov()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_output_aov;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_output_aov);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderOutputAOV", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_output_linestyle_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -41,6 +44,16 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
.subtype(PROP_FACTOR);
|
||||
};
|
||||
|
||||
static void node_buts_output_linestyle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *row, *col;
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
row = uiLayoutRow(col, true);
|
||||
uiItemR(row, ptr, "blend_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(col, ptr, "use_clamp", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::node_shader_output_linestyle_cc
|
||||
|
||||
/* node type definition */
|
||||
@@ -52,6 +65,7 @@ void register_node_type_sh_output_linestyle()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_buts_output_linestyle;
|
||||
ntype.no_muting = true;
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
@@ -23,9 +23,42 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_script_cc {
|
||||
|
||||
/* **************** Script ******************** */
|
||||
static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *row;
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
|
||||
if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_INTERNAL) {
|
||||
uiItemR(row, ptr, "script", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update");
|
||||
}
|
||||
|
||||
static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemS(layout);
|
||||
|
||||
node_shader_buts_script(layout, C, ptr);
|
||||
|
||||
#if 0 /* not implemented yet */
|
||||
if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) {
|
||||
uiItemR(layout, ptr, "use_auto_update", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
@@ -69,6 +102,8 @@ void register_node_type_sh_script()
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT);
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_script;
|
||||
ntype.draw_buttons_ex = file_ns::node_shader_buts_script_ex;
|
||||
node_type_init(&ntype, file_ns::init);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderScript", file_ns::node_free_script, file_ns::node_copy_script);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_subsurface_scattering_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -41,6 +44,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Shader>(N_("BSSRDF"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_subsurface(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_subsurface_scattering(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = SHD_SUBSURFACE_RANDOM_WALK;
|
||||
@@ -95,6 +103,7 @@ void register_node_type_sh_subsurface_scattering()
|
||||
sh_node_type_base(
|
||||
&ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_subsurface;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_subsurface_scattering);
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_subsurface_scattering);
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tangent_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -26,6 +31,32 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Tangent"));
|
||||
};
|
||||
|
||||
static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *split, *row;
|
||||
|
||||
split = uiLayoutSplit(layout, 0.0f, false);
|
||||
|
||||
uiItemR(split, ptr, "direction_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
|
||||
|
||||
row = uiLayoutRow(split, false);
|
||||
|
||||
if (RNA_enum_get(ptr, "direction_type") == SHD_TANGENT_UVMAP) {
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "uv_map", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "axis", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderTangent *attr = MEM_cnew<NodeShaderTangent>("NodeShaderTangent");
|
||||
@@ -79,6 +110,7 @@ void register_node_type_sh_tangent()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tangent;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tangent);
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_tangent);
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
#include "BLI_float2.hh"
|
||||
#include "BLI_float4.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_brick_cc {
|
||||
|
||||
static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b)
|
||||
@@ -57,6 +60,26 @@ static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Fac"));
|
||||
};
|
||||
|
||||
static void node_shader_buts_tex_brick(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiLayout *col;
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col,
|
||||
ptr,
|
||||
"offset",
|
||||
UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER,
|
||||
IFACE_("Offset"),
|
||||
ICON_NONE);
|
||||
uiItemR(
|
||||
col, ptr, "offset_frequency", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Frequency"), ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "squash", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Squash"), ICON_NONE);
|
||||
uiItemR(
|
||||
col, ptr, "squash_frequency", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Frequency"), ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexBrick *tex = MEM_cnew<NodeTexBrick>(__func__);
|
||||
@@ -272,6 +295,7 @@ void register_node_type_sh_tex_brick()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_brick_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_brick;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_brick);
|
||||
node_type_storage(
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_coord_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -34,6 +37,12 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Reflection"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "object", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
uiItemR(layout, ptr, "from_instancer", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
}
|
||||
|
||||
static int node_shader_gpu_tex_coord(GPUMaterial *mat,
|
||||
bNode *node,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
@@ -94,6 +103,7 @@ void register_node_type_sh_tex_coord()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_coord;
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_gradient_cc {
|
||||
|
||||
static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b)
|
||||
@@ -29,6 +32,11 @@ static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
|
||||
};
|
||||
|
||||
static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "gradient_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexGradient *tex = MEM_cnew<NodeTexGradient>(__func__);
|
||||
@@ -163,6 +171,7 @@ void register_node_type_sh_tex_gradient()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_gradient_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_gradient;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_gradient);
|
||||
node_type_storage(
|
||||
&ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_magic_cc {
|
||||
|
||||
static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b)
|
||||
@@ -31,6 +34,11 @@ static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
|
||||
};
|
||||
|
||||
static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "turbulence_depth", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexMagic *tex = MEM_cnew<NodeTexMagic>(__func__);
|
||||
@@ -185,6 +193,7 @@ void register_node_type_sh_tex_magic()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_magic_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_magic;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_magic);
|
||||
node_type_storage(
|
||||
&ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_musgrave_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeTexMusgrave)
|
||||
@@ -42,6 +45,12 @@ static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
|
||||
};
|
||||
|
||||
static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "musgrave_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "musgrave_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexMusgrave *tex = MEM_cnew<NodeTexMusgrave>(__func__);
|
||||
@@ -539,6 +548,7 @@ void register_node_type_sh_tex_musgrave()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_musgrave_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_musgrave;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_musgrave);
|
||||
node_type_storage(
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_noise_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeTexNoise)
|
||||
@@ -45,6 +48,11 @@ static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Color>(N_("Color")).no_muted_links();
|
||||
};
|
||||
|
||||
static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "noise_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexNoise *tex = MEM_cnew<NodeTexNoise>(__func__);
|
||||
@@ -256,6 +264,7 @@ void register_node_type_sh_tex_noise()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_noise_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_noise;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_noise);
|
||||
node_type_storage(
|
||||
&ntype, "NodeTexNoise", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "RE_texture.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_pointdensity_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -30,6 +33,52 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Density"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_pointdensity(uiLayout *layout,
|
||||
bContext *UNUSED(C),
|
||||
PointerRNA *ptr)
|
||||
{
|
||||
bNode *node = (bNode *)ptr->data;
|
||||
NodeShaderTexPointDensity *shader_point_density = (NodeShaderTexPointDensity *)node->storage;
|
||||
Object *ob = (Object *)node->id;
|
||||
|
||||
PointerRNA ob_ptr, obdata_ptr;
|
||||
RNA_id_pointer_create((ID *)ob, &ob_ptr);
|
||||
RNA_id_pointer_create(ob ? (ID *)ob->data : nullptr, &obdata_ptr);
|
||||
|
||||
uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "object", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
|
||||
if (node->id && shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
|
||||
PointerRNA dataptr;
|
||||
RNA_id_pointer_create((ID *)node->id, &dataptr);
|
||||
uiItemPointerR(
|
||||
layout, ptr, "particle_system", &dataptr, "particle_systems", nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "radius", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "resolution", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
|
||||
uiItemR(layout, ptr, "particle_color_source", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, ptr, "vertex_color_source", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTWEIGHT) {
|
||||
if (ob_ptr.data) {
|
||||
uiItemPointerR(
|
||||
layout, ptr, "vertex_attribute_name", &ob_ptr, "vertex_groups", "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTCOL) {
|
||||
if (obdata_ptr.data) {
|
||||
uiItemPointerR(
|
||||
layout, ptr, "vertex_attribute_name", &obdata_ptr, "vertex_colors", "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderTexPointDensity *point_density = MEM_cnew<NodeShaderTexPointDensity>("new pd node");
|
||||
@@ -71,6 +120,7 @@ void register_node_type_sh_tex_pointdensity()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_pointdensity;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_pointdensity);
|
||||
node_type_storage(&ntype,
|
||||
"NodeShaderTexPointDensity",
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
#include "node_shader_util.hh"
|
||||
#include "sky_model.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_scene.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_sky_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -28,6 +34,46 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Color>(N_("Color")).no_muted_links();
|
||||
}
|
||||
|
||||
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "sky_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_PREETHAM) {
|
||||
uiItemR(layout, ptr, "sun_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "turbidity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_HOSEK) {
|
||||
uiItemR(layout, ptr, "sun_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "turbidity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "ground_albedo", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_NISHITA) {
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
if (BKE_scene_uses_blender_eevee(scene)) {
|
||||
uiItemL(layout, TIP_("Nishita not available in Eevee"), ICON_ERROR);
|
||||
}
|
||||
uiItemR(layout, ptr, "sun_disc", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
|
||||
uiLayout *col;
|
||||
if (RNA_boolean_get(ptr, "sun_disc")) {
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "sun_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "sun_intensity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "sun_elevation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "sun_rotation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
|
||||
uiItemR(layout, ptr, "altitude", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, ptr, "air_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "dust_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(col, ptr, "ozone_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexSky *tex = MEM_cnew<NodeTexSky>("NodeTexSky");
|
||||
@@ -210,6 +256,7 @@ void register_node_type_sh_tex_sky()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_sky;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_sky);
|
||||
node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_voronoi_cc {
|
||||
|
||||
NODE_STORAGE_FUNCS(NodeTexVoronoi)
|
||||
@@ -62,6 +65,17 @@ static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b)
|
||||
});
|
||||
};
|
||||
|
||||
static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "voronoi_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "feature", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
int feature = RNA_enum_get(ptr, "feature");
|
||||
if (!ELEM(feature, SHD_VORONOI_DISTANCE_TO_EDGE, SHD_VORONOI_N_SPHERE_RADIUS) &&
|
||||
RNA_enum_get(ptr, "voronoi_dimensions") != 1) {
|
||||
uiItemR(layout, ptr, "distance", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexVoronoi *tex = MEM_cnew<NodeTexVoronoi>(__func__);
|
||||
@@ -1346,6 +1360,7 @@ void register_node_type_sh_tex_voronoi()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_voronoi_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_voronoi;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_voronoi);
|
||||
node_type_storage(
|
||||
&ntype, "NodeTexVoronoi", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_wave_cc {
|
||||
|
||||
static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b)
|
||||
@@ -41,6 +44,20 @@ static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Fac")).no_muted_links();
|
||||
};
|
||||
|
||||
static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "wave_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
int type = RNA_enum_get(ptr, "wave_type");
|
||||
if (type == SHD_WAVE_BANDS) {
|
||||
uiItemR(layout, ptr, "bands_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
else { /* SHD_WAVE_RINGS */
|
||||
uiItemR(layout, ptr, "rings_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, ptr, "wave_profile", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeTexWave *tex = MEM_cnew<NodeTexWave>(__func__);
|
||||
@@ -222,6 +239,7 @@ void register_node_type_sh_tex_wave()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_wave_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_tex_wave;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_wave);
|
||||
node_type_storage(&ntype, "NodeTexWave", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#include "BLI_noise.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_tex_white_noise_cc {
|
||||
|
||||
static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b)
|
||||
@@ -35,6 +38,11 @@ static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Color>(N_("Color"));
|
||||
};
|
||||
|
||||
static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "noise_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_tex_white_noise(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = 3;
|
||||
@@ -198,6 +206,7 @@ void register_node_type_sh_tex_white_noise()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE);
|
||||
ntype.declare = file_ns::sh_node_tex_white_noise_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_white_noise;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_tex_white_noise);
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_tex_white_noise);
|
||||
node_type_update(&ntype, file_ns::node_shader_update_tex_white_noise);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_uv_along_stroke_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -26,6 +29,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("UV"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "use_tips", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
}
|
||||
|
||||
} // namespace blender::nodes::node_shader_uv_along_stroke_cc
|
||||
|
||||
/* node type definition */
|
||||
@@ -37,6 +45,7 @@ void register_node_type_sh_uvalongstroke()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_uvalongstroke;
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,13 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "DNA_customdata_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_uvmap_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -28,6 +33,20 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("UV"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "from_instancer", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
|
||||
if (!RNA_boolean_get(ptr, "from_instancer")) {
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderUVMap *attr = MEM_cnew<NodeShaderUVMap>("NodeShaderUVMap");
|
||||
@@ -61,6 +80,7 @@ void register_node_type_sh_uvmap()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_uvmap;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_MIDDLE);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_uvmap);
|
||||
node_type_storage(
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
|
||||
#include "RNA_enum_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_vector_math_cc {
|
||||
|
||||
static void sh_node_vector_math_declare(NodeDeclarationBuilder &b)
|
||||
@@ -41,6 +44,11 @@ static void sh_node_vector_math_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Value"));
|
||||
};
|
||||
|
||||
static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "operation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
class SocketSearchOp {
|
||||
public:
|
||||
std::string socket_name;
|
||||
@@ -331,6 +339,7 @@ void register_node_type_sh_vect_math()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR);
|
||||
ntype.declare = file_ns::sh_node_vector_math_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_vect_math;
|
||||
ntype.labelfunc = node_vector_math_label;
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_vector_math);
|
||||
node_type_update(&ntype, file_ns::node_shader_update_vector_math);
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_vector_rotate_cc {
|
||||
|
||||
static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b)
|
||||
@@ -36,6 +39,12 @@ static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Vector"));
|
||||
};
|
||||
|
||||
static void node_shader_buts_vector_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "rotation_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE);
|
||||
uiItemR(layout, ptr, "invert", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
}
|
||||
|
||||
static const char *gpu_shader_get_name(int mode)
|
||||
{
|
||||
switch (mode) {
|
||||
@@ -213,6 +222,7 @@ void register_node_type_sh_vector_rotate()
|
||||
|
||||
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR);
|
||||
ntype.declare = file_ns::sh_node_vector_rotate_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_vector_rotate;
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_vector_rotate);
|
||||
node_type_update(&ntype, file_ns::node_shader_update_vector_rotate);
|
||||
ntype.build_multi_function = file_ns::sh_node_vector_rotate_build_multi_function;
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_vector_transform_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -34,6 +37,18 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Vector>(N_("Vector"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_vect_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout,
|
||||
ptr,
|
||||
"vector_type",
|
||||
UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND,
|
||||
nullptr,
|
||||
ICON_NONE);
|
||||
uiItemR(layout, ptr, "convert_from", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemR(layout, ptr, "convert_to", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void node_shader_init_vect_transform(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderVectTransform *vect = MEM_cnew<NodeShaderVectTransform>("NodeShaderVectTransform");
|
||||
@@ -138,8 +153,9 @@ void register_node_type_sh_vect_transform()
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR);
|
||||
node_type_init(&ntype, file_ns::node_shader_init_vect_transform);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_vect_transform;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_vect_transform);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage);
|
||||
node_type_gpu(&ntype, file_ns::gpu_shader_vect_transform);
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "BKE_context.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_vertex_color_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -27,6 +32,26 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Alpha"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
PointerRNA obptr = CTX_data_pointer_get(C, "active_object");
|
||||
if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
|
||||
PointerRNA dataptr = RNA_pointer_get(&obptr, "data");
|
||||
|
||||
if (U.experimental.use_sculpt_vertex_colors &&
|
||||
RNA_collection_length(&dataptr, "sculpt_vertex_colors")) {
|
||||
uiItemPointerR(
|
||||
layout, ptr, "layer_name", &dataptr, "sculpt_vertex_colors", "", ICON_GROUP_VCOL);
|
||||
}
|
||||
else {
|
||||
uiItemPointerR(layout, ptr, "layer_name", &dataptr, "vertex_colors", "", ICON_GROUP_VCOL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
uiItemL(layout, TIP_("No mesh in active object"), ICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
static void node_shader_init_vertex_color(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeShaderVertexColor *vertexColor = MEM_cnew<NodeShaderVertexColor>("NodeShaderVertexColor");
|
||||
@@ -58,6 +83,7 @@ void register_node_type_sh_vertex_color()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Vertex Color", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_vertex_color;
|
||||
node_type_init(&ntype, file_ns::node_shader_init_vertex_color);
|
||||
node_type_storage(
|
||||
&ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
|
||||
#include "node_shader_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
namespace blender::nodes::node_shader_wireframe_cc {
|
||||
|
||||
static void node_declare(NodeDeclarationBuilder &b)
|
||||
@@ -27,6 +30,11 @@ static void node_declare(NodeDeclarationBuilder &b)
|
||||
b.add_output<decl::Float>(N_("Fac"));
|
||||
}
|
||||
|
||||
static void node_shader_buts_wireframe(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "use_pixel_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0);
|
||||
}
|
||||
|
||||
static int node_shader_gpu_wireframe(GPUMaterial *mat,
|
||||
bNode *node,
|
||||
bNodeExecData *UNUSED(execdata),
|
||||
@@ -60,6 +68,7 @@ void register_node_type_sh_wireframe()
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT);
|
||||
ntype.declare = file_ns::node_declare;
|
||||
ntype.draw_buttons = file_ns::node_shader_buts_wireframe;
|
||||
node_type_gpu(&ntype, file_ns::node_shader_gpu_wireframe);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
||||
Reference in New Issue
Block a user