This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/collada/DocumentImporter.h
Ton Roosendaal 51b796ff15 Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!

* Point density, voxel data, ocean, environment map textures were removed,
  as these only worked within BI rendering. Note that the ocean modifier
  and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
  with BI. If we ever wanted to support this again probably it should go
  through the baking API.
* GPU shader export through the Python API was removed. This only worked
  for the old BI GLSL shaders, which no longer exists. Doing something
  similar for Eevee would be significantly more complicated because it
  uses a lot of multiplass rendering and logic outside the shader, it's
  probably impractical.
* Collada material import / export code is mostly gone, as it only worked
  for BI materials. We need to add Cycles / Eevee material support at some
  point.
* The mesh noise operator was removed since it only worked with BI
  material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
  for BI material texture slots. Could be added back with node support.

* Not all legacy viewport features are supported in the new viewport, but
  their code was removed. If we need to bring anything back we can look at
  older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
  that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
  used anywhere now. We may eventually use this to replace the texture
  nodes with Cycles / Eevee shader nodes.

* The Cycles Bake panel now includes settings for baking multires normal
  and displacement maps. The underlying code needs to be merged properly,
  and we plan to add back support for multires AO baking and add support
  to Cycles baking for features like vertex color, displacement, and other
  missing baking features.

* This commit removes DNA and the Python API for BI material, lamp, world
  and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
  are reusing some old BI properties but the names are not really correct
  anymore.
* Texture slots for materials, lamps and world were removed. They remain
  for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
  other renderers use this to find all panels to show, minus a few panels
  that they have their own replacement for.
2018-04-19 17:35:25 +02:00

178 lines
5.6 KiB
C++

/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file DocumentImporter.h
* \ingroup collada
*/
#ifndef __DOCUMENTIMPORTER_H__
#define __DOCUMENTIMPORTER_H__
#include "COLLADAFWIWriter.h"
#include "COLLADAFWMaterial.h"
#include "COLLADAFWEffect.h"
#include "COLLADAFWColor.h"
#include "COLLADAFWImage.h"
#include "COLLADAFWInstanceGeometry.h"
#include "COLLADAFWController.h"
#include "COLLADAFWMorphController.h"
#include "COLLADAFWSkinController.h"
#include "COLLADAFWEffectCommon.h"
#include "BKE_object.h"
#include "BKE_constraint.h"
#include "TransformReader.h"
#include "AnimationImporter.h"
#include "ArmatureImporter.h"
#include "ControllerExporter.h"
#include "MeshImporter.h"
#include "ImportSettings.h"
struct bContext;
/** Importer class. */
class DocumentImporter : COLLADAFW::IWriter
{
public:
//! Enumeration to denote the stage of import
enum ImportStage {
General, //!< First pass to collect all data except controller
Controller, //!< Second pass to collect controller data
};
/** Constructor */
DocumentImporter(bContext *C, const ImportSettings *import_settings);
/** Destructor */
~DocumentImporter();
/** Function called by blender UI */
bool import();
/** these should not be here */
Object* create_camera_object(COLLADAFW::InstanceCamera*, Scene*);
Object* create_lamp_object(COLLADAFW::InstanceLight*, Scene*);
Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, bool);
void create_constraints(ExtraTags *et, Object *ob);
std::vector<Object *> *write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
void write_profile_COMMON(COLLADAFW::EffectCommon*, Material*);
void translate_anim_recursive(COLLADAFW::Node*, COLLADAFW::Node*, Object*);
/**
* This method will be called if an error in the loading process occurred and the loader cannot
* continue to load. The writer should undo all operations that have been performed.
* \param errorMessage A message containing informations about the error that occurred.
*/
void cancel(const COLLADAFW::String& errorMessage);
/** This is the method called. The writer hast to prepare to receive data.*/
void start();
/** This method is called after the last write* method. No other methods will be called after this.*/
void finish();
bool writeGlobalAsset(const COLLADAFW::FileInfo*);
std::string get_import_version(const COLLADAFW::FileInfo *asset);
bool writeScene(const COLLADAFW::Scene*);
bool writeVisualScene(const COLLADAFW::VisualScene*);
bool writeLibraryNodes(const COLLADAFW::LibraryNodes*);
bool writeAnimation(const COLLADAFW::Animation*);
bool writeAnimationList(const COLLADAFW::AnimationList*);
bool writeGeometry(const COLLADAFW::Geometry*);
bool writeMaterial(const COLLADAFW::Material*);
bool writeEffect(const COLLADAFW::Effect*);
bool writeCamera(const COLLADAFW::Camera*);
bool writeImage(const COLLADAFW::Image*);
bool writeLight(const COLLADAFW::Light*);
bool writeSkinControllerData(const COLLADAFW::SkinControllerData*);
bool writeController(const COLLADAFW::Controller*);
bool writeFormulas(const COLLADAFW::Formulas*);
bool writeKinematicsScene(const COLLADAFW::KinematicsScene*);
/** Add element and data for UniqueId */
bool addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags);
/** Get an extisting ExtraTags for uid */
ExtraTags* getExtraTags(const COLLADAFW::UniqueId &uid);
bool is_armature(COLLADAFW::Node * node);
private:
const ImportSettings *import_settings;
/** Current import stage we're in. */
ImportStage mImportStage;
bContext *mContext;
ViewLayer *view_layer;
UnitConverter unit_converter;
ArmatureImporter armature_importer;
MeshImporter mesh_importer;
AnimationImporter anim_importer;
/** TagsMap typedef for uid_tags_map. */
typedef std::map<std::string, ExtraTags*> TagsMap;
/** Tags map of unique id as a string and ExtraTags instance. */
TagsMap uid_tags_map;
std::map<COLLADAFW::UniqueId, Image*> uid_image_map;
std::map<COLLADAFW::UniqueId, Material*> uid_material_map;
std::map<COLLADAFW::UniqueId, Material*> uid_effect_map;
std::map<COLLADAFW::UniqueId, Camera*> uid_camera_map;
std::map<COLLADAFW::UniqueId, Lamp*> uid_lamp_map;
std::map<Material*, TexIndexTextureArrayMap> material_texture_mapping_map;
std::multimap<COLLADAFW::UniqueId, Object*> object_map;
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> node_map;
std::vector<const COLLADAFW::VisualScene*> vscenes;
std::vector<Object*> libnode_ob;
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> root_map; // find root joint by child joint uid, for bone tree evaluation during resampling
std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map;
std::string import_from_version;
void report_unknown_reference(const COLLADAFW::Node &node, const std::string object_type);
};
#endif