miscellaneous bugfixes and improvements

metadata
Wenzel Jakob 2010-11-23 23:01:47 +01:00
parent 724ef1bf11
commit 94e1d825b7
8 changed files with 45 additions and 10 deletions

View File

@ -125,7 +125,7 @@ class EXPORT_OT_mitsuba(bpy.types.Operator):
bl_idname = 'export.mitsuba' bl_idname = 'export.mitsuba'
bl_label = 'Export Mitsuba Scene (.xml)' bl_label = 'Export Mitsuba Scene (.xml)'
filename = bpy.props.StringProperty(name='Target filename') filename = bpy.props.StringProperty(name='Target filename', subtype = 'FILE_PATH')
directory = bpy.props.StringProperty(name='Target directory') directory = bpy.props.StringProperty(name='Target directory')
scene = bpy.props.StringProperty(options={'HIDDEN'}, default='') scene = bpy.props.StringProperty(options={'HIDDEN'}, default='')
@ -150,6 +150,9 @@ class EXPORT_OT_mitsuba(bpy.types.Operator):
mts_basename = os.path.join( mts_basename = os.path.join(
self.properties.directory, self.properties.directory,
self.properties.filename) self.properties.filename)
(path, ext) = os.path.splitext(mts_basename)
if ext == '.xml':
mts_basename = path
mts_dae_file = mts_basename + ".dae" mts_dae_file = mts_basename + ".dae"
mts_xml_file = mts_basename + ".xml" mts_xml_file = mts_basename + ".xml"
mts_adj_file = mts_basename + "_adjustments.xml" mts_adj_file = mts_basename + "_adjustments.xml"
@ -206,7 +209,10 @@ class EXPORT_OT_mitsuba(bpy.types.Operator):
MtsLog("Caught exception: %s" % ''.join(elist)) MtsLog("Caught exception: %s" % ''.join(elist))
return {'CANCELLED'} return {'CANCELLED'}
menu_func = lambda self, context: self.layout.operator("export.mitsuba", text="Export Mitsuba scene...") def menu_func(self, context):
default_path = os.path.splitext(os.path.basename(bpy.data.filepath))[0] + ".xml"
self.layout.operator("export.mitsuba", text="Export Mitsuba scene...").filename = default_path
bpy.types.INFO_MT_file_export.append(menu_func) bpy.types.INFO_MT_file_export.append(menu_func)
class MITSUBA_OT_material_slot_move(bpy.types.Operator): class MITSUBA_OT_material_slot_move(bpy.types.Operator):

View File

