Permalink
Browse files

Added global scene scale setting.

  • Loading branch information...
est77 committed Jul 6, 2017
1 parent 98dac62 commit ff351a2af0387ae6408f62defccff9bfcc8516cd
@@ -381,8 +381,12 @@ def create(self):
ui=pm.floatFieldGrp(label="Max Ray Intensity", numberOfFields = 1),
attrName="maxRayIntensity")
with pm.frameLayout(label="Environment", collapsable=True, collapse=False):
with pm.frameLayout(label="Scene", collapsable=True, collapse=False):
with pm.columnLayout("appleseedColumnLayout", adjustableColumn=True, width=columnWidth):
self.__addControl(
ui=pm.floatFieldGrp(label="Scene Scale", numberOfFields = 1),
attrName="sceneScale")
with pm.rowLayout("appleseedRowLayout", nc=3):
pm.text("Environment Light")
ui = pm.optionMenu(changeCommand=self.__environmentLightSelected)
@@ -381,7 +381,10 @@ namespace
m_project->get_scene()->assemblies().insert(assembly);
// Instance the main assembly
asf::auto_release_ptr<asr::AssemblyInstance> assemblyInstance = asr::AssemblyInstanceFactory::create("assembly_inst", asr::ParamArray(), "assembly");
asf::auto_release_ptr<asr::AssemblyInstance> assemblyInstance = asr::AssemblyInstanceFactory::create(
"assembly_inst",
asr::ParamArray(),
"assembly");
m_project->get_scene()->assembly_instances().insert(assemblyInstance);
}
@@ -464,11 +467,37 @@ namespace
}
}
MFnDependencyNode fnDepNode(globalsNode);
// Apply the scene scale factor.
float sceneScale;
if (AttributeUtils::get(fnDepNode, "sceneScale", sceneScale))
{
if (sceneScale != 1.0f)
{
asr::TransformSequence scaleTransformSeq;
scaleTransformSeq.set_transform(0.0, asf::Transformd::from_local_to_parent(
asf::Matrix4d::make_scaling(asf::Vector3d(sceneScale))));
// Scale the main assembly instance.
asr::Scene* scene = m_project->get_scene();
asr::AssemblyInstance* assemblyInstance =
scene->assembly_instances().get_by_name("assembly_inst");
assemblyInstance->transform_sequence() = scaleTransformSeq;
// Apply scaling to all cameras.
for (size_t i = 0, e = scene->cameras().size(); i < e; ++i)
{
asr::Camera* camera = scene->cameras().get_by_index(i);
camera->transform_sequence() = camera->transform_sequence() * scaleTransformSeq;
}
}
}
// Set the resolution.
params.insert("resolution", asf::Vector2i(m_options.m_width, m_options.m_height));
// Set the tile size.
MFnDependencyNode fnDepNode(globalsNode);
int tileSize;
if (AttributeUtils::get(fnDepNode, "tileSize", tileSize))
params.insert("tile_size", asf::Vector2i(tileSize));

This file was deleted.

Oops, something went wrong.
@@ -61,6 +61,8 @@ MObject RenderGlobalsNode::m_pixelSamples;
MObject RenderGlobalsNode::m_passes;
MObject RenderGlobalsNode::m_tileSize;
MObject RenderGlobalsNode::m_sceneScale;
MObject RenderGlobalsNode::m_lightingEngine;
MStringArray RenderGlobalsNode::m_diagnosticShaderKeys;
@@ -138,6 +140,17 @@ MStatus RenderGlobalsNode::initialize()
status,
"appleseedMaya: Failed to add render globals tileSize attribute");
// Scene Scale.
m_sceneScale = numAttrFn.create("sceneScale", "sceneScale", MFnNumericData::kFloat, 1.0f, &status);
APPLESEED_MAYA_CHECK_MSTATUS_RET_MSG(
status,
"appleseedMaya: Failed to create render globals sceneScale attribute");
numAttrFn.setMin(0.0000001f);
status = addAttribute(m_sceneScale);
APPLESEED_MAYA_CHECK_MSTATUS_RET_MSG(
status,
"appleseedMaya: Failed to add render globals sceneScale attribute");
// Lighting engine.
MFnEnumAttribute enumAttrFn;
m_lightingEngine = enumAttrFn.create("lightingEngine", "lightingEngine", 0, &status);
@@ -63,39 +63,41 @@ class RenderGlobalsNode
AppleseedSession::MotionBlurTimes& motionBlurTimes);
private:
static MObject m_pixelSamples;
static MObject m_passes;
static MObject m_tileSize;
static MObject m_pixelSamples;
static MObject m_passes;
static MObject m_tileSize;
static MObject m_lightingEngine;
static MObject m_sceneScale;
static MObject m_lightingEngine;
static MObject m_diagnosticShader;
static MStringArray m_diagnosticShaderKeys;
static MObject m_limitBounces;
static MObject m_globalBounces;
static MObject m_specularBounces;
static MObject m_glossyBounces;
static MObject m_diffuseBounces;
static MObject m_limitBounces;
static MObject m_globalBounces;
static MObject m_specularBounces;
static MObject m_glossyBounces;
static MObject m_diffuseBounces;
static MObject m_lightSamples;
static MObject m_envSamples;
static MObject m_caustics;
static MObject m_maxRayIntensity;
static MObject m_lightSamples;
static MObject m_envSamples;
static MObject m_caustics;
static MObject m_maxRayIntensity;
static MObject m_envLightNode;
static MObject m_backgroundEmitsLight;
static MObject m_envLightNode;
static MObject m_backgroundEmitsLight;
static MObject m_motionBlur;
static MObject m_mbCameraSamples;
static MObject m_mbTransformSamples;
static MObject m_mbDeformSamples;
static MObject m_shutterOpen;
static MObject m_shutterClose;
static MObject m_motionBlur;
static MObject m_mbCameraSamples;
static MObject m_mbTransformSamples;
static MObject m_mbDeformSamples;
static MObject m_shutterOpen;
static MObject m_shutterClose;
static MObject m_renderingThreads;
static MObject m_renderingThreads;
static MObject m_imageFormat;
static MObject m_imageFormat;
};
#endif // !APPLESEED_MAYA_RENDERGLOBALSNODE_H
Oops, something went wrong.

0 comments on commit ff351a2

Please sign in to comment.