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_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')
scene = bpy.props.StringProperty(options={'HIDDEN'}, default='')
@ -150,6 +150,9 @@ class EXPORT_OT_mitsuba(bpy.types.Operator):
mts_basename = os.path.join(
self.properties.directory,
self.properties.filename)
(path, ext) = os.path.splitext(mts_basename)
if ext == '.xml':
mts_basename = path
mts_dae_file = mts_basename + ".dae"
mts_xml_file = mts_basename + ".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))
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)
class MITSUBA_OT_material_slot_move(bpy.types.Operator):

View File

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

View File

@ -50,7 +50,7 @@ GLWidget::GLWidget(QWidget *parent) :
connect(m_preview, SIGNAL(statusMessage(const QString &)),
this, SIGNAL(statusMessage(const QString &)), Qt::QueuedConnection);
m_invertMouse = false;
m_navigationMode = EFlythroughFixedYaw;
m_navigationMode = EFlythrough;
m_ignoreMouseEvent = QPoint(0, 0);
m_didSetCursor = false;
m_softwareFallback = false;
@ -406,7 +406,12 @@ void GLWidget::downloadFramebuffer() {
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();
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) {
if (!m_ignoreMessages) {
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->setMouseSensitivity(settings.value("mouseSensitivity", 3).toInt());
ui->glView->setNavigationMode((ENavigationMode) settings.value("navigationMode",
EFlythroughFixedYaw).toInt());
EFlythrough).toInt());
m_searchPaths = settings.value("searchPaths", QStringList()).toStringList();
m_blockSize = settings.value("blockSize", 32).toInt();
m_listenPort = settings.value("listenPort", MTS_DEFAULT_PORT).toInt();

View File

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

View File

@ -22,6 +22,7 @@ MTS_NAMESPACE_BEGIN
ShapeGroup::ShapeGroup(const Properties &props) : Shape(props) {
m_kdtree = new KDTree();
m_name = props.getID();
}
ShapeGroup::ShapeGroup(Stream *stream, InstanceManager *manager)
@ -85,6 +86,19 @@ bool ShapeGroup::isCompound() const {
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_EXPORT_PLUGIN(ShapeGroup, "Grouped geometry for instancing");
MTS_NAMESPACE_END

View File

@ -59,9 +59,16 @@ public:
/// Return a pointer to the internal KD-tree
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()
private:
ref<KDTree> m_kdtree;
std::string m_name;
};
MTS_NAMESPACE_END