Anim: drop versioning code for pre-2.50 animation
Drop all support for animation data from Blender versions 2.49 and older. - The `IPO` DNA struct is deleted, as is the `IDType_ID_IP` type definition. - Versioning code has been removed in its entirety. - Loading a pre-2.50 blend file will issue a warning, stating that any animation data that was there is now lost, and that the file should be loaded & re-saved with Blender 4.5 to properly port the data. Note that versioning of Action assignments (as in, picking a slot) still uses the tagging + updating all tagged assignments as a post-processing step. This is necessary because picking the right slot is only possible after all Actions (also those from libraries) have been versioned. We might be able to address this as well, by upgrading legacy → slotted Actions "on the fly" versioning these Action assignments. If we do that, I think that would be better in a separate PR though, as it could introduce issues by itself. Ref: #134219 Pull Request: https://projects.blender.org/blender/blender/pulls/145188
This commit is contained in:
@@ -39,7 +39,6 @@ set(SRC_DNA_INC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpu_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_grease_pencil_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_image_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ipo_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_key_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_lattice_types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_layer_types.h
|
||||
|
||||
@@ -49,9 +49,8 @@ bool action_is_layered(const bAction &dna_action)
|
||||
const bool has_layered_data = action.layer_array_num > 0 || action.slot_array_num > 0;
|
||||
const bool has_animato_data = !(BLI_listbase_is_empty(&action.curves) &&
|
||||
BLI_listbase_is_empty(&action.groups));
|
||||
const bool has_pre_animato_data = !BLI_listbase_is_empty(&action.chanbase);
|
||||
|
||||
return has_layered_data || (!has_animato_data && !has_pre_animato_data);
|
||||
return has_layered_data || !has_animato_data;
|
||||
}
|
||||
|
||||
void convert_legacy_animato_actions(Main &bmain)
|
||||
@@ -68,27 +67,12 @@ void convert_legacy_animato_actions(Main &bmain)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* This function should skip pre-2.50 Actions, as those are versioned in a special step (see
|
||||
* `do_versions_after_setup()` in `versioning_common.cc`). */
|
||||
if (!BLI_listbase_is_empty(&action.chanbase)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
convert_legacy_animato_action(action);
|
||||
}
|
||||
}
|
||||
|
||||
void convert_legacy_animato_action(bAction &dna_action)
|
||||
{
|
||||
BLI_assert_msg(BLI_listbase_is_empty(&dna_action.chanbase),
|
||||
"this function cannot handle pre-2.50 Actions");
|
||||
if (!BLI_listbase_is_empty(&dna_action.chanbase)) {
|
||||
/* This is a pre-2.5 Action, which cannot be converted here. It's converted in another function
|
||||
* to a post-2.5 Action (aka Animato Action), and after that, this function will be called
|
||||
* again. */
|
||||
return;
|
||||
}
|
||||
|
||||
Action &action = dna_action.wrap();
|
||||
BLI_assert(action.is_action_legacy());
|
||||
|
||||
@@ -257,10 +241,10 @@ void convert_legacy_action_assignments(Main &bmain, ReportList *reports)
|
||||
};
|
||||
|
||||
/* Note that the code below does not remove the `action_assignment_needs_slot` tag. One ID can
|
||||
* use multiple Actions (via NLA, Action constraints, etc.); if one of those Action is an ancient
|
||||
* one from before 2.50 (just to name one example case) this ID may needs to be re-visited
|
||||
* after those were versioned. Rather than trying to figure out if re-visiting is necessary, this
|
||||
* function is safe to call multiple times, and all that's lost is a little bit of CPU time. */
|
||||
* use multiple Actions (via NLA, Action constraints, etc.); if one of those Action is a legacy
|
||||
* one from a linked datablock, this ID may needs to be re-visited after the library file was
|
||||
* versioned. Rather than trying to figure out if re-visiting is necessary, this function is safe
|
||||
* to call multiple times, and all that's lost is a little bit of CPU time. */
|
||||
|
||||
ID *id;
|
||||
FOREACH_MAIN_ID_BEGIN (&bmain, id) {
|
||||
|
||||
@@ -20,15 +20,6 @@ TEST(animrig_versioning, action_is_layered)
|
||||
/* This unit test doesn't put valid data in the action under test. Since action_is_layered()
|
||||
* only looks at the length of lists, and not their contents, that should be fine. */
|
||||
|
||||
{ /* Pre-Animato Action / Blender version 2.49 and older. */
|
||||
bAction action = {};
|
||||
Link /* Ipo */ fake_ipo = {};
|
||||
|
||||
BLI_addtail(&action.chanbase, &fake_ipo);
|
||||
EXPECT_FALSE(action_is_layered(action))
|
||||
<< "Pre-2.5 Actions should NOT be considered 'layered'";
|
||||
}
|
||||
|
||||
{ /* Animato Action only fcurves / Blender version [2.5, 4.4) */
|
||||
bAction action = {};
|
||||
Link /* FCurve */ fake_fcurve = {};
|
||||
|
||||
@@ -301,7 +301,6 @@ extern IDTypeInfo IDType_ID_IM;
|
||||
extern IDTypeInfo IDType_ID_LT;
|
||||
extern IDTypeInfo IDType_ID_LA;
|
||||
extern IDTypeInfo IDType_ID_CA;
|
||||
extern IDTypeInfo IDType_ID_IP;
|
||||
extern IDTypeInfo IDType_ID_KE;
|
||||
extern IDTypeInfo IDType_ID_WO;
|
||||
extern IDTypeInfo IDType_ID_SCR;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
#pragma once
|
||||
|
||||
/** \file
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
struct Main;
|
||||
|
||||
/**
|
||||
* Called from #do_versions() in `readfile.cc` to convert the old `IPO/adrcode`
|
||||
* system to the new Layered Action system.
|
||||
*
|
||||
* Note: this *only* deals with animation data that is *pre-Animato*, and
|
||||
* upgrades it all the way past Animato to modern Layered Actions and drivers.
|
||||
* Actions that are already Animato actions are ignored, as they are versioned
|
||||
* elsewhere (see `animrig::versioning::convert_legacy_actions()`). This is admittedly
|
||||
* weird, but it's due to the fact that versioning pre-Animato data requires
|
||||
* creating new datablocks, which must happen at a stage *after* the standard
|
||||
* versioning where the simpler Animato-to-Layered upgrades are done.
|
||||
*
|
||||
* The basic method used here, is to loop over data-blocks which have IPO-data,
|
||||
* and add those IPO's to new AnimData blocks as Actions.
|
||||
* Action/NLA data only works well for Objects, so these only need to be checked for there.
|
||||
*
|
||||
* Data that has been converted should be freed immediately, which means that it is immediately
|
||||
* clear which data-blocks have yet to be converted, and also prevent freeing errors when we exit.
|
||||
*
|
||||
* \note Currently done after all file reading.
|
||||
*/
|
||||
void do_versions_ipos_to_layered_actions(struct Main *bmain);
|
||||
|
||||
/* --------------------- xxx stuff ------------------------ */
|
||||
@@ -287,8 +287,6 @@ struct Main : blender::NonCopyable, blender::NonMovable {
|
||||
ListBase lattices = {};
|
||||
ListBase lights = {};
|
||||
ListBase cameras = {};
|
||||
/** Deprecated (only for versioning). */
|
||||
ListBase ipo = {};
|
||||
ListBase shapekeys = {};
|
||||
ListBase worlds = {};
|
||||
ListBase screens = {};
|
||||
|
||||
@@ -160,7 +160,6 @@ set(SRC
|
||||
intern/image_save.cc
|
||||
intern/instances.cc
|
||||
intern/instances_attributes.cc
|
||||
intern/ipo.cc
|
||||
intern/kelvinlet.cc
|
||||
intern/key.cc
|
||||
intern/keyconfig.cc
|
||||
@@ -428,7 +427,6 @@ set(SRC
|
||||
BKE_image_save.hh
|
||||
BKE_image_wrappers.hh
|
||||
BKE_instances.hh
|
||||
BKE_ipo.h
|
||||
BKE_kelvinlet.h
|
||||
BKE_key.hh
|
||||
BKE_keyconfig.h
|
||||
|
||||
@@ -256,7 +256,6 @@ static void action_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
* NOTE: early-returns by BKE_LIB_FOREACHID_PROCESS_... macros are forbidden in non-readonly
|
||||
* cases (see #IDWALK_RET_STOP_ITER documentation). */
|
||||
|
||||
const LibraryForeachIDFlag flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
constexpr LibraryForeachIDCallbackFlag idwalk_flags = IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK;
|
||||
|
||||
/* Note that `bmain` can be `nullptr`. An example is in
|
||||
@@ -291,6 +290,7 @@ static void action_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
const LibraryForeachIDFlag flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
const bool is_readonly = flag & IDWALK_READONLY;
|
||||
if (is_readonly) {
|
||||
BLI_assert_msg(!should_invalidate,
|
||||
@@ -306,16 +306,6 @@ static void action_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
LISTBASE_FOREACH (TimeMarker *, marker, &action.markers) {
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, marker->camera, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
/* Legacy IPO curves. */
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
LISTBASE_FOREACH (bActionChannel *, chan, &action.chanbase) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, chan->ipo, IDWALK_CB_USER);
|
||||
LISTBASE_FOREACH (bConstraintChannel *, chan_constraint, &chan->constraintChannels) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, chan_constraint->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void write_channelbag(BlendWriter *writer, animrig::Channelbag &channelbag)
|
||||
@@ -698,10 +688,6 @@ static void action_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
BLI_listbase_clear(&action.curves);
|
||||
BLI_listbase_clear(&action.groups);
|
||||
|
||||
/* Should never be stored as part of the forward-compatible data in a
|
||||
* layered action, and thus should always be empty here. */
|
||||
BLI_assert(BLI_listbase_is_empty(&action.chanbase));
|
||||
|
||||
/* Layered actions should always have `idroot == 0`, but when writing an
|
||||
* action to a blend file `idroot` is typically set otherwise for forward
|
||||
* compatibility reasons (see `action_blend_write()`). So we set it to zero
|
||||
@@ -710,15 +696,9 @@ static void action_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
}
|
||||
else {
|
||||
/* Read legacy data. */
|
||||
BLO_read_struct_list(reader, bActionChannel, &action.chanbase);
|
||||
BLO_read_struct_list(reader, FCurve, &action.curves);
|
||||
BLO_read_struct_list(reader, bActionGroup, &action.groups);
|
||||
|
||||
LISTBASE_FOREACH (bActionChannel *, achan, &action.chanbase) {
|
||||
BLO_read_struct(reader, bActionGroup, &achan->grp);
|
||||
BLO_read_struct_list(reader, bConstraintChannel, &achan->constraintChannels);
|
||||
}
|
||||
|
||||
BKE_fcurve_blend_read_data_listbase(reader, &action.curves);
|
||||
|
||||
LISTBASE_FOREACH (bActionGroup *, agrp, &action.groups) {
|
||||
|
||||
@@ -172,7 +172,7 @@ static void action_flip_pchan(Object *ob_arm, const bPoseChannel *pchan, FCurveP
|
||||
/* Use a fixed buffer size as it's known this can only be at most:
|
||||
* `pose.bones["{MAXBONENAME}"].rotation_quaternion`. */
|
||||
char path_xform[256];
|
||||
char pchan_name_esc[sizeof(bActionChannel::name) * 2];
|
||||
char pchan_name_esc[sizeof(pchan->name) * 2];
|
||||
BLI_str_escape(pchan_name_esc, pchan->name, sizeof(pchan_name_esc));
|
||||
const int path_xform_prefix_len = SNPRINTF_UTF8(
|
||||
path_xform, "pose.bones[\"%s\"]", pchan_name_esc);
|
||||
|
||||
@@ -115,7 +115,6 @@ static void camera_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, camera->ipo, IDWALK_CB_USER);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, camera->dof_ob, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
|
||||
@@ -5539,11 +5539,16 @@ static void con_unlink_refs_cb(bConstraint * /*con*/,
|
||||
}
|
||||
}
|
||||
|
||||
/** Helper function to invoke the id_looper callback, including custom space. */
|
||||
/**
|
||||
* Helper function to invoke the id_looper callback, including custom space.
|
||||
*
|
||||
* \param flag is unused right now, but it's kept as a reminder that new code may need to check
|
||||
* flags as well. See enum LibraryForeachIDFlag in BKE_lib_query.hh.
|
||||
*/
|
||||
static void con_invoke_id_looper(const bConstraintTypeInfo *cti,
|
||||
bConstraint *con,
|
||||
ConstraintIDFunc func,
|
||||
const int flag,
|
||||
const int /*flag*/,
|
||||
void *userdata)
|
||||
{
|
||||
if (cti->id_looper) {
|
||||
@@ -5551,10 +5556,6 @@ static void con_invoke_id_looper(const bConstraintTypeInfo *cti,
|
||||
}
|
||||
|
||||
func(con, (ID **)&con->space_object, false, userdata);
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
func(con, reinterpret_cast<ID **>(&con->ipo), false, userdata);
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_constraint_free_data_ex(bConstraint *con, bool do_id_user)
|
||||
|
||||
@@ -144,7 +144,6 @@ static void curve_free_data(ID *id)
|
||||
static void curve_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Curve *curve = reinterpret_cast<Curve *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, curve->bevobj, IDWALK_CB_NOP);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, curve->taperobj, IDWALK_CB_NOP);
|
||||
@@ -157,10 +156,6 @@ static void curve_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, curve->vfontb, IDWALK_CB_USER);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, curve->vfonti, IDWALK_CB_USER);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, curve->vfontbi, IDWALK_CB_USER);
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, curve->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void curve_blend_write(BlendWriter *writer, ID *id, const void *id_address)
|
||||
|
||||
@@ -67,7 +67,6 @@ static void id_type_init()
|
||||
INIT_TYPE(ID_LT);
|
||||
INIT_TYPE(ID_LA);
|
||||
INIT_TYPE(ID_CA);
|
||||
INIT_TYPE(ID_IP);
|
||||
INIT_TYPE(ID_KE);
|
||||
INIT_TYPE(ID_WO);
|
||||
INIT_TYPE(ID_SCR);
|
||||
@@ -244,7 +243,6 @@ int BKE_idtype_idcode_to_index(const short idcode)
|
||||
CASE_IDINDEX(GR);
|
||||
CASE_IDINDEX(CV);
|
||||
CASE_IDINDEX(IM);
|
||||
CASE_IDINDEX(IP);
|
||||
CASE_IDINDEX(KE);
|
||||
CASE_IDINDEX(LA);
|
||||
CASE_IDINDEX(LI);
|
||||
@@ -303,7 +301,6 @@ int BKE_idtype_idfilter_to_index(const uint64_t id_filter)
|
||||
CASE_IDINDEX(GR);
|
||||
CASE_IDINDEX(CV);
|
||||
CASE_IDINDEX(IM);
|
||||
CASE_IDINDEX(IP);
|
||||
CASE_IDINDEX(KE);
|
||||
CASE_IDINDEX(LA);
|
||||
CASE_IDINDEX(LI);
|
||||
|
||||
@@ -1,2558 +0,0 @@
|
||||
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup bke
|
||||
*/
|
||||
|
||||
/* NOTE:
|
||||
*
|
||||
* This file is no longer used to provide tools for the deprecated IPO system. Instead, it
|
||||
* is only used to house the conversion code to the new system.
|
||||
*
|
||||
* -- Joshua Leung, Jan 2009
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
/* since we have versioning code here */
|
||||
#define DNA_DEPRECATED_ALLOW
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_light_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_nla_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BLI_dynstr.h"
|
||||
#include "BLI_listbase.h"
|
||||
#include "BLI_string.h"
|
||||
#include "BLI_string_utf8.h"
|
||||
#include "BLI_string_utils.hh"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLT_translation.hh"
|
||||
|
||||
#include "BKE_action.hh"
|
||||
#include "BKE_anim_data.hh"
|
||||
#include "BKE_fcurve.hh"
|
||||
#include "BKE_fcurve_driver.h"
|
||||
#include "BKE_global.hh"
|
||||
#include "BKE_idtype.hh"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_key.hh"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_lib_query.hh"
|
||||
#include "BKE_main.hh"
|
||||
#include "BKE_nla.hh"
|
||||
|
||||
#include "ANIM_action.hh"
|
||||
#include "ANIM_versioning.hh"
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "SEQ_iterator.hh"
|
||||
|
||||
#include "BLO_read_write.hh"
|
||||
|
||||
#ifdef WIN32
|
||||
# include "BLI_math_base.h" /* M_PI */
|
||||
#endif
|
||||
|
||||
static CLG_LogRef LOG = {"anim.ipo"};
|
||||
|
||||
using namespace blender;
|
||||
|
||||
static void ipo_free_data(ID *id)
|
||||
{
|
||||
Ipo *ipo = (Ipo *)id;
|
||||
|
||||
IpoCurve *icu, *icn;
|
||||
int n = 0;
|
||||
|
||||
for (icu = static_cast<IpoCurve *>(ipo->curve.first); icu; icu = icn) {
|
||||
icn = icu->next;
|
||||
n++;
|
||||
|
||||
if (icu->bezt) {
|
||||
MEM_freeN(icu->bezt);
|
||||
}
|
||||
if (icu->bp) {
|
||||
MEM_freeN(icu->bp);
|
||||
}
|
||||
if (icu->driver) {
|
||||
MEM_freeN(icu->driver);
|
||||
}
|
||||
|
||||
BLI_freelinkN(&ipo->curve, icu);
|
||||
}
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s'\n", n, ipo->id.name + 2);
|
||||
}
|
||||
}
|
||||
|
||||
static void ipo_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Ipo *ipo = reinterpret_cast<Ipo *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) {
|
||||
if (icu->driver) {
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, icu->driver->ob, IDWALK_CB_NOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ipo_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Ipo *ipo = (Ipo *)id;
|
||||
|
||||
BLO_read_struct_list(reader, IpoCurve, &(ipo->curve));
|
||||
|
||||
/* NOTE: this is endianness-sensitive.
|
||||
* Not clear why, but endianness switching was undone here for some data?
|
||||
* That 'undo switching' code appeared to be heavily broken in 4.x code actually, performing
|
||||
* switch on `ipo` data as part of the loop on `icu`'s, among other obvious mistakes. */
|
||||
|
||||
LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) {
|
||||
BLO_read_struct_array(reader, BezTriple, icu->totvert, &icu->bezt);
|
||||
BLO_read_struct_array(reader, BPoint, icu->totvert, &icu->bp);
|
||||
BLO_read_struct(reader, IpoDriver, &icu->driver);
|
||||
}
|
||||
}
|
||||
|
||||
IDTypeInfo IDType_ID_IP = {
|
||||
/*id_code*/ Ipo::id_type,
|
||||
/*id_filter*/ FILTER_ID_IP,
|
||||
/*dependencies_id_types*/ 0,
|
||||
/*main_listbase_index*/ INDEX_ID_IP,
|
||||
/*struct_size*/ sizeof(Ipo),
|
||||
/*name*/ "Ipo",
|
||||
/*name_plural*/ N_("ipos"),
|
||||
/*translation_context*/ "",
|
||||
/*flags*/ IDTYPE_FLAGS_NO_COPY | IDTYPE_FLAGS_NO_LIBLINKING | IDTYPE_FLAGS_NO_ANIMDATA,
|
||||
/*asset_type_info*/ nullptr,
|
||||
|
||||
/*init_data*/ nullptr,
|
||||
/*copy_data*/ nullptr,
|
||||
/*free_data*/ ipo_free_data,
|
||||
/*make_local*/ nullptr,
|
||||
/*foreach_id*/ ipo_foreach_id,
|
||||
/*foreach_cache*/ nullptr,
|
||||
/*foreach_path*/ nullptr,
|
||||
/*foreach_working_space_color*/ nullptr,
|
||||
/*owner_pointer_get*/ nullptr,
|
||||
|
||||
/*blend_write*/ nullptr,
|
||||
/*blend_read_data*/ ipo_blend_read_data,
|
||||
/*blend_read_after_liblink*/ nullptr,
|
||||
|
||||
/*blend_read_undo_preserve*/ nullptr,
|
||||
|
||||
/*lib_override_apply_post*/ nullptr,
|
||||
};
|
||||
|
||||
/* *************************************************** */
|
||||
/* Old-Data Freeing Tools */
|
||||
|
||||
/* *************************************************** */
|
||||
/* ADRCODE to RNA-Path Conversion Code - Special (Bitflags) */
|
||||
|
||||
/* Mapping Table for bitflag <-> RNA path */
|
||||
struct AdrBit2Path {
|
||||
int bit;
|
||||
const char *path;
|
||||
int array_index;
|
||||
};
|
||||
|
||||
/* ----------------- */
|
||||
/* Mapping Tables to use bits <-> RNA paths */
|
||||
|
||||
/* Object layers */
|
||||
static AdrBit2Path ob_layer_bits[] = {
|
||||
{(1 << 0), "layers", 0}, {(1 << 1), "layers", 1}, {(1 << 2), "layers", 2},
|
||||
{(1 << 3), "layers", 3}, {(1 << 4), "layers", 4}, {(1 << 5), "layers", 5},
|
||||
{(1 << 6), "layers", 6}, {(1 << 7), "layers", 7}, {(1 << 8), "layers", 8},
|
||||
{(1 << 9), "layers", 9}, {(1 << 10), "layers", 10}, {(1 << 11), "layers", 11},
|
||||
{(1 << 12), "layers", 12}, {(1 << 13), "layers", 13}, {(1 << 14), "layers", 14},
|
||||
{(1 << 15), "layers", 15}, {(1 << 16), "layers", 16}, {(1 << 17), "layers", 17},
|
||||
{(1 << 18), "layers", 18}, {(1 << 19), "layers", 19},
|
||||
};
|
||||
|
||||
/* ----------------- */
|
||||
|
||||
/* quick macro for returning the appropriate array for adrcode_bitmaps_to_paths() */
|
||||
#define RET_ABP(items) \
|
||||
{ \
|
||||
*tot = ARRAY_SIZE(items); \
|
||||
return items; \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
/* This function checks if a `blocktype+adrcode` combination, returning a mapping table. */
|
||||
static AdrBit2Path *adrcode_bitmaps_to_paths(int blocktype, int adrcode, int *tot)
|
||||
{
|
||||
/* Object layers */
|
||||
if ((blocktype == ID_OB) && (adrcode == OB_LAY)) {
|
||||
RET_ABP(ob_layer_bits);
|
||||
}
|
||||
/* XXX TODO: add other types... */
|
||||
|
||||
/* Normal curve */
|
||||
return nullptr;
|
||||
}
|
||||
#undef RET_ABP
|
||||
|
||||
/* *************************************************** */
|
||||
/* ADRCODE to RNA-Path Conversion Code - Standard */
|
||||
|
||||
/* Object types */
|
||||
static const char *ob_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case OB_LOC_X:
|
||||
*r_array_index = 0;
|
||||
return "location";
|
||||
case OB_LOC_Y:
|
||||
*r_array_index = 1;
|
||||
return "location";
|
||||
case OB_LOC_Z:
|
||||
*r_array_index = 2;
|
||||
return "location";
|
||||
case OB_DLOC_X:
|
||||
*r_array_index = 0;
|
||||
return "delta_location";
|
||||
case OB_DLOC_Y:
|
||||
*r_array_index = 1;
|
||||
return "delta_location";
|
||||
case OB_DLOC_Z:
|
||||
*r_array_index = 2;
|
||||
return "delta_location";
|
||||
|
||||
case OB_ROT_X:
|
||||
*r_array_index = 0;
|
||||
return "rotation_euler";
|
||||
case OB_ROT_Y:
|
||||
*r_array_index = 1;
|
||||
return "rotation_euler";
|
||||
case OB_ROT_Z:
|
||||
*r_array_index = 2;
|
||||
return "rotation_euler";
|
||||
case OB_DROT_X:
|
||||
*r_array_index = 0;
|
||||
return "delta_rotation_euler";
|
||||
case OB_DROT_Y:
|
||||
*r_array_index = 1;
|
||||
return "delta_rotation_euler";
|
||||
case OB_DROT_Z:
|
||||
*r_array_index = 2;
|
||||
return "delta_rotation_euler";
|
||||
|
||||
case OB_SIZE_X:
|
||||
*r_array_index = 0;
|
||||
return "scale";
|
||||
case OB_SIZE_Y:
|
||||
*r_array_index = 1;
|
||||
return "scale";
|
||||
case OB_SIZE_Z:
|
||||
*r_array_index = 2;
|
||||
return "scale";
|
||||
case OB_DSIZE_X:
|
||||
*r_array_index = 0;
|
||||
return "delta_scale";
|
||||
case OB_DSIZE_Y:
|
||||
*r_array_index = 1;
|
||||
return "delta_scale";
|
||||
case OB_DSIZE_Z:
|
||||
*r_array_index = 2;
|
||||
return "delta_scale";
|
||||
case OB_COL_R:
|
||||
*r_array_index = 0;
|
||||
return "color";
|
||||
case OB_COL_G:
|
||||
*r_array_index = 1;
|
||||
return "color";
|
||||
case OB_COL_B:
|
||||
*r_array_index = 2;
|
||||
return "color";
|
||||
case OB_COL_A:
|
||||
*r_array_index = 3;
|
||||
return "color";
|
||||
#if 0
|
||||
case OB_PD_FSTR:
|
||||
if (ob->pd) {
|
||||
poin = &(ob->pd->f_strength);
|
||||
}
|
||||
break;
|
||||
case OB_PD_FFALL:
|
||||
if (ob->pd) {
|
||||
poin = &(ob->pd->f_power);
|
||||
}
|
||||
break;
|
||||
case OB_PD_SDAMP:
|
||||
if (ob->pd) {
|
||||
poin = &(ob->pd->pdef_damp);
|
||||
}
|
||||
break;
|
||||
case OB_PD_RDAMP:
|
||||
if (ob->pd) {
|
||||
poin = &(ob->pd->pdef_rdamp);
|
||||
}
|
||||
break;
|
||||
case OB_PD_PERM:
|
||||
if (ob->pd) {
|
||||
poin = &(ob->pd->pdef_perm);
|
||||
}
|
||||
break;
|
||||
case OB_PD_FMAXD:
|
||||
if (ob->pd) {
|
||||
poin = &(ob->pd->maxdist);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* PoseChannel types
|
||||
* NOTE: pchan name comes from 'actname' added earlier...
|
||||
*/
|
||||
static const char *pchan_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case AC_QUAT_W:
|
||||
*r_array_index = 0;
|
||||
return "rotation_quaternion";
|
||||
case AC_QUAT_X:
|
||||
*r_array_index = 1;
|
||||
return "rotation_quaternion";
|
||||
case AC_QUAT_Y:
|
||||
*r_array_index = 2;
|
||||
return "rotation_quaternion";
|
||||
case AC_QUAT_Z:
|
||||
*r_array_index = 3;
|
||||
return "rotation_quaternion";
|
||||
|
||||
case AC_EUL_X:
|
||||
*r_array_index = 0;
|
||||
return "rotation_euler";
|
||||
case AC_EUL_Y:
|
||||
*r_array_index = 1;
|
||||
return "rotation_euler";
|
||||
case AC_EUL_Z:
|
||||
*r_array_index = 2;
|
||||
return "rotation_euler";
|
||||
|
||||
case AC_LOC_X:
|
||||
*r_array_index = 0;
|
||||
return "location";
|
||||
case AC_LOC_Y:
|
||||
*r_array_index = 1;
|
||||
return "location";
|
||||
case AC_LOC_Z:
|
||||
*r_array_index = 2;
|
||||
return "location";
|
||||
|
||||
case AC_SIZE_X:
|
||||
*r_array_index = 0;
|
||||
return "scale";
|
||||
case AC_SIZE_Y:
|
||||
*r_array_index = 1;
|
||||
return "scale";
|
||||
case AC_SIZE_Z:
|
||||
*r_array_index = 2;
|
||||
return "scale";
|
||||
}
|
||||
|
||||
/* for debugging only */
|
||||
CLOG_ERROR(&LOG, "unmatched PoseChannel setting (code %d)", adrcode);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Constraint types */
|
||||
static const char *constraint_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case CO_ENFORCE:
|
||||
return "influence";
|
||||
case CO_HEADTAIL:
|
||||
/* XXX this needs to be wrapped in RNA.. probably then this path will be invalid. */
|
||||
return "data.head_tail";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* ShapeKey types
|
||||
* NOTE: as we don't have access to the keyblock where the data comes from (for now),
|
||||
* we'll just use numerical indices for now...
|
||||
*/
|
||||
static char *shapekey_adrcodes_to_paths(ID *id, int adrcode, int * /*r_array_index*/)
|
||||
{
|
||||
static char buf[128];
|
||||
|
||||
/* block will be attached to ID_KE block... */
|
||||
if (adrcode == 0) {
|
||||
/* adrcode=0 was the misnamed "speed" curve (now "evaluation time") */
|
||||
STRNCPY_UTF8(buf, "eval_time");
|
||||
}
|
||||
else {
|
||||
/* Find the name of the ShapeKey (i.e. KeyBlock) to look for */
|
||||
Key *key = (Key *)id;
|
||||
KeyBlock *kb = BKE_keyblock_find_by_index(key, adrcode);
|
||||
|
||||
/* setting that we alter is the "value" (i.e. keyblock.curval) */
|
||||
if (kb) {
|
||||
/* Use the keyblock name, escaped, so that path lookups for this will work */
|
||||
char kb_name_esc[sizeof(kb->name) * 2];
|
||||
BLI_str_escape(kb_name_esc, kb->name, sizeof(kb_name_esc));
|
||||
SNPRINTF_UTF8(buf, "key_blocks[\"%s\"].value", kb_name_esc);
|
||||
}
|
||||
else {
|
||||
/* Fallback - Use the adrcode as index directly, so that this can be manually fixed */
|
||||
SNPRINTF_UTF8(buf, "key_blocks[%d].value", adrcode);
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* MTex (Texture Slot) types */
|
||||
static const char *mtex_adrcodes_to_paths(int adrcode, int * /*r_array_index*/)
|
||||
{
|
||||
const char *base = nullptr, *prop = nullptr;
|
||||
static char buf[128];
|
||||
|
||||
/* base part of path */
|
||||
if (adrcode & MA_MAP1) {
|
||||
base = "textures[0]";
|
||||
}
|
||||
else if (adrcode & MA_MAP2) {
|
||||
base = "textures[1]";
|
||||
}
|
||||
else if (adrcode & MA_MAP3) {
|
||||
base = "textures[2]";
|
||||
}
|
||||
else if (adrcode & MA_MAP4) {
|
||||
base = "textures[3]";
|
||||
}
|
||||
else if (adrcode & MA_MAP5) {
|
||||
base = "textures[4]";
|
||||
}
|
||||
else if (adrcode & MA_MAP6) {
|
||||
base = "textures[5]";
|
||||
}
|
||||
else if (adrcode & MA_MAP7) {
|
||||
base = "textures[6]";
|
||||
}
|
||||
else if (adrcode & MA_MAP8) {
|
||||
base = "textures[7]";
|
||||
}
|
||||
else if (adrcode & MA_MAP9) {
|
||||
base = "textures[8]";
|
||||
}
|
||||
else if (adrcode & MA_MAP10) {
|
||||
base = "textures[9]";
|
||||
}
|
||||
else if (adrcode & MA_MAP11) {
|
||||
base = "textures[10]";
|
||||
}
|
||||
else if (adrcode & MA_MAP12) {
|
||||
base = "textures[11]";
|
||||
}
|
||||
else if (adrcode & MA_MAP13) {
|
||||
base = "textures[12]";
|
||||
}
|
||||
else if (adrcode & MA_MAP14) {
|
||||
base = "textures[13]";
|
||||
}
|
||||
else if (adrcode & MA_MAP15) {
|
||||
base = "textures[14]";
|
||||
}
|
||||
else if (adrcode & MA_MAP16) {
|
||||
base = "textures[15]";
|
||||
}
|
||||
else if (adrcode & MA_MAP17) {
|
||||
base = "textures[16]";
|
||||
}
|
||||
else if (adrcode & MA_MAP18) {
|
||||
base = "textures[17]";
|
||||
}
|
||||
|
||||
/* property identifier for path */
|
||||
adrcode = (adrcode & (MA_MAP1 - 1));
|
||||
switch (adrcode) {
|
||||
#if 0 /* XXX these are not wrapped in RNA yet! */
|
||||
case MAP_OFS_X:
|
||||
poin = &(mtex->ofs[0]);
|
||||
break;
|
||||
case MAP_OFS_Y:
|
||||
poin = &(mtex->ofs[1]);
|
||||
break;
|
||||
case MAP_OFS_Z:
|
||||
poin = &(mtex->ofs[2]);
|
||||
break;
|
||||
case MAP_SIZE_X:
|
||||
poin = &(mtex->size[0]);
|
||||
break;
|
||||
case MAP_SIZE_Y:
|
||||
poin = &(mtex->size[1]);
|
||||
break;
|
||||
case MAP_SIZE_Z:
|
||||
poin = &(mtex->size[2]);
|
||||
break;
|
||||
case MAP_R:
|
||||
poin = &(mtex->r);
|
||||
break;
|
||||
case MAP_G:
|
||||
poin = &(mtex->g);
|
||||
break;
|
||||
case MAP_B:
|
||||
poin = &(mtex->b);
|
||||
break;
|
||||
case MAP_DVAR:
|
||||
poin = &(mtex->def_var);
|
||||
break;
|
||||
case MAP_COLF:
|
||||
poin = &(mtex->colfac);
|
||||
break;
|
||||
case MAP_NORF:
|
||||
poin = &(mtex->norfac);
|
||||
break;
|
||||
case MAP_VARF:
|
||||
poin = &(mtex->varfac);
|
||||
break;
|
||||
#endif
|
||||
case MAP_DISP:
|
||||
prop = "warp_factor";
|
||||
break;
|
||||
}
|
||||
|
||||
/* only build and return path if there's a property */
|
||||
if (prop) {
|
||||
SNPRINTF_UTF8(buf, "%s.%s", base, prop);
|
||||
return buf;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Texture types */
|
||||
static const char *texture_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case TE_NSIZE:
|
||||
return "noise_size";
|
||||
case TE_TURB:
|
||||
return "turbulence";
|
||||
|
||||
case TE_NDEPTH: /* XXX texture RNA undefined */
|
||||
// poin= &(tex->noisedepth); *type= IPO_SHORT; break;
|
||||
break;
|
||||
case TE_NTYPE: /* XXX texture RNA undefined */
|
||||
// poin= &(tex->noisetype); *type= IPO_SHORT; break;
|
||||
break;
|
||||
|
||||
case TE_N_BAS1:
|
||||
return "noise_basis";
|
||||
case TE_N_BAS2:
|
||||
return "noise_basis"; /* XXX this is not yet defined in RNA... */
|
||||
|
||||
/* voronoi */
|
||||
case TE_VNW1:
|
||||
*r_array_index = 0;
|
||||
return "feature_weights";
|
||||
case TE_VNW2:
|
||||
*r_array_index = 1;
|
||||
return "feature_weights";
|
||||
case TE_VNW3:
|
||||
*r_array_index = 2;
|
||||
return "feature_weights";
|
||||
case TE_VNW4:
|
||||
*r_array_index = 3;
|
||||
return "feature_weights";
|
||||
case TE_VNMEXP:
|
||||
return "minkovsky_exponent";
|
||||
case TE_VN_DISTM:
|
||||
return "distance_metric";
|
||||
case TE_VN_COLT:
|
||||
return "color_type";
|
||||
|
||||
/* distorted noise / voronoi */
|
||||
case TE_ISCA:
|
||||
return "noise_intensity";
|
||||
|
||||
/* distorted noise */
|
||||
case TE_DISTA:
|
||||
return "distortion_amount";
|
||||
|
||||
/* musgrave */
|
||||
case TE_MG_TYP: /* XXX texture RNA undefined */
|
||||
// poin= &(tex->stype); *type= IPO_SHORT; break;
|
||||
break;
|
||||
case TE_MGH:
|
||||
return "highest_dimension";
|
||||
case TE_MG_LAC:
|
||||
return "lacunarity";
|
||||
case TE_MG_OCT:
|
||||
return "octaves";
|
||||
case TE_MG_OFF:
|
||||
return "offset";
|
||||
case TE_MG_GAIN:
|
||||
return "gain";
|
||||
|
||||
case TE_COL_R:
|
||||
*r_array_index = 0;
|
||||
return "rgb_factor";
|
||||
case TE_COL_G:
|
||||
*r_array_index = 1;
|
||||
return "rgb_factor";
|
||||
case TE_COL_B:
|
||||
*r_array_index = 2;
|
||||
return "rgb_factor";
|
||||
|
||||
case TE_BRIGHT:
|
||||
return "brightness";
|
||||
case TE_CONTRA:
|
||||
return "contrast";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Material Types */
|
||||
static const char *material_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case MA_COL_R:
|
||||
*r_array_index = 0;
|
||||
return "diffuse_color";
|
||||
case MA_COL_G:
|
||||
*r_array_index = 1;
|
||||
return "diffuse_color";
|
||||
case MA_COL_B:
|
||||
*r_array_index = 2;
|
||||
return "diffuse_color";
|
||||
|
||||
case MA_SPEC_R:
|
||||
*r_array_index = 0;
|
||||
return "specular_color";
|
||||
case MA_SPEC_G:
|
||||
*r_array_index = 1;
|
||||
return "specular_color";
|
||||
case MA_SPEC_B:
|
||||
*r_array_index = 2;
|
||||
return "specular_color";
|
||||
|
||||
case MA_MIR_R:
|
||||
*r_array_index = 0;
|
||||
return "mirror_color";
|
||||
case MA_MIR_G:
|
||||
*r_array_index = 1;
|
||||
return "mirror_color";
|
||||
case MA_MIR_B:
|
||||
*r_array_index = 2;
|
||||
return "mirror_color";
|
||||
|
||||
case MA_ALPHA:
|
||||
return "alpha";
|
||||
|
||||
case MA_REF:
|
||||
return "diffuse_intensity";
|
||||
|
||||
case MA_EMIT:
|
||||
return "emit";
|
||||
|
||||
case MA_AMB:
|
||||
return "ambient";
|
||||
|
||||
case MA_SPEC:
|
||||
return "specular_intensity";
|
||||
|
||||
case MA_HARD:
|
||||
return "specular_hardness";
|
||||
|
||||
case MA_SPTR:
|
||||
return "specular_opacity";
|
||||
|
||||
case MA_IOR:
|
||||
return "ior";
|
||||
|
||||
case MA_HASIZE:
|
||||
return "halo.size";
|
||||
|
||||
case MA_TRANSLU:
|
||||
return "translucency";
|
||||
|
||||
case MA_RAYM:
|
||||
return "raytrace_mirror.reflect";
|
||||
|
||||
case MA_FRESMIR:
|
||||
return "raytrace_mirror.fresnel";
|
||||
|
||||
case MA_FRESMIRI:
|
||||
return "raytrace_mirror.fresnel_factor";
|
||||
|
||||
case MA_FRESTRA:
|
||||
return "raytrace_transparency.fresnel";
|
||||
|
||||
case MA_FRESTRAI:
|
||||
return "raytrace_transparency.fresnel_factor";
|
||||
|
||||
case MA_ADD:
|
||||
return "halo.add";
|
||||
|
||||
default: /* for now, we assume that the others were MTex channels */
|
||||
return mtex_adrcodes_to_paths(adrcode, r_array_index);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Camera Types */
|
||||
static const char *camera_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case CAM_LENS:
|
||||
#if 0 /* XXX this cannot be resolved easily... \
|
||||
* perhaps we assume camera is perspective (works for most cases... */
|
||||
if (ca->type == CAM_ORTHO) {
|
||||
return "ortho_scale";
|
||||
}
|
||||
else {
|
||||
return "lens";
|
||||
}
|
||||
#else /* XXX lazy hack for now... */
|
||||
return "lens";
|
||||
#endif /* XXX this cannot be resolved easily */
|
||||
|
||||
case CAM_STA:
|
||||
return "clip_start";
|
||||
case CAM_END:
|
||||
return "clip_end";
|
||||
|
||||
#if 0 /* XXX these are not defined in RNA */
|
||||
case CAM_YF_APERT:
|
||||
poin = &(ca->YF_aperture);
|
||||
break;
|
||||
case CAM_YF_FDIST:
|
||||
poin = &(ca->dof_distance);
|
||||
break;
|
||||
#endif /* XXX these are not defined in RNA */
|
||||
|
||||
case CAM_SHIFT_X:
|
||||
return "shift_x";
|
||||
case CAM_SHIFT_Y:
|
||||
return "shift_y";
|
||||
}
|
||||
|
||||
/* unrecognized adrcode, or not-yet-handled ones! */
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Light Types */
|
||||
static const char *light_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case LA_ENERGY:
|
||||
return "energy";
|
||||
|
||||
case LA_COL_R:
|
||||
*r_array_index = 0;
|
||||
return "color";
|
||||
case LA_COL_G:
|
||||
*r_array_index = 1;
|
||||
return "color";
|
||||
case LA_COL_B:
|
||||
*r_array_index = 2;
|
||||
return "color";
|
||||
|
||||
case LA_DIST:
|
||||
return "distance";
|
||||
|
||||
case LA_SPOTSI:
|
||||
return "spot_size";
|
||||
case LA_SPOTBL:
|
||||
return "spot_blend";
|
||||
|
||||
case LA_QUAD1:
|
||||
return "linear_attenuation";
|
||||
case LA_QUAD2:
|
||||
return "quadratic_attenuation";
|
||||
|
||||
case LA_HALOINT:
|
||||
return "halo_intensity";
|
||||
|
||||
default: /* for now, we assume that the others were MTex channels */
|
||||
return mtex_adrcodes_to_paths(adrcode, r_array_index);
|
||||
}
|
||||
|
||||
/* unrecognized adrcode, or not-yet-handled ones! */
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Sound Types */
|
||||
static const char *sound_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case SND_VOLUME:
|
||||
return "volume";
|
||||
case SND_PITCH:
|
||||
return "pitch";
|
||||
/* XXX Joshua -- I had wrapped panning in rna,
|
||||
* but someone commented out, calling it "unused" */
|
||||
#if 0
|
||||
case SND_PANNING:
|
||||
return "panning";
|
||||
#endif
|
||||
case SND_ATTEN:
|
||||
return "attenuation";
|
||||
}
|
||||
|
||||
/* unrecognized adrcode, or not-yet-handled ones! */
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* World Types */
|
||||
static const char *world_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case WO_HOR_R:
|
||||
*r_array_index = 0;
|
||||
return "horizon_color";
|
||||
case WO_HOR_G:
|
||||
*r_array_index = 1;
|
||||
return "horizon_color";
|
||||
case WO_HOR_B:
|
||||
*r_array_index = 2;
|
||||
return "horizon_color";
|
||||
case WO_ZEN_R:
|
||||
*r_array_index = 0;
|
||||
return "zenith_color";
|
||||
case WO_ZEN_G:
|
||||
*r_array_index = 1;
|
||||
return "zenith_color";
|
||||
case WO_ZEN_B:
|
||||
*r_array_index = 2;
|
||||
return "zenith_color";
|
||||
|
||||
case WO_EXPOS:
|
||||
return "exposure";
|
||||
|
||||
case WO_MISI:
|
||||
return "mist.intensity";
|
||||
case WO_MISTDI:
|
||||
return "mist.depth";
|
||||
case WO_MISTSTA:
|
||||
return "mist.start";
|
||||
case WO_MISTHI:
|
||||
return "mist.height";
|
||||
|
||||
default: /* for now, we assume that the others were MTex channels */
|
||||
return mtex_adrcodes_to_paths(adrcode, r_array_index);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Particle Types */
|
||||
static const char *particle_adrcodes_to_paths(int adrcode, int *r_array_index)
|
||||
{
|
||||
/* Set array index like this in-case nothing sets it correctly. */
|
||||
*r_array_index = 0;
|
||||
|
||||
/* result depends on adrcode */
|
||||
switch (adrcode) {
|
||||
case PART_CLUMP:
|
||||
return "settings.clump_factor";
|
||||
case PART_AVE:
|
||||
return "settings.angular_velocity_factor";
|
||||
case PART_SIZE:
|
||||
return "settings.particle_size";
|
||||
case PART_DRAG:
|
||||
return "settings.drag_factor";
|
||||
case PART_BROWN:
|
||||
return "settings.brownian_factor";
|
||||
case PART_DAMP:
|
||||
return "settings.damp_factor";
|
||||
case PART_LENGTH:
|
||||
return "settings.length";
|
||||
case PART_GRAV_X:
|
||||
*r_array_index = 0;
|
||||
return "settings.acceleration";
|
||||
case PART_GRAV_Y:
|
||||
*r_array_index = 1;
|
||||
return "settings.acceleration";
|
||||
case PART_GRAV_Z:
|
||||
*r_array_index = 2;
|
||||
return "settings.acceleration";
|
||||
case PART_KINK_AMP:
|
||||
return "settings.kink_amplitude";
|
||||
case PART_KINK_FREQ:
|
||||
return "settings.kink_frequency";
|
||||
case PART_KINK_SHAPE:
|
||||
return "settings.kink_shape";
|
||||
case PART_BB_TILT:
|
||||
return "settings.billboard_tilt";
|
||||
|
||||
/* PartDeflect needs to be sorted out properly in rna_object_force;
|
||||
* If anyone else works on this, but is unfamiliar, these particular
|
||||
* settings reference the particles of the system themselves
|
||||
* being used as forces -- it will use the same rna structure
|
||||
* as the similar object forces */
|
||||
#if 0
|
||||
case PART_PD_FSTR:
|
||||
if (part->pd) {
|
||||
poin = &(part->pd->f_strength);
|
||||
}
|
||||
break;
|
||||
case PART_PD_FFALL:
|
||||
if (part->pd) {
|
||||
poin = &(part->pd->f_power);
|
||||
}
|
||||
break;
|
||||
case PART_PD_FMAXD:
|
||||
if (part->pd) {
|
||||
poin = &(part->pd->maxdist);
|
||||
}
|
||||
break;
|
||||
case PART_PD2_FSTR:
|
||||
if (part->pd2) {
|
||||
poin = &(part->pd2->f_strength);
|
||||
}
|
||||
break;
|
||||
case PART_PD2_FFALL:
|
||||
if (part->pd2) {
|
||||
poin = &(part->pd2->f_power);
|
||||
}
|
||||
break;
|
||||
case PART_PD2_FMAXD:
|
||||
if (part->pd2) {
|
||||
poin = &(part->pd2->maxdist);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* ------- */
|
||||
|
||||
/* Allocate memory for RNA-path for some property given a blocktype, adrcode,
|
||||
* and 'root' parts of path.
|
||||
*
|
||||
* Input:
|
||||
* - id - the data-block that the curve's IPO block
|
||||
* is attached to and/or which the new paths will start from
|
||||
* - blocktype, adrcode - determines setting to get
|
||||
* - actname, constname, seq - used to build path
|
||||
* Output:
|
||||
* - r_array_index - index in property's array (if applicable) to use
|
||||
* - return - the allocated path...
|
||||
*/
|
||||
static char *get_rna_access(ID *id,
|
||||
int blocktype,
|
||||
int adrcode,
|
||||
const char actname[],
|
||||
const char constname[],
|
||||
Strip *strip,
|
||||
int *r_array_index)
|
||||
{
|
||||
DynStr *path = BLI_dynstr_new();
|
||||
const char *propname = nullptr;
|
||||
char *rpath = nullptr;
|
||||
char buf[512];
|
||||
int dummy_index = 0;
|
||||
|
||||
/* hack: if constname is set, we can only be dealing with an Constraint curve */
|
||||
if (constname) {
|
||||
blocktype = ID_CO;
|
||||
}
|
||||
|
||||
/* get property name based on blocktype */
|
||||
switch (blocktype) {
|
||||
case ID_OB: /* object */
|
||||
propname = ob_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_PO: /* pose channel */
|
||||
propname = pchan_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_KE: /* shapekeys */
|
||||
propname = shapekey_adrcodes_to_paths(id, adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_CO: /* constraint */
|
||||
propname = constraint_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_TE: /* texture */
|
||||
propname = texture_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_MA: /* material */
|
||||
propname = material_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_CA: /* camera */
|
||||
propname = camera_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_LA: /* light */
|
||||
propname = light_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_SO: /* sound */
|
||||
propname = sound_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_WO: /* world */
|
||||
propname = world_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_PA: /* particle */
|
||||
propname = particle_adrcodes_to_paths(adrcode, &dummy_index);
|
||||
break;
|
||||
|
||||
case ID_CU_LEGACY: /* curve */
|
||||
/* this used to be a 'dummy' curve which got evaluated on the fly...
|
||||
* now we've got real var for this!
|
||||
*/
|
||||
propname = "eval_time";
|
||||
break;
|
||||
|
||||
/* XXX problematic block-types. */
|
||||
case ID_SEQ: /* sequencer strip */
|
||||
/* STRIP_FAC1: */
|
||||
switch (adrcode) {
|
||||
case STRIP_FAC1:
|
||||
propname = "effect_fader";
|
||||
break;
|
||||
case STRIP_FAC_SPEED:
|
||||
propname = "speed_fader";
|
||||
break;
|
||||
case STRIP_FAC_OPACITY:
|
||||
propname = "blend_alpha";
|
||||
break;
|
||||
}
|
||||
/* XXX this doesn't seem to be included anywhere in sequencer RNA... */
|
||||
// poin= &(seq->facf0);
|
||||
break;
|
||||
|
||||
/* special hacks */
|
||||
case -1:
|
||||
/* special case for rotdiff drivers... we don't need a property for this... */
|
||||
break;
|
||||
|
||||
/* TODO: add other block-types. */
|
||||
default:
|
||||
CLOG_WARN(&LOG, "No path for blocktype %d, adrcode %d yet", blocktype, adrcode);
|
||||
break;
|
||||
}
|
||||
|
||||
/* check if any property found
|
||||
* - blocktype < 0 is special case for a specific type of driver,
|
||||
* where we don't need a property name...
|
||||
*/
|
||||
if ((propname == nullptr) && (blocktype > 0)) {
|
||||
/* nothing was found, so exit */
|
||||
if (r_array_index) {
|
||||
*r_array_index = 0;
|
||||
}
|
||||
|
||||
BLI_dynstr_free(path);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (r_array_index) {
|
||||
*r_array_index = dummy_index;
|
||||
}
|
||||
|
||||
/* 'buf' _must_ be initialized in this block */
|
||||
/* append preceding bits to path */
|
||||
/* NOTE: strings are not escaped and they should be! */
|
||||
if ((actname && actname[0]) && (constname && constname[0])) {
|
||||
/* Constraint in Pose-Channel */
|
||||
char actname_esc[sizeof(bActionChannel::name) * 2];
|
||||
char constname_esc[sizeof(bConstraint::name) * 2];
|
||||
BLI_str_escape(actname_esc, actname, sizeof(actname_esc));
|
||||
BLI_str_escape(constname_esc, constname, sizeof(constname_esc));
|
||||
SNPRINTF_UTF8(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname_esc, constname_esc);
|
||||
}
|
||||
else if (actname && actname[0]) {
|
||||
if ((blocktype == ID_OB) && STREQ(actname, "Object")) {
|
||||
/* Actionified "Object" IPO's... no extra path stuff needed */
|
||||
buf[0] = '\0'; /* empty string */
|
||||
}
|
||||
else if ((blocktype == ID_KE) && STREQ(actname, "Shape")) {
|
||||
/* Actionified "Shape" IPO's -
|
||||
* these are forced onto object level via the action container there... */
|
||||
STRNCPY_UTF8(buf, "data.shape_keys");
|
||||
}
|
||||
else {
|
||||
/* Pose-Channel */
|
||||
char actname_esc[sizeof(bActionChannel::name) * 2];
|
||||
BLI_str_escape(actname_esc, actname, sizeof(actname_esc));
|
||||
SNPRINTF_UTF8(buf, "pose.bones[\"%s\"]", actname_esc);
|
||||
}
|
||||
}
|
||||
else if (constname && constname[0]) {
|
||||
/* Constraint in Object */
|
||||
char constname_esc[sizeof(bConstraint::name) * 2];
|
||||
BLI_str_escape(constname_esc, constname, sizeof(constname_esc));
|
||||
SNPRINTF_UTF8(buf, "constraints[\"%s\"]", constname_esc);
|
||||
}
|
||||
else if (strip) {
|
||||
/* Strip names in Scene */
|
||||
char strip_name_esc[(sizeof(strip->name) - 2) * 2];
|
||||
BLI_str_escape(strip_name_esc, strip->name + 2, sizeof(strip_name_esc));
|
||||
SNPRINTF_UTF8(buf, "sequence_editor.sequences_all[\"%s\"]", strip_name_esc);
|
||||
}
|
||||
else {
|
||||
buf[0] = '\0'; /* empty string */
|
||||
}
|
||||
|
||||
BLI_dynstr_append(path, buf);
|
||||
|
||||
/* need to add dot before property if there was anything preceding this */
|
||||
if (buf[0]) {
|
||||
BLI_dynstr_append(path, ".");
|
||||
}
|
||||
|
||||
/* now write name of property */
|
||||
BLI_dynstr_append(path, propname);
|
||||
|
||||
/* if there was no array index pointer provided, add it to the path */
|
||||
if (r_array_index == nullptr) {
|
||||
SNPRINTF_UTF8(buf, "[\"%d\"]", dummy_index);
|
||||
BLI_dynstr_append(path, buf);
|
||||
}
|
||||
|
||||
/* convert to normal MEM_malloc'd string */
|
||||
rpath = BLI_dynstr_get_cstring(path);
|
||||
BLI_dynstr_free(path);
|
||||
|
||||
/* return path... */
|
||||
return rpath;
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
/* Conversion Utilities */
|
||||
|
||||
/* Convert adrcodes to driver target transform channel types */
|
||||
static short adrcode_to_dtar_transchan(short adrcode)
|
||||
{
|
||||
switch (adrcode) {
|
||||
case OB_LOC_X:
|
||||
return DTAR_TRANSCHAN_LOCX;
|
||||
case OB_LOC_Y:
|
||||
return DTAR_TRANSCHAN_LOCY;
|
||||
case OB_LOC_Z:
|
||||
return DTAR_TRANSCHAN_LOCZ;
|
||||
|
||||
case OB_ROT_X:
|
||||
return DTAR_TRANSCHAN_ROTX;
|
||||
case OB_ROT_Y:
|
||||
return DTAR_TRANSCHAN_ROTY;
|
||||
case OB_ROT_Z:
|
||||
return DTAR_TRANSCHAN_ROTZ;
|
||||
|
||||
case OB_SIZE_X:
|
||||
return DTAR_TRANSCHAN_SCALEX;
|
||||
case OB_SIZE_Y:
|
||||
return DTAR_TRANSCHAN_SCALEX;
|
||||
case OB_SIZE_Z:
|
||||
return DTAR_TRANSCHAN_SCALEX;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert IpoDriver to ChannelDriver - will free the old data (i.e. the old driver) */
|
||||
static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver)
|
||||
{
|
||||
ChannelDriver *cdriver;
|
||||
|
||||
/* allocate memory for new driver */
|
||||
cdriver = MEM_callocN<ChannelDriver>("ChannelDriver");
|
||||
|
||||
/* If `pydriver`, just copy data across. */
|
||||
if (idriver->type == IPO_DRIVER_TYPE_PYTHON) {
|
||||
/* PyDriver only requires the expression to be copied */
|
||||
/* FIXME: expression will be useless due to API changes, but at least not totally lost */
|
||||
cdriver->type = DRIVER_TYPE_PYTHON;
|
||||
if (idriver->name[0]) {
|
||||
STRNCPY_UTF8(cdriver->expression, idriver->name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
DriverVar *dvar = nullptr;
|
||||
DriverTarget *dtar = nullptr;
|
||||
|
||||
/* this should be ok for all types here... */
|
||||
cdriver->type = DRIVER_TYPE_AVERAGE;
|
||||
|
||||
/* What to store depends on the `blocktype` - object or pose-channel. */
|
||||
if (idriver->blocktype == ID_AR) { /* PoseChannel */
|
||||
if (idriver->adrcode == OB_ROT_DIFF) {
|
||||
/* Rotational Difference requires a special type of variable */
|
||||
dvar = driver_add_new_variable(cdriver);
|
||||
driver_change_variable_type(dvar, DVAR_TYPE_ROT_DIFF);
|
||||
|
||||
/* first bone target */
|
||||
dtar = &dvar->targets[0];
|
||||
dtar->id = (ID *)idriver->ob;
|
||||
dtar->idtype = ID_OB;
|
||||
if (idriver->name[0]) {
|
||||
STRNCPY_UTF8(dtar->pchan_name, idriver->name);
|
||||
}
|
||||
|
||||
/* second bone target (name was stored in same var as the first one) */
|
||||
dtar = &dvar->targets[1];
|
||||
dtar->id = (ID *)idriver->ob;
|
||||
dtar->idtype = ID_OB;
|
||||
if (idriver->name[0]) { /* XXX: for safety. */
|
||||
STRNCPY_UTF8(dtar->pchan_name, idriver->name + DRIVER_NAME_OFFS);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* only a single variable, of type 'transform channel' */
|
||||
dvar = driver_add_new_variable(cdriver);
|
||||
driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
|
||||
|
||||
/* only requires a single target */
|
||||
dtar = &dvar->targets[0];
|
||||
dtar->id = (ID *)idriver->ob;
|
||||
dtar->idtype = ID_OB;
|
||||
if (idriver->name[0]) {
|
||||
STRNCPY_UTF8(dtar->pchan_name, idriver->name);
|
||||
}
|
||||
dtar->transChan = adrcode_to_dtar_transchan(idriver->adrcode);
|
||||
dtar->flag |= DTAR_FLAG_LOCALSPACE; /* old drivers took local space */
|
||||
}
|
||||
}
|
||||
else { /* Object */
|
||||
/* only a single variable, of type 'transform channel' */
|
||||
dvar = driver_add_new_variable(cdriver);
|
||||
driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
|
||||
|
||||
/* only requires single target */
|
||||
dtar = &dvar->targets[0];
|
||||
dtar->id = (ID *)idriver->ob;
|
||||
dtar->idtype = ID_OB;
|
||||
dtar->transChan = adrcode_to_dtar_transchan(idriver->adrcode);
|
||||
}
|
||||
}
|
||||
|
||||
/* return the new one */
|
||||
return cdriver;
|
||||
}
|
||||
|
||||
/* Add F-Curve to the correct list
|
||||
* - grpname is needed to be used as group name where relevant, and is usually derived from actname
|
||||
*/
|
||||
static void fcurve_add_to_list(
|
||||
ListBase *groups, ListBase *list, FCurve *fcu, char *grpname, int muteipo)
|
||||
{
|
||||
/* If we're adding to an action, we will have groups to write to... */
|
||||
if (groups && grpname) {
|
||||
/* wrap the pointers given into a dummy action that we pass to the API func
|
||||
* and extract the resultant lists...
|
||||
*/
|
||||
bAction tmp_act = {};
|
||||
bActionGroup *agrp = nullptr;
|
||||
|
||||
/* init the temp action */
|
||||
tmp_act.groups.first = groups->first;
|
||||
tmp_act.groups.last = groups->last;
|
||||
tmp_act.curves.first = list->first;
|
||||
tmp_act.curves.last = list->last;
|
||||
/* XXX: The other vars don't need to be filled in. */
|
||||
|
||||
/* get the group to use */
|
||||
agrp = BKE_action_group_find_name(&tmp_act, grpname);
|
||||
/* no matching group, so add one */
|
||||
if (agrp == nullptr) {
|
||||
/* Add a new group, and make it active */
|
||||
agrp = MEM_callocN<bActionGroup>("bActionGroup");
|
||||
|
||||
agrp->flag = AGRP_SELECTED;
|
||||
if (muteipo) {
|
||||
agrp->flag |= AGRP_MUTED;
|
||||
}
|
||||
|
||||
STRNCPY_UTF8(agrp->name, grpname);
|
||||
|
||||
BLI_addtail(&tmp_act.groups, agrp);
|
||||
BLI_uniquename(&tmp_act.groups,
|
||||
agrp,
|
||||
DATA_("Group"),
|
||||
'.',
|
||||
offsetof(bActionGroup, name),
|
||||
sizeof(agrp->name));
|
||||
}
|
||||
|
||||
/* add F-Curve to group */
|
||||
/* WARNING: this func should only need to look at the stuff we initialized,
|
||||
* if not, things may crash. */
|
||||
action_groups_add_channel(&tmp_act, agrp, fcu);
|
||||
|
||||
if (agrp->flag & AGRP_MUTED) { /* flush down */
|
||||
fcu->flag |= FCURVE_MUTED;
|
||||
}
|
||||
|
||||
/* set the output lists based on the ones in the temp action */
|
||||
groups->first = tmp_act.groups.first;
|
||||
groups->last = tmp_act.groups.last;
|
||||
list->first = tmp_act.curves.first;
|
||||
list->last = tmp_act.curves.last;
|
||||
}
|
||||
else {
|
||||
/* simply add the F-Curve to the end of the given list */
|
||||
BLI_addtail(list, fcu);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that
|
||||
* is not relevant, BUT do not free the IPO-Curve itself...
|
||||
*
|
||||
* \param `id`: data-block that the IPO-Curve is attached to and/or which the new
|
||||
* data-paths will start from. May be null, which may impact the data-paths of the
|
||||
* created F-Curves in some cases.
|
||||
* \param actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to.
|
||||
* \param constname: name of Constraint-Channel (if applicable)
|
||||
* that IPO-Curve's IPO-block belonged to \a seq.
|
||||
* \param seq: sequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to.
|
||||
*/
|
||||
static void icu_to_fcurves(ID *id,
|
||||
ListBase *groups,
|
||||
ListBase *list,
|
||||
IpoCurve *icu,
|
||||
char *actname,
|
||||
char *constname,
|
||||
Strip *strip,
|
||||
int muteipo)
|
||||
{
|
||||
AdrBit2Path *abp;
|
||||
FCurve *fcu;
|
||||
int totbits;
|
||||
|
||||
/* allocate memory for a new F-Curve */
|
||||
fcu = BKE_fcurve_create();
|
||||
|
||||
/* convert driver */
|
||||
if (icu->driver) {
|
||||
fcu->driver = idriver_to_cdriver(icu->driver);
|
||||
}
|
||||
|
||||
/* copy flags */
|
||||
if (icu->flag & IPO_VISIBLE) {
|
||||
fcu->flag |= FCURVE_VISIBLE;
|
||||
}
|
||||
if (icu->flag & IPO_SELECT) {
|
||||
fcu->flag |= FCURVE_SELECTED;
|
||||
}
|
||||
if (icu->flag & IPO_ACTIVE) {
|
||||
fcu->flag |= FCURVE_ACTIVE;
|
||||
}
|
||||
if (icu->flag & IPO_MUTE) {
|
||||
fcu->flag |= FCURVE_MUTED;
|
||||
}
|
||||
if (icu->flag & IPO_PROTECT) {
|
||||
fcu->flag |= FCURVE_PROTECTED;
|
||||
}
|
||||
|
||||
/* set extrapolation */
|
||||
switch (icu->extrap) {
|
||||
case IPO_HORIZ: /* constant extrapolation */
|
||||
case IPO_DIR: /* linear extrapolation */
|
||||
{
|
||||
/* just copy, as the new defines match the old ones... */
|
||||
fcu->extend = icu->extrap;
|
||||
break;
|
||||
}
|
||||
case IPO_CYCL: /* cyclic extrapolation */
|
||||
case IPO_CYCLX: /* cyclic extrapolation + offset */
|
||||
{
|
||||
/* Add a new FModifier (Cyclic) instead of setting extend value
|
||||
* as that's the new equivalent of that option.
|
||||
*/
|
||||
FModifier *fcm = add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, fcu);
|
||||
FMod_Cycles *data = (FMod_Cycles *)fcm->data;
|
||||
|
||||
/* if 'offset' one is in use, set appropriate settings */
|
||||
if (icu->extrap == IPO_CYCLX) {
|
||||
data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC_OFFSET;
|
||||
}
|
||||
else {
|
||||
data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* -------- */
|
||||
|
||||
/* get adrcode <-> bitflags mapping to handle nasty bitflag curves? */
|
||||
abp = adrcode_bitmaps_to_paths(icu->blocktype, icu->adrcode, &totbits);
|
||||
if (abp && totbits) {
|
||||
FCurve *fcurve;
|
||||
int b;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconvert bitflag ipocurve, totbits = %d\n", totbits);
|
||||
}
|
||||
|
||||
/* add the 'only int values' flag */
|
||||
fcu->flag |= (FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES);
|
||||
|
||||
/* for each bit we have to remap + check for:
|
||||
* 1) we need to make copy the existing F-Curve data (fcu -> fcurve),
|
||||
* except for the last one which will use the original
|
||||
* 2) copy the relevant path info across
|
||||
* 3) filter the keyframes for the flag of interest
|
||||
*/
|
||||
for (b = 0; b < totbits; b++, abp++) {
|
||||
uint i = 0;
|
||||
|
||||
/* make a copy of existing base-data if not the last curve */
|
||||
if (b < (totbits - 1)) {
|
||||
fcurve = BKE_fcurve_copy(fcu);
|
||||
}
|
||||
else {
|
||||
fcurve = fcu;
|
||||
}
|
||||
|
||||
/* set path */
|
||||
fcurve->rna_path = BLI_strdup(abp->path);
|
||||
fcurve->array_index = abp->array_index;
|
||||
|
||||
/* Convert keyframes:
|
||||
* - Beztriples and bpoints are mutually exclusive,
|
||||
* so we won't have both at the same time.
|
||||
* - Beztriples are more likely to be encountered as they are keyframes
|
||||
* (the other type wasn't used yet).
|
||||
*/
|
||||
fcurve->totvert = icu->totvert;
|
||||
|
||||
if (icu->bezt) {
|
||||
BezTriple *dst, *src;
|
||||
|
||||
/* allocate new array for keyframes/beztriples */
|
||||
fcurve->bezt = MEM_calloc_arrayN<BezTriple>(fcurve->totvert, "BezTriples");
|
||||
|
||||
/* loop through copying all BezTriples individually, as we need to modify a few things */
|
||||
for (dst = fcurve->bezt, src = icu->bezt, i = 0; i < fcurve->totvert; i++, dst++, src++) {
|
||||
/* firstly, copy BezTriple data */
|
||||
*dst = *src;
|
||||
|
||||
/* interpolation can only be constant... */
|
||||
dst->ipo = BEZT_IPO_CONST;
|
||||
|
||||
/* 'hide' flag is now used for keytype - only 'keyframes' existed before */
|
||||
dst->hide = BEZT_KEYTYPE_KEYFRAME;
|
||||
|
||||
/* auto-handles - per curve to per handle */
|
||||
if (icu->flag & IPO_AUTO_HORIZ) {
|
||||
if (dst->h1 == HD_AUTO) {
|
||||
dst->h1 = HD_AUTO_ANIM;
|
||||
}
|
||||
if (dst->h2 == HD_AUTO) {
|
||||
dst->h2 = HD_AUTO_ANIM;
|
||||
}
|
||||
}
|
||||
|
||||
/* correct values, by checking if the flag of interest is set */
|
||||
if (int(dst->vec[1][1]) & (abp->bit)) {
|
||||
dst->vec[0][1] = dst->vec[1][1] = dst->vec[2][1] = 1.0f;
|
||||
}
|
||||
else {
|
||||
dst->vec[0][1] = dst->vec[1][1] = dst->vec[2][1] = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (icu->bp) {
|
||||
/* TODO: need to convert from BPoint type to the more compact FPoint type...
|
||||
* but not priority, since no data used this. */
|
||||
// BPoint *bp;
|
||||
// FPoint *fpt;
|
||||
}
|
||||
|
||||
/* add new F-Curve to list */
|
||||
fcurve_add_to_list(groups, list, fcurve, actname, muteipo);
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint i = 0;
|
||||
|
||||
/* get rna-path
|
||||
* - we will need to set the 'disabled' flag if no path is able to be made (for now)
|
||||
*/
|
||||
fcu->rna_path = get_rna_access(
|
||||
id, icu->blocktype, icu->adrcode, actname, constname, strip, &fcu->array_index);
|
||||
if (fcu->rna_path == nullptr) {
|
||||
fcu->flag |= FCURVE_DISABLED;
|
||||
}
|
||||
|
||||
/* Convert keyframes:
|
||||
* - Beztriples and bpoints are mutually exclusive, so we won't have both at the same time.
|
||||
* - Beztriples are more likely to be encountered as they are keyframes
|
||||
* (the other type wasn't used yet).
|
||||
*/
|
||||
fcu->totvert = icu->totvert;
|
||||
|
||||
if (icu->bezt) {
|
||||
BezTriple *dst, *src;
|
||||
|
||||
/* allocate new array for keyframes/beztriples */
|
||||
fcu->bezt = MEM_calloc_arrayN<BezTriple>(fcu->totvert, "BezTriples");
|
||||
|
||||
/* loop through copying all BezTriples individually, as we need to modify a few things */
|
||||
for (dst = fcu->bezt, src = icu->bezt, i = 0; i < fcu->totvert; i++, dst++, src++) {
|
||||
/* firstly, copy BezTriple data */
|
||||
*dst = *src;
|
||||
|
||||
/* now copy interpolation from curve (if not already set) */
|
||||
if (icu->ipo != IPO_MIXED) {
|
||||
dst->ipo = icu->ipo;
|
||||
}
|
||||
|
||||
/* 'hide' flag is now used for keytype - only 'keyframes' existed before */
|
||||
dst->hide = BEZT_KEYTYPE_KEYFRAME;
|
||||
|
||||
/* auto-handles - per curve to per handle */
|
||||
if (icu->flag & IPO_AUTO_HORIZ) {
|
||||
if (dst->h1 == HD_AUTO) {
|
||||
dst->h1 = HD_AUTO_ANIM;
|
||||
}
|
||||
if (dst->h2 == HD_AUTO) {
|
||||
dst->h2 = HD_AUTO_ANIM;
|
||||
}
|
||||
}
|
||||
|
||||
/* correct values for euler rotation curves
|
||||
* - they were degrees/10
|
||||
* - we need radians for RNA to do the right thing
|
||||
*/
|
||||
if (((icu->blocktype == ID_OB) && ELEM(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) ||
|
||||
((icu->blocktype == ID_PO) && ELEM(icu->adrcode, AC_EUL_X, AC_EUL_Y, AC_EUL_Z)))
|
||||
{
|
||||
const float fac = float(M_PI) / 18.0f; /* `10.0f * M_PI/180.0f`. */
|
||||
|
||||
dst->vec[0][1] *= fac;
|
||||
dst->vec[1][1] *= fac;
|
||||
dst->vec[2][1] *= fac;
|
||||
}
|
||||
|
||||
/* correct values for path speed curves
|
||||
* - their values were 0-1
|
||||
* - we now need as 'frames'
|
||||
*/
|
||||
if ((id) && (icu->blocktype == GS(id->name)) && (GS(id->name) == ID_CU_LEGACY) &&
|
||||
(fcu->rna_path && STREQ(fcu->rna_path, "eval_time")))
|
||||
{
|
||||
const Curve *cu = (const Curve *)id;
|
||||
|
||||
dst->vec[0][1] *= cu->pathlen;
|
||||
dst->vec[1][1] *= cu->pathlen;
|
||||
dst->vec[2][1] *= cu->pathlen;
|
||||
}
|
||||
|
||||
/* correct times for rotation drivers
|
||||
* - need to go from degrees to radians...
|
||||
* - there's only really 1 target to worry about
|
||||
* - were also degrees/10
|
||||
*/
|
||||
if (fcu->driver && fcu->driver->variables.first) {
|
||||
const DriverVar *dvar = static_cast<const DriverVar *>(fcu->driver->variables.first);
|
||||
const DriverTarget *dtar = &dvar->targets[0];
|
||||
|
||||
if (ELEM(dtar->transChan, DTAR_TRANSCHAN_ROTX, DTAR_TRANSCHAN_ROTY, DTAR_TRANSCHAN_ROTZ))
|
||||
{
|
||||
const float fac = float(M_PI) / 18.0f;
|
||||
|
||||
dst->vec[0][0] *= fac;
|
||||
dst->vec[1][0] *= fac;
|
||||
dst->vec[2][0] *= fac;
|
||||
}
|
||||
}
|
||||
|
||||
/* correct values for sequencer curves, that were not locked to frame */
|
||||
if (strip && (strip->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
|
||||
const float mul = (strip->enddisp - strip->startdisp) / 100.0f;
|
||||
const float offset = strip->startdisp;
|
||||
|
||||
dst->vec[0][0] *= mul;
|
||||
dst->vec[0][0] += offset;
|
||||
|
||||
dst->vec[1][0] *= mul;
|
||||
dst->vec[1][0] += offset;
|
||||
|
||||
dst->vec[2][0] *= mul;
|
||||
dst->vec[2][0] += offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (icu->bp) {
|
||||
/* TODO: need to convert from BPoint type to the more compact FPoint type...
|
||||
* but not priority, since no data used this */
|
||||
// BPoint *bp;
|
||||
// FPoint *fpt;
|
||||
}
|
||||
|
||||
/* add new F-Curve to list */
|
||||
fcurve_add_to_list(groups, list, fcu, actname, muteipo);
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------- */
|
||||
|
||||
/**
|
||||
* Convert an IPO block to listbases of Animato data.
|
||||
*
|
||||
* This does not assume that any ID or AnimData uses it, but does assume that
|
||||
* it is given two lists, which it will perform driver/animation-data separation.
|
||||
*
|
||||
* \param `id`: Data-block that the IPO-Curve is attached to and/or which the
|
||||
* new data-paths will start from. May be null, which may impact the data-paths of
|
||||
* the created F-Curves in some cases.
|
||||
* \param `actname`: Contrary to what you might think, this is not the name of
|
||||
* an action. I (Nathan) don't know what it *is*, but I'm leaving this note here
|
||||
* so people in the future are not misled by the awful parameter name.
|
||||
* \param `animgroups`: List of channel groups that the converted data will be
|
||||
* added to.
|
||||
* \param `anim`: List of FCurves that the converted animation data will be
|
||||
* added to.
|
||||
* \param `drivers`: List of FCurves that converted drivers will be added to.
|
||||
*/
|
||||
static void ipo_to_animato(ID *id,
|
||||
Ipo *ipo,
|
||||
char actname[],
|
||||
char constname[],
|
||||
Strip *strip,
|
||||
ListBase /* bActionGroup */ *animgroups,
|
||||
ListBase /* FCurve */ *anim,
|
||||
ListBase /* FCurve */ *drivers)
|
||||
{
|
||||
IpoCurve *icu;
|
||||
|
||||
/* sanity check */
|
||||
if (ELEM(nullptr, ipo, anim, drivers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("ipo_to_animato\n");
|
||||
}
|
||||
|
||||
/* validate actname and constname
|
||||
* - clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
|
||||
* - actname can then be used to assign F-Curves in Action to Action Groups
|
||||
* (i.e. thus keeping the benefits that used to be provided by Action Channels for grouping
|
||||
* F-Curves for bones). This may be added later... for now let's just dump without them...
|
||||
*/
|
||||
if (actname) {
|
||||
if ((ipo->blocktype == ID_OB) && STREQ(actname, "Object")) {
|
||||
actname = nullptr;
|
||||
}
|
||||
else if ((ipo->blocktype == ID_OB) && STREQ(actname, "Shape")) {
|
||||
actname = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* loop over IPO-Curves, freeing as we progress */
|
||||
LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) {
|
||||
/* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves),
|
||||
* we figure out the best place to put the channel,
|
||||
* then tell the curve-converter to just dump there. */
|
||||
if (icu->driver) {
|
||||
/* Blender 2.4x allowed empty drivers,
|
||||
* but we don't now, since they cause more trouble than they're worth. */
|
||||
if ((icu->driver->ob) || (icu->driver->type == IPO_DRIVER_TYPE_PYTHON)) {
|
||||
icu_to_fcurves(id, nullptr, drivers, icu, actname, constname, strip, ipo->muteipo);
|
||||
}
|
||||
else {
|
||||
MEM_freeN(icu->driver);
|
||||
icu->driver = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
icu_to_fcurves(id, animgroups, anim, icu, actname, constname, strip, ipo->muteipo);
|
||||
}
|
||||
}
|
||||
|
||||
/* if this IPO block doesn't have any users after this one, free... */
|
||||
id_us_min(&ipo->id);
|
||||
if (ID_REAL_USERS(ipo) <= 0) {
|
||||
IpoCurve *icn;
|
||||
|
||||
for (icu = static_cast<IpoCurve *>(ipo->curve.first); icu; icu = icn) {
|
||||
icn = icu->next;
|
||||
|
||||
/* free driver */
|
||||
if (icu->driver) {
|
||||
MEM_freeN(icu->driver);
|
||||
}
|
||||
|
||||
/* free old data of curve now that it's no longer needed for converting any more curves */
|
||||
if (icu->bezt) {
|
||||
MEM_freeN(icu->bezt);
|
||||
}
|
||||
if (icu->bp) {
|
||||
MEM_freeN(icu->bezt);
|
||||
}
|
||||
|
||||
/* free this IPO-Curve */
|
||||
BLI_freelinkN(&ipo->curve, icu);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a pre-Animato Action to an Animato Action and drivers.
|
||||
*
|
||||
* New curves may not be converted directly into the given Action (i.e. for Actions linked
|
||||
* to Objects, where ob->ipo and ob->action need to be combined).
|
||||
*
|
||||
* Pre-Animato Actions can contain drivers, which are added to `drivers`.
|
||||
*
|
||||
* Note: this was refactored from older code. In general `groups` and `curves`
|
||||
* should just be from `act`, and `drivers` should be from the adt of `id`.
|
||||
* However, this is not always the case for `drivers`, and diving into the
|
||||
* spaghetti of where this is called it wasn't clear to me (Nathan) if that's
|
||||
* actually *always* the case for `groups` and `curves` either, so I (Nathan)
|
||||
* left them as separate parameters to be on the safe side.
|
||||
*/
|
||||
static void convert_pre_animato_action_to_animato_action_in_place(
|
||||
ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
|
||||
{
|
||||
const bool is_pre_animato_action = !BLI_listbase_is_empty(&act->chanbase);
|
||||
BLI_assert_msg(is_pre_animato_action, "Action is not pre-Animato.");
|
||||
if (!is_pre_animato_action) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* get rid of all Action Groups */
|
||||
/* XXX this is risky if there's some old + some new data in the Action... */
|
||||
if (act->groups.first) {
|
||||
BLI_freelistN(&act->groups);
|
||||
}
|
||||
|
||||
/* loop through Action-Channels, converting data, freeing as we go */
|
||||
LISTBASE_FOREACH_MUTABLE (bActionChannel *, achan, &act->chanbase) {
|
||||
/* convert Action Channel's IPO data */
|
||||
if (achan->ipo) {
|
||||
ipo_to_animato(id, achan->ipo, achan->name, nullptr, nullptr, groups, curves, drivers);
|
||||
id_us_min(&achan->ipo->id);
|
||||
achan->ipo = nullptr;
|
||||
}
|
||||
|
||||
/* convert constraint channel IPO-data */
|
||||
LISTBASE_FOREACH_MUTABLE (bConstraintChannel *, conchan, &achan->constraintChannels) {
|
||||
/* convert Constraint Channel's IPO data */
|
||||
if (conchan->ipo) {
|
||||
ipo_to_animato(
|
||||
id, conchan->ipo, achan->name, conchan->name, nullptr, groups, curves, drivers);
|
||||
id_us_min(&conchan->ipo->id);
|
||||
conchan->ipo = nullptr;
|
||||
}
|
||||
|
||||
/* free Constraint Channel */
|
||||
BLI_freelinkN(&achan->constraintChannels, conchan);
|
||||
}
|
||||
|
||||
/* free Action Channel */
|
||||
BLI_freelinkN(&act->chanbase, achan);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure that the action is a modern layered action, upgrading if necessary.
|
||||
*
|
||||
* This deals with both Animato and pre-Animato actions, ensuring that they are
|
||||
* fully upgraded. In the case of a pre-Animato action, it may contain drivers
|
||||
* as well, which are converted and added to `drivers`.
|
||||
*
|
||||
* Much of the behavior of this function, and the reason for most of the
|
||||
* parameters, is due to
|
||||
* `convert_pre_animato_action_to_animato_action_in_place()`. See its
|
||||
* documentation for more details.
|
||||
*
|
||||
* \see convert_pre_animato_action_to_animato_action_in_place()
|
||||
*/
|
||||
static void ensure_action_is_layered(
|
||||
ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
|
||||
{
|
||||
/* Already converted to the most modern kind of action, so no need to
|
||||
* convert. */
|
||||
if (blender::animrig::versioning::action_is_layered(*act)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* If there are Action Channels, indicating a pre-Animato action, then convert
|
||||
* to Animato data. Note that pre-Animato actions may include drivers! */
|
||||
const bool is_pre_animato_action = !BLI_listbase_is_empty(&act->chanbase);
|
||||
if (is_pre_animato_action) {
|
||||
convert_pre_animato_action_to_animato_action_in_place(id, act, groups, curves, drivers);
|
||||
}
|
||||
|
||||
/* If there is an animated ID, tag it so that its Action usage also will get converted. */
|
||||
if (id) {
|
||||
blender::animrig::versioning::tag_action_user_for_slotted_actions_conversion(*id);
|
||||
}
|
||||
|
||||
/* Convert to layered action. */
|
||||
blender::animrig::versioning::convert_legacy_animato_action(*act);
|
||||
}
|
||||
|
||||
/* ------------------------- */
|
||||
|
||||
/* Convert IPO-block (i.e. all its IpoCurves) for some ID to the new system
|
||||
* This assumes that AnimData has been added already. Separation of drivers
|
||||
* from animation data is accomplished here too...
|
||||
*/
|
||||
static void ipo_to_animdata(
|
||||
Main *bmain, ID *id, Ipo *ipo, char actname[], char constname[], Strip *strip)
|
||||
{
|
||||
AnimData *adt = BKE_animdata_from_id(id);
|
||||
ListBase anim = {nullptr, nullptr};
|
||||
ListBase drivers = {nullptr, nullptr};
|
||||
|
||||
/* sanity check */
|
||||
if (ELEM(nullptr, id, ipo)) {
|
||||
return;
|
||||
}
|
||||
if (adt == nullptr) {
|
||||
CLOG_ERROR(&LOG, "adt invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s stripname:%s curves:%d\n",
|
||||
id->name + 2,
|
||||
ipo->id.name + 2,
|
||||
(actname) ? actname : "<None>",
|
||||
(constname) ? constname : "<None>",
|
||||
(strip) ? (strip->name + 2) : "<None>",
|
||||
BLI_listbase_count(&ipo->curve));
|
||||
}
|
||||
|
||||
/* Convert curves to animato system
|
||||
* (separated into separate lists of F-Curves for animation and drivers),
|
||||
* and the try to put these lists in the right places, but do not free the lists here. */
|
||||
/* XXX there shouldn't be any need for the groups, so don't supply pointer for that now... */
|
||||
ipo_to_animato(id, ipo, actname, constname, strip, nullptr, &anim, &drivers);
|
||||
|
||||
/* deal with animation first */
|
||||
if (anim.first) {
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\thas anim\n");
|
||||
}
|
||||
/* try to get action */
|
||||
if (adt->action == nullptr) {
|
||||
char nameBuf[MAX_ID_NAME];
|
||||
|
||||
SNPRINTF_UTF8(nameBuf, "CDA:%s", ipo->id.name + 2);
|
||||
|
||||
bAction *action = BKE_action_add(bmain, nameBuf);
|
||||
id_us_min(&action->id);
|
||||
const bool assign_ok = animrig::assign_action(action, {*id, *adt});
|
||||
BLI_assert_msg(assign_ok, "Expecting the assignment of a new Action to always work");
|
||||
UNUSED_VARS_NDEBUG(assign_ok);
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\t\tadded new action - '%s'\n", nameBuf);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add F-Curves to action, creating an Animato action. */
|
||||
BLI_movelisttolist(&adt->action->curves, &anim);
|
||||
|
||||
/* Upgrade Animato action to a layered action. */
|
||||
blender::animrig::versioning::tag_action_user_for_slotted_actions_conversion(*id);
|
||||
blender::animrig::versioning::convert_legacy_animato_action(*adt->action);
|
||||
}
|
||||
|
||||
/* deal with drivers */
|
||||
if (drivers.first) {
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\thas drivers\n");
|
||||
}
|
||||
/* add drivers to end of driver stack */
|
||||
BLI_movelisttolist(&adt->drivers, &drivers);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert Action-block to new system
|
||||
* NOTE: we need to be careful here, as same data-structs are used for new system too!
|
||||
*/
|
||||
static void action_to_animdata(ID *id, bAction *act)
|
||||
{
|
||||
AnimData *adt = BKE_animdata_from_id(id);
|
||||
|
||||
/* only continue if there are Action Channels (indicating unconverted data) */
|
||||
if (ELEM(nullptr, adt, act->chanbase.first)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* check if we need to set this Action as the AnimData's action */
|
||||
if (adt->action == nullptr) {
|
||||
/* set this Action as AnimData's Action */
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("act_to_adt - set adt action to act\n");
|
||||
}
|
||||
const bool assign_ok = animrig::assign_action(act, {*id, *adt});
|
||||
BLI_assert_msg(assign_ok, "Expecting the assignment of a just-converted Action to work");
|
||||
UNUSED_VARS_NDEBUG(assign_ok);
|
||||
}
|
||||
|
||||
/* convert Action data */
|
||||
ensure_action_is_layered(id, act, &adt->action->groups, &adt->action->curves, &adt->drivers);
|
||||
}
|
||||
|
||||
/* ------------------------- */
|
||||
|
||||
/* TODO:
|
||||
* - NLA group duplicators info
|
||||
* - NLA curve/stride modifiers... */
|
||||
|
||||
/* Convert NLA-Strip to new system */
|
||||
static void nlastrips_to_animdata(ID *id, ListBase *strips)
|
||||
{
|
||||
AnimData *adt = BKE_animdata_from_id(id);
|
||||
NlaTrack *nlt = nullptr;
|
||||
NlaStrip *strip;
|
||||
bActionStrip *as, *asn;
|
||||
|
||||
/* for each one of the original strips, convert to a new strip and free the old... */
|
||||
for (as = static_cast<bActionStrip *>(strips->first); as; as = asn) {
|
||||
asn = as->next;
|
||||
|
||||
/* this old strip is only worth something if it had an action... */
|
||||
if (as->act) {
|
||||
/* convert Action data (if not yet converted), storing the results in the same Action */
|
||||
ensure_action_is_layered(id, as->act, &as->act->groups, &as->act->curves, &adt->drivers);
|
||||
|
||||
/* Create a new-style NLA-strip which references this Action,
|
||||
* then copy over relevant settings. */
|
||||
{
|
||||
/* init a new strip, and assign the action to it
|
||||
* - no need to muck around with the user-counts, since this is just
|
||||
* passing over the ref to the new owner, not creating an additional ref
|
||||
*/
|
||||
strip = MEM_callocN<NlaStrip>("NlaStrip");
|
||||
strip->act = as->act;
|
||||
|
||||
/* endpoints */
|
||||
strip->start = as->start;
|
||||
strip->end = as->end;
|
||||
strip->actstart = as->actstart;
|
||||
strip->actend = as->actend;
|
||||
|
||||
/* action reuse */
|
||||
strip->repeat = as->repeat;
|
||||
strip->scale = as->scale;
|
||||
if (as->flag & ACTSTRIP_LOCK_ACTION) {
|
||||
strip->flag |= NLASTRIP_FLAG_SYNC_LENGTH;
|
||||
}
|
||||
|
||||
/* blending */
|
||||
strip->blendin = as->blendin;
|
||||
strip->blendout = as->blendout;
|
||||
strip->blendmode = (as->mode == ACTSTRIPMODE_ADD) ? NLASTRIP_MODE_ADD :
|
||||
NLASTRIP_MODE_REPLACE;
|
||||
if (as->flag & ACTSTRIP_AUTO_BLENDS) {
|
||||
strip->flag |= NLASTRIP_FLAG_AUTO_BLENDS;
|
||||
}
|
||||
|
||||
/* assorted setting flags */
|
||||
if (as->flag & ACTSTRIP_SELECT) {
|
||||
strip->flag |= NLASTRIP_FLAG_SELECT;
|
||||
}
|
||||
if (as->flag & ACTSTRIP_ACTIVE) {
|
||||
strip->flag |= NLASTRIP_FLAG_ACTIVE;
|
||||
}
|
||||
|
||||
if (as->flag & ACTSTRIP_MUTE) {
|
||||
strip->flag |= NLASTRIP_FLAG_MUTED;
|
||||
}
|
||||
if (as->flag & ACTSTRIP_REVERSE) {
|
||||
strip->flag |= NLASTRIP_FLAG_REVERSE;
|
||||
}
|
||||
|
||||
/* by default, we now always extrapolate, while in the past this was optional */
|
||||
if ((as->flag & ACTSTRIP_HOLDLASTFRAME) == 0) {
|
||||
strip->extendmode = NLASTRIP_EXTEND_NOTHING;
|
||||
}
|
||||
}
|
||||
|
||||
/* Try to add this strip to the current NLA-Track
|
||||
* (i.e. the 'last' one on the stack at the moment). */
|
||||
if (BKE_nlatrack_add_strip(nlt, strip, false) == 0) {
|
||||
/* trying to add to the current failed (no space),
|
||||
* so add a new track to the stack, and add to that...
|
||||
*/
|
||||
nlt = BKE_nlatrack_new_tail(&adt->nla_tracks, false);
|
||||
BKE_nlatrack_set_active(&adt->nla_tracks, nlt);
|
||||
BKE_nlatrack_add_strip(nlt, strip, false);
|
||||
}
|
||||
|
||||
/* ensure that strip has a name */
|
||||
BKE_nlastrip_validate_name(adt, strip);
|
||||
}
|
||||
|
||||
/* modifiers */
|
||||
/* FIXME: for now, we just free them... */
|
||||
if (as->modifiers.first) {
|
||||
BLI_freelistN(&as->modifiers);
|
||||
}
|
||||
|
||||
/* free the old strip */
|
||||
BLI_freelinkN(strips, as);
|
||||
}
|
||||
}
|
||||
|
||||
struct Seq_callback_data {
|
||||
Main *bmain;
|
||||
Scene *scene;
|
||||
AnimData *adt;
|
||||
};
|
||||
|
||||
static bool strip_convert_callback(Strip *strip, void *userdata)
|
||||
{
|
||||
IpoCurve *icu = static_cast<IpoCurve *>((strip->ipo_legacy) ? strip->ipo_legacy->curve.first :
|
||||
nullptr);
|
||||
short adrcode = STRIP_FAC1;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting sequence strip %s\n", strip->name + 2);
|
||||
}
|
||||
|
||||
if (ELEM(nullptr, strip->ipo_legacy, icu)) {
|
||||
strip->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Patch `adrcode`, so that we can map to different DNA variables later (semi-hack (tm)). */
|
||||
switch (strip->type) {
|
||||
case STRIP_TYPE_IMAGE:
|
||||
case STRIP_TYPE_META:
|
||||
case STRIP_TYPE_SCENE:
|
||||
case STRIP_TYPE_MOVIE:
|
||||
case STRIP_TYPE_COLOR:
|
||||
adrcode = STRIP_FAC_OPACITY;
|
||||
break;
|
||||
case STRIP_TYPE_SPEED:
|
||||
adrcode = STRIP_FAC_SPEED;
|
||||
break;
|
||||
}
|
||||
icu->adrcode = adrcode;
|
||||
|
||||
Seq_callback_data *cd = (Seq_callback_data *)userdata;
|
||||
|
||||
/* convert IPO */
|
||||
ipo_to_animdata(cd->bmain, (ID *)cd->scene, strip->ipo_legacy, nullptr, nullptr, strip);
|
||||
|
||||
if (cd->adt->action && !blender::animrig::versioning::action_is_layered(*cd->adt->action)) {
|
||||
cd->adt->action->idroot = ID_SCE; /* scene-rooted */
|
||||
}
|
||||
|
||||
id_us_min(&strip->ipo_legacy->id);
|
||||
strip->ipo_legacy = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
/* External API - Only Called from do_versions() */
|
||||
|
||||
void do_versions_ipos_to_layered_actions(Main *bmain)
|
||||
{
|
||||
using blender::animrig::versioning::action_is_layered;
|
||||
|
||||
ListBase drivers = {nullptr, nullptr};
|
||||
ID *id;
|
||||
|
||||
if (bmain == nullptr) {
|
||||
CLOG_ERROR(&LOG, "Argh! Main is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Only convert if the bmain version is old enough.
|
||||
*
|
||||
* Note that the mixing of pre-2.50 and post-2.50 animation data is not supported, and so there
|
||||
* is no need to check for the version of library blend files.
|
||||
*
|
||||
* See the check in #BKE_blendfile_link(), that actively warns users that their animation data
|
||||
* will not be converted when linking to a pre-2.50 blend file.
|
||||
*
|
||||
* But even when the main file is newer, it could still link in pre-2.50 Actions, and those need
|
||||
* to be converted in this function as well.
|
||||
*/
|
||||
if (bmain->versionfile >= 250) {
|
||||
bool shown_info = false;
|
||||
|
||||
LISTBASE_FOREACH (ID *, id, &bmain->actions) {
|
||||
bAction *action = reinterpret_cast<bAction *>(id);
|
||||
|
||||
const bool is_pre_animato_action = !BLI_listbase_is_empty(&action->chanbase);
|
||||
if (!is_pre_animato_action) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
if (!shown_info) {
|
||||
printf("INFO: Converting IPO Action to modern animation data types...\n");
|
||||
shown_info = true;
|
||||
}
|
||||
|
||||
printf("\tconverting action %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* This Action will be object-only. */
|
||||
action->idroot = ID_OB;
|
||||
|
||||
ensure_action_is_layered(nullptr, action, &action->groups, &action->curves, &drivers);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("INFO: Converting IPO to modern animation data types...\n");
|
||||
}
|
||||
|
||||
/* ----------- Animation Attached to Data -------------- */
|
||||
|
||||
/* objects */
|
||||
for (id = static_cast<ID *>(bmain->objects.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Object *ob = (Object *)id;
|
||||
bConstraintChannel *conchan, *conchann;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting ob %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* check if object has any animation data */
|
||||
if (ob->nlastrips.first) {
|
||||
/* Add AnimData block */
|
||||
BKE_animdata_ensure_id(id);
|
||||
|
||||
/* IPO first to take into any non-NLA'd Object Animation */
|
||||
if (ob->ipo) {
|
||||
ipo_to_animdata(bmain, id, ob->ipo, nullptr, nullptr, nullptr);
|
||||
/* No need to id_us_min ipo ID here, ipo_to_animdata already does it. */
|
||||
ob->ipo = nullptr;
|
||||
}
|
||||
|
||||
/* Action is skipped since it'll be used by some strip in the NLA anyway,
|
||||
* causing errors with evaluation in the new evaluation pipeline
|
||||
*/
|
||||
if (ob->action) {
|
||||
id_us_min(&ob->action->id);
|
||||
ob->action = nullptr;
|
||||
}
|
||||
|
||||
/* finally NLA */
|
||||
nlastrips_to_animdata(id, &ob->nlastrips);
|
||||
}
|
||||
else if ((ob->ipo) || (ob->action)) {
|
||||
BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Action first - so that Action name get conserved */
|
||||
if (ob->action) {
|
||||
action_to_animdata(id, ob->action);
|
||||
|
||||
id_us_min(&ob->action->id);
|
||||
ob->action = nullptr;
|
||||
}
|
||||
|
||||
/* IPO second... */
|
||||
if (ob->ipo) {
|
||||
ipo_to_animdata(bmain, id, ob->ipo, nullptr, nullptr, nullptr);
|
||||
/* No need to id_us_min ipo ID here, ipo_to_animdata already does it. */
|
||||
ob->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* check PoseChannels for constraints with local data */
|
||||
if (ob->pose) {
|
||||
LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
|
||||
LISTBASE_FOREACH (bConstraint *, con, &pchan->constraints) {
|
||||
/* if constraint has its own IPO, convert add these to Object
|
||||
* (NOTE: they're most likely to be drivers too)
|
||||
*/
|
||||
if (con->ipo) {
|
||||
/* Verify if there's AnimData block */
|
||||
BKE_animdata_ensure_id(id);
|
||||
|
||||
/* although this was the constraint's local IPO, we still need to provide pchan + con
|
||||
* so that drivers can be added properly...
|
||||
*/
|
||||
ipo_to_animdata(bmain, id, con->ipo, pchan->name, con->name, nullptr);
|
||||
id_us_min(&con->ipo->id);
|
||||
con->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check constraints for local IPO's */
|
||||
LISTBASE_FOREACH (bConstraint *, con, &ob->constraints) {
|
||||
/* if constraint has its own IPO, convert add these to Object
|
||||
* (NOTE: they're most likely to be drivers too)
|
||||
*/
|
||||
if (con->ipo) {
|
||||
/* Verify if there's AnimData block, just in case */
|
||||
BKE_animdata_ensure_id(id);
|
||||
|
||||
/* although this was the constraint's local IPO, we still need to provide con
|
||||
* so that drivers can be added properly...
|
||||
*/
|
||||
ipo_to_animdata(bmain, id, con->ipo, nullptr, con->name, nullptr);
|
||||
id_us_min(&con->ipo->id);
|
||||
con->ipo = nullptr;
|
||||
}
|
||||
|
||||
/* check for Action Constraint */
|
||||
/* XXX do we really want to do this here? */
|
||||
}
|
||||
|
||||
/* check constraint channels - we need to remove them anyway... */
|
||||
if (ob->constraintChannels.first) {
|
||||
for (conchan = static_cast<bConstraintChannel *>(ob->constraintChannels.first); conchan;
|
||||
conchan = conchann)
|
||||
{
|
||||
/* get pointer to next Constraint Channel */
|
||||
conchann = conchan->next;
|
||||
|
||||
/* convert Constraint Channel's IPO data */
|
||||
if (conchan->ipo) {
|
||||
/* Verify if there's AnimData block */
|
||||
BKE_animdata_ensure_id(id);
|
||||
|
||||
ipo_to_animdata(bmain, id, conchan->ipo, nullptr, conchan->name, nullptr);
|
||||
id_us_min(&conchan->ipo->id);
|
||||
conchan->ipo = nullptr;
|
||||
}
|
||||
|
||||
/* free Constraint Channel */
|
||||
BLI_freelinkN(&ob->constraintChannels, conchan);
|
||||
}
|
||||
}
|
||||
|
||||
/* object's action will always be object-rooted */
|
||||
{
|
||||
AnimData *adt = BKE_animdata_from_id(id);
|
||||
if (adt && adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = ID_OB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* shapekeys */
|
||||
for (id = static_cast<ID *>(bmain->shapekeys.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Key *key = (Key *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting key %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* we're only interested in the IPO
|
||||
* NOTE: for later, it might be good to port these over to Object instead, as many of these
|
||||
* are likely to be drivers, but it's hard to trace that from here, so move this to Ob loop?
|
||||
*/
|
||||
if (key->ipo) {
|
||||
/* Add AnimData block */
|
||||
AnimData *adt = BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Convert Shape-key data... */
|
||||
ipo_to_animdata(bmain, id, key->ipo, nullptr, nullptr, nullptr);
|
||||
|
||||
if (adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = key->ipo->blocktype;
|
||||
}
|
||||
|
||||
id_us_min(&key->ipo->id);
|
||||
key->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* materials */
|
||||
for (id = static_cast<ID *>(bmain->materials.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Material *ma = (Material *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting material %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* we're only interested in the IPO */
|
||||
if (ma->ipo) {
|
||||
/* Add AnimData block */
|
||||
AnimData *adt = BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Convert Material data... */
|
||||
ipo_to_animdata(bmain, id, ma->ipo, nullptr, nullptr, nullptr);
|
||||
|
||||
if (adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = ma->ipo->blocktype;
|
||||
}
|
||||
|
||||
id_us_min(&ma->ipo->id);
|
||||
ma->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* worlds */
|
||||
for (id = static_cast<ID *>(bmain->worlds.first); id; id = static_cast<ID *>(id->next)) {
|
||||
World *wo = (World *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting world %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* we're only interested in the IPO */
|
||||
if (wo->ipo) {
|
||||
/* Add AnimData block */
|
||||
AnimData *adt = BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Convert World data... */
|
||||
ipo_to_animdata(bmain, id, wo->ipo, nullptr, nullptr, nullptr);
|
||||
|
||||
if (adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = wo->ipo->blocktype;
|
||||
}
|
||||
|
||||
id_us_min(&wo->ipo->id);
|
||||
wo->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* sequence strips */
|
||||
for (id = static_cast<ID *>(bmain->scenes.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Scene *scene = (Scene *)id;
|
||||
Editing *ed = scene->ed;
|
||||
if (ed && ed->current_strips()) {
|
||||
Seq_callback_data cb_data = {bmain, scene, BKE_animdata_ensure_id(id)};
|
||||
seq::for_each_callback(&ed->seqbase, strip_convert_callback, &cb_data);
|
||||
}
|
||||
}
|
||||
|
||||
/* textures */
|
||||
for (id = static_cast<ID *>(bmain->textures.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Tex *te = (Tex *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting texture %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* we're only interested in the IPO */
|
||||
if (te->ipo) {
|
||||
/* Add AnimData block */
|
||||
AnimData *adt = BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Convert Texture data... */
|
||||
ipo_to_animdata(bmain, id, te->ipo, nullptr, nullptr, nullptr);
|
||||
|
||||
if (adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = te->ipo->blocktype;
|
||||
}
|
||||
|
||||
id_us_min(&te->ipo->id);
|
||||
te->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* cameras */
|
||||
for (id = static_cast<ID *>(bmain->cameras.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Camera *ca = (Camera *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting camera %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* we're only interested in the IPO */
|
||||
if (ca->ipo) {
|
||||
/* Add AnimData block */
|
||||
AnimData *adt = BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Convert Camera data... */
|
||||
ipo_to_animdata(bmain, id, ca->ipo, nullptr, nullptr, nullptr);
|
||||
|
||||
if (adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = ca->ipo->blocktype;
|
||||
}
|
||||
|
||||
id_us_min(&ca->ipo->id);
|
||||
ca->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* lights */
|
||||
for (id = static_cast<ID *>(bmain->lights.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Light *la = (Light *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting light %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* we're only interested in the IPO */
|
||||
if (la->ipo) {
|
||||
/* Add AnimData block */
|
||||
AnimData *adt = BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Convert Light data... */
|
||||
ipo_to_animdata(bmain, id, la->ipo, nullptr, nullptr, nullptr);
|
||||
|
||||
if (adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = la->ipo->blocktype;
|
||||
}
|
||||
|
||||
id_us_min(&la->ipo->id);
|
||||
la->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* curves */
|
||||
for (id = static_cast<ID *>(bmain->curves.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Curve *cu = (Curve *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting curve %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* we're only interested in the IPO */
|
||||
if (cu->ipo) {
|
||||
/* Add AnimData block */
|
||||
AnimData *adt = BKE_animdata_ensure_id(id);
|
||||
|
||||
/* Convert Curve data... */
|
||||
ipo_to_animdata(bmain, id, cu->ipo, nullptr, nullptr, nullptr);
|
||||
|
||||
if (adt->action && !action_is_layered(*adt->action)) {
|
||||
adt->action->idroot = cu->ipo->blocktype;
|
||||
}
|
||||
|
||||
id_us_min(&cu->ipo->id);
|
||||
cu->ipo = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------- Unconverted Animation Data ------------------ */
|
||||
/* For Animation data which may not be directly connected (i.e. not linked) to any other
|
||||
* data, we need to perform a separate pass to make sure that they are converted to standalone
|
||||
* Actions which may then be able to be reused. This does mean that we will be going over data
|
||||
* that's already been converted, but there are no problems with that.
|
||||
*
|
||||
* The most common case for this will be Action Constraints, or IPO's with Fake-Users.
|
||||
* We collect all drivers that were found into a temporary collection, and free them in one go,
|
||||
* as they're impossible to resolve.
|
||||
*/
|
||||
|
||||
/* actions */
|
||||
for (id = static_cast<ID *>(bmain->actions.first); id; id = static_cast<ID *>(id->next)) {
|
||||
bAction *act = (bAction *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting action %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* if old action, it will be object-only... */
|
||||
if (act->chanbase.first) {
|
||||
act->idroot = ID_OB;
|
||||
}
|
||||
|
||||
/* be careful! some of the actions we encounter will be converted ones... */
|
||||
ensure_action_is_layered(nullptr, act, &act->groups, &act->curves, &drivers);
|
||||
}
|
||||
|
||||
/* ipo's */
|
||||
for (id = static_cast<ID *>(bmain->ipo.first); id; id = static_cast<ID *>(id->next)) {
|
||||
Ipo *ipo = (Ipo *)id;
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("\tconverting ipo %s\n", id->name + 2);
|
||||
}
|
||||
|
||||
/* most likely this IPO has already been processed, so check if any curves left to convert */
|
||||
if (ipo->curve.first) {
|
||||
bAction *new_act;
|
||||
|
||||
/* add a new action for this, and convert all data into that action */
|
||||
new_act = BKE_action_add(bmain, id->name + 2);
|
||||
ipo_to_animato(nullptr, ipo, nullptr, nullptr, nullptr, nullptr, &new_act->curves, &drivers);
|
||||
new_act->idroot = ipo->blocktype;
|
||||
|
||||
/* Upgrade the resulting Animato action to a layered action. */
|
||||
blender::animrig::versioning::tag_action_user_for_slotted_actions_conversion(*id);
|
||||
blender::animrig::versioning::convert_legacy_animato_action(*new_act);
|
||||
}
|
||||
|
||||
/* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */
|
||||
ipo->id.us = 0;
|
||||
ipo->id.flag &= ~ID_FLAG_FAKEUSER;
|
||||
}
|
||||
|
||||
/* free unused drivers from actions + ipos */
|
||||
BKE_fcurves_free(&drivers);
|
||||
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("INFO: Animato convert done\n");
|
||||
}
|
||||
}
|
||||
@@ -100,13 +100,7 @@ static void shapekey_free_data(ID *id)
|
||||
static void shapekey_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Key *key = reinterpret_cast<Key *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
BKE_LIB_FOREACHID_PROCESS_ID(data, key->from, IDWALK_CB_LOOPBACK);
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, key->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static ID **shapekey_owner_pointer_get(ID *id, const bool debug_relationship_assert)
|
||||
|
||||
@@ -125,13 +125,7 @@ static void lattice_free_data(ID *id)
|
||||
static void lattice_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Lattice *lattice = reinterpret_cast<Lattice *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, lattice->key, IDWALK_CB_USER);
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, lattice->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void lattice_blend_write(BlendWriter *writer, ID *id, const void *id_address)
|
||||
|
||||
@@ -115,17 +115,12 @@ static void light_free_data(ID *id)
|
||||
static void light_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Light *lamp = reinterpret_cast<Light *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
if (lamp->nodetree) {
|
||||
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
||||
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
|
||||
data, BKE_library_foreach_ID_embedded(data, (ID **)&lamp->nodetree));
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, lamp->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void light_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
|
||||
|
||||
@@ -125,7 +125,6 @@ void BKE_main_clear(Main &bmain)
|
||||
|
||||
switch ((eID_Index)a) {
|
||||
CASE_ID_INDEX(INDEX_ID_LI);
|
||||
CASE_ID_INDEX(INDEX_ID_IP);
|
||||
CASE_ID_INDEX(INDEX_ID_AC);
|
||||
CASE_ID_INDEX(INDEX_ID_GD_LEGACY);
|
||||
CASE_ID_INDEX(INDEX_ID_NT);
|
||||
@@ -914,8 +913,6 @@ ListBase *which_libbase(Main *bmain, short type)
|
||||
return &(bmain->lights);
|
||||
case ID_CA:
|
||||
return &(bmain->cameras);
|
||||
case ID_IP:
|
||||
return &(bmain->ipo);
|
||||
case ID_KE:
|
||||
return &(bmain->shapekeys);
|
||||
case ID_WO:
|
||||
@@ -980,8 +977,6 @@ MainListsArray BKE_main_lists_get(Main &bmain)
|
||||
/* Libraries may be accessed from pretty much any other ID. */
|
||||
lb[INDEX_ID_LI] = &bmain.libraries;
|
||||
|
||||
lb[INDEX_ID_IP] = &bmain.ipo;
|
||||
|
||||
/* Moved here to avoid problems when freeing with animato (aligorith). */
|
||||
lb[INDEX_ID_AC] = &bmain.actions;
|
||||
|
||||
|
||||
@@ -169,7 +169,6 @@ static void material_free_data(ID *id)
|
||||
static void material_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Material *material = reinterpret_cast<Material *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
/* Node-trees **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
||||
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
|
||||
@@ -181,10 +180,6 @@ static void material_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, material->gp_style->sima, IDWALK_CB_USER);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, material->gp_style->ima, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, material->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void material_foreach_working_space_color(ID *id,
|
||||
|
||||
@@ -95,15 +95,9 @@ static void metaball_free_data(ID *id)
|
||||
static void metaball_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
MetaBall *metaball = reinterpret_cast<MetaBall *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
for (int i = 0; i < metaball->totcol; i++) {
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, metaball->mat[i], IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, metaball->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void metaball_blend_write(BlendWriter *writer, ID *id, const void *id_address)
|
||||
|
||||
@@ -273,17 +273,12 @@ static void mesh_free_data(ID *id)
|
||||
static void mesh_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Mesh *mesh = reinterpret_cast<Mesh *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mesh->texcomesh, IDWALK_CB_NEVER_SELF);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mesh->key, IDWALK_CB_USER);
|
||||
for (int i = 0; i < mesh->totcol; i++) {
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, mesh->mat[i], IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, mesh->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void mesh_foreach_path(ID *id, BPathForeachPathData *bpath_data)
|
||||
|
||||
@@ -486,15 +486,7 @@ static void object_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, object->ipo, IDWALK_CB_USER);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, object->action, IDWALK_CB_USER);
|
||||
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, object->poselib, IDWALK_CB_USER);
|
||||
|
||||
LISTBASE_FOREACH (bConstraintChannel *, chan, &object->constraintChannels) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, chan->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
/* Note: This is technically _not_ needed currently, because readcode (see
|
||||
* #object_blend_read_data) directly converts and removes these deprecated ObHook data.
|
||||
* However, for sake of consistency, better have this ID pointer handled here nonetheless. */
|
||||
@@ -505,15 +497,6 @@ static void object_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, hook->parent, IDWALK_CB_NOP);
|
||||
}
|
||||
|
||||
LISTBASE_FOREACH (bActionStrip *, strip, &object->nlastrips) {
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, strip->object, IDWALK_CB_NOP);
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, strip->act, IDWALK_CB_USER);
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, strip->ipo, IDWALK_CB_USER);
|
||||
LISTBASE_FOREACH (bActionModifier *, amod, &strip->modifiers) {
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, amod->ob, IDWALK_CB_NOP);
|
||||
}
|
||||
}
|
||||
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, object->gpd, IDWALK_CB_USER);
|
||||
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, object->proxy, IDWALK_CB_NOP);
|
||||
@@ -525,12 +508,6 @@ static void object_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
if (paf && paf->group) {
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, paf->group, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
FluidsimModifierData *fluidmd = reinterpret_cast<FluidsimModifierData *>(
|
||||
BKE_modifiers_findby_type(object, eModifierType_Fluidsim));
|
||||
if (fluidmd && fluidmd->fss) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, fluidmd->fss->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,16 +693,6 @@ static void object_blend_write(BlendWriter *writer, ID *id, const void *id_addre
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX deprecated - old animation system */
|
||||
static void direct_link_nlastrips(BlendDataReader *reader, ListBase *strips)
|
||||
{
|
||||
BLO_read_struct_list(reader, bActionStrip, strips);
|
||||
|
||||
LISTBASE_FOREACH (bActionStrip *, strip, strips) {
|
||||
BLO_read_struct_list(reader, bActionModifier, &strip->modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
static void object_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
{
|
||||
Object *ob = (Object *)id;
|
||||
@@ -763,11 +730,6 @@ static void object_blend_read_data(BlendDataReader *reader, ID *id)
|
||||
BLO_read_struct_list(reader, bDeformGroup, &ob->defbase);
|
||||
BLO_read_struct_list(reader, bFaceMap, &ob->fmaps);
|
||||
|
||||
/* XXX deprecated - old animation system <<< */
|
||||
direct_link_nlastrips(reader, &ob->nlastrips);
|
||||
BLO_read_struct_list(reader, bConstraintChannel, &ob->constraintChannels);
|
||||
/* >>> XXX deprecated - old animation system */
|
||||
|
||||
BLO_read_pointer_array(reader, ob->totcol, (void **)&ob->mat);
|
||||
BLO_read_char_array(reader, ob->totcol, &ob->matbits);
|
||||
|
||||
|
||||
@@ -777,7 +777,6 @@ static void scene_foreach_layer_collection(LibraryForeachIDData *data,
|
||||
static bool strip_foreach_member_id_cb(Strip *strip, void *user_data)
|
||||
{
|
||||
LibraryForeachIDData *data = static_cast<LibraryForeachIDData *>(user_data);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
/* Only for deprecated data. */
|
||||
#define FOREACHID_PROCESS_ID_NOCHECK(_data, _id_super, _cb_flag) \
|
||||
@@ -816,10 +815,6 @@ static bool strip_foreach_member_id_cb(Strip *strip, void *user_data)
|
||||
FOREACHID_PROCESS_IDSUPER(data, text_data->text_font, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
FOREACHID_PROCESS_ID_NOCHECK(data, strip->ipo_legacy, IDWALK_CB_USER);
|
||||
}
|
||||
|
||||
#undef FOREACHID_PROCESS_IDSUPER
|
||||
#undef FOREACHID_PROCESS_ID_NOCHECK
|
||||
|
||||
|
||||
@@ -86,7 +86,6 @@ static void sound_copy_data(Main * /*bmain*/,
|
||||
BLI_spin_init(static_cast<SpinLock *>(sound_dst->spinlock));
|
||||
|
||||
/* Just to be sure, should not have any value actually after reading time. */
|
||||
sound_dst->ipo = nullptr;
|
||||
sound_dst->newpackedfile = nullptr;
|
||||
|
||||
if (sound_src->packedfile != nullptr) {
|
||||
@@ -118,16 +117,6 @@ static void sound_free_data(ID *id)
|
||||
}
|
||||
}
|
||||
|
||||
static void sound_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
bSound *sound = reinterpret_cast<bSound *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, sound->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void sound_foreach_cache(ID *id,
|
||||
IDTypeForeachCacheFunctionCallback function_callback,
|
||||
void *user_data)
|
||||
@@ -219,7 +208,7 @@ IDTypeInfo IDType_ID_SO = {
|
||||
/*copy_data*/ sound_copy_data,
|
||||
/*free_data*/ sound_free_data,
|
||||
/*make_local*/ nullptr,
|
||||
/*foreach_id*/ sound_foreach_id,
|
||||
/*foreach_id*/ nullptr,
|
||||
/*foreach_cache*/ sound_foreach_cache,
|
||||
/*foreach_path*/ sound_foreach_path,
|
||||
/*foreach_working_space_color*/ nullptr,
|
||||
|
||||
@@ -136,7 +136,6 @@ static void texture_free_data(ID *id)
|
||||
static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Tex *texture = reinterpret_cast<Tex *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
if (texture->nodetree) {
|
||||
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
||||
@@ -144,10 +143,6 @@ static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
data, BKE_library_foreach_ID_embedded(data, (ID **)&texture->nodetree));
|
||||
}
|
||||
BKE_LIB_FOREACHID_PROCESS_IDSUPER(data, texture->ima, IDWALK_CB_USER);
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, texture->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
|
||||
|
||||
@@ -125,17 +125,12 @@ static void world_copy_data(Main *bmain,
|
||||
static void world_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
World *world = reinterpret_cast<World *>(id);
|
||||
const int flag = BKE_lib_query_foreachid_process_flags_get(data);
|
||||
|
||||
if (world->nodetree) {
|
||||
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
||||
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
|
||||
data, BKE_library_foreach_ID_embedded(data, (ID **)&world->nodetree));
|
||||
}
|
||||
|
||||
if (flag & IDWALK_DO_DEPRECATED_POINTERS) {
|
||||
BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data, world->ipo, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
|
||||
static void world_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
|
||||
|
||||
@@ -145,6 +145,9 @@ struct BlendFileReadReport {
|
||||
int resynced_lib_overrides_libraries_count;
|
||||
bool do_resynced_lib_overrides_libraries_list;
|
||||
LinkNode *resynced_lib_overrides_libraries;
|
||||
|
||||
/** Whether a pre-2.50 blend file was loaded, in which case any animation is lost. */
|
||||
bool pre_animato_file_loaded;
|
||||
};
|
||||
|
||||
/** Skip reading some data-block types (may want to skip screen data too). */
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_grease_pencil_legacy_convert.hh"
|
||||
#include "BKE_idprop.hh"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_lib_id.hh"
|
||||
#include "BKE_lib_override.hh"
|
||||
#include "BKE_library.hh"
|
||||
@@ -34,6 +33,7 @@
|
||||
#include "BKE_node_legacy_types.hh"
|
||||
#include "BKE_node_runtime.hh"
|
||||
#include "BKE_node_tree_update.hh"
|
||||
#include "BKE_report.hh"
|
||||
#include "BKE_screen.hh"
|
||||
|
||||
#include "ANIM_versioning.hh"
|
||||
@@ -713,7 +713,9 @@ void do_versions_after_setup(Main *new_bmain,
|
||||
* the versions of all the linked libraries. */
|
||||
|
||||
if (!blendfile_or_libraries_versions_atleast(new_bmain, 250, 0)) {
|
||||
do_versions_ipos_to_layered_actions(new_bmain);
|
||||
/* This happens here, because at this point in the versioning code there's
|
||||
* 'reports' available. */
|
||||
reports->pre_animato_file_loaded = true;
|
||||
}
|
||||
|
||||
if (!blendfile_or_libraries_versions_atleast(new_bmain, 250, 0)) {
|
||||
|
||||
@@ -2359,41 +2359,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 245, 11)) {
|
||||
Object *ob;
|
||||
|
||||
/* NLA-strips - scale. */
|
||||
for (ob = static_cast<Object *>(bmain->objects.first); ob;
|
||||
ob = static_cast<Object *>(ob->id.next))
|
||||
{
|
||||
LISTBASE_FOREACH (bActionStrip *, strip, &ob->nlastrips) {
|
||||
float length, actlength, repeat;
|
||||
|
||||
if (strip->flag & ACTSTRIP_USESTRIDE) {
|
||||
repeat = 1.0f;
|
||||
}
|
||||
else {
|
||||
repeat = strip->repeat;
|
||||
}
|
||||
|
||||
length = strip->end - strip->start;
|
||||
if (length == 0.0f) {
|
||||
length = 1.0f;
|
||||
}
|
||||
actlength = strip->actend - strip->actstart;
|
||||
|
||||
strip->scale = length / (repeat * actlength);
|
||||
if (strip->scale == 0.0f) {
|
||||
strip->scale = 1.0f;
|
||||
}
|
||||
}
|
||||
if (ob->soft) {
|
||||
ob->soft->inpush = ob->soft->inspring;
|
||||
ob->soft->shearstiff = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 245, 14)) {
|
||||
Scene *sce;
|
||||
|
||||
@@ -2420,7 +2385,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
idproperties_fix_group_lengths(bmain->lattices);
|
||||
idproperties_fix_group_lengths(bmain->lights);
|
||||
idproperties_fix_group_lengths(bmain->cameras);
|
||||
idproperties_fix_group_lengths(bmain->ipo);
|
||||
idproperties_fix_group_lengths(bmain->shapekeys);
|
||||
idproperties_fix_group_lengths(bmain->worlds);
|
||||
idproperties_fix_group_lengths(bmain->screens);
|
||||
@@ -2449,8 +2413,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
|
||||
MEM_freeN(fluidmd->fss);
|
||||
fluidmd->fss = static_cast<FluidsimSettings *>(MEM_dupallocN(ob->fluidsimSettings));
|
||||
fluidmd->fss->ipo = static_cast<Ipo *>(
|
||||
blo_do_versions_newlibadr(fd, &ob->id, ID_IS_LINKED(ob), ob->fluidsimSettings->ipo));
|
||||
MEM_freeN(ob->fluidsimSettings);
|
||||
|
||||
fluidmd->fss->lastgoodframe = INT_MAX;
|
||||
|
||||
@@ -659,7 +659,6 @@ void DepsgraphNodeBuilder::build_id(ID *id, const bool force_be_visible)
|
||||
break;
|
||||
|
||||
case ID_LI:
|
||||
case ID_IP:
|
||||
case ID_SCR:
|
||||
case ID_VF:
|
||||
case ID_BR:
|
||||
|
||||
@@ -599,7 +599,6 @@ void DepsgraphRelationBuilder::build_id(ID *id)
|
||||
break;
|
||||
|
||||
case ID_LI:
|
||||
case ID_IP:
|
||||
case ID_SCR:
|
||||
case ID_VF:
|
||||
case ID_BR:
|
||||
|
||||
@@ -2120,7 +2120,6 @@ int UI_icon_from_idcode(const int idcode)
|
||||
|
||||
/* No icons for these ID-types. */
|
||||
case ID_LI:
|
||||
case ID_IP:
|
||||
case ID_SCR:
|
||||
case ID_WM:
|
||||
break;
|
||||
|
||||
@@ -866,7 +866,6 @@ static StringRef template_id_browse_tip(const StructRNA *type)
|
||||
|
||||
/* Use generic text. */
|
||||
case ID_LI:
|
||||
case ID_IP:
|
||||
case ID_KE:
|
||||
case ID_VF:
|
||||
case ID_GR:
|
||||
|
||||
@@ -629,7 +629,6 @@ static int gather_frames_to_render_for_id(LibraryIDLinkCallbackData *cb_data)
|
||||
case ID_SCE: /* Scene */
|
||||
case ID_LI: /* Library */
|
||||
case ID_OB: /* Object */
|
||||
case ID_IP: /* Ipo (depreciated, replaced by FCurves) */
|
||||
case ID_WO: /* World */
|
||||
case ID_SCR: /* Screen */
|
||||
case ID_GR: /* Group */
|
||||
|
||||
@@ -139,7 +139,6 @@ static void get_element_operation_type(
|
||||
case ID_SPK:
|
||||
case ID_MA:
|
||||
case ID_TE:
|
||||
case ID_IP:
|
||||
case ID_IM:
|
||||
case ID_SO:
|
||||
case ID_KE:
|
||||
|
||||
@@ -92,9 +92,6 @@ std::unique_ptr<TreeElementID> TreeElementID::create_from_id(TreeElement &legacy
|
||||
case ID_PC:
|
||||
case ID_CF:
|
||||
return std::make_unique<TreeElementID>(legacy_te, id);
|
||||
case ID_IP:
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
@@ -666,13 +666,15 @@ typedef struct PreviewImage {
|
||||
|
||||
/* Check whether datablock type is covered by copy-on-evaluation. */
|
||||
#define ID_TYPE_USE_COPY_ON_EVAL(_id_type) \
|
||||
(!ELEM(_id_type, ID_LI, ID_IP, ID_SCR, ID_VF, ID_BR, ID_WM, ID_PAL, ID_PC, ID_WS, ID_IM))
|
||||
(!ELEM(_id_type, ID_LI, ID_SCR, ID_VF, ID_BR, ID_WM, ID_PAL, ID_PC, ID_WS, ID_IM))
|
||||
|
||||
/* Check whether data-block type requires copy-on-evaluation from #ID_RECALC_PARAMETERS.
|
||||
* Keep in sync with #BKE_id_eval_properties_copy. */
|
||||
#define ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(id_type) ELEM(id_type, ID_ME)
|
||||
|
||||
#define ID_TYPE_IS_DEPRECATED(id_type) ELEM(id_type, ID_IP)
|
||||
/* This used to be ELEM(id_type, ID_IP), currently there is no deprecated ID
|
||||
* type. ID_IP was removed in Blender 5.0. */
|
||||
#define ID_TYPE_IS_DEPRECATED(id_type) false
|
||||
|
||||
#ifdef GS
|
||||
# undef GS
|
||||
@@ -1202,7 +1204,6 @@ typedef enum eID_Index {
|
||||
INDEX_ID_LI = 0,
|
||||
|
||||
/* Animation types, might be used by almost all other types. */
|
||||
INDEX_ID_IP, /* Deprecated. */
|
||||
INDEX_ID_AC,
|
||||
|
||||
/* Grease Pencil, special case, should be with the other obdata, but it can also be used by many
|
||||
|
||||
@@ -126,7 +126,6 @@ typedef enum ID_Type {
|
||||
ID_LT = MAKE_ID2('L', 'T'), /* Lattice */
|
||||
ID_LA = MAKE_ID2('L', 'A'), /* Light */
|
||||
ID_CA = MAKE_ID2('C', 'A'), /* Camera */
|
||||
ID_IP = MAKE_ID2('I', 'P'), /* Ipo (depreciated, replaced by FCurves) */
|
||||
ID_KE = MAKE_ID2('K', 'E'), /* Key (shape key) */
|
||||
ID_WO = MAKE_ID2('W', 'O'), /* World */
|
||||
ID_SCR = MAKE_ID2('S', 'R'), /* bScreen */
|
||||
|
||||
@@ -814,8 +814,6 @@ typedef struct bAction {
|
||||
|
||||
/** Legacy F-Curves (FCurve), introduced in Blender 2.5. */
|
||||
ListBase curves;
|
||||
/** Legacy Action Channels (bActionChannel) from pre-2.5 animation system. */
|
||||
ListBase chanbase DNA_DEPRECATED;
|
||||
/** Legacy Groups of function-curves (bActionGroup), introduced in Blender 2.5. */
|
||||
ListBase groups;
|
||||
|
||||
@@ -1109,38 +1107,6 @@ typedef enum eTimeline_Cache_Flag {
|
||||
TIME_CACHE_SIMULATION_NODES = (1 << 7),
|
||||
} eTimeline_Cache_Flag;
|
||||
|
||||
/* ************************************************ */
|
||||
/* Legacy Data */
|
||||
|
||||
/* WARNING: Action Channels are now deprecated... they were part of the old animation system!
|
||||
* (ONLY USED FOR DO_VERSIONS...)
|
||||
*
|
||||
* Action Channels belong to Actions. They are linked with an IPO block, and can also own
|
||||
* Constraint Channels in certain situations.
|
||||
*
|
||||
* Action-Channels can only belong to one group at a time, but they still live the Action's
|
||||
* list of achans (to preserve backwards compatibility, and also minimize the code
|
||||
* that would need to be recoded). Grouped achans are stored at the start of the list, according
|
||||
* to the position of the group in the list, and their position within the group.
|
||||
*/
|
||||
typedef struct bActionChannel {
|
||||
struct bActionChannel *next, *prev;
|
||||
/** Action Group this Action Channel belongs to. */
|
||||
bActionGroup *grp;
|
||||
|
||||
/** IPO block this action channel references. */
|
||||
struct Ipo *ipo;
|
||||
/** Constraint Channels (when Action Channel represents an Object or Bone). */
|
||||
ListBase constraintChannels;
|
||||
|
||||
/** Settings accessed via bitmapping. */
|
||||
int flag;
|
||||
/** Channel name. */
|
||||
char name[/*MAX_NAME*/ 64];
|
||||
/** Temporary setting - may be used to indicate group that channel belongs to during syncing. */
|
||||
int temp;
|
||||
} bActionChannel;
|
||||
|
||||
/* ************************************************ */
|
||||
/* Layered Animation data-types. */
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "DNA_movieclip_types.h"
|
||||
|
||||
struct AnimData;
|
||||
struct Ipo;
|
||||
struct Object;
|
||||
|
||||
/* ------------------------------------------- */
|
||||
@@ -125,9 +124,6 @@ typedef struct Camera {
|
||||
int custom_mode;
|
||||
int _pad3;
|
||||
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
|
||||
struct Object *dof_ob DNA_DEPRECATED;
|
||||
struct GPUDOFSettings gpu_dof DNA_DEPRECATED;
|
||||
struct CameraDOFSettings dof;
|
||||
|
||||
@@ -13,18 +13,8 @@
|
||||
#include "DNA_defs.h"
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
struct Ipo;
|
||||
struct Text;
|
||||
|
||||
/* channels reside in Object or Action (ListBase) constraintChannels */
|
||||
/* XXX: deprecated... old AnimSys. */
|
||||
typedef struct bConstraintChannel {
|
||||
struct bConstraintChannel *next, *prev;
|
||||
struct Ipo *ipo;
|
||||
short flag;
|
||||
char name[30];
|
||||
} bConstraintChannel;
|
||||
|
||||
/** A Constraint. */
|
||||
typedef struct bConstraint {
|
||||
struct bConstraint *next, *prev;
|
||||
@@ -57,10 +47,6 @@ typedef struct bConstraint {
|
||||
/** Point along `subtarget` bone where the actual target is. 0=head (default for all), 1=tail. */
|
||||
float headtail;
|
||||
|
||||
/* old animation system, deprecated for 2.5. */
|
||||
/** Local influence ipo or driver */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
|
||||
/* Below are read-only fields that are set at runtime
|
||||
* by the solver for use in the GE (only IK at the moment). */
|
||||
/** Residual error on constraint expressed in blender unit. */
|
||||
|
||||
@@ -23,7 +23,6 @@ struct Curves;
|
||||
struct CurveProfile;
|
||||
struct EditFont;
|
||||
struct GHash;
|
||||
struct Ipo;
|
||||
struct Key;
|
||||
struct Material;
|
||||
struct Object;
|
||||
@@ -219,8 +218,6 @@ typedef struct Curve {
|
||||
EditNurb *editnurb;
|
||||
|
||||
struct Object *bevobj, *taperobj, *textoncurve;
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
struct Key *key;
|
||||
struct Material **mat;
|
||||
|
||||
|
||||
@@ -1,514 +0,0 @@
|
||||
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup DNA
|
||||
* \deprecated
|
||||
* The contents of this file are now officially deprecated.
|
||||
* They were used for the 'old' animation system,
|
||||
* which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith).
|
||||
* All defines, etc. are only still maintained to provide backwards compatibility for old files.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_listBase.h"
|
||||
#include "DNA_vec_types.h"
|
||||
|
||||
#include "DNA_ID.h"
|
||||
|
||||
#include "BLI_compiler_attrs.h"
|
||||
|
||||
/* -------------------------- Type Defines --------------------------- */
|
||||
|
||||
/* --- IPO Curve Driver --- */
|
||||
|
||||
/* IPO Curve Driver */
|
||||
typedef struct IpoDriver {
|
||||
/** Target/driver ob. */
|
||||
struct Object *ob;
|
||||
/** Sub-channel to use. */
|
||||
short blocktype, adrcode;
|
||||
|
||||
/** Driver settings. */
|
||||
short type, flag;
|
||||
/** Bone, or python expression here. */
|
||||
char name[128];
|
||||
} IpoDriver;
|
||||
|
||||
/* --- IPO Curve --- */
|
||||
|
||||
/* IPO Curve */
|
||||
typedef struct IpoCurve {
|
||||
struct IpoCurve *next, *prev;
|
||||
|
||||
/** Array of #BPoints `(sizeof(BPoint) * totvert)` - i.e. baked/imported data. */
|
||||
struct BPoint *bp;
|
||||
/** Array of #BezTriples `(sizeof(BezTriple) * totvert)` - i.e. user-editable keyframes. */
|
||||
struct BezTriple *bezt;
|
||||
|
||||
/** Bounding boxes. */
|
||||
rctf maxrct, totrct;
|
||||
|
||||
/** Block-type of the curve (#ID_Type). */
|
||||
short blocktype;
|
||||
/** Type of ipo-curve. */
|
||||
short adrcode;
|
||||
/** Format of data. */
|
||||
short vartype;
|
||||
/** Total number of BezTriples (i.e. keyframes) on curve. */
|
||||
short totvert;
|
||||
/** Interpolation and extrapolation modes. */
|
||||
short ipo, extrap;
|
||||
/** Flag= settings. */
|
||||
short flag;
|
||||
char _pad0[2];
|
||||
/** Minimum/maximum y-extents for curve. */
|
||||
float ymin, ymax;
|
||||
/** Unused since the first available revision. */
|
||||
unsigned int bitmask;
|
||||
|
||||
/** Minimum/maximum values for sliders (in action editor). */
|
||||
float slide_min, slide_max;
|
||||
/** Value of ipo-curve for current frame. */
|
||||
float curval;
|
||||
|
||||
/** Pointer to ipo-driver for this curve. */
|
||||
IpoDriver *driver;
|
||||
} IpoCurve;
|
||||
|
||||
/* --- ID-Datablock --- */
|
||||
|
||||
/* IPO Data-Block */
|
||||
typedef struct Ipo {
|
||||
#ifdef __cplusplus
|
||||
/** See #ID_Type comment for why this is here. */
|
||||
static constexpr ID_Type id_type = ID_IP;
|
||||
#endif
|
||||
|
||||
ID id;
|
||||
|
||||
/** A list of IpoCurve structs in a linked list. */
|
||||
ListBase curve;
|
||||
/** Rect defining extents of keyframes? */
|
||||
rctf cur;
|
||||
|
||||
/** #ID_Type. */
|
||||
short blocktype;
|
||||
/** Either 0 or 1 (show vertical yellow lines for editing). */
|
||||
short showkey;
|
||||
/** Mute-IPO: either 0 or 1 (whether ipo block is muted). */
|
||||
short muteipo;
|
||||
char _pad[2];
|
||||
} Ipo;
|
||||
|
||||
/* ----------- adrcodes (for matching ipo-curves to data) ------------- */
|
||||
|
||||
/* defines: are these duped or new? */
|
||||
#define IPOBUTY 17
|
||||
|
||||
#define TOB_IPO 1
|
||||
#define TOB_IPODROT 2
|
||||
|
||||
/* disptype */
|
||||
#define IPO_DISPDEGR 1
|
||||
#define IPO_DISPBITS 2
|
||||
#define IPO_DISPTIME 3
|
||||
|
||||
/* ********** Object (ID_OB) ********** */
|
||||
|
||||
#define OB_TOTIPO 30
|
||||
#define OB_TOTNAM 30
|
||||
|
||||
#define OB_LOC_X 1
|
||||
#define OB_LOC_Y 2
|
||||
#define OB_LOC_Z 3
|
||||
#define OB_DLOC_X 4
|
||||
#define OB_DLOC_Y 5
|
||||
#define OB_DLOC_Z 6
|
||||
|
||||
#define OB_ROT_X 7
|
||||
#define OB_ROT_Y 8
|
||||
#define OB_ROT_Z 9
|
||||
#define OB_DROT_X 10
|
||||
#define OB_DROT_Y 11
|
||||
#define OB_DROT_Z 12
|
||||
|
||||
#define OB_SIZE_X 13
|
||||
#define OB_SIZE_Y 14
|
||||
#define OB_SIZE_Z 15
|
||||
#define OB_DSIZE_X 16
|
||||
#define OB_DSIZE_Y 17
|
||||
#define OB_DSIZE_Z 18
|
||||
|
||||
#define OB_LAY 19
|
||||
|
||||
#define OB_TIME 20
|
||||
|
||||
#define OB_COL_R 21
|
||||
#define OB_COL_G 22
|
||||
#define OB_COL_B 23
|
||||
#define OB_COL_A 24
|
||||
|
||||
#define OB_PD_FSTR 25
|
||||
#define OB_PD_FFALL 26
|
||||
#define OB_PD_SDAMP 27
|
||||
#define OB_PD_RDAMP 28
|
||||
#define OB_PD_PERM 29
|
||||
#define OB_PD_FMAXD 30
|
||||
|
||||
/* exception: driver channel, for bone driver only */
|
||||
#define OB_ROT_DIFF 100
|
||||
|
||||
/* ********** Material (ID_MA) ********** */
|
||||
|
||||
#define MA_TOTIPO 40
|
||||
#define MA_TOTNAM 26
|
||||
|
||||
#define MA_COL_R 1
|
||||
#define MA_COL_G 2
|
||||
#define MA_COL_B 3
|
||||
#define MA_SPEC_R 4
|
||||
#define MA_SPEC_G 5
|
||||
#define MA_SPEC_B 6
|
||||
#define MA_MIR_R 7
|
||||
#define MA_MIR_G 8
|
||||
#define MA_MIR_B 9
|
||||
#define MA_REF 10
|
||||
#define MA_ALPHA 11
|
||||
#define MA_EMIT 12
|
||||
#define MA_AMB 13
|
||||
#define MA_SPEC 14
|
||||
#define MA_HARD 15
|
||||
#define MA_SPTR 16
|
||||
#define MA_IOR 17
|
||||
#define MA_MODE 18
|
||||
#define MA_HASIZE 19
|
||||
#define MA_TRANSLU 20
|
||||
#define MA_RAYM 21
|
||||
#define MA_FRESMIR 22
|
||||
#define MA_FRESMIRI 23
|
||||
#define MA_FRESTRA 24
|
||||
#define MA_FRESTRAI 25
|
||||
#define MA_ADD 26
|
||||
|
||||
#define MA_MAP1 (1 << 5)
|
||||
#define MA_MAP2 (1 << 6)
|
||||
#define MA_MAP3 (1 << 7)
|
||||
#define MA_MAP4 (1 << 8)
|
||||
#define MA_MAP5 (1 << 9)
|
||||
#define MA_MAP6 (1 << 10)
|
||||
#define MA_MAP7 (1 << 11)
|
||||
#define MA_MAP8 (1 << 12)
|
||||
#define MA_MAP9 (1 << 13)
|
||||
#define MA_MAP10 (1 << 14)
|
||||
#define MA_MAP11 (1 << 15)
|
||||
#define MA_MAP12 (1 << 16)
|
||||
#define MA_MAP13 (1 << 17)
|
||||
#define MA_MAP14 (1 << 18)
|
||||
#define MA_MAP15 (1 << 19)
|
||||
#define MA_MAP16 (1 << 20)
|
||||
#define MA_MAP17 (1 << 21)
|
||||
#define MA_MAP18 (1 << 22)
|
||||
|
||||
/* ********** Texture Slots (MTex) ********** */
|
||||
|
||||
#define TEX_TOTNAM 14
|
||||
|
||||
#define MAP_OFS_X 1
|
||||
#define MAP_OFS_Y 2
|
||||
#define MAP_OFS_Z 3
|
||||
#define MAP_SIZE_X 4
|
||||
#define MAP_SIZE_Y 5
|
||||
#define MAP_SIZE_Z 6
|
||||
#define MAP_R 7
|
||||
#define MAP_G 8
|
||||
#define MAP_B 9
|
||||
|
||||
#define MAP_DVAR 10
|
||||
#define MAP_COLF 11
|
||||
#define MAP_NORF 12
|
||||
#define MAP_VARF 13
|
||||
#define MAP_DISP 14
|
||||
|
||||
/* ********** Texture (ID_TE) ********** */
|
||||
|
||||
#define TE_TOTIPO 26
|
||||
#define TE_TOTNAM 26
|
||||
|
||||
#define TE_NSIZE 1
|
||||
#define TE_NDEPTH 2
|
||||
#define TE_NTYPE 3
|
||||
#define TE_TURB 4
|
||||
|
||||
#define TE_VNW1 5
|
||||
#define TE_VNW2 6
|
||||
#define TE_VNW3 7
|
||||
#define TE_VNW4 8
|
||||
#define TE_VNMEXP 9
|
||||
#define TE_VN_DISTM 10
|
||||
#define TE_VN_COLT 11
|
||||
|
||||
#define TE_ISCA 12
|
||||
#define TE_DISTA 13
|
||||
|
||||
#define TE_MG_TYP 14
|
||||
#define TE_MGH 15
|
||||
#define TE_MG_LAC 16
|
||||
#define TE_MG_OCT 17
|
||||
#define TE_MG_OFF 18
|
||||
#define TE_MG_GAIN 19
|
||||
|
||||
#define TE_N_BAS1 20
|
||||
#define TE_N_BAS2 21
|
||||
|
||||
#define TE_COL_R 22
|
||||
#define TE_COL_G 23
|
||||
#define TE_COL_B 24
|
||||
#define TE_BRIGHT 25
|
||||
#define TE_CONTRA 26
|
||||
|
||||
/* ******** Sequence (ID_SEQ) ********** */
|
||||
|
||||
#define STRIP_TOTIPO 1
|
||||
#define STRIP_TOTNAM 1
|
||||
|
||||
#define STRIP_FAC1 1
|
||||
#define STRIP_FAC_SPEED 2
|
||||
#define STRIP_FAC_OPACITY 3
|
||||
|
||||
/* ********* Curve (ID_CU_LEGACY) *********** */
|
||||
|
||||
#define CU_TOTIPO 1
|
||||
#define CU_TOTNAM 1
|
||||
|
||||
#define CU_SPEED 1
|
||||
|
||||
/* ********* ShapeKey (ID_KE) *********** */
|
||||
|
||||
#define KEY_TOTIPO 64
|
||||
#define KEY_TOTNAM 64
|
||||
|
||||
#define KEY_SPEED 0
|
||||
#define KEY_NR 1
|
||||
|
||||
/* ********* World (ID_WO) *********** */
|
||||
|
||||
#define WO_TOTIPO 29
|
||||
#define WO_TOTNAM 16
|
||||
|
||||
#define WO_HOR_R 1
|
||||
#define WO_HOR_G 2
|
||||
#define WO_HOR_B 3
|
||||
#define WO_ZEN_R 4
|
||||
#define WO_ZEN_G 5
|
||||
#define WO_ZEN_B 6
|
||||
|
||||
#define WO_EXPOS 7
|
||||
|
||||
#define WO_MISI 8
|
||||
#define WO_MISTDI 9
|
||||
#define WO_MISTSTA 10
|
||||
#define WO_MISTHI 11
|
||||
|
||||
/* Stars are deprecated & unused. */
|
||||
// #define WO_STAR_R 12
|
||||
// #define WO_STAR_G 13
|
||||
// #define WO_STAR_B 14
|
||||
// #define WO_STARDIST 15
|
||||
// #define WO_STARSIZE 16
|
||||
|
||||
/* ********** Light (ID_LA) ********** */
|
||||
|
||||
#define LA_TOTIPO 21
|
||||
#define LA_TOTNAM 10
|
||||
|
||||
#define LA_ENERGY 1
|
||||
#define LA_COL_R 2
|
||||
#define LA_COL_G 3
|
||||
#define LA_COL_B 4
|
||||
#define LA_DIST 5
|
||||
#define LA_SPOTSI 6
|
||||
#define LA_SPOTBL 7
|
||||
#define LA_QUAD1 8
|
||||
#define LA_QUAD2 9
|
||||
#define LA_HALOINT 10
|
||||
|
||||
/* ********* Camera (ID_CA) ************ */
|
||||
|
||||
#define CAM_TOTIPO 7
|
||||
#define CAM_TOTNAM 7
|
||||
|
||||
#define CAM_LENS 1
|
||||
#define CAM_STA 2
|
||||
#define CAM_END 3
|
||||
|
||||
/* YAFRAY aperture & focal distance curves. */
|
||||
#define CAM_YF_APERT 4
|
||||
#define CAM_YF_FDIST 5
|
||||
|
||||
#define CAM_SHIFT_X 6
|
||||
#define CAM_SHIFT_Y 7
|
||||
|
||||
/* ********* Sound (ID_SO) *********** */
|
||||
|
||||
#define SND_TOTIPO 4
|
||||
#define SND_TOTNAM 4
|
||||
|
||||
#define SND_VOLUME 1
|
||||
#define SND_PITCH 2
|
||||
#define SND_PANNING 3
|
||||
#define SND_ATTEN 4
|
||||
|
||||
/* ******* PoseChannel (ID_PO) ********* */
|
||||
|
||||
#define AC_TOTIPO 13
|
||||
#define AC_TOTNAM 13
|
||||
|
||||
#define AC_LOC_X 1
|
||||
#define AC_LOC_Y 2
|
||||
#define AC_LOC_Z 3
|
||||
|
||||
#define AC_SIZE_X 13
|
||||
#define AC_SIZE_Y 14
|
||||
#define AC_SIZE_Z 15
|
||||
|
||||
#define AC_EUL_X 16
|
||||
#define AC_EUL_Y 17
|
||||
#define AC_EUL_Z 18
|
||||
|
||||
#define AC_QUAT_W 25
|
||||
#define AC_QUAT_X 26
|
||||
#define AC_QUAT_Y 27
|
||||
#define AC_QUAT_Z 28
|
||||
|
||||
/* ******** Constraint (ID_CO) ********** */
|
||||
|
||||
#define CO_TOTIPO 2
|
||||
#define CO_TOTNAM 2
|
||||
|
||||
#define CO_ENFORCE 1
|
||||
#define CO_HEADTAIL 2
|
||||
|
||||
/* ****** FluidSim (ID_FLUIDSIM) ****** */
|
||||
|
||||
#define FLUIDSIM_TOTIPO 13
|
||||
#define FLUIDSIM_TOTNAM 13
|
||||
|
||||
#define FLUIDSIM_VISC 1
|
||||
#define FLUIDSIM_TIME 2
|
||||
|
||||
#define FLUIDSIM_GRAV_X 3
|
||||
#define FLUIDSIM_GRAV_Y 4
|
||||
#define FLUIDSIM_GRAV_Z 5
|
||||
|
||||
#define FLUIDSIM_VEL_X 6
|
||||
#define FLUIDSIM_VEL_Y 7
|
||||
#define FLUIDSIM_VEL_Z 8
|
||||
|
||||
#define FLUIDSIM_ACTIVE 9
|
||||
|
||||
#define FLUIDSIM_ATTR_FORCE_STR 10
|
||||
#define FLUIDSIM_ATTR_FORCE_RADIUS 11
|
||||
#define FLUIDSIM_VEL_FORCE_STR 12
|
||||
#define FLUIDSIM_VEL_FORCE_RADIUS 13
|
||||
|
||||
/* ******************** */
|
||||
/* particle ipos */
|
||||
|
||||
/* ******* Particle (ID_PA) ******** */
|
||||
#define PART_TOTIPO 25
|
||||
#define PART_TOTNAM 25
|
||||
|
||||
#define PART_EMIT_FREQ 1
|
||||
// #define PART_EMIT_LIFE 2 /* UNUSED */
|
||||
#define PART_EMIT_VEL 3
|
||||
#define PART_EMIT_AVE 4
|
||||
// #define PART_EMIT_SIZE 5 /* UNUSED */
|
||||
|
||||
#define PART_AVE 6
|
||||
#define PART_SIZE 7
|
||||
#define PART_DRAG 8
|
||||
#define PART_BROWN 9
|
||||
#define PART_DAMP 10
|
||||
#define PART_LENGTH 11
|
||||
#define PART_CLUMP 12
|
||||
|
||||
#define PART_GRAV_X 13
|
||||
#define PART_GRAV_Y 14
|
||||
#define PART_GRAV_Z 15
|
||||
|
||||
#define PART_KINK_AMP 16
|
||||
#define PART_KINK_FREQ 17
|
||||
#define PART_KINK_SHAPE 18
|
||||
|
||||
#define PART_BB_TILT 19
|
||||
|
||||
#define PART_PD_FSTR 20
|
||||
#define PART_PD_FFALL 21
|
||||
#define PART_PD_FMAXD 22
|
||||
|
||||
#define PART_PD2_FSTR 23
|
||||
#define PART_PD2_FFALL 24
|
||||
#define PART_PD2_FMAXD 25
|
||||
|
||||
/* -------------------- Defines: Flags and Types ------------------ */
|
||||
|
||||
/* ----- IPO Curve Defines ------- */
|
||||
|
||||
/* icu->vartype */
|
||||
#define IPO_CHAR 0
|
||||
#define IPO_SHORT 1
|
||||
#define IPO_INT 2
|
||||
#define IPO_LONG 3
|
||||
#define IPO_FLOAT 4
|
||||
#define IPO_DOUBLE 5
|
||||
#define IPO_FLOAT_DEGR 6
|
||||
|
||||
/* very special case, in keys */
|
||||
#define IPO_BEZTRIPLE 100
|
||||
#define IPO_BPOINT 101
|
||||
|
||||
/* icu->vartype */
|
||||
#define IPO_BITS 16
|
||||
#define IPO_CHAR_BIT 16
|
||||
#define IPO_SHORT_BIT 17
|
||||
#define IPO_INT_BIT 18
|
||||
|
||||
/* icu->ipo: the type of curve. */
|
||||
#define IPO_CONST 0
|
||||
#define IPO_LIN 1
|
||||
#define IPO_BEZ 2
|
||||
/* not used yet */
|
||||
#define IPO_MIXED 3
|
||||
|
||||
/* icu->extrap */
|
||||
#define IPO_HORIZ 0
|
||||
#define IPO_DIR 1
|
||||
#define IPO_CYCL 2
|
||||
#define IPO_CYCLX 3
|
||||
|
||||
/* icu->flag */
|
||||
#define IPO_VISIBLE 1
|
||||
#define IPO_SELECT 2
|
||||
#define IPO_EDIT 4
|
||||
#define IPO_LOCK 8
|
||||
#define IPO_AUTO_HORIZ 16
|
||||
#define IPO_ACTIVE 32
|
||||
#define IPO_PROTECT 64
|
||||
#define IPO_MUTE 128
|
||||
|
||||
/* ---------- IPO Drivers ----------- */
|
||||
|
||||
/** Offset in driver->name for finding second pose-channel for rot-diff. */
|
||||
#define DRIVER_NAME_OFFS 32
|
||||
|
||||
/* driver->type */
|
||||
#define IPO_DRIVER_TYPE_NORMAL 0
|
||||
#define IPO_DRIVER_TYPE_PYTHON 1
|
||||
|
||||
/* driver->flag */
|
||||
/** Invalid flag: currently only used for invalid Python-driver expressions. */
|
||||
#define IPO_DRIVER_FLAG_INVALID (1 << 0)
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
struct AnimData;
|
||||
struct Ipo;
|
||||
|
||||
/**
|
||||
* The struct that holds the data for an individual Shape Key. Depending on which object owns the
|
||||
@@ -90,8 +89,6 @@ typedef struct Key {
|
||||
|
||||
/** A list of KeyBlock's. */
|
||||
ListBase block;
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
|
||||
ID *from;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
struct AnimData;
|
||||
struct BPoint;
|
||||
struct Ipo;
|
||||
struct Key;
|
||||
struct MDeformVert;
|
||||
|
||||
@@ -55,8 +54,6 @@ typedef struct Lattice {
|
||||
|
||||
struct BPoint *def;
|
||||
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
struct Key *key;
|
||||
|
||||
struct MDeformVert *dvert;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#endif
|
||||
|
||||
struct AnimData;
|
||||
struct Ipo;
|
||||
struct bNodeTree;
|
||||
|
||||
typedef struct Light {
|
||||
@@ -87,7 +86,6 @@ typedef struct Light {
|
||||
struct bNodeTree *nodetree;
|
||||
|
||||
/* Deprecated. */
|
||||
struct Ipo *ipo DNA_DEPRECATED; /* Old animation system. */
|
||||
float energy_deprecated DNA_DEPRECATED;
|
||||
float _pad2;
|
||||
} Light;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
struct AnimData;
|
||||
struct Image;
|
||||
struct Ipo;
|
||||
struct bNodeTree;
|
||||
|
||||
/* WATCH IT: change type? also make changes in ipo.h */
|
||||
@@ -200,8 +199,6 @@ typedef struct Material {
|
||||
short index;
|
||||
|
||||
struct bNodeTree *nodetree;
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
struct PreviewImage *preview;
|
||||
|
||||
/* Freestyle line settings. */
|
||||
|
||||
@@ -49,7 +49,6 @@ typedef struct MeshRuntimeHandle MeshRuntimeHandle;
|
||||
#endif
|
||||
|
||||
struct AnimData;
|
||||
struct Ipo;
|
||||
struct Key;
|
||||
struct MCol;
|
||||
struct MEdge;
|
||||
@@ -67,8 +66,6 @@ typedef struct Mesh {
|
||||
/** Animation data (must be immediately after id for utilities to use it). */
|
||||
struct AnimData *adt;
|
||||
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
struct Key *key;
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
struct AnimData;
|
||||
struct BoundBox;
|
||||
struct Ipo;
|
||||
struct Material;
|
||||
|
||||
typedef struct MetaElem {
|
||||
@@ -58,8 +57,6 @@ typedef struct MetaBall {
|
||||
ListBase elems;
|
||||
/** Not saved in files, note we use pointer for editmode check. */
|
||||
ListBase *editelems;
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
|
||||
/* material of the mother ball will define the material used of all others */
|
||||
struct Material **mat;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include "DNA_listBase.h"
|
||||
|
||||
struct Ipo;
|
||||
struct Object;
|
||||
struct bAction;
|
||||
|
||||
@@ -43,8 +42,6 @@ typedef struct bActionStrip {
|
||||
/** Current modifier for buttons. */
|
||||
short curmod;
|
||||
|
||||
/** Blending ipo - was used for some old NAN era experiments. Non-functional currently. */
|
||||
struct Ipo *ipo;
|
||||
/** The action referenced by this strip. */
|
||||
struct bAction *act;
|
||||
/** For groups, the actual object being nla'ed. */
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_defs.h"
|
||||
|
||||
struct Ipo;
|
||||
|
||||
typedef struct FluidVertexVelocity {
|
||||
float vel[3];
|
||||
} FluidVertexVelocity;
|
||||
@@ -69,9 +67,6 @@ typedef struct FluidsimSettings {
|
||||
/* values are initialized during derived mesh display. */
|
||||
float bbStart[3], bbSize[3];
|
||||
|
||||
/** Animated parameters. */
|
||||
struct Ipo *ipo;
|
||||
|
||||
/* additional flags depending on the type, lower short contains flags
|
||||
* to check validity, higher short additional flags */
|
||||
short typeFlags;
|
||||
|
||||
@@ -43,7 +43,6 @@ struct Collection;
|
||||
struct Curve;
|
||||
struct FluidsimSettings;
|
||||
struct ImageUser;
|
||||
struct Ipo;
|
||||
struct LightgroupMembership;
|
||||
struct Material;
|
||||
struct Object;
|
||||
@@ -213,10 +212,7 @@ typedef struct Object {
|
||||
struct Object *proxy DNA_DEPRECATED;
|
||||
struct Object *proxy_group DNA_DEPRECATED;
|
||||
struct Object *proxy_from DNA_DEPRECATED;
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
// struct Path *path;
|
||||
struct bAction *action DNA_DEPRECATED; /* XXX deprecated... old animation system */
|
||||
struct bAction *poselib DNA_DEPRECATED; /* Pre-Blender 3.0 pose library, deprecated in 3.5. */
|
||||
/** Pose data, armature objects only. */
|
||||
struct bPose *pose;
|
||||
@@ -233,10 +229,9 @@ typedef struct Object {
|
||||
bMotionPath *mpath;
|
||||
void *_pad0;
|
||||
|
||||
ListBase constraintChannels DNA_DEPRECATED; /* XXX deprecated... old animation system */
|
||||
ListBase effect DNA_DEPRECATED; /* XXX deprecated... keep for readfile */
|
||||
ListBase defbase DNA_DEPRECATED; /* Only for versioning, moved to object data. */
|
||||
ListBase fmaps DNA_DEPRECATED; /* For versioning, moved to generic attributes. */
|
||||
ListBase effect DNA_DEPRECATED; /* XXX deprecated... keep for readfile */
|
||||
ListBase defbase DNA_DEPRECATED; /* Only for versioning, moved to object data. */
|
||||
ListBase fmaps DNA_DEPRECATED; /* For versioning, moved to generic attributes. */
|
||||
/** List of ModifierData structures. */
|
||||
ListBase modifiers;
|
||||
/** List of GpencilModifierData structures. */
|
||||
@@ -347,8 +342,7 @@ typedef struct Object {
|
||||
|
||||
/** Object constraints. */
|
||||
ListBase constraints;
|
||||
ListBase nlastrips DNA_DEPRECATED; /* XXX deprecated... old animation system */
|
||||
ListBase hooks DNA_DEPRECATED; /* XXX deprecated... old animation system */
|
||||
ListBase hooks DNA_DEPRECATED;
|
||||
/** Particle systems. */
|
||||
ListBase particlesystem;
|
||||
|
||||
|
||||
@@ -279,8 +279,6 @@ typedef struct ParticleSettings {
|
||||
struct Collection *force_group DNA_DEPRECATED; /* deprecated */
|
||||
struct Object *instance_object;
|
||||
struct Object *bb_ob;
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
struct PartDeflect *pd;
|
||||
struct PartDeflect *pd2;
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "DNA_session_uid_types.h" /* for #SessionUID */
|
||||
#include "DNA_vec_types.h" /* for #rctf */
|
||||
|
||||
struct Ipo;
|
||||
struct MovieClip;
|
||||
struct Scene;
|
||||
struct VFont;
|
||||
@@ -210,9 +209,6 @@ typedef struct Strip {
|
||||
|
||||
StripData *data;
|
||||
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo_legacy DNA_DEPRECATED;
|
||||
|
||||
/** These ID vars should never be NULL but can be when linked libraries fail to load,
|
||||
* so check on access. */
|
||||
/* For SCENE strips. */
|
||||
@@ -300,6 +296,8 @@ typedef struct Strip {
|
||||
int retiming_keys_num;
|
||||
char _pad6[4];
|
||||
|
||||
void *_pad10;
|
||||
|
||||
StripRuntime runtime;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_defs.h"
|
||||
|
||||
struct Ipo;
|
||||
struct PackedFile;
|
||||
|
||||
typedef struct bSound {
|
||||
@@ -40,7 +39,7 @@ typedef struct bSound {
|
||||
* Deprecated; used for loading pre 2.5 files.
|
||||
*/
|
||||
struct PackedFile *newpackedfile;
|
||||
struct Ipo *ipo;
|
||||
void *_pad0;
|
||||
|
||||
float volume;
|
||||
float attenuation;
|
||||
|
||||
@@ -17,7 +17,6 @@ struct AnimData;
|
||||
struct ColorBand;
|
||||
struct CurveMapping;
|
||||
struct Image;
|
||||
struct Ipo;
|
||||
struct Object;
|
||||
struct PreviewImage;
|
||||
struct Tex;
|
||||
@@ -128,8 +127,6 @@ typedef struct Tex {
|
||||
struct ImageUser iuser;
|
||||
|
||||
struct bNodeTree *nodetree;
|
||||
/* old animation system, deprecated for 2.5 */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
struct Image *ima;
|
||||
struct ColorBand *coba;
|
||||
struct PreviewImage *preview;
|
||||
@@ -137,8 +134,6 @@ typedef struct Tex {
|
||||
char use_nodes;
|
||||
char _pad[7];
|
||||
|
||||
void *_pad3;
|
||||
|
||||
Tex_Runtime runtime;
|
||||
} Tex;
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "DNA_defs.h"
|
||||
|
||||
struct AnimData;
|
||||
struct Ipo;
|
||||
struct LightgroupMembership;
|
||||
struct bNodeTree;
|
||||
|
||||
@@ -76,8 +75,6 @@ typedef struct World {
|
||||
float sun_shadow_filter_radius;
|
||||
char _pad4[4];
|
||||
|
||||
/** Old animation system, deprecated for 2.5. */
|
||||
struct Ipo *ipo DNA_DEPRECATED;
|
||||
short pr_texture;
|
||||
short use_nodes DNA_DEPRECATED;
|
||||
char _pad[4];
|
||||
@@ -91,8 +88,6 @@ typedef struct World {
|
||||
/** Light-group membership information. */
|
||||
struct LightgroupMembership *lightgroup;
|
||||
|
||||
void *_pad1;
|
||||
|
||||
/** Runtime. */
|
||||
ListBase gpumaterial;
|
||||
/* The Depsgraph::update_count when this World was last updated. */
|
||||
|
||||
@@ -208,7 +208,6 @@ DNA_STRUCT_RENAME_MEMBER(SpaceNode, geometry_nodes_tool_tree, selected_node_grou
|
||||
DNA_STRUCT_RENAME_MEMBER(SpaceSeq, overlay_type, overlay_frame_type)
|
||||
DNA_STRUCT_RENAME_MEMBER(SpeedControlVars, globalSpeed, globalSpeed_legacy)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, endstill, endstill_legacy)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, ipo, ipo_legacy)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, machine, channel)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, pitch, pitch_legacy)
|
||||
DNA_STRUCT_RENAME_MEMBER(Strip, retiming_handle_num, retiming_keys_num)
|
||||
|
||||
@@ -568,10 +568,6 @@ StructRNA *ID_code_to_RNA_type(short idcode)
|
||||
return &RNA_World;
|
||||
case ID_WS:
|
||||
return &RNA_WorkSpace;
|
||||
|
||||
/* deprecated */
|
||||
case ID_IP:
|
||||
break;
|
||||
}
|
||||
|
||||
return &RNA_ID;
|
||||
|
||||
@@ -1041,6 +1041,14 @@ static void file_read_reports_finalize(BlendFileReadReport *bf_reports)
|
||||
|
||||
BLI_linklist_free(bf_reports->resynced_lib_overrides_libraries, nullptr);
|
||||
bf_reports->resynced_lib_overrides_libraries = nullptr;
|
||||
|
||||
if (bf_reports->pre_animato_file_loaded) {
|
||||
BKE_report(
|
||||
bf_reports->reports,
|
||||
RPT_WARNING,
|
||||
"Loaded a pre-2.50 blend file, animation data has not been loaded. Open & save the file "
|
||||
"with Blender v4.5 to convert animation data.");
|
||||
}
|
||||
}
|
||||
|
||||
bool WM_file_read(bContext *C,
|
||||
|
||||
Reference in New Issue
Block a user