2011-01-28 12:56:30 +00:00
|
|
|
/*
|
2010-06-03 17:41:33 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
2011-02-27 20:30:35 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup collada
|
2011-02-27 20:30:35 +00:00
|
|
|
*/
|
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* TODO:
|
|
|
|
* * name imported objects
|
|
|
|
* * import object rotation as euler */
|
2009-11-29 14:38:50 +00:00
|
|
|
|
2010-10-05 00:05:14 +00:00
|
|
|
#include <algorithm> /* sort() */
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2010-10-05 00:05:14 +00:00
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "COLLADAFWArrayPrimitiveType.h"
|
|
|
|
#include "COLLADAFWCamera.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
#include "COLLADAFWColorOrTexture.h"
|
|
|
|
#include "COLLADAFWIndexList.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "COLLADAFWLibraryNodes.h"
|
|
|
|
#include "COLLADAFWLight.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
#include "COLLADAFWMeshPrimitiveWithFaceVertexCount.h"
|
|
|
|
#include "COLLADAFWPolygons.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "COLLADAFWRoot.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
#include "COLLADAFWSampler.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "COLLADAFWStableHeaders.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
#include "COLLADAFWTypes.h"
|
|
|
|
#include "COLLADAFWVisualScene.h"
|
|
|
|
|
2011-03-23 14:25:35 +00:00
|
|
|
#include "COLLADASaxFWLIExtraDataCallbackHandler.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "COLLADASaxFWLLoader.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2020-01-26 16:38:18 +01:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_fileops.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_listbase.h"
|
|
|
|
#include "BLI_math.h"
|
|
|
|
#include "BLI_string.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2011-11-05 13:00:39 +00:00
|
|
|
#include "BKE_camera.h"
|
Render Layers and Collections (merge from render-layers)
Design Documents
----------------
* https://wiki.blender.org/index.php/Dev:2.8/Source/Layers
* https://wiki.blender.org/index.php/Dev:2.8/Source/DataDesignRevised
User Commit Log
---------------
* New Layer and Collection system to replace render layers and viewport layers.
* A layer is a set of collections of objects (and their drawing options) required for specific tasks.
* A collection is a set of objects, equivalent of the old layers in Blender. A collection can be shared across multiple layers.
* All Scenes have a master collection that all other collections are children of.
* New collection "context" tab (in Properties Editor)
* New temporary viewport "collections" panel to control per-collection
visibility
Missing User Features
---------------------
* Collection "Filter"
Option to add objects based on their names
* Collection Manager operators
The existing buttons are placeholders
* Collection Manager drawing
The editor main region is empty
* Collection Override
* Per-Collection engine settings
This will come as a separate commit, as part of the clay-engine branch
Dev Commit Log
--------------
* New DNA file (DNA_layer_types.h) with the new structs
We are replacing Base by a new extended Base while keeping it backward
compatible with some legacy settings (i.e., lay, flag_legacy).
Renamed all Base to BaseLegacy to make it clear the areas of code that
still need to be converted
Note: manual changes were required on - deg_builder_nodes.h, rna_object.c, KX_Light.cpp
* Unittesting for main syncronization requirements
- read, write, add/copy/remove objects, copy scene, collection
link/unlinking, context)
* New Editor: Collection Manager
Based on patch by Julian Eisel
This is extracted from the layer-manager branch. With the following changes:
- Renamed references of layer manager to collections manager
- I doesn't include the editors/space_collections/ draw and util files
- The drawing code itself will be implemented separately by Julian
* Base / Object:
A little note about them. Original Blender code would try to keep them
in sync through the code, juggling flags back and forth. This will now
be handled by Depsgraph, keeping Object and Bases more separated
throughout the non-rendering code.
Scene.base is being cleared in doversion, and the old viewport drawing
code was poorly converted to use the new bases while the new viewport
code doesn't get merged and replace the old one.
Python API Changes
------------------
```
- scene.layers
+ # no longer exists
- scene.objects
+ scene.scene_layers.active.objects
- scene.objects.active
+ scene.render_layers.active.objects.active
- bpy.context.scene.objects.link()
+ bpy.context.scene_collection.objects.link()
- bpy_extras.object_utils.object_data_add(context, obdata, operator=None, use_active_layer=True, name=None)
+ bpy_extras.object_utils.object_data_add(context, obdata, operator=None, name=None)
- bpy.context.object.select
+ bpy.context.object.select = True
+ bpy.context.object.select = False
+ bpy.context.object.select_get()
+ bpy.context.object.select_set(action='SELECT')
+ bpy.context.object.select_set(action='DESELECT')
-AddObjectHelper.layers
+ # no longer exists
```
2017-02-07 10:18:38 +01:00
|
|
|
#include "BKE_collection.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_fcurve.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_image.h"
|
2017-11-08 12:16:49 -02:00
|
|
|
#include "BKE_layer.h"
|
2020-02-10 12:58:59 +01:00
|
|
|
#include "BKE_lib_id.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_light.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
#include "BKE_material.h"
|
2018-11-07 18:00:24 +01:00
|
|
|
#include "BKE_scene.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2012-09-03 22:04:14 +00:00
|
|
|
#include "BLI_path_util.h"
|
|
|
|
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
#include "DNA_camera_types.h"
|
2019-02-27 12:34:56 +11:00
|
|
|
#include "DNA_light_types.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2010-10-09 21:17:14 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
2013-02-08 19:52:02 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
2012-06-12 21:25:29 +00:00
|
|
|
|
2017-04-06 16:17:21 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
#include "DEG_depsgraph_build.h"
|
|
|
|
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
#include "DocumentImporter.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "ErrorHandler.h"
|
|
|
|
#include "ExtraHandler.h"
|
2011-03-09 14:16:21 +00:00
|
|
|
#include "TransformReader.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "Materials.h"
|
2011-03-23 14:25:35 +00:00
|
|
|
#include "collada_internal.h"
|
2010-10-05 00:05:14 +00:00
|
|
|
#include "collada_utils.h"
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2010-10-05 00:05:14 +00:00
|
|
|
/*
|
2012-10-04 13:26:15 +00:00
|
|
|
* COLLADA Importer limitations:
|
|
|
|
* - no multiple scene import, all objects are added to active scene
|
2010-10-05 00:05:14 +00:00
|
|
|
*/
|
2010-02-15 16:18:21 +00:00
|
|
|
|
2010-10-05 00:05:14 +00:00
|
|
|
// #define COLLADA_DEBUG
|
2010-02-15 16:18:21 +00:00
|
|
|
/* creates empties for each imported bone on layer 2, for debugging */
|
|
|
|
// #define ARMATURE_TEST
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2013-02-09 16:19:30 +00:00
|
|
|
DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_settings)
|
2013-02-10 17:06:05 +00:00
|
|
|
: import_settings(import_settings),
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
mImportStage(Fetching_Scene_data),
|
2011-03-25 09:52:36 +00:00
|
|
|
mContext(C),
|
2018-01-26 13:13:54 +01:00
|
|
|
view_layer(CTX_data_view_layer(mContext)),
|
2018-06-14 15:55:51 +02:00
|
|
|
armature_importer(&unit_converter,
|
|
|
|
&mesh_importer,
|
|
|
|
CTX_data_main(C),
|
|
|
|
CTX_data_scene(C),
|
|
|
|
view_layer,
|
|
|
|
import_settings),
|
|
|
|
mesh_importer(
|
|
|
|
&unit_converter, &armature_importer, CTX_data_main(C), CTX_data_scene(C), view_layer),
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
anim_importer(C, &unit_converter, &armature_importer, CTX_data_scene(C))
|
2012-06-12 22:05:33 +00:00
|
|
|
{
|
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
|
2011-03-25 11:07:57 +00:00
|
|
|
DocumentImporter::~DocumentImporter()
|
|
|
|
{
|
2011-03-28 09:31:44 +00:00
|
|
|
TagsMap::iterator etit;
|
2011-03-25 11:07:57 +00:00
|
|
|
etit = uid_tags_map.begin();
|
2012-06-12 22:05:33 +00:00
|
|
|
while (etit != uid_tags_map.end()) {
|
2011-03-25 11:07:57 +00:00
|
|
|
delete etit->second;
|
|
|
|
etit++;
|
|
|
|
}
|
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
|
|
|
|
bool DocumentImporter::import()
|
|
|
|
{
|
2011-09-05 20:41:58 +00:00
|
|
|
ErrorHandler errorHandler;
|
|
|
|
COLLADASaxFWL::Loader loader(&errorHandler);
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADAFW::Root root(&loader, this);
|
2011-08-14 16:15:41 +00:00
|
|
|
ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
loader.registerExtraDataCallbackHandler(ehandler);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* deselect all to select new objects */
|
2018-01-26 13:13:54 +01:00
|
|
|
BKE_view_layer_base_deselect_all(view_layer);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-09 16:19:30 +00:00
|
|
|
std::string mFilename = std::string(this->import_settings->filepath);
|
2013-02-09 00:23:59 +00:00
|
|
|
const std::string encodedFilename = bc_url_encode(mFilename);
|
|
|
|
if (!root.loadDocument(encodedFilename)) {
|
2012-03-17 06:37:26 +00:00
|
|
|
fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n");
|
2015-09-11 19:12:25 +10:00
|
|
|
delete ehandler;
|
2011-03-25 09:52:36 +00:00
|
|
|
return false;
|
2012-03-17 06:37:26 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-09-11 19:12:25 +10:00
|
|
|
if (errorHandler.hasError()) {
|
|
|
|
delete ehandler;
|
2011-09-05 20:41:58 +00:00
|
|
|
return false;
|
2015-09-11 19:12:25 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
/** TODO set up scene graph and such here */
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
mImportStage = Fetching_Controller_data;
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADASaxFWL::Loader loader2;
|
|
|
|
COLLADAFW::Root root2(&loader2, this);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-09 00:23:59 +00:00
|
|
|
if (!root2.loadDocument(encodedFilename)) {
|
2012-03-17 06:37:26 +00:00
|
|
|
fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 2nd pass\n");
|
2015-09-11 19:12:25 +10:00
|
|
|
delete ehandler;
|
2011-03-25 09:52:36 +00:00
|
|
|
return false;
|
2012-03-17 06:37:26 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
delete ehandler;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DocumentImporter::cancel(const COLLADAFW::String &errorMessage)
|
|
|
|
{
|
2019-04-30 13:41:21 +10:00
|
|
|
/* TODO: if possible show error info
|
|
|
|
*
|
|
|
|
* Should we get rid of invisible Meshes that were created so far
|
|
|
|
* or maybe create objects at coordinate space origin?
|
|
|
|
*
|
|
|
|
* The latter sounds better. */
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
2012-05-03 21:32:49 +00:00
|
|
|
void DocumentImporter::start()
|
|
|
|
{
|
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
|
|
|
|
void DocumentImporter::finish()
|
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-17 18:33:10 +00:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2019-04-30 13:41:21 +10:00
|
|
|
/* TODO: create a new scene except the selected <visual_scene> -
|
|
|
|
* use current blender scene for it */
|
2013-02-17 18:33:10 +00:00
|
|
|
Scene *sce = CTX_data_scene(mContext);
|
2013-07-29 21:51:53 +00:00
|
|
|
unit_converter.calculate_scale(*sce);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-07-29 22:15:04 +00:00
|
|
|
std::vector<Object *> *objects_to_scale = new std::vector<Object *>();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
/** TODO Break up and put into 2-pass parsing of DAE */
|
2018-03-11 20:12:55 +01:00
|
|
|
std::vector<const COLLADAFW::VisualScene *>::iterator sit;
|
|
|
|
for (sit = vscenes.begin(); sit != vscenes.end(); sit++) {
|
2011-03-25 09:52:36 +00:00
|
|
|
PointerRNA sceneptr, unit_settings;
|
|
|
|
PropertyRNA *system, *scale;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* for scene unit settings: system, scale_length */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
RNA_id_pointer_create(&sce->id, &sceneptr);
|
|
|
|
unit_settings = RNA_pointer_get(&sceneptr, "unit_settings");
|
|
|
|
system = RNA_struct_find_property(&unit_settings, "system");
|
|
|
|
scale = RNA_struct_find_property(&unit_settings, "scale_length");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-09 16:19:30 +00:00
|
|
|
if (this->import_settings->import_units) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-09 16:19:30 +00:00
|
|
|
switch (unit_converter.isMetricSystem()) {
|
|
|
|
case UnitConverter::Metric:
|
|
|
|
RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC);
|
|
|
|
break;
|
|
|
|
case UnitConverter::Imperial:
|
|
|
|
RNA_property_enum_set(&unit_settings, system, USER_UNIT_IMPERIAL);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
RNA_property_enum_set(&unit_settings, system, USER_UNIT_NONE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
float unit_factor = unit_converter.getLinearMeter();
|
|
|
|
RNA_property_float_set(&unit_settings, scale, unit_factor);
|
|
|
|
fprintf(stdout, "Collada: Adjusting Blender units to Importset units: %f.\n", unit_factor);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* Write nodes to scene */
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
fprintf(stderr, "+-- Import Scene --------\n");
|
2018-03-11 20:12:55 +01:00
|
|
|
const COLLADAFW::NodePointerArray &roots = (*sit)->getRootNodes();
|
2011-03-25 09:52:36 +00:00
|
|
|
for (unsigned int i = 0; i < roots.getCount(); i++) {
|
2020-11-06 17:49:09 +01:00
|
|
|
std::vector<Object *> *objects_done = write_node(roots[i], nullptr, sce, nullptr, false);
|
2013-07-29 22:15:04 +00:00
|
|
|
objects_to_scale->insert(
|
|
|
|
objects_to_scale->end(), objects_done->begin(), objects_done->end());
|
2015-09-11 19:12:25 +10:00
|
|
|
delete objects_done;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2013-01-21 13:45:49 +00:00
|
|
|
mesh_importer.optimize_material_assignements();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-07-26 18:28:07 +00:00
|
|
|
armature_importer.set_tags_map(this->uid_tags_map);
|
2016-06-03 18:26:12 +02:00
|
|
|
armature_importer.make_armatures(mContext, *objects_to_scale);
|
2018-06-12 12:53:27 +02:00
|
|
|
armature_importer.make_shape_keys(mContext);
|
2010-09-04 19:27:04 +00:00
|
|
|
|
2009-11-29 14:38:50 +00:00
|
|
|
#if 0
|
2011-03-25 09:52:36 +00:00
|
|
|
armature_importer.fix_animation();
|
2009-11-29 14:38:50 +00:00
|
|
|
#endif
|
|
|
|
|
2020-12-07 12:21:11 +01:00
|
|
|
for (const COLLADAFW::VisualScene *vscene : vscenes) {
|
|
|
|
const COLLADAFW::NodePointerArray &roots = vscene->getRootNodes();
|
2009-11-29 14:38:50 +00:00
|
|
|
|
2013-02-20 00:06:31 +00:00
|
|
|
for (unsigned int i = 0; i < roots.getCount(); i++) {
|
2020-11-06 17:49:09 +01:00
|
|
|
translate_anim_recursive(roots[i], nullptr, nullptr);
|
2013-02-20 00:06:31 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2009-11-29 14:38:50 +00:00
|
|
|
|
2020-07-03 14:59:27 +02:00
|
|
|
if (!libnode_ob.empty()) {
|
2010-09-04 19:27:04 +00:00
|
|
|
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
fprintf(stderr, "| Cleanup: free %d library nodes\n", (int)libnode_ob.size());
|
2019-04-30 13:41:21 +10:00
|
|
|
/* free all library_nodes */
|
2012-06-12 22:05:33 +00:00
|
|
|
std::vector<Object *>::iterator it;
|
2011-03-25 09:52:36 +00:00
|
|
|
for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) {
|
|
|
|
Object *ob = *it;
|
2018-06-14 15:55:51 +02:00
|
|
|
BKE_scene_collections_object_remove(bmain, sce, ob, true);
|
2010-09-04 19:27:04 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
libnode_ob.clear();
|
2009-11-29 14:38:50 +00:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2013-07-29 22:15:04 +00:00
|
|
|
bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units);
|
2015-09-11 19:12:25 +10:00
|
|
|
|
|
|
|
delete objects_to_scale;
|
2018-06-20 17:43:56 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* update scene */
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&sce->id, ID_RECALC_COPY_ON_WRITE);
|
2018-06-20 17:43:56 +02:00
|
|
|
DEG_relations_tag_update(bmain);
|
2020-11-06 17:49:09 +01:00
|
|
|
WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, nullptr);
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2009-11-29 14:38:50 +00:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node,
|
2020-11-06 17:49:09 +01:00
|
|
|
COLLADAFW::Node *par = nullptr,
|
|
|
|
Object *parob = nullptr)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2021-02-05 16:23:34 +11:00
|
|
|
/* The split in T29246, root_map must point at actual root when
|
2019-04-30 13:41:21 +10:00
|
|
|
* calculating bones in apply_curves_as_matrix. - actual root is the root node.
|
|
|
|
* This has to do with inverse bind poses being world space
|
2021-02-05 16:23:34 +11:00
|
|
|
* (the sources for skinned bones' rest-poses) and the way
|
|
|
|
* non-skinning nodes have their "rest-pose" recursively calculated.
|
2019-04-30 13:41:21 +10:00
|
|
|
* XXX TODO: design issue, how to support unrelated joints taking
|
|
|
|
* part in skinning. */
|
2012-03-22 13:35:52 +00:00
|
|
|
if (par) { // && par->getType() == COLLADAFW::Node::JOINT) {
|
2021-02-05 16:23:34 +11:00
|
|
|
/* If par is root if there's no corresponding key in root_map. */
|
2019-05-31 22:51:19 +10:00
|
|
|
if (root_map.find(par->getUniqueId()) == root_map.end()) {
|
2013-01-21 13:45:49 +00:00
|
|
|
root_map[node->getUniqueId()] = node;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
else {
|
2011-03-25 09:52:36 +00:00
|
|
|
root_map[node->getUniqueId()] = root_map[par->getUniqueId()];
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2009-11-29 14:38:50 +00:00
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
#if 0
|
|
|
|
COLLADAFW::Transformation::TransformationType types[] = {
|
2019-04-17 08:24:14 +02:00
|
|
|
COLLADAFW::Transformation::ROTATE,
|
|
|
|
COLLADAFW::Transformation::SCALE,
|
|
|
|
COLLADAFW::Transformation::TRANSLATE,
|
|
|
|
COLLADAFW::Transformation::MATRIX,
|
2011-03-25 09:52:36 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
Object *ob;
|
|
|
|
#endif
|
2011-03-25 09:52:36 +00:00
|
|
|
unsigned int i;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-06 17:49:09 +01:00
|
|
|
if (node->getType() == COLLADAFW::Node::JOINT && par == nullptr) {
|
2019-04-30 13:41:21 +10:00
|
|
|
/* For Skeletons without root node we have to simulate the
|
|
|
|
* root node here and recursively enter the same function
|
|
|
|
* XXX: maybe this can be made more elegant. */
|
2013-02-20 00:06:31 +00:00
|
|
|
translate_anim_recursive(node, node, parob);
|
|
|
|
}
|
|
|
|
else {
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
anim_importer.translate_Animations(
|
|
|
|
node, root_map, object_map, FW_object_map, uid_material_map);
|
2013-02-20 00:06:31 +00:00
|
|
|
COLLADAFW::NodePointerArray &children = node->getChildNodes();
|
|
|
|
for (i = 0; i < children.getCount(); i++) {
|
2020-11-06 17:49:09 +01:00
|
|
|
translate_anim_recursive(children[i], node, nullptr);
|
2013-02-20 00:06:31 +00:00
|
|
|
}
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
2014-02-03 13:04:51 +01:00
|
|
|
/**
|
|
|
|
* If the imported file was made with Blender, return the Blender version used,
|
|
|
|
* otherwise return an empty std::string
|
|
|
|
*/
|
|
|
|
std::string DocumentImporter::get_import_version(const COLLADAFW::FileInfo *asset)
|
|
|
|
{
|
|
|
|
const char AUTORING_TOOL[] = "authoring_tool";
|
|
|
|
const std::string BLENDER("Blender ");
|
|
|
|
const COLLADAFW::FileInfo::ValuePairPointerArray &valuePairs = asset->getValuePairArray();
|
2019-09-08 00:12:26 +10:00
|
|
|
for (size_t i = 0, count = valuePairs.getCount(); i < count; i++) {
|
2014-02-03 13:04:51 +01:00
|
|
|
const COLLADAFW::FileInfo::ValuePair *valuePair = valuePairs[i];
|
|
|
|
const COLLADAFW::String &key = valuePair->first;
|
|
|
|
const COLLADAFW::String &value = valuePair->second;
|
|
|
|
if (key == AUTORING_TOOL) {
|
|
|
|
if (value.compare(0, BLENDER.length(), BLENDER) == 0) {
|
2019-04-30 13:41:21 +10:00
|
|
|
/* Was made with Blender, now get version string */
|
2014-02-03 13:04:51 +01:00
|
|
|
std::string v = value.substr(BLENDER.length());
|
|
|
|
std::string::size_type n = v.find(" ");
|
|
|
|
if (n > 0) {
|
|
|
|
return v.substr(0, n);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-02-03 13:04:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the global document asset.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeGlobalAsset(const COLLADAFW::FileInfo *asset)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
|
|
|
unit_converter.read_asset(asset);
|
2014-02-03 13:04:51 +01:00
|
|
|
import_from_version = get_import_version(asset);
|
|
|
|
anim_importer.set_import_from_version(import_from_version);
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the scene.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeScene(const COLLADAFW::Scene *scene)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-04-30 13:41:21 +10:00
|
|
|
/* XXX could store the scene id, but do nothing for now */
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-06-12 22:05:33 +00:00
|
|
|
Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera, Scene *sce)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
|
|
|
const COLLADAFW::UniqueId &cam_uid = camera->getInstanciatedObjectId();
|
2012-10-21 05:46:41 +00:00
|
|
|
if (uid_camera_map.find(cam_uid) == uid_camera_map.end()) {
|
2012-08-05 10:23:34 +00:00
|
|
|
// fprintf(stderr, "Couldn't find camera by UID.\n");
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-14 15:15:51 +02:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2020-11-06 17:49:09 +01:00
|
|
|
Object *ob = bc_add_object(bmain, sce, view_layer, OB_CAMERA, nullptr);
|
2011-03-25 09:52:36 +00:00
|
|
|
Camera *cam = uid_camera_map[cam_uid];
|
2012-06-12 22:05:33 +00:00
|
|
|
Camera *old_cam = (Camera *)ob->data;
|
2011-03-25 09:52:36 +00:00
|
|
|
ob->data = cam;
|
2019-01-14 21:08:22 +01:00
|
|
|
BKE_id_free_us(bmain, old_cam);
|
2011-03-25 09:52:36 +00:00
|
|
|
return ob;
|
|
|
|
}
|
|
|
|
|
2019-02-27 12:02:02 +11:00
|
|
|
Object *DocumentImporter::create_light_object(COLLADAFW::InstanceLight *lamp, Scene *sce)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
|
|
|
const COLLADAFW::UniqueId &lamp_uid = lamp->getInstanciatedObjectId();
|
2019-02-27 12:02:02 +11:00
|
|
|
if (uid_light_map.find(lamp_uid) == uid_light_map.end()) {
|
2018-06-27 14:41:53 +02:00
|
|
|
fprintf(stderr, "Couldn't find light by UID.\n");
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-14 15:15:51 +02:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2020-11-06 17:49:09 +01:00
|
|
|
Object *ob = bc_add_object(bmain, sce, view_layer, OB_LAMP, nullptr);
|
2019-02-27 12:02:02 +11:00
|
|
|
Light *la = uid_light_map[lamp_uid];
|
|
|
|
Light *old_light = (Light *)ob->data;
|
2011-03-25 09:52:36 +00:00
|
|
|
ob->data = la;
|
2019-02-27 12:02:02 +11:00
|
|
|
BKE_id_free_us(bmain, old_light);
|
2011-03-25 09:52:36 +00:00
|
|
|
return ob;
|
|
|
|
}
|
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
Object *DocumentImporter::create_instance_node(Object *source_ob,
|
|
|
|
COLLADAFW::Node *source_node,
|
|
|
|
COLLADAFW::Node *instance_node,
|
|
|
|
Scene *sce,
|
|
|
|
bool is_library_node)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-04-30 13:41:21 +10:00
|
|
|
// fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ?
|
|
|
|
// instance_node->getOriginalId().c_str() : NULL, source_node ?
|
|
|
|
// source_node->getOriginalId().c_str() : NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-14 15:15:51 +02:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2020-10-07 18:01:25 +02:00
|
|
|
Object *obn = (Object *)BKE_id_copy(bmain, &source_ob->id);
|
|
|
|
id_us_min(&obn->id);
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
|
2018-06-14 16:43:11 +02:00
|
|
|
BKE_collection_object_add_from(bmain, sce, source_ob, obn);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
if (instance_node) {
|
|
|
|
anim_importer.read_node_transform(instance_node, obn);
|
2019-04-30 13:41:21 +10:00
|
|
|
/* if we also have a source_node (always ;), take its
|
|
|
|
* transformation matrix and apply it to the newly instantiated
|
|
|
|
* object to account for node hierarchy transforms in
|
|
|
|
* .dae */
|
2012-03-24 07:52:14 +00:00
|
|
|
if (source_node) {
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADABU::Math::Matrix4 mat4 = source_node->getTransformationMatrix();
|
|
|
|
COLLADABU::Math::Matrix4 bmat4 =
|
|
|
|
mat4.transpose(); /* transpose to get blender row-major order */
|
|
|
|
float mat[4][4];
|
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
for (int j = 0; j < 4; j++) {
|
|
|
|
mat[i][j] = bmat4[i][j];
|
|
|
|
}
|
|
|
|
}
|
2019-04-30 13:41:21 +10:00
|
|
|
/* calc new matrix and apply */
|
2013-05-26 18:36:25 +00:00
|
|
|
mul_m4_m4m4(obn->obmat, obn->obmat, mat);
|
2020-11-06 14:25:30 +01:00
|
|
|
BKE_object_apply_mat4(obn, obn->obmat, false, false);
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
else {
|
|
|
|
anim_importer.read_node_transform(source_node, obn);
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-21 19:33:04 +00:00
|
|
|
/*DAG_relations_tag_update(CTX_data_main(mContext));*/
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADAFW::NodePointerArray &children = source_node->getChildNodes();
|
|
|
|
if (children.getCount()) {
|
|
|
|
for (unsigned int i = 0; i < children.getCount(); i++) {
|
|
|
|
COLLADAFW::Node *child_node = children[i];
|
|
|
|
const COLLADAFW::UniqueId &child_id = child_node->getUniqueId();
|
2019-05-31 22:51:19 +10:00
|
|
|
if (object_map.find(child_id) == object_map.end()) {
|
2011-03-25 09:52:36 +00:00
|
|
|
continue;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADAFW::InstanceNodePointerArray &inodes = child_node->getInstanceNodes();
|
2020-11-06 17:49:09 +01:00
|
|
|
Object *new_child = nullptr;
|
2011-03-25 09:52:36 +00:00
|
|
|
if (inodes.getCount()) { /* \todo loop through instance nodes */
|
|
|
|
const COLLADAFW::UniqueId &id = inodes[0]->getInstanciatedObjectId();
|
2012-06-16 09:16:24 +00:00
|
|
|
fprintf(stderr, "Doing %d child nodes\n", (int)node_map.count(id));
|
2012-04-30 23:51:09 +00:00
|
|
|
new_child = create_instance_node(
|
|
|
|
object_map.find(id)->second, node_map[id], child_node, sce, is_library_node);
|
2011-03-09 14:16:21 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
else {
|
2012-04-30 23:51:09 +00:00
|
|
|
new_child = create_instance_node(
|
2020-11-06 17:49:09 +01:00
|
|
|
object_map.find(child_id)->second, child_node, nullptr, sce, is_library_node);
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
bc_set_parent(new_child, obn, mContext, true);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (is_library_node) {
|
2011-03-25 09:52:36 +00:00
|
|
|
libnode_ob.push_back(new_child);
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-17 06:37:26 +00:00
|
|
|
return obn;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2010-09-04 19:27:04 +00:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* to create constraints off node <extra> tags. Assumes only constraint data in
|
|
|
|
* current <extra> with blender profile. */
|
2013-02-10 17:06:05 +00:00
|
|
|
void DocumentImporter::create_constraints(ExtraTags *et, Object *ob)
|
|
|
|
{
|
|
|
|
if (et && et->isProfile("blender")) {
|
2013-01-21 13:45:49 +00:00
|
|
|
std::string name;
|
2018-03-11 20:32:47 +01:00
|
|
|
short type = 0;
|
|
|
|
et->setData("type", &type);
|
|
|
|
BKE_constraint_add_for_object(ob, "Test_con", type);
|
2013-01-21 13:45:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-25 19:03:02 +02:00
|
|
|
void DocumentImporter::report_unknown_reference(const COLLADAFW::Node &node,
|
|
|
|
const std::string object_type)
|
|
|
|
{
|
|
|
|
std::string id = node.getOriginalId();
|
|
|
|
std::string name = node.getName();
|
|
|
|
fprintf(stderr,
|
2019-03-15 08:53:22 +11:00
|
|
|
"error: node id=\"%s\", name=\"%s\" refers to an undefined %s.\n",
|
|
|
|
id.c_str(),
|
|
|
|
name.c_str(),
|
|
|
|
object_type.c_str());
|
2014-08-25 19:03:02 +02:00
|
|
|
}
|
|
|
|
|
2013-02-10 22:14:56 +00:00
|
|
|
std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node,
|
|
|
|
COLLADAFW::Node *parent_node,
|
|
|
|
Scene *sce,
|
|
|
|
Object *par,
|
|
|
|
bool is_library_node)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2018-06-14 15:15:51 +02:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2020-11-06 17:49:09 +01:00
|
|
|
Object *ob = nullptr;
|
2011-03-25 09:52:36 +00:00
|
|
|
bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
|
2012-03-17 06:37:26 +00:00
|
|
|
bool read_transform = true;
|
2013-02-08 19:52:02 +00:00
|
|
|
std::string id = node->getOriginalId();
|
|
|
|
std::string name = node->getName();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* if node has child nodes write them */
|
2015-09-11 19:12:25 +10:00
|
|
|
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-01-21 13:45:49 +00:00
|
|
|
std::vector<Object *> *objects_done = new std::vector<Object *>();
|
2013-07-29 22:15:04 +00:00
|
|
|
std::vector<Object *> *root_objects = new std::vector<Object *>();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-08 19:52:02 +00:00
|
|
|
fprintf(
|
2019-03-15 08:53:22 +11:00
|
|
|
stderr, "| %s id='%s', name='%s'\n", is_joint ? "JOINT" : "NODE ", id.c_str(), name.c_str());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
if (is_joint) {
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr && !is_library_node) {
|
2019-04-30 13:41:21 +10:00
|
|
|
/* A Joint on root level is a skeleton without root node.
|
|
|
|
* Here we add the armature "on the fly": */
|
2018-06-14 15:55:51 +02:00
|
|
|
par = bc_add_object(bmain, sce, view_layer, OB_ARMATURE, std::string("Armature").c_str());
|
2013-02-20 00:06:31 +00:00
|
|
|
objects_done->push_back(par);
|
2013-07-29 22:15:04 +00:00
|
|
|
root_objects->push_back(par);
|
2013-04-29 19:15:53 +00:00
|
|
|
object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), par));
|
2013-02-20 00:06:31 +00:00
|
|
|
node_map[node->getUniqueId()] = node;
|
|
|
|
}
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr || parent_node->getType() != COLLADAFW::Node::JOINT) {
|
2013-07-14 17:21:12 +00:00
|
|
|
armature_importer.add_root_joint(node, par);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr) {
|
2019-04-30 13:41:21 +10:00
|
|
|
/* for skeletons without root node all has been done above.
|
|
|
|
* Skeletons with root node are handled further down. */
|
2015-09-11 19:12:25 +10:00
|
|
|
goto finally;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2013-02-20 00:06:31 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
else {
|
|
|
|
COLLADAFW::InstanceGeometryPointerArray &geom = node->getInstanceGeometries();
|
|
|
|
COLLADAFW::InstanceCameraPointerArray &camera = node->getInstanceCameras();
|
|
|
|
COLLADAFW::InstanceLightPointerArray &lamp = node->getInstanceLights();
|
|
|
|
COLLADAFW::InstanceControllerPointerArray &controller = node->getInstanceControllers();
|
|
|
|
COLLADAFW::InstanceNodePointerArray &inst_node = node->getInstanceNodes();
|
2011-06-20 10:50:17 +00:00
|
|
|
size_t geom_done = 0;
|
|
|
|
size_t camera_done = 0;
|
|
|
|
size_t lamp_done = 0;
|
|
|
|
size_t controller_done = 0;
|
|
|
|
size_t inst_done = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* XXX linking object with the first <instance_geometry>, though a node may have more of
|
|
|
|
* them... maybe join multiple <instance_...> meshes into 1, and link object with it? not
|
|
|
|
* sure... <instance_geometry> */
|
2011-03-25 09:52:36 +00:00
|
|
|
while (geom_done < geom.getCount()) {
|
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:34:44 +02:00
|
|
|
ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (ob == nullptr) {
|
2014-08-25 19:03:02 +02:00
|
|
|
report_unknown_reference(*node, "instance_mesh");
|
2013-02-08 00:28:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
objects_done->push_back(ob);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr) {
|
2013-07-29 22:15:04 +00:00
|
|
|
root_objects->push_back(ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2013-07-29 22:15:04 +00:00
|
|
|
}
|
2019-09-08 00:12:26 +10:00
|
|
|
geom_done++;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
while (camera_done < camera.getCount()) {
|
|
|
|
ob = create_camera_object(camera[camera_done], sce);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (ob == nullptr) {
|
2014-08-25 19:03:02 +02:00
|
|
|
report_unknown_reference(*node, "instance_camera");
|
2012-08-05 10:23:34 +00:00
|
|
|
}
|
2013-07-29 22:15:04 +00:00
|
|
|
else {
|
2012-08-05 10:23:34 +00:00
|
|
|
objects_done->push_back(ob);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr) {
|
2013-07-29 22:15:04 +00:00
|
|
|
root_objects->push_back(ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2013-07-29 22:15:04 +00:00
|
|
|
}
|
2019-09-08 00:12:26 +10:00
|
|
|
camera_done++;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
while (lamp_done < lamp.getCount()) {
|
2019-02-27 12:02:02 +11:00
|
|
|
ob = create_light_object(lamp[lamp_done], sce);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (ob == nullptr) {
|
2019-02-27 12:02:02 +11:00
|
|
|
report_unknown_reference(*node, "instance_light");
|
2014-08-25 19:03:02 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
objects_done->push_back(ob);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr) {
|
2014-08-25 19:03:02 +02:00
|
|
|
root_objects->push_back(ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-08-25 19:03:02 +02:00
|
|
|
}
|
2019-09-08 00:12:26 +10:00
|
|
|
lamp_done++;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
while (controller_done < controller.getCount()) {
|
2018-03-11 20:32:47 +01:00
|
|
|
COLLADAFW::InstanceGeometry *geometry = (COLLADAFW::InstanceGeometry *)
|
|
|
|
controller[controller_done];
|
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:34:44 +02:00
|
|
|
ob = mesh_importer.create_mesh_object(node, geometry, true, uid_material_map);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (ob == nullptr) {
|
2014-08-25 19:03:02 +02:00
|
|
|
report_unknown_reference(*node, "instance_controller");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
objects_done->push_back(ob);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr) {
|
2014-08-25 19:03:02 +02:00
|
|
|
root_objects->push_back(ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-08-25 19:03:02 +02:00
|
|
|
}
|
2019-09-08 00:12:26 +10:00
|
|
|
controller_done++;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2019-04-30 13:41:21 +10:00
|
|
|
/* XXX instance_node is not supported yet */
|
2011-03-25 09:52:36 +00:00
|
|
|
while (inst_done < inst_node.getCount()) {
|
|
|
|
const COLLADAFW::UniqueId &node_id = inst_node[inst_done]->getInstanciatedObjectId();
|
|
|
|
if (object_map.find(node_id) == object_map.end()) {
|
2012-03-22 13:35:52 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
"Cannot find object for node referenced by <instance_node name=\"%s\">.\n",
|
|
|
|
inst_node[inst_done]->getName().c_str());
|
2020-11-06 17:49:09 +01:00
|
|
|
ob = nullptr;
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
else {
|
2012-05-01 20:08:23 +00:00
|
|
|
std::pair<std::multimap<COLLADAFW::UniqueId, Object *>::iterator,
|
|
|
|
std::multimap<COLLADAFW::UniqueId, Object *>::iterator>
|
|
|
|
pair_iter = object_map.equal_range(node_id);
|
|
|
|
for (std::multimap<COLLADAFW::UniqueId, Object *>::iterator it2 = pair_iter.first;
|
|
|
|
it2 != pair_iter.second;
|
|
|
|
it2++) {
|
2012-04-30 23:51:09 +00:00
|
|
|
Object *source_ob = (Object *)it2->second;
|
|
|
|
COLLADAFW::Node *source_node = node_map[node_id];
|
|
|
|
ob = create_instance_node(source_ob, source_node, node, sce, is_library_node);
|
2013-07-30 12:18:24 +00:00
|
|
|
objects_done->push_back(ob);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr) {
|
2013-07-30 12:18:24 +00:00
|
|
|
root_objects->push_back(ob);
|
2013-07-29 22:15:04 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2019-09-08 00:12:26 +10:00
|
|
|
inst_done++;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-17 06:37:26 +00:00
|
|
|
read_transform = false;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* if node is empty - create empty object
|
|
|
|
* XXX empty node may not mean it is empty object, not sure about this */
|
2011-03-25 09:52:36 +00:00
|
|
|
if ((geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
|
2019-04-30 13:41:21 +10:00
|
|
|
/* Check if Object is armature, by checking if immediate child is a JOINT node. */
|
2013-02-10 17:06:05 +00:00
|
|
|
if (is_armature(node)) {
|
2018-06-14 15:55:51 +02:00
|
|
|
ob = bc_add_object(bmain, sce, view_layer, OB_ARMATURE, name.c_str());
|
2013-02-10 17:06:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-11-06 17:49:09 +01:00
|
|
|
ob = bc_add_object(bmain, sce, view_layer, OB_EMPTY, nullptr);
|
2013-02-10 17:06:05 +00:00
|
|
|
}
|
2012-04-30 23:51:09 +00:00
|
|
|
objects_done->push_back(ob);
|
2020-11-06 17:49:09 +01:00
|
|
|
if (parent_node == nullptr) {
|
2013-07-29 22:15:04 +00:00
|
|
|
root_objects->push_back(ob);
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2021-02-13 17:44:51 +11:00
|
|
|
/* XXX: if there are multiple instances, only one is stored. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-09-11 19:12:25 +10:00
|
|
|
if (!ob) {
|
|
|
|
goto finally;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-07 12:21:11 +01:00
|
|
|
for (Object *ob : *objects_done) {
|
2020-07-03 14:59:27 +02:00
|
|
|
std::string nodename = node->getName().empty() ? node->getOriginalId() : node->getName();
|
2018-06-14 15:15:51 +02:00
|
|
|
BKE_libblock_rename(bmain, &ob->id, (char *)nodename.c_str());
|
2013-04-29 19:15:53 +00:00
|
|
|
object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), ob));
|
2012-04-30 23:51:09 +00:00
|
|
|
node_map[node->getUniqueId()] = node;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-31 22:51:19 +10:00
|
|
|
if (is_library_node) {
|
2012-04-30 23:51:09 +00:00
|
|
|
libnode_ob.push_back(ob);
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2012-04-30 23:51:09 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* create_constraints(et,ob); */
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-07 12:21:11 +01:00
|
|
|
for (Object *ob : *objects_done) {
|
2019-05-31 22:51:19 +10:00
|
|
|
if (read_transform) {
|
2012-06-12 22:05:33 +00:00
|
|
|
anim_importer.read_node_transform(node, ob); /* overwrites location set earlier */
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-04-30 23:51:09 +00:00
|
|
|
if (!is_joint) {
|
2013-07-14 00:34:21 +00:00
|
|
|
if (par && ob) {
|
|
|
|
ob->parent = par;
|
|
|
|
ob->partype = PAROBJECT;
|
|
|
|
ob->parsubstr[0] = 0;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
// bc_set_parent(ob, par, mContext, false);
|
2012-04-30 23:51:09 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-07-03 14:59:27 +02:00
|
|
|
if (objects_done->empty()) {
|
2020-11-06 17:49:09 +01:00
|
|
|
ob = nullptr;
|
2013-02-11 20:21:10 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-07-03 14:59:27 +02:00
|
|
|
ob = *objects_done->begin();
|
2013-02-11 20:21:10 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-11 20:21:10 +00:00
|
|
|
for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
|
2015-09-11 19:12:25 +10:00
|
|
|
std::vector<Object *> *child_objects;
|
|
|
|
child_objects = write_node(child_nodes[i], node, sce, ob, is_library_node);
|
|
|
|
delete child_objects;
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2015-09-11 19:12:25 +10:00
|
|
|
|
|
|
|
finally:
|
|
|
|
delete objects_done;
|
|
|
|
|
2013-07-29 22:15:04 +00:00
|
|
|
return root_objects;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2018-09-02 18:28:27 +10:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the entire visual scene.
|
|
|
|
* Return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScene)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* This method called on post process after writeGeometry, writeMaterial, etc. */
|
|
|
|
|
|
|
|
/* For each <node> in <visual_scene>:
|
|
|
|
* create an Object
|
|
|
|
* if Mesh (previously created in writeGeometry) to which <node> corresponds exists,
|
|
|
|
* link Object with that mesh.
|
|
|
|
*
|
|
|
|
* Update: since we cannot link a Mesh with Object in
|
|
|
|
* writeGeometry because <geometry> does not reference <node>,
|
|
|
|
* we link Objects with Meshes here.
|
|
|
|
*/
|
2011-03-25 09:52:36 +00:00
|
|
|
vscenes.push_back(visualScene);
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must handle all nodes contained in the
|
2012-11-18 01:22:31 +00:00
|
|
|
* library nodes.
|
2019-11-25 01:14:39 +11:00
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryNodes)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
Scene *sce = CTX_data_scene(mContext);
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
const COLLADAFW::NodePointerArray &nodes = libraryNodes->getNodes();
|
2010-09-04 19:27:04 +00:00
|
|
|
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
fprintf(stderr, "+-- Read Library nodes ----------\n");
|
2011-03-25 09:52:36 +00:00
|
|
|
for (unsigned int i = 0; i < nodes.getCount(); i++) {
|
2015-09-11 19:12:25 +10:00
|
|
|
std::vector<Object *> *child_objects;
|
2020-11-06 17:49:09 +01:00
|
|
|
child_objects = write_node(nodes[i], nullptr, sce, nullptr, true);
|
2015-09-11 19:12:25 +10:00
|
|
|
delete child_objects;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2010-09-04 19:27:04 +00:00
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the geometry.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeGeometry(const COLLADAFW::Geometry *geom)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
return mesh_importer.write_geometry(geom);
|
|
|
|
}
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the material.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeMaterial(const COLLADAFW::Material *cmat)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2018-06-14 15:15:51 +02:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2020-07-03 14:59:27 +02:00
|
|
|
const std::string &str_mat_id = cmat->getName().empty() ? cmat->getOriginalId() :
|
|
|
|
cmat->getName();
|
2018-06-14 15:15:51 +02:00
|
|
|
Material *ma = BKE_material_add(bmain, (char *)str_mat_id.c_str());
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
this->uid_effect_map[cmat->getInstantiatedEffect()] = ma;
|
|
|
|
this->uid_material_map[cmat->getUniqueId()] = ma;
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Material *ma)
|
|
|
|
{
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
MaterialNode matNode = MaterialNode(mContext, ef, ma, uid_image_map);
|
2019-06-04 14:31:22 +02:00
|
|
|
|
|
|
|
/* Direct mapping to principled BSDF Shader */
|
|
|
|
matNode.set_diffuse(ef->getDiffuse());
|
|
|
|
matNode.set_emission(ef->getEmission());
|
|
|
|
matNode.set_ior(ef->getIndexOfRefraction());
|
|
|
|
matNode.set_alpha(ef->getOpaqueMode(), ef->getTransparent(), ef->getTransparency());
|
|
|
|
|
|
|
|
/* following mapping still needs to be verified */
|
2019-07-15 17:12:52 +02:00
|
|
|
#if 0
|
|
|
|
/* needs rework to be done for 2.81 */
|
2019-06-04 14:31:22 +02:00
|
|
|
matNode.set_shininess(ef->getShininess());
|
2019-07-15 17:12:52 +02:00
|
|
|
#endif
|
2019-06-04 14:31:22 +02:00
|
|
|
matNode.set_reflectivity(ef->getReflectivity());
|
|
|
|
|
|
|
|
/* not supported by principled BSDF */
|
|
|
|
matNode.set_ambient(ef->getAmbient());
|
|
|
|
matNode.set_specular(ef->getSpecular());
|
|
|
|
matNode.set_reflective(ef->getReflective());
|
2021-05-04 15:19:33 +02:00
|
|
|
|
|
|
|
matNode.update_material_nodetree();
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the effect.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeEffect(const COLLADAFW::Effect *effect)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
const COLLADAFW::UniqueId &uid = effect->getUniqueId();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
if (uid_effect_map.find(uid) == uid_effect_map.end()) {
|
|
|
|
fprintf(stderr, "Couldn't find a material by UID.\n");
|
|
|
|
return true;
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
Material *ma = uid_effect_map[uid];
|
2012-06-12 22:05:33 +00:00
|
|
|
std::map<COLLADAFW::UniqueId, Material *>::iterator iter;
|
|
|
|
for (iter = uid_material_map.begin(); iter != uid_material_map.end(); iter++) {
|
|
|
|
if (iter->second == ma) {
|
2011-07-23 20:49:26 +00:00
|
|
|
this->FW_object_map[iter->first] = effect;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADAFW::CommonEffectPointerArray common_efs = effect->getCommonEffects();
|
|
|
|
if (common_efs.getCount() < 1) {
|
|
|
|
fprintf(stderr, "Couldn't find <profile_COMMON>.\n");
|
|
|
|
return true;
|
|
|
|
}
|
2019-04-30 13:41:21 +10:00
|
|
|
/* XXX TODO: Take all <profile_common>s
|
|
|
|
* Currently only first <profile_common> is supported */
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADAFW::EffectCommon *ef = common_efs[0];
|
|
|
|
write_profile_COMMON(ef, ma);
|
2011-07-18 19:32:51 +00:00
|
|
|
this->FW_object_map[effect->getUniqueId()] = effect;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the camera.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-14 15:15:51 +02:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2020-11-06 17:49:09 +01:00
|
|
|
Camera *cam = nullptr;
|
2011-03-25 09:52:36 +00:00
|
|
|
std::string cam_id, cam_name;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-09-05 06:58:27 +00:00
|
|
|
ExtraTags *et = getExtraTags(camera->getUniqueId());
|
2011-03-25 09:52:36 +00:00
|
|
|
cam_id = camera->getOriginalId();
|
|
|
|
cam_name = camera->getName();
|
2020-07-03 14:59:27 +02:00
|
|
|
if (cam_name.empty()) {
|
|
|
|
cam = (Camera *)BKE_camera_add(bmain, (char *)cam_id.c_str());
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
else {
|
2020-07-03 14:59:27 +02:00
|
|
|
cam = (Camera *)BKE_camera_add(bmain, (char *)cam_name.c_str());
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
if (!cam) {
|
2012-03-31 00:59:17 +00:00
|
|
|
fprintf(stderr, "Cannot create camera.\n");
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-09-21 10:46:58 +00:00
|
|
|
if (et && et->isProfile("blender")) {
|
2013-09-05 06:58:27 +00:00
|
|
|
et->setData("shiftx", &(cam->shiftx));
|
|
|
|
et->setData("shifty", &(cam->shifty));
|
2019-05-18 11:45:38 +02:00
|
|
|
et->setData("dof_distance", &(cam->dof.focus_distance));
|
2013-09-05 06:58:27 +00:00
|
|
|
}
|
2019-02-16 12:21:44 +11:00
|
|
|
cam->clip_start = camera->getNearClippingPlane().getValue();
|
|
|
|
cam->clip_end = camera->getFarClippingPlane().getValue();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
COLLADAFW::Camera::CameraType type = camera->getCameraType();
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (type) {
|
2012-06-12 22:05:33 +00:00
|
|
|
case COLLADAFW::Camera::ORTHOGRAPHIC: {
|
2011-03-25 09:52:36 +00:00
|
|
|
cam->type = CAM_ORTHO;
|
|
|
|
} break;
|
2012-06-12 22:05:33 +00:00
|
|
|
case COLLADAFW::Camera::PERSPECTIVE: {
|
2011-03-25 09:52:36 +00:00
|
|
|
cam->type = CAM_PERSP;
|
|
|
|
} break;
|
2012-06-12 22:05:33 +00:00
|
|
|
case COLLADAFW::Camera::UNDEFINED_CAMERATYPE: {
|
2012-03-31 00:59:17 +00:00
|
|
|
fprintf(stderr, "Current camera type is not supported.\n");
|
2011-03-25 09:52:36 +00:00
|
|
|
cam->type = CAM_PERSP;
|
|
|
|
} break;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (camera->getDescriptionType()) {
|
2012-06-12 22:05:33 +00:00
|
|
|
case COLLADAFW::Camera::ASPECTRATIO_AND_Y: {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (cam->type) {
|
2011-03-25 09:52:36 +00:00
|
|
|
case CAM_ORTHO: {
|
2012-08-04 22:18:56 +00:00
|
|
|
double ymag = 2 * camera->getYMag().getValue();
|
2012-06-12 22:05:33 +00:00
|
|
|
double aspect = camera->getAspectRatio().getValue();
|
|
|
|
double xmag = aspect * ymag;
|
|
|
|
cam->ortho_scale = (float)xmag;
|
|
|
|
} break;
|
2011-03-25 09:52:36 +00:00
|
|
|
case CAM_PERSP:
|
|
|
|
default: {
|
2012-06-12 22:05:33 +00:00
|
|
|
double yfov = camera->getYFov().getValue();
|
|
|
|
double aspect = camera->getAspectRatio().getValue();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-07-31 14:25:09 +02:00
|
|
|
/* NOTE: Needs more testing (As we currently have no official test data for this) */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-03 17:54:04 +00:00
|
|
|
double xfov = 2.0f * atanf(aspect * tanf(DEG2RADF(yfov) * 0.5f));
|
|
|
|
cam->lens = fov_to_focallength(xfov, cam->sensor_x);
|
2012-06-12 22:05:33 +00:00
|
|
|
} break;
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
} break;
|
2012-06-12 22:05:33 +00:00
|
|
|
/* XXX correct way to do following four is probably to get also render
|
2012-10-04 13:26:15 +00:00
|
|
|
* size and determine proper settings from that somehow */
|
2012-06-12 22:05:33 +00:00
|
|
|
case COLLADAFW::Camera::ASPECTRATIO_AND_X:
|
|
|
|
case COLLADAFW::Camera::SINGLE_X:
|
|
|
|
case COLLADAFW::Camera::X_AND_Y: {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (cam->type) {
|
2011-03-25 09:52:36 +00:00
|
|
|
case CAM_ORTHO:
|
2012-08-04 22:18:56 +00:00
|
|
|
cam->ortho_scale = (float)camera->getXMag().getValue() * 2;
|
2011-03-25 09:52:36 +00:00
|
|
|
break;
|
|
|
|
case CAM_PERSP:
|
|
|
|
default: {
|
2012-06-12 22:05:33 +00:00
|
|
|
double x = camera->getXFov().getValue();
|
2021-02-05 16:23:34 +11:00
|
|
|
/* X is in degrees, cam->lens is in millimeters. */
|
2012-06-12 22:05:33 +00:00
|
|
|
cam->lens = fov_to_focallength(DEG2RADF(x), cam->sensor_x);
|
|
|
|
} break;
|
2011-03-25 09:52:36 +00:00
|
|
|
}
|
|
|
|
} break;
|
2012-06-12 22:05:33 +00:00
|
|
|
case COLLADAFW::Camera::SINGLE_Y: {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (cam->type) {
|
2011-03-25 09:52:36 +00:00
|
|
|
case CAM_ORTHO:
|
|
|
|
cam->ortho_scale = (float)camera->getYMag().getValue();
|
|
|
|
break;
|
|
|
|
case CAM_PERSP:
|
|
|
|
default: {
|
|
|
|
double yfov = camera->getYFov().getValue();
|
2021-02-05 16:23:34 +11:00
|
|
|
/* yfov is in degrees, cam->lens is in millimeters. */
|
2011-11-04 14:36:06 +00:00
|
|
|
cam->lens = fov_to_focallength(DEG2RADF(yfov), cam->sensor_x);
|
2012-06-12 22:05:33 +00:00
|
|
|
} break;
|
2010-09-28 08:01:20 +00:00
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
} break;
|
2012-06-12 22:05:33 +00:00
|
|
|
case COLLADAFW::Camera::UNDEFINED:
|
2019-04-30 13:41:21 +10:00
|
|
|
/* read nothing, use blender defaults. */
|
2012-06-12 22:05:33 +00:00
|
|
|
break;
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
this->uid_camera_map[camera->getUniqueId()] = cam;
|
2011-07-06 18:09:36 +00:00
|
|
|
this->FW_object_map[camera->getUniqueId()] = camera;
|
2019-04-30 13:41:21 +10:00
|
|
|
/* XXX import camera options */
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the image.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-13 16:00:46 +00:00
|
|
|
const std::string &imagepath = image->getImageURI().toNativePath();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
char dir[FILE_MAX];
|
2013-02-13 16:00:46 +00:00
|
|
|
char absolute_path[FILE_MAX];
|
|
|
|
const char *workpath;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-02-13 16:00:46 +00:00
|
|
|
BLI_split_dir_part(this->import_settings->filepath, dir, sizeof(dir));
|
|
|
|
BLI_join_dirfile(absolute_path, sizeof(absolute_path), dir, imagepath.c_str());
|
|
|
|
if (BLI_exists(absolute_path)) {
|
|
|
|
workpath = absolute_path;
|
2018-06-08 08:07:48 +02:00
|
|
|
}
|
2013-02-13 16:00:46 +00:00
|
|
|
else {
|
2019-04-30 13:41:21 +10:00
|
|
|
/* Maybe imagepath was already absolute ? */
|
2013-02-13 16:00:46 +00:00
|
|
|
if (!BLI_exists(imagepath.c_str())) {
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
fprintf(stderr, "|! Image not found: %s\n", imagepath.c_str());
|
2013-02-13 16:00:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
workpath = imagepath.c_str();
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-11 15:40:37 +02:00
|
|
|
Image *ima = BKE_image_load_exists(CTX_data_main(mContext), workpath);
|
2011-03-25 09:52:36 +00:00
|
|
|
if (!ima) {
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
fprintf(stderr, "|! Cannot create image: %s\n", workpath);
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
2011-03-25 09:52:36 +00:00
|
|
|
this->uid_image_map[image->getUniqueId()] = ima;
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
fprintf(stderr, "| import Image: %s\n", workpath);
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the light.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeLight(const COLLADAFW::Light *light)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-06-14 15:15:51 +02:00
|
|
|
Main *bmain = CTX_data_main(mContext);
|
2020-11-06 17:49:09 +01:00
|
|
|
Light *lamp = nullptr;
|
2011-03-25 09:52:36 +00:00
|
|
|
std::string la_id, la_name;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-01-21 13:45:49 +00:00
|
|
|
ExtraTags *et = getExtraTags(light->getUniqueId());
|
2019-04-18 07:21:26 +02:00
|
|
|
#if 0
|
|
|
|
TagsMap::iterator etit;
|
2011-03-28 09:31:44 +00:00
|
|
|
ExtraTags *et = 0;
|
|
|
|
etit = uid_tags_map.find(light->getUniqueId().toAscii());
|
2019-04-18 07:21:26 +02:00
|
|
|
if (etit != uid_tags_map.end()) {
|
|
|
|
et = etit->second;
|
|
|
|
}
|
|
|
|
#endif
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
la_id = light->getOriginalId();
|
|
|
|
la_name = light->getName();
|
2020-07-03 14:59:27 +02:00
|
|
|
if (la_name.empty()) {
|
|
|
|
lamp = (Light *)BKE_light_add(bmain, (char *)la_id.c_str());
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
else {
|
2020-07-03 14:59:27 +02:00
|
|
|
lamp = (Light *)BKE_light_add(bmain, (char *)la_name.c_str());
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
if (!lamp) {
|
2018-06-27 14:41:53 +02:00
|
|
|
fprintf(stderr, "Cannot create light.\n");
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* if we find an ExtraTags for this, use that instead. */
|
2012-03-24 07:52:14 +00:00
|
|
|
if (et && et->isProfile("blender")) {
|
2011-03-28 09:31:44 +00:00
|
|
|
et->setData("type", &(lamp->type));
|
|
|
|
et->setData("flag", &(lamp->flag));
|
|
|
|
et->setData("mode", &(lamp->mode));
|
|
|
|
et->setData("gamma", &(lamp->k));
|
2011-03-30 10:51:01 +00:00
|
|
|
et->setData("red", &(lamp->r));
|
|
|
|
et->setData("green", &(lamp->g));
|
|
|
|
et->setData("blue", &(lamp->b));
|
2011-03-28 09:31:44 +00:00
|
|
|
et->setData("shadow_r", &(lamp->shdwr));
|
|
|
|
et->setData("shadow_g", &(lamp->shdwg));
|
|
|
|
et->setData("shadow_b", &(lamp->shdwb));
|
|
|
|
et->setData("energy", &(lamp->energy));
|
|
|
|
et->setData("dist", &(lamp->dist));
|
|
|
|
et->setData("spotsize", &(lamp->spotsize));
|
Cleanup: Internal degrees removal.
This patch changes most of the reamining degrees usage in internal code into radians.
I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them.
WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly
in previous versions (a few angle properties would use radians values as degrees...).
Details:
- Data:
-- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such
(using getter/setter functions), still using radians internally.
-- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev.
- Modifiers:
-- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done.
- Postprocessing:
-- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done.
- BGE:
-- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type,
it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence
can be either distance or angle values, depending on the mode. Will leave this to BGE team.
-- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself,
as it seems this is the expected value here...).
-- bRadarSensor.angle: Done.
Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt
Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt
Thanks to all!
Differential Revision: http://developer.blender.org/D59
2013-12-03 20:09:25 +01:00
|
|
|
lamp->spotsize = DEG2RADF(lamp->spotsize);
|
2011-03-28 09:31:44 +00:00
|
|
|
et->setData("spotblend", &(lamp->spotblend));
|
|
|
|
et->setData("att1", &(lamp->att1));
|
|
|
|
et->setData("att2", &(lamp->att2));
|
|
|
|
et->setData("falloff_type", &(lamp->falloff_type));
|
|
|
|
et->setData("clipsta", &(lamp->clipsta));
|
|
|
|
et->setData("clipend", &(lamp->clipend));
|
|
|
|
et->setData("bias", &(lamp->bias));
|
|
|
|
et->setData("soft", &(lamp->soft));
|
|
|
|
et->setData("bufsize", &(lamp->bufsize));
|
|
|
|
et->setData("buffers", &(lamp->buffers));
|
|
|
|
et->setData("area_shape", &(lamp->area_shape));
|
|
|
|
et->setData("area_size", &(lamp->area_size));
|
|
|
|
et->setData("area_sizey", &(lamp->area_sizey));
|
|
|
|
et->setData("area_sizez", &(lamp->area_sizez));
|
|
|
|
}
|
2011-03-30 10:51:01 +00:00
|
|
|
else {
|
|
|
|
float constatt = light->getConstantAttenuation().getValue();
|
|
|
|
float linatt = light->getLinearAttenuation().getValue();
|
|
|
|
float quadatt = light->getQuadraticAttenuation().getValue();
|
|
|
|
float d = 25.0f;
|
|
|
|
float att1 = 0.0f;
|
|
|
|
float att2 = 0.0f;
|
|
|
|
float e = 1.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-30 10:51:01 +00:00
|
|
|
if (light->getColor().isValid()) {
|
|
|
|
COLLADAFW::Color col = light->getColor();
|
|
|
|
lamp->r = col.getRed();
|
|
|
|
lamp->g = col.getGreen();
|
|
|
|
lamp->b = col.getBlue();
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 07:52:14 +00:00
|
|
|
if (IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
|
2011-03-30 10:51:01 +00:00
|
|
|
att2 = quadatt;
|
2012-06-12 22:05:33 +00:00
|
|
|
d = sqrt(1.0f / quadatt);
|
2011-03-30 10:51:01 +00:00
|
|
|
}
|
2019-04-30 13:41:21 +10:00
|
|
|
/* linear light */
|
2012-03-24 07:52:14 +00:00
|
|
|
else if (IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
|
2011-03-30 10:51:01 +00:00
|
|
|
att1 = linatt;
|
2012-06-12 22:05:33 +00:00
|
|
|
d = (1.0f / linatt);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (IS_EQ(constatt, 1.0f)) {
|
2011-03-30 10:51:01 +00:00
|
|
|
att1 = 1.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-04-30 13:41:21 +10:00
|
|
|
/* assuming point light (const att = 1.0); */
|
2011-03-30 10:51:01 +00:00
|
|
|
att1 = 1.0f;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
d *= (1.0f / unit_converter.getLinearMeter());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-30 10:51:01 +00:00
|
|
|
lamp->energy = e;
|
|
|
|
lamp->dist = d;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Partial rewrite of the Collada Module for Blender 2.8
Most important changes are in the Animation exporter and Animation Importer.
There is still some cleaning up to be done. But the Exporter/Importer basically
work within Blender 2.8
Some details:
User Interface:
The interface has been reorganized to look more like the FBX interface.
New options in user interface:
* keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves
* keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:
- the exported animated objects have parent inverse matrices
different from the unit matrix
- The exported objects have negative scaling
There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.
BlenderContext:
is a new class that contains the bridge to Blender. It contains
pointers to the current export/import context plus derived values
of Depsgraph, Scene, Main
Reporting:
I reorganized the output on the Blender Console to become more
informative and more readable
Preservation of Item names:
name attributes are now encoded with XML entities. This makes
sure that i can export/import names exactly defined in the tool.
This affects material names, bone names and object names.
Hierarchy export:
* Object and Bone Hierarchies are now exported correctly
by taking the Blender parent/child hierarchy into account
* Export also not selected intermediate objects
Problem:
When we export an Object Hierarchy, then we must export
all elements of the hierarchy to maintain the transforms. This
is especially important when exporting animated objects, because the
animation curves are exported as relative curves based on the
parent-child hierarchy. If an intermediate animated object is missing
then the exported animation breaks.
Solution:
If the "Selected" Optioon is enabled, then take care
to also export all objects which are not selected and hidden,
but which are parents of selected objects.
Node Based Material Importer (wip):
Added basic support for Materials with diffuse color and
diffuse textures. More properties (opacity, emission) need
changes in the used shader.
Note: Materials are all constructed by using the principled BSDF shader.
Animation Exporter:
* Massive optimization of the Animation Bake tool (Animation Sampler).
Instead of sampling each fcurve separately, i now sample all
exported fcurves simultaneously. So i avoid many (many!)
scene updates during animation export.
* Add support for Continuous Acceleration (Fcurve handles)
This allows us to create smoother FCurves during importing Collada
Animation curves. Possibly this should become an option ionstead of
a fixed import feature.
* Add support for sampling curves (to bake animations)
* The animation sampler now can be used for any animation curve.
Before the sampler only looked at curves which are supported by
Standard Collada 1.4. However the Collada exporter currently
ignores all animation curves which are not covered by the 1.4.1
Collada Standards. There is still some room for improvements
here (work in progres)
Known issues:
* Some exports do currently not work reliably, among those
are the camera animations, material animations and light animations
those animations will be added back next (work in progres)
* Exporting animation curves with keyframes (and tangents)
sometimes results in odd curves (when parent inverse matrix is involved)
This needs to be checked in more depth (probably it can not be solved).
* Export of "all animations in scene" is disabled because the
Collada Importer can not handle this reliably at the
moment (work in progres).
* Support for Animation Clip export
Added one extra level to the exported animations
such that now all scene animations are enclosed:
<Animation name="id_name(ob)_Action">
<Animation>...</Animation>
...
</Animation>
Animation Importer:
* Import of animations for objects with multiple materials
When importing multiple materials for one object,
the imported material animation curves have all been
assigned to the first material in the object.
Error handling (wip):
The Importer was a bit confused as it sometimes ignored fatal
parsing errors and continued to import. I did my best to
unconfuse it, but i believe that this needs to be tested more.
Refactoring:
update : move generation of effect id names into own function
update : adjust importer/exporter for no longer supported HEMI lights
cleanup: Removed no lopnger existing attribute from the exporter presets
cleanup: Removed not needed Context attribute from DocumentExporter
fix : Avoid duplicate deletion of temporary items
cleanup: fixed indentation and white space issues
update : Make BCAnimation class more self contained
cleanup: Renamed classes, updated comments for better reading
cleanup: Moved static class functions to collada_utils
cleanup: Moved typedefs to more intuitive locations
cleanup: indentation and class method declarations
cleanup: Removed no longer needed methods
update : Moved Classes into separate files
cleanup: Added comments
cleanup: take care of name conventions
... : many more small changes, not helpful to list them all
2018-11-23 15:57:45 +01:00
|
|
|
switch (light->getLightType()) {
|
2011-03-30 10:51:01 +00:00
|
|
|
case COLLADAFW::Light::AMBIENT_LIGHT: {
|
2019-04-30 13:41:21 +10:00
|
|
|
lamp->type = LA_SUN; /* TODO needs more thoughts */
|
2012-06-12 22:05:33 +00:00
|
|
|
} break;
|
2011-03-30 10:51:01 +00:00
|
|
|
case COLLADAFW::Light::SPOT_LIGHT: {
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->type = LA_SPOT;
|
|
|
|
lamp->att1 = att1;
|
|
|
|
lamp->att2 = att2;
|
2019-05-31 22:51:19 +10:00
|
|
|
if (IS_EQ(att1, 0.0f) && att2 > 0) {
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->falloff_type = LA_FALLOFF_INVSQUARE;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
if (IS_EQ(att2, 0.0f) && att1 > 0) {
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->falloff_type = LA_FALLOFF_INVLINEAR;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
Cleanup: Internal degrees removal.
This patch changes most of the reamining degrees usage in internal code into radians.
I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them.
WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly
in previous versions (a few angle properties would use radians values as degrees...).
Details:
- Data:
-- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such
(using getter/setter functions), still using radians internally.
-- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev.
- Modifiers:
-- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done.
- Postprocessing:
-- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done.
- BGE:
-- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type,
it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence
can be either distance or angle values, depending on the mode. Will leave this to BGE team.
-- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself,
as it seems this is the expected value here...).
-- bRadarSensor.angle: Done.
Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt
Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt
Thanks to all!
Differential Revision: http://developer.blender.org/D59
2013-12-03 20:09:25 +01:00
|
|
|
lamp->spotsize = DEG2RADF(light->getFallOffAngle().getValue());
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->spotblend = light->getFallOffExponent().getValue();
|
|
|
|
} break;
|
2011-03-30 10:51:01 +00:00
|
|
|
case COLLADAFW::Light::DIRECTIONAL_LIGHT: {
|
2012-06-12 22:05:33 +00:00
|
|
|
/* our sun is very strong, so pick a smaller energy level */
|
|
|
|
lamp->type = LA_SUN;
|
|
|
|
} break;
|
2011-03-30 10:51:01 +00:00
|
|
|
case COLLADAFW::Light::POINT_LIGHT: {
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->type = LA_LOCAL;
|
|
|
|
lamp->att1 = att1;
|
|
|
|
lamp->att2 = att2;
|
2019-05-31 22:51:19 +10:00
|
|
|
if (IS_EQ(att1, 0.0f) && att2 > 0) {
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->falloff_type = LA_FALLOFF_INVSQUARE;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
|
|
|
if (IS_EQ(att2, 0.0f) && att1 > 0) {
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->falloff_type = LA_FALLOFF_INVLINEAR;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2012-06-12 22:05:33 +00:00
|
|
|
} break;
|
2011-03-30 10:51:01 +00:00
|
|
|
case COLLADAFW::Light::UNDEFINED: {
|
2018-06-27 14:41:53 +02:00
|
|
|
fprintf(stderr, "Current light type is not supported.\n");
|
2012-06-12 22:05:33 +00:00
|
|
|
lamp->type = LA_LOCAL;
|
|
|
|
} break;
|
2011-03-30 10:51:01 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 12:02:02 +11:00
|
|
|
this->uid_light_map[light->getUniqueId()] = lamp;
|
2011-07-03 11:07:34 +00:00
|
|
|
this->FW_object_map[light->getUniqueId()] = light;
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* this function is called only for animations that pass COLLADAFW::validate */
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeAnimation(const COLLADAFW::Animation *anim)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
return anim_importer.write_animation(anim);
|
|
|
|
}
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* called on post-process stage after writeVisualScenes */
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeAnimationList(const COLLADAFW::AnimationList *animationList)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* return true; */
|
2011-03-25 09:52:36 +00:00
|
|
|
return anim_importer.write_animation_list(animationList);
|
|
|
|
}
|
|
|
|
|
2018-12-05 22:04:10 +01:00
|
|
|
#if WITH_OPENCOLLADA_ANIMATION_CLIP
|
2019-04-30 13:41:21 +10:00
|
|
|
/* Since opencollada 1.6.68
|
|
|
|
* called on post-process stage after writeVisualScenes */
|
2018-12-04 20:28:20 +01:00
|
|
|
bool DocumentImporter::writeAnimationClip(const COLLADAFW::AnimationClip *animationClip)
|
2018-12-04 19:11:33 +01:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2018-12-04 19:11:33 +01:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-12-04 19:11:33 +01:00
|
|
|
|
|
|
|
return true;
|
2019-04-30 13:41:21 +10:00
|
|
|
/* TODO: implement import of AnimationClips */
|
|
|
|
// return animation_clip_importer.write_animation_clip(animationClip);
|
2018-12-04 19:11:33 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-11-25 01:14:39 +11:00
|
|
|
/**
|
|
|
|
* When this method is called, the writer must write the skin controller data.
|
|
|
|
* \return The writer should return true, if writing succeeded, false otherwise.
|
|
|
|
*/
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeSkinControllerData(const COLLADAFW::SkinControllerData *skin)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
|
|
|
return armature_importer.write_skin_controller_data(skin);
|
|
|
|
}
|
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* this is called on postprocess, before writeVisualScenes */
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeController(const COLLADAFW::Controller *controller)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2019-05-31 22:51:19 +10:00
|
|
|
if (mImportStage == Fetching_Controller_data) {
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
2019-05-31 22:51:19 +10:00
|
|
|
}
|
2018-06-08 08:07:48 +02:00
|
|
|
|
2011-03-25 09:52:36 +00:00
|
|
|
return armature_importer.write_controller(controller);
|
|
|
|
}
|
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeFormulas(const COLLADAFW::Formulas *formulas)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
Merge of the COLLADA GSoC branch into trunk.
COLLADA code is disabled by default (it has dependencies requiring manual install).
SCons and CMake builds are supported on Windows and Linux, no Mac building yet. More on building COLLADA code: http://wiki.blender.org/index.php/User:Kazanbas/Building_Collada_Branch.
The detailed command log of the merge (can be useful for educational purposes):
branch=https://svn.blender.org/svnroot/bf-blender/branches/soc-2009-chingachgook
# collada code
svn copy $branch/source/blender/collada source/blender/collada
# operator
svn merge -c 20401,20955,21077,24077,24079 $branch/source/blender/windowmanager/intern/wm_operators.c source/blender/windowmanager/intern/wm_operators.c
# menu
svn merge -c 24079 $branch/release/scripts/ui/space_info.py release/scripts/ui/space_info.py
# scons
svn merge -c 20398 $branch/source/blender/SConscript source/blender/SConscript
svn merge -c 20398,20691,20955,22726 $branch/tools/btools.py tools/btools.py
svn merge -c 20691,20955,22726 $branch/tools/Blender.py tools/Blender.py
svn merge -c 20398,20692,20955 $branch/config/linux2-config.py config/linux2-config.py
svn merge -c 22726 $branch/config/win64-vc-config.py config/win64-vc-config.py
svn merge -c 22726 $branch/config/win32-vc-config.py config/win32-vc-config.py
svn merge -c 24077 $branch/source/blender/windowmanager/SConscript source/blender/windowmanager/SConscript
# cmake
svn merge -c 23319,23905,24077,24158 $branch/CMakeLists.txt CMakeLists.txt
svn merge -c 23319 $branch/source/blender/CMakeLists.txt source/blender/CMakeLists.txt
svn merge -c 23319 $branch/source/creator/CMakeLists.txt source/creator/CMakeLists.txt
svn merge -c 23319 $branch/CMake/macros.cmake CMake/macros.cmake
svn merge -c 24077 $branch/source/blender/windowmanager/CMakeLists.txt source/blender/windowmanager/CMakeLists.txt
2009-10-30 15:35:50 +00:00
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::writeKinematicsScene(const COLLADAFW::KinematicsScene *kinematicsScene)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2010-12-14 21:46:03 +00:00
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
ExtraTags *DocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid)
|
2011-03-25 11:07:57 +00:00
|
|
|
{
|
2012-06-12 22:05:33 +00:00
|
|
|
if (uid_tags_map.find(uid.toAscii()) == uid_tags_map.end()) {
|
2020-11-06 17:49:09 +01:00
|
|
|
return nullptr;
|
2011-03-25 11:07:57 +00:00
|
|
|
}
|
2011-03-28 09:31:44 +00:00
|
|
|
return uid_tags_map[uid.toAscii()];
|
2011-03-25 11:07:57 +00:00
|
|
|
}
|
|
|
|
|
2012-06-12 22:05:33 +00:00
|
|
|
bool DocumentImporter::addExtraTags(const COLLADAFW::UniqueId &uid, ExtraTags *extra_tags)
|
2011-03-25 09:52:36 +00:00
|
|
|
{
|
2011-03-28 09:31:44 +00:00
|
|
|
uid_tags_map[uid.toAscii()] = extra_tags;
|
2011-03-25 09:52:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
2010-12-14 21:46:03 +00:00
|
|
|
|
2013-02-10 17:06:05 +00:00
|
|
|
bool DocumentImporter::is_armature(COLLADAFW::Node *node)
|
|
|
|
{
|
2013-01-21 13:45:49 +00:00
|
|
|
COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes();
|
2013-02-10 17:06:05 +00:00
|
|
|
for (unsigned int i = 0; i < child_nodes.getCount(); i++) {
|
|
|
|
if (child_nodes[i]->getType() == COLLADAFW::Node::JOINT) {
|
|
|
|
return true;
|
|
|
|
}
|
2013-01-21 13:45:49 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-30 13:41:21 +10:00
|
|
|
/* no child is JOINT */
|
2013-01-21 13:45:49 +00:00
|
|
|
return false;
|
|
|
|
}
|