void MaterialItem::slot_edit(AttributeEditor* attribute_editor) { auto_ptr<EntityEditor::IFormFactory> form_factory( new FixedModelEntityEditorFormFactoryType( m_editor_context.m_project_builder.get_factory_registrar<Material>(), m_entity->get_name(), m_entity->get_model())); auto_ptr<EntityEditor::IEntityBrowser> entity_browser( new EntityBrowser<Assembly>(m_parent)); auto_ptr<CustomEntityUI> custom_entity_ui; #ifdef APPLESEED_WITH_DISNEY_MATERIAL if (strcmp(m_entity->get_model(), "disney_material") == 0) { custom_entity_ui = auto_ptr<CustomEntityUI>( new DisneyMaterialCustomUI( m_editor_context.m_project, m_editor_context.m_settings)); } #endif const Dictionary values = EntityTraitsType::get_entity_values(m_entity); if (attribute_editor) { attribute_editor->edit( form_factory, entity_browser, custom_entity_ui, values, this, SLOT(slot_edit_accepted(foundation::Dictionary))); } else { const string window_title = string("Edit ") + EntityTraitsType::get_human_readable_entity_type_name(); open_entity_editor( QTreeWidgetItem::treeWidget(), window_title, m_editor_context.m_project, form_factory, entity_browser, custom_entity_ui, values, this, SLOT(slot_edit_accepted(foundation::Dictionary)), SLOT(slot_edit_accepted(foundation::Dictionary)), SLOT(slot_edit_accepted(foundation::Dictionary))); } }
void MaterialCollectionItem::do_create_material(const char* model) { typedef EntityTraits<Material> EntityTraits; const string window_title = string("Create ") + EntityTraits::get_human_readable_entity_type_name(); const string name_suggestion = make_unique_name( EntityTraits::get_entity_type_name(), EntityTraits::get_entity_container(Base::m_parent)); typedef EntityTraits::FactoryRegistrarType FactoryRegistrarType; auto_ptr<EntityEditor::IFormFactory> form_factory( new FixedModelEntityEditorFormFactory<FactoryRegistrarType>( m_editor_context.m_project_builder.get_factory_registrar<Material>(), name_suggestion, model)); auto_ptr<EntityEditor::IEntityBrowser> entity_browser( new EntityBrowser<Assembly>(Base::m_parent)); auto_ptr<CustomEntityUI> custom_entity_ui; #ifdef APPLESEED_WITH_DISNEY_MATERIAL if (strcmp(model, "disney_material") == 0) { custom_entity_ui.reset( new DisneyMaterialCustomUI( m_editor_context.m_project, m_editor_context.m_settings)); } #endif open_entity_editor( QTreeWidgetItem::treeWidget(), window_title, m_editor_context.m_project, form_factory, entity_browser, custom_entity_ui, Dictionary(), this, SLOT(slot_create_applied(foundation::Dictionary)), SLOT(slot_create_accepted(foundation::Dictionary)), SLOT(slot_create_canceled(foundation::Dictionary))); }
void FrameItem::slot_edit(AttributeEditor* attribute_editor) { unique_ptr<EntityEditor::IFormFactory> form_factory( new SingleModelEntityEditorFormFactory( m_frame->get_name(), FrameFactory::get_input_metadata())); const Scene& scene = *m_editor_context.m_project.get_scene(); std::unique_ptr<EntityEditor::IEntityBrowser> entity_browser( new EntityBrowser<Scene>(scene)); if (attribute_editor) { attribute_editor->edit( move(form_factory), move(entity_browser), unique_ptr<CustomEntityUI>(), m_frame->get_parameters(), this, SLOT(slot_edit_accepted(foundation::Dictionary))); } else { open_entity_editor( treeWidget(), "Edit Frame", m_editor_context.m_project, m_editor_context.m_settings, move(form_factory), move(entity_browser), m_frame->get_parameters(), this, SLOT(slot_edit_accepted(foundation::Dictionary)), SLOT(slot_edit_accepted(foundation::Dictionary)), SLOT(slot_edit_accepted(foundation::Dictionary))); } }