forked from blender/blender
Moved check of existing MaterialX addon from bpy_hydra.py to material.cc and log warning only once. #83
@ -1283,7 +1283,6 @@ class HydraRenderEngine(RenderEngine):
|
||||
# Final render.
|
||||
def update(self, data, depsgraph):
|
||||
import _bpy_hydra
|
||||
import bpy
|
||||
|
||||
engine_type = 'PREVIEW' if self.is_preview else 'FINAL'
|
||||
if not self.engine_ptr:
|
||||
@ -1294,7 +1293,7 @@ class HydraRenderEngine(RenderEngine):
|
||||
for key, val in self.get_sync_settings(engine_type).items():
|
||||
_bpy_hydra.engine_set_sync_setting(self.engine_ptr, key, val)
|
||||
|
||||
_bpy_hydra.engine_update(self.engine_ptr, depsgraph, bpy.context)
|
||||
_bpy_hydra.engine_update(self.engine_ptr, depsgraph, None)
|
||||
|
||||
for key, val in self.get_render_settings('PREVIEW' if self.is_preview else 'FINAL').items():
|
||||
_bpy_hydra.engine_set_render_setting(self.engine_ptr, key, val)
|
||||
@ -1304,7 +1303,7 @@ class HydraRenderEngine(RenderEngine):
|
||||
return
|
||||
|
||||
import _bpy_hydra
|
||||
_bpy_hydra.engine_render(self.engine_ptr, depsgraph)
|
||||
_bpy_hydra.engine_render(self.engine_ptr)
|
||||
|
||||
# Viewport render.
|
||||
def view_update(self, context, depsgraph):
|
||||
@ -1327,4 +1326,4 @@ class HydraRenderEngine(RenderEngine):
|
||||
return
|
||||
|
||||
import _bpy_hydra
|
||||
_bpy_hydra.engine_view_draw(self.engine_ptr, depsgraph, context)
|
||||
_bpy_hydra.engine_view_draw(self.engine_ptr, context)
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA_SCENE, "render.hydra.scene");
|
||||
CLG_LOGREF_DECLARE_GLOBAL(LOG_HYDRA_SCENE, "hydra.scene");
|
||||
|
||||
bool HydraSceneDelegate::ShadingSettings::operator==(const ShadingSettings &other)
|
||||
{
|
||||
@ -38,21 +38,21 @@ HydraSceneDelegate::HydraSceneDelegate(pxr::HdRenderIndex *parent_index,
|
||||
|
||||
pxr::HdMeshTopology HydraSceneDelegate::GetMeshTopology(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
MeshData *m_data = mesh_data(id);
|
||||
return m_data->topology(id);
|
||||
}
|
||||
|
||||
pxr::HdBasisCurvesTopology HydraSceneDelegate::GetBasisCurvesTopology(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CurvesData *c_data = curves_data(id);
|
||||
return c_data->topology();
|
||||
};
|
||||
|
||||
pxr::GfMatrix4d HydraSceneDelegate::GetTransform(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
InstancerData *i_data = instancer_data(id, true);
|
||||
if (i_data) {
|
||||
return i_data->transform(id);
|
||||
@ -69,7 +69,7 @@ pxr::GfMatrix4d HydraSceneDelegate::GetTransform(pxr::SdfPath const &id)
|
||||
|
||||
pxr::VtValue HydraSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const &key)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
ObjectData *obj_data = object_data(id);
|
||||
if (obj_data) {
|
||||
return obj_data->get_data(id, key);
|
||||
@ -88,7 +88,7 @@ pxr::VtValue HydraSceneDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const
|
||||
pxr::VtValue HydraSceneDelegate::GetLightParamValue(pxr::SdfPath const &id,
|
||||
pxr::TfToken const &key)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
LightData *l_data = light_data(id);
|
||||
if (l_data) {
|
||||
return l_data->get_data(key);
|
||||
@ -99,7 +99,7 @@ pxr::VtValue HydraSceneDelegate::GetLightParamValue(pxr::SdfPath const &id,
|
||||
pxr::HdPrimvarDescriptorVector HydraSceneDelegate::GetPrimvarDescriptors(
|
||||
pxr::SdfPath const &id, pxr::HdInterpolation interpolation)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %d", id.GetText(), interpolation);
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s, %d", id.GetText(), interpolation);
|
||||
MeshData *m_data = mesh_data(id);
|
||||
if (m_data) {
|
||||
return m_data->primvar_descriptors(interpolation);
|
||||
@ -117,7 +117,7 @@ pxr::HdPrimvarDescriptorVector HydraSceneDelegate::GetPrimvarDescriptors(
|
||||
|
||||
pxr::SdfPath HydraSceneDelegate::GetMaterialId(pxr::SdfPath const &rprim_id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", rprim_id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", rprim_id.GetText());
|
||||
ObjectData *obj_data = object_data(rprim_id);
|
||||
if (obj_data) {
|
||||
return obj_data->material_id(rprim_id);
|
||||
@ -127,7 +127,7 @@ pxr::SdfPath HydraSceneDelegate::GetMaterialId(pxr::SdfPath const &rprim_id)
|
||||
|
||||
pxr::VtValue HydraSceneDelegate::GetMaterialResource(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
MaterialData *mat_data = material_data(id);
|
||||
if (mat_data) {
|
||||
return mat_data->get_material_resource();
|
||||
@ -137,7 +137,7 @@ pxr::VtValue HydraSceneDelegate::GetMaterialResource(pxr::SdfPath const &id)
|
||||
|
||||
bool HydraSceneDelegate::GetVisible(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
if (id == world_prim_id()) {
|
||||
return true;
|
||||
}
|
||||
@ -150,19 +150,19 @@ bool HydraSceneDelegate::GetVisible(pxr::SdfPath const &id)
|
||||
|
||||
bool HydraSceneDelegate::GetDoubleSided(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
return mesh_data(id)->double_sided(id);
|
||||
}
|
||||
|
||||
pxr::HdCullStyle HydraSceneDelegate::GetCullStyle(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", id.GetText());
|
||||
return mesh_data(id)->cull_style(id);
|
||||
}
|
||||
|
||||
pxr::SdfPath HydraSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", prim_id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", prim_id.GetText());
|
||||
InstancerData *i_data = instancer_data(prim_id, true);
|
||||
if (i_data && mesh_data(prim_id)) {
|
||||
return i_data->prim_id;
|
||||
@ -172,7 +172,7 @@ pxr::SdfPath HydraSceneDelegate::GetInstancerId(pxr::SdfPath const &prim_id)
|
||||
|
||||
pxr::SdfPathVector HydraSceneDelegate::GetInstancerPrototypes(pxr::SdfPath const &instancer_id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
||||
InstancerData *i_data = instancer_data(instancer_id);
|
||||
return i_data->prototypes();
|
||||
}
|
||||
@ -180,14 +180,14 @@ pxr::SdfPathVector HydraSceneDelegate::GetInstancerPrototypes(pxr::SdfPath const
|
||||
pxr::VtIntArray HydraSceneDelegate::GetInstanceIndices(pxr::SdfPath const &instancer_id,
|
||||
pxr::SdfPath const &prototype_id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s, %s", instancer_id.GetText(), prototype_id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s, %s", instancer_id.GetText(), prototype_id.GetText());
|
||||
InstancerData *i_data = instancer_data(instancer_id);
|
||||
return i_data->indices(prototype_id);
|
||||
}
|
||||
|
||||
pxr::GfMatrix4d HydraSceneDelegate::GetInstancerTransform(pxr::SdfPath const &instancer_id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", instancer_id.GetText());
|
||||
InstancerData *i_data = instancer_data(instancer_id);
|
||||
return i_data->transform(instancer_id);
|
||||
}
|
||||
@ -195,7 +195,7 @@ pxr::GfMatrix4d HydraSceneDelegate::GetInstancerTransform(pxr::SdfPath const &in
|
||||
pxr::HdVolumeFieldDescriptorVector HydraSceneDelegate::GetVolumeFieldDescriptors(
|
||||
pxr::SdfPath const &volume_id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 3, "%s", volume_id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 3, "%s", volume_id.GetText());
|
||||
VolumeData *v_data = volume_data(volume_id);
|
||||
return v_data->field_descriptors();
|
||||
}
|
||||
@ -271,8 +271,8 @@ ObjectData *HydraSceneDelegate::object_data(pxr::SdfPath const &id) const
|
||||
if (id == world_prim_id()) {
|
||||
return world_data_.get();
|
||||
}
|
||||
|
||||
pxr::SdfPath p_id = (id.GetName().find("SM_") == 0 || id.GetName().find("VF_") == 0) ?
|
||||
auto name = id.GetName();
|
||||
pxr::SdfPath p_id = (STRPREFIX(name.c_str(), "SM_") || STRPREFIX(name.c_str(), "VF_")) ?
|
||||
id.GetParentPath() :
|
||||
id;
|
||||
auto obj_data = objects_.lookup_ptr(p_id);
|
||||
@ -378,7 +378,7 @@ void HydraSceneDelegate::check_updates()
|
||||
data.only_updated = true;
|
||||
ITER_BEGIN (DEG_iterator_ids_begin, DEG_iterator_ids_next, DEG_iterator_ids_end, &data, ID *, id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE,
|
||||
CLOG_INFO(LOG_HYDRA_SCENE,
|
||||
0,
|
||||
"Update: %s [%s]",
|
||||
id->name,
|
||||
@ -459,7 +459,7 @@ void HydraSceneDelegate::update_collection()
|
||||
continue;
|
||||
}
|
||||
|
||||
instancer_data_->update_instance(data.dupli_parent, dupli);
|
||||
instancer_data_->update_instance(dupli);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ struct View3D;
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
extern struct CLG_LogRef *LOG_RENDER_HYDRA_SCENE;
|
||||
extern struct CLG_LogRef *LOG_HYDRA_SCENE;
|
||||
|
||||
class Engine;
|
||||
|
||||
|
@ -50,10 +50,10 @@ class IdData {
|
||||
};
|
||||
|
||||
#define ID_LOG(level, msg, ...) \
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, level, "%s: " msg, prim_id.GetText(), ##__VA_ARGS__);
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, level, "%s: " msg, prim_id.GetText(), ##__VA_ARGS__);
|
||||
|
||||
#define ID_LOGN(level, msg, ...) \
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, \
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, \
|
||||
level, \
|
||||
"%s (%s): " msg, \
|
||||
prim_id.GetText(), \
|
||||
|
@ -56,10 +56,10 @@ static std::string cache_image_file(
|
||||
opts.save_copy = true;
|
||||
STRNCPY(opts.filepath, file_path.c_str());
|
||||
if (BKE_image_save(nullptr, bmain, image, iuser, &opts)) {
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 1, "%s -> %s", image->id.name, file_path.c_str());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 1, "%s -> %s", image->id.name, file_path.c_str());
|
||||
}
|
||||
else {
|
||||
CLOG_ERROR(LOG_RENDER_HYDRA_SCENE, "Can't save %s", file_path.c_str());
|
||||
CLOG_ERROR(LOG_HYDRA_SCENE, "Can't save %s", file_path.c_str());
|
||||
file_path = "";
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ std::string cache_or_get_image_file(Main *bmain, Scene *scene, Image *image, Ima
|
||||
}
|
||||
}
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 1, "%s -> %s", image->id.name, file_path.c_str());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 1, "%s -> %s", image->id.name, file_path.c_str());
|
||||
return file_path;
|
||||
}
|
||||
|
||||
@ -109,10 +109,10 @@ std::string cache_image_color(float color[4])
|
||||
ibuf->ftype = IMB_FTYPE_RADHDR;
|
||||
|
||||
if (IMB_saveiff(ibuf, file_path.c_str(), IB_rectfloat)) {
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 1, "%s", file_path.c_str());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 1, "%s", file_path.c_str());
|
||||
}
|
||||
else {
|
||||
CLOG_ERROR(LOG_RENDER_HYDRA_SCENE, "Can't save %s", file_path.c_str());
|
||||
CLOG_ERROR(LOG_HYDRA_SCENE, "Can't save %s", file_path.c_str());
|
||||
file_path = "";
|
||||
}
|
||||
IMB_freeImBuf(ibuf);
|
||||
|
@ -23,7 +23,7 @@ void InstancerData::insert() {}
|
||||
|
||||
void InstancerData::remove()
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA_SCENE, 1, "%s", prim_id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_SCENE, 1, "%s", prim_id.GetText());
|
||||
for (auto &m_inst : mesh_instances_.values()) {
|
||||
m_inst.data->remove();
|
||||
}
|
||||
@ -129,7 +129,7 @@ void InstancerData::pre_update()
|
||||
}
|
||||
}
|
||||
|
||||
void InstancerData::update_instance(Object * /* parent_ob */, DupliObject *dupli)
|
||||
void InstancerData::update_instance(DupliObject *dupli)
|
||||
{
|
||||
Object *object = dupli->ob;
|
||||
pxr::SdfPath p_id = object_prim_id(object);
|
||||
|
@ -51,7 +51,7 @@ class InstancerData : public IdData {
|
||||
* ...
|
||||
* post_update() */
|
||||
void pre_update();
|
||||
void update_instance(Object *parent_ob, DupliObject *dupli);
|
||||
void update_instance(DupliObject *dupli);
|
||||
void post_update();
|
||||
|
||||
private:
|
||||
|
@ -155,28 +155,28 @@ pxr::TfToken LightData::prim_type(Light *light)
|
||||
switch (light->area_shape) {
|
||||
case LA_AREA_SQUARE:
|
||||
case LA_AREA_RECT:
|
||||
return pxr::TfToken(pxr::HdPrimTypeTokens->rectLight);
|
||||
return pxr::HdPrimTypeTokens->rectLight;
|
||||
|
||||
case LA_AREA_DISK:
|
||||
case LA_AREA_ELLIPSE:
|
||||
return pxr::TfToken(pxr::HdPrimTypeTokens->diskLight);
|
||||
return pxr::HdPrimTypeTokens->diskLight;
|
||||
|
||||
default:
|
||||
return pxr::TfToken(pxr::HdPrimTypeTokens->rectLight);
|
||||
return pxr::HdPrimTypeTokens->rectLight;
|
||||
}
|
||||
break;
|
||||
|
||||
case LA_LOCAL:
|
||||
case LA_SPOT:
|
||||
return pxr::TfToken(pxr::HdPrimTypeTokens->sphereLight);
|
||||
return pxr::HdPrimTypeTokens->sphereLight;
|
||||
|
||||
case LA_SUN:
|
||||
return pxr::TfToken(pxr::HdPrimTypeTokens->distantLight);
|
||||
return pxr::HdPrimTypeTokens->distantLight;
|
||||
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return pxr::TfToken(pxr::HdPrimTypeTokens->sphereLight);
|
||||
}
|
||||
return pxr::TfToken();
|
||||
}
|
||||
|
||||
} // namespace blender::io::hydra
|
||||
|
@ -174,7 +174,7 @@ void MaterialData::export_mtlx()
|
||||
err_str += PyUnicode_AsUTF8(pstr);
|
||||
Py_DECREF(pstr);
|
||||
}
|
||||
CLOG_ERROR(LOG_RENDER_HYDRA_SCENE,
|
||||
CLOG_ERROR(LOG_HYDRA_SCENE,
|
||||
"Export error for %s (%s): %s",
|
||||
prim_id.GetText(),
|
||||
id->name,
|
||||
|
@ -50,7 +50,7 @@ void VolumeModifierData::init()
|
||||
scene_delegate_->depsgraph, object, md);
|
||||
|
||||
if ((modifier_->domain->cache_data_format & FLUID_DOMAIN_FILE_OPENVDB) == 0) {
|
||||
CLOG_WARN(LOG_RENDER_HYDRA_SCENE,
|
||||
CLOG_WARN(LOG_HYDRA_SCENE,
|
||||
"Volume %s is't exported: only OpenVDB file format supported",
|
||||
prim_id.GetText());
|
||||
return;
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace blender::render::hydra {
|
||||
|
||||
CLG_LOGREF_DECLARE_GLOBAL(LOG_RENDER_HYDRA, "render.hydra");
|
||||
CLG_LOGREF_DECLARE_GLOBAL(LOG_HYDRA_RENDER, "hydra.render");
|
||||
|
||||
Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
|
||||
: render_delegate_name_(render_delegate_name), bl_engine_(bl_engine)
|
||||
@ -76,9 +76,11 @@ Engine::Engine(RenderEngine *bl_engine, const std::string &render_delegate_name)
|
||||
|
||||
void Engine::sync(Depsgraph *depsgraph, bContext *context)
|
||||
{
|
||||
const Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
depsgraph_ = depsgraph;
|
||||
context_ = context;
|
||||
scene_ = DEG_get_evaluated_scene(depsgraph);
|
||||
|
||||
if (scene->hydra.export_method == SCE_HYDRA_EXPORT_HYDRA) {
|
||||
if (scene_->hydra.export_method == SCE_HYDRA_EXPORT_HYDRA) {
|
||||
/* Fast path. */
|
||||
usd_scene_delegate_.reset();
|
||||
|
||||
@ -118,21 +120,15 @@ void Engine::set_sync_setting(const std::string &key, const pxr::VtValue &val)
|
||||
|
||||
void Engine::set_render_setting(const std::string &key, const pxr::VtValue &val)
|
||||
{
|
||||
if (STRPREFIX(key.c_str(), "aovToken:")) {
|
||||
render_delegate_settings_.aovs.add_new(key.substr(key.find(":") + 1),
|
||||
pxr::TfToken(val.UncheckedGet<std::string>()));
|
||||
}
|
||||
else {
|
||||
render_delegate_->SetRenderSetting(pxr::TfToken(key), val);
|
||||
}
|
||||
}
|
||||
|
||||
float Engine::renderer_percent_done()
|
||||
{
|
||||
pxr::VtDictionary render_stats = render_delegate_->GetRenderStats();
|
||||
auto it = render_stats.find("percentDone");
|
||||
if (it == render_stats.end()) {
|
||||
return 0.0;
|
||||
return 0.0f;
|
||||
}
|
||||
return (float)it->second.UncheckedGet<double>();
|
||||
}
|
||||
|
@ -27,16 +27,15 @@ struct CLG_LogRef;
|
||||
|
||||
namespace blender::render::hydra {
|
||||
|
||||
extern struct CLG_LogRef *LOG_RENDER_HYDRA;
|
||||
|
||||
struct RenderDelegateSettings {
|
||||
Map<std::string, pxr::TfToken> aovs;
|
||||
};
|
||||
extern struct CLG_LogRef *LOG_HYDRA_RENDER;
|
||||
|
||||
class Engine {
|
||||
protected:
|
||||
std::string render_delegate_name_;
|
||||
RenderEngine *bl_engine_ = nullptr;
|
||||
Depsgraph *depsgraph_ = nullptr;
|
||||
bContext *context_ = nullptr;
|
||||
Scene *scene_ = nullptr;
|
||||
|
||||
/* The order is important due to deletion order */
|
||||
pxr::HgiUniquePtr hgi_;
|
||||
@ -48,7 +47,6 @@ class Engine {
|
||||
std::unique_ptr<io::hydra::HydraSceneDelegate> hydra_scene_delegate_;
|
||||
std::unique_ptr<io::hydra::USDSceneDelegate> usd_scene_delegate_;
|
||||
|
||||
RenderDelegateSettings render_delegate_settings_;
|
||||
std::unique_ptr<RenderTaskDelegate> render_task_delegate_;
|
||||
std::unique_ptr<pxr::HdxFreeCameraSceneDelegate> free_camera_delegate_;
|
||||
std::unique_ptr<LightTasksDelegate> light_tasks_delegate_;
|
||||
@ -59,13 +57,14 @@ class Engine {
|
||||
virtual ~Engine() = default;
|
||||
|
||||
void sync(Depsgraph *depsgraph, bContext *context);
|
||||
virtual void render(Depsgraph *depsgraph) = 0;
|
||||
virtual void render() = 0;
|
||||
|
||||
void set_sync_setting(const std::string &key, const pxr::VtValue &val);
|
||||
void set_render_setting(const std::string &key, const pxr::VtValue &val);
|
||||
virtual void set_render_setting(const std::string &key, const pxr::VtValue &val);
|
||||
|
||||
protected:
|
||||
float renderer_percent_done();
|
||||
virtual void notify_status(float progress, const std::string &title, const std::string &info) = 0;
|
||||
};
|
||||
|
||||
} // namespace blender::render::hydra
|
||||
|
@ -23,17 +23,14 @@
|
||||
|
||||
namespace blender::render::hydra {
|
||||
|
||||
void FinalEngine::render(Depsgraph *depsgraph)
|
||||
void FinalEngine::render()
|
||||
{
|
||||
const Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
const ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
|
||||
const ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph_);
|
||||
|
||||
char scene_name[MAX_ID_FULL_NAME];
|
||||
BKE_id_full_name_get(scene_name, &scene->id, 0);
|
||||
scene_name_ = scene_name;
|
||||
layer_name_ = view_layer->name;
|
||||
BKE_id_full_name_get(scene_name, &scene_->id, 0);
|
||||
|
||||
const RenderData &r = scene->r;
|
||||
const RenderData &r = scene_->r;
|
||||
pxr::GfVec4f border(0, 0, 1, 1);
|
||||
if (r.mode & R_BORDER) {
|
||||
border.Set(r.border.xmin,
|
||||
@ -42,33 +39,36 @@ void FinalEngine::render(Depsgraph *depsgraph)
|
||||
r.border.ymax - r.border.ymin);
|
||||
}
|
||||
pxr::GfVec2i image_res(r.xsch * r.size / 100, r.ysch * r.size / 100);
|
||||
resolution_ = pxr::GfVec2i(int(image_res[0] * border[2]), int(image_res[1] * border[3]));
|
||||
int width = image_res[0] * border[2];
|
||||
int height = image_res[1] * border[3];
|
||||
pxr::GfCamera camera =
|
||||
io::hydra::CameraData(scene->camera, image_res, pxr::GfVec4f(0, 0, 1, 1)).gf_camera(border);
|
||||
io::hydra::CameraData(scene_->camera, image_res, pxr::GfVec4f(0, 0, 1, 1)).gf_camera(border);
|
||||
|
||||
free_camera_delegate_->SetCamera(camera);
|
||||
render_task_delegate_->set_viewport(pxr::GfVec4d(0, 0, resolution_[0], resolution_[1]));
|
||||
render_task_delegate_->set_viewport(pxr::GfVec4d(0, 0, width, height));
|
||||
if (light_tasks_delegate_) {
|
||||
light_tasks_delegate_->set_viewport(pxr::GfVec4d(0, 0, resolution_[0], resolution_[1]));
|
||||
light_tasks_delegate_->set_viewport(pxr::GfVec4d(0, 0, width, height));
|
||||
}
|
||||
|
||||
render_task_delegate_->add_aov(pxr::HdAovTokens->color);
|
||||
if (bl_engine_->type->flag & RE_USE_GPU_CONTEXT) {
|
||||
render_task_delegate_->add_aov(pxr::HdAovTokens->depth);
|
||||
RenderResult *rr = RE_engine_get_result(bl_engine_);
|
||||
RenderLayer *rlayer = (RenderLayer *)rr->layers.first;
|
||||
LISTBASE_FOREACH (RenderPass *, rpass, &rlayer->passes) {
|
||||
pxr::TfToken *aov_token = aov_tokens_.lookup_ptr(rpass->name);
|
||||
if (!aov_token) {
|
||||
CLOG_WARN(LOG_HYDRA_RENDER, "Couldn't find AOV token for render pass: %s", rpass->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
RenderResult *result = RE_engine_get_result(bl_engine_);
|
||||
RenderLayer *layer = (RenderLayer *)result->layers.first;
|
||||
for (RenderPass *pass = (RenderPass *)layer->passes.first; pass != nullptr; pass = pass->next) {
|
||||
pxr::TfToken *aov_token = render_delegate_settings_.aovs.lookup_ptr(pass->name);
|
||||
if (aov_token) {
|
||||
render_task_delegate_->add_aov(*aov_token);
|
||||
}
|
||||
if (bl_engine_->type->flag & RE_USE_GPU_CONTEXT) {
|
||||
/* For GPU context engine color and depth AOVs has to be added anyway */
|
||||
render_task_delegate_->add_aov(pxr::HdAovTokens->color);
|
||||
render_task_delegate_->add_aov(pxr::HdAovTokens->depth);
|
||||
}
|
||||
|
||||
pxr::HdTaskSharedPtrVector tasks;
|
||||
if (light_tasks_delegate_) {
|
||||
if (scene->r.alphamode != R_ALPHAPREMUL) {
|
||||
if (scene_->r.alphamode != R_ALPHAPREMUL) {
|
||||
tasks.push_back(light_tasks_delegate_->skydome_task());
|
||||
}
|
||||
tasks.push_back(light_tasks_delegate_->simple_task());
|
||||
@ -92,7 +92,7 @@ void FinalEngine::render(Depsgraph *depsgraph)
|
||||
BLI_timecode_string_from_time_simple(
|
||||
elapsed_time, sizeof(elapsed_time), PIL_check_seconds_timer() - time_begin);
|
||||
notify_status(percent_done / 100.0,
|
||||
scene_name_ + ": " + layer_name_,
|
||||
std::string(scene_name) + ": " + view_layer->name,
|
||||
std::string("Render Time: ") + elapsed_time +
|
||||
" | Done: " + std::to_string(int(percent_done)) + "%");
|
||||
|
||||
@ -100,30 +100,39 @@ void FinalEngine::render(Depsgraph *depsgraph)
|
||||
break;
|
||||
}
|
||||
|
||||
update_render_result();
|
||||
update_render_result(width, height, view_layer->name);
|
||||
}
|
||||
|
||||
update_render_result();
|
||||
update_render_result(width, height, view_layer->name);
|
||||
render_task_delegate_->unbind();
|
||||
}
|
||||
|
||||
void FinalEngine::set_render_setting(const std::string &key, const pxr::VtValue &val)
|
||||
{
|
||||
if (STRPREFIX(key.c_str(), "aovToken:")) {
|
||||
aov_tokens_.add_overwrite(key.substr(key.find(":") + 1),
|
||||
pxr::TfToken(val.UncheckedGet<std::string>()));
|
||||
return;
|
||||
}
|
||||
Engine::set_render_setting(key, val);
|
||||
}
|
||||
|
||||
void FinalEngine::notify_status(float progress, const std::string &title, const std::string &info)
|
||||
{
|
||||
RE_engine_update_progress(bl_engine_, progress);
|
||||
RE_engine_update_stats(bl_engine_, title.c_str(), info.c_str());
|
||||
}
|
||||
|
||||
void FinalEngine::update_render_result()
|
||||
void FinalEngine::update_render_result(int width, int height, const char *layer_name)
|
||||
{
|
||||
RenderResult *rr = RE_engine_begin_result(
|
||||
bl_engine_, 0, 0, resolution_[0], resolution_[1], layer_name_.c_str(), nullptr);
|
||||
RenderResult *rr = RE_engine_begin_result(bl_engine_, 0, 0, width, height, layer_name, nullptr);
|
||||
|
||||
RenderLayer *rlayer = static_cast<RenderLayer *>(
|
||||
BLI_findstring(&rr->layers, layer_name_.c_str(), offsetof(RenderLayer, name)));
|
||||
BLI_findstring(&rr->layers, layer_name, offsetof(RenderLayer, name)));
|
||||
|
||||
if (rlayer) {
|
||||
LISTBASE_FOREACH (RenderPass *, rpass, &rlayer->passes) {
|
||||
pxr::TfToken *aov_token = render_delegate_settings_.aovs.lookup_ptr(rpass->name);
|
||||
pxr::TfToken *aov_token = aov_tokens_.lookup_ptr(rpass->name);
|
||||
if (aov_token) {
|
||||
render_task_delegate_->read_aov(*aov_token, rpass->ibuf->float_buffer.data);
|
||||
}
|
||||
|
@ -8,19 +8,20 @@
|
||||
namespace blender::render::hydra {
|
||||
|
||||
class FinalEngine : public Engine {
|
||||
protected:
|
||||
std::string scene_name_;
|
||||
std::string layer_name_;
|
||||
pxr::GfVec2i resolution_;
|
||||
private:
|
||||
Map<std::string, pxr::TfToken> aov_tokens_;
|
||||
|
||||
public:
|
||||
using Engine::Engine;
|
||||
|
||||
void render(Depsgraph *depsgraph) override;
|
||||
void render() override;
|
||||
void set_render_setting(const std::string &key, const pxr::VtValue &val) override;
|
||||
|
||||
protected:
|
||||
virtual void notify_status(float progress, const std::string &title, const std::string &info);
|
||||
void update_render_result();
|
||||
void notify_status(float progress, const std::string &title, const std::string &info) override;
|
||||
|
||||
private:
|
||||
void update_render_result(int width, int height, const char *layer_name);
|
||||
};
|
||||
|
||||
} // namespace blender::render::hydra
|
||||
|
@ -15,13 +15,13 @@ LightTasksDelegate::LightTasksDelegate(pxr::HdRenderIndex *parent_index,
|
||||
skydome_task_id_ = GetDelegateID().AppendElementString("skydomeTask");
|
||||
GetRenderIndex().InsertTask<pxr::HdxSkydomeTask>(this, skydome_task_id_);
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "%s", simple_task_id_.GetText());
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "%s", skydome_task_id_.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 1, "%s", simple_task_id_.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 1, "%s", skydome_task_id_.GetText());
|
||||
}
|
||||
|
||||
pxr::VtValue LightTasksDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const &key)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
|
||||
if (key == pxr::HdTokens->params) {
|
||||
if (id == simple_task_id_) {
|
||||
|
@ -50,11 +50,11 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
|
||||
}
|
||||
}
|
||||
catch (std::runtime_error &e) {
|
||||
CLOG_ERROR(LOG_RENDER_HYDRA, "%s", e.what());
|
||||
CLOG_ERROR(LOG_HYDRA_RENDER, "%s", e.what());
|
||||
}
|
||||
|
||||
if (engine) {
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p %s", engine, engine_type);
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 1, "Engine %p %s", engine, engine_type);
|
||||
}
|
||||
return PyLong_FromVoidPtr(engine);
|
||||
}
|
||||
@ -69,7 +69,7 @@ static PyObject *engine_free_func(PyObject * /*self*/, PyObject *args)
|
||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||
delete engine;
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "Engine %p", engine);
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 1, "Engine %p", engine);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ static PyObject *engine_update_func(PyObject * /*self*/, PyObject *args)
|
||||
Depsgraph *depsgraph = pyrna_to_pointer<Depsgraph>(pydepsgraph, &RNA_Depsgraph);
|
||||
bContext *context = pyrna_to_pointer<bContext>(pycontext, &RNA_Context);
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %p", engine);
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 2, "Engine %p", engine);
|
||||
engine->sync(depsgraph, context);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
@ -92,20 +92,18 @@ static PyObject *engine_update_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
static PyObject *engine_render_func(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject *pyengine, *pydepsgraph;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OO", &pyengine, &pydepsgraph)) {
|
||||
PyObject *pyengine;
|
||||
if (!PyArg_ParseTuple(args, "O", &pyengine)) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||
Depsgraph *depsgraph = pyrna_to_pointer<Depsgraph>(pydepsgraph, &RNA_Depsgraph);
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 2, "Engine %p", engine);
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 2, "Engine %p", engine);
|
||||
|
||||
/* Allow Blender to execute other Python scripts. */
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
engine->render(depsgraph);
|
||||
engine->render();
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
Py_RETURN_NONE;
|
||||
@ -113,20 +111,19 @@ static PyObject *engine_render_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
static PyObject *engine_view_draw_func(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject *pyengine, *pydepsgraph, *pycontext;
|
||||
if (!PyArg_ParseTuple(args, "OOO", &pyengine, &pydepsgraph, &pycontext)) {
|
||||
PyObject *pyengine, *pycontext;
|
||||
if (!PyArg_ParseTuple(args, "OO", &pyengine, &pycontext)) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
ViewportEngine *engine = static_cast<ViewportEngine *>(PyLong_AsVoidPtr(pyengine));
|
||||
Depsgraph *depsgraph = pyrna_to_pointer<Depsgraph>(pydepsgraph, &RNA_Depsgraph);
|
||||
bContext *context = pyrna_to_pointer<bContext>(pycontext, &RNA_Context);
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 3, "Engine %p", engine);
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "Engine %p", engine);
|
||||
|
||||
/* Allow Blender to execute other Python scripts. */
|
||||
Py_BEGIN_ALLOW_THREADS;
|
||||
engine->render(depsgraph, context);
|
||||
engine->render(context);
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
||||
Py_RETURN_NONE;
|
||||
@ -160,7 +157,7 @@ static PyObject *engine_set_sync_setting_func(PyObject * /*self*/, PyObject *arg
|
||||
|
||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 3, "Engine %p: %s", engine, key);
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "Engine %p: %s", engine, key);
|
||||
engine->set_sync_setting(key, get_setting_val(pyval));
|
||||
|
||||
Py_RETURN_NONE;
|
||||
@ -176,7 +173,7 @@ static PyObject *engine_set_render_setting_func(PyObject * /*self*/, PyObject *a
|
||||
|
||||
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 3, "Engine %p: %s", engine, key);
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "Engine %p: %s", engine, key);
|
||||
engine->set_render_setting(key, get_setting_val(pyval));
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
@ -28,12 +28,12 @@ RenderTaskDelegate::RenderTaskDelegate(pxr::HdRenderIndex *parent_index,
|
||||
task_params_.enableLighting = true;
|
||||
task_params_.alphaThreshold = 0.1f;
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "%s", task_id_.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 1, "%s", task_id_.GetText());
|
||||
}
|
||||
|
||||
pxr::VtValue RenderTaskDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const &key)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "%s, %s", id.GetText(), key.GetText());
|
||||
|
||||
if (key == pxr::HdTokens->params) {
|
||||
return pxr::VtValue(task_params_);
|
||||
@ -47,14 +47,14 @@ pxr::VtValue RenderTaskDelegate::Get(pxr::SdfPath const &id, pxr::TfToken const
|
||||
|
||||
pxr::TfTokenVector RenderTaskDelegate::GetTaskRenderTags(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "%s", id.GetText());
|
||||
|
||||
return {pxr::HdRenderTagTokens->geometry};
|
||||
}
|
||||
|
||||
pxr::HdRenderBufferDescriptor RenderTaskDelegate::GetRenderBufferDescriptor(pxr::SdfPath const &id)
|
||||
{
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 3, "%s", id.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "%s", id.GetText());
|
||||
|
||||
return buffer_descriptors_[id];
|
||||
}
|
||||
@ -124,7 +124,7 @@ void RenderTaskDelegate::add_aov(pxr::TfToken const &aov_key)
|
||||
task_params_.aovBindings.push_back(binding);
|
||||
render_index.GetChangeTracker().MarkTaskDirty(task_id_, pxr::HdChangeTracker::DirtyParams);
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "%s", aov_key.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 1, "%s", aov_key.GetText());
|
||||
}
|
||||
|
||||
void RenderTaskDelegate::read_aov(pxr::TfToken const &aov_key, void *data)
|
||||
@ -225,7 +225,7 @@ void GPURenderTaskDelegate::add_aov(pxr::TfToken const &aov_key)
|
||||
GPU_TEXTURE_USAGE_GENERAL,
|
||||
nullptr);
|
||||
|
||||
CLOG_INFO(LOG_RENDER_HYDRA, 1, "%s", aov_key.GetText());
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 1, "%s", aov_key.GetText());
|
||||
}
|
||||
|
||||
void GPURenderTaskDelegate::read_aov(pxr::TfToken const &aov_key, void *data)
|
||||
@ -289,6 +289,7 @@ void GPURenderTaskDelegate::bind()
|
||||
glGenVertexArrays(1, &VAO_);
|
||||
glBindVertexArray(VAO_);
|
||||
}
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "");
|
||||
}
|
||||
|
||||
void GPURenderTaskDelegate::unbind()
|
||||
@ -301,6 +302,7 @@ void GPURenderTaskDelegate::unbind()
|
||||
GPU_framebuffer_free(framebuffer_);
|
||||
framebuffer_ = nullptr;
|
||||
}
|
||||
CLOG_INFO(LOG_HYDRA_RENDER, 3, "");
|
||||
}
|
||||
|
||||
GPUTexture *GPURenderTaskDelegate::aov_texture(pxr::TfToken const &aov_key)
|
||||
|
@ -31,7 +31,7 @@ class RenderTaskDelegate : public pxr::HdSceneDelegate {
|
||||
|
||||
pxr::HdTaskSharedPtr task();
|
||||
void set_camera(pxr::SdfPath const &camera_id);
|
||||
virtual bool is_converged();
|
||||
bool is_converged();
|
||||
virtual void set_viewport(pxr::GfVec4d const &viewport);
|
||||
virtual void add_aov(pxr::TfToken const &aov_key);
|
||||
virtual void read_aov(pxr::TfToken const &aov_key, void *data);
|
||||
|
@ -210,15 +210,9 @@ GPUTexture *DrawTexture::texture() const
|
||||
return texture_;
|
||||
}
|
||||
|
||||
void ViewportEngine::render(Depsgraph * /* depsgraph */)
|
||||
void ViewportEngine::render()
|
||||
{
|
||||
/* Empty function */
|
||||
}
|
||||
|
||||
void ViewportEngine::render(Depsgraph *depsgraph, bContext *context)
|
||||
{
|
||||
ViewSettings view_settings(context);
|
||||
const Scene *scene = DEG_get_evaluated_scene(depsgraph);
|
||||
ViewSettings view_settings(context_);
|
||||
if (view_settings.width() * view_settings.height() == 0) {
|
||||
return;
|
||||
};
|
||||
@ -240,7 +234,7 @@ void ViewportEngine::render(Depsgraph *depsgraph, bContext *context)
|
||||
|
||||
pxr::HdTaskSharedPtrVector tasks;
|
||||
if (light_tasks_delegate_) {
|
||||
if (scene->r.alphamode != R_ALPHAPREMUL) {
|
||||
if (scene_->r.alphamode != R_ALPHAPREMUL) {
|
||||
tasks.push_back(light_tasks_delegate_->skydome_task());
|
||||
}
|
||||
tasks.push_back(light_tasks_delegate_->simple_task());
|
||||
@ -280,18 +274,27 @@ void ViewportEngine::render(Depsgraph *depsgraph, bContext *context)
|
||||
BLI_timecode_string_from_time_simple(
|
||||
elapsed_time, sizeof(elapsed_time), PIL_check_seconds_timer() - time_begin_);
|
||||
|
||||
float percent_done = renderer_percent_done();
|
||||
if (!render_task_delegate_->is_converged()) {
|
||||
notify_status(std::string("Time: ") + elapsed_time +
|
||||
" | Done: " + std::to_string(int(renderer_percent_done())) + "%",
|
||||
notify_status(percent_done / 100.0,
|
||||
std ::string("Time: ") + elapsed_time +
|
||||
" | Done: " + std::to_string(int(percent_done)) + "%",
|
||||
"Render");
|
||||
bl_engine_->flag |= RE_ENGINE_DO_DRAW;
|
||||
}
|
||||
else {
|
||||
notify_status((std::string("Time: ") + elapsed_time).c_str(), "Rendering Done");
|
||||
notify_status(percent_done / 100.0, std::string("Time: ") + elapsed_time, "Rendering Done");
|
||||
}
|
||||
}
|
||||
|
||||
void ViewportEngine::notify_status(const std::string &info, const std::string &status)
|
||||
void ViewportEngine::render(bContext *context)
|
||||
{
|
||||
context_ = context;
|
||||
render();
|
||||
}
|
||||
|
||||
void ViewportEngine::notify_status(float /*progress*/, const std::string &info,
|
||||
const std::string &status)
|
||||
{
|
||||
RE_engine_update_stats(bl_engine_, status.c_str(), info.c_str());
|
||||
}
|
||||
|
@ -37,11 +37,11 @@ class ViewportEngine : public Engine {
|
||||
public:
|
||||
using Engine::Engine;
|
||||
|
||||
void render(Depsgraph *depsgraph) override;
|
||||
void render(Depsgraph *depsgraph, bContext *context);
|
||||
void render() override;
|
||||
void render(bContext *context);
|
||||
|
||||
private:
|
||||
void notify_status(const std::string &title, const std::string &info);
|
||||
protected:
|
||||
void notify_status(float progress, const std::string &title, const std::string &info) override;
|
||||
};
|
||||
|
||||
} // namespace blender::render::hydra
|
||||
|
Loading…
Reference in New Issue
Block a user