WIP: Experiment: Drop import operator helper and file drop type #111242
|
@ -15,11 +15,6 @@
|
|||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
typedef struct ChiangHairExtra {
|
||||
/* Geometry data. */
|
||||
float4 geom;
|
||||
} ChiangHairExtra;
|
||||
|
||||
typedef struct ChiangHairBSDF {
|
||||
SHADER_CLOSURE_BASE;
|
||||
|
||||
|
@ -36,12 +31,11 @@ typedef struct ChiangHairBSDF {
|
|||
/* Effective variance for the diffuse bounce only. */
|
||||
float m0_roughness;
|
||||
|
||||
/* Extra closure. */
|
||||
ccl_private ChiangHairExtra *extra;
|
||||
/* Azimuthal offset. */
|
||||
float h;
|
||||
} ChiangHairBSDF;
|
||||
|
||||
static_assert(sizeof(ShaderClosure) >= sizeof(ChiangHairBSDF), "ChiangHairBSDF is too large!");
|
||||
static_assert(sizeof(ShaderClosure) >= sizeof(ChiangHairExtra), "ChiangHairExtra is too large!");
|
||||
|
||||
/* Gives the change in direction in the normal plane for the given angles and p-th-order
|
||||
* scattering. */
|
||||
|
@ -184,13 +178,13 @@ ccl_device int bsdf_hair_chiang_setup(ccl_private ShaderData *sd, ccl_private Ch
|
|||
|
||||
/* TODO: we convert this value to a cosine later and discard the sign, so
|
||||
* we could probably save some operations. */
|
||||
float h = (sd->type & PRIMITIVE_CURVE_RIBBON) ? -sd->v : dot(cross(sd->Ng, X), Z);
|
||||
bsdf->h = (sd->type & PRIMITIVE_CURVE_RIBBON) ? -sd->v : dot(cross(sd->Ng, X), Z);
|
||||
|
||||
kernel_assert(fabsf(h) < 1.0f + 1e-4f);
|
||||
kernel_assert(fabsf(bsdf->h) < 1.0f + 1e-4f);
|
||||
kernel_assert(isfinite_safe(Y));
|
||||
kernel_assert(isfinite_safe(h));
|
||||
|
||||
bsdf->extra->geom = make_float4(Y.x, Y.y, Y.z, h);
|
||||
bsdf->N = Y;
|
||||
|
||||
return SD_BSDF | SD_BSDF_HAS_EVAL | SD_BSDF_NEEDS_LCG | SD_BSDF_HAS_TRANSMISSION;
|
||||
}
|
||||
|
@ -261,7 +255,7 @@ ccl_device Spectrum bsdf_hair_chiang_eval(KernelGlobals kg,
|
|||
kernel_assert(isfinite_safe(sd->P) && isfinite_safe(sd->ray_length));
|
||||
|
||||
ccl_private const ChiangHairBSDF *bsdf = (ccl_private const ChiangHairBSDF *)sc;
|
||||
const float3 Y = float4_to_float3(bsdf->extra->geom);
|
||||
const float3 Y = bsdf->N;
|
||||
|
||||
const float3 X = safe_normalize(sd->dPdu);
|
||||
kernel_assert(fabsf(dot(X, Y)) < 1e-3f);
|
||||
|
@ -278,7 +272,7 @@ ccl_device Spectrum bsdf_hair_chiang_eval(KernelGlobals kg,
|
|||
const float sin_theta_t = sin_theta_o / bsdf->eta;
|
||||
const float cos_theta_t = cos_from_sin(sin_theta_t);
|
||||
|
||||
const float sin_gamma_o = bsdf->extra->geom.w;
|
||||
const float sin_gamma_o = bsdf->h;
|
||||
const float cos_gamma_o = cos_from_sin(sin_gamma_o);
|
||||
const float gamma_o = safe_asinf(sin_gamma_o);
|
||||
|
||||
|
@ -349,7 +343,7 @@ ccl_device int bsdf_hair_chiang_sample(KernelGlobals kg,
|
|||
*sampled_roughness = make_float2(bsdf->m0_roughness, bsdf->m0_roughness);
|
||||
*eta = bsdf->eta;
|
||||
|
||||
const float3 Y = float4_to_float3(bsdf->extra->geom);
|
||||
const float3 Y = bsdf->N;
|
||||
|
||||
const float3 X = safe_normalize(sd->dPdu);
|
||||
kernel_assert(fabsf(dot(X, Y)) < 1e-3f);
|
||||
|
@ -364,7 +358,7 @@ ccl_device int bsdf_hair_chiang_sample(KernelGlobals kg,
|
|||
const float sin_theta_t = sin_theta_o / bsdf->eta;
|
||||
const float cos_theta_t = cos_from_sin(sin_theta_t);
|
||||
|
||||
const float sin_gamma_o = bsdf->extra->geom.w;
|
||||
const float sin_gamma_o = bsdf->h;
|
||||
const float cos_gamma_o = cos_from_sin(sin_gamma_o);
|
||||
const float gamma_o = safe_asinf(sin_gamma_o);
|
||||
|
||||
|
@ -472,7 +466,7 @@ ccl_device Spectrum bsdf_hair_chiang_albedo(ccl_private const ShaderData *sd,
|
|||
ccl_private ChiangHairBSDF *bsdf = (ccl_private ChiangHairBSDF *)sc;
|
||||
|
||||
const float cos_theta_o = cos_from_sin(dot(sd->wi, safe_normalize(sd->dPdu)));
|
||||
const float cos_gamma_o = cos_from_sin(bsdf->extra->geom.w);
|
||||
const float cos_gamma_o = cos_from_sin(bsdf->h);
|
||||
const float f = fresnel_dielectric_cos(cos_theta_o * cos_gamma_o, bsdf->eta);
|
||||
|
||||
const float roughness_scale = bsdf_principled_hair_albedo_roughness_scale(bsdf->v);
|
||||
|
|
|
@ -145,7 +145,7 @@ ccl_device void osl_closure_reflection_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->alpha_x = bsdf->alpha_y = 0.0f;
|
||||
|
||||
sd->flag |= bsdf_microfacet_ggx_setup(bsdf);
|
||||
|
@ -168,7 +168,7 @@ ccl_device void osl_closure_refraction_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->ior = closure->ior;
|
||||
bsdf->alpha_x = bsdf->alpha_y = 0.0f;
|
||||
|
||||
|
@ -214,7 +214,7 @@ ccl_device void osl_closure_dielectric_bsdf_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->alpha_x = closure->alpha_x;
|
||||
bsdf->alpha_y = closure->alpha_y;
|
||||
bsdf->ior = closure->ior;
|
||||
|
@ -286,7 +286,7 @@ ccl_device void osl_closure_conductor_bsdf_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->alpha_x = closure->alpha_x;
|
||||
bsdf->alpha_y = closure->alpha_y;
|
||||
bsdf->ior = 0.0f;
|
||||
|
@ -338,7 +338,7 @@ ccl_device void osl_closure_generalized_schlick_bsdf_setup(
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->alpha_x = closure->alpha_x;
|
||||
bsdf->alpha_y = closure->alpha_y;
|
||||
bsdf->T = closure->T;
|
||||
|
@ -422,7 +422,7 @@ ccl_device void osl_closure_microfacet_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->alpha_x = closure->alpha_x;
|
||||
bsdf->alpha_y = closure->alpha_y;
|
||||
bsdf->ior = closure->ior;
|
||||
|
@ -495,7 +495,7 @@ ccl_device void osl_closure_microfacet_multi_ggx_glass_setup(
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->alpha_x = closure->alpha_x;
|
||||
bsdf->alpha_y = bsdf->alpha_x;
|
||||
bsdf->ior = closure->ior;
|
||||
|
@ -526,7 +526,7 @@ ccl_device void osl_closure_microfacet_multi_ggx_aniso_setup(
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->alpha_x = closure->alpha_x;
|
||||
bsdf->alpha_y = closure->alpha_y;
|
||||
bsdf->ior = 1.0f;
|
||||
|
@ -561,7 +561,7 @@ ccl_device void osl_closure_ashikhmin_velvet_setup(
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->sigma = closure->sigma;
|
||||
|
||||
sd->flag |= bsdf_ashikhmin_velvet_setup(bsdf);
|
||||
|
@ -588,7 +588,7 @@ ccl_device void osl_closure_sheen_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->roughness = closure->roughness;
|
||||
|
||||
sd->flag |= bsdf_sheen_setup(kg, sd, bsdf);
|
||||
|
@ -615,7 +615,7 @@ ccl_device void osl_closure_diffuse_toon_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->size = closure->size;
|
||||
bsdf->smooth = closure->smooth;
|
||||
|
||||
|
@ -639,7 +639,7 @@ ccl_device void osl_closure_glossy_toon_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->size = closure->size;
|
||||
bsdf->smooth = closure->smooth;
|
||||
|
||||
|
@ -733,7 +733,7 @@ ccl_device void osl_closure_phong_ramp_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->exponent = closure->exponent;
|
||||
|
||||
bsdf->colors = (float3 *)closure_alloc_extra(sd, sizeof(float3) * 8);
|
||||
|
@ -804,7 +804,7 @@ ccl_device void osl_closure_hair_reflection_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->T = closure->T;
|
||||
bsdf->roughness1 = closure->roughness1;
|
||||
bsdf->roughness2 = closure->roughness2;
|
||||
|
@ -831,7 +831,7 @@ ccl_device void osl_closure_hair_transmission_setup(
|
|||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->T = closure->T;
|
||||
bsdf->roughness1 = closure->roughness1;
|
||||
bsdf->roughness2 = closure->roughness2;
|
||||
|
@ -858,13 +858,7 @@ ccl_device void osl_closure_hair_chiang_setup(KernelGlobals kg,
|
|||
return;
|
||||
}
|
||||
|
||||
ccl_private ChiangHairExtra *extra = (ccl_private ChiangHairExtra *)closure_alloc_extra(
|
||||
sd, sizeof(ChiangHairExtra));
|
||||
if (!extra) {
|
||||
return;
|
||||
}
|
||||
|
||||
bsdf->N = ensure_valid_specular_reflection(sd->Ng, sd->wi, closure->N);
|
||||
bsdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bsdf->sigma = closure->sigma;
|
||||
bsdf->v = closure->v;
|
||||
bsdf->s = closure->s;
|
||||
|
@ -872,8 +866,6 @@ ccl_device void osl_closure_hair_chiang_setup(KernelGlobals kg,
|
|||
bsdf->eta = closure->eta;
|
||||
bsdf->m0_roughness = closure->m0_roughness;
|
||||
|
||||
bsdf->extra = extra;
|
||||
|
||||
sd->flag |= bsdf_hair_chiang_setup(sd, bsdf);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -32,11 +32,13 @@ shader node_geometry(string bump_offset = "center",
|
|||
Parametric += Dy(Parametric);
|
||||
}
|
||||
|
||||
/* first try to get tangent attribute */
|
||||
point generated;
|
||||
float IsCurve = 0;
|
||||
getattribute("geom:is_curve", IsCurve);
|
||||
|
||||
/* try to create spherical tangent from generated coordinates */
|
||||
if (getattribute("geom:generated", generated)) {
|
||||
/* create spherical tangent from generated coordinates if they're available,
|
||||
* unless we're on a curve. */
|
||||
if (!IsCurve && getattribute("geom:generated", generated)) {
|
||||
normal data = normal(-(generated[1] - 0.5), (generated[0] - 0.5), 0.0);
|
||||
vector T = transform("object", "world", data);
|
||||
Tangent = cross(Normal, normalize(cross(T, Normal)));
|
||||
|
|
|
@ -36,8 +36,8 @@ shader node_hair_bsdf(color Color = 0.8,
|
|||
}
|
||||
else {
|
||||
if (component == "reflection")
|
||||
BSDF = Color * hair_reflection(Ng, roughnessh, roughnessv, T, offset);
|
||||
BSDF = Color * hair_reflection(N, roughnessh, roughnessv, T, offset);
|
||||
else
|
||||
BSDF = Color * hair_transmission(Ng, roughnessh, roughnessv, T, offset);
|
||||
BSDF = Color * hair_transmission(N, roughnessh, roughnessv, T, offset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -706,13 +706,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
ccl_private ChiangHairBSDF *bsdf = (ccl_private ChiangHairBSDF *)bsdf_alloc(
|
||||
sd, sizeof(ChiangHairBSDF), weight);
|
||||
if (bsdf) {
|
||||
ccl_private ChiangHairExtra *extra = (ccl_private ChiangHairExtra *)closure_alloc_extra(
|
||||
sd, sizeof(ChiangHairExtra));
|
||||
|
||||
if (!extra) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Remap Coat value to [0, 100]% of Roughness. */
|
||||
float coat = stack_load_float_default(stack, shared_ofs1, data_node3.w);
|
||||
float m0_roughness = 1.0f - clamp(coat, 0.0f, 1.0f);
|
||||
|
@ -722,7 +715,6 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
|
|||
bsdf->m0_roughness = m0_roughness;
|
||||
bsdf->alpha = alpha;
|
||||
bsdf->eta = ior;
|
||||
bsdf->extra = extra;
|
||||
bsdf->sigma = sigma;
|
||||
|
||||
sd->flag |= bsdf_hair_chiang_setup(sd, bsdf);
|
||||
|
|
|
@ -3525,7 +3525,6 @@ NODE_DEFINE(HairBsdfNode)
|
|||
NodeType *type = NodeType::add("hair_bsdf", create, NodeType::SHADER);
|
||||
|
||||
SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f));
|
||||
SOCKET_IN_NORMAL(normal, "Normal", zero_float3(), SocketType::LINK_NORMAL);
|
||||
SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL);
|
||||
|
||||
static NodeEnum component_enum;
|
||||
|
|
|
@ -42,6 +42,9 @@ extern "C" {
|
|||
/** User readable version string. */
|
||||
const char *BKE_blender_version_string(void);
|
||||
|
||||
/** As above but does not show patch version. */
|
||||
const char *BKE_blender_version_string_compact(void);
|
||||
|
||||
/** Returns true when version cycle is alpha, otherwise (beta, rc) returns false. */
|
||||
bool BKE_blender_version_is_alpha(void);
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ void BKE_blender_free()
|
|||
|
||||
static char blender_version_string[48] = "";
|
||||
|
||||
/* Only includes patch if non-zero. */
|
||||
static char blender_version_string_compact[48] = "";
|
||||
|
||||
static void blender_version_init()
|
||||
{
|
||||
const char *version_cycle = "";
|
||||
|
@ -118,6 +121,12 @@ static void blender_version_init()
|
|||
BLENDER_VERSION % 100,
|
||||
BLENDER_VERSION_PATCH,
|
||||
version_cycle);
|
||||
|
||||
SNPRINTF(blender_version_string_compact,
|
||||
"%d.%01d%s",
|
||||
BLENDER_VERSION / 100,
|
||||
BLENDER_VERSION % 100,
|
||||
version_cycle);
|
||||
}
|
||||
|
||||
const char *BKE_blender_version_string()
|
||||
|
@ -125,6 +134,11 @@ const char *BKE_blender_version_string()
|
|||
return blender_version_string;
|
||||
}
|
||||
|
||||
const char *BKE_blender_version_string_compact()
|
||||
{
|
||||
return blender_version_string_compact;
|
||||
}
|
||||
|
||||
void BKE_blender_version_blendfile_string_from_values(char *str_buff,
|
||||
const size_t str_buff_maxncpy,
|
||||
const short file_version,
|
||||
|
|
|
@ -849,7 +849,7 @@ static uiTooltipData *ui_tooltip_data_from_button_or_extra_icon(bContext *C,
|
|||
!but->tip_func)
|
||||
{
|
||||
UI_tooltip_text_field_add(
|
||||
data, BLI_strdup(but_label.strinfo), nullptr, UI_TIP_STYLE_HEADER, UI_TIP_LC_NORMAL);
|
||||
data, BLI_strdup(but_tip_label.strinfo), nullptr, UI_TIP_STYLE_HEADER, UI_TIP_LC_NORMAL);
|
||||
}
|
||||
|
||||
/* Tip */
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "BLT_translation.h"
|
||||
|
||||
#include "BKE_blender_version.h"
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_icons.h"
|
||||
|
@ -481,20 +482,23 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
|
|||
* because #WM_window_open always sets window title. */
|
||||
}
|
||||
else if (win->ghostwin) {
|
||||
/* this is set to 1 if you don't have startup.blend open */
|
||||
const char *blendfile_path = BKE_main_blendfile_path_from_global();
|
||||
if (blendfile_path[0] != '\0') {
|
||||
char str[sizeof(Main::filepath) + 24];
|
||||
SNPRINTF(str,
|
||||
"Blender%s [%s%s]",
|
||||
wm->file_saved ? "" : "*",
|
||||
blendfile_path,
|
||||
G_MAIN->recovered ? " (Recovered)" : "");
|
||||
GHOST_SetTitle(static_cast<GHOST_WindowHandle>(win->ghostwin), str);
|
||||
}
|
||||
else {
|
||||
GHOST_SetTitle(static_cast<GHOST_WindowHandle>(win->ghostwin), "Blender");
|
||||
char str[sizeof(Main::filepath) + 24];
|
||||
const char *filepath = BKE_main_blendfile_path_from_global();
|
||||
char basepath[FILE_MAXDIR] = {0};
|
||||
char filename[FILE_MAXFILE] = {0};
|
||||
std::string location;
|
||||
if (filepath[0]) {
|
||||
BLI_path_split_dir_file(filepath, basepath, sizeof(basepath), filename, sizeof(filename));
|
||||
location = " [" + std::string(basepath) + "]";
|
||||
}
|
||||
SNPRINTF(str,
|
||||
"%s %s%s%s - Blender %s",
|
||||
wm->file_saved ? "" : "*",
|
||||
filename[0] ? filename : IFACE_("(Unsaved)"),
|
||||
G_MAIN->recovered ? " (Recovered)" : "",
|
||||
basepath[0] ? location.c_str() : "",
|
||||
BKE_blender_version_string_compact());
|
||||
GHOST_SetTitle(static_cast<GHOST_WindowHandle>(win->ghostwin), str);
|
||||
|
||||
/* Informs GHOST of unsaved changes, to set window modified visual indicator (macOS)
|
||||
* and to give hint of unsaved changes for a user warning mechanism in case of OS application
|
||||
|
|
Loading…
Reference in New Issue