Пример #1
0
bool add_noise_dialog::respond (sxsdk::dialog_interface &d, sxsdk::dialog_item_class &item, int action, void *)
{
	if(action == sx::dialog_item::changing_action) return false;

	bool update = auto_preview;

	switch(item.get_id())
	{
	case bAuto_preview_id:
		if(!item.get_bool()) {
			update = false;
			break;
		}
	// TODO Check fallthrough or break.
	fallthrough; case bRedraw_preview_id:
		d.get_dialog_item(pPreview_mode_id).set_selection(After_effect);
	// TODO Check fallthrough or break.
	fallthrough; case pPreview_mode_id:
		update = true;
		break;
	case fOpacity_id:
	case fOpacity_A_id:
		if(item.get_float() > 1.0f)	item.set_float(1.0f);
	// TODO Check fallthrough or break.
	fallthrough; case fZ_Effect_id:
	case fOpacity_R_id:
	case fOpacity_G_id:
	case fOpacity_B_id:
		if(item.get_float() < 0.0f)	item.set_float(0.0f);
	// TODO Check fallthrough or break.
	fallthrough; default:
		if(auto_preview)	d.get_dialog_item(pPreview_mode_id).set_selection(After_effect);
	}

	save_dialog_data(d);
	if((update || auto_preview) && noise_preview) {
		try {
			if (!noise_preview->update_preview_image(preview_mode)) {
				preview_mode = Before_effect;
			}
		} catch (...) {
			shade.show_message_box(shade.gettext("error_out_of_memory"), false);
			preview_mode = Before_effect;
		}
		d.get_dialog_item(pPreview_mode_id).set_selection(preview_mode);
	}

	return false;
}
bool CRIBExporterInterface::respond (sxsdk::dialog_interface &dialog, sxsdk::dialog_item_class &item, int action, void *)
{
	const int id = item.get_id();		// アクションがあったダイアログアイテムのID.

	if (id == sx::iddefault) {
		m_data.Clear();
		load_dialog_data(dialog);
		return true;
	}

	if (id == sx::idok) {
		m_dlgOK = true;
	}

	if (id == dlg_integrators_id) {
		m_data.type = (RIBParam::INTEGRATORS_TYPE)item.get_selection();
		return true;
	}
	if (id == dlg_pixel_variance_id) {
		m_data.pixelVariance = item.get_float();
		return true;
	}
	if (id == dlg_min_samples_id) {
		m_data.minSamples = item.get_int();
		return true;
	}
	if (id == dlg_max_samples_id) {
		m_data.maxSamples = item.get_int();
		return true;
	}
	if (id == dlg_incremental_id) {
		m_data.incremental = item.get_bool();
		return true;
	}
	if (id == dlg_bias_id) {
		m_data.bias = item.get_float();
		return true;
	}
	if (id == dlg_max_diffuse_depth_id) {
		m_data.maxDiffuseDepth = item.get_int();
		return true;
	}
	if (id == dlg_max_specular_depth_id) {
		m_data.maxSpecularDepth = item.get_int();
		return true;
	}
	if (id == dlg_version_id) {
		m_data.prmanVersion = item.get_selection();
		return true;
	}
	if (id == dlg_rendering_format_type_id) {
		m_data.renderingFormatType = (RIBParam::RENDERING_FORMAT_TYPE)item.get_selection();
		return true;
	}
	if (id == dlg_rendering_image_type_id) {
		m_data.renderingImageType = (RIBParam::RENDERING_IMAGE_TYPE)item.get_selection();
		return true;
	}

	if (id == dlg_output_background_image_id) {
		m_data.outputBackgroundImage = item.get_bool();
		{
			sxsdk::dialog_item_class &item2 = dialog.get_dialog_item(dlg_background_image_size_id);
			item2.set_enabled(m_data.outputBackgroundImage);
		}
		{
			sxsdk::dialog_item_class &item2 = dialog.get_dialog_item(dlg_background_image_intensity_id);
			item2.set_enabled(m_data.outputBackgroundImage);
		}
		{
			sxsdk::dialog_item_class &item2 = dialog.get_dialog_item(dlg_background_draw_id);
			item2.set_enabled(m_data.outputBackgroundImage);
		}
		return true;
	}
	if (id == dlg_background_image_size_id) {
		m_data.backgroundImageSize = (RIBParam::BACKGROUND_IMAGE_SIZE)item.get_selection();
		return true;
	}
	if (id == dlg_background_image_intensity_id) {
		m_data.backgroundImageIntensity = item.get_float();
		return true;
	}
	if (id == dlg_background_draw_id) {
		m_data.backgroundDraw = item.get_bool();
		return true;
	}
	if (id == dlg_color_color_to_linear_id) {
		m_data.colorColorToLinear = item.get_bool();
		return true;
	}
	if (id == dlg_color_texture_to_linear_id) {
		m_data.colorTextureToLinear = item.get_bool();
		return true;
	}
	if (id == dlg_light_day_light_id) {
		m_data.lightDayLight = item.get_bool();
		return true;
	}
	if (id == dlg_statistics_end_of_frame_id) {
		m_data.statisticsEndOfFrame = item.get_bool();
		return true;
	}
	if (id == dlg_statistics_xml_file_id) {
		m_data.statisticsXMLFile = item.get_bool();
		return true;
	}
	if (id == dlg_subdivision_id) {
		m_data.doSubdivision = item.get_bool();
		return true;
	}
	if (id == dlg_denoise_id) {
		m_data.doDenoise = item.get_bool();
		return true;
	}

	return false;
}