forked from blender/blender
main sync #3
@ -153,6 +153,16 @@ static float3 output_estimate_emission(ShaderOutput *output, bool &is_constant)
|
||||
estimate *= node->get_float(strength_in->socket_type);
|
||||
}
|
||||
|
||||
/* Lower importance of emission nodes from automatic value/color to shader
|
||||
* conversion, as these are likely used for previewing and can be slow to
|
||||
* build a light tree for on dense meshes. */
|
||||
if (node->type == EmissionNode::get_node_type()) {
|
||||
EmissionNode *emission_node = static_cast<EmissionNode *>(node);
|
||||
if (emission_node->from_auto_conversion) {
|
||||
estimate *= 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
return estimate;
|
||||
}
|
||||
else if (node->type == LightFalloffNode::get_node_type() ||
|
||||
|
@ -260,6 +260,7 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to)
|
||||
|
||||
if (to->type() == SocketType::CLOSURE) {
|
||||
EmissionNode *emission = create_node<EmissionNode>();
|
||||
emission->from_auto_conversion = true;
|
||||
emission->set_color(one_float3());
|
||||
emission->set_strength(1.0f);
|
||||
convert = add(emission);
|
||||
|
@ -723,6 +723,8 @@ class EmissionNode : public ShaderNode {
|
||||
NODE_SOCKET_API(float3, color)
|
||||
NODE_SOCKET_API(float, strength)
|
||||
NODE_SOCKET_API(float, surface_mix_weight)
|
||||
|
||||
bool from_auto_conversion = false;
|
||||
};
|
||||
|
||||
class BackgroundNode : public ShaderNode {
|
||||
|
@ -25,6 +25,7 @@ class AssetIdentifier {
|
||||
AssetIdentifier(const AssetIdentifier &) = default;
|
||||
|
||||
std::string full_path() const;
|
||||
std::string full_library_path() const;
|
||||
};
|
||||
|
||||
} // namespace blender::asset_system
|
||||
|
@ -92,7 +92,11 @@ class AssetRepresentation {
|
||||
/* C-Handle */
|
||||
struct AssetRepresentation;
|
||||
|
||||
const std::string AS_asset_representation_full_path_get(const ::AssetRepresentation *asset);
|
||||
std::string AS_asset_representation_full_path_get(const ::AssetRepresentation *asset);
|
||||
/** Get the absolute path to the .blend file containing the given asset. String will be empty if
|
||||
* the asset could not be mapped to a valid .blend file path. Valid in this case also means that
|
||||
* the file needs to exist on disk. */
|
||||
std::string AS_asset_representation_full_library_path_get(const ::AssetRepresentation *asset);
|
||||
std::optional<eAssetImportMethod> AS_asset_representation_import_method_get(
|
||||
const ::AssetRepresentation *asset_handle);
|
||||
bool AS_asset_representation_may_override_import_method(const ::AssetRepresentation *asset_handle);
|
||||
|
@ -5,6 +5,7 @@ set(INC
|
||||
intern
|
||||
../blenkernel
|
||||
../blenlib
|
||||
../blenloader
|
||||
../makesdna
|
||||
../../../intern/clog
|
||||
../../../intern/guardedalloc
|
||||
|
@ -4,8 +4,11 @@
|
||||
* \ingroup asset_system
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "BLO_readfile.h"
|
||||
|
||||
#include "BLI_path_util.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "AS_asset_identifier.hh"
|
||||
|
||||
@ -24,4 +27,16 @@ std::string AssetIdentifier::full_path() const
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string AssetIdentifier::full_library_path() const
|
||||
{
|
||||
std::string asset_path = full_path();
|
||||
|
||||
char blend_path[1090 /*FILE_MAX_LIBEXTRA*/];
|
||||
if (!BLO_library_path_explode(asset_path.c_str(), blend_path, nullptr, nullptr)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return blend_path;
|
||||
}
|
||||
|
||||
} // namespace blender::asset_system
|
||||
|
@ -111,7 +111,7 @@ const AssetLibrary &AssetRepresentation::owner_asset_library() const
|
||||
|
||||
using namespace blender;
|
||||
|
||||
const std::string AS_asset_representation_full_path_get(const AssetRepresentation *asset_handle)
|
||||
std::string AS_asset_representation_full_path_get(const AssetRepresentation *asset_handle)
|
||||
{
|
||||
const asset_system::AssetRepresentation *asset =
|
||||
reinterpret_cast<const asset_system::AssetRepresentation *>(asset_handle);
|
||||
@ -119,6 +119,13 @@ const std::string AS_asset_representation_full_path_get(const AssetRepresentatio
|
||||
return identifier.full_path();
|
||||
}
|
||||
|
||||
std::string AS_asset_representation_full_library_path_get(const AssetRepresentation *asset_handle)
|
||||
{
|
||||
const asset_system::AssetRepresentation *asset =
|
||||
reinterpret_cast<const asset_system::AssetRepresentation *>(asset_handle);
|
||||
return asset->get_identifier().full_library_path();
|
||||
}
|
||||
|
||||
std::optional<eAssetImportMethod> AS_asset_representation_import_method_get(
|
||||
const AssetRepresentation *asset_handle)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user