@ -109,6 +109,10 @@ public:
void rayIntersectPacketIncoherent(const RayPacket4 &packet, void rayIntersectPacketIncoherent(const RayPacket4 &packet,
const RayInterval4 &interval, Intersection4 &its, void *temp) const; const RayInterval4 &interval, Intersection4 &its, void *temp) const;
#endif #endif
FINLINE size_type getPrimitiveCount() const {
return m_shapeMap[m_shapeMap.size()-1];
}
MTS_DECLARE_CLASS() MTS_DECLARE_CLASS()
protected: protected:
@ -149,10 +153,6 @@ protected:
} }
} }
FINLINE size_type getPrimitiveCount() const {
return m_shapeMap[m_shapeMap.size()-1];
}
/// Temporarily holds some intersection information /// Temporarily holds some intersection information
struct IntersectionCache { struct IntersectionCache {
size_type shapeIndex; size_type shapeIndex;

View File

@ -50,7 +50,7 @@ GLWidget::GLWidget(QWidget *parent) :
connect(m_preview, SIGNAL(statusMessage(const QString &)), connect(m_preview, SIGNAL(statusMessage(const QString &)),
this, SIGNAL(statusMessage(const QString &)), Qt::QueuedConnection); this, SIGNAL(statusMessage(const QString &)), Qt::QueuedConnection);
m_invertMouse = false; m_invertMouse = false;
m_navigationMode = EFlythroughFixedYaw; m_navigationMode = EFlythrough;
m_ignoreMouseEvent = QPoint(0, 0); m_ignoreMouseEvent = QPoint(0, 0);
m_didSetCursor = false; m_didSetCursor = false;
m_softwareFallback = false; m_softwareFallback = false;
@ -406,7 +406,12 @@ void GLWidget::downloadFramebuffer() {
createdFramebuffer = true; createdFramebuffer = true;
} }
PreviewQueueEntry entry = m_preview->acquireBuffer(); PreviewQueueEntry entry = m_preview->acquireBuffer(1000);
if (entry.buffer == NULL) {
if (createdFramebuffer)
m_framebuffer->init();
return;
}
Point3i size = entry.buffer->getSize(); Point3i size = entry.buffer->getSize();
ref<Bitmap> sourceBitmap = new Bitmap(size.x, size.y, 128); ref<Bitmap> sourceBitmap = new Bitmap(size.x, size.y, 128);

View File

@ -38,7 +38,8 @@ public:
void append(ELogLevel level, const std::string &message) { void append(ELogLevel level, const std::string &message) {
if (!m_ignoreMessages) { if (!m_ignoreMessages) {
emit textMessage(level, QString::fromLatin1(message.c_str())); emit textMessage(level, QString::fromLatin1(message.c_str()));
floodCheck(); if (level >= EWarn)
floodCheck();
} }
} }

View File

@ -141,7 +141,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->glView->setInvertMouse(settings.value("invertMouse", false).toBool()); ui->glView->setInvertMouse(settings.value("invertMouse", false).toBool());
ui->glView->setMouseSensitivity(settings.value("mouseSensitivity", 3).toInt()); ui->glView->setMouseSensitivity(settings.value("mouseSensitivity", 3).toInt());
ui->glView->setNavigationMode((ENavigationMode) settings.value("navigationMode", ui->glView->setNavigationMode((ENavigationMode) settings.value("navigationMode",
EFlythroughFixedYaw).toInt()); EFlythrough).toInt());
m_searchPaths = settings.value("searchPaths", QStringList()).toStringList(); m_searchPaths = settings.value("searchPaths", QStringList()).toStringList();
m_blockSize = settings.value("blockSize", 32).toInt(); m_blockSize = settings.value("blockSize", 32).toInt();
m_listenPort = settings.value("listenPort", MTS_DEFAULT_PORT).toInt(); m_listenPort = settings.value("listenPort", MTS_DEFAULT_PORT).toInt();

View File

@ -48,6 +48,8 @@ public:
AABB getAABB() const { AABB getAABB() const {
const KDTree *kdtree = m_shapeGroup->getKDTree(); const KDTree *kdtree = m_shapeGroup->getKDTree();
const AABB &aabb = kdtree->getAABB(); const AABB &aabb = kdtree->getAABB();
if (!aabb.isValid()) // the geometry group is empty
return aabb;
AABB result; AABB result;
for (int i=0; i<8; ++i) for (int i=0; i<8; ++i)
result.expandBy(m_objectToWorld(aabb.getCorner(i))); result.expandBy(m_objectToWorld(aabb.getCorner(i)));

View File

@ -22,6 +22,7 @@ MTS_NAMESPACE_BEGIN
ShapeGroup::ShapeGroup(const Properties &props) : Shape(props) { ShapeGroup::ShapeGroup(const Properties &props) : Shape(props) {
m_kdtree = new KDTree(); m_kdtree = new KDTree();
m_name = props.getID();
} }
ShapeGroup::ShapeGroup(Stream *stream, InstanceManager *manager) ShapeGroup::ShapeGroup(Stream *stream, InstanceManager *manager)
@ -85,6 +86,19 @@ bool ShapeGroup::isCompound() const {
return true; return true;
} }
std::string ShapeGroup::getName() const {
return m_name;
}
std::string ShapeGroup::toString() const {
std::ostringstream oss;
oss << "ShapeGroup[" << endl
<< " name = \"" << m_name << "\", " << endl
<< " primCount = " << m_kdtree->getPrimitiveCount() << endl
<< "]";
return oss.str();
}
MTS_IMPLEMENT_CLASS_S(ShapeGroup, false, Shape) MTS_IMPLEMENT_CLASS_S(ShapeGroup, false, Shape)
MTS_EXPORT_PLUGIN(ShapeGroup, "Grouped geometry for instancing"); MTS_EXPORT_PLUGIN(ShapeGroup, "Grouped geometry for instancing");
MTS_NAMESPACE_END MTS_NAMESPACE_END

View File

@ -59,9 +59,16 @@ public:
/// Return a pointer to the internal KD-tree /// Return a pointer to the internal KD-tree
inline const KDTree *getKDTree() const { return m_kdtree.get(); } inline const KDTree *getKDTree() const { return m_kdtree.get(); }
/// Return the name of the geometry group
std::string getName() const;
/// Return a string representation
std::string toString() const;
MTS_DECLARE_CLASS() MTS_DECLARE_CLASS()
private: private:
ref<KDTree> m_kdtree; ref<KDTree> m_kdtree;
std::string m_name;
}; };
MTS_NAMESPACE_END MTS_NAMESPACE_END