Merge branch 'master' into blender2.8
Conflicts: source/blender/collada/ArmatureExporter.cpp source/blender/collada/ArmatureExporter.h source/blender/collada/DocumentExporter.cpp source/blender/collada/DocumentExporter.h source/blender/collada/SceneExporter.cpp source/blender/collada/SceneExporter.h source/blender/collada/collada.cpp source/blender/collada/collada.h source/blender/editors/armature/armature_edit.c source/blender/editors/armature/editarmature_retarget.c source/blender/editors/armature/pose_transform.c source/blender/editors/include/ED_armature.h source/blender/editors/include/ED_object.h source/blender/editors/include/ED_screen.h source/blender/editors/io/io_collada.c source/blender/editors/object/object_transform.c source/blender/editors/screen/screen_edit.c source/blender/editors/screen/screen_ops.c source/blender/windowmanager/intern/wm.c source/blender/windowmanager/intern/wm_files.c source/blender/windowmanager/intern/wm_window.c source/blenderplayer/bad_level_call_stubs/stubs.c
This commit is contained in:
@@ -62,10 +62,11 @@ ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSett
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write bone nodes
|
// write bone nodes
|
||||||
void ArmatureExporter::add_armature_bones(Depsgraph *depsgraph, Object *ob_arm,
|
void ArmatureExporter::add_armature_bones(bContext *C, Depsgraph *depsgraph, Object *ob_arm,
|
||||||
Scene *sce, SceneExporter *se,
|
Scene *sce, SceneExporter *se,
|
||||||
std::list<Object *>& child_objects)
|
std::list<Object *>& child_objects)
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
// write bone nodes
|
// write bone nodes
|
||||||
|
|
||||||
bArmature * armature = (bArmature *)ob_arm->data;
|
bArmature * armature = (bArmature *)ob_arm->data;
|
||||||
@@ -77,11 +78,11 @@ void ArmatureExporter::add_armature_bones(Depsgraph *depsgraph, Object *ob_arm,
|
|||||||
for (Bone *bone = (Bone *)armature->bonebase.first; bone; bone = bone->next) {
|
for (Bone *bone = (Bone *)armature->bonebase.first; bone; bone = bone->next) {
|
||||||
// start from root bones
|
// start from root bones
|
||||||
if (!bone->parent)
|
if (!bone->parent)
|
||||||
add_bone_node(depsgraph, bone, ob_arm, sce, se, child_objects);
|
add_bone_node(C, depsgraph, bone, ob_arm, sce, se, child_objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_edited) {
|
if (!is_edited) {
|
||||||
ED_armature_from_edit(armature);
|
ED_armature_from_edit(bmain, armature);
|
||||||
ED_armature_edit_free(armature);
|
ED_armature_edit_free(armature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +158,7 @@ void ArmatureExporter::find_objects_using_armature(Object *ob_arm, std::vector<O
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parent_mat is armature-space
|
// parent_mat is armature-space
|
||||||
void ArmatureExporter::add_bone_node(Depsgraph *depsgraph, Bone *bone, Object *ob_arm, Scene *sce,
|
void ArmatureExporter::add_bone_node(bContext *C, Depsgraph *depsgraph, Bone *bone, Object *ob_arm, Scene *sce,
|
||||||
SceneExporter *se,
|
SceneExporter *se,
|
||||||
std::list<Object *>& child_objects)
|
std::list<Object *>& child_objects)
|
||||||
{
|
{
|
||||||
@@ -231,7 +232,7 @@ void ArmatureExporter::add_bone_node(Depsgraph *depsgraph, Bone *bone, Object *o
|
|||||||
mul_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv);
|
mul_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv);
|
||||||
}
|
}
|
||||||
|
|
||||||
se->writeNodes(depsgraph, *i, sce);
|
se->writeNodes(C, depsgraph, *i, sce);
|
||||||
|
|
||||||
copy_m4_m4((*i)->parentinv, backup_parinv);
|
copy_m4_m4((*i)->parentinv, backup_parinv);
|
||||||
child_objects.erase(i++);
|
child_objects.erase(i++);
|
||||||
@@ -240,13 +241,13 @@ void ArmatureExporter::add_bone_node(Depsgraph *depsgraph, Bone *bone, Object *o
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
|
for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
|
||||||
add_bone_node(depsgraph, child, ob_arm, sce, se, child_objects);
|
add_bone_node(C, depsgraph, child, ob_arm, sce, se, child_objects);
|
||||||
}
|
}
|
||||||
node.end();
|
node.end();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
|
for (Bone *child = (Bone *)bone->childbase.first; child; child = child->next) {
|
||||||
add_bone_node(depsgraph, child, ob_arm, sce, se, child_objects);
|
add_bone_node(C, depsgraph, child, ob_arm, sce, se, child_objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ public:
|
|||||||
ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
|
ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
|
||||||
|
|
||||||
// write bone nodes
|
// write bone nodes
|
||||||
void add_armature_bones(struct Depsgraph *depsgraph, Object *ob_arm, Scene *sce, SceneExporter *se,
|
void add_armature_bones(bContext *C, struct Depsgraph *depsgraph, Object *ob_arm, Scene *sce, SceneExporter *se,
|
||||||
std::list<Object *>& child_objects);
|
std::list<Object *>& child_objects);
|
||||||
|
|
||||||
bool add_instance_controller(Object *ob);
|
bool add_instance_controller(Object *ob);
|
||||||
@@ -85,7 +85,7 @@ private:
|
|||||||
|
|
||||||
// Scene, SceneExporter and the list of child_objects
|
// Scene, SceneExporter and the list of child_objects
|
||||||
// are required for writing bone parented objects
|
// are required for writing bone parented objects
|
||||||
void add_bone_node(struct Depsgraph *depsgraph, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se,
|
void add_bone_node(bContext *C, struct Depsgraph *depsgraph, Bone *bone, Object *ob_arm, Scene *sce, SceneExporter *se,
|
||||||
std::list<Object *>& child_objects);
|
std::list<Object *>& child_objects);
|
||||||
|
|
||||||
void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node);
|
void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node);
|
||||||
|
@@ -448,7 +448,7 @@ ArmatureJoints& ArmatureImporter::get_armature_joints(Object *ob_arm)
|
|||||||
return armature_joints.back();
|
return armature_joints.back();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms)
|
void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *> &ob_arms)
|
||||||
{
|
{
|
||||||
std::vector<COLLADAFW::Node *>::iterator ri;
|
std::vector<COLLADAFW::Node *>::iterator ri;
|
||||||
std::vector<std::string> layer_labels;
|
std::vector<std::string> layer_labels;
|
||||||
@@ -481,7 +481,7 @@ void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* exit armature edit mode to populate the Armature object */
|
/* exit armature edit mode to populate the Armature object */
|
||||||
ED_armature_from_edit(armature);
|
ED_armature_from_edit(bmain, armature);
|
||||||
ED_armature_edit_free(armature);
|
ED_armature_edit_free(armature);
|
||||||
|
|
||||||
ED_armature_to_edit(armature);
|
ED_armature_to_edit(armature);
|
||||||
@@ -489,7 +489,7 @@ void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms)
|
|||||||
fix_leaf_bone_hierarchy(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation);
|
fix_leaf_bone_hierarchy(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation);
|
||||||
unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
|
unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
|
||||||
|
|
||||||
ED_armature_from_edit(armature);
|
ED_armature_from_edit(bmain, armature);
|
||||||
ED_armature_edit_free(armature);
|
ED_armature_edit_free(armature);
|
||||||
|
|
||||||
int index = std::find(ob_arms.begin(), ob_arms.end(), ob_arm) - ob_arms.begin();
|
int index = std::find(ob_arms.begin(), ob_arms.end(), ob_arm) - ob_arms.begin();
|
||||||
@@ -501,7 +501,7 @@ void ArmatureImporter::create_armature_bones(std::vector<Object *> &ob_arms)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Object *ArmatureImporter::create_armature_bones(SkinInfo& skin)
|
Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo& skin)
|
||||||
{
|
{
|
||||||
// just do like so:
|
// just do like so:
|
||||||
// - get armature
|
// - get armature
|
||||||
@@ -619,7 +619,7 @@ Object *ArmatureImporter::create_armature_bones(SkinInfo& skin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* exit armature edit mode to populate the Armature object */
|
/* exit armature edit mode to populate the Armature object */
|
||||||
ED_armature_from_edit(armature);
|
ED_armature_from_edit(bmain, armature);
|
||||||
ED_armature_edit_free(armature);
|
ED_armature_edit_free(armature);
|
||||||
|
|
||||||
ED_armature_to_edit(armature);
|
ED_armature_to_edit(armature);
|
||||||
@@ -627,7 +627,7 @@ Object *ArmatureImporter::create_armature_bones(SkinInfo& skin)
|
|||||||
connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX);
|
connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX);
|
||||||
}
|
}
|
||||||
fix_leaf_bone_hierarchy(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation);
|
fix_leaf_bone_hierarchy(armature, (Bone *)armature->bonebase.first, this->import_settings->fix_orientation);
|
||||||
ED_armature_from_edit(armature);
|
ED_armature_from_edit(bmain, armature);
|
||||||
ED_armature_edit_free(armature);
|
ED_armature_edit_free(armature);
|
||||||
|
|
||||||
DEG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA);
|
DEG_id_tag_update(&ob_arm->id, OB_RECALC_OB | OB_RECALC_DATA);
|
||||||
@@ -709,6 +709,7 @@ void ArmatureImporter::add_root_joint(COLLADAFW::Node *node)
|
|||||||
// here we add bones to armatures, having armatures previously created in write_controller
|
// here we add bones to armatures, having armatures previously created in write_controller
|
||||||
void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &objects_to_scale)
|
void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &objects_to_scale)
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
std::vector<Object *> ob_arms;
|
std::vector<Object *> ob_arms;
|
||||||
std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
|
std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it;
|
||||||
|
|
||||||
@@ -718,7 +719,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object
|
|||||||
|
|
||||||
SkinInfo& skin = it->second;
|
SkinInfo& skin = it->second;
|
||||||
|
|
||||||
Object *ob_arm = create_armature_bones(skin);
|
Object *ob_arm = create_armature_bones(bmain, skin);
|
||||||
|
|
||||||
// link armature with a mesh object
|
// link armature with a mesh object
|
||||||
const COLLADAFW::UniqueId &uid = skin.get_controller_uid();
|
const COLLADAFW::UniqueId &uid = skin.get_controller_uid();
|
||||||
@@ -759,7 +760,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object
|
|||||||
}
|
}
|
||||||
|
|
||||||
//for bones without skins
|
//for bones without skins
|
||||||
create_armature_bones(ob_arms);
|
create_armature_bones(bmain, ob_arms);
|
||||||
|
|
||||||
// Fix bone relations
|
// Fix bone relations
|
||||||
std::vector<Object *>::iterator ob_arm_it;
|
std::vector<Object *>::iterator ob_arm_it;
|
||||||
@@ -773,7 +774,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object
|
|||||||
|
|
||||||
fix_parent_connect(armature, (Bone *)armature->bonebase.first);
|
fix_parent_connect(armature, (Bone *)armature->bonebase.first);
|
||||||
|
|
||||||
ED_armature_from_edit(armature);
|
ED_armature_from_edit(bmain, armature);
|
||||||
ED_armature_edit_free(armature);
|
ED_armature_edit_free(armature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -130,8 +130,8 @@ private:
|
|||||||
ArmatureJoints& get_armature_joints(Object *ob_arm);
|
ArmatureJoints& get_armature_joints(Object *ob_arm);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Object *create_armature_bones(SkinInfo& skin);
|
Object *create_armature_bones(Main *bmain, SkinInfo& skin);
|
||||||
void create_armature_bones(std::vector<Object *> &arm_objs);
|
void create_armature_bones(Main *bmain, std::vector<Object *> &arm_objs);
|
||||||
|
|
||||||
/** TagsMap typedef for uid_tags_map. */
|
/** TagsMap typedef for uid_tags_map. */
|
||||||
typedef std::map<std::string, ExtraTags*> TagsMap;
|
typedef std::map<std::string, ExtraTags*> TagsMap;
|
||||||
|
@@ -181,7 +181,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char *
|
|||||||
// For this to work, we need to know objects that use a certain action.
|
// For this to work, we need to know objects that use a certain action.
|
||||||
|
|
||||||
|
|
||||||
int DocumentExporter::exportCurrentScene(Scene *sce)
|
int DocumentExporter::exportCurrentScene(bContext *C, Scene *sce)
|
||||||
{
|
{
|
||||||
PointerRNA sceneptr, unit_settings;
|
PointerRNA sceneptr, unit_settings;
|
||||||
PropertyRNA *system; /* unused , *scale; */
|
PropertyRNA *system; /* unused , *scale; */
|
||||||
@@ -307,7 +307,7 @@ int DocumentExporter::exportCurrentScene(Scene *sce)
|
|||||||
AnimationExporter ae(depsgraph, writer, this->export_settings);
|
AnimationExporter ae(depsgraph, writer, this->export_settings);
|
||||||
ae.exportAnimations(sce);
|
ae.exportAnimations(sce);
|
||||||
}
|
}
|
||||||
se.exportScene(depsgraph, sce);
|
se.exportScene(C, depsgraph, sce);
|
||||||
|
|
||||||
// <scene>
|
// <scene>
|
||||||
std::string scene_name(translate_id(id_name(sce)));
|
std::string scene_name(translate_id(id_name(sce)));
|
||||||
|
@@ -40,7 +40,7 @@ class DocumentExporter
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DocumentExporter(Depsgraph *depsgraph, const ExportSettings *export_settings);
|
DocumentExporter(Depsgraph *depsgraph, const ExportSettings *export_settings);
|
||||||
int exportCurrentScene(Scene *sce);
|
int exportCurrentScene(bContext *C, Scene *sce);
|
||||||
|
|
||||||
void exportScenes(const char *filename);
|
void exportScenes(const char *filename);
|
||||||
private:
|
private:
|
||||||
|
@@ -39,17 +39,17 @@ SceneExporter::SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneExporter::exportScene(Depsgraph *depsgraph, Scene *sce)
|
void SceneExporter::exportScene(bContext *C, Depsgraph *depsgraph, Scene *sce)
|
||||||
{
|
{
|
||||||
// <library_visual_scenes> <visual_scene>
|
// <library_visual_scenes> <visual_scene>
|
||||||
std::string id_naming = id_name(sce);
|
std::string id_naming = id_name(sce);
|
||||||
openVisualScene(translate_id(id_naming), id_naming);
|
openVisualScene(translate_id(id_naming), id_naming);
|
||||||
exportHierarchy(depsgraph, sce);
|
exportHierarchy(C, depsgraph, sce);
|
||||||
closeVisualScene();
|
closeVisualScene();
|
||||||
closeLibrary();
|
closeLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneExporter::exportHierarchy(Depsgraph *depsgraph, Scene *sce)
|
void SceneExporter::exportHierarchy(bContext *C, Depsgraph *depsgraph, Scene *sce)
|
||||||
{
|
{
|
||||||
LinkNode *node;
|
LinkNode *node;
|
||||||
std::vector<Object *> base_objects;
|
std::vector<Object *> base_objects;
|
||||||
@@ -81,13 +81,13 @@ void SceneExporter::exportHierarchy(Depsgraph *depsgraph, Scene *sce)
|
|||||||
Object *ob = base_objects[index];
|
Object *ob = base_objects[index];
|
||||||
if (bc_is_marked(ob)) {
|
if (bc_is_marked(ob)) {
|
||||||
bc_remove_mark(ob);
|
bc_remove_mark(ob);
|
||||||
writeNodes(depsgraph, ob, sce);
|
writeNodes(C, depsgraph, ob, sce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SceneExporter::writeNodes(Depsgraph *depsgraph, Object *ob, Scene *sce)
|
void SceneExporter::writeNodes(bContext *C, Depsgraph *depsgraph, Object *ob, Scene *sce)
|
||||||
{
|
{
|
||||||
// Add associated armature first if available
|
// Add associated armature first if available
|
||||||
bool armature_exported = false;
|
bool armature_exported = false;
|
||||||
@@ -96,7 +96,7 @@ void SceneExporter::writeNodes(Depsgraph *depsgraph, Object *ob, Scene *sce)
|
|||||||
armature_exported = bc_is_in_Export_set(this->export_settings->export_set, ob_arm);
|
armature_exported = bc_is_in_Export_set(this->export_settings->export_set, ob_arm);
|
||||||
if (armature_exported && bc_is_marked(ob_arm)) {
|
if (armature_exported && bc_is_marked(ob_arm)) {
|
||||||
bc_remove_mark(ob_arm);
|
bc_remove_mark(ob_arm);
|
||||||
writeNodes(depsgraph, ob_arm, sce);
|
writeNodes(C, depsgraph, ob_arm, sce);
|
||||||
armature_exported = true;
|
armature_exported = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ void SceneExporter::writeNodes(Depsgraph *depsgraph, Object *ob, Scene *sce)
|
|||||||
|
|
||||||
// <instance_controller>
|
// <instance_controller>
|
||||||
else if (ob->type == OB_ARMATURE) {
|
else if (ob->type == OB_ARMATURE) {
|
||||||
arm_exporter->add_armature_bones(depsgraph, ob, sce, this, child_objects);
|
arm_exporter->add_armature_bones(C, depsgraph, ob, sce, this, child_objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <instance_camera>
|
// <instance_camera>
|
||||||
@@ -234,7 +234,7 @@ void SceneExporter::writeNodes(Depsgraph *depsgraph, Object *ob, Scene *sce)
|
|||||||
for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) {
|
for (std::list<Object *>::iterator i = child_objects.begin(); i != child_objects.end(); ++i) {
|
||||||
if (bc_is_marked(*i)) {
|
if (bc_is_marked(*i)) {
|
||||||
bc_remove_mark(*i);
|
bc_remove_mark(*i);
|
||||||
writeNodes(depsgraph, *i, sce);
|
writeNodes(C, depsgraph, *i, sce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -96,12 +96,12 @@ class SceneExporter: COLLADASW::LibraryVisualScenes, protected TransformWriter,
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings);
|
SceneExporter(COLLADASW::StreamWriter *sw, ArmatureExporter *arm, const ExportSettings *export_settings);
|
||||||
void exportScene(Depsgraph *depsgraph, Scene *sce);
|
void exportScene(bContext *C, Depsgraph *depsgraph, Scene *sce);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ArmatureExporter;
|
friend class ArmatureExporter;
|
||||||
void exportHierarchy(struct Depsgraph *depsgraph, Scene *sce);
|
void exportHierarchy(bContext *C, struct Depsgraph *depsgraph, Scene *sce);
|
||||||
void writeNodes(struct Depsgraph *depsgraph, Object *ob, Scene *sce);
|
void writeNodes(bContext *C, struct Depsgraph *depsgraph, Object *ob, Scene *sce);
|
||||||
|
|
||||||
ArmatureExporter *arm_exporter;
|
ArmatureExporter *arm_exporter;
|
||||||
const ExportSettings *export_settings;
|
const ExportSettings *export_settings;
|
||||||
|
@@ -51,7 +51,8 @@ int collada_import(bContext *C, ImportSettings *import_settings)
|
|||||||
return (imp.import())? 1:0;
|
return (imp.import())? 1:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int collada_export(Depsgraph *depsgraph,
|
int collada_export(bContext *C,
|
||||||
|
Depsgraph *depsgraph,
|
||||||
Scene *sce,
|
Scene *sce,
|
||||||
ExportSettings *export_settings)
|
ExportSettings *export_settings)
|
||||||
{
|
{
|
||||||
@@ -80,7 +81,7 @@ int collada_export(Depsgraph *depsgraph,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DocumentExporter exporter(depsgraph, export_settings);
|
DocumentExporter exporter(depsgraph, export_settings);
|
||||||
int status = exporter.exportCurrentScene(sce);
|
int status = exporter.exportCurrentScene(C, sce);
|
||||||
|
|
||||||
BLI_linklist_free(export_settings->export_set, NULL);
|
BLI_linklist_free(export_settings->export_set, NULL);
|
||||||
|
|
||||||
|
@@ -52,7 +52,8 @@ int collada_import(struct bContext *C,
|
|||||||
ImportSettings *import_settings);
|
ImportSettings *import_settings);
|
||||||
|
|
||||||
|
|
||||||
int collada_export(struct Depsgraph *depsgraph,
|
int collada_export(struct bContext *C,
|
||||||
|
struct Depsgraph *depsgraph,
|
||||||
struct Scene *sce,
|
struct Scene *sce,
|
||||||
ExportSettings *export_settings);
|
ExportSettings *export_settings);
|
||||||
|
|
||||||
|
@@ -50,6 +50,7 @@
|
|||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
#include "BKE_layer.h"
|
#include "BKE_layer.h"
|
||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
|
#include "BKE_main.h"
|
||||||
#include "BKE_report.h"
|
#include "BKE_report.h"
|
||||||
#include "BKE_object.h"
|
#include "BKE_object.h"
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
/* ************************** Object Tools Exports ******************************* */
|
/* ************************** Object Tools Exports ******************************* */
|
||||||
/* NOTE: these functions are exported to the Object module to be called from the tools there */
|
/* NOTE: these functions are exported to the Object module to be called from the tools there */
|
||||||
|
|
||||||
void ED_armature_transform_apply(Object *ob, float mat[4][4], const bool do_props)
|
void ED_armature_transform_apply(Main *bmain, Object *ob, float mat[4][4], const bool do_props)
|
||||||
{
|
{
|
||||||
bArmature *arm = ob->data;
|
bArmature *arm = ob->data;
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ void ED_armature_transform_apply(Object *ob, float mat[4][4], const bool do_prop
|
|||||||
ED_armature_transform_bones(arm, mat, do_props);
|
ED_armature_transform_bones(arm, mat, do_props);
|
||||||
|
|
||||||
/* Turn the list into an armature */
|
/* Turn the list into an armature */
|
||||||
ED_armature_from_edit(arm);
|
ED_armature_from_edit(bmain, arm);
|
||||||
ED_armature_edit_free(arm);
|
ED_armature_edit_free(arm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ED_armature_transform(struct bArmature *arm, float mat[4][4], const bool do_props)
|
void ED_armature_transform(Main *bmain, bArmature *arm, float mat[4][4], const bool do_props)
|
||||||
{
|
{
|
||||||
if (arm->edbo) {
|
if (arm->edbo) {
|
||||||
ED_armature_transform_bones(arm, mat, do_props);
|
ED_armature_transform_bones(arm, mat, do_props);
|
||||||
@@ -133,14 +134,14 @@ void ED_armature_transform(struct bArmature *arm, float mat[4][4], const bool do
|
|||||||
ED_armature_transform_bones(arm, mat, do_props);
|
ED_armature_transform_bones(arm, mat, do_props);
|
||||||
|
|
||||||
/* Go back to object mode*/
|
/* Go back to object mode*/
|
||||||
ED_armature_from_edit(arm);
|
ED_armature_from_edit(bmain, arm);
|
||||||
ED_armature_edit_free(arm);
|
ED_armature_edit_free(arm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exported for use in editors/object/ */
|
/* exported for use in editors/object/ */
|
||||||
/* 0 == do center, 1 == center new, 2 == center cursor */
|
/* 0 == do center, 1 == center new, 2 == center cursor */
|
||||||
void ED_armature_origin_set(Object *ob, float cursor[3], int centermode, int around)
|
void ED_armature_origin_set(Main *bmain, Object *ob, float cursor[3], int centermode, int around)
|
||||||
{
|
{
|
||||||
const bool is_editmode = BKE_object_is_in_editmode(ob);
|
const bool is_editmode = BKE_object_is_in_editmode(ob);
|
||||||
EditBone *ebone;
|
EditBone *ebone;
|
||||||
@@ -190,7 +191,7 @@ void ED_armature_origin_set(Object *ob, float cursor[3], int centermode, int aro
|
|||||||
|
|
||||||
/* Turn the list into an armature */
|
/* Turn the list into an armature */
|
||||||
if (is_editmode == false) {
|
if (is_editmode == false) {
|
||||||
ED_armature_from_edit(arm);
|
ED_armature_from_edit(bmain, arm);
|
||||||
ED_armature_edit_free(arm);
|
ED_armature_edit_free(arm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -400,7 +400,7 @@ int join_armature_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
DEG_relations_tag_update(bmain); /* because we removed object(s) */
|
DEG_relations_tag_update(bmain); /* because we removed object(s) */
|
||||||
|
|
||||||
ED_armature_from_edit(arm);
|
ED_armature_from_edit(bmain, arm);
|
||||||
ED_armature_edit_free(arm);
|
ED_armature_edit_free(arm);
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
|
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
|
||||||
@@ -516,7 +516,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
|
|||||||
* sel: remove selected bones from the armature, otherwise the unselected bones are removed
|
* sel: remove selected bones from the armature, otherwise the unselected bones are removed
|
||||||
* (ob is not in editmode)
|
* (ob is not in editmode)
|
||||||
*/
|
*/
|
||||||
static void separate_armature_bones(Object *ob, short sel)
|
static void separate_armature_bones(Main *bmain, Object *ob, short sel)
|
||||||
{
|
{
|
||||||
bArmature *arm = (bArmature *)ob->data;
|
bArmature *arm = (bArmature *)ob->data;
|
||||||
bPoseChannel *pchan, *pchann;
|
bPoseChannel *pchan, *pchann;
|
||||||
@@ -563,7 +563,7 @@ static void separate_armature_bones(Object *ob, short sel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* exit editmode (recalculates pchans too) */
|
/* exit editmode (recalculates pchans too) */
|
||||||
ED_armature_from_edit(ob->data);
|
ED_armature_from_edit(bmain, ob->data);
|
||||||
ED_armature_edit_free(ob->data);
|
ED_armature_edit_free(ob->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
|
|||||||
oldob->mode &= ~OB_MODE_POSE;
|
oldob->mode &= ~OB_MODE_POSE;
|
||||||
//oldbase->flag &= ~OB_POSEMODE;
|
//oldbase->flag &= ~OB_POSEMODE;
|
||||||
|
|
||||||
ED_armature_from_edit(obedit->data);
|
ED_armature_from_edit(bmain, obedit->data);
|
||||||
ED_armature_edit_free(obedit->data);
|
ED_armature_edit_free(obedit->data);
|
||||||
|
|
||||||
/* 2) duplicate base */
|
/* 2) duplicate base */
|
||||||
@@ -623,8 +623,8 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
|
|
||||||
/* 3) remove bones that shouldn't still be around on both armatures */
|
/* 3) remove bones that shouldn't still be around on both armatures */
|
||||||
separate_armature_bones(oldob, 1);
|
separate_armature_bones(bmain, oldob, 1);
|
||||||
separate_armature_bones(newob, 0);
|
separate_armature_bones(bmain, newob, 0);
|
||||||
|
|
||||||
|
|
||||||
/* 4) fix links before depsgraph flushes */ // err... or after?
|
/* 4) fix links before depsgraph flushes */ // err... or after?
|
||||||
|
@@ -585,7 +585,7 @@ static void armature_finalize_restpose(ListBase *bonelist, ListBase *editbonelis
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* put EditMode back in Object */
|
/* put EditMode back in Object */
|
||||||
void ED_armature_from_edit(bArmature *arm)
|
void ED_armature_from_edit(Main *bmain, bArmature *arm)
|
||||||
{
|
{
|
||||||
EditBone *eBone, *neBone;
|
EditBone *eBone, *neBone;
|
||||||
Bone *newBone;
|
Bone *newBone;
|
||||||
@@ -679,7 +679,7 @@ void ED_armature_from_edit(bArmature *arm)
|
|||||||
armature_finalize_restpose(&arm->bonebase, arm->edbo);
|
armature_finalize_restpose(&arm->bonebase, arm->edbo);
|
||||||
|
|
||||||
/* so all users of this armature should get rebuilt */
|
/* so all users of this armature should get rebuilt */
|
||||||
for (obt = G.main->object.first; obt; obt = obt->id.next) {
|
for (obt = bmain->object.first; obt; obt = obt->id.next) {
|
||||||
if (obt->data == arm) {
|
if (obt->data == arm) {
|
||||||
BKE_pose_rebuild(obt, arm);
|
BKE_pose_rebuild(obt, arm);
|
||||||
}
|
}
|
||||||
|
2644
source/blender/editors/armature/editarmature_retarget.c
Normal file
2644
source/blender/editors/armature/editarmature_retarget.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -97,6 +97,7 @@ static void applyarmature_fix_boneparents(const bContext *C, Scene *scene, Objec
|
|||||||
/* set the current pose as the restpose */
|
/* set the current pose as the restpose */
|
||||||
static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
|
static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
|
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object
|
||||||
@@ -195,7 +196,7 @@ static int apply_armature_pose2bones_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* convert editbones back to bones, and then free the edit-data */
|
/* convert editbones back to bones, and then free the edit-data */
|
||||||
ED_armature_from_edit(arm);
|
ED_armature_from_edit(bmain, arm);
|
||||||
ED_armature_edit_free(arm);
|
ED_armature_edit_free(arm);
|
||||||
|
|
||||||
/* flush positions of posebones */
|
/* flush positions of posebones */
|
||||||
|
@@ -1105,7 +1105,7 @@ static int *initialize_index_map(Object *obedit, int *r_old_totvert)
|
|||||||
return old_to_new_map;
|
return old_to_new_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void remap_hooks_and_vertex_parents(Object *obedit)
|
static void remap_hooks_and_vertex_parents(Main *bmain, Object *obedit)
|
||||||
{
|
{
|
||||||
Object *object;
|
Object *object;
|
||||||
Curve *curve = (Curve *) obedit->data;
|
Curve *curve = (Curve *) obedit->data;
|
||||||
@@ -1121,7 +1121,7 @@ static void remap_hooks_and_vertex_parents(Object *obedit)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (object = G.main->object.first; object; object = object->id.next) {
|
for (object = bmain->object.first; object; object = object->id.next) {
|
||||||
ModifierData *md;
|
ModifierData *md;
|
||||||
int index;
|
int index;
|
||||||
if ((object->parent) &&
|
if ((object->parent) &&
|
||||||
@@ -1184,7 +1184,7 @@ static void remap_hooks_and_vertex_parents(Object *obedit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* load editNurb in object */
|
/* load editNurb in object */
|
||||||
void ED_curve_editnurb_load(Object *obedit)
|
void ED_curve_editnurb_load(Main *bmain, Object *obedit)
|
||||||
{
|
{
|
||||||
ListBase *editnurb = object_editcurve_get(obedit);
|
ListBase *editnurb = object_editcurve_get(obedit);
|
||||||
|
|
||||||
@@ -1195,7 +1195,7 @@ void ED_curve_editnurb_load(Object *obedit)
|
|||||||
Nurb *nu, *newnu;
|
Nurb *nu, *newnu;
|
||||||
ListBase newnurb = {NULL, NULL}, oldnurb = cu->nurb;
|
ListBase newnurb = {NULL, NULL}, oldnurb = cu->nurb;
|
||||||
|
|
||||||
remap_hooks_and_vertex_parents(obedit);
|
remap_hooks_and_vertex_parents(bmain, obedit);
|
||||||
|
|
||||||
for (nu = editnurb->first; nu; nu = nu->next) {
|
for (nu = editnurb->first; nu; nu = nu->next) {
|
||||||
newnu = BKE_nurb_duplicate(nu);
|
newnu = BKE_nurb_duplicate(nu);
|
||||||
@@ -1325,7 +1325,7 @@ static int separate_exec(bContext *C, wmOperator *op)
|
|||||||
BLI_movelisttolist(&newedit->nurbs, &newnurb);
|
BLI_movelisttolist(&newedit->nurbs, &newnurb);
|
||||||
|
|
||||||
/* 4. put old object out of editmode and delete separated geometry */
|
/* 4. put old object out of editmode and delete separated geometry */
|
||||||
ED_curve_editnurb_load(newob);
|
ED_curve_editnurb_load(bmain, newob);
|
||||||
ED_curve_editnurb_free(newob);
|
ED_curve_editnurb_free(newob);
|
||||||
curve_delete_segments(oldob, true);
|
curve_delete_segments(oldob, true);
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@ struct bPoseChannel;
|
|||||||
struct Depsgraph;
|
struct Depsgraph;
|
||||||
struct IDProperty;
|
struct IDProperty;
|
||||||
struct ListBase;
|
struct ListBase;
|
||||||
|
struct Main;
|
||||||
struct MeshDeformModifierData;
|
struct MeshDeformModifierData;
|
||||||
struct Mesh;
|
struct Mesh;
|
||||||
struct Object;
|
struct Object;
|
||||||
@@ -135,7 +136,7 @@ void ED_operatormacros_armature(void);
|
|||||||
void ED_keymap_armature(struct wmKeyConfig *keyconf);
|
void ED_keymap_armature(struct wmKeyConfig *keyconf);
|
||||||
|
|
||||||
/* editarmature.c */
|
/* editarmature.c */
|
||||||
void ED_armature_from_edit(struct bArmature *arm);
|
void ED_armature_from_edit(struct Main *bmain, struct bArmature *arm);
|
||||||
void ED_armature_to_edit(struct bArmature *arm);
|
void ED_armature_to_edit(struct bArmature *arm);
|
||||||
void ED_armature_edit_free(struct bArmature *arm);
|
void ED_armature_edit_free(struct bArmature *arm);
|
||||||
|
|
||||||
@@ -181,11 +182,11 @@ void ED_armature_ebone_from_mat3(EditBone *ebone, float mat[3][3]);
|
|||||||
void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
|
void ED_armature_ebone_from_mat4(EditBone *ebone, float mat[4][4]);
|
||||||
|
|
||||||
void ED_armature_edit_transform_mirror_update(struct Object *obedit);
|
void ED_armature_edit_transform_mirror_update(struct Object *obedit);
|
||||||
void ED_armature_origin_set(struct Object *ob, float cursor[3], int centermode, int around);
|
void ED_armature_origin_set(struct Main *bmain, struct Object *ob, float cursor[3], int centermode, int around);
|
||||||
|
|
||||||
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props);
|
void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props);
|
||||||
void ED_armature_transform_apply(struct Object *ob, float mat[4][4], const bool do_props);
|
void ED_armature_transform_apply(struct Main *bmain, struct Object *ob, float mat[4][4], const bool do_props);
|
||||||
void ED_armature_transform(struct bArmature *arm, float mat[4][4], const bool do_props);
|
void ED_armature_transform(struct Main *bmain, struct bArmature *arm, float mat[4][4], const bool do_props);
|
||||||
|
|
||||||
#define ARM_GROUPS_NAME 1
|
#define ARM_GROUPS_NAME 1
|
||||||
#define ARM_GROUPS_ENVELOPE 2
|
#define ARM_GROUPS_ENVELOPE 2
|
||||||
|
@@ -32,15 +32,16 @@
|
|||||||
#define __ED_CURVE_H__
|
#define __ED_CURVE_H__
|
||||||
|
|
||||||
struct bContext;
|
struct bContext;
|
||||||
|
struct BezTriple;
|
||||||
|
struct BPoint;
|
||||||
|
struct Curve;
|
||||||
|
struct EditNurb;
|
||||||
|
struct Main;
|
||||||
struct Nurb;
|
struct Nurb;
|
||||||
struct Object;
|
struct Object;
|
||||||
struct Text;
|
struct Text;
|
||||||
struct wmOperator;
|
struct wmOperator;
|
||||||
struct wmKeyConfig;
|
struct wmKeyConfig;
|
||||||
struct Curve;
|
|
||||||
struct EditNurb;
|
|
||||||
struct BezTriple;
|
|
||||||
struct BPoint;
|
|
||||||
struct UndoType;
|
struct UndoType;
|
||||||
|
|
||||||
/* curve_ops.c */
|
/* curve_ops.c */
|
||||||
@@ -51,7 +52,7 @@ void ED_keymap_curve(struct wmKeyConfig *keyconf);
|
|||||||
/* editcurve.c */
|
/* editcurve.c */
|
||||||
struct ListBase *object_editcurve_get(struct Object *ob);
|
struct ListBase *object_editcurve_get(struct Object *ob);
|
||||||
|
|
||||||
void ED_curve_editnurb_load(struct Object *obedit);
|
void ED_curve_editnurb_load(struct Main *bmain, struct Object *obedit);
|
||||||
void ED_curve_editnurb_make(struct Object *obedit);
|
void ED_curve_editnurb_make(struct Object *obedit);
|
||||||
void ED_curve_editnurb_free(struct Object *obedit);
|
void ED_curve_editnurb_free(struct Object *obedit);
|
||||||
|
|
||||||
|
@@ -126,7 +126,7 @@ enum {
|
|||||||
EM_NO_CONTEXT = (1 << 4),
|
EM_NO_CONTEXT = (1 << 4),
|
||||||
};
|
};
|
||||||
bool ED_object_editmode_exit_ex(
|
bool ED_object_editmode_exit_ex(
|
||||||
struct Scene *scene, struct Object *obedit, int flag);
|
struct Main *bmain, struct Scene *scene, struct Object *obedit, int flag);
|
||||||
bool ED_object_editmode_exit(struct bContext *C, int flag);
|
bool ED_object_editmode_exit(struct bContext *C, int flag);
|
||||||
|
|
||||||
bool ED_object_editmode_enter_ex(struct Main *bmain, struct Scene *scene, struct Object *ob, int flag);
|
bool ED_object_editmode_enter_ex(struct Main *bmain, struct Scene *scene, struct Object *ob, int flag);
|
||||||
|
@@ -160,7 +160,7 @@ ScrArea *ED_screen_areas_iter_next(const bScreen *screen, const ScrArea *area);
|
|||||||
vert_name = (vert_name == (win)->global_areas.vertbase.last) ? (screen)->vertbase.first : vert_name->next)
|
vert_name = (vert_name == (win)->global_areas.vertbase.last) ? (screen)->vertbase.first : vert_name->next)
|
||||||
|
|
||||||
/* screens */
|
/* screens */
|
||||||
void ED_screens_initialize(struct wmWindowManager *wm);
|
void ED_screens_initialize(struct Main *bmain, struct wmWindowManager *wm);
|
||||||
void ED_screen_draw_edges(struct wmWindow *win);
|
void ED_screen_draw_edges(struct wmWindow *win);
|
||||||
void ED_screen_draw_join_shape(struct ScrArea *sa1, struct ScrArea *sa2);
|
void ED_screen_draw_join_shape(struct ScrArea *sa1, struct ScrArea *sa2);
|
||||||
void ED_screen_draw_split_preview(struct ScrArea *sa, const int dir, const float fac);
|
void ED_screen_draw_split_preview(struct ScrArea *sa, const int dir, const float fac);
|
||||||
|
@@ -205,9 +205,11 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
|
|||||||
if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;
|
if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;
|
||||||
if (export_settings.include_children) includeFilter |= OB_REL_CHILDREN_RECURSIVE;
|
if (export_settings.include_children) includeFilter |= OB_REL_CHILDREN_RECURSIVE;
|
||||||
|
|
||||||
export_count = collada_export(CTX_data_depsgraph(C),
|
export_count = collada_export(
|
||||||
scene,
|
C,
|
||||||
&export_settings
|
CTX_data_depsgraph(C),
|
||||||
|
scene,
|
||||||
|
&export_settings
|
||||||
);
|
);
|
||||||
|
|
||||||
if (export_count == 0) {
|
if (export_count == 0) {
|
||||||
|
@@ -152,7 +152,7 @@ bConstraint *get_active_constraint(Object *ob)
|
|||||||
/* ------------- PyConstraints ------------------ */
|
/* ------------- PyConstraints ------------------ */
|
||||||
|
|
||||||
/* this callback sets the text-file to be used for selected menu item */
|
/* this callback sets the text-file to be used for selected menu item */
|
||||||
static void validate_pyconstraint_cb(void *arg1, void *arg2)
|
static void validate_pyconstraint_cb(Main *bmain, void *arg1, void *arg2)
|
||||||
{
|
{
|
||||||
bPythonConstraint *data = arg1;
|
bPythonConstraint *data = arg1;
|
||||||
Text *text = NULL;
|
Text *text = NULL;
|
||||||
@@ -162,13 +162,13 @@ static void validate_pyconstraint_cb(void *arg1, void *arg2)
|
|||||||
/* exception for no script */
|
/* exception for no script */
|
||||||
if (index) {
|
if (index) {
|
||||||
/* innovative use of a for...loop to search */
|
/* innovative use of a for...loop to search */
|
||||||
for (text = G.main->text.first, i = 1; text && index != i; i++, text = text->id.next) ;
|
for (text = bmain->text.first, i = 1; text && index != i; i++, text = text->id.next) ;
|
||||||
}
|
}
|
||||||
data->text = text;
|
data->text = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this returns a string for the list of usable pyconstraint script names */
|
/* this returns a string for the list of usable pyconstraint script names */
|
||||||
static char *buildmenu_pyconstraints(Text *con_text, int *pyconindex)
|
static char *buildmenu_pyconstraints(Main *bmain, Text *con_text, int *pyconindex)
|
||||||
{
|
{
|
||||||
DynStr *pupds = BLI_dynstr_new();
|
DynStr *pupds = BLI_dynstr_new();
|
||||||
Text *text;
|
Text *text;
|
||||||
@@ -185,7 +185,7 @@ static char *buildmenu_pyconstraints(Text *con_text, int *pyconindex)
|
|||||||
*pyconindex = 0;
|
*pyconindex = 0;
|
||||||
|
|
||||||
/* loop through markers, adding them */
|
/* loop through markers, adding them */
|
||||||
for (text = G.main->text.first, i = 1; text; i++, text = text->id.next) {
|
for (text = bmain->text.first, i = 1; text; i++, text = text->id.next) {
|
||||||
/* this is important to ensure that right script is shown as active */
|
/* this is important to ensure that right script is shown as active */
|
||||||
if (text == con_text) *pyconindex = i;
|
if (text == con_text) *pyconindex = i;
|
||||||
|
|
||||||
@@ -1798,14 +1798,14 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
|
|||||||
char *menustr;
|
char *menustr;
|
||||||
int scriptint = 0;
|
int scriptint = 0;
|
||||||
/* popup a list of usable scripts */
|
/* popup a list of usable scripts */
|
||||||
menustr = buildmenu_pyconstraints(NULL, &scriptint);
|
menustr = buildmenu_pyconstraints(bmain, NULL, &scriptint);
|
||||||
/* XXX scriptint = pupmenu(menustr); */
|
/* XXX scriptint = pupmenu(menustr); */
|
||||||
MEM_freeN(menustr);
|
MEM_freeN(menustr);
|
||||||
|
|
||||||
/* only add constraint if a script was chosen */
|
/* only add constraint if a script was chosen */
|
||||||
if (scriptint) {
|
if (scriptint) {
|
||||||
/* add constraint */
|
/* add constraint */
|
||||||
validate_pyconstraint_cb(con->data, &scriptint);
|
validate_pyconstraint_cb(bmain, con->data, &scriptint);
|
||||||
|
|
||||||
/* make sure target allowance is set correctly */
|
/* make sure target allowance is set correctly */
|
||||||
BPY_pyconstraint_update(ob, con);
|
BPY_pyconstraint_update(ob, con);
|
||||||
|
@@ -209,7 +209,7 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
|
|||||||
if (arm->edbo == NULL) {
|
if (arm->edbo == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ED_armature_from_edit(obedit->data);
|
ED_armature_from_edit(bmain, obedit->data);
|
||||||
if (freedata) {
|
if (freedata) {
|
||||||
ED_armature_edit_free(obedit->data);
|
ED_armature_edit_free(obedit->data);
|
||||||
}
|
}
|
||||||
@@ -224,7 +224,7 @@ static bool ED_object_editmode_load_ex(Main *bmain, Object *obedit, const bool f
|
|||||||
if (cu->editnurb == NULL) {
|
if (cu->editnurb == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ED_curve_editnurb_load(obedit);
|
ED_curve_editnurb_load(bmain, obedit);
|
||||||
if (freedata) {
|
if (freedata) {
|
||||||
ED_curve_editnurb_free(obedit);
|
ED_curve_editnurb_free(obedit);
|
||||||
}
|
}
|
||||||
@@ -272,13 +272,13 @@ bool ED_object_editmode_load(Main *bmain, Object *obedit)
|
|||||||
* \param flag:
|
* \param flag:
|
||||||
* - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly.
|
* - If #EM_FREEDATA isn't in the flag, use ED_object_editmode_load directly.
|
||||||
*/
|
*/
|
||||||
bool ED_object_editmode_exit_ex(Scene *scene, Object *obedit, int flag)
|
bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int flag)
|
||||||
{
|
{
|
||||||
const bool freedata = (flag & EM_FREEDATA) != 0;
|
const bool freedata = (flag & EM_FREEDATA) != 0;
|
||||||
|
|
||||||
if (flag & EM_WAITCURSOR) waitcursor(1);
|
if (flag & EM_WAITCURSOR) waitcursor(1);
|
||||||
|
|
||||||
if (ED_object_editmode_load_ex(G.main, obedit, freedata) == false) {
|
if (ED_object_editmode_load_ex(bmain, obedit, freedata) == false) {
|
||||||
/* in rare cases (background mode) its possible active object
|
/* in rare cases (background mode) its possible active object
|
||||||
* is flagged for editmode, without 'obedit' being set [#35489] */
|
* is flagged for editmode, without 'obedit' being set [#35489] */
|
||||||
if (UNLIKELY(obedit && obedit->mode & OB_MODE_EDIT)) {
|
if (UNLIKELY(obedit && obedit->mode & OB_MODE_EDIT)) {
|
||||||
@@ -318,9 +318,10 @@ bool ED_object_editmode_exit_ex(Scene *scene, Object *obedit, int flag)
|
|||||||
|
|
||||||
bool ED_object_editmode_exit(bContext *C, int flag)
|
bool ED_object_editmode_exit(bContext *C, int flag)
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
Object *obedit = CTX_data_edit_object(C);
|
Object *obedit = CTX_data_edit_object(C);
|
||||||
return ED_object_editmode_exit_ex(scene, obedit, flag);
|
return ED_object_editmode_exit_ex(bmain, scene, obedit, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag)
|
bool ED_object_editmode_enter_ex(Main *bmain, Scene *scene, Object *ob, int flag)
|
||||||
@@ -465,7 +466,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op)
|
|||||||
FOREACH_OBJECT_BEGIN(view_layer, ob)
|
FOREACH_OBJECT_BEGIN(view_layer, ob)
|
||||||
{
|
{
|
||||||
if ((ob != obact) && (ob->type == obact->type)) {
|
if ((ob != obact) && (ob->type == obact->type)) {
|
||||||
ED_object_editmode_exit_ex(scene, ob, EM_FREEDATA | EM_WAITCURSOR);
|
ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA | EM_WAITCURSOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FOREACH_OBJECT_END;
|
FOREACH_OBJECT_END;
|
||||||
|
@@ -304,7 +304,7 @@ static int return_editcurve_indexar(
|
|||||||
return totvert;
|
return totvert;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool object_hook_index_array(Scene *scene, Object *obedit,
|
static bool object_hook_index_array(Main *bmain, Scene *scene, Object *obedit,
|
||||||
int *r_tot, int **r_indexar, char *r_name, float r_cent[3])
|
int *r_tot, int **r_indexar, char *r_name, float r_cent[3])
|
||||||
{
|
{
|
||||||
*r_indexar = NULL;
|
*r_indexar = NULL;
|
||||||
@@ -336,7 +336,7 @@ static bool object_hook_index_array(Scene *scene, Object *obedit,
|
|||||||
}
|
}
|
||||||
case OB_CURVE:
|
case OB_CURVE:
|
||||||
case OB_SURF:
|
case OB_SURF:
|
||||||
ED_curve_editnurb_load(obedit);
|
ED_curve_editnurb_load(bmain, obedit);
|
||||||
ED_curve_editnurb_make(obedit);
|
ED_curve_editnurb_make(obedit);
|
||||||
return return_editcurve_indexar(obedit, r_tot, r_indexar, r_cent);
|
return return_editcurve_indexar(obedit, r_tot, r_indexar, r_cent);
|
||||||
case OB_LATTICE:
|
case OB_LATTICE:
|
||||||
@@ -476,7 +476,7 @@ static int add_hook_object(const bContext *C, Main *bmain, Scene *scene, ViewLay
|
|||||||
int tot, ok, *indexar;
|
int tot, ok, *indexar;
|
||||||
char name[MAX_NAME];
|
char name[MAX_NAME];
|
||||||
|
|
||||||
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
|
ok = object_hook_index_array(bmain, scene, obedit, &tot, &indexar, name, cent);
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
BKE_report(reports, RPT_ERROR, "Requires selected vertices or active vertex group");
|
BKE_report(reports, RPT_ERROR, "Requires selected vertices or active vertex group");
|
||||||
@@ -814,6 +814,7 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot)
|
|||||||
|
|
||||||
static int object_hook_assign_exec(bContext *C, wmOperator *op)
|
static int object_hook_assign_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
|
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
|
||||||
int num = RNA_enum_get(op->ptr, "modifier");
|
int num = RNA_enum_get(op->ptr, "modifier");
|
||||||
@@ -831,7 +832,7 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
/* assign functionality */
|
/* assign functionality */
|
||||||
|
|
||||||
if (!object_hook_index_array(scene, ob, &tot, &indexar, name, cent)) {
|
if (!object_hook_index_array(bmain, scene, ob, &tot, &indexar, name, cent)) {
|
||||||
BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
|
BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
@@ -209,7 +209,7 @@ static bool ed_object_mode_generic_exit_ex(
|
|||||||
if (only_test) {
|
if (only_test) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ED_object_editmode_exit_ex(scene, ob, EM_FREEDATA);
|
ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ob->mode & OB_MODE_VERTEX_PAINT) {
|
else if (ob->mode & OB_MODE_VERTEX_PAINT) {
|
||||||
|
@@ -1782,7 +1782,7 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain,
|
|||||||
MEM_freeN(emap);
|
MEM_freeN(emap);
|
||||||
MEM_freeN(emap_mem);
|
MEM_freeN(emap_mem);
|
||||||
|
|
||||||
ED_armature_from_edit(arm);
|
ED_armature_from_edit(bmain, arm);
|
||||||
ED_armature_edit_free(arm);
|
ED_armature_edit_free(arm);
|
||||||
|
|
||||||
return arm_ob;
|
return arm_ob;
|
||||||
|
@@ -553,7 +553,7 @@ static int apply_objects_internal(
|
|||||||
BKE_mesh_calc_normals(me);
|
BKE_mesh_calc_normals(me);
|
||||||
}
|
}
|
||||||
else if (ob->type == OB_ARMATURE) {
|
else if (ob->type == OB_ARMATURE) {
|
||||||
ED_armature_transform_apply(ob, mat, do_props);
|
ED_armature_transform_apply(bmain, ob, mat, do_props);
|
||||||
}
|
}
|
||||||
else if (ob->type == OB_LATTICE) {
|
else if (ob->type == OB_LATTICE) {
|
||||||
Lattice *lt = ob->data;
|
Lattice *lt = ob->data;
|
||||||
@@ -1006,7 +1006,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
|
|||||||
/* Function to recenter armatures in editarmature.c
|
/* Function to recenter armatures in editarmature.c
|
||||||
* Bone + object locations are handled there.
|
* Bone + object locations are handled there.
|
||||||
*/
|
*/
|
||||||
ED_armature_origin_set(ob, cursor, centermode, around);
|
ED_armature_origin_set(bmain, ob, cursor, centermode, around);
|
||||||
|
|
||||||
tot_change++;
|
tot_change++;
|
||||||
arm->id.tag |= LIB_TAG_DOIT;
|
arm->id.tag |= LIB_TAG_DOIT;
|
||||||
|
@@ -340,12 +340,12 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
|
|||||||
/**
|
/**
|
||||||
* Empty screen, with 1 dummy area without spacedata. Uses window size.
|
* Empty screen, with 1 dummy area without spacedata. Uses window size.
|
||||||
*/
|
*/
|
||||||
bScreen *screen_add(const char *name, const rcti *rect)
|
bScreen *screen_add(Main *bmain, const char *name, const rcti *rect)
|
||||||
{
|
{
|
||||||
bScreen *sc;
|
bScreen *sc;
|
||||||
ScrVert *sv1, *sv2, *sv3, *sv4;
|
ScrVert *sv1, *sv2, *sv3, *sv4;
|
||||||
|
|
||||||
sc = BKE_libblock_alloc(G.main, ID_SCR, name, 0);
|
sc = BKE_libblock_alloc(bmain, ID_SCR, name, 0);
|
||||||
sc->do_refresh = true;
|
sc->do_refresh = true;
|
||||||
sc->redraws_flag = TIME_ALL_3D_WIN | TIME_ALL_ANIM_WIN;
|
sc->redraws_flag = TIME_ALL_3D_WIN | TIME_ALL_ANIM_WIN;
|
||||||
|
|
||||||
@@ -832,7 +832,7 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* file read, set all screens, ... */
|
/* file read, set all screens, ... */
|
||||||
void ED_screens_initialize(wmWindowManager *wm)
|
void ED_screens_initialize(Main *UNUSED(bmain), wmWindowManager *wm)
|
||||||
{
|
{
|
||||||
wmWindow *win;
|
wmWindow *win;
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ void screen_area_update_region_sizes(wmWindowManager *wm, wmWindow *win,
|
|||||||
void region_toggle_hidden(struct bContext *C, ARegion *ar, const bool do_fade);
|
void region_toggle_hidden(struct bContext *C, ARegion *ar, const bool do_fade);
|
||||||
|
|
||||||
/* screen_edit.c */
|
/* screen_edit.c */
|
||||||
bScreen *screen_add(const char *name, const rcti *rect);
|
bScreen *screen_add(struct Main *bmain, const char *name, const rcti *rect);
|
||||||
void screen_data_copy(bScreen *to, bScreen *from);
|
void screen_data_copy(bScreen *to, bScreen *from);
|
||||||
void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new);
|
void screen_new_activate_prepare(const wmWindow *win, bScreen *screen_new);
|
||||||
void screen_change_update(struct bContext *C, wmWindow *win, bScreen *sc);
|
void screen_change_update(struct bContext *C, wmWindow *win, bScreen *sc);
|
||||||
|
@@ -54,7 +54,7 @@ WorkSpaceLayout *ED_workspace_layout_add(
|
|||||||
rcti screen_rect;
|
rcti screen_rect;
|
||||||
|
|
||||||
WM_window_screen_rect_calc(win, &screen_rect);
|
WM_window_screen_rect_calc(win, &screen_rect);
|
||||||
screen = screen_add(name, &screen_rect);
|
screen = screen_add(G.main, name, &screen_rect);
|
||||||
|
|
||||||
return BKE_workspace_layout_add(workspace, screen, name);
|
return BKE_workspace_layout_add(workspace, screen, name);
|
||||||
}
|
}
|
||||||
|
@@ -2313,7 +2313,7 @@ static int filelist_readjob_list_lib(const char *root, ListBase *entries, const
|
|||||||
#if 0
|
#if 0
|
||||||
/* Kept for reference here, in case we want to add back that feature later. We do not need it currently. */
|
/* Kept for reference here, in case we want to add back that feature later. We do not need it currently. */
|
||||||
/* Code ***NOT*** updated for job stuff! */
|
/* Code ***NOT*** updated for job stuff! */
|
||||||
static void filelist_readjob_main_rec(struct FileList *filelist)
|
static void filelist_readjob_main_rec(Main *bmain, FileList *filelist)
|
||||||
{
|
{
|
||||||
ID *id;
|
ID *id;
|
||||||
FileDirEntry *files, *firstlib = NULL;
|
FileDirEntry *files, *firstlib = NULL;
|
||||||
@@ -2375,7 +2375,7 @@ static void filelist_readjob_main_rec(struct FileList *filelist)
|
|||||||
/* make files */
|
/* make files */
|
||||||
idcode = groupname_to_code(filelist->filelist.root);
|
idcode = groupname_to_code(filelist->filelist.root);
|
||||||
|
|
||||||
lb = which_libbase(G.main, idcode);
|
lb = which_libbase(bmain, idcode);
|
||||||
if (lb == NULL) return;
|
if (lb == NULL) return;
|
||||||
|
|
||||||
filelist->filelist.nbr_entries = 0;
|
filelist->filelist.nbr_entries = 0;
|
||||||
|
@@ -47,6 +47,7 @@
|
|||||||
#include "BKE_collection.h"
|
#include "BKE_collection.h"
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
#include "BKE_layer.h"
|
#include "BKE_layer.h"
|
||||||
|
#include "BKE_main.h"
|
||||||
#include "BKE_object.h"
|
#include "BKE_object.h"
|
||||||
#include "BKE_scene.h"
|
#include "BKE_scene.h"
|
||||||
#include "BKE_sequencer.h"
|
#include "BKE_sequencer.h"
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
|
|
||||||
static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base)
|
static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *view_layer, Base *base)
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
Object *obact = OBACT(view_layer);
|
Object *obact = OBACT(view_layer);
|
||||||
bool use_all = false;
|
bool use_all = false;
|
||||||
|
|
||||||
@@ -95,7 +97,7 @@ static void do_outliner_activate_obdata(bContext *C, Scene *scene, ViewLayer *vi
|
|||||||
if (ob->type == obact->type) {
|
if (ob->type == obact->type) {
|
||||||
bool ok;
|
bool ok;
|
||||||
if (BKE_object_is_in_editmode(ob)) {
|
if (BKE_object_is_in_editmode(ob)) {
|
||||||
ok = ED_object_editmode_exit_ex(scene, ob, EM_FREEDATA | EM_WAITCURSOR);
|
ok = ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA | EM_WAITCURSOR);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ok = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, EM_WAITCURSOR | EM_NO_CONTEXT);
|
ok = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, EM_WAITCURSOR | EM_NO_CONTEXT);
|
||||||
|
@@ -504,9 +504,9 @@ static int rna_Armature_is_editmode_get(PointerRNA *ptr)
|
|||||||
return (arm->edbo != NULL);
|
return (arm->edbo != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Armature_transform(struct bArmature *arm, float *mat)
|
static void rna_Armature_transform(struct bArmature *arm, Main *bmain, float *mat)
|
||||||
{
|
{
|
||||||
ED_armature_transform(arm, (float (*)[4])mat, true);
|
ED_armature_transform(bmain, arm, (float (*)[4])mat, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@@ -1034,6 +1034,7 @@ static void rna_def_armature(BlenderRNA *brna)
|
|||||||
RNA_def_struct_sdna(srna, "bArmature");
|
RNA_def_struct_sdna(srna, "bArmature");
|
||||||
|
|
||||||
func = RNA_def_function(srna, "transform", "rna_Armature_transform");
|
func = RNA_def_function(srna, "transform", "rna_Armature_transform");
|
||||||
|
RNA_def_function_flag(func, FUNC_USE_MAIN);
|
||||||
RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
|
RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
|
||||||
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
|
parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
|
||||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||||
|
@@ -300,7 +300,7 @@ static void rna_Object_active_shape_update(bContext *C, PointerRNA *ptr)
|
|||||||
break;
|
break;
|
||||||
case OB_CURVE:
|
case OB_CURVE:
|
||||||
case OB_SURF:
|
case OB_SURF:
|
||||||
ED_curve_editnurb_load(ob);
|
ED_curve_editnurb_load(bmain, ob);
|
||||||
ED_curve_editnurb_make(ob);
|
ED_curve_editnurb_make(ob);
|
||||||
break;
|
break;
|
||||||
case OB_LATTICE:
|
case OB_LATTICE:
|
||||||
|
@@ -394,6 +394,7 @@ void WM_keymap_init(bContext *C)
|
|||||||
|
|
||||||
void WM_check(bContext *C)
|
void WM_check(bContext *C)
|
||||||
{
|
{
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
wmWindowManager *wm = CTX_wm_manager(C);
|
wmWindowManager *wm = CTX_wm_manager(C);
|
||||||
|
|
||||||
/* wm context */
|
/* wm context */
|
||||||
@@ -424,7 +425,7 @@ void WM_check(bContext *C)
|
|||||||
/* case: fileread */
|
/* case: fileread */
|
||||||
/* note: this runs in bg mode to set the screen context cb */
|
/* note: this runs in bg mode to set the screen context cb */
|
||||||
if ((wm->initialized & WM_WINDOW_IS_INITIALIZED) == 0) {
|
if ((wm->initialized & WM_WINDOW_IS_INITIALIZED) == 0) {
|
||||||
ED_screens_initialize(wm);
|
ED_screens_initialize(bmain, wm);
|
||||||
wm->initialized |= WM_WINDOW_IS_INITIALIZED;
|
wm->initialized |= WM_WINDOW_IS_INITIALIZED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -572,7 +572,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
|||||||
|
|
||||||
/* we didn't succeed, now try to read Blender file */
|
/* we didn't succeed, now try to read Blender file */
|
||||||
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
|
if (retval == BKE_READ_EXOTIC_OK_BLEND) {
|
||||||
Main *bmain = CTX_data_main(C);
|
|
||||||
int G_f = G.f;
|
int G_f = G.f;
|
||||||
ListBase wmbase;
|
ListBase wmbase;
|
||||||
|
|
||||||
@@ -583,6 +582,10 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
|||||||
/* confusing this global... */
|
/* confusing this global... */
|
||||||
G.relbase_valid = 1;
|
G.relbase_valid = 1;
|
||||||
retval = BKE_blendfile_read(C, filepath, reports, 0);
|
retval = BKE_blendfile_read(C, filepath, reports, 0);
|
||||||
|
|
||||||
|
/* BKE_file_read sets new Main into context. */
|
||||||
|
Main *bmain = CTX_data_main(C);
|
||||||
|
|
||||||
/* when loading startup.blend's, we can be left with a blank path */
|
/* when loading startup.blend's, we can be left with a blank path */
|
||||||
if (BKE_main_blendfile_path(bmain)) {
|
if (BKE_main_blendfile_path(bmain)) {
|
||||||
G.save_over = 1;
|
G.save_over = 1;
|
||||||
@@ -600,12 +603,12 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* match the read WM with current WM */
|
/* match the read WM with current WM */
|
||||||
wm_window_match_do(C, &wmbase, &G.main->wm, &G.main->wm);
|
wm_window_match_do(C, &wmbase, &bmain->wm, &bmain->wm);
|
||||||
WM_check(C); /* opens window(s), checks keymaps */
|
WM_check(C); /* opens window(s), checks keymaps */
|
||||||
|
|
||||||
if (retval == BKE_BLENDFILE_READ_OK_USERPREFS) {
|
if (retval == BKE_BLENDFILE_READ_OK_USERPREFS) {
|
||||||
/* in case a userdef is read from regular .blend */
|
/* in case a userdef is read from regular .blend */
|
||||||
wm_init_userdef(G.main, false);
|
wm_init_userdef(bmain, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval != BKE_BLENDFILE_READ_FAIL) {
|
if (retval != BKE_BLENDFILE_READ_FAIL) {
|
||||||
|
Reference in New Issue
Block a